text:
*   HTML5 quality selection
*   Improvements to the YouTube quality selection

## v3.0.11

*   Muted and autoplay fixes
*   Small bug fixes from Sentry logs

## v3.0.10

*   Docs fix
*   Package upgrades

## v3.0.9

*   Demo fix
*   Fix Vimeo regression

## v3.0.8

*   Vimeo hotfix for private videos

## v3.0.7

*   Fix for keyboard shortcut error with fast forward
*   Fix for Vimeo trying to set playback rate when not allowed

## v3.0.6

*   Improved the logic for the custom handlers preventing default handlers

## v3.0.5

*   Removed console messages

## v3.0.4

*   Fixes for fullscreen not working inside iframes
*   Fixes for custom handlers being able to prevent default
*   Fixes for controls not hiding/showing correctly on Mobile Safari

## v3.0.3

*   Vimeo offset tweak (fixes #826)
*   Fix for .stop() method (fixes #819)
*   Check for array for speed options (fixes #817)
*   Restore as float (fixes #828)
*   Fix for Firefox fullscreen oddness (Fixes #821)
*   Improve Sprite checking (fixes #827)
*   Fix fast-forward control (thanks @saadshahd)
*   Fix the options link in the readme (thanks @DanielRuf)

## v3.0.2

*   Fix for Safari not firing error events when trying to load blocked scripts

## v3.0.1

*   Fix for trying to accessing local storage when it's blocked

# v3.0.0

This is a massive release. A _mostly_ complete rewrite in ES6. What started out as a few changes quickly snowballed. There's many breaking changes so be careful upgrading.

### Big changes

*   New settings menu complete with funky animations
*   Ability to adjust speed of playback
*   Ability to toggle caption language (HTML5 and Vimeo only)
*   Ability to set YouTube quality (HTML5 will follow)
*   Added support for Vimeo captions
*   Added Picture-in-Picture support (Safari only)
*   Added AirPlay support (again, Safari only)
*   Added `playsinline` support for iOS 10+
*   Soundcloud removed until I can work on a plugin framework
*   Embedded players are now progressively enhanced - no more empty `<div>`s!

### Other stuff

*   Now using SASS exclusively. Sorry, LESS folk it just made sense to maintain one method as SASS is what the cool kids use. It may come back if we work out an automated way to convert the SASS
*   Moved to ES6. All the rage these days. You'll need to look at polyfills. The demo uses [polyfill.io](https://polyfill.io)
*   Added basic looping support
*   Added an aspect ratio option for those that can't leave the 90s and want 4:3
*   `controlshidden` and `controlsshown` events added for when the controls show or hide
*   `qualityrequested` and `qualitychange` events for YouTube quality control (HTML5 will follow)
*   Volume is now `0` to `1` as per HTML5 spec
*   No longer bodging a `<progress>` behind the `<input type="range">` to make up for WebKit's lack of lower fill styling
*   Captions now render with line breaks as intended
*   Captions now render without AJAX using the native events etc
*   Added a fallback for getting YouTube video data incase `.getVideoData()` disappears when one of their developers randomly deletes it again
*   Setup and building of the UI should be way "snappier"
*   Click to toggle inverted time (e.g. 0:01 or -2:59 for a 3 minute video at 1 seconds) - new `toggleInvert` and `invertTime` options
*   Added `autopause` option for Vimeo
*   Added `muted` option for you guessed it, muted playback
*   Restored the `.off()` API method
*   `.play()` will now return a promise to prevent that pesky uncaught promise issue in Chrome etc
*   Pressing and hold the seek bar no longer freezes all other updates of the UI

...plus loads of bug fixes.

### Breaking changes

You gotta break eggs to make an omelette. Sadly, there's quite a few breaking changes:

*   Setup now uses proper constructor, accepts a single selector/element/node and returns a single instance - much simpler than before
*   Much of the API is now using getters and setters rather than methods (where it makes sense) to match the HTML5 API - see the docs for more info
*   The data attributes for the embeds are now `data-plyr-provider` and `data-plyr-embed-id` to prevent compatibility issues. These can be changed under `config.attributes.embed` if required
*   `blankUrl` -> `blankVideo`
*   `volume` is now `0` to `1` as per HTML5 spec
*   `keyboardShorcuts` (typo) is now just `keyboard`
*   `loop` is now `loop.active` in preparation for loop enhancements later
*   `html` option for custom controls removed in favour of the `controls` option which now accepts an array (to use built in controls) or a string of HTML for custom controls.
*   `classes` -> `classNames`
*   `classes.videoWrapper` -> `classNames.video`
*   `classes.embedWrapper` -> `classNames.embed`
*   `classes.ready` removed
*   `classes.setup` removed
*   `classes.muted` removed
*   `classes.fullscreen.active` removed in favour of the `:fullscreen` selector
*   `selectors.html5` removed
*   `selectors.embed` removed
*   `selectors.buttons.seek` -> `selectors.inputs.seek`
*   `selectors.volume.input` -> `selectors.inputs.volume`
*   `selectors.volume.display` -> `selectors.display.volume`
*   `selectors.currentTime` -> `selectors.display.currentTime`
*   `selectors.duration` -> `selectors.display.duration`

### Polyfilling

Because we're using the fancy new ES6 syntax, you will need to polyfill for vintage browsers if you want to use Plyr and still support them. Luckily there's a decent service for this that makes it painless, [polyfill.io](https://polyfill.io). Alternatively, you can use the prebuilt polyfilled build but bear in mind this is 20kb larger. I'd suggest working our your own polyfill strategy.

## v2.0.18

*   Fix for YouTube .getVideoData() issue (fixes #709)

## v2.0.17

*   Vimeo controls fix (fixes #697)
*   SVG4everybody compatibility fix
*   Allow Plyr.setup event listeners to be set up as separate event listeners (https://github.com/sampotts/plyr/pull/703)
*   Added title to the layer html template (for custom controls) (https://github.com/sampotts/plyr/pull/649)
*   Target is null bug fix (https://github.com/sampotts/plyr/pull/617)
*   fix #684 memory leaks issues after destroy (https://github.com/sampotts/plyr/pull/700)

## v2.0.16

*   Fullscreen bug fix (fixes #664)

## v2.0.15

*   Demo fix

## v2.0.14

*   CDN URL updates. Sorry, still working on V3 as hard as I can...

## v2.0.13

*   Repo moved and Vimeo demo fix

## v2.0.12

*   Ability to set custom `blankUrl` for source changes (https://github.com/sampotts/plyr/pull/504)
*   Ability to set caption button listener (https://github.com/sampotts/plyr/pull/468)

## v2.0.11

*   Fix for `cleanUp` being called twice (thanks to @sebastiancarlsson)
*   Fix for YouTube controls on iPad (fixes #391)

## v2.0.10

*   Added seek event fixes for Vimeo and YouTube (fixes #409)
*   Added support for embed URLs rather than ID only (fixes #345)

## v2.0.9

*   Temporary patch for the YouTube API issues with `getDuration()` (relates to #374)

## v2.0.8

*   Added `isPaused()` API method (thanks to @darrena092)
*   Allowed `.on()` API method to be chainable (thanks to @gurupras) (fixes #357)
*   Improved the "awful" rendering of captions on small screens in fullscreen mode (fixes #390)
*   Fix for Firefox VTT compatibility (thanks to @magourex)
*   Fix for Firefox Developer Edition blank video due to `-webkit-mask-image` issue (fixes #392)
*   Added Issue and PR templates with the aim of reducing duplicate or duff issues

## v2.0.7

*   Fixed `getCurrentTime()` method (fixes #351)
*   Added `getVolume()` , `isMuted()` and `getDuration()` API methods (fixes #346)

## v2.0.6

*   Fixed merge issue with `Updated define to work with AMD imports #326` PR
*   Code formatting

## v2.0.5

*   Fix for Vimeo in IE9 & IE10
*   Fix for HTML5 elements not firing `ready` event

## v2.0.4

*   Fix for Firefox full screen (fixes #343)

## v2.0.3

*   Set 'global' keyboard shortcut option to false as default, added `<textarea>` to editable elements to be ignored

## v2.0.2

*   Added 'global' keyboard shortcut option

## v2.0.1

*   Version bump for NPM (sorry for folks who upgraded to the now deleted v1.9.0 through NPM)

# v2.0.0

This version contains several potential **_breaking changes_**:

*   `setup()` has been reverted to pre v1.8.0 behaviour; meaning it will return the _instance_ rather than the _element_. This is because the reference to the instance is no longer added to the original element (see below).
*   The reference to the `plyr` instance is now added to the media element rather than original container. This is because if a container with multiple children was passed to `setup()` the references to all instances would have been added to the container, creating issues. I would recommend using the return value from `setup()` or the new `get()` method to access the instance.
*   Players will always be wrapped in their own div now - this makes `setup()` and `destroy()` cleaner. This _may_ break any custom styling based on DOM position.
*   Players no longer seek to 0 on 'ended' - this is to fix a bug with Microsoft Edge as it triggers 'ended' on media change for whatever reason. They'll never change ;-)

And some other changes and bug fixes:

*   New `get()` method on the global plyr object to get all instances inside a container
*   New API methods: - `getOriginal()` to get the original, _unmodified_ element plyr was setup on (`<video>`, `<audio>` or empty `<div>` for YouTube and Vimeo) - `getContainer()` to get the players outer wrapper element - `getMedia()` to get the players media element (`<video>`, `<audio>` or empty `<div>` for YouTube and Vimeo) - `getEmbed()` to access the YouTube or Vimeo API directly - `getType()` to get the type of the player - `isReady()` to determine if an instance has completed setup and necessary APIs are loaded (for YouTube / Vimeo) - `on()` to provide an easy way to listen to events - `stop()` to, you guessed it, stop the player
*   `destroy()` now works correctly for YouTube and Vimeo (fixes #272)
*   New `destroyed` event when `destroy()` has completed (original element is passed as event.target)
*   Default volume is now 10 (max) rather than 5
*   Sprite is only loaded once (fixes #259)
*   Fixes for Vimeo post message bugs on source change or destroy (fixes #318)
*   Save caption state in storage (fixes #311)
*   Added keyboard shortcuts to the current focused player (with `keyboardShortcuts` boolean option to disable) (fixes #309)
*   Fix for captions bug (fixes #332)
*   Change to AMD (fixes #298)

## v1.8.12

*   Vimeo keyboard focus fix (Fixes #317)
*   Fix for Vimeo on basic support devices

## v1.8.11

*   Fix for keyboard navigation on Vimeo (Fixes #317)
*   Fix for bug introduced in v1.8.9 related to additional controls
*   Vimeo API upgrade
*   Fix for YouTube bug introduced in v1.8.9
*   Added support for passing array to .setup() (Fixes #319)

## v1.8.10

*   Fix for seek issues introduced in v1.8.9

## v1.8.9

*   Fix for fullscreen not being defined (Fixes #295)
*   Fix for multiline captions (Fixes #314)
*   Clean up of type checks and fix for `restart()` (Fixes #315)
*   Fix for `MEDIA_ERR_SRC_NOT_SUPPORTED` when calling `.source()` API method

## v1.8.8

*   Added getCurrentTime API method (fixes #292)
*   Fix for !hideControls on touch devices (fixes #303)

## v1.8.7

*   Line height fix

## v1.8.6

*   Reverted font size change

## v1.8.5

*   Fixed overflow issues (fixes #286)

## v1.8.4

*   Fix for large play button on small videos

## v1.8.3

*   Disabled iPad support for YouTube and Vimeo due to iOS limitations with iFrame playback
*   Fixed IE11 icon loading (fixes #269)
*   Updated screenshot (fixes #281)
*   Added WordPress plugin (fixes #239)
*   Added Neos plugin
*   Added HLS, Shaka and dash.js examples (see #235 for more)
*   Improvements for controls hiding and showing on touch devices

## v1.8.2

*   Fixed event bubbling

## v1.8.1

*   Fixed inaccurate log message

# v1.8.0

*   **_(Important)_** `setup()` now returns the element Plyr was setup on rather than the `plyr` object. This means `var player = plyr.setup()[0];` would now be `var player = plyr.setup()[0].plyr;`. This improves support for React and other virtual dom frameworks as mentioned in #254
*   Fixed using a relative URL for `iconUrl` in IE (fixes #269)

# v1.7.0

*   SASS cleanup (fixes #265)
*   Docs tidy up to help quick start (fixes #253)
*   Fix for issues with data attribute options passing (fixes #257)
*   **_(Important)_** Removed the requirement for a wrapper div to setup Plyr and removed the dependency on the `plyr` classname as a JS hook. By default it will now look for `<video>`, `<audio>` and `[data-type]` elements. If you are just calling `setup()` with a `<div class="plyr">` you may want to give it a good test after upgrading. You can probably remove the wrapper div. The reason behind this is to make setup easier for newcomers and prevent the styling being used on unsupported players (because the plyr classname was used as a CSS and JS hook - which isn't ideal)
*   Renamed the 'docs' folder to `demo` to avoid confusion - the readme is the docs after all

## v1.6.20

*   Fix for multiple sprites being requested (fixes #259)

## v1.6.19

*   Fix for scroll direction issues on volume control (fixes #258)

## v1.6.18

*   Reduced rounding of seek value from 1 decimal point to 4 (fixes #242)

## v1.6.17

*   Added `disableContextMenu` option to hide the right click context menu (fixes #248 and #225)

## v1.6.16

*   Always hide standard controls (fixes #225)
*   Fix for Tooltips overflowing (fixes #230)

## v1.6.15

*   Restore scroll position when exiting full screen (fixes #236)

## v1.6.14

*   SVG sprite loading automatically for an easier setup
*   Touch devices now show controls on touch rather than pausing playback

## v1.6.13

*   Decreased sensitivity and inverted scroll on volume slider (scroll up to increase, down to decrease)

## v1.6.12

*   Fix for undefined buffer error
*   Add scroll listener on volume slider (PR #227 bty @igoradamenko)

## v1.6.11

*   Fix for Vimeo fullscreen (fixes #214)

## v1.6.10

*   Changed default icon prefix from 'icon' to 'plyr' to avoid clashes

## v1.6.9

*   Added 'latest' CDN option
*   Renamed `sprite.svg` to `plyr.svg` to be inline with the other package files

## v1.6.8

*   Fix for bug introduced in v1.6.7

## v1.6.7

*   Fixes for using `source` API method on iOS

## v1.6.6

*   Icons cleaned up
*   IE11 button fix for tooltips (fixes #210)

## v1.6.5

*   IE UI bug fixes

## v1.6.4

*   Bug fix for undefined progress bar

## v1.6.3

*   Seek back to 0 for all media on ended
*   Check for HTML5 video on ended reload
*   Update to docs for `showPosterOnEnd` option

## v1.6.2

*   Fix for tooltip displaying when duration is not set (fixes #177)
*   `showPosterOnEnd` option to show poster when HTML5 video ended (fixes #59)
*   Error handler for YouTube (fixes #189)
*   Initial SoundCloud support (fixes #194)
*   Other minor bug fixes

## v1.6.1

*   Tooltip changes for accessibility

## v1.6.0

*   New, cleaner, UI: - Controls are now overlaid, maintaining the video's ratio and making sizing easier - A large play button can now be overlaid over videos - Default number of control buttons reduced - New play, pause, rewind and fast forward icons - Flexbox all the things!
*   Tidied up the LESS (and SCSS) as part of the above, variables and mixins in seprate files amking customization and upgrades easier
*   Toggle mute bug fix; if a player was muted previously and the user refreshed, unmuting would have meant volume was still zero (effectively muted), now the config default value is used. Not ideal but good for now
*   New `iconUrl` option allowing specifying a same origin SVG sprite location. Loading this way means you don't need the AJAX sprite loading JavaScript
*   `click` option renamed to `clickToPlay` to make it a bit more self explanatory. Unfortunately cross origin SVG sprites is not supported in any browser yet :-(
*   `hideControls` is now a global option, rather than being exclusive to fullscreen. Controls are now hidden after 2 seconds of no mouse movement. Controls are always shown when media is paused or stopped. This is defaulted to true.
*   `sass` folder in `src` renamed from to `scss`

## v1.5.21

*   Bug fix for embeds: `play` not being defined (fixes #185 and #186)

## v1.5.20

*   Bug fix for autoplay option

## v1.5.19

*   Fix for accessing `embed` property after `ready` event fired

## v1.5.18

*   Added 'ready' event for initial setup complete or source change occurs
*   Fixed SASS stylesheet references to transparentize
*   Added default font stack to controls
*   Docs fixes inc controls HTML (fixes #180)

## v1.5.17

*   Expose YouTube and Vimeo API (docs update required) (fixes #176)
*   Auto set title based on YouTube getVideoData() title property
*   Bug fix for Vimeo API change (Uncaught TypeError: Cannot read property 'value' of undefined) due to a change their end

## v1.5.16

*   Cancel requests on source change (fixes #174)

## v1.5.15

*   Fix for CustomEvent polyfill and related bug (see #172)

## v1.5.14

*   Volume storage fix (fixes #171)

## v1.5.13

*   Fix for manual caption rendering

## v1.5.12

*   Added a duration option to pass the duration of the file
*   Added the ability to set options per element by setting a data-plyr attribute on the target elements (this might be useful for the duration option for example)
*   Fixes for Chrome and Safari caption rendering, they now use the default texttrack and cuechange events
*   Firefox bug fix for event not defined

## v1.5.11

*   iOS embed bug fixes (fixes #166)
*   Hide IE/Edge <input type='range'> tooltip (since we have a styled one) (fixes #160)
*   SASS bug fix for default values (fixes #158)

## v1.5.9 + v1.5.10

*   NPM bug fixes

## v1.5.8

*   Fix for touch device seek tooltip
*   Seek improvements

## v1.5.7

*   Fix for control tooltips always showing

## v1.5.6

*   Seek tooltip (option for tooltips changed, please check docs)
*   SASS compile error fixes (fixes #148)
*   Fullscreen fixes for controls not always hiding/showing (fixes #149)
*   Screen reader icon fixes (title was being read twice due to the tooltip/hidden label)

## v1.5.5

*   Fixed controls.md example
*   Bug fix for docs error page
*   Bug fix for controls tooltips

## v1.5.4

*   Minor bug fix for clicking video to play/pause after source change

## v1.5.3

*   Minor bug fix for occasional display of 0:00 as the media duration

## v1.5.2

*   `handlers` option renamed to `listeners`
*   Added event listeners for all types to the plyr container (playback, fullscreen, captions etc - see docs)
*   Removed onSetup config option (use the 'setup' event instead, plyr element is event.plyr)
*   Style bug fixes
*   Vimeo seek bug fix (requires whole seconds when seeking)
*   Fix for fullscreen player (using class hook, not browser fullscreen)

## v1.5.1

*   Fix for event listeners being duplicated on source change

# v1.5.0

*   Vimeo support (fixes #8)
*   New options for initialization (you can now pass a selector, HTMLElement or NodeList) (fixes #118)
*   Switched to BEM methodology (you will need to change CSS and probably HTML)
*   Decoupled CSS and JS hooks (fixes #129)
*   Custom controls container (fixes #98)
*   Fix for private/incognito mode local storage bug (fixes #131)
*   UMD module setup (fixes #121)
*   Specify iframe title for Vimeo and YouTube (fixes #124)
*   Better handling of mission controls (fixes #132)
*   Retain classname on source change (fixes #120)
*   Increased thumb size on seek (partially fixes #130)
*   Passing no argument to `source` api method, now returns current source (by @gurupras)
*   Ability to add custom handlers to controls prior to Plyr bindings (by @gurupras)
*   Keyboard navigation improvements (focus on seek, focus trap in fullscreen) (fixes #135)

## v1.3.5

*   Fixed bug with API use on basic supported browsers

## v1.3.4

*   Code cleanup by @calvintam236

## v1.3.3

*   Removed captions being read by screen readers

## v1.3.2

*   Voiceover fix for captions

## v1.3.1

*   ARIA improvements for captions being read

## v1.3.0

*   Internationalization support (i18n) using default controls (required markup changes to controls)
*   ARIA enhancements for controls (required markup changes to controls)
*   Captions legibility improvements
*   YouTube bug fixes

## v1.2.6

*   SASS updates and fixes (cheers @ChristianPV)

## v1.2.5

*   Fix for YouTube quality (let them decide quality)

## v1.2.4

*   Fix for omitted kind attribute on <track> (fixes #88)

## v1.2.3

*   Fix for YouTube on iPhone or unsupported browsers (fallback to YouTube native)
*   Docs tidy up
*   Fullscreen for Safari fix (fixes #96)

## v1.2.2

*   Fix for :focus keyboard vs mouse (fixes #61)
*   Fix for caption positioning in full screen (fixes #92)

## v1.2.1

*   Tooltip bug fix

# v1.2.0

*   Added YouTube support

## v1.1.13

*   Added icon prefix option for when using default controls

## v1.1.13

*   Logic tweaks for hiding controls in fullscreen

## v1.1.12

*   Bug fix for Chrome Canary

## v1.1.11

*   Bug fix

## v1.1.10

*   Bug fix

## v1.1.9

*   Bug fix for 1.1.8

## v1.1.8

*   setVolume API method improvements (fixes #83)

## v1.1.7

*   Restore classname on destroy()

## v1.1.6

*   New API methods (fixes #77), Fix for non strict mode (fixes #78)

## v1.1.5

*   Fix for incorrect `isFullscreen()` return value in Mozilla (fixes #38)

## v1.1.4

*   Minor bug fixes

## v1.1.3

*   Fixes for random id used in controls with multiple instances and one call to setup
*   Audio player UI improvements

## v1.1.2

*   Added an onSetup callback option
*   Added fullscreen API methods `toggleFullscreen()` (must be user iniated), and `isFullscreen()`

## v1.1.1

*   Fix for unsupported browser handling
*   Fix for config.controls having no effect

## v1.1.0

*   Added config option to set which controls are shown (if using the default controls html) and better handling of missing controls

## v1.0.31

*   Display duration on `metadataloaded`

## v1.0.30

*   Fixed bug with media longer than 60 minutes (fixes #69)

## v1.0.29

*   Added option to hide controls on fullscreen (default `true`) while palying, after 1s. Pause, mouse hover on progress, or focus on a child control re-shows the controls. On touch a tap of the video (which plays/pauses the video by default) is required. (fixes #47)
*   Fixed a bug with caption toggle in 1.0.28

## v1.0.28

*   Added API support for browsers that don't have full plyr support (pretty much <=IE9 and `<video>` on iPhone/iPod)

## v1.0.27

*   Keyboard accessibility improvements (fixes #66)

## v1.0.26

*   Fixes for SASS (cheers @brunowego)
*   Indentation reset to 4 spaces

## v1.0.25

*   Fixes for iOS volume controls (hidden)
*   Classnames for left/right controls changed

## v1.0.24

*   Added tooltip option to display labels as tooltips (fixes #50)

## v1.0.23

*   Handling loading states in the UI (fixes #36)

## v1.0.22

*   Added support() API method for checking mimetype support
*   Added source() API method for setting media source(s) (fixes #44)
*   Added poster() API method for setting poster source
*   Refactored captions logic for manual captions

## v1.0.21

*   Added an <input type="range"> for seeking to improve experience (and support dragging) (fixes #40, #42)
*   Icons for restart and captions improved (and some IDs changed) (fixes #49)

## v1.0.20

*   Default controls included (Fixes #45)
*   Volume changes on `input` as well as `change` (fixes #43)
*   Fix for undefined Play text
*   License changed to MIT

## v1.0.19

*   Fixed firefox fullscreen issue (fixes #38)

## v1.0.18

*   Added CDN references

## v1.0.17

*   SASS support added (thanks to @brunowego)
*   Docs completely separated to avoid any confusion
*   New gulp tasks (will add more documentation for this)

## v1.0.16

*   Aria label is now dynamic

## v1.0.15

*   Fix for seek time display in controls
*   More documentation for controls html

## v1.0.14

*   Minor change for bootstrap compatibility

## v1.0.13

*   Minor tweaks

## v1.0.12

*   Handle native events (issue #34)

## v1.0.11

*   Bug fixes for fullscreen mode

## v1.0.10

*   Bower includes src files now
*   Folder re-arrangement

## v1.0.9

*   Added buffer progress bar
*   Fixed Safari 8 caption track (it needs to be removed from the DOM like in Safari 7)
*   Added validation (it works or it doesn't basically) of the `html` option passed

## v1.0.8

*   Bug fix

## v1.0.7

*   Storing user selected volume in local storage

## v1.0.6

*   Fullscreen fallback for older browsers to use "full window"

## v1.0.5

*   More minor bug fixes and improvements

## v1.0.4

*   Fixed caption legibility issues

## v1.0.3

*   Minor bug fixes

## v1.0.2

*   Added OGG to <audio> example for Firefox
*   Fixed IE11 fullscreen issues

## v1.0.1

*   Bug fixes for IE (as per usual)
*   Added CSS hooks for media type
*   Return instances of Plyr to the element

## v1.0.0

*   Initial release


text:
({
    /**
     * Basic validation of helper definition client side.
     * Verify the methods you expect to see and also methods that you don't expect to see.
     */
    testGetHelper: {
        test: function(component){
            var helper = component.getDef().getHelper();
            $A.test.assertNotUndefinedOrNull(helper);
            $A.test.assertNotUndefinedOrNull(helper.a);
            $A.test.assertNotUndefinedOrNull(helper.b);
            $A.test.assertUndefinedOrNull(helper.c);
        }
    },

    testGetHelperDef: {
        test: function(component){
            var helperDef = component.getDef().getHelperDef();
            $A.test.assertNotUndefinedOrNull(helperDef);
            $A.test.assertNotUndefinedOrNull(helperDef.getFunctions);
            $A.test.assertNotUndefinedOrNull(helperDef.getFunctions());
            $A.test.assertEquals("HelperDef", helperDef.auraType);
        }
    },

    testFunctions: {
        test: function(component){
            var helper = component.getDef().getHelper();
            $A.test.assertNotUndefinedOrNull(helper);
            $A.test.assertEquals("func A", helper.a());
            $A.test.assertEquals("func B", helper.b());
        }
    },

    /**
     * Assert that components can have additional helper inherited from parents.
     */
    testInheritedFunctions: {
        test: function(component){
            var helper = component.getDef().getHelper();
            $A.test.assertNotUndefinedOrNull(helper);
            $A.test.assertEquals("func Z", helper.z());
            $A.test.assertEquals("func superSuperZ on Super Super", helper.superSuperZ());
        }
    },

    /**
     * Assert helpers are usable in Renderer functions.
     */
    testRender : {
        test : function(component){
            //This property is set in a render method
            //Which proves that the helper made it into the method signature as expected
            $A.test.assertNotUndefinedOrNull(component.renderHelper, "Helper not passed into render()");
            $A.test.assertNotUndefinedOrNull(component.afterRenderHelper, "Helper not passed into afterRender()");
            //Components won't rerender unless they are actually dirty, so forcing it.
            component.set("v.dirty", "1");
            $A.rerender(component);
            $A.test.assertNotUndefinedOrNull(component.rerenderHelper, "Helper not passed into rerender()");
            $A.test.assertEquals("func A", component.rerenderHelper.a());
            $A.unrender(component);
            $A.test.assertNotUndefinedOrNull(component.unrenderHelper, "Helper not passed into unrender()");
        }
    },

    /**
     * Assert helpers are usable in client controllers.
     */
    testAction : {
        test : function(component){
            //This property is set in an action
            //Which proves that the helper made it into the action signature as expected
            component.get("c.myAction").runDeprecated();
            $A.test.assertNotUndefinedOrNull(component.myActionHelper);
            $A.test.assertEquals("func A", component.myActionHelper.a());
        }
    },

    /**
     * Assert that helpers can accept and process arguments.
     */
    testPassingArguments: {
        test : function(component){
            var helper = component.getDef().getHelper();
            $A.test.assertNotNull(helper);
            var argument = 'Aura';
            $A.test.assertEquals("Argument passed="+argument, helper.methodWithArgs(argument), "Passing arguments to helpers failed.");
        }
    },

    /**
     * Assert that helper are not exposed as global functions.
     */
    testHelpersAreNotExposedGlobally: {
        test : function(component){
            var helper = component.getDef().getHelper();
            $A.test.assertTrue($A.util.isFunction(helper.methodWithArgs));
            $A.test.assertFalse($A.util.isFunction(window.methodWithArgs), "Helper methods exposed on window");
            $A.test.assertFalse($A.util.isFunction(window.setFocus), "Helper methods exposed on window");
            $A.test.assertTrue($A.util.isFunction(helper.setFocus));
            $A.test.assertEquals("Set Focus", helper.setFocus());
        }
    }
})

redpajama_set_name: RedPajamaGithub


text:
package net.spy.memcached.ops;

import net.spy.memcached.tapmessage.ResponseMessage;
import net.spy.memcached.tapmessage.TapOpcode;

/**
 * Tap operation.
 */
public interface TapOperation extends Operation {

  /**
   * Operation callback for the tap dump request.
   */
  interface Callback extends OperationCallback {
    /**
     * Callback for each result from a get.
     *
     * @param message the response message sent from the server
     */
    void gotData(ResponseMessage message);

    void gotAck(TapOpcode opcode, int opaque);
  }

  void streamClosed(OperationState state);
}


text:
The icons come from the open-iconic collection available at: https://useiconic.com/
Only the icons that are used in the Getting Started widget have been included here.


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace Plantr_v2.Models
{
    public class Soul
    {
        public int Id { get; set; }

        // Name
        [Required(ErrorMessage = "A First Name is Required")]
        public string FirstName { get; set; }

        [Required(ErrorMessage = "A Last Name is Required")]
        public string LastName { get; set; }

        // Address Info
        [Required(ErrorMessage = "An Address is Required")]
        public string Address { get; set; }

        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string AptNumber { get; set; }

        [Required(ErrorMessage = "A City is Required")]
        public string City { get; set; }

        [Required(ErrorMessage = "A Zip Code is Required")]
        public int Zip { get; set; }

        public string Phone { get; set; }
    }
}


text: [title]


text:
all: max min

max:
	webpack

min:
	UGLIFY=true webpack


text:
<wicket:panel xmlns:wicket="http://wicket.apache.org">

</wicket:panel>


text:
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Runtime.Serialization;

namespace Alchemy4Tridion.Plugins.Clients.CoreService
{
	[GeneratedCode("System.Runtime.Serialization", "4.0.0.0"), DebuggerStepThrough, DataContract(Name = "WorkflowManagerFilterData", Namespace = "http://www.sdltridion.com/ContentManager/R6"), KnownType(typeof(ApprovalStatusesFilterData)), KnownType(typeof(ProcessDefinitionsFilterData)), KnownType(typeof(UserWorkItemsFilterData)), KnownType(typeof(ProcessDefinitionAssociationsFilterData)), KnownType(typeof(ProcessesFilterData)), KnownType(typeof(ActivityInstancesFilterData))]
	public class WorkflowManagerFilterData : SystemWideListFilterData
	{
	}
}


text:
import * as path from 'path';
import commonPathPrefix from 'common-path-prefix';
import * as ts from 'typescript';
import convert from 'convert-source-map';

// returned by CScript sys environment
const UNSUPPORTED_FILE_ENCODING_ERR_CODE = -2147024809;

/* beautify preserve:start */
export const keyByPath = (map, file) => Object.assign(map, { [file.path]: file });
/* beautify preserve:end */

/* eslint-disable class-methods-use-this, immutable/no-mutation */
export default class CompilerHost {

  outFiles = {};

  constructor(input, compilerOpts) {
    this.files = input.reduce(keyByPath, {});
    this.compilerOpts = compilerOpts;
  }

  useCaseSensitiveFileNames() {
    return ts.sys.useCaseSensitiveFileNames;
  }

  getNewLine() {
    return ts.getNewLineCharacter(this.compilerOpts);
  }

  getDefaultLibLocation() {
    return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath()));
  }

  getDefaultLibFileName(options) {
    return ts.combinePaths(this.getDefaultLibLocation(), ts.getDefaultLibFileName(options));
  }

  getCurrentDirectory() {
    return ts.sys.getCurrentDirectory();
  }

  getCanonicalFileName(fileName) {
    return this.useCaseSensitiveFileNames() ? fileName : fileName.toLowerCase();
  }

  fileExists(fileName) {
    return !!this.files[fileName] || ts.sys.fileExists(fileName);
  }

  readFile(fileName) {
    if (this.files[fileName]) {
      return this.files[fileName].data;
    }

    return ts.sys.readFile(fileName);
  }

  getSourceFile(fileName, languageVersion, onError) {
    let text = null;

    if (this.files[fileName]) {
      text = this.files[fileName].data;
    } else {
      try {
        text = ts.sys.readFile(fileName, this.compilerOpts.charset);
      } catch (e) {
        if (onError) {
          onError(e.number === UNSUPPORTED_FILE_ENCODING_ERR_CODE ?
            ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText :
            e.message);
        }
        text = '';
      }
    }

    if (text !== null) {
      return ts.createSourceFile(fileName, text, languageVersion, this.setParentNodes);
    }
  }

  writeFile(fileName, data) {
    this.outFiles[fileName] = {
      path: fileName,
      data,
      map: null
    };
  }

  emitFiles() {
    const files = Object.keys(this.outFiles);
    const commonPath = commonPathPrefix(files);
    const currentDir = this.getCurrentDirectory();

    return files.reduce((emitted, file) => {
      const sourceFile = this.outFiles[file];
      const sourceRelativePath = path.relative(commonPath, path.dirname(file));
      const sourceRoot = path.join(
        path.relative(path.dirname(file), currentDir),
        path.relative(currentDir, commonPath),
      );

      if (file.endsWith('.map')) {
        const sourceMap = JSON.parse(sourceFile.data);

        // eslint-disable-next-line no-magic-numbers
        this.outFiles[file.substring(0, file.length - 4)].map = {
          ...sourceMap,
          sourceRoot,
          sources: sourceMap.sources.map((source) => path.join(sourceRelativePath, source))
        };
      } else {
        const sourceMap = convert.fromSource(sourceFile.data, true);

        if (sourceMap) {
          sourceMap.setProperty('sourceRoot', sourceRoot)
            .setProperty('sources', sourceMap.getProperty('sources')
              .map((source) => path.join(sourceRelativePath, source)));

          // eslint-disable-next-line no-magic-numbers
          sourceFile.data = `${convert.removeComments(sourceFile.data)}\n${sourceMap.toComment()}`;
        }

        emitted.push(sourceFile);
      }

      return emitted;
    }, []);
  }
}


text:
from django.http import QueryDict

from ..base import BaseTestCase

class RequestPanelTestCase(BaseTestCase):
    panel_id = "RequestPanel"

    def test_non_ascii_session(self):
        self.request.session = {"où": "où"}
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        self.assertIn("où", self.panel.content)

    def test_object_with_non_ascii_repr_in_request_params(self):
        self.request.path = "/non_ascii_request/"
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        self.assertIn("nôt åscíì", self.panel.content)

    def test_insert_content(self):
        """
        Test that the panel only inserts content after generate_stats and
        not the process_request.
        """
        self.request.path = "/non_ascii_request/"
        response = self.panel.process_request(self.request)
        # ensure the panel does not have content yet.
        self.assertNotIn("nôt åscíì", self.panel.content)
        self.panel.generate_stats(self.request, response)
        # ensure the panel renders correctly.
        content = self.panel.content
        self.assertIn("nôt åscíì", content)
        self.assertValidHTML(content)

    def test_query_dict_for_request_in_method_get(self):
        """
        Test verifies the correctness of the statistics generation method
        in the case when the GET request is class QueryDict
        """
        self.request.GET = QueryDict("foo=bar")
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        # ensure the panel GET request data is processed correctly.
        content = self.panel.content
        self.assertIn("foo", content)
        self.assertIn("bar", content)

    def test_dict_for_request_in_method_get(self):
        """
        Test verifies the correctness of the statistics generation method
        in the case when the GET request is class Dict
        """
        self.request.GET = {"foo": "bar"}
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        # ensure the panel GET request data is processed correctly.
        content = self.panel.content
        self.assertIn("foo", content)
        self.assertIn("bar", content)

    def test_query_dict_for_request_in_method_post(self):
        """
        Test verifies the correctness of the statistics generation method
        in the case when the POST request is class QueryDict
        """
        self.request.POST = QueryDict("foo=bar")
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        # ensure the panel POST request data is processed correctly.
        content = self.panel.content
        self.assertIn("foo", content)
        self.assertIn("bar", content)

    def test_dict_for_request_in_method_post(self):
        """
        Test verifies the correctness of the statistics generation method
        in the case when the POST request is class Dict
        """
        self.request.POST = {"foo": "bar"}
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        # ensure the panel POST request data is processed correctly.
        content = self.panel.content
        self.assertIn("foo", content)
        self.assertIn("bar", content)

    def test_list_for_request_in_method_post(self):
        """
        Verify that the toolbar doesn't crash if request.POST contains unexpected data.

        See https://github.com/jazzband/django-debug-toolbar/issues/1621
        """
        self.request.POST = [{"a": 1}, {"b": 2}]
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        # ensure the panel POST request data is processed correctly.
        content = self.panel.content
        self.assertIn("[{'a': 1}, {'b': 2}]", content)

    def test_namespaced_url(self):
        self.request.path = "/admin/login/"
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        panel_stats = self.panel.get_stats()
        self.assertEqual(panel_stats["view_urlname"], "admin:login")

    def test_session_list_sorted_or_not(self):
        """
        Verify the session is sorted when all keys are strings.

        See  https://github.com/jazzband/django-debug-toolbar/issues/1668
        """
        self.request.session = {
            1: "value",
            "data": ["foo", "bar", 1],
            (2, 3): "tuple_key",
        }
        data = {
            "list": [(1, "value"), ("data", ["foo", "bar", 1]), ((2, 3), "tuple_key")]
        }
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        panel_stats = self.panel.get_stats()
        self.assertEqual(panel_stats["session"], data)

        self.request.session = {
            "b": "b-value",
            "a": "a-value",
        }
        data = {"list": [("a", "a-value"), ("b", "b-value")]}
        response = self.panel.process_request(self.request)
        self.panel.generate_stats(self.request, response)
        panel_stats = self.panel.get_stats()
        self.assertEqual(panel_stats["session"], data)


text:
void print(int low, int high, int val, int total);

int sortints(int in, int range);

void chart(int argc, char* argv[]);

#endif


text:
(function () {
  d3.svg.multibrush = function() {

    // From d3/scale/scale.js
    function d3_scaleExtent(domain) {
      var start = domain[0], stop = domain[domain.length - 1];
      return start < stop ? [ start, stop ] : [ stop, start ];
    }
    function d3_scaleRange(scale) {
      return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
    }

    // From d3
    var d3_document = this.document;
    function d3_documentElement(node) {
      return node && (node.ownerDocument || node.document || node).documentElement;
    }
    function d3_window(node) {
      return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView);
    }
    if (d3_document) {
      try {
        d3_array(d3_document.documentElement.childNodes)[0].nodeType;
      } catch (e) {
        d3_array = function(list) {
          var i = list.length, array = new Array(i);
          while (i--) array[i] = list[i];
          return array;
        };
      }
    }

    function d3_eventPreventDefault() {
      d3.event.preventDefault();
    }

    function d3_vendorSymbol(object, name) {
      if (name in object) return name;
      name = name.charAt(0).toUpperCase() + name.slice(1);
      for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
        var prefixName = d3_vendorPrefixes[i] + name;
        if (prefixName in object) return prefixName;
      }
    }
    var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ];

    var d3_event_dragSelect = "onselectstart" in document ? null : d3_vendorSymbol(document.documentElement.style, "userSelect"), d3_event_dragId = 0;
    function d3_event_dragSuppress(node) {
      var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window(node)).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault);
      if (d3_event_dragSelect == null) {
        d3_event_dragSelect = "onselectstart" in node ? false : d3_vendorSymbol(node.style, "userSelect");
      }
      if (d3_event_dragSelect) {
        var style = d3_documentElement(node).style, select = style[d3_event_dragSelect];
        style[d3_event_dragSelect] = "none";
      }
      return function(suppressClick) {
        w.on(name, null);
        if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
        if (suppressClick) {
          var off = function() {
            w.on(click, null);
          };
          w.on(click, function() {
            d3_eventPreventDefault();
            off();
          }, true);
          setTimeout(off, 0);
        }
      };
    }

    var event = d3.dispatch("brushstart", "brush", "brushend"),
      brushElement,
      x = null, // x-scale, optional
      y = null, // y-scale, optional
      xExtent = [[0, 0]], // [x0, x1] in integer pixels
      yExtent = [[0, 0]], // [y0, y1] in integer pixels
      xExtentDomain = [], // x-extent in data space
      yExtentDomain = [], // y-extent in data space
      xClamp = true, // whether to clamp the x-extent to the range
      yClamp = true, // whether to clamp the y-extent to the range
      resizes = d3_svg_brushResizes[0],
      resizeAdaption = function () {}, // Function to 'call' on new resize selection
      extentAdaption = function () {}; // Function to 'call' on new extent selection

    event.of = function(thiz, argumentz) {
      return function(e1) {
        try {
          var e0 =
            e1.sourceEvent = d3.event;
          e1.target = brush;
          d3.event = e1;
          event[e1.type].apply(thiz, argumentz);
        } finally {
          d3.event = e0;
        }
      };
    };

    function brush(g) {
      g.each(function() {

        // Prepare the brush container for events.
        var g = d3.select(this)
          .style("pointer-events", "all")
          .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)")
          .on("mousedown.brush", brushstart)
          .on("touchstart.brush", brushstart);

        brushElement = g;

        // An invisible, mouseable area for starting a new brush.
        var background = g.selectAll(".background")
          .data([0]);

        background.enter().append("rect")
          .attr("class", "background")
          .style("visibility", "hidden")
          .style("cursor", "crosshair");

        drawExtents(g);

        // When called on a transition, use a transition to update.
        var gUpdate = d3.transition(g),
          backgroundUpdate = d3.transition(background),
          range;

        // Initialize the background to fill the defined range.
        // If the range isn't defined, you can post-process.
        if (x) {
          range = d3_scaleRange(x);
          backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]);
          redrawX(gUpdate);
        }
        if (y) {
          range = d3_scaleRange(y);
          backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]);
          redrawY(gUpdate);
        }
        redraw(gUpdate);
      });
    }

    function drawExtents(g) {
      var ex = xExtent.length > yExtent.length ? xExtent : yExtent,
        i = ex.length
      extentArr = ex.map(function(d,i) { return i; }),
        extentResizes = d3.merge(ex.map(function(d,i) { return resizes.map(function(r) { return [r, i]; }); }));

      if(!g) g = brushElement;

      // The visible brush extent; style this as you like!
      var extent = g.selectAll(".extent")
        .data(extentArr, function (d) { return d; });

      extent.exit().remove();

      extent.enter().append("rect")
        .attr("class", "extent")
        .style("cursor", "move")
        .call(extentAdaption);

      // More invisible rects for resizing the extent.
      var resize = g.selectAll(".resize")
        .data(extentResizes, function (d) { return d[0] + d[1]; });

      // Remove any superfluous resizers.
      resize.exit().remove();

      var newResize = resize.enter().append("g")
        .attr("class", function(d) { return "resize " + d[0]; })
        .style("cursor", function(d) { return d3_svg_brushCursor[d[0]]; });

      newResize.append("rect")
        .attr("x", function(d) { return /[ew]$/.test(d[0]) ? -3 : null; })
        .attr("y", function(d) { return /^[ns]/.test(d[0]) ? -3 : null; })
        .attr("width", 6)
        .attr("height", 6)
        .style("visibility", "hidden");

      newResize.call(resizeAdaption);

      // Show or hide the resizers.
      resize.style("display", function (d) { return brush.empty(d[1]) ? "none" : null; });
    }

    brush.event = function(g) {
      g.each(function() {
        var event_ = event.of(this, arguments),
          extent1 = {x: xExtent, y: yExtent, i: xExtentDomain, j: yExtentDomain},
          extent0 = this.__chart__ || extent1;
        this.__chart__ = extent1;
        event_({type: "brushstart"});
        event_({type: "brush", mode: "resize"});
        event_({type: "brushend"});
      });
    };

    function redraw(g) {
      g.selectAll(".resize").attr("transform", function(d) {
        return "translate(" + xExtent[d[1]][+/e$/.test(d[0])] + "," + yExtent[d[1]][+/^s/.test(d[0])] + ")";
      });
    }

    function redrawX(g) {
      g.selectAll(".extent").attr("x", function (d) { return xExtent[d][0]; });
      g.selectAll(".extent").attr("width", function(d) { return xExtent[d][1] - xExtent[d][0]; });
    }

    function redrawY(g) {
      g.selectAll(".extent").attr("y", function (d) { return yExtent[d][0]; });
      g.selectAll(".extent").attr("height", function (d) { return yExtent[d][1] - yExtent[d][0]; });
    }

    function brushstart() {
      var target = this,
        eventTarget = d3.select(d3.event.target),
        event_ = event.of(target, arguments),
        g = d3.select(target),
        resizing = eventTarget.datum()[0],
        resizingX = !/^(n|s)$/.test(resizing) && x,
        resizingY = !/^(e|w)$/.test(resizing) && y,
        dragging = eventTarget.classed("extent"),
        dragRestore = d3_event_dragSuppress(target),
        center,
        origin = d3.mouse(target),
        offset,
        i;

      var w = d3.select(window)
        .on("keydown.brush", keydown)
        .on("keyup.brush", keyup);

      if (d3.event.changedTouches) {
        w.on("touchmove.brush", brushmove).on("touchend.brush", brushend);
      } else {
        w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend);
      }

      // Interrupt the transition, if any.
      g.interrupt().selectAll("*").interrupt();

      // If the extent was clicked on, drag rather than brush;
      // store the point between the mouse and extent origin instead.
      if (dragging) {
        i = eventTarget.datum();
        origin[0] = xExtent[i][0] - origin[0];
        origin[1] = yExtent[i][0] - origin[1];
      }

      // If a resizer was clicked on, record which side is to be resized.
      // Also, set the origin to the opposite side.
      else if (resizing) {
        var ex = +/w$/.test(resizing),
          ey = +/^n/.test(resizing);

        i = eventTarget.datum()[1];
        offset = [xExtent[i][1 - ex] - origin[0], yExtent[i][1 - ey] - origin[1]];
        origin[0] = xExtent[i][ex];
        origin[1] = yExtent[i][ey];
      }

      else {
        i = xExtent.length - 1; // Figure out the count of the new extent.
        xExtent.push([0,0]);
        yExtent.push([0,0]);

        // If the ALT key is down when starting a brush, the center is at the mouse.
        if (d3.event.altKey) center = origin.slice();
      }

      // Propagate the active cursor to the body for the drag duration.
      g.style("pointer-events", "none");
      d3.select("body").style("cursor", eventTarget.style("cursor"));

      // Show resizers as long as we're not dragging or resizing.
      if(!dragging && !resizing) g.selectAll(".resize").style("display", null)

      // Notify listeners.
      event_({type: "brushstart"});
      brushmove();

      function keydown() {
        if (d3.event.keyCode == 32) {
          if (!dragging) {
            center = null;
            origin[0] -= xExtent[i][1];
            origin[1] -= yExtent[i][1];
            dragging = 2;
          }
          d3.event.preventDefault();
        }
      }

      function keyup() {
        if (d3.event.keyCode == 32 && dragging == 2) {
          origin[0] += xExtent[i][1];
          origin[1] += yExtent[i][1];
          dragging = 0;
          d3.event.preventDefault();
        }
      }

      function brushmove() {
        var point = d3.mouse(target),
          moved = false;

        // Preserve the offset for thick resizers.
        if (offset) {
          point[0] += offset[0];
          point[1] += offset[1];
        }

        if (!dragging) {

          // If needed, determine the center from the current extent.
          if (d3.event.altKey) {
            if (!center) center = [(xExtent[i][0] + xExtent[i][1]) / 2, (yExtent[i][0] + yExtent[i][1]) / 2];

            // Update the origin, for when the ALT key is released.
            origin[0] = xExtent[i][+(point[0] < center[0])];
            origin[1] = yExtent[i][+(point[1] < center[1])];
          }

          // When the ALT key is released, we clear the center.
          else center = null;
        }

        // Update the brush extent for each dimension.
        if (resizingX && move1(point, x, 0)) {
          redrawX(g, i);
          moved = true;
        }
        if (resizingY && move1(point, y, 1)) {
          redrawY(g, i);
          moved = true;
        }

        // Final redraw and notify listeners.
        if (moved) {
          redraw(g);
          event_({type: "brush", mode: dragging ? "move" : "resize"});
        }
      }

      function move1(point, scale, j) {
        var range = d3_scaleRange(scale),
          r0 = range[0],
          r1 = range[1],
          position = origin[j],
          extent = j ? yExtent[i] : xExtent[i],
          size = extent[1] - extent[0],
          min,
          max;

        // When dragging, reduce the range by the extent size and position.
        if (dragging) {
          r0 -= position;
          r1 -= size + position;
        }

        // Clamp the point (unless clamp set to false) so that the extent fits within the range extent.
        min = (j ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[j])) : point[j];

        // Compute the new extent bounds.
        if (dragging) {
          max = (min += position) + size;
        } else {

          // If the ALT key is pressed, then preserve the center of the extent.
          if (center) position = Math.max(r0, Math.min(r1, 2 * center[j] - min));

          // Compute the min and max of the position and point.
          if (position < min) {
            max = min;
            min = position;
          } else {
            max = position;
          }
        }

        // Update the stored bounds.
        if (extent[0] != min || extent[1] != max) {
          if (j) yExtentDomain[i] = null;
          else xExtentDomain[i] = null;
          extent[0] = min;
          extent[1] = max;
          return true;
        }
      }

      function brushend() {
        brushmove();

        // If the current extent is empty, clear everything.
        if(x && xExtent[i][0] == xExtent[i][1] ||
          y && yExtent[i][0] == yExtent[i][1]) {
          brush.clear();
        }

        // reset the cursor styles
        g.style("pointer-events", "all").selectAll(".resize").style("display", function(d) { return brush.empty(d[1]) ? "none" : null; });
        d3.select("body").style("cursor", null);

        w .on("mousemove.brush", null)
          .on("mouseup.brush", null)
          .on("touchmove.brush", null)
          .on("touchend.brush", null)
          .on("keydown.brush", null)
          .on("keyup.brush", null);

        drawExtents();

        dragRestore();
        event_({type: "brushend"});
      }
    }

    brush.x = function(z) {
      if (!arguments.length) return x;
      x = z;
      resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore!
      return brush;
    };

    brush.y = function(z) {
      if (!arguments.length) return y;
      y = z;
      resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore!
      return brush;
    };

    brush.resizeAdaption = function(z) {
      if (!arguments.length) return resizeAdaption;
      resizeAdaption = z;
      return brush;
    }

    brush.extentAdaption = function(z) {
      if (!arguments.length) return extentAdaption;
      extentAdaption = z;
      return brush;
    }

    brush.clamp = function(z) {
      if (!arguments.length) return x && y ? [xClamp, yClamp] : x ? xClamp : y ? yClamp : null;
      if (x && y) xClamp = !!z[0], yClamp = !!z[1];
      else if (x) xClamp = !!z;
      else if (y) yClamp = !!z;
      return brush;
    };

    brush.extent = function(z) {
      var x0, x1, y0, y1, t;
      var xOutput, yOutput, xyOutput = [];

      // Invert the pixel extent to data-space.
      if (!arguments.length) {
        if (x) {
          if (xExtentDomain[0]) {
            xOutput = xExtentDomain;
          } else {
            xOutput = xExtent.map(function (d) {
              if (x.invert) return [ x.invert(d[0]), x.invert(d[1]) ];
              return d;
            }).map(function (d) {
              if (d[1] < d[0]) return [ d[1], d[0] ];
              return d;
            }).filter(function (d) { return d[1] - d[0] != 0; });
          }
        }
        if (y) {
          if (yExtentDomain[0]) {
            yOutput = yExtentDomain;
          } else {
            yOutput = yExtent.map(function (d) {
              if(y.invert) return [ y.invert(d[0]), y.invert(d[1]) ];
              return d;
            }).map(function (d) {
              if (d[1] < d[0]) return [ d[1], d[0] ];
              return d;
            }).filter(function (d) { return d[1] - d[0] != 0; });
          }
        }
        if(x && y) {
          xOutput.forEach(function (d, i) {
            xyOutput.push([[d[0], yOutput[i][0]], [d[1], yOutput[i][1]]]);
          });
        }
        return x && y ? xyOutput : x ? xOutput : y && yOutput;
      }

      // Scale the data-space extent to pixels.
      if (x) {
        xOutput = z;
        if (y) xOutput = xOutput.map(function (d) {
          return [d[0][0], d[1][0]];
        });
        xExtentDomain = xOutput;
        xOutput = xOutput.map(function (d) {
          if (x.invert) return [x(d[0]), x(d[1])];
          return d;
        }).map(function (d) {
          if(d[1] < d[0]) return [d[1], d[0]];
          return d;
        });
        xExtent = xOutput;
        if(!y) yExtent = xOutput.map(function() { return [0,0]; });
      }
      if (y) {
        yOutput = z;
        if (x) yOutput = yOutput.map(function (d) {
          return [d[0][1], d[1][1]];
        });
        yExtentDomain = yOutput;
        yOutput = yOutput.map(function (d) {
          if (y.invert) return [y(d[0]), y(d[1])];
          return d;
        }).map(function (d) {
          if(d[1] < d[0]) return [d[1], d[0]];
          return d;
        });
        yExtent = yOutput;
        if(!x) xExtent = yOutput.map(function () { return [0,0]; });
      }

      // Handle the case where the extents are set to empty arrays.
      if(xExtent.length === 0) xExtent = [[0,0]];
      if(yExtent.length === 0) yExtent = [[0,0]];

      return brush;
    };

    brush.clear = function() {
      xExtent = [[0, 0]], yExtent = [[0, 0]];
      xExtentDomain = yExtentDomain = [];
      drawExtents();
      if(x) redrawX(brushElement);
      if(y) redrawY(brushElement);
      return brush;
    };

    brush.empty = function(i) {
      if (this.extent().length === 0) {
        return true;
      }
      if(xExtent.length == 1 && yExtent.length == 1) i = 0;
      if(i !== undefined) {
        return !!x && xExtent[i][0] == xExtent[i][1]
          || !!y && yExtent[i][0] == yExtent[i][1];
      } else {
        return false;
      }
    };

    return d3.rebind(brush, event, "on");
  };

  var d3_svg_brushCursor = {
    n: "ns-resize",
    e: "ew-resize",
    s: "ns-resize",
    w: "ew-resize",
    nw: "nwse-resize",
    ne: "nesw-resize",
    se: "nwse-resize",
    sw: "nesw-resize"
  };

  var d3_svg_brushResizes = [
    ["n", "e", "s", "w", "nw", "ne", "se", "sw"],
    ["e", "w"],
    ["n", "s"],
    []
  ];
})();


text:
import sys

from neutronclient.common import exceptions
from neutronclient.neutron.v2_0.vpn import ipsec_site_connection
from neutronclient.tests.unit import test_cli20

class CLITestV20IPsecSiteConnectionJSON(test_cli20.CLITestV20Base):

    # TODO(pcm): Remove, once peer-cidr is deprecated completely
    def test_create_ipsec_site_connection_all_params_using_peer_cidrs(self):
        # ipsecsite-connection-create all params using peer CIDRs.
        resource = 'ipsec_site_connection'
        cmd = ipsec_site_connection.CreateIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        tenant_id = 'mytenant_id'
        name = 'connection1'
        my_id = 'my_id'
        peer_address = '192.168.2.10'
        peer_id = '192.168.2.10'
        psk = 'abcd'
        mtu = '1500'
        initiator = 'bi-directional'
        vpnservice_id = 'vpnservice_id'
        ikepolicy_id = 'ikepolicy_id'
        ipsecpolicy_id = 'ipsecpolicy_id'
        peer_cidrs = ['192.168.3.0/24', '192.168.2.0/24']
        admin_state = True
        description = 'my-vpn-connection'
        dpd = 'action=restart,interval=30,timeout=120'

        args = ['--tenant-id', tenant_id,
                '--peer-address', peer_address, '--peer-id', peer_id,
                '--psk', psk, '--initiator', initiator,
                '--vpnservice-id', vpnservice_id,
                '--ikepolicy-id', ikepolicy_id, '--name', name,
                '--ipsecpolicy-id', ipsecpolicy_id, '--mtu', mtu,
                '--description', description,
                '--peer-cidr', '192.168.3.0/24',
                '--peer-cidr', '192.168.2.0/24',
                '--dpd', dpd]

        position_names = ['name', 'tenant_id', 'admin_state_up',
                          'peer_address', 'peer_id', 'peer_cidrs',
                          'psk', 'mtu', 'initiator', 'description',
                          'vpnservice_id', 'ikepolicy_id',
                          'ipsecpolicy_id']

        position_values = [name, tenant_id, admin_state, peer_address,
                           peer_id, peer_cidrs, psk, mtu,
                           initiator, description,
                           vpnservice_id, ikepolicy_id, ipsecpolicy_id]
        extra_body = {
            'dpd': {
                'action': 'restart',
                'interval': 30,
                'timeout': 120,
            },
        }

        self._test_create_resource(resource, cmd, name, my_id, args,
                                   position_names, position_values,
                                   extra_body=extra_body)

    def test_create_ipsec_site_conn_all_params(self):
        # ipsecsite-connection-create all params using endpoint groups.
        resource = 'ipsec_site_connection'
        cmd = ipsec_site_connection.CreateIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        tenant_id = 'mytenant_id'
        name = 'connection1'
        my_id = 'my_id'
        peer_address = '192.168.2.10'
        peer_id = '192.168.2.10'
        psk = 'abcd'
        mtu = '1500'
        initiator = 'bi-directional'
        vpnservice_id = 'vpnservice_id'
        ikepolicy_id = 'ikepolicy_id'
        ipsecpolicy_id = 'ipsecpolicy_id'
        local_ep_group = 'local-epg'
        peer_ep_group = 'peer-epg'
        admin_state = True
        description = 'my-vpn-connection'
        dpd = 'action=restart,interval=30,timeout=120'

        args = ['--tenant-id', tenant_id,
                '--peer-address', peer_address, '--peer-id', peer_id,
                '--psk', psk, '--initiator', initiator,
                '--vpnservice-id', vpnservice_id,
                '--ikepolicy-id', ikepolicy_id, '--name', name,
                '--ipsecpolicy-id', ipsecpolicy_id, '--mtu', mtu,
                '--description', description,
                '--local-ep-group', local_ep_group,
                '--peer-ep-group', peer_ep_group,
                '--dpd', dpd]

        position_names = ['name', 'tenant_id', 'admin_state_up',
                          'peer_address', 'peer_id', 'psk', 'mtu',
                          'local_ep_group_id', 'peer_ep_group_id',
                          'initiator', 'description',
                          'vpnservice_id', 'ikepolicy_id',
                          'ipsecpolicy_id']

        position_values = [name, tenant_id, admin_state, peer_address,
                           peer_id, psk, mtu, local_ep_group,
                           peer_ep_group, initiator, description,
                           vpnservice_id, ikepolicy_id, ipsecpolicy_id]
        extra_body = {
            'dpd': {
                'action': 'restart',
                'interval': 30,
                'timeout': 120,
            },
        }

        self._test_create_resource(resource, cmd, name, my_id, args,
                                   position_names, position_values,
                                   extra_body=extra_body)

    def test_create_ipsec_site_connection_with_limited_params(self):
        # ipsecsite-connection-create with limited params.
        resource = 'ipsec_site_connection'
        cmd = ipsec_site_connection.CreateIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        tenant_id = 'mytenant_id'
        my_id = 'my_id'
        peer_address = '192.168.2.10'
        peer_id = '192.168.2.10'
        psk = 'abcd'
        mtu = '1500'
        initiator = 'bi-directional'
        vpnservice_id = 'vpnservice_id'
        ikepolicy_id = 'ikepolicy_id'
        ipsecpolicy_id = 'ipsecpolicy_id'
        local_ep_group = 'local-epg'
        peer_ep_group = 'peer-epg'
        admin_state = True

        args = ['--tenant-id', tenant_id,
                '--peer-address', peer_address,
                '--peer-id', peer_id,
                '--psk', psk,
                '--vpnservice-id', vpnservice_id,
                '--ikepolicy-id', ikepolicy_id,
                '--ipsecpolicy-id', ipsecpolicy_id,
                '--local-ep-group', local_ep_group,
                '--peer-ep-group', peer_ep_group]

        position_names = ['tenant_id', 'admin_state_up',
                          'peer_address', 'peer_id',
                          'local_ep_group_id', 'peer_ep_group_id',
                          'psk', 'mtu', 'initiator',
                          'vpnservice_id', 'ikepolicy_id',
                          'ipsecpolicy_id']

        position_values = [tenant_id, admin_state, peer_address, peer_id,
                           local_ep_group, peer_ep_group, psk, mtu, initiator,
                           vpnservice_id, ikepolicy_id, ipsecpolicy_id]

        self._test_create_resource(resource, cmd, None, my_id, args,
                                   position_names, position_values)

    def _test_create_failure(self, additional_args=None, expected_exc=None):
        # Helper to test failure of IPSec site-to-site creation failure.
        resource = 'ipsec_site_connection'
        cmd = ipsec_site_connection.CreateIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        tenant_id = 'mytenant_id'
        my_id = 'my_id'
        peer_address = '192.168.2.10'
        peer_id = '192.168.2.10'
        psk = 'abcd'
        mtu = '1500'
        initiator = 'bi-directional'
        vpnservice_id = 'vpnservice_id'
        ikepolicy_id = 'ikepolicy_id'
        ipsecpolicy_id = 'ipsecpolicy_id'
        admin_state = True

        args = ['--tenant-id', tenant_id,
                '--peer-address', peer_address,
                '--peer-id', peer_id,
                '--psk', psk,
                '--vpnservice-id', vpnservice_id,
                '--ikepolicy-id', ikepolicy_id,
                '--ipsecpolicy-id', ipsecpolicy_id]
        if additional_args is not None:
            args += additional_args
        position_names = ['tenant_id', 'admin_state_up', 'peer_address',
                          'peer_id', 'psk', 'mtu', 'initiator',
                          'local_ep_group_id', 'peer_ep_group_id',
                          'vpnservice_id', 'ikepolicy_id', 'ipsecpolicy_id']

        position_values = [tenant_id, admin_state, peer_address, peer_id, psk,
                           mtu, initiator, None, None, vpnservice_id,
                           ikepolicy_id, ipsecpolicy_id]
        if not expected_exc:
            expected_exc = exceptions.CommandError
        self.assertRaises(expected_exc,
                          self._test_create_resource,
                          resource, cmd, None, my_id, args,
                          position_names, position_values)

    def test_fail_create_with_invalid_mtu(self):
        # ipsecsite-connection-create with invalid dpd values.
        bad_mtu = ['--mtu', '67']
        self._test_create_failure(bad_mtu)

    def test_fail_create_with_invalid_dpd_keys(self):
        bad_dpd_key = ['--dpd', 'act=restart,interval=30,time=120']
        self._test_create_failure(bad_dpd_key, SystemExit)

    def test_fail_create_with_invalid_dpd_values(self):
        bad_dpd_values = ['--dpd', 'action=hold,interval=30,timeout=-1']
        self._test_create_failure(bad_dpd_values)

    def test_fail_create_missing_endpoint_groups_or_cidr(self):
        # Must provide either endpoint groups or peer cidrs.
        self._test_create_failure()

    def test_fail_create_missing_peer_endpoint_group(self):
        # Fails if dont have both endpoint groups - missing peer.
        self._test_create_failure(['--local-ep-group', 'local-epg'])

    def test_fail_create_missing_local_endpoint_group(self):
        # Fails if dont have both endpoint groups - missing local.
        self._test_create_failure(['--peer-ep-group', 'peer-epg'])

    def test_fail_create_when_both_endpoints_and_peer_cidr(self):
        # Cannot intermix endpoint groups and peer CIDRs for create.
        additional_args = ['--local-ep-group', 'local-epg',
                           '--peer-ep-group', 'peer-epg',
                           '--peer-cidr', '10.2.0.0/24']
        self._test_create_failure(additional_args)

    def test_list_ipsec_site_connection(self):
        # ipsecsite-connection-list.
        resources = "ipsec_site_connections"
        cmd = ipsec_site_connection.ListIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        self._test_list_resources(resources, cmd, True)

    def test_list_ipsec_site_connection_pagination(self):
        # ipsecsite-connection-list.
        resources = "ipsec_site_connections"
        cmd = ipsec_site_connection.ListIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        self._test_list_resources_with_pagination(resources, cmd)

    def test_list_ipsec_site_connection_sort(self):
        # ipsecsite-connection-list.
        # --sort-key name --sort-key id --sort-key asc --sort-key desc
        resources = "ipsec_site_connections"
        cmd = ipsec_site_connection.ListIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        self._test_list_resources(resources, cmd,
                                  sort_key=["name", "id"],
                                  sort_dir=["asc", "desc"])

    def test_list_ipsec_site_connection_limit(self):
        # ipsecsite-connection-list -P.
        resources = "ipsec_site_connections"
        cmd = ipsec_site_connection.ListIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        self._test_list_resources(resources, cmd, page_size=1000)

    def test_delete_ipsec_site_connection(self):
        # ipsecsite-connection-delete my-id.
        resource = 'ipsec_site_connection'
        cmd = ipsec_site_connection.DeleteIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        my_id = 'my-id'
        args = [my_id]
        self._test_delete_resource(resource, cmd, my_id, args)

    def test_update_ipsec_site_connection(self):
        # ipsecsite-connection-update  myid --name myname --tags a b."""
        resource = 'ipsec_site_connection'
        cmd = ipsec_site_connection.UpdateIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        self._test_update_resource(resource, cmd, 'myid',
                                   ['myid', '--name', 'Branch-new',
                                    '--tags', 'a', 'b'],
                                   {'name': 'Branch-new',
                                    'tags': ['a', 'b'], })

    def test_show_ipsec_site_connection_id(self):
        # ipsecsite-connection-show test_id."""
        resource = 'ipsec_site_connection'
        cmd = ipsec_site_connection.ShowIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        args = ['--fields', 'id', self.test_id]
        self._test_show_resource(resource, cmd, self.test_id, args, ['id'])

    def test_show_ipsec_site_connection_id_name(self):
        # ipsecsite-connection-show."""
        resource = 'ipsec_site_connection'
        cmd = ipsec_site_connection.ShowIPsecSiteConnection(
            test_cli20.MyApp(sys.stdout), None
        )
        args = ['--fields', 'id', '--fields', 'name', self.test_id]
        self._test_show_resource(resource, cmd, self.test_id,
                                 args, ['id', 'name'])


text:
<?php

defined('IN_IA') or exit('Access Denied');
$_W['page']['title'] = '用户列表 - 用户管理 - 用户管理';

$pindex = max(1, intval($_GPC['page']));
$psize = 20;

$where = ' WHERE 1 ';
$params = array();
if ($_GPC['status'] > 0) {
	$where .= " AND status = :status";
	$params[':status'] = intval($_GPC['status']);
}
if (!empty($_GPC['username'])) {
	$where .= " AND username LIKE :username";
	$params[':username'] = "%{$_GPC['username']}%";
}
if (!empty($_GPC['group'])) {
	$where .= " AND groupid = :groupid";
	$params[':groupid'] = intval($_GPC['group']);
}
$endtime = intval($_GPC['endtime']);
if($endtime != 0) {
	if($endtime == -1) {
		$where .= " AND endtime <= :endtime AND endtime != 0";
		$params[':endtime'] = TIMESTAMP;
	} else {
		$end = strtotime($endtime . 'days');
		$where .= " AND endtime <= :endtime AND endtime > :starttime";
		$params[':endtime'] = $end;
		$params[':starttime'] = TIMESTAMP;
	}
}
$sql = 'SELECT * FROM ' . tablename('users') .$where . " LIMIT " . ($pindex - 1) * $psize .',' .$psize;
$users = pdo_fetchall($sql, $params);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('users') . $where, $params);
$pager = pagination($total, $pindex, $psize);

$founders = explode(',', $_W['config']['setting']['founder']);
foreach($users as &$user) {
	$user['founder'] = in_array($user['uid'], $founders);
}
unset($user);

$usergroups = pdo_fetchall("SELECT id, name FROM ".tablename('users_group'), array(), 'id');
$settings = $_W['setting']['register'];

template('user/display');


text:
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include "cryptolib.h"
#include "host_common.h"
#include "timer_utils.h"

#define NUM_HASH_ALGORITHMS 3
#define TEST_BUFFER_SIZE 4000000

/* Table of hash function pointers and their description. */
typedef uint8_t* (*Hashptr) (const uint8_t*, uint64_t, uint8_t*);
typedef struct HashFxTable {
  Hashptr hash;
  char* description;
} HashFxTable;

HashFxTable hash_functions[NUM_HASH_ALGORITHMS] = {
  {internal_SHA1, "sha1"},
  {internal_SHA256, "sha256"},
  {internal_SHA512, "sha512"}
};

int main(int argc, char* argv[]) {
  int i;
  double speed;
  uint32_t msecs;
  uint8_t* buffer = (uint8_t*) malloc(TEST_BUFFER_SIZE);
  uint8_t* digest = (uint8_t*) malloc(SHA512_DIGEST_SIZE); /* Maximum size of
                                                            * the digest. */
  ClockTimerState ct;

  /* Iterate through all the hash functions. */
  for(i = 0; i < NUM_HASH_ALGORITHMS; i++) {
    StartTimer(&ct);
    hash_functions[i].hash(buffer, TEST_BUFFER_SIZE, digest);
    StopTimer(&ct);

    msecs = GetDurationMsecs(&ct);
    speed = ((TEST_BUFFER_SIZE / 10e6)
             / (msecs / 10e3)); /* Mbytes/sec */

    fprintf(stderr, "# %s Time taken = %u ms, Speed = %f Mbytes/sec\n",
            hash_functions[i].description, msecs, speed);
    fprintf(stdout, "mbytes_per_sec_%s:%f\n",
            hash_functions[i].description, speed);
  }

  free(digest);
  free(buffer);
  return 0;
}


text:
@interface HNObject ()

@property (nonatomic, assign, readwrite) HNSession *session;

@end

@implementation HNObject
@synthesize identifier=identifier, URL=url, session=session;
@synthesize loadingState;

+ (BOOL)isValidURL:(NSURL *)url_ {
    if (url_ == nil) return NO;
    if (![[url_ scheme] isEqualToString:@"http"] && ![[url_ scheme] isEqualToString:@"https"]) return NO;
    if (![[url_ host] isEqualToString:kHNWebsiteHost]) return NO;

    return YES;
}

+ (NSDictionary *)infoDictionaryForURL:(NSURL *)url_ {
    return nil;
}

+ (id)identifierForURL:(NSURL *)url_ {
    return nil;
}

+ (NSString *)pathForURLWithIdentifier:(id)identifier_ infoDictionary:(NSDictionary *)info {
    return nil;
}

+ (NSDictionary *)parametersForURLWithIdentifier:(id)identifier_ infoDictionary:(NSDictionary *)info {
    return nil;
}

+ (NSURL *)generateURLWithIdentifier:(id)identifier_ infoDictionary:(NSDictionary *)info {
    NSDictionary *parameters = [self parametersForURLWithIdentifier:identifier_ infoDictionary:info];
    NSString *path = [self pathForURLWithIdentifier:identifier_ infoDictionary:info];
    NSString *combined = [path stringByAppendingString:[parameters queryString]];
    return [[NSURL URLWithString:combined relativeToURL:kHNWebsiteURL] absoluteURL];
}

+ (id)session:(HNSession *)session objectWithIdentifier:(id)identifier_ infoDictionary:(NSDictionary *)info URL:(NSURL *)url_ {
    HNObjectCache *cache = [session cache];
    HNObject *object = [cache objectFromCacheWithClass:self identifier:identifier_ infoDictionary:info];

    if (object == nil) {
        object = [[[self alloc] init] autorelease];
        [object setSession:session];
    }

    if (url_ != nil) {
        [object setURL:url_];
        [object setIdentifier:identifier_];
        [object loadInfoDictionary:info];

        if (![cache cacheHasObject:object]) {
            [cache addObjectToCache:object];
        }
    }

    return object;
}

+ (id)session:(HNSession *)session objectWithIdentifier:(id)identifier_ infoDictionary:(NSDictionary *)info {
    return [self session:session objectWithIdentifier:identifier_ infoDictionary:info URL:[[self class] generateURLWithIdentifier:identifier_ infoDictionary:info]];
}

+ (id)session:(HNSession *)session objectWithIdentifier:(id)identifier_ {
    return [self session:session objectWithIdentifier:identifier_ infoDictionary:nil];
}

+ (id)session:(HNSession *)session objectWithURL:(NSURL *)url_ {
    id identifier_ = [self identifierForURL:url_];
    NSDictionary *info = [self infoDictionaryForURL:url_];
    return [self session:session objectWithIdentifier:identifier_ infoDictionary:info URL:url_];
}

+ (NSString *)pathWithIdentifier:(id)identifier {
    return nil;
}

- (NSDictionary *)infoDictionary {
    return nil;
}

- (void)loadInfoDictionary:(NSDictionary *)info {
    return;
}

- (NSString *)description {
    NSString *other = nil;

    if (![self isLoaded]) {
        other = @"[not loaded]";
    }

    NSString *identifier_ = [NSString stringWithFormat:@" identifier=%@", identifier];
    if (identifier == nil) identifier_ = @"";

    return [NSString stringWithFormat:@"<%@:%p %@ %@>", [self class], self, identifier_, other];
}

#pragma mark - Loading

- (void)clearLoadingState:(HNObjectLoadingState)state_ {
    loadingState &= ~state_;

    [[NSNotificationCenter defaultCenter] postNotificationName:kHNObjectLoadingStateChangedNotification object:self];
}

- (void)addLoadingState:(HNObjectLoadingState)state_ {
    loadingState |= state_;

    if ((state_ & kHNObjectLoadingStateLoaded) > 0) {
        [[NSNotificationCenter defaultCenter] postNotificationName:kHNObjectFinishedLoadingNotification object:self];
    } else if ((state_ & kHNObjectLoadingStateLoadingAny) > 0) {
        [[NSNotificationCenter defaultCenter] postNotificationName:kHNObjectStartedLoadingNotification object:self];
    }

    [[NSNotificationCenter defaultCenter] postNotificationName:kHNObjectLoadingStateChangedNotification object:self];
}

- (BOOL)hasLoadingState:(HNObjectLoadingState)state_ {
    return ([self loadingState] & state_) > 0;
}

- (BOOL)isLoaded {
    return [self hasLoadingState:kHNObjectLoadingStateLoaded];
}

- (void)setIsLoaded:(BOOL)loaded {
    if (loaded) {
        // XXX: do we really want to do this here?
        if ([self isLoading]) [self cancelLoading];

        [self clearLoadingState:kHNObjectLoadingStateUnloaded];
        [self clearLoadingState:kHNObjectLoadingStateNotLoaded];
        [self addLoadingState:kHNObjectLoadingStateLoaded];
    } else {
        [self clearLoadingState:kHNObjectLoadingStateLoaded];
        [self addLoadingState:kHNObjectLoadingStateUnloaded];
    }
}

- (BOOL)isLoading {
    return [self hasLoadingState:kHNObjectLoadingStateLoadingAny];
}

- (void)loadFromDictionary:(NSDictionary *)dictionary complete:(BOOL)complete {
    if (complete) {
        HNObjectCache *cache = [session cache];
        [cache savePersistentCacheDictionary:dictionary forObject:self];
        [self setIsLoaded:YES];
    }
}

- (void)_clearRequest {
    if ([apiRequest isLoading]) {
        [apiRequest cancelRequest];
    }

    [apiRequest release];
    apiRequest = nil;

    [self clearLoadingState:kHNObjectLoadingStateLoadingAny];
}

- (void)request:(HNAPIRequest *)request completedWithResponse:(NSDictionary *)response error:(NSError *)error {
    if (error == nil) {
        [self loadFromDictionary:response complete:YES];
    }

    // note: don't move this downwards, bad things will happen
    [self _clearRequest];

    if (error != nil) {
        [[NSNotificationCenter defaultCenter] postNotificationName:kHNObjectFailedLoadingNotification object:self];
    }
}

- (void)beginLoadingWithState:(HNObjectLoadingState)state_ {
    HNObjectCache *cache = [session cache];
    [cache updateObjectFromPersistentCache:self];

    [self addLoadingState:state_];

    NSDictionary *info = [self infoDictionary];
    NSDictionary *parameters = [[self class] parametersForURLWithIdentifier:identifier infoDictionary:info];
    NSString *path = [[self class] pathForURLWithIdentifier:identifier infoDictionary:info];

    apiRequest = [[HNAPIRequest alloc] initWithSession:session target:self action:@selector(request:completedWithResponse:error:)];
    [apiRequest performRequestWithPath:path parameters:parameters];
}

- (void)cancelLoading {
    [self _clearRequest];
}

- (void)beginLoading {
    // Loading multiple times at once just makes no sense.
    if ([self isLoading]) return;

    if ([self isLoaded]) {
        [self beginLoadingWithState:kHNObjectLoadingStateLoadingReload];
    } else {
        [self beginLoadingWithState:kHNObjectLoadingStateLoadingInitial];
    }
}

@end


text:
using BlueConcord.IdentityServer.EntityFrameworkCore.DbContexts;
using BlueConcord.IdentityServer.EntityFrameworkCore.Entities;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace BlueConcord.IdentityServer.IntegrationTests
{
    public class ClientConfigurationDbContextTests
    {
        private const string ConfigConnectionStringName = "Config";
        private DbContextOptions _options;

        public ClientConfigurationDbContextTests()
        {
            var builder = new DbContextOptionsBuilder<ClientConfigurationContext<int>>();
            builder.UseInMemoryDatabase();
            _options = builder.Options;
        }

        [Fact]
        public void CanAddAndDeleteClientScopes()
        {
            using (var db = new ClientConfigurationContext<int>(_options))
            {
                db.Clients.Add(new Client<int>
                {
                    ClientId = "test-client-scopes",
                    ClientName = "Test Client"
                });

                db.SaveChanges();
            }

            using (var db = new ClientConfigurationContext<int>(_options))
            {
                var client = db.Clients.First();

                client.AllowedScopes = new HashSet<ClientScope<int>>();
                client.AllowedScopes.Add(new ClientScope<int>
                {
                    Scope = "test"
                });

                db.SaveChanges();
            }

            using (var db = new ClientConfigurationContext<int>(_options))
            {
                var client = db.Clients
                    .Include(e => e.AllowedScopes)
                    .First();
                var scope = client.AllowedScopes.First();

                client.AllowedScopes.Remove(scope);

                db.SaveChanges();
            }

            using (var db = new ClientConfigurationContext<int>(_options))
            {
                var client = db.Clients
                    .Include(e => e.AllowedScopes)
                    .First();

                Assert.Equal(0, client.AllowedScopes.Count());
            }
        }

        [Fact]
        public void CanAddAndDeleteClientRedirectUri()
        {
            using (var db = new ClientConfigurationContext<int>(_options))
            {
                db.Clients.Add(new Client<int>
                {
                    ClientId = "test-client",
                    ClientName = "Test Client"
                });

                db.SaveChanges();
            }

            using (var db = new ClientConfigurationContext<int>(_options))
            {
                var client = db.Clients
                    .First();

                client.RedirectUris = new HashSet<ClientRedirectUri<int>>();
                client.RedirectUris.Add(new ClientRedirectUri<int>
                {
                    Uri = "https://redirect-uri-1"
                });

                db.SaveChanges();
            }

            using (var db = new ClientConfigurationContext<int>(_options))
            {
                var client = db.Clients
                    .Include(e => e.RedirectUris)
                    .First();
                var redirectUri = client.RedirectUris.First();

                client.RedirectUris.Remove(redirectUri);

                db.SaveChanges();
            }

            using (var db = new ClientConfigurationContext<int>(_options))
            {
                var client = db.Clients
                    .Include(e => e.RedirectUris)
                    .First();

                Assert.Equal(0, client.RedirectUris.Count());
            }
        }
    }
}


text:
import time
import logging
from threading import Thread
from litmus.device.device import device
from litmus.core.util import find_pattern
from litmus.core.exceptions import BootError

class deviceartik10(device):
    """docstring for device"""

    _booting_time = 60
    _pattern_shellprompt = r'root.*> .*'
    _pattern_bootprompt = r'ARTIK.*# .*'

    def __init__(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs
        self._name = kwargs['devicename']

        self._open_uart()
        self._manager = kwargs['manager']

    def _release(self):
        """docstring for _release"""
        self._close_uart()

    def _wait_uart_shell_login_prompt(self):
        """docstring for _wait_uart_shell_login_prompt"""
        super(deviceartik10, self)._wait_uart_shell_login_prompt()

    def _set_sdb_deviceid(self):
        """docstring for _set_sdb_deviceid"""
        usb0_path = b'/sys/class/usb_mode/usb0'
        pattern = '.*{0}'.format(self.get_id())

        def set_serialnumber(deviceid):
            """docstring for set_serialnumber"""
            self._write_uart(b''.join([b'echo 0 > ', usb0_path, b'/enable']))
            time.sleep(0.3)
            self._write_uart(b''.join([b'echo ',
                                       b'-n ',
                                       deviceid,
                                       b' > ', usb0_path,
                                       b'/iSerial']))
            time.sleep(0.3)
            self._write_uart(b'direct_set_debug.sh --sdb-set')
            time.sleep(0.5)

        def get_serialnumber():
            """docstring for get_serialnumber"""
            self._write_uart(b''.join([b'cat ', usb0_path, b'/enable']))
            time.sleep(0.3)
            self._write_uart(b''.join([b'cat ', usb0_path, b'/iSerial']))
            time.sleep(0.3)
            return self._read_uart(1000)

        retrycnt = 0
        while retrycnt < 10:
            set_serialnumber(deviceid=self.get_id().encode())
            serialnumber = get_serialnumber()
            if find_pattern(pattern, serialnumber):
                return
            retrycnt += 1
        else:
            raise Exception('Can\'t configure sdb deviceid')

    def _reboot(self):
        """docstring for _reboot"""
        status = self._current_uart_status()

        if status == 'LOGGED_IN':
            self._write_uart(b'reboot')
            time.sleep(3)
        elif status == 'BOOT_PROMPT':
            self._write_uart(b'reset')
            time.sleep(3)
        elif status == 'NOT_LOGGED_IN':
            self._wait_uart_shell_login_prompt()
            self._login_uart_shell()
            self._write_uart(b'reboot')
            time.sleep(3)

    def _current_uart_status(self):
        """docstring for _current_uart_status"""
        self._flush_uart_buffer()
        for loop in range(3):
            self._write_uart(b'')
        readdata = self._read_uart(500)
        if find_pattern(self._pattern_bootprompt, readdata):
            return 'BOOT_PROMPT'
        if find_pattern(self._pattern_shellprompt, readdata):
            return 'LOGGED_IN'
        else:
            return 'NOT_LOGGED_IN'

    def _enter_download_mode(self, cmd, power_cut_delay=1, thread_param=10):
        """docstring for _enter_download_mode"""
        t = Thread(target=self._thread_for_enter_download_mode,
                   args=(cmd, thread_param, ))
        status = self._current_uart_status()
        if status == 'NOT_LOGGED_IN':
            self._wait_uart_shell_login_prompt()
            self._login_uart_shell()
        t.start()
        self._reboot()
        t.join()

    def on(self, powercut_delay=3):
        """
        Turn on the device acquired.

        :param float powercut_delay: power-cut delay for cutter
        """
        logging.debug('=================Turn on device {}=================='
                      .format(self.get_name()))
        retry_cnt = 0
        time.sleep(powercut_delay)
        while retry_cnt <= self._max_attempt_boot_retry:
            try:
                self._reboot()
                self._wait_uart_shell_login_prompt()
                self._login_uart_shell()
                self._set_sdb_deviceid()
                self._attach_sdb()
                self.sdb_root_on()
                return
            except KeyboardInterrupt:
                raise Exception('Keyboard interrupt.')
            except Exception as e:
                logging.debug(e)
                retry_cnt += 1
        else:
            raise BootError('Cant\'t turn on dut.')

    def off(self, powercut_delay=2):
        """
        Trun off the device acquired.

        :param float powercut_delay: power-cut delay for cutter
        """
        logging.debug('off function is not supported for Artik device')


text:
package ca.uhn.fhir.validation;

import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.util.OperationOutcomeUtil;

public class ValidationFailureException extends RuntimeException {

	private static final long serialVersionUID = 1L;
	private IBaseOperationOutcome myOperationOutcome;

//	public ValidationFailureException(String theProblem) {
//		this(theProblem, IssueSeverityEnum.FATAL, null);
//	}

	private static String toDescription(FhirContext theCtx, IBaseOperationOutcome theOo) {
		StringBuilder b = new StringBuilder();
		b.append(OperationOutcomeUtil.getFirstIssueDetails(theCtx, theOo));
//		b.append(" - ");
//		b.append(theOo.getIssueFirstRep().getLocationFirstRep().getValue());
		return b.toString();
	}

//	public ValidationFailureException(String theProblem, Exception theCause) {
//		this(theProblem, IssueSeverityEnum.FATAL, theCause);
//	}

//	public ValidationFailureException(String theProblem, IssueSeverityEnum theSeverity, Exception theCause) {
//		super(theProblem, theCause);
//		myOperationOutcome = new OperationOutcome();
//		myOperationOutcome.addIssue().setSeverity(theSeverity).setDetails(theProblem);
//	}

	public ValidationFailureException(FhirContext theCtx, IBaseOperationOutcome theOperationOutcome) {
		super(toDescription(theCtx, theOperationOutcome));
		myOperationOutcome = theOperationOutcome;
	}

	public IBaseOperationOutcome getOperationOutcome() {
		return myOperationOutcome;
	}

}