text:
# jQuery.isInView

[Setup][setup] – [Example: Lazy loading][example] – [API][api] – [Browser support][browsers] – [Limitations][limitations] – [Performance tips][perftips] – [Build and test][build]

This jQuery plugin tells you if elements are in view inside a scrollable container, or inside a container hiding its overflow. It works with respect to the viewport, iframes, or other scrollable elements.

**What sets jQuery.isInView apart?**

A whole lot of other components aim to do the same job as jQuery.isInView. Most are a bit more lightweight, in terms of file size. They are good choices if you need to check just a few elements, and just occasionally, when timing is not critical.

The main advantage of jQuery.isInView over them is speed. The methods of the plugin are optimized for performance and do their job faster, by orders of magnitude, than any other component I have been able to find (see this [live performance test][perftest-jsbin]). To give you an idea, filtering 1000 elements takes no more than 3ms on an elderly desktop running Chrome, and about 9ms on an underpowered mobile device.

As a result, jQuery.isInView is suitable for event handlers which are called frequently – scroll and resize handlers, for instance –, and it can deal with large numbers of elements.

**Core methods**

You can choose between different ways to figure out which elements [are in view][api-core]. The plugin gives you [filters][] like `$elems.inView()`. You get an [`:inViewport` selector][api-selector], too. Or you can use [boolean queries][boolean-queries], such as [`$elem.isInView()`][api-fn.isInView].

**Useful helpers**

jQuery.isInView exposes a number of [useful helper functions][api-helpers] which are valuable in their own right. One is [`$elem.hasScrollbar()`][api-fn.hasScrollbar]. You also get [`$elem.scrollbarWidth()`][api-fn.scrollbarWidth], telling you about the space taken up by scroll bars inside a given element. Finally, there is [`$elem.ownerWindow()`][api-fn.ownerWindow], which is helpful for operations in iframes and child windows.

(If you think the API is a bit too prolific for your taste, feel free to overwrite any part of it with your own jQuery extensions. Each plugin method is independent of the others, at least with regard to the public API.)

**Tests**

Browsers are a moving target for development, and they are full of quirks, too. In this environment, the plugin needs to prove that it works. It comes along with a massive [test suite][tests], auto-generated from diverse scenarios and a carefully crafted set of base tests. [Performance tests][perftests] are also part of the package.

**Example and Demo**

There is an interactive demo at [JS Bin][demo-jsbin] or [Codepen][demo-codepen] which you can play with. Or explore the [lazy-loading example, below][example].

**Other**

If you are a happy user of this project already, you can support its development by [donating to it][donations]. You absolutely don't have to, of course, but perhaps it is something you [might actually want to do][donations].

## Dependencies and setup

jQuery.isInView depends on [jQuery][] and [jQuery.documentSize][]. They must be ready for use when jquery.isinview.js is loaded.

The stable version of jQuery.isInView is available in the `dist` directory ([dev][dist-dev], [prod][dist-prod]), including an AMD build ([dev][dist-amd-dev], [prod][dist-amd-prod]). If you use Bower, fetch the files with `bower install jquery.isinview`. With npm, it is `npm install jquery.isinview`.

## Usage by example: Lazy loading

Suppose you want to lazy-load images as soon as they are scrolled into view. You already have `<img>` tags for those images, but their `src` attribute hasn't been set, keeping the assets from loading. The URL for each image is stored in a `data-url` attribute of the `<img>` tag.

Now we implement a scroll handler, which loads each image as soon as it appears on screen. (Of course, we [must throttle][throttled-scroll] the calls. To keep things simple, we just use [_.throttle][Underscore.throttle] from the [Underscore][] library, which does the job just fine.)

### A rough draft

Our first iteration results in the following code:

```javascript
var $scrollable = $( window ),
    $images = $( ".imageContainer img" )
        .width( 200 ).height( 100 ),            // see (*)

    loader = function () {
        var loaded = [];
        $images
            .inViewport()                       // jQuery.isInView filter
            .each( function () {
                this.src = $( this ).data( "url" );
                loaded.push( this );
            } );
        $images = $images.not( loaded );
    };

$scrollable.scroll( _.throttle( loader, 100 ) );
loader();                                       // see (**)
```

Here, we use [`$images.inViewport()`][api-fn.inViewport] to filter the images and grab those which are already on screen. Only then do we load the actual image assets. But that is too late.

### Timely loading

Let's improve our code and load images when they are within 400px of the viewport. For that, we modify the [`.inViewport()` filter][api-fn.inViewport] with the [`tolerance` option][api-options.tolerance]: `$images.inViewport( { tolerance: 400 } )`. Done!

Next, we should ask ourselves what "in view" means, exactly. When we say that "an element" is "in view", do we talk about the element as a whole, or is part of it enough? And does it include padding and border?

For jQuery.isInView, an element is considered to be "in view" when it is completely visible: its content box, padding, and border, every tiny bit of it. But we can change that. Perhaps we decide that images should load as soon as they begin to move into the tolerance zone, even if only partially. For that, there is the [`partially` option][api-options.partially]: `$images.inViewport( { partially: true, tolerance: 400 } )`.

In addition, we could be more focused and declare that we only care about the content area, and not about the padding or border of an element. The option [`box: "content-box"`][api-options.box] would flip that particular switch. For lazy loading, however, being that specific does not make sense, so we leave the option at its default value, `"border-box"`.

### Flexible container

Now, imagine that we don't want to scroll the viewport for some reason, and scroll our container div, `.imageContainer`, instead. So we redefine `$scrollable = $( ".imageContainer" )` in the snippet above. We also set it to `overflow: auto` in the CSS.

But what else do we need to change? We can no longer use `.inViewport()`, as its name suggests. So we replace it with the more flexible [`.inView()` method][api-fn.inView]. It accepts two arguments: the container (`$scrollable` in our case), and the options we have chosen above. Here is our final filter, then: `$images.inView( $scrollable, { partially: true, tolerance: 400 } )`. It also works for our initial scenario, where `$scrollable` is a window.

That's it. This short example should leave you with a pretty good understanding of what jQuery.isInView can do. And as a bonus, the final version is not just some contrived code you'd never use in real life, but rather an efficient, production-ready way to do lazy loading.

Coming up next: a more formal description, more methods, and the fine print. The API section.

_(*) We must assign a width and height to the image tags. Without explicit dimensions, they would not occupy any space in the document and fit into the viewport all at once. As a result, the images would all be loaded immediately, defeating the purpose._

_(**) We want the first batch of images to appear without scrolling, so we need to call the loader directly once._

## API

### Core

The primary purpose of jQuery.isInView is to tell you whether or not an element is "in view" – inside the viewport, or otherwise.

#### Filters

These methods operate on a jQuery collection and reduce it to those elements which are in view.

##### .inView( [container] [, options] )

_Returns: jQuery_

Acts as a filter and returns those elements in the collection which are in view inside the viewport, or inside another container.

The container can be a window, iframe, scrollable element (`overflow: scroll` or `overflow: auto`), an element with `overflow: hidden`, or a selector for any of these. A jQuery object or a plain DOM object are equally acceptable. The container defaults to the window containing the elements.

The size of an element is defined by its border-box, which includes its padding and border. Alternatively, the content-box of the element [can be used][api-options.box], excluding padding and borders.

Accepts the [options for core queries][api-options].

##### .inViewport( [options] )

_Returns: jQuery_

Acts as a filter and returns those elements in the collection which are in view inside the window. Shorthand for `$elem.inView( $elem.ownerWindow(), options )`.

Accepts the [options for core queries][api-options].

##### :inViewport selector

Selects all elements which are in view inside the window. Equivalent to calling `.inViewport()` on a jQuery collection.

Does not accept options.

#### Boolean queries

These methods operate on a single element and return whether or not a given element is in view.

##### .isInView( [container] [, options] )

_Returns: boolean_

Returns true if the element is in view inside the viewport, or inside another container. Examines the first element in a jQuery collection.

The container can be a window, iframe, scrollable element (`overflow: scroll` or `overflow: auto`), an element with `overflow: hidden`, or a selector for any of these. A jQuery object or a plain DOM object are equally acceptable. The container defaults to the window containing the element.

The size of an element is defined by its border-box, which includes its padding and border. Alternatively, the content-box of the element [can be used][api-options.box], excluding padding and borders.

Accepts the [options for core queries][api-options].

##### .isInViewport( [options] )

_Returns: boolean_

Returns true if the element is in view inside the window. Examines the first element in a jQuery collection. Shorthand for `$elem.isInView( $elem.ownerWindow(), options )`.

Accepts the [options for core queries][api-options].

#### Options

The following options are shared by all core methods of jQuery.isInView.

##### options.partially

_Type: boolean, default: false_

If set to true, elements which are just partially inside the container are deemed to be "in view", too. By default, an element must be in full view in order to be included.

##### options.box

_Type: string, default: "border-box", alternative: "content-box"_

By default, an element is defined by its border-box and considered to be "in view" if its border, padding, and content area are inside the container. With the `box` option set to `"content-box"`, borders and padding are ignored – only the content area determines if an element is in or out of view.

Please be aware that the `"content-box"` option requires additional DOM queries for every element in a jQuery set, and therefore makes filtering a lot slower. See the [performance tips below][perftips].

##### options.excludeHidden

_Type: boolean, default: false_

If set to true, only elements which take up visible space in the document can be "in view". Elements hidden with `display: none`, or have a size of zero, are "not in view" regardless of their position.

By default, elements without dimensions on screen can be "in view" if their location is inside the container. (Somewhat counter-intuitively, this is also [a little faster to check][perftips].)

##### options.tolerance

_Type: number or string, default: 0_

Extends the area in which an element is considered to be "in view". That zone is enlarged by the specified amount on each side of the container. Conversely, a negative value "shrinks" the zone, making it smaller than the container.

The value can either be passed as a number, which is taken to mean "px", or with a unit ("px" or "%" only).

##### options.direction

_Type: string, default: "both", other values: "horizontal", "vertical"_

Restricts a query or filter to a single dimension: `"horizontal"` or `"vertical"`. When evaluating whether or not an element is in view, only that dimension is taken into account.

### Helpers

By necessity, jQuery.isInView has to deal with scroll bars a lot. It also operates in windows other than the global one. A few utilities have come out of this.

#### Scroll bar

##### .hasScrollbar( [axis] )

_Returns: number or object (or undefined)_

Checks if an element has a scroll bar. The axis can be specified as `"horizontal"`, `"vertical"`, or `"both"`. Both axes are checked by default.

The return type depends on whether one or both axes are queried. For a single axis, the method returns a boolean. For both axes, it returns an object with the state of each individual axis, e.g. `{ vertical: true, horizontal: false }`.

Only acts on the first element of a jQuery collection. Returns undefined if the collection is empty.

The `.hasScrollbar` method can be called on any sort of item a jQuery collection can hold. It attempts to convert the item intelligently into a sensible target for a scroll bar query if possible. Specifically,

- when called on a window, document, or document element (`<html>` tag), `.hasScrollbar()` looks for window scroll bars
- when called on an iframe element, `.hasScrollbar()` looks for scroll bars on the content window of the iframe
- when called on the body, `.hasScrollbar()` looks for scroll bars on the body tag itself (!). That's because in exotic scenarios, the body _can_ have scroll bars of its own. Usually, there aren't any – if you want to find out about window scroll bars, don't call `.hasScrollbar()` on the body.

Please be aware that the method checks for the presence of a scroll bar and nothing else. It doesn't mean that the scroll bar actually scrolls, or takes up any space in the document:

- It always returns true for elements set to `overflow: scroll`. That is because scroll bars appear even if an element doesn't contain content which needs to be scrolled.
- It returns true if there is a scroll bar of width 0, which is the standard behaviour of Safari on the Mac and on iOS.

##### .scrollbarWidth( [axis] )

_Returns: number or object (or undefined)_

Returns the effective size (width) of a scrollbar on the element, in pixels, as a number without unit. The axis can be specified as `"horizontal"`, `"vertical"`, or `"both"`. Both axes are queried by default.

The return type depends on whether one or both axes are queried. For a single axis, the method returns a number. For both axes, it returns an object with the size of each individual scroll bar, e.g. `{ vertical: 17, horizontal: 0 }`.

For a given axis, the method returns the value of [`$.scrollbarWidth()`][jQuery.documentSize-scrollbarWidth], a browser constant, if there is a scroll bar, and 0 if there isn't. It does not handle custom scroll bars, and expects the default scroll bars of the browser to appear.

Only acts on the first element of a jQuery collection. Returns undefined if the collection is empty.

Please be aware that the method does not allow you to infer the presence of a scroll bar, or whether it actually scrolls:

- It always returns the default scroll bar width for elements set to `overflow: scroll`. That is because scroll bars appear even if an element doesn't contain content which needs to be scrolled.
- It returns 0 if there is no scroll bar, but also if there _is_ a scroll bar of width 0, which is the standard behaviour of Safari on the Mac and on iOS.

For the type of elements the method can be called on, and how they are handled, see [`.hasScrollbar()`, above][api-fn.hasScrollbar].

#### Other

##### .ownerWindow()

_Returns: Window (or undefined)_

Returns the window containing the element. Examines the first element in a jQuery collection.

If the "element" is a window, `.ownerWindow()` returns the window itself. If there aren't any elements in the jQuery collection, `.ownerWindow()` returns undefined.

If the element is inside an iframe, `.ownerWindow()` returns the window representing the iframe. However, if the element _is_ the iframe, `.ownerWindow()` returns the window containing the iframe (the global `window`, usually).

(Please keep in mind that selecting elements inside an iframe, from code running in the context of the global window, is subject to cross-domain security restrictions and does not always work.)

## Browser support

jQuery.isInView has been tested with

- 2015, 2016, 2017 versions of Chrome, Firefox, Safari, and Opera on the desktop
- IE9+, Edge
- Safari on iOS 8-10; Chrome and Firefox on Android 5
- PhantomJS, SlimerJS

The plugin is not formally tested in IE8 (due to a limitation of the test suite), and for that reason, IE8 is not supported. That said, it appears to work there, too. Your mileage may vary – if you still have to support IE8, go ahead and use it, but keep your eyes open.

Feel free to [run the test suite][tests] on other devices. Feedback is welcome, about successful tests as well as failing ones.

## Limitations

 jQuery.isInView examines whether elements are in or out of view with regard to an _area_, defined by a container. From that perspective, elements only ever drop out of view because they overflow their container. But there are other ways elements can be obscured – and they are not captured by jQuery.isInView.

- No consideration of stacking:

  Positioning can lead to an item being placed on top of another. Floating can obscure the background of a non-floated element. Actual visibility is further complicated by opacity. Obscuring elements by stacking others on top of them is conceptually different from moving elements out of view, which is what the plugin deals with, and not taken into account.

- No consideration of clipping and masking:

  Likewise, jQuery.isInView does not account for the effects of clipping and masking, using the deprecated `clip()`, its successor `clip-path()`, or any[ new masking techniques][css-clipping-masking] which may or may not land in the next crop of browsers.

There are also a few limitations with regard to HTML elements and their styles:

- The plugin doesn't support elements with `position: fixed`, or elements inside containers with `position: fixed`.

- Containers must not be rotated with a CSS transform. Scaling is ok. (You can do anything with content, including rotation, that's ok).

- The `<object>` tag is not supported as a container.

In terms of weird edge cases, there is one for [`.hasScrollbar()`][api-fn.hasScrollbar]. I only mention it for the sake of completeness – you are extremely unlikely to run into it in an actual application. It can only occur in browsers which display scroll bars [of width 0][jQuery.documentSize-scrollbarWidth], like those on iOS and Android. The overflow setting of the documentElement has to be different from the default, `"visible"`. The overflow of the body has to be set to `"auto"`. Then, if you take the unusual step of querying the scroll bars [of the body itself][api-fn.hasScrollbar] (as opposed to the window), `.hasScrollbar()` fails to detect them. That is not a bug, and can't be fixed. It is not possible to detect the presence of scroll bars in these circumstances.

Finally, the plugin doesn't deal with multiple, nested scrolls yet. But it merely isn't aggregating the results for you. You can call it on each individual container and simply chain the results (with `&&` for boolean tests, or filter chaining).

## Performance tips

A few best practices speed up jQuery.isInView calls, and do so by a huge amount. In hot code paths like scroll handlers, they have the potential to make or break your application as a whole. So here goes.

- If you act on multiple elements, use [a filter][filters], not [a boolean query][boolean-queries] in a loop. In other words, don't do this:

  ```javascript
  $content.each( function () {
      if ( $( this ).isInView( $container ) ) { /* ... do stuff */ }    // WRONG!
  } );
  ```

  Instead, use the corresponding filter:

  ```javascript
  $content.inView( $container ).each( function () {
      // ... do stuff
  } );
  ```

  The speed difference can be _huge_. Perhaps you can still get away with using a boolean query in a loop if your container is the `window`. It is five times slower than a filter then, but even that is still blazing fast. If your container is an ordinary HTML element, however, the boolean query slows down the process by a factor of up to 50 (!). In a nutshell: Prefer filters, and you won't go wrong.

- The [option `box: "content-box"`][api-options.box] is an expensive choice, _much_ slower than working with the `"border-box"` (which is the default). When performance matters, use it only if you really have to.

- The [option `excludeHidden: true`][api-options.excludeHidden] also has a performance cost, though to a much lesser degree. It is off (false) by default.

## Build process and tests

If you'd like to test, fix, customize or otherwise improve jQuery.isInView: here are your tools.

### Setup

[npm][] sets up the environment for you.

- The only thing you've got to have on your machine (besides Git) is [Node.js]. Download the installer [here][Node.js].
- Clone the project and open a command prompt in the project directory.
- Run the setup with `npm run setup`.
- Make sure the Grunt CLI is installed as a global Node module. If not, or if you are not sure, run `npm install -g grunt-cli` from the command prompt.

Your test and build environment is ready now. If you want to test against specific versions of jQuery, edit `bower.json` first.

### Running tests, creating a new build

#### Considerations for testing

Some tests are executed in a child window (aka pop-up window). Please _disable the pop-up blocker of the browser_ for the domain the tests are run under (usually localhost), or they will fail.

To run the tests on remote clients (e.g. mobile devices), start a web server with `grunt interactive` and visit `http://[your-host-ip]:9400/web-mocha/` with the client browser. Running the tests in a browser like this takes a _long_ time, so it makes sense to disable the power-save/sleep/auto-lock timeout on the mobile device.

Further, on iOS, you need to guide the tests along.  You have about a minute to hit OK before the related part of the test suite times out. These notifications show up multiple times, so keep an eye on your device until all tests are done.

#### Performance tests

You can examine the performance of jQuery.isInView, and compare it to some other popular plugins which have served as a benchmark during development. Spin up a server with `grunt demo` and navigate to the performance test page, `http://[your-host-ip]:9400/demo/perftest/`.

A live version of the test, showing data of a stable, published build, is available on [JS Bin][perftest-jsbin].

#### Tool chain and commands

The test tool chain: [Grunt][] (task runner), [Karma][] (test runner), [Mocha][] (test framework), [Chai][] (assertion library), [Sinon][] (mocking framework). The good news: you don't need to worry about any of this.

A handful of commands manage everything for you:

- Run the tests in a terminal with `grunt test`.
- Run the tests in a browser interactively, live-reloading the page when the source or the tests change: `grunt interactive`.
- If the live reload bothers you, you can also run the tests in a browser without it: `grunt webtest`.
- Run the linter only with `grunt lint` or `grunt hint`. (The linter is part of `grunt test` as well.)
- Build the dist files (also running tests and linter) with `grunt build`, or just `grunt`.
- Build continuously on every save with `grunt ci`.
- Change the version number throughout the project with `grunt setver --to=1.2.3`. Or just increment the revision with `grunt setver --inc`. (Remember to rebuild the project with `grunt` afterwards.)
- `grunt getver` will quickly tell you which version you are at.

Finally, if need be, you can set up a quick demo page to play with the code. First, edit the files in the `demo` directory. Then display `demo/index.html`, live-reloading your changes to the code or the page, with `grunt demo`. Libraries needed for the demo/playground should go into the Bower dev dependencies – in the project-wide `bower.json` – or else be managed by the dedicated `bower.json` in the demo directory.

_The `grunt interactive` and `grunt demo` commands spin up a web server, opening up the **whole project** to access via http._ So please be aware of the security implications. You can restrict that access to localhost in `Gruntfile.js` if you just use browsers on your machine.

### Changing the tool chain configuration

In case anything about the test and build process needs to be changed, have a look at the following config files:

- `karma.conf.js` (changes to dependencies, additional test frameworks)
- `Gruntfile.js`  (changes to the whole process)
- `web-mocha/_index.html` (changes to dependencies, additional test frameworks)

New test files in the `spec` directory are picked up automatically, no need to edit the configuration for that.

## Facilitating development

To my own surprise, [a kind soul][donations-idea] wanted to donate to one of my projects, but there hadn't been a link. [Now there is.][donations-paypal-link]

Please don't feel obliged in the slightest. The license here is [MIT][license], and so it's free. That said, if you do want to support the maintenance and development of this component, or any of my [other open-source projects][hashchange-projects-overview], I _am_ thankful for your contribution.

Naturally, these things don't pay for themselves – not even remotely. The components I write aim to be well tested, performant, and reliable. These qualities may not seem particularly fascinating, but I put a lot of emphasis on them because they make all the difference in production. They are also rather costly to maintain, time-wise.

That's why donations are welcome, and be it as nod of appreciation to keep spirits up. [Thank you!][donations-paypal-link]

[![Donate with Paypal][donations-paypal-button]][donations-paypal-link]

## Release Notes

### v1.0.6

- Fixed `:inViewport` selector when negated (issue #3)

### v1.0.5

- Updated the jQuery dependency to jQuery 3.1

### v1.0.4

- Updated the jQuery dependency to jQuery 3

### v1.0.2

- Removed $.scrollbarWidth() (now provided by jQuery.documentSize)
- Updated the jQuery.documentSize dependency

### v1.0.1

- Added friendly error message for invalid container param
- Removed redundant project boilerplate
- Improved demo, documentation

### v1.0.0

- Improved caching, especially of container properties
- Improved handling of mixed overflows in $.fn.hasScrollbar()
- Fixed tests for PhantomJS, SlimerJS, IE10
- Added missing copyright notice to Leche test helper

### v0.5.1

- Fixed wrong treatment of container border
- Fixed readme typos

### v0.5.0

- Removed code for document size detection, using jQuery.documentSize instead
- Fixed swapped axes for body query in $.fn.hasScrollbar()
- Refactored $.fn.hasScrollbar
- Fixed $ parameter in IIFE

### v0.4.1

- Made the browser scrollbar width detection run immediately on DOM ready
- Simplified browser scrollbar width detection
- Fixed $(window).hasScrollbar() for IE9
- Fixed tests for IE9

### v0.4.0

- Fixed plugin code for IE8
- Fixed $(window).hasScrollbar() with body overflow: auto, hidden for FF and IE
- Excluded complex hasScrollbar() edge case, when called on body, from handling in some browsers (documented in readme)
- Handled iOS anomaly which ignores overflow-y: hidden for the viewport
- Improved handling of overflow edge cases for viewport and body
- Improved test code, fixed for iOS
- Added an AMD demo
- Fleshed out the readme

### v0.3.0

- Fixed plugin and tests for IE
- Fixed test code for FF
- Added IE, Safari, Opera launchers to test environment
- Fixed various minor bugs

### v0.2.0

- Added box option
- Added $.fn.hasScrollbar, $.fn.scrollbarWidth
- Reorganized plugin, made all tests pass
- Completed core tests, increased test coverage

### v0.1.1

- Fixed custom inViewport selector, switched to current Sizzle API

### v0.1.0

- Initial development, tests, documentation

## License

MIT.

Copyright (c) 2014-2017 Michael Heim.

Code in the data provider test helper: (c) 2014 Box, Inc., Apache 2.0 license. [See file][data-provider.js].

[dist-dev]: https://raw.github.com/hashchange/jquery.isinview/master/dist/jquery.isinview.js "jquery.isinview.js"
[dist-prod]: https://raw.github.com/hashchange/jquery.isinview/master/dist/jquery.isinview.min.js "jquery.isinview.min.js"
[dist-amd-dev]: https://raw.github.com/hashchange/jquery.isinview/master/dist/amd/jquery.isinview.js "jquery.isinview.js, AMD build"
[dist-amd-prod]: https://raw.github.com/hashchange/jquery.isinview/master/dist/amd/jquery.isinview.min.js "jquery.isinview.min.js, AMD build"

[setup]: #dependencies-and-setup "Setup"
[example]: #usage-by-example-lazy-loading "Usage by example: Lazy loading"
[api]: #api "API"
[browsers]: #browser-support "Browser support"
[limitations]: #limitations "Limitations"
[perftips]: #performance-tips "Performance tips"
[build]: #build-process-and-tests "Build process and tests"

[api-core]: #core "API: Core methods"
[filters]: #filters "API: filters"
[api-fn.inView]: #inview-container--options- "API: .inView()"
[api-fn.inViewport]: #inviewport-options- "API: .inViewport()"
[api-selector]: #inviewport-selector "API: :inViewport selector"

[boolean-queries]: #boolean-queries "API: boolean queries"
[api-fn.isInView]: #isinview-container--options- "API: .isInView()"

[api-options]: #options "API: Options for core queries"
[api-options.tolerance]: #optionstolerance "API: 'tolerance' option"
[api-options.partially]: #optionspartially "API: 'partially' option"
[api-options.box]: #optionsbox "API: 'box' option"
[api-options.excludeHidden]: #optionsexcludehidden "API: 'excludeHidden' option"

[api-helpers]: #helpers "API: Helpers"
[api-fn.hasScrollbar]: #hasscrollbar-axis- "API: .hasScrollbar()"
[api-fn.scrollbarWidth]: #scrollbarwidth-axis- "API: .scrollbarWidth()"
[api-fn.ownerWindow]: #ownerwindow "API: .ownerWindow()"

[tests]: #running-tests-creating-a-new-build "Running tests, creating a new build"
[perftests]: #performance-tests "Performance tests"

[jQuery]: http://jquery.com/ "jQuery"
[jQuery.documentSize]: https://github.com/hashchange/jquery.documentsize "jQuery.documentSize"
[Underscore]: http://underscorejs.org/ "Underscore.js"

[demo-jsbin]: http://jsbin.com/legice/6/edit?js,output "jQuery.isInView demo (AMD) – JSBin"
[demo-codepen]: http://codepen.io/hashchange/pen/LVKqPK "jQuery.isInView demo (AMD) – Codepen"
[perftest-jsbin]: http://jsbin.com/lisudi/3 "jQuery.isInView: Performance Test and Comparison (with isInViewport, jquery.visible, jquery_lazyload, hunt) - JS Bin"

[throttled-scroll]: http://ejohn.org/blog/learning-from-twitter/ "John Resig: Learning from Twitter"
[Underscore.throttle]: http://underscorejs.org/#throttle "Underscore.js: _.throttle()"
[css-clipping-masking]: http://css-tricks.com/clipping-masking-css/ "CSS-Tricks: Clipping and Masking in CSS"
[jQuery.documentSize-scrollbarWidth]: https://github.com/hashchange/jquery.documentsize#scroll-bar-size "jQuery.documentSize: $.scrollbarWidth()"

[data-provider.js]: https://github.com/hashchange/jquery.isinview/blob/master/spec/helpers/data-provider.js "Source code of data-provider.js"

[Node.js]: http://nodejs.org/ "Node.js"
[Bower]: http://bower.io/ "Bower: a package manager for the web"
[npm]: https://npmjs.org/ "npm: Node Packaged Modules"
[Grunt]: http://gruntjs.com/ "Grunt: The JavaScript Task Runner"
[Karma]: http://karma-runner.github.io/ "Karma – Spectacular Test Runner for Javascript"
[Mocha]: http://mochajs.org/ "Mocha – the fun, simple, flexible JavaScript test framework"
[Chai]: http://chaijs.com/ "Chai: a BDD / TDD assertion library"
[Sinon]: http://sinonjs.org/ "Sinon.JS – Versatile standalone test spies, stubs and mocks for JavaScript"
[JSHint]: http://www.jshint.com/ "JSHint, a JavaScript Code Quality Tool"

[donations]: #facilitating-development "Facilitating development"
[donations-idea]: https://github.com/hashchange/jquery.documentsize/issues/1 "jQuery.documentSize, issue #1: Thank you!"
[donations-paypal-link]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BJY73NCT5YVVY "Donate with Paypal"
[donations-paypal-button]: https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif "Donate with Paypal"
[license]: #license "License"
[hashchange-projects-overview]: http://hashchange.github.io/ "Hacking the front end: Backbone, Marionette, jQuery and the DOM. An overview of open-source projects by @hashchange."


text:
---
layout: post
title: "Eccentric Shaders"
date: 2016-08-16 00:00:01 -0400
image: "/images/clouds-of-venus.jpg"
excerpt: "A collection of WebGL shaders that run on a web browser. Reflections and explorations about the mechanistic and voided world of computation and quantum theory."
banner:
    video: /images/video/venus.mp4
    loop: true
    volume: 0.0
    start_at: 0.0
    image: /images/clouds-of-venus.jpg
    opacity: 1.0
    background: "#000"
    height: "100vh"
    min_height: "38vh"
medium: "WebGL Shaders"
tags: [math, technology, experiment, programming, universe]
---

This is a collection of WebGL shaders that run in a web browser window. These, for the most part, are reflections and meditations on the laws of the physical laws of nature, expressed in a computer graphic language. Imitating natural patterns with computer code turns out to be a very abstracted and intangible process. This was an exploratory process which explored the mechanistic and voided world of computers.

As computers increasingly become the middle grounds for establishing human understanding about the world, they also give birth to ideas that make us believe that our reality is nothing but a simulation (see [simulation hypothesis](https://en.wikipedia.org/wiki/Simulation_hypothesis)), and therefore not "real". These works are therefore reflections about the way in which humans create a scientific world-view that is no different than a collection of instrument measurements and scientific notations (I reflected on this in _[The Demise of Contemplation and the Rise of Intellectual Labour](/post/the-demise-of-contemplation)_).

This was a background thought that I had throughout the duration of this alienated form of mediated expression. The ultimate revelation that emerged out of these explorations is that the greatest thing that one can do in life is to enjoy one's present existent condition disregarding whether it is "real" or not. The realness of the present is a question that does not have a meaningful answer. The attempt to ascribe and understand everything according to reductionist terms and symbols, only suppresses the belief that everything is real. Therefore, the greatness of life that there could be, is just to enjoy what is always here — the present.

![](https://vimeo.com/200555033)

[Link to Shader Gallery](http://mbrav.github.io/shaders/01/)
[Eccentric Shaders on GitHub](https://github.com/mbrav/shaders)

license: MIT

branch_name: refs/heads/master

extension: markdown

gha_language: HTML

gha_license_id: MIT

license_type: permissive


text:
# githoogle
A fancy poc project to test Reactj Hooks, Redux, NextJs, Thunk, Styled Components, Material-ui and a lot more

Live version here: [https://githoogle.tadeuqc.now.sh/](https://githoogle.tadeuqc.now.sh/)
## Setup

- **Clone the repository with git** by running the following command:
```bash
  git clone git@github.com:tadeuqc/githoogle.git
  ```
- **Install the dependencies** with [**Yarn**](https://yarnpkg.com/en/) ...or [**Npm**](https://www.npmjs.com/). I'll be using Yarn on this README file.

```bash
  cd githoogle
  yarn install
```

- **Run development server** with your preferred package manager

```bash
 yarn dev
 ```

 ## Run production version locally
 - **Run build script** with your preferred package manager
 ```bash
  yarn build
  ```
- **Comment the content of the next.config.js file** the file content must look like this:
 ```bash
  //module.exports = {
  //	target: 'serverless'
  //};

  ```

- **Run start script**. You can also set the port you want by running the command below with "PORT=[the port you want]" for example. The server runs on port 3000 by default
```bash
yarn start
```

 ## Run production version on NOW
 - **Run build script** with your preferred package manager
```bash
 yarn build
 ```

 - This project is configured to fast deploy production version into a Zeit's NOW serverless environment by default. You can deploy it by running the now command on the projects directory:
```bash
 now
 ```

repository: tadeuqc/githoogle

extension: md

gha_language: JavaScript

repo_name: tadeuqc/githoogle


text:
# ![](static/klapp-back.png) klapp-example

Research on cloud base high interaction honeypot

# Running

1. `brew install terraform` install terraform CLI on OSX [other platforms](https://www.terraform.io/downloads.html)
2. `brew install awscli`  install aws CLI on OSX otherwise see: [guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html)
3. Get AWS API token `aws configure`
4. Set terraform variables under [terraform.tfvars](https://github.com/splunk/klapp-example/blob/develop/terraform.tfvars.example)
5. `terraform init`
6. `terraform apply`

# Test
try logging into the `honeypot_ip` returned from terraform with any password to these [users](https://github.com/d1vious/klapp-example/blob/master/ansible/vars/vars.yml)

# Collecting Data
TODO

repository: josehelps/klapp-example

repo_name: josehelps/klapp-example


text:
# Shinseibank-ruby

This is a Shinsei-bank PowerDirect (Shinsei-bank internet banking) library for Ruby.
http://www.shinseibank.com/

Forked from: https://github.com/binzume/shinseibank-ruby

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'shinseibank'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install shinseibank

## Usage

### Command Line Interface

```sh
bundle exec exe/shinseibank --help
```

There are multiple ways to pass credentials.

#### YAML file

```yaml
account: "4009999999"
password: "********"
pin: "1234"
code_card:
 - "ZXCVBNMBNM"
 - "ASDFGHJKLL"
 - "QWERTYUIOP"
 - "1234567890"
 - "ZXCVBNMBNM"
```

The CLI will load `./shinsei_account.yaml` by default, but you can pass your own
credentials file using the `--credentials` option.

#### Environment variables

```sh
SHINSEIBANK_ACCOUNT=4009999999
SHINSEIBANK_PASSWORD=********
SHINSEIBANK_PIN=1234
SHINSEIBANK_CODE_CARD=ZXCVBNMBNM,ASDFGHJKLL,QWERTYUIOP,1234567890,ZXCVBNMBNM
bundle exec exe/shinseibank --help
```

You can also use [`envchain`](https://github.com/sorah/envchain) to store these
values securely.

```sh
brew install envchain

envchain --set my-shinsei SHINSEIBANK_ACCOUNT SHINSEIBANK_PASSWORD SHINSEIBANK_PIN SHINSEIBANK_CODE_CARD
# Here, set your credential values one by one.

envchain my-shinsei bundle exec exe/shinseibank account show
```

### Library

Provide account number, password, pin code and the security card grid.

```ruby
require_relative 'shinseibank'

powerdirect = ShinseiBank.connect(
  account: "4009999999",
  password: "********",
  pin: "1234",
  code_card: [
    "ZXCVBNMBNM",
    "ASDFGHJKLL",
    "QWERTYUIOP",
    "1234567890",
    "ZXCVBNMBNM"
  ]
)

# login
unless powerdirect
  puts 'LOGIN ERROR'
  exit
end

begin
  puts 'total: ' + powerdirect.total_balance.to_s
  powerdirect.recent.each do |row|
    p row
  end

  puts "accounts:"
  powerdirect.accounts.values.find_all{|a|a[:balance]>0}.each{|a|
    p a
  }
  puts "funds:"
  powerdirect.funds.each{|f|
    p f
  }

  # 登録済み口座に振り込み 200万円まで？？
  # powerdirect.transfer_to_registered_account('登録済み振込先の口座番号7桁(仮)', 50000)

ensure
  # logout
  powerdirect.logout
end

puts "ok"
```

### Transfer to a registered account

```
powerdirect.transfer_to_registered_account('registed_account_num', 50000)
```

With remitter information:
```
powerdirect.transfer_to_registered_account('registed_account_num', 50000, remitter_info: 'YEY', remitter_info_pos: :after)
```

- TODO: Use the confirm method to confirm the transaction

### Buy and sell funds

投資信託を買う(すでに買ってあるやつを追加で)

```ruby
fund = powerdirect.funds[0]
req = powerdirect.buy_fund fund, 1000000
powerdirect.confitm req
```

投資信託を解約

```ruby
fund = powerdirect.funds[0]
req = powerdirect.sell_fund fund, 1230000
powerdirect.confitm req
```

あらゆる動作は無保証です．実装と動作をよく確認して使ってください．

## Development

After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/knshiro/shinseibank-ruby.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

repository: knshiro/shinseibank-ruby

gha_language: Ruby

repo_name: knshiro/shinseibank-ruby


text:
# Extending Classes

Extensibility has been kept in mind with this package as to allow you to customise and change the functionality as required for your application. All classes that are exported from this package provide mixin functionality at the import level so that any extended functionality is available anywhere in your application. This is all handled internally within this package so all you have to do is provide a mixin function.

## Using a mixer

Mixers are provided for all classes that are exported by this package anf provide a means for you to `mixin` your own properties and methods into the classes provided by `@openrailuk/common`. An example of a mixer function that adds the property `test` as well as adding a toggle function into the `Association`. **This should all be done before any other initialisation in your application**:

```javascript
import { Association, associationMixer } from '@openrailuk/common';

const sTest = Symbol('test');

function testMixin(SuperClass) {
  return class Association extends SuperClass {
    constructor(...args) {
      super(...args);

      this[sTest] = true;
    }

    get test() {
      return this[sTest] || false;
    }

    toggleInternalValue() {
      this[sTest] = !this[sTest];
    }
  }
}

associationMixer(testMixin);

// your application

```

You might ask, why does the example use a Symbol as the key inside the extended class? This is to prevent accidential conflicts with internal values when extending the classes functionality. This is because your application may not be the only thing extending functionality (at a minimum other @openrailuk packages extend the classes too). Symbols help to mitigate this issue as no two Symbols have the same value, even when they have the same description. This allows your application code to remain seperate from others and for node to throw an error if you attempt to set two of the same getters/setters which are already defined.

## what if I want to access the internal values of the existing class?

You might have an occasion where you need to modify the internal values of the existing class, and because Symbols are used there would not be an easy way of determining what key to use. To get around this a 2nd argument is passed into the mixer function which provides a map of all symbols used by the base class (this excludes any symbols added by other mixers. Raise a request if this is something you want though). An example of how to use it is as follows:

```javascript
import { Association, associationMixer } from '@openrailuk/common';

function testMixin(SuperClass, symbols) {
  return class Association extends SuperClass {
    isMainAString() {
      return typeof this[symbols.get('main')] === 'string';
    }
  }
}

associationMixer(testMixin);

```

The available symbols in the map can be determined from the individual class documentation.

## Any other information

This is all there is too it. It is just class extensibility using ES6 mixins with some fancy functions to do it.

path: /docs/Extending Classes.md

filename: Extending Classes.md


text:
# Conjoint-Analysis
The aim of the project was to produce a set of scripts that would perform conjoint analysis on data about a product. The scripts use the data given by consumers about their preferences for a product. The result of a conjoint analysis is a model of the response consumers have towards a certain product in its different attribute settings (price, size, etc).

The initial inspiration for the project came from a client. He wanted to have scripts written in python that depended on nothing but the native language. This was to allow the client to translate the code into other languages at a later date without having to figure out what the dependencies do. Producing these scripts depended upon knowledge of linear algebra and linear regression in multiple dimensions.

The code is documented throught and has a file that explains what the scripts need and what they produce.

BIBLIOGRAPHY:

The Handbook of Marketing Research; Rajiv Grover, Marco Vriens; CH15

Getting Started with Conjoint Analysis: Strategies for Product Design and Pricing Research

How to ensure the price is right: Conjoint analysis balances price with quality; Paul Hunt

repository: mdiby/Conjoint-Analysis

repo_name: mdiby/Conjoint-Analysis


text:
# Welcome! Awesome stuff available on Internet

This directory is available to share great content

While this content is not organized, use your browser's search function to find the words or topics you want.

Last update: June 29, 2022

## Unsorted links
- [Example](http://www.example.com)

## Linux
- [Linux](https://www.linux.com)

---

\[GitHub\] [Web-Editor - codespaces](https://docs.github.com/en/codespaces/developing-in-codespaces/web-based-editor)

\[PodCast\] [A Bug Story - How Narrative Bias Creates Blind Spots](https://spec.fm/podcasts/developer-tea/167202)

\[Tool\] [Convert YouTube link to mp3 or mp4 file](https://youtube-to-mp3.org/mp3-convert/)

## Coding Corner - tips & tricks

\[XCode\] [Warning related to team ID - how to setup it](https://stackoverflow.com/questions/56616238/warning-for-xcode-capabilities-for-project-may-not-function-correctly-because)

license: Unlicense

repository: lgturatti/welcome

repo_name: lgturatti/welcome


text:
# node-jungle

[![Greenkeeper badge](https://badges.greenkeeper.io/moqada/node-jungle.svg)](https://greenkeeper.io/)

[![NPM version][npm-image]][npm-url]
[![NPM downloads][npm-download-image]][npm-download-url]
[![Build Status][travis-image]][travis-url]
[![Dependency Status][daviddm-image]][daviddm-url]
[![DevDependency Status][daviddm-dev-image]][daviddm-dev-url]
[![License][license-image]][license-url]

node.js port of [jungle](https://github.com/achiku/jungle)

## Installation

```
npm install -g node-jungle
```

## Configuration

You can create the credential file yourself. By default, its location is at `~/.aws/credentials`

```
[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_SECRET_KEY
```

You may also want to set a default region. This can be done in the configuration file.
But, filtering target is EnvironmentName.

### Elastic MapReduce

Listing all Elastic MapReduce Clusters

```
jungle emr ls
```

`jungle emr ls` has same options as `jungle ec2 ls`.
But, filtering target is Name.

### RDS

Listing all RDS instances

```
jungle rds ls
```

`jungle rds ls` has same options as `jungle ec2 ls`.
But, filtering target is DB Indentifier.

## Todo

- [ ] Add ec2 ssh command
- [ ] Add ELB Sub commands
- [ ] Refactor Internal libs
- [x] Add docs (#17)
- [ ] Add tests
- [ ] Replace command to `jg` from `jungle`
- [ ] Add update-notifier

[npm-url]: https://www.npmjs.com/package/node-jungle
[npm-image]: https://img.shields.io/npm/v/node-jungle.svg?style=flat-square
[npm-download-url]: https://www.npmjs.com/package/node-jungle
[npm-download-image]: https://img.shields.io/npm/dt/node-jungle.svg?style=flat-square
[travis-url]: https://travis-ci.org/moqada/node-jungle
[travis-image]: https://img.shields.io/travis/moqada/node-jungle.svg?style=flat-square
[daviddm-url]: https://david-dm.org/moqada/node-jungle
[daviddm-image]: https://img.shields.io/david/moqada/node-jungle.svg?style=flat-square
[daviddm-dev-url]: https://david-dm.org/moqada/node-jungle#info=devDependencies
[daviddm-dev-image]: https://img.shields.io/david/dev/moqada/node-jungle.svg?style=flat-square
[license-url]: http://opensource.org/licenses/MIT
[license-image]: https://img.shields.io/npm/l/node-jungle.svg?style=flat-square

repository: moqada/node-jungle

repo_name: moqada/node-jungle


text:
## Usage

    require 'toe_tag'

    # Exception grouping:
    # Note that not all of the constants have to be defined. Missing ones will be ignored.
    DatabaseError = ToeTag.category %w[ActiveRecord::JDBCError PG::Error ActiveRecord::StatementInvalid]

    begin
      leaky_database_call
    rescue DatabaseError => err
      # err could be any of the listed classes
    end

    # Filtering by message:
    SpuriousError = DatabaseError.with_message(/spurious|pointless|meaningless/)

    begin
      boring_database_call # ! raises PG::Error, "something spurious happened"
    rescue SpuriousError
      log "something spurious happened, ignore it"
    rescue DatabaseError
      log "watch out, something bad happened"
    end

    # Filtering by proc
    class FancyError
      attr_reader :error_code

      def initialize(message, error_code)
        super message
        @error_code = error_code
      end
    end

    FancierError = FancyError.with_proc{|e| e.error_code == 123 }

    begin
      fancy_api_call
    rescue FancierError
      log "it's one of those 123 errors again"
    rescue FancyError
      log "some unknown error, reraising"
      raise
    end

## Installation

Add this line to your application's Gemfile:

    gem 'toe_tag'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install toe_tag

## Contributing

1. Fork it.
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin my-new-feature`).
5. Submit a pull request.

gha_license_id: NOASSERTION


text:
---
title: Fonts
page_title: Fonts | UI for WinForms Documentation
description: Fonts
slug: winforms/pdfprocessing/concepts/fonts
tags: fonts
published: True
position: 3
previous_url: pdfprocessing-concepts-fonts
---

# Fonts

__RadPdfProcessing__ uses fonts represented by __FontBase__ objects to specify the look of the text that is exported to PDF. Currently, it supports two font types: Standard and Embedded.

## Standard Fonts

There are 14 standard fonts that are not embedded in the document when you use them. These fonts can accessed through the [FontsRepository](http://www.telerik.com/help/winforms/allmembers_t_telerik_windows_documents_fixed_model_fonts_fontsrepository.html) class and are listed below.

* Helvetica

* Helvetica Bold

* Helvetica Oblique

* Helvetica BoldOblique

* Courier

* Courier Bold

* Courier Oblique

* Courier BoldOblique

* Times Roman

* Times Bold

* Times Italic

* Times BoldItalic

* Symbol

* ZapfDingbats

## Embedded Fonts

All fonts which are not included in the 14 standard ones should be embedded in the PDF document. Otherwise, the result when the document is rendered is unpredictable. In __RadPdfProcessing__ you have the ability to embed fonts.

### Registering a Font

If you want to use a font which is not part of the standard ones you can register it using the __RegisterFont()__ method of the __FontRepository__ static class. The method requires four parameters - FontFamily, FontStyle and FontWeight objects describing the font and a byte array containing the raw font data.

__Example 1__ demonstrates how you can use the RegisterFont() method.

#### Example 1: Register font

{{source=..\SamplesCS\PdfProcessing\Concepts\PdfProcessingConceptsFonts.cs region=radpdfprocessing-concepts-fonts_0}}
{{source=..\SamplesVB\PdfProcessing\Concepts\PdfProcessingConceptsFonts.vb region=radpdfprocessing-concepts-fonts_0}}

````C#
FontsRepository.RegisterFont(fontFamily, fontStyle, fontWeight, data);

````
````VB.NET
FontsRepository.RegisterFont(fontFamily, fontStyle, fontWeight, data)

````

{{endregion}}

### Creating a Font

Each registered font can be obtained from the font repository as __FontBase__ object and applied to a [TextFragment]({%slug winforms/pdfprocessing/model/textfragment%}).

__Example 2__ shows how to create a font using the FontsRepository.
#### Example 2: Create FontBase

{{source=..\SamplesCS\PdfProcessing\Concepts\PdfProcessingConceptsFonts.cs region=radpdfprocessing-concepts-fonts_1}}
{{source=..\SamplesVB\PdfProcessing\Concepts\PdfProcessingConceptsFonts.vb region=radpdfprocessing-concepts-fonts_1}}

````C#
FontBase font;
bool success = FontsRepository.TryCreateFont(fontFamily, fontStyle, fontWeight, out font);

````
````VB.NET
Dim font As FontBase
Dim success As Boolean = FontsRepository.TryCreateFont(fontFamily, fontStyle, fontWeight, font)

````

{{endregion}}

>note Creating a font that is -not- present in the repository with the code from __Example 2__ is going to fail.
>

>note You can create fonts that are not explicitly registered. Creating a font that is not registered in the repository with the code from __Example 2__ tries to find the font from the ones installed on the machine.
>

# See Also

 * [FontsRepository](http://www.telerik.com/help/winforms/allmembers_t_telerik_windows_documents_fixed_model_fonts_fontsrepository.html)

 * [TextFragment]({%slug winforms/pdfprocessing/model/textfragment%})


text:
# GOOGLE CLOUD IDENTITY
Global resource
Identity as a Service (IDaaS)

## Best Practice
always use service accounts rather than keys / user accounts even for local dev

## Cloud Platform Managed Keys
GCLOUD manages the keys and rotates once a day. Use these instead

## Directory Sync
can sync to LDAP or AD

## Identities
works with other google services like Chrome
can be used with SSO and other apps

repository: evanharmon/eph-headspace

branch_name: refs/heads/main

repo_name: evanharmon/eph-headspace


text:
# chromecast-player

simple chromecast player.
Relies on the [castv2-client](https://github.com/thibauts/node-castv2-client) lib
from thibauts, all credits go to him.

### Usage Samples

Start Playback of some video file:

```javascript
var player = require('chromecast-player')();
var media = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/ED_1280.mp4';
player.launch(media, function(err, p) {
  p.once('playing', function() {
    console.log('playback has started.');
  });
});
```

Attach to a currently playing session:

```javascript
var player = require('chromecast-player')();
player.attach(function(err, p) {
  p.pause();
});
```

### Installation

`npm install chromecast-player`

## License
Copyright (c) 2014 Simon Kusterer
Licensed under the MIT license.

repository: BrOakes/project-time-warp

repo_name: BrOakes/project-time-warp


text:
# Flatline 4
[![Travis CI](https://img.shields.io/travis/Flatline4/Flatline4.svg?style=flat-square)](https://travis-ci.org/Flatline4/Flatline4)
[![Gitter](https://img.shields.io/badge/chat-Gitter-ff69b4.svg?style=flat-square)](https://gitter.im/Flatline4/Lobby)

## What is Flatline4?
Flatline4: the definitive web development experience. Flatline4 is a new front-end framework that's here to stay. Written purely in TypeScript, Flatline provides
a rich suite of features to web developers developing SPAs including HTML generation, routing, and AJAX requests (that's asynchronous javascript and xml request, not the dish soap).
Flatline4 allows developers to create their website's using entirely JavaScript or TypeScript and eliminates the pain of writing HTML and CSS. Sound intersting? Read on to learn more.

## Sounds awesome! But how can I use it?
Becuase Flatline compiles to pure JavaScript, using it is as simple as adding a script tag to your page. See the example below. In addition, a demo website is included in the demo folder.
```html
<!DOCTYPE html>
<html>
  <body>
    <script src="flatline-browser.min.js"></script>
    <script>
      Flatline.Route('home', function(body) {
        body
          .h1(function(parent, style, children) {
            children
              .text('Hello World!');
          });
      });
    </script>
  </body>
</html>
```

## So how do I build it?
Becuase Flatline4 using npm as its package manager and task runner, installing and building the project is a breeze. Simply clone the repository, navigate to the root directory,
and run `npm install` to install the project dependencies and `npm run build` to build the project. The build outputs 4 bundles:
* flatline-browser.js
* flatline-browser.min.js
* flatline-common.js
* flatline-common.min.js
The browser bundles are for use in the browser, and the common bundles are for use in NodeJS.

> During development, use `npm run dev` instead to only build unminified files and watch for changes

## Contributor Guide
TODO: Write a contributor guide

## License
MIT

gha_language: TypeScript


text:
# Security Policy

This document explains the security policy of webpack-cli and how we intend to support webpack and webpack-cli.

## Supported Versions

webpack CLI is currently supporting webpack v4 and webpack v5. Security fixes are released in patches.

| webpack version | webpack-cli version           | Supported          |
| --------------- | ----------------------------- | ------------------ |
| >= 4.20.x       | ^4.2.0                        | :white_check_mark: |
| <= 4.19.x       | ^4.2.0                        | :white_check_mark: |
| 5.x.0           | ^4.2.0                        | :white_check_mark: |
| 5.0.x           | ^4.2.0                        | :white_check_mark: |
| < 4.x.x         | (CLI included in webpack < 4) | :x:                |

**Note: Using webpack < 4 with webpack CLI is not required as CLI was [included](https://github.com/webpack/webpack/commit/4b0332d3909eea8115d84f9a03da2d52478daa70#diff-b9cfc7f2cdf78a7f4b91a753d10865a2) in webpack.**

## Reporting a Vulnerability

To report a vulnerability, please contact one of webpack maintainers through the email provided from either npm, GitHub or reach out at other social media platforms. For third party security vulnerabilities, submitting an issue or Pull Request to fix the security vulnerability is much appreciated. We also use dependabot from GitHub to avoid vulnerabilities.

repository: webpack/webpack-cli

repo_name: webpack/webpack-cli


text:
# Transberingia bursifolia subsp. bursifolia (DC.) Al-Shehbaz & O'Kane SUBSPECIES

#### Status
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
null

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# pypher.py
A Python 3.5.1 application for encoding and decoding common ciphers. Mainly a personal 'exercise' for algorithms.

Cracking Caesarian cipher currently only works in Linux using `/usr/share/dict/american-english`. Everything else, in theory, should with any Python 3.

I wrote this when I was still first learning Python, so this was pretty much an exercise with the language and Git.


text:
# Video Streaming - Vupload
_Worker for video conversion_

**See [backend-service](https://github.com/junzhli/video-platform-api) for more details**

Prerequisite
-----
* MongoDB >= v3.6
* RabbitMQ >= v3.8

Getting started
-----

```bash
## see config/env.go for further environment configurations
$ go run cmd/main.go
```


text:
---
layout: page
title: "Getting started"
description: ""
group: navigation
scrollspy: [Setting homes, Going home, Permissions]
---
{% include JB/setup %}

Getting started with Hearthstone couldn't be easier. Just download and drag it into your plugins folder and away you go. Still stuck? Read on.

## Setting homes

Players can set a home anywhere in the game world with two exceptions. Firstly players may not set homes in areas where they are unable to build. Secondly they can not use an obstructed location. Hearthstone considers any area which is not made out of air and does not have enough space for the player to teleport to as obstructed.

You can set your own home by typing either `/home set` or `/hs set`; both do exactly the same thing. There is no cooldown when setting a new home and you can do it as often as you like.

Players are allowed to set one home per world. If they set another one when they already have an existing home, it will forget about the other one.

### Setting other players homes

You can also set a home for someone else using the same command. This works exactly the same way but you need to supply the name of the player whos home you want to set. For example `/hs set grandwazir` would set my home to your current location.

### Restricting home locations

You can also prevent players from setting a world in a location where they are unable to build. This is helpful for example in adventure maps where teleportation could cause you problems.

All you need to do is download WorldGuard and region the areas of your world. Hearthstone will check with WorldGuard to see if a player is allowed to build in an area. It is that simple!
## Going home

You can teleport home at any time by typing `/home` providing it is not cooling down. This will instantly teleport to your home in your current world. Unless I have permission I would not be able to teleport again until my cooldown has expired.

You can also teleport to homes located in other worlds by typing `/hs teleport grandwazir world_nether`. This would teleport me to my secret nether fortress.

### Teleporting to other players homes

Additionally you can teleport to a home belonging to any player in any world. This command still enforces a cooldown, so it you may want to make sure your moderators are except from the cooldown when you give them permission to use this command. For example I am going to teleport to Fuzic's house in the current world by typing `/hs teleport fuzic`.

### Cooldown between teleports

It is possible for administrators to force players to obey a cooldown between teleports. This is useful to prevent players repeatedly setting and teleporting home as a travel, safety or griefing exploit. You set the amount of time you wish players to wait by changing the value of cooldown in the config.yml. By default it looks like this:

    cooldown: 15m

## Permissions

Each command is assigned its own permission node and all follow the same style. The full list of available permissions, and their defaults, is below. Additionally there is the `hearthstone.teleport.cooldown` node. Players who have this permission will not be able to teleport home unless the cooldown time has expired.

    hearthstone.set (op)
    hearthstone.set.own (true)
    hearthstone.set.others (op)
    hearthstone.teleport (op)
    hearthstone.teleport.own (true)
    hearthstone.teleport.others (op)
    hearthstone.teleport.cooldown (!op)

repository: grandwazir/jekyll-plugin-site

repo_name: grandwazir/jekyll-plugin-site


text:
# Contribute to Pomodoro

## How do I make a contribution?

1. Find or add an issue that you are interested in addressing or a feature that you would like to add.
2. Fork the repository associated with the issue to your local GitHub organization. This means that you will have a copy of the repository under ```your-GitHub-username/repository-name.```
3. Clone the repository to your local machine using ```$ git clone https://github.com/github-username/repository-name.git```.
4. Create a new branch for your fix using ```$ git checkout -b branch-name-here```.
5. Run ```$ npm i``` and ```$ npm run start``` to make the appropriate changes for the issue you are trying to address or the feature that you want to add.
6. Use ```$ git add insert-paths-of-changed-files-here``` to add the file contents of the changed files to the "snapshot" git uses to manage the state of the project, also known as the index.
7. Use ```$ git commit -m "Insert a short message of the changes made here"``` to store the contents of the index with a descriptive message.
8. Push the changes to the remote repository using ```$ git push origin branch-name-here```.
9. Submit a pull request to the upstream repository.
10. Title the pull request with a short description of the changes made and the issue or bug number associated with your change. For example, you can title an issue like so "Added more log outputting to resolve #4352".
11. In the description of the pull request, explain the changes that you made, any issues you think exist with the pull request you made, and any questions you have for the maintainer. It's OK if your pull request is not perfect (no pull request is), the reviewer will be able to help you fix any problems and improve it!
12. Wait for the pull request to be reviewed by a maintainer.
13. Make changes to the pull request if the reviewing maintainer recommends them.
14. Celebrate your success after your pull request is merged!

repository: illiaTaboo/pomodoro

repo_name: illiaTaboo/pomodoro


text:
# Guessing Game Collection

![Languages](https://img.shields.io/github/languages/count/hgz12345ssdlh/guessing-game-collection)
![Code-size](https://img.shields.io/github/languages/code-size/hgz12345ssdlh/guessing-game-collection?color=purple)

A collection of the number guessing game in different languages - weekly update ;)

Aimed to help me explore & touch new languages & technologies. Writing a simple game definitely cannot exploit the full advantages / disadvantages of a language, but should be a good start towards learning its pipeline of development and basic syntax.

## Progress List

System programming languages:

- [x] C
- [x] C++
- [x] Rust
- [x] Go

Common scripting languages:

- [x] Python
- [ ] Ruby
- [x] Julia
- [ ] R

Java & its variants:

- [ ] Java
- [ ] Kotlin
- [ ] Dart

Web scripting languages (with sample page in HTML/CSS):

- [ ] JavaScript
- [ ] TypeScript
- [ ] PHP

Other app development:

- [ ] Swift
- [ ] Objective-C
- [ ] C#

Lisp & its dialects:

- [ ] Common Lisp
- [ ] Scala
- [ ] Scheme
- [ ] Clojure

Erlang & its variants:

- [ ] Erlang
- [ ] Elixir

Assembly:

- [ ] MIPS
- [ ] RISC-V
- [ ] x86
- [ ] ARM
- [ ] WebAssembly

## Testing

Run the tester with Python3:

```bash
$ python3 test-all.py
```

This will give comprehensive tests for all language versions defined in `test-all.py`. Outputs will be strictly matched.

## Expected Behavior

**Normal behavior** is a guessing game where the player tries to guess a random integer between 1 to 100.

```
Welcome to Guanzhou's guessing game!
Enter an int ∈ [1, 100], or 'q' to quit: 50
  Your guess is... Too large!
Enter an int ∈ [1, 100], or 'q' to quit: 25
  Your guess is... Too large!
Enter an int ∈ [1, 100], or 'q' to quit: 12
  Your guess is... Too large!
Enter an int ∈ [1, 100], or 'q' to quit: 6
  Your guess is... Too small!
Enter an int ∈ [1, 100], or 'q' to quit: 9
  Your guess is... Too large!
Enter an int ∈ [1, 100], or 'q' to quit: 7
  Your guess is... Too small!
Enter an int ∈ [1, 100], or 'q' to quit: 8
  Your guess is... Correct!
You win! Congrats ;)
<Game stats>
  You tried: 50 25 12 6 9 7 8
  In total 7 tries used.
```

> Binary search should be the best strategy overall, but you can get lucky sometimes ;)

**Robustness requirements** under boundary conditions are defined as the following:

```
# Invalid input.
Enter an int ∈ [1, 100], or 'q' to quit: e
WARN: not a valid integer. Try again...

# Out-of-range input.
Enter an int ∈ [1, 100], or 'q' to quit: -141
WARN: valid input ∈ [1, 100]. Try again...

# Allow leading & trailing whitespaces.
Enter an int ∈ [1, 100], or 'q' to quit:   50 \t
  Your guess is... Too large!

# Empty input.
Enter an int ∈ [1, 100], or 'q' to quit:        # Directly display a new prompt.
Enter an int ∈ [1, 100], or 'q' to quit:

# Start with 'q'.
Enter an int ∈ [1, 100], or 'q' to quit: qewe   # Treat as quit signal as well.
Sad to see you go :(
```

All language versions must satisfy this specification.


text:
---
layout: index
title: String
---

A string is a piece of text (string literal), a string variable is variable that holds text.

    myStingVar = "World"

Strings can be added together in any combination of string literal (enclosed in quotes) or variables.

    myNewStringVar = "Hello " + myStringVar

They can also be used to show messages to the user with the *msg* command.

    msg (myNewStringVar)

Also see String Functions

repository: textadventures/quest

gha_language: C#

repo_name: textadventures/quest


text:
---
title: "UB Lockdown V3"
date: 2017-12-04 23:15:24 -0500
categories: [Incident Response]
tags: [incident response, blue team, rit, ccdc]
author: Duc Phan
excerpt-separator: <!--more-->
---

The weekend before Thanksgiving, I had the chance to play at Lockdown v3, an incident response competition held at University of Buffalo by [UBNetDef](https://lockdown.ubnetdef.org).

<!--more-->

## Overview
- This is a defense-only competition
- There are 6 people per team.
- Each team is given access to an infrastructure with basic components of an enterprise network:
  + Windows and Linux client machines
  + Web server(s)
  + Active Directory/DNS server(s)
  + FTP server
  + Mail server
  + Databases
  + A router. In this competition, it is a pfSense router.
- While blue teams (competitors) trying to defend the infrastructure under the attack of red team, blue teams have to complete technical and business tasks (called **injects**) within a certain amount of time. This increase significantly the pressure of the competition since the scoring are 50/50 for up-time and injects.
- During the competition, there are meeting between team captain and C-level people for information inquiry about the work progress.
- Blue teams are required to turn in an incident response report as the final inject at the end of the competition.

## Competition Time

My responsibilities in a nutshell:

- Keep the web servers up and running and maintain the communication between the web application and the databases.
- Keep the Linux clients ping-able from the scoring engine.
- Keep things clean and properly configured.
- Record red-team activities for incident reporting.

I started out by changing the default passwords on all the machines that I was on. Firstly, I changed password of the root users and users that are used to login to other machines to avoid password reuse. However, I **stopped changing the passwords** when I realized that there were so many users and I couldn't figure out a way to automate this process without hard-coding it. I didn't even proceed to audit those users. This is a huge mistake.

I tried to deploy my firewall script on the machines serveral times. It didn't work perfectly. I ended up taking them down, leaving the machines without firewall. They did not get hit hard until the end of the competition, when red team tried to burn the scoreboard. Still, it is another big mistake where I could have avoided by better preparation.

Here are some of my findings before red team burning the scoreboard:

- Backdoor in ~/.bashrc that filters out red-team activities from the output of commands like `netstat, ps`.
- Reverse shell backdoor in `/root`
- Backdoor ssh-key that allow red-team to login without password.

Towards the end of the competition, red-team attempted to delete the host routing table on the Linux clients, making it un-ping-able from the scoring engine. The solution was to rebuild the routing table. It took me a while as I didn't expect to work with host routing table. This is a new thing that I've learned during the competition.

## Lesson Learned

tl;dr:

- Firewalls ftw.
- Don't rush. Know what you do.
- Have a plan, stick with it.
- Look carefully.
- Change default credentials. There is a potato out there died for each of the unchanged credential.

### Gameplay

1.  IF NOT, MAKE ONE, AND STICK WITH IT**: I had a plan. I even told myself that I would be panicking during the competition and that's what the 5-minute plan was for. I ended up carrying out portions of the plans in no order. That made me panic even worse towards the end of the competition.
2. It is easy to overlook obvious things when being under pressure. I skipped things that I was supposed to investigate: ansible scripts, redundant services that are actually backdoors, .bashrc, aliases, all kind of things in this planet.
3. There is a lot going on this kind of competition and even in real life situation. For me, it is often difficult to distinguish between malicious and non-malicious files/processes/configurations/etc during the competition and at that time, I did not know what to do with those things and proceeded to do research on things that I could have spent time learning before the competition. I think one of the best way to truly understand something is to build it from scratch and install components and monitor the changes in the systems. In that way, I can figure out different "states" of the systems, and whether something is malicious or not.

## The techy bits

1. **CHANGE DEFAULT PASSWORDS**: Just change it. If there's too much work, try to find a way to automate the process.
2. Have a working firewall script. My scripts break on all the competitions that I have ever been to.
3. The scored web application communicates with the databases. When the databases are down, we lose points for the web application as well. This means it's not about just defending separate machines, but keeping the communication between the components is also critical.
4. Monitoring file integrity is critical.
5. Check for PAM backdoor.

repository: ducphanduyagentp/blog

repo_name: ducphanduyagentp/blog


text:
# OnChangeTextListener
A small extension to simplify work with the TextChangedListener in Kotlin
### Usage
Unpack zip, copy OnChangeTextListener.kt file to your folder with your scripts. Then just make an instance of Add class, so the syntax will be following:

  OnChangeTextListener.Add(yourTextInput, ::yourFunction)

So that's it, it's just simple as that, I also provided the example with usage and with the code in Example folder and compiled .apk in the build folder, so you can check it out, but I will insert here the code as well with comments:

    private var changed = 0 //declaration for our variable what will change upon every change

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val input = findViewById<EditText>(R.id.inputSample)
        OnChangeTextListener.Add(input, ::onChangeFunction) //add listener to input with onChangeFunction, which is defined lower
    }

    private fun onChangeFunction(){
        changed++ //add 1 after any change
        findViewById<TextView>(R.id.outputSample).text = "Text were changed $changed times" //this will show up the in TextView the number of changes
    }

repository: VelociraptorCZE/OnChangeTextListener

repo_name: VelociraptorCZE/OnChangeTextListener


text:
---
id: copy
title: Copy Command
sidebar_label: Copy
description: Copies a running service to a specific template.
---

The `copy` command is used to copy a running service to a specific template.

Permission: `cloudnet.command.copy`
Aliases: `copy`, `cp`

:::info
This command can be used as a command in the node console or as a command ingame with the prefix `/cloud`
:::

This is a basic overview about the `copy` command.
Please have a look below for any further information.
```
COMMAND: cp <local service uniqueId | name> [excludes: spigot.jar;logs;plugins] | template=storage:prefix/name
```

## cp
**Usage:** `cp <local service uniqueId | name> [excludes: spigot.jar;logs;plugins] | template=storage:prefix/name`

The first argument has to be the name of the service you want to copy (e.g. `Lobby-1`).
After that, you can exclude files which should not be copied into the template.
At the end, separated with a `|` you can set a specific template to which the files should be copied.

repository: GiantTreeLP/website

branch_name: refs/heads/development

repo_name: GiantTreeLP/website


text:
## Expected result

Listing containers must show three containers running and the port mapping as below:
```
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
d6752b317e6d   compose-dev-env_proxy                 "nginx -g 'daemon of…"   About a minute ago   Up About a minute   <IP_ADDRESS>:80->80/tcp, :::80->80/tcp   compose-dev-env_proxy_1
70bf9182ea52   compose-dev-env_backend               "/server"                About a minute ago   Up About a minute   8000/tcp                            compose-dev-env_backend_1
c67de604799d   mariadb                               "docker-entrypoint.s…"   About a minute ago   Up About a minute   3306/tcp                            compose-dev-env_db_1
```

After the application starts, navigate to `http://localhost:80` in your web browser or run:
```
$ curl localhost:80
["Blog post #0","Blog post #1","Blog post #2","Blog post #3","Blog post #4"]
```

Stop and remove the containers
```
$ docker-compose down
```


text:
# 55. Jump Game

* *Difficulty: Medium*

* *Topics: Array, Greedy*

* *Similar Questions:*

  * [Jump Game II](jump-game-ii.md)

## Problem:

Given an array of non-negative integers, you are initially positioned at the first index of the array.

Each element in the array represents your maximum jump length at that position.

Determine if you are able to reach the last index.

Example 1:

Input: [2,3,1,1,4]
Output: true
Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index.

Example 2:

Input: [3,2,1,0,4]
Output: false
Explanation: You will always arrive at index 3 no matter what. Its maximum
             jump length is 0, which makes it impossible to reach the last index.

## Solutions:

```c++
class Solution {
public:
    bool canJump(vector<int>& nums) {
        if (nums.size() == 0)   return false;
        int distance = 0;
        for (int i = 0; i <= distance; ++i) {
            distance = max(distance, i + nums[i]);
            if (distance >= nums.size() - 1) return true;
        }

        return false;
    }
};
```

repository: LamhotJM/git-book

repo_name: LamhotJM/git-book


text:
Releasing Ambassador
====================

If you just want to **use** Ambassador, check out https://www.getambassador.io/! You don't need to build - much less release! - anything, and in fact you shouldn't.

If you don't work at Datawire, this document is probably not going to help you. Maybe check out [the developer guide](BUILDING.md) instead.

----

If you're still reading, you must be at Datawire. Congrats, you picked a fine place to work! To release Ambassador, you'll need credentials for our Github repos.

1. PRs will pile up on `master`. **Don't accept PRs for which CI doesn't show passing tests.**

2. Once `master` has all the release drivers, tag `master` with an RC tag, e.g. `0.33.0-rc1`.

3. The RC tag will trigger CI to run a new build and new tests. It had better pass: if not, figure out why.

4. The RC build will be available as e.g. `quay.io/datawire/ambassador:0.33.0-rc1` and also as e.g. `quay.io/datawire/ambassador:0.33.0-rc-latest`. Any other testing you want to do against this image, rock on.

5. When you're happy with everything, sync up the docs!
   - `make pull-docs` to pull updates from the docs repo
   - Handle conflicts as needed.
   - Commit any conflict-resolution changes to `master`.

6. After the docs are synced, use `make release-prep` to update `CHANGELOG.md` and `docs/versions.yml`.
   - It will _commit_, but not _push_, the updated files. Make sure the diffs it shows you look correct!
   - Do a manual `git push` to update the world with your new files.

7. Now for the time-critical bit.
   - Tag `master` with a GA tag like `0.33.0` and let CI do its thing.
   - CI will retag the latest RC image as the GA image.
   - `make docs-push` _after the retag_ to push new docs out to the website.

   **Note** that there must be at least one RC build before a GA, since the GA tag **does not** rebuild the docker images -- it retags the ones built by the RC build. This is intentional, to allow for testing to happen on the actual artifacts that will be released.

8. Finally, go submit a PR into the `helm/charts` repo to update things in `stable/ambassador`:
   - in `Chart.yaml`, update `appVersion` with the new Ambassador version, and bump `version`.
   - in `README.md`, update the default value of `image.tag`.
   - in `values.yaml`, update `tag`.

----
Updating Ambassador's Envoy
----

Ambassador currently relies on a custom Envoy build which includes the Ambassador `extauth` filter. This build lives in `https://github.com/datawire/envoy`, which is a fork of `https://github.com/envoyproxy/envoy`, and it'll need to be updated at least as often as Envoy releases happen. To do that:

1. Clone the `datawire/envoy` repo and get to the `datawire/extauth-build-automation` branch:

    ```
    git clone git@github.com:datawire/envoy.git
    cd envoy
    git checkout datawire/extauth-build-automation
    ```

2. Follow the directions in `DATAWIRE/README.md` to get everything built and tested and pushed.

3. Once the new `ambassador-envoy` image has been pushed, get back to your clone of the Ambassador repo and update the `FROM` line in `ambassador/Dockerfile` to use the new image.

4. Build and test Ambassador as normal.

repository: neumanndaniel/ambassador

repo_name: neumanndaniel/ambassador


text:
# TrimSimulator

####Version:
1.0.0

##Author:
Hiu Hong Yu -<EMAIL_ADDRESS>- Department of Computer Science, University of California, Davis.

Ming-hung (Michael) Lu -<EMAIL_ADDRESS>- Department of Computer Science, University of California, Davis.

##Description:
Trim Simulator is a simulation tools designed for sequential, queued Trim in Linux environment.
TrimSimulator-0.0.1 also provide a new ways of issuing Trim command.

####Installation:
None

####Compilation:
cmake .

##Usage:
./bin/TS [options] Simulation_Mode

#####Acknowledgement:
TrimSimulation is proposed and approved class project for ECS251 by Professor Wu, Department of Computer Science, University of California, Davis.

###License
Apache 2.0


text:
# Prettier formatter for Atom

Atom package to format your Javascript using [Prettier](https://github.com/jlongster/prettier).

### Usage

#### Keybindings

Use `ctrl-alt-f` to format the current Javascript file. If a text selection is made, only the selected text will be formatted.

#### Format On Save

Automatically format your Javascript file on save by enabling the *Format On Save* package setting.  This is off by default.

#### Menu

*Packages > prettier > Format*

### Settings

#### formatOnSave (default: false)

Format Javascript files when saving.

repository: onecityuni/prettier-atom

repo_name: onecityuni/prettier-atom


text:
# Lab 4 - *Canvas*

**Canvas**
Use animation to manipulate emoticons.

Time spent: **5** hours spent in total

## User Stories

The following **required** functionality is completed:

* [x] Setup
* [x] Build a Simple Draggable Tray
* [x] Open + Close the Tray
* [x] Creating New Faces

## Video Walkthrough

Here's a walkthrough of implemented user stories:

![Video Walkthrough](file.gif)

GIF created with [LiceCap](http://www.cockos.com/licecap/).

## Notes

Find the correct documentation.

## License

    Copyright 2016 Ian Campelo

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.


text:
# JS Questions:

* Explain event delegation

Let the parent handles events that occur on its child nodes. Why? It can boost performance.

* Explain how `this` works in JavaScript

Use the following 4 rules (in the order of precedence) to determine what `this` refers to:
1. `new`
2. `call`, `apply`, and `bind`
3. `Object.method()`
4. default to globel like (`document` in browser, `global` in node)
* Explain how prototypal inheritance works

Javascript achieved inheritance through prototype chain. Even the keyword `class` is just a syntax sugar to `function`.
```javascript
class Animal {
  constructor() {
    this.weight = 1;
  }
}

class Dog extends Animal {
  constructor() {
    super();
    this.name = 'dog';
  }

  bark() {
    console.log(this.name);
  }
}

// Equivalent to below using Babel
"use strict";

var _createClass = (function() {
  function defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps) defineProperties(Constructor.prototype, protoProps);
    if (staticProps) defineProperties(Constructor, staticProps);
    return Constructor;
  };
})();

function _possibleConstructorReturn(self, call) {
  if (!self) {
    throw new ReferenceError(
      "this hasn't been initialised - super() hasn't been called"
    );
  }
  return call && (typeof call === "object" || typeof call === "function")
    ? call
    : self;
}

function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError(
      "Super expression must either be null or a function, not " +
        typeof superClass
    );
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, {
    constructor: {
      value: subClass,
      enumerable: false,
      writable: true,
      configurable: true
    }
  });
  if (superClass)
    Object.setPrototypeOf
      ? Object.setPrototypeOf(subClass, superClass)
      : (subClass.__proto__ = superClass);
}

//
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

var Animal = function Animal() {
  _classCallCheck(this, Animal); // Ensure Animal is called as a constructor function

  this.weight = 1;
};

var Dog = (function(_Animal) {
  _inherits(Dog, _Animal);

  function Dog() {
    _classCallCheck(this, Dog);

    var _this = _possibleConstructorReturn(
      this,
      (Dog.__proto__ || Object.getPrototypeOf(Dog)).call(this)
    );

    _this.name = "dog";
    return _this;
  }

  _createClass(Dog, [
    {
      key: "bark",
      value: function bark() {
        console.log(this.name);
      }
    }
  ]);

  return Dog;
})(Animal);

```

* What do you think of AMD vs CommonJS?

They are all popular JavaScript Module Systems.\
They are for solving dependencies.\
AMD supports asynchronous module loading as its name suggests. `requirejs` is an implementation of AMD.
CommonJS is for synchronous loading. Often require transpiler
https://auth0.com/blog/javascript-module-systems-showdown/

* Explain why the following doesn't work as an IIFE: `function foo(){ }();`.
  * What needs to be changed to properly make it an IIFE?
* What's the difference between a variable that is: `null`, `undefined` or undeclared?
  * How would you go about checking for any of these states?
* What is a closure, and how/why would you use one?
* Can you describe the main difference between a `forEach` loop and a `.map()` loop and why you would pick one versus the other?
* What's a typical use case for anonymous functions?
* How do you organize your code? (module pattern, classical inheritance?)
* What's the difference between host objects and native objects?
* Difference between: `function Person(){}`, `var person = Person()`, and `var person = new Person()`?
* What's the difference between `.call` and `.apply`?
* Explain `Function.prototype.bind`.
* What's the difference between feature detection, feature inference, and using the UA string?
* Explain Ajax in as much detail as possible.
* What are the advantages and disadvantages of using Ajax?
* Explain how JSONP works (and how it's not really Ajax).
* Have you ever used JavaScript templating?
  * If so, what libraries have you used?
* Explain "hoisting".
* Describe event bubbling.
* What's the difference between an "attribute" and a "property"?
* Why is extending built-in JavaScript objects not a good idea?
* Difference between document load event and document DOMContentLoaded event?
* What is the difference between `==` and `===`?
* Explain the same-origin policy with regards to JavaScript.
* Make this work:
```javascript
duplicate([1,2,3,4,5]); // [1,2,3,4,5,1,2,3,4,5]
```
* Why is it called a Ternary operator, what does the word "Ternary" indicate?
* What is `"use strict";`? what are the advantages and disadvantages to using it?
* Create a for loop that iterates up to `100` while outputting **"fizz"** at multiples of `3`, **"buzz"** at multiples of `5` and **"fizzbuzz"** at multiples of `3` and `5`
* Why is it, in general, a good idea to leave the global scope of a website as-is and never touch it?
* Why would you use something like the `load` event? Does this event have disadvantages? Do you know any alternatives, and why would you use those?
* Explain what a single page app is and how to make one SEO-friendly.
* What is the extent of your experience with Promises and/or their polyfills?
* What are the pros and cons of using Promises instead of callbacks?
* What are some of the advantages/disadvantages of writing JavaScript code in a language that compiles to JavaScript?
* What tools and techniques do you use debugging JavaScript code?
* What language constructions do you use for iterating over object properties and array items?
* Explain the difference between mutable and immutable objects.
  * What is an example of an immutable object in JavaScript?
  * What are the pros and cons of immutability?
  * How can you achieve immutability in your own code?
* Explain the difference between synchronous and asynchronous functions.
* What is event loop?
  * What is the difference between call stack and task queue?
* Explain the differences on the usage of `foo` between `function foo() {}` and `var foo = function() {}`
* What are the differences between variables created using `let`, `var` or `const`?
* What are the differences between ES6 class and ES5 function constructors?
* Can you offer a use case for the new arrow `=>` function syntax? How does this new syntax differ from other functions?
* What advantage is there for using the arrow syntax for a method in a constructor?
* What is the definition of a higher-order function?
* Can you give an example for destructuring an object or an array?
* ES6 Template Literals offer a lot of flexibility in generating strings, can you give an example?
* Can you give an example of a curry function and why this syntax offers an advantage?
* What are the benefits of using `spread syntax` and how is it different from `rest syntax`?
* How can you share code between files?
* Why you might want to create static class members?


text:
teeproxy
=========

A reverse HTTP proxy that duplicates requests.

Why you may need this?
----------------------
You may have production servers running, but you need to upgrade to a new system. You want to run A/B test on both old and new systems to confirm the new system can handle the production load, and want to see whether the new system can run in shadow mode continuously without any issue.

How it works?
-------------
teeproxy is a reverse HTTP proxy. For each incoming request, it clone the request into 2 requests, forward them to 2 servers. The results from server a are returned as usual, but the results from server b are ignored.

teeproxy handles GET, POST, and all other http methods.

Build
-------------
go build

Usage
-------------
 ./teeproxy -l :8888 -a localhost:9000 -b localhost:9001

 "-l" specifies the listening port. "-a" and "-b" are meant for system A and B. The B system can be taken down or started up without causing any issue to the teeproxy.

#### Configuring timeouts ####
It's also possible to configure the timeout to both systems
*  -a.timeout int: timeout in seconds for production traffic (default 3)
*  -b.timeout int: timeout in seconds for alternate site traffic (default 1)

repository: bsingr/teeproxy

gha_language: Go

repo_name: bsingr/teeproxy


text:
# Mass Colorizor

A commandline utility to search through a directory and convert all the colors according to the settings in a json config file. Non-destructive.

options:

    --config=[file]: a json file specifying all the color conversions. Required.
    --src=[file]: the root directory of the directory structure to be scanned. Required.
    --dest=[file]: the root directory into which the files in src are to be copied. Required.
    --colors=[file]: a json file listing color names and their corresponding rgb values in hex. Optional.
    -r: make the scan recursive
    --verbose: list all the conversions that take place and where they are
    --search: list all the colors in the directory structure. Will not perform the conversion. When --search is specified then --config and --dest become optional.

This script was originally created for the purpose of changing the color schemes of themes. Although it seems to work as intended, the results need to be tweaked to be usable, especially since some graphics get the same color as the background and become invisible, but it still saves a lot of work over modifying hundreds or thousands of color strings manually.

Requires python 3.

repository: Lestibournes/Mass-Colorizor

repo_name: Lestibournes/Mass-Colorizor


text:
# Project Title
BlindVisual_737 - MVP Android Application to assist blind people in perceiving object

### Getting Started
The Aim of our project is to guide the visually impaired folios to perceive the things in surrounding environment with a sole MVP Android app, concisely which helps them to listen about the things which they can’t see.

### Prerequisites
  1. Application Platform:     Android
  2. Emulator version:         Android Oreo
  3. Development IDE:          IntelliJ Android Studio
  4. Storage:                  Google Firebase
  5. Visual Recogntn Platform: IBM Blue mix Node red (Watson)
  6. Text to speech service:   Google speech service

### Built with

__Android Programming Language__, __Node JS__, __Firebase__, __IBM and Google API's__

### Description
The lack of visual capabilities has limited the individuals from completely perceiving their immediate surroundings which has potential safety concerns and lowers their quality of life since they must rely on some sort of aid to get around. We are going to resolve the problem Through a cloud based android application, where the user takes the picture of specific area and then this picture is analyzed by the IBM tool later it is transformed into Audio format and will be send into the user Mobile for which the user can perceive about the picture.

__Project core functions:__
  1. User friendly Android application.
  2. Image analysis with IBM Image recognition in Node red.
  3. Google's Text to speech analysis.
  4. Better perspective for blind with Android features.
  5. Better Acoustic with Google's voice.

### Running the Project
  1. Clone the project into a new folder.
  2. Create Google Cloud Services account, get Text to Speech service and firebase API's with access keys.
  3. Update API's and access keys.
  4. Create a new IBM node red account in IBM BlueMix.
  5. __Node Red:__
    1. Create nodes for getting the images from Android Application. (https get)
    2. Initializing. (Reforming the payload and getting respective image needed for image recognition)
    3. Connecting to IBM visual recognition (Must have IBM Visual Recognition access, select classifyImage)
    4. Reforming the text response. (Loop through the msg.paylod and get the text required)
        __*msg.result.images[0].classifiers[0].classes[i]> and a condition to get classes > 0.60 for accuracy*__
    5. Send the text response output to debug node and http post node.
  6. Build the Android application and set an emulator for test.
  7. Run the application and get the response as an Audio.

### Author

__Project Team__
1. __Kishan Patel__ (Responsible for Android Development and Google Services)
2. __Viswanadh Bhaskarla__ (Responsible for Project planning, IBM Cloud services, IBM Node red flows, API Integration and Testing)

### Project Images

![Architecture](https://user-images.githubusercontent.com/6322818/79527378-c704d600-80aa-11ea-92f7-42ef390dcaa2.jpg)

![Nodered_screenshot](https://user-images.githubusercontent.com/6322818/79527511-2531b900-80ab-11ea-95ab-2ef742bdab47.JPG)

![image](https://user-images.githubusercontent.com/6322818/79527629-6fb33580-80ab-11ea-8397-6e35f5cc044a.png)


text:
# random_copy

Copies mp3 files from "SOURCE" to "DESTINATION". \
All music files are randomly copied. It copies "MAXSONGS" per folder. \
A Number of "MAXFOLDERS" folders are created, each with the prefix "FOLDERNAME" and then numbered in ascending order.

Example:
```shell
FOLDERNAME="RandomMusik"
MAXSONGS=3
MAXFOLDERS=2
```

Produces:
```shell
RandomMusik0:
    -Track5
    -Track6
    -Track3
RandomMusik1:
    -Track2
    -Track1
    -Track4
```

repository: ThorsHamster/scripts

repo_name: ThorsHamster/scripts


text:
---
title: Codes
date: 2022-01-01
subtitle: open-source research toolkits
image: 'https://s2.loli.net/2022/07/04/PGa8kIBQjzKdn2r.jpg'
tags: [fashion, study, travel]
---

## Open-source softwares & libraries

[Kinetic.jl](https://github.com/vavrines/Kinetic.jl): A portable finite volume toolbox for scientific and neural computing

[FluxReconstruction.jl](https://github.com/vavrines/FluxReconstruction.jl): Flux reconstruction method for solving advection-diffusion type physics

[FiniteMesh.jl](https://github.com/vavrines/FiniteMesh.jl): I/O methods for finite element meshes

[SPM](https://github.com/vavrines/SPM): Numerical methods for solving linear Boltzmann equation

[CloudLB](https://github.com/vavrines/CloudLB): Hand-written D2Q9-BGK codes for incompressible Navier-Stokes equations

[Langevin.jl](https://github.com/vavrines/Langevin.jl): stochastic kinetic scheme for uncertainty quantification

Unified gas-kinetic scheme: [complete set](https://github.com/vavrines/UGKS) and extracted [flux function](https://github.com/vavrines/UGKSFlux)