text:
@interface ViewController ()
@property (nonatomic, strong) UITextView * textView;
@property (nonatomic, strong) UILabel * label;
@property (nonatomic, strong) UIImageView * imageView;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.label];
    [self.view addSubview:self.textView];
    [self.view addSubview:self.imageView];

    NSLog(@"%@",NSStringFromRange([@"a=v&c=d&d=e==" rangeOfString:@"="]));
}

- (void)setImage:(UIImage *)image {
    _image = image;
    self.imageView.image = image;
}

- (void)setUrl:(NSString *)url {
    _url = url;
    self.label.text = url;
}

- (void)setParams:(NSDictionary *)params {
    _params = params;
    self.textView.text = [NSString stringWithFormat:@"params: %@",params];
    NSString *dataStr = params[@"imageStr"];
    UIImage *image = dataStr.imageFromBase64String;
    if (image) {
        self.image = image;
    }
}

- (UILabel *)label {
    if (_label == nil) {
        _label = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, 300, 100)];
        _label.numberOfLines = 0;
    }
    return _label;
}

- (UITextView *)textView {
    if (_textView == nil) {
        _textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 200, self.view.bounds.size.width - 40, 300)];
        _textView.text = @"传过来的参数";
    }
    return _textView;
}

- (UIImageView *)imageView {
    if (_imageView == nil) {
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 500, 100, 100)];
    }
    return _imageView;
}

@end


text:
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_BIQUAD_DSP_KERNEL_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_BIQUAD_DSP_KERNEL_H_

#include "third_party/blink/renderer/modules/webaudio/biquad_processor.h"
#include "third_party/blink/renderer/platform/audio/audio_dsp_kernel.h"
#include "third_party/blink/renderer/platform/audio/biquad.h"

namespace blink {

class BiquadProcessor;

// BiquadDSPKernel is an AudioDSPKernel and is responsible for filtering one
// channel of a BiquadProcessor using a Biquad object.

class BiquadDSPKernel final : public AudioDSPKernel {
 public:
  explicit BiquadDSPKernel(BiquadProcessor* processor)
      : AudioDSPKernel(processor),
        tail_time_(std::numeric_limits<double>::infinity()) {}

  // AudioDSPKernel
  void Process(const float* source,
               float* dest,
               uint32_t frames_to_process) override;
  void Reset() override { biquad_.Reset(); }

  // Get the magnitude and phase response of the given BiquadDSPKernel at the
  // given set of frequencies (in Hz). The phase response is in radians.  This
  // must be called from the main thread.
  static void GetFrequencyResponse(BiquadDSPKernel& kernel,
                                   int n_frequencies,
                                   const float* frequency_hz,
                                   float* mag_response,
                                   float* phase_response);

  bool RequiresTailProcessing() const final;
  double TailTime() const override;
  double LatencyTime() const override;
  // Update the biquad cofficients with the given parameters
  void UpdateCoefficients(int number_of_frames,
                          const float* frequency,
                          const float* q,
                          const float* gain,
                          const float* detune);

 protected:
  Biquad biquad_;
  BiquadProcessor* GetBiquadProcessor() {
    return static_cast<BiquadProcessor*>(Processor());
  }

  // To prevent audio glitches when parameters are changed,
  // dezippering is used to slowly change the parameters.
  void UpdateCoefficientsIfNecessary(int);

 private:
  // Compute the tail time using the BiquadFilter coefficients at
  // index |coef_index|.
  void UpdateTailTime(int coef_index);

  // Synchronize process() with getting and setting the filter coefficients.
  mutable Mutex process_lock_;

  // The current tail time for biquad filter.
  double tail_time_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_BIQUAD_DSP_KERNEL_H_

redpajama_set_name: RedPajamaGithub


text:
package de.thingweb.repository.handlers;

import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import de.thingweb.repository.ThingDescriptionUtils;
import de.thingweb.repository.rest.BadRequestException;
import de.thingweb.repository.rest.RESTException;
import de.thingweb.repository.rest.RESTHandler;
import de.thingweb.repository.rest.RESTResource;
import de.thingweb.repository.rest.RESTServerInstance;

public class TDLookUpHandler extends RESTHandler {

	public TDLookUpHandler(List<RESTServerInstance> instances) {
		super("td-lookup", instances);
	}

}


text:
var Reservation = can.Model({
    id: "ReservationID",
    findAll: 'GET /reservations/',
    findOne: function(params) {
        if (params.id) {
            return $.ajax({
                url: '/reservations/'+params.id,
                type: 'get',
                dataType: 'json'
            });
        }
    },
    create:  'POST /reservations/',
    update:  'PUT /reservations/{id}',
    destroy: 'DELETE /reservations/{id}'
}, {})


text:
namespace sdl {
	namespace joystick {
		void Init(v8::Handle<v8::Object> exports);
	}

	class JoystickWrapper : public node::ObjectWrap {
	public:
		static v8::Persistent<v8::FunctionTemplate> wrap_template_;

		JoystickWrapper();
		JoystickWrapper(bool owned);
		~JoystickWrapper();

		static void Init(v8::Handle<v8::Object> exports);
		static v8::Handle<v8::Value> New(const v8::Arguments& args);

		static v8::Handle<v8::Value> GetAttached(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetAxis(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetBall(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetButton(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetGUID(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetHat(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetName(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetNumAxes(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetNumButtons(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetNumBalls(const v8::Arguments& args);
		static v8::Handle<v8::Value> GetNumHats(const v8::Arguments& args);

		SDL_Joystick* joystick_;
		bool owned_;
	};

	v8::Handle<v8::Value> NumJoysticks(const v8::Arguments& args);

	v8::Handle<v8::Value> JoystickNameForIndex(const v8::Arguments& args);
	v8::Handle<v8::Value> JoystickGetDeviceGUID(const v8::Arguments& args);
	v8::Handle<v8::Value> JoystickGetGUIDFromString(const v8::Arguments& args);
	v8::Handle<v8::Value> JoystickGetGUIDString(const v8::Arguments& args);

	v8::Handle<v8::Value> JoystickUpdate(const v8::Arguments& args);
	v8::Handle<v8::Value> JoystickEventState(const v8::Arguments& args);
}

#endif


text:
package com.google.litecoin.crypto;

import com.google.common.base.Joiner;
import org.junit.Before;
import org.junit.Test;
import org.spongycastle.util.encoders.Hex;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static org.junit.Assert.assertEquals;

public class MnemonicCodeTest {
    // These vectors are from https://raw.github.com/trezor/python-mnemonic/master/vectors.json
    String vectors[] = {

        "00000000000000000000000000000000",
        "risk tiger venture dinner age assume float denial penalty hello game wing",

        "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
        "truth chase learn pretty right casual acoustic frozen betray main slogan method",

        "80808080808080808080808080808080",
        "olive garment twenty drill people finish hat own usual level milk usage",

        "ffffffffffffffffffffffffffffffff",
        "laundry faint system client frog vanish plug shell slot cable large embrace",

        "000000000000000000000000000000000000000000000000",
        "giant twelve seat embark ostrich jazz leader lunch budget hover much weapon vendor build truth garden year list",

        "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
        "awful faint gun mean fuel side slogan marine glad donkey velvet oyster movie real type digital dress federal",

        "808080808080808080808080808080808080808080808080",
        "bless carpet daughter animal hospital pave faculty escape fortune song sign twin unknown bread mobile normal agent use",

        "ffffffffffffffffffffffffffffffffffffffffffffffff",
        "saddle curve flight drama client resemble venture arch will ordinary enrich clutch razor shallow trophy tumble dice outer",

        "0000000000000000000000000000000000000000000000000000000000000000",
        "supreme army trim onion neglect coach squirrel spider device glass cabbage giant web digital floor able social magnet only fork fuel embrace salt fence",

        "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
        "cloth video uncle switch year captain artist country adjust edit inherit ocean tennis soda baby express hospital forest panel actual profit boy spice elite",

        "8080808080808080808080808080808080808080808080808080808080808080",
        "fence twin prize extra choose mask twist deny cereal quarter can power term ostrich leg staff nature nut swift sausage amateur aim script wisdom",

        "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
        "moon fiscal evidence exile rifle series neglect giant exclude banana glance frown kangaroo globe turtle hat fitness casual sudden select idle arctic best unlock",

        "449ea2d7249c6e0d8d295424fb8894cf",
        "choice barrel artefact cram increase sell veteran matrix mirror hollow walk pave",

        "75fc3f44a7ff8e2b8af05aa18bded3827a3796df406763dd",
        "crack outside teach chat praise client manual scorpion predict chalk decrease casino lunch garbage enable ball when bamboo",

        "1cce2f8c2c6a7f2d8473ebf1c32ce13b36737835d7a8768f44dcf96d64782c0e",
        "muffin evoke all fiber night guard black quote neck expire dial tenant leisure have dragon neck notable peace captain insane nice uphold shine angry",

        "3daa82dd08bd144ec9fb9f77c6ece3d2",
        "foil dawn net enroll turtle bird vault trumpet service fun immune unveil",

        "9720239c0039f8446d44334daec325f3c24b3a490315d6d9",
        "damp all desert dash insane pear debate easily soup enough goddess make friend plug violin pact wealth insect",

        "fe58c6644bc3fad95832d4400cea0cce208c8b19bb4734a26995440b7fae7600",
        "wet sniff asthma once gap enrich pumpkin define trust rude gesture keen grass fine emerge census immense smooth ritual spirit rescue problem beef choice",

        "99fe82c94edadffe75e1cc64cbd7ada7",
        "thing real emerge verify domain cloud lens teach travel radio effort glad",

        "4fd6e8d06d55b4700130f8f462f7f9bfc6188da83e3faadb",
        "diary opinion lobster code orange odor insane permit spirit evolve upset final antique grant friend dutch say enroll",

        "7a547fb59606e89ba88188013712946f6cb31c3e0ca606a7ee1ff23f57272c63",
        "layer owner legal stadium glance oyster element spell episode eager wagon stand pride old defense black print junior fade easy topic ready galaxy debris",

        "e5fc62d20e0e5d9b2756e8d4d91cbb80",
        "flat make unit discover rifle armed unit acquire group panel nerve want",

        "d29be791a9e4b6a48ff79003dbf31d6afabdc4290a273765",
        "absurd valve party disorder basket injury make blanket vintage ancient please random theory cart retire odor borrow belt",

        "c87c135433c16f1ecbf9919dc53dd9f30f85824dc7264d4e1bd644826c902be2",
        "upper will wisdom term once bean blur inquiry used bamboo frequent hamster amazing cake attack any author mimic leopard day token joy install company",
    };
    private MnemonicCode mc;

    @Before
    public void setup() throws IOException {
        mc = new MnemonicCode();
    }

    @Test
    public void testEncodeVectors() throws Exception {
        for (int ii = 0; ii < vectors.length; ii += 2) {
            List<String> words = mc.encode(Hex.decode(vectors[ii]));
            assertEquals(vectors[ii + 1], Joiner.on(' ').join(words));
        }
    }

    @Test
    public void testDecodeVectors() throws Exception {
        for (int ii = 0; ii < vectors.length; ii += 2) {
            byte[] seed = mc.decode(split(vectors[ii+1]));
            assertEquals(vectors[ii], new String(Hex.encode(seed)));
        }
    }

    @Test(expected = IllegalArgumentException.class)
    public void testBadSeedLength() throws Exception {
        byte[] seed = Hex.decode("7f7f7f7f7f7f7f7f7f7f7f7f7f7f");
        mc.encode(seed);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testBadWordsLength() throws Exception {
        List<String> words = split("risk tiger venture dinner age assume float denial penalty");
        mc.decode(words);
    }

    static public List<String> split(String words) {
        return new ArrayList<String>(Arrays.asList(words.split("\\s+")));
    }
}


text:
'use strict';

let passport  = require('passport');
let passportGithub = require('passport-github');
let merge = require('merge');

class GitHubAuthentication {
    constructor() {
        let passportOptions = {
                authorizationURL: process.env.GITHUB_PROTOCOL + '://' + process.env.GITHUB_HOST + '/login/oauth/authorize',
                clientID: process.env.GITHUB_CLIENT,
                clientSecret: process.env.GITHUB_SECRET,
                tokenURL: process.env.GITHUB_PROTOCOL + '://' + process.env.GITHUB_HOST + '/login/oauth/access_token',
                userProfileURL: process.env.GITHUB_PROTOCOL + '://' + process.env.GITHUB_API_BASE + process.env.GITHUB_API_PATH + '/user',
        };

        passport.use( new passportGithub.Strategy(passportOptions, function(accessToken, refreshToken, profile, done) {
            done(null, merge(profile._json, { token: accessToken }));
        }));

        passport.serializeUser(function(user, done) {
            done(null, user);
        });

        passport.deserializeUser(function(user, done) {
            done(null, user);
        });
    }

    initialize() {
        return passport.initialize();
    }

    session() {
        return passport.session();
    }

    checkReturnTo(req, res, next) {
        let returnTo = req.query.redirect;
        if (returnTo) {
            req.session.returnTo = returnTo;
        }
        next();
    };

    callback() {
        return passport.authenticate('github', { successReturnToOrRedirect: '/' });
    }

    authenticate() {
        return passport.authenticate('github', { scope: ['user:email'] });
    }

    logout(req, res, next) {
        req.logout();
        if (!req.query.noredirect) {
            res.redirect('/');
        } else {
            next();
        }
    }

}

module.exports = new GitHubAuthentication;


text:
<!--

Please add your own contribution below inside the Master section
Bug-fixes within the same version aren't needed

## Master

* use assertion's fullName in TestResult instead of the source test name - @connectdotz
-->

### 4.0.0-alpha.1
* change path of jest executable in order to support running jest in yarn workspaces - @glentakahashi
* refactor editor decorations and load icons from `vscode-codicons` [@Tymek](https://github.com/Tymek)
* move test status indicator from editor text to gutter [@Tymek](https://github.com/Tymek)

### 4.0.0-alpha.0
* improve create-react-app detection logic - stephtr
* improve the detection of cases in which Jest needs to be restarted with `--watchAll` - [@lordofthelake](https://github.com/lordofthelake)
* upgrade all dependencies to the latest, except istanbul-lib-xxx, which requires more code change and will be handled in a separate coverage PR. - @connectdotz
* code base clean up: migrate from tslint to eslint and adopted the latest recommended coding style, adopt semi-colon, added more ci check... - @connectdotz
* resolve coverage map merge issue, upgrade istanbul dependencies to the latest and move to async coverageMap update. @connectdotz
* introducing a new matching algorithm to use context relationship in matching test blocks and assertions - @connectdotz

### 3.2.0
* prevent auto starting watch-mode jest process when the parent process is stopped, which can lead to orphan process during deactivation among others. - @connectdotz
* adding workspace folder in error message for multii-root projects. - @connectdotz

### 3.1.1
* fix reporter failed to load due to whitespace in path - connectdotz

### 3.1.0
* fix test breakage with 'jest-editor-support' internal modules due to automock. - connectdotz
* replacing the status bar spinner with the VS Code spinner - rhalaly
* Fix regex to detect the pluralized message 'snapshots failed' and show the 'Would you like to update your Snapshots' dialog - shruda
* Add 'hair space' (U+200A) after decoration text - [@rfgamaral](https://github.com/rfgamaral)
* Fix decoration color for 'unknown' tests - [@rfgamaral](https://github.com/rfgamaral)
* Improve global and local detection for Jest executable on `win32` platform - [@rfgamaral](https://github.com/rfgamaral)
* Set `"extensionKind": "workspace"` in `package.json` to support remote developement - [@rfgamaral](https://github.com/rfgamaral)
* Fix remove ANSI characters from test messages - [@jmarceli](https://github.com/jmarceli)
* Adjust test result indicators for colorblind people - [@jmarceli](https://github.com/jmarceli)
* Use short message instead of terse message in test diagnostic tooltip and tab - [@jmarceli](https://github.com/jmarceli)
* quoting default "pathToJest" to preserve special characters, if any. - @connectdotz
* Fix for when `branch.end.column` is `null`. [@garyking](https://github.com/garyking)
* Fix several jest coverage issues and improve usability. - @connectdotz
* Add "Running tests" message to the StatusBar - [@jmarceli](https://github.com/jmarceli)
* Disable inline error messages by default - [@jmarceli](https://github.com/jmarceli)
* Fix StatusBarItem when starting Jest without active text editor but only one workspace folder - @stephtr

### 3.0.1

* use webpack for compilation, resulting in a much smaller extension size - stephtr

* fix security vulnerability for dependencies flagged by github - stephtr

### 3.0.0
* Support multi-root workspaces - escaton
  * multiroot workspace statusBar displays both active folder and workspace summary info - connectdotz
  * fix race condition in multi-root projects - connectdotz
  * add folder status bar support for multi-root projects - connectdotz

* support template-literal-string test names by matching with location info from jest result - connectdotz

* paying down some tech debt, see PR#447 for detail.

* Add disableOptimisticBPs option to debug configuration. Fixes #400 - blikblum

* Adds "Jest: Restart Runner" command - vdh

* replaced deprecated vscode.previewHtml command with webview - qalex

### 2.9.1

* Prevent ANSI escape codes from appearing in test messages - seanpoulter

### 2.9.0

* Adds a setting to control when the debug CodeLens appears - seanpoulter
* Support the "Jest: Start/Stop" and "Show output" commands without an active
  text editor - seanpoulter
* Restart Jest with --watchAll when --watch is not supported without git/hg
  - seanpoulter
* Highlight error of failed test when assertion was made outside of test
* Fix regression in handling workspaces that have been bootstrapped with
  create-react-app - seanpoulter
* Run Jest on Windows in a shell when gathering settings, such that we don't
  have to deal with the .cmd extension anymore - stephtr
* upgrade to jest 23.3 - connectdotz
* enhanced error reporting and troubleshooting assistance - connectdotz
  * Added a `jest.debugMode` setting for self-diagnosis
  * expand README Troubleshooting area
  * expand issue template to include critical settings as well as debug output
* retired jestSettings and version lookup logic - connectdotz
* refactor diagnostics to defer some expensive operations to later when the file becomes active. This is to improve performance and correctness, especially for use cases in #349 or #334 - connectdotz

### 2.8.0

* Adds a setting to control when the debug CodeLens appears - seanpoulter
* Support the "Jest: Start/Stop" and "Show output" commands without an active
  text editor - seanpoulter
* Restart Jest with --watchAll when --watch is not supported without git/hg
  - seanpoulter

### 2.7.2

* Fix decorators showing corrupt values when two tests of the same name in one file (e.g. in different describe blocks) exist - ThomasRooney

### 2.7.1

* Add new coverage formatter named GutterFormatter (can be used by setting jest.coverageFormatter to GutterFormatter instead of DefaultFormatter) - Guymestef

### 2.7.0

* Add the ability to configure debugging of tests - stephtr, connectdotz

### 2.6.4

* Fixes debugging of tests on Windows (bug introduced in 2.6.2) - stephtr

### 2.6.3

* Even better detection logic for projects created by `create-react-app` - stephtr

### 2.6.2

* Adding `.cmd` in `pathToJest` on Windows isn't necessary anymore - stephtr
* Update settings at runtime - gcangussu
* Improved detection logic for projects created by `create-react-app` - stephtr
* Added `JestProcess` and `JestProcessManager` abstractions to simplify Jest process management - marcinczenko

### 2.6.1

* Strips testNames so they can be used as regex - BLamy
* Show "update snapshots" message when multiple snapshot tests failed - uucue2

### 2.6.0

* Adds ability to open snapshot file directly from test - bookman25
* Start automatically if jest.config.js or jest.json is in workspace - uucue2
* Use pathToJest setting to properly locate jest's package.json and read the version - uucue2
* Fix missing coverage overlay on Windows - seanpoulter
* Toggle coverage overlay without changing documents - seanpoulter

### 2.5.7-8

* Fix dot decoration display on Windows - seanpoulter

### 2.5.6

* Improve the dot decoration placement as we edit - seanpoulter
* Hide Debug CodeLens for skipped tests - seanpoulter
* Mute output from `console.warn` during tests - seanpoulter

### 2.5.5

* Improve where the Debug CodeLens is displayed - seanpoulter

### 2.5.4

* The debugger uses the setting `jest.pathToJest`  - seanpoulter

### 2.5.3

* Detect apps bootstrapped using react-scripts-ts  - seanpoulter

### 2.5.1-2

* Add option to disable codelens - goncharov

### 2.5.0

* Allow debugging non-successful tests - CzBuCHi

### 2.4.5

* Adds an option to not run all tests on launch - seanpoulter
* Never sends VS Code an invalid line number for an unexpected result - connectdotz

### 2.4.4

* Improvements for Create React Native App - anton-matosov

### 2.4.3

* Improvements for Create React App - seanpoulter

### 2.4.1-2

* Adds an option for `"jest.rootPath"` to let you choose the folder to run jest commands - garyxuehong

### 2.4.1

* Restart jest up to three times upon unexpected exit - connectdotz

### 2.4.0

* Fixes for Jest 21 - connectdotz
* Improvements to settings auto-completion - vvo
* Support toggling code coverage - bookman25
* Improve error reporting - bookman25

### 2.3.0

* Apply [prettier](https://github.com/prettier/prettier) to the codebase. - macklinu
* Adds coverage support - bookman25

### 2.2.1

* Jest related depenendency bumps. Should improve the inline messages and crash less. - orta

### 2.2.0

* Adds an option to not show errors inline in the editor - orta
* Adds an option to not snapshot update requests - orta
* Show channel command - orta
* Supports TS/TSX/JSX .snaps - orta
* Create React App fixes - orta
* Use "jest-test-typescript-parser" for our TypeScript parser - orta
* Bumps min VS code release - orta

Note: This release consolidates a lot of code with the Jest project, and so if you have a custom `testRegex` and use
      Jest below v20, chances are the decorators will not show. Everything else should be 👍 - orta

### 2.0.4

* New fancy spinner when running tests - bookman25
* Improved handling of expired test results - bookman25

### 2.0.3

* Improved underlining of failing expectations - bookman25

### 2.0.2

* Whitespace fixes for the error messages next to a fail - orta

### 2.0.1

* tsx support - orta/bookman25

### 2.0.0

* Move all of the Jest specific code into a new repo: [jest-editor-support](https://github.com/facebook/jest/tree/master/packages/jest-editor-support) where
  we can share the code with a nuclide implementation. This brings some changes to the development process (see the README) but should only affect users
  if we've missed something in moving over.

  - orta / bookman25 / cpojer

* Significant improvements to JavaScript parsers - bookman25
* Introduction of TypeScript support - bookman25

### 1.6.5

* Prepare for Jest 18 - orta

### 1.6.4

* Windows + Create React App improvements - brentatkins

### 1.6.3

* config file improvements - luizbon
* Warning message copy improvements - orta

### 1.6.2

* Adds an option that allows you to use an external config json file - luizbon

### 1.6.1

* More windows improvements - KalleOtt

### 1.6.0

* Separation of VS Code specific code from the extension by creating a lib directory,
  in preparation for moving to the Jest repo - https://github.com/facebook/jest/issues/2183 - orta
* Minor improvements for create-react users - orta
* Support for running Jest even in repos where Jest is not a direct dependency via the command `Start Jest Runner` - you will definitely need to set the per-project `.vscode/settings.json` to whatever would normally trigger a jest run - orta

### 1.5.1

* Use green empty circles for tests assumed to be good - gabro
* More windows improvements - bookman25

### 1.5.0

* Adds support for running the tests inside `create react` apps - orta

### 1.4.0

* When a Snapshot test has failed, it offers the chance to update your snapshots - orta

### 1.3.2

* Adds an error message if you're not using Jest 17 - orta

### 1.3.0 - 1.3.1

* Windows support - orta

### 1.2.0

* Adds syntax highlights for the JSX in `.js.snap` files - orta

### 1.1.0

* `import type` now shouldn't cause a parser error, and should be fine in test files - orta
* Adds an option to disable the initial loading of the runner on a project - orta
* You can start and stop the jest runner via the command pallette. - orta
* You can define your own path to the Jest test runner - orta
* Not a feature, but the code has been thoroughly commented - orta
* Improvements to parsing passing test files - orta
* Only run JS parser on files that match the Jest tesRegex - orta

### 1.0.3

* Uses all possible Babylon plugins when parsing a test file, should raise exceptions less - orta

### 1.0.2

* Removes unused commands - orta

### 1.0.1

#### Feature Complete, and rough polish pass

* Starts Jest automatically when you're in a project with Jest installed.
* Show individual fail / passes inline.
* Show fails inside the problem inspector.
* Highlights the errors next to the `expect` functions

- orta

### 0.0.6

* Show when the tests are running - orta
* Switch to use symbols in the status bar - orta

### 0.0.5

* All Tests in a file are marked red/green when we know whether the file passed - orta
* When we don't know test state yet, show an empty circle - orta

### 0.0.4

* Adds statusbar support - orta
* Adds fails to the problems section - orta

### 0.0.3

* Parses current file for it/test blocks - orta


text:
public class FlashCard {

	private String term;
	private String definition;

	public FlashCard() {
		this.term = "";
		this.definition = "";
	}

	public FlashCard(String term, String definition) {
		this.term = term;
		this.definition = definition;
	}

	public void setTerm(String newTerm) {
		this.term = newTerm;
	}

	public String getTerm() {
		return this.term;
	}

	public void setDefinition(String newDefinition) {
		this.definition = newDefinition;
	}

	public String getDefinitino() {
		return this.definition;
	}

}


text:
' Copyright (c) 2015 ZZZ Projects. All rights reserved
' Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
' Website: http://www.zzzprojects.com/
' Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927
' All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library

Public Module Extensions_477

	''' <summary>
	'''     Returns a value that indicates whether the specified value is not a number ().
	''' </summary>
	''' <param name="f">A single-precision floating-point number.</param>
	''' <returns>true if  evaluates to not a number (); otherwise, false.</returns>
	<System.Runtime.CompilerServices.Extension> _
	Public Function IsNaN(f As [Single]) As [Boolean]
		Return [Single].IsNaN(f)
	End Function
End Module


text:
<?php

use Phphilosophy\Phphilosophy;
use Phphilosophy\Http\Request;

require __DIR__.'/../bootstrap/bootstrap.php';

$request = Request::createFromGlobals();
Phphilosophy::register($request);

/*
 * PLEASE ADD YOUR ROUTES HERE
 */
Phphilosophy::get('/', function() {
    echo 'Welcome to PHPhilosophy!';
});

/*
 * HERE YOU CAN CUSTOMIZE YOUR ERROR PAGE
 */
Phphilosophy::notFound(function() {
    echo 'The page you requested could not be found!';
});

Phphilosophy::run();


text:
import seaborn as sns
from pudzu.charts import *

FONT, fg, bg = calibri, "white", "black"

countries = pd.read_csv("datasets/countries.csv").split_columns(('nationality', 'tld', 'country'), "|").explode('country').set_index('country')
df = pd.read_csv("datasets/eujews.csv")

def entitle(img):
    title = Image.from_text("Famous Europeans of Jewish origin ".upper(), FONT(96, bold=True), fg=fg, bg=bg)
    subtitle = Image.from_text("(roughly ordered by how famous they are)", FONT(72), fg=fg, bg=bg).pad((0,0,0,10), bg)
    img = Image.from_column([title, subtitle, img], bg=bg, padding=5).pad(15,bg=bg)
    img = img.pad((0,0,0,20), bg).place(Image.from_text("/u/Udzu", FONT(16), fg=fg, bg=bg, padding=5).pad((1,1,0,0), fg), align=1, padding=10)
    return img

grids = []
for row in generate_batches(df.iterrows(), ceil(len(df)/4)):

    table = pd.DataFrame([[dict(d) for _,d in row]], columns=[d.country for _,d in row])
    DEFAULT_IMG = "https://s-media-cache-ak0.pinimg.com/736x/0d/36/e7/0d36e7a476b06333d9fe9960572b66b9.jpg"

    def cell(d):
        if not d: return None
        return Image.from_column([
          Image.from_url_with_cache(get_non(d, 'image', DEFAULT_IMG)).cropped_resize((160,160), (0.5,get_non(d, 'align', 0.2))),
          Image.from_text(d['link'], FONT(16, bold=True), fg=fg, bg=bg),
          Image.from_text(d['description'], FONT(16, italics=True),fg=fg, bg=bg)
          ], bg=bg, padding=2).pad(5, bg)

    def flag(column):
        flag = Image.from_url_with_cache(countries.flag[table.columns[column]]).to_rgba()
        flag = flag.resize_fixed_aspect(height=100) if flag.width / flag.height < 1.3 else flag.resize((160,100))
        flag = flag.trim(1).pad(1, "grey").pad((0,10,0,0), bg)
        return flag

    grid = grid_chart(table, cell, col_label=flag, bg=bg)
    grids.append(grid)

chart = Image.from_column(grids, xalign=0)
chart = entitle(chart)
chart.convert("RGB").save("output/wikifame_eujews.jpg")


text:
require 'open-uri'
require 'chunky_png'
require 'minecraft-avatars/exceptions'

module MinecraftAvatars

  class RawSkin

    attr_accessor :player_name
    attr_accessor :sections
    attr_accessor :image

    def initialize(player_name)

      self.sections = {}
      self.player_name = player_name
      begin
        image_uri = open "#{MinecraftAvatars::SKIN_URL}/#{player_name}.png"
        raw_data = image_uri.read
      rescue OpenURI::HTTPError => e
        if e.message == "403 Forbidden"
          raise MinecraftAvatars::InvalidPlayerException.new(player_name)
        else
          raise e
        end
      end

      self.image = ChunkyPNG::Image.from_blob(raw_data)

      deconstruct

    end

    def deconstruct

      MinecraftAvatars::SKIN_SECTIONS.each do |name, section|
        x, y, width, height = section
        chunk = self.image.crop x, y, width, height

        self.sections[name] = chunk
      end

    end

  end
end


text:
#ifndef INPUT_H
#define INPUT_H
#include <stdio.h>

/* Open the sources for reading
 * If an element is '-', stdin is used for input.
 * Otherwise it is assumed to be the path to a file.
 * If input_open was called before, it also closes the
 * previous sources.
 * */
void input_open(char** src);

/* Receive a pointer to the opened sources */
FILE** input_streams(void);

/* Close the opened sources */
void input_close(void);
#endif


text:
package ch.liip.timeforcoffee.backend;

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

import retrofit.http.GET;
import retrofit.http.Headers;
import retrofit.http.Path;
import retrofit.http.QueryMap;
import rx.Observable;

public interface BackendService {

    @Headers("Cache-Control:public, max-age=20")
    @GET("/api/ch/stationboard/{stationId}")
    Observable<Departures> getDepartures(@Path("stationId") String stationId);

    @Headers("Cache-Control:public, max-age=20")
    @GET("/api/ch/connections/{stationId}/{destinationId}/{departureDate}/{arrivalDate}")
    Observable<Connections> getConnections(
            @Path("stationId") String stationId,
            @Path("destinationId") String destinationId,
            @Path("departureDate") String departureDate,
            @Path("arrivalDate") String arrivalDate);
}


text:
$(".modal").draggable({
    handle: ".modal-header"
});

//Clear modal content for reuse the wrapper by other functions
$('body').on('hidden.bs.modal', '.modal', function () {
    $(this).removeData('bs.modal');
});

/*Map layer configurations*/
var map;

initialLoad();

function initialLoad() {
    if (document.getElementById('map') == null) {
        setTimeout(initialLoad, 500); // give everything some time to render
    } else {
        initializeMap();
        getTileServers();
        loadWms();
        processAfterInitializationMap();
        //Access gps and make zoom to server location as map center
        //navigator.geolocation.getCurrentPosition(success, error);
        $("#loading").hide();
    }
}

//function success(position) {
//    var browserLatitude = position.coords.latitude;
//    var browserLongitude = position.coords.longitude;
//    map.setView([browserLatitude, browserLongitude]);
//    map.setZoom(14);
//    $.UIkit.notify({
//        message: "Map view set to browser's location",
//        status: 'info',
//        timeout: ApplicationOptions.constance.NOTIFY_INFO_TIMEOUT,
//        pos: 'top-center'
//    });
//}
//
//function error() {
//    $.UIkit.notify({
//        message: "Unable to find browser location!",
//        status: 'warning',
//        timeout: ApplicationOptions.constance.NOTIFY_WARNING_TIMEOUT,
//        pos: 'top-center'
//    });
//}

function initializeMap() {
    if (typeof(map) !== 'undefined') {
        map.remove();
    }

    if (document.getElementById('map') == null) {
        console.log("no map");
    } else {
    }

    map = L.map("map", {
        zoom: 14,
        center:[6.9271, 79.8612],
        layers: [defaultOSM, defaultTFL],
        zoomControl: false,
        attributionControl: false,
        maxZoom: 20,
        maxNativeZoom: 18
    });

    map.on('click', function (e) {
        $.UIkit.offcanvas.hide();//[force = false] no animation
    });

    map.on('zoomend', function () {
        if (map.getZoom() < 14) {
            // remove busStops
            var layer;
            for (var key in currentSpatialObjects) {
                if (currentSpatialObjects.hasOwnProperty(key)) {
                    object = currentSpatialObjects[key];
                    if (object.type == "STOP")
                        map.removeLayer(object.geoJson);
                }
            }
            console.log("removed busStops from map");
        } else {

            var layer;
            for (var key in currentSpatialObjects) {
                if (currentSpatialObjects.hasOwnProperty(key)) {
                    object = currentSpatialObjects[key];
                    if (object.type == "STOP")
                        map.addLayer(object.geoJson);
                }
            }
            console.log("added busStops to map");
        }

    });

}

/* Attribution control */
function updateAttribution(e) {
    $.each(map._layers, function (index, layer) {
        if (layer.getAttribution) {
            $("#attribution").html((layer.getAttribution()));
        }
    });
}

var attributionControl;
var groupedOverlays;
var layerControl;

function processAfterInitializationMap(){
    attributionControl = L.control({
        position: "bottomright"
    });
    attributionControl.onAdd = function (map) {
        var div = L.DomUtil.create("div", "leaflet-control-attribution");
        div.innerHTML = "Attribution";
        return div;
    };
    //map.addControl(attributionControl);

    //L.control.fullscreen({
    //    position: 'bottomright'
    //}).addTo(map);
    L.control.zoom({
        position: "bottomright"
    }).addTo(map);

    groupedOverlays = {
        "Web Map Service layers": {}
    };

    layerControl = L.control.groupedLayers(baseLayers, groupedOverlays, {
        collapsed: true
    }).addTo(map);

    //L.control.layers(baseLayers).addTo(map);
    //map.addLayer(defaultTFL);
}

/* Highlight search box text on click */
$("#searchbox").click(function () {
    $(this).select();
});

/* TypeAhead search functionality */

var substringMatcher = function () {
    return function findMatches(q, cb) {
        var matches, substrRegex;
        matches = [];
        substrRegex = new RegExp(q, 'i');
        $.each(currentSpatialObjects, function (i, str) {
            if (substrRegex.test(i)) {
                matches.push({value: i});
            }
        });

        cb(matches);
    };
};

var chart;
function createChart() {
    chart = c3.generate({
        bindto: '#chart_div',
        data: {
            columns: [
                ['speed']
            ]
        },
        subchart: {
            show: true
        },
        axis: {
            y: {
                label: {
                    text: 'Speed',
                    position: 'outer-middle'
                }
            }
        },
        legend: {
            show: false
        }
    });
}

var predictionChart;
function createPredictionChart() {
    predictionChart = c3.generate({
        bindto: '#prediction_chart_div',
        data: {
            x: 'x',
            columns: [
                ['traffic']
            ]
        },
        subchart: {
            show: true
        },
        axis: {
            y: {
                label: {
                    text: 'Traffic',
                    position: 'outer-middle'
                }
            },
            x: {
                label: {
                    text: 'UTC hour for today',
                    position: 'outer-middle'
                }
            }

        },
        legend: {
            show: false
        }
    });
}

$('#searchbox').typeahead({
        hint: true,
        highlight: true,
        minLength: 1
    },
    {
        name: 'speed',
        displayKey: 'value',
        source: substringMatcher()
    }).on('typeahead:selected', function ($e, datum) {
        objectId = datum['value'];
        focusOnSpatialObject(objectId)
    });

var toggled = false;
function focusOnSpatialObject(objectId) {
    console.log("Selecting" + objectId);
    var spatialObject = currentSpatialObjects[objectId];// (local)
    if (!spatialObject) {
        $.UIkit.notify({
            message: "Spatial Object " + objectId + " not in the Map!!",
            status: 'warning',
            timeout: ApplicationOptions.constance.NOTIFY_WARNING_TIMEOUT,
            pos: 'top-center'
        });
        return false;
    }
    clearFocus(); // Clear current focus if any
    selectedSpatialObject = objectId; // (global) Why not use 'var' other than implicit declaration http://stackoverflow.com/questions/1470488/what-is-the-function-of-the-var-keyword-and-when-to-use-it-or-omit-it#answer-1471738

    console.log("Selected " + objectId + " type " + spatialObject.type);
    if (spatialObject.type == "area") {
        spatialObject.focusOn(map);
        return true;
    }

    map.setView(spatialObject.marker.getLatLng(), 15, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly

    $('#objectInfo').find('#objectInfoId').html(selectedSpatialObject);
    spatialObject.marker.openPopup();
    if (!toggled) {
        $('#objectInfo').animate({width: 'toggle'}, 100);
        toggled = true;
    }
    getAlertsHistory(objectId);
    spatialObject.drawPath();
    setTimeout(function () {
        createChart();
        chart.load({columns: [spatialObject.speedHistory.getArray()]});
    }, 100);
}

function onClickMoreInfo(objectId) {

    var url = "https://localhost:9443/portal/dashboards/motor-rally-individual-summary?team_name=" + objectId;
    window.open(url);

}

// Unfocused on current searched spatial object
function clearFocus() {
    if (selectedSpatialObject) {
        spatialObject = currentSpatialObjects[selectedSpatialObject];
        spatialObject.removeFromMap();
        selectedSpatialObject = null;
    }
}


text:
module Perpetuity
  class Postgres
    class NullValue
      def to_s
        'NULL'
      end
    end
  end
end


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _pangu = require('../modules/pangu');

var _pangu2 = _interopRequireDefault(_pangu);

var _extend = require('../utils/extend');

var _extend2 = _interopRequireDefault(_extend);

var _upperCaseFirst = require('../utils/upper-case-first');

var _upperCaseFirst2 = _interopRequireDefault(_upperCaseFirst);

var _expsDict = require('../stores/exps-dict');

var _expsDict2 = _interopRequireDefault(_expsDict);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var lifeExp = function lifeExp(talks) {
  var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

  // Init exps
  var exps = talks;

  // Init options
  var defaultOptions = {
    isTrim: true,
    isWearGlasses: false
  };
  options = (0, _extend2.default)({}, defaultOptions, options);

  /* ==== Teaching ==== */

  // Replace text according to expsDict
  for (var pattern in _expsDict2.default) {
    exps = exps.replace(new RegExp(pattern, 'ig'), _expsDict2.default[pattern]);
  }

  // TODO: Wear glasses
  if (options.isWearGlasses) {}

  // Add space between Chinese and English characters
  exps = (0, _pangu2.default)(exps);

  // Remove leading and trailing excess spaces
  if (options.isTrim) {
    exps.trim();
  }

  // Upper case the first character of each sentence
  var endPunctuation = ['。', '!', '?', // Fullwidth
  '. ', '! ', '? ' // Halfwidth
  ];
  endPunctuation.forEach(function (mark) {
    exps = exps.split(mark).map(_upperCaseFirst2.default).join(mark);
  });

  return exps;
};

exports.default = lifeExp;
module.exports = exports['default'];


text:
<!--
  ~ Copyright 2008 Kjetil Valstadsve
  ~
  ~ 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.
  -->

<assembly>
    <id>scalacalc-install</id>
    <includeBaseDirectory>false</includeBaseDirectory>
    <formats>
        <format>zip</format>
    </formats>
    <fileSets>
        <fileSet>
            <lineEnding>unix</lineEnding>
            <directory>src/main/resources/scalacalc-install</directory>
            <outputDirectory>vanadis-felix</outputDirectory>
        </fileSet>
    </fileSets>
    <binaries>
        <dependencySets>
            <dependencySet>
                <useTransitiveDependencies>false</useTransitiveDependencies>
                <unpack>true</unpack>
                <includes>
                    <include>vanadis.install:vanadis.install</include>
                </includes>
                <unpackOptions>
                    <excludes>
                        <exclude>vanadis-felix/deploy/bundle/vanadis.modules.ris.rmi*</exclude>
                        <exclude>vanadis-felix/deploy/bundle/vanadis.rmiprovider*</exclude>
                        <exclude>vanadis-felix/deploy/launch/distributor.xml</exclude>
                    </excludes>
                </unpackOptions>
            </dependencySet>
            <dependencySet>
                <useTransitiveDependencies>false</useTransitiveDependencies>
                <outputDirectory>
                    vanadis-felix/deploy/bundle
                </outputDirectory>
                <includes>
                    <include>vanadis.modules.examples.scalacalc.*</include>
                </includes>
                <excludes>
                    <exclude>vanadis.modules.examples.scalacalc.install*</exclude>
                </excludes>
            </dependencySet>
        </dependencySets>
    </binaries>
</assembly>


text:
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  hasProp = {}.hasOwnProperty;

this.Spellbook.Classes.LiveSearch = (function(superClass) {
  extend(LiveSearch, superClass);

  function LiveSearch() {
    return LiveSearch.__super__.constructor.apply(this, arguments);
  }

  LiveSearch.prototype._query = '';

  LiveSearch.prototype.init = function() {
    this._setDefaults({
      $element: $('.js-search'),
      $query: $('.js-search-query'),
      $container: $('.js-search-container'),
      itemNode: '.js-search-item',
      hiddenClass: 'is-hidden',
      emptyMessage: true,
      emptyNode: '.js-search-empty',
      onClear: null,
      onEmpty: null,
      onFound: null,
      onKeyup: null
    });
    return this._setEventHandlers();
  };

  LiveSearch.prototype._setEventHandlers = function() {
    return this._settings.$element.on('keyup', (function(_this) {
      return function(event) {
        var base, base1;
        _this._query = $(event.currentTarget).val();
        if (typeof (base = _this._settings).onKeyup === "function") {
          base.onKeyup(_this._settings);
        }
        if (_this._query === '') {
          $(_this._settings.itemNode).removeClass(_this._settings.hiddenClass);
          _this._clearEmptyMessage();
          if (typeof (base1 = _this._settings).onClear === "function") {
            base1.onClear(_this._settings);
          }
        }
        _this._clearEmptyMessage();
        return _this._parseDom();
      };
    })(this));
  };

  LiveSearch.prototype._parseDom = function() {
    this._settings.$query.each((function(_this) {
      return function(index, elementNode) {
        var $element, base;
        $element = $(elementNode);
        if (_this._isQueryAbsent($element)) {
          return $element.closest(_this._settings.itemNode).addClass(_this._settings.hiddenClass);
        } else {
          $element.closest(_this._settings.itemNode).removeClass(_this._settings.hiddenClass);
          return typeof (base = _this._settings).onFound === "function" ? base.onFound(_this._settings) : void 0;
        }
      };
    })(this));
    return this._handleEmptyResults();
  };

  LiveSearch.prototype._clearEmptyMessage = function() {
    if (this._settings.emptyMessage && $(this._settings.emptyNode).length > 0) {
      return $(this._settings.emptyNode).remove();
    }
  };

  LiveSearch.prototype._handleEmptyResults = function() {
    var base, emptyClass;
    if (this._isEmpty()) {
      if (this._settings.emptyMessage) {
        emptyClass = this._settings.emptyNode.replace('.', '');
      }
      $("
\n  There are no results matching '" + this._query + "'.\n
").insertAfter(this._settings.$container);
      return typeof (base = this._settings).onEmpty === "function" ? base.onEmpty(this._settings) : void 0;
    }
  };

  LiveSearch.prototype._isQueryAbsent = function(element) {
    return element.text().search(new RegExp(this._query, 'i')) < 0;
  };

  LiveSearch.prototype._isEmpty = function() {
    return $(this._settings.itemNode + "." + this._settings.hiddenClass).length === $(this._settings.itemNode).length;
  };

  return LiveSearch;

})(Spellbook.Classes.Base);


text:
class ReaderWriterLock
{
    volatile Int32  m_RWLock;       // lock used for R/W synchronization
    Int32           m_spinCount;    // spin count for a reader waiting for a writer to release the lock
    bool            m_fBlockOnGc;   // True if the spinning writers should block when GC is in progress

#if 0
    // used to prevent writers from being starved by readers
    // we currently do not prevent writers from starving readers since writers
    // are supposed to be rare.
    bool            m_WriterWaiting;
#endif

    bool TryAcquireReadLock();
    bool TryAcquireWriteLock();

public:
    class ReadHolder
    {
        ReaderWriterLock * m_pLock;
        bool               m_fLockAcquired;
    public:
        ReadHolder(ReaderWriterLock * pLock, bool fAcquireLock = true);
        ~ReadHolder();
    };

    class WriteHolder
    {
        ReaderWriterLock * m_pLock;
        bool               m_fLockAcquired;
    public:
        WriteHolder(ReaderWriterLock * pLock, bool fAcquireLock = true);
        ~WriteHolder();
    };

    ReaderWriterLock(bool fBlockOnGc = false);

    void AcquireReadLock();
    void ReleaseReadLock();

    bool DangerousTryPulseReadLock();

protected:
    void AcquireWriteLock();
    void ReleaseWriteLock();

    void AcquireReadLockWorker();

};

#endif // __RWLock_h__


text:
<refentry xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          id="glossary.collection">
<refmeta>
<refentrytitle>glossary.collection</refentrytitle>
<refmiscinfo role="type">string</refmiscinfo>
</refmeta>
<refnamediv>
<refname>glossary.collection</refname>
<refpurpose>Name of the glossary collection file</refpurpose>
</refnamediv>

<refsynopsisdiv>
<src:fragment id='glossary.collection.frag'>
<xsl:param name="glossary.collection" select="''"/>
</src:fragment>
</refsynopsisdiv>

<refsect1><title>Description</title>

<para>Glossaries maintained independently across a set of documents
are likely to become inconsistent unless considerable effort is
expended to keep them in sync. It makes much more sense, usually, to
store all of the glossary entries in a single place and simply
<quote>extract</quote> the ones you need in each document.</para>

<para>That's the purpose of the
<parameter>glossary.collection</parameter> parameter. To setup a global
glossary <quote>database</quote>, follow these steps:</para>

<refsect2><title>Setting Up the Glossary Database</title>

<para>First, create a stand-alone glossary document that contains all of
the entries that you wish to reference. Make sure that each glossary
entry has an ID.</para>

<para>Here's an example glossary:</para>

<informalexample>
<programlisting><![CDATA[
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE glossary
  PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<glossary>
<glossaryinfo>
<editor><firstname>Eric</firstname><surname>Raymond</surname></editor>
<title>Jargon File 4.2.3 (abridged)</title>
<releaseinfo>Just some test data</releaseinfo>
</glossaryinfo>

<glossdiv><title>0</title>

<glossentry>
<glossterm>0</glossterm>
<glossdef>
<para>Numeric zero, as opposed to the letter `O' (the 15th letter of
the English alphabet). In their unmodified forms they look a lot
alike, and various kluges invented to make them visually distinct have
compounded the confusion. If your zero is center-dotted and letter-O
is not, or if letter-O looks almost rectangular but zero looks more
like an American football stood on end (or the reverse), you're
probably looking at a modern character display (though the dotted zero
seems to have originated as an option on IBM 3270 controllers). If
your zero is slashed but letter-O is not, you're probably looking at
an old-style ASCII graphic set descended from the default typewheel on
the venerable ASR-33 Teletype (Scandinavians, for whom /O is a letter,
curse this arrangement). (Interestingly, the slashed zero long
predates computers; Florian Cajori's monumental "A History of
Mathematical Notations" notes that it was used in the twelfth and
thirteenth centuries.) If letter-O has a slash across it and the zero
does not, your display is tuned for a very old convention used at IBM
and a few other early mainframe makers (Scandinavians curse <emphasis>this</emphasis>
arrangement even more, because it means two of their letters collide).
Some Burroughs/Unisys equipment displays a zero with a <emphasis>reversed</emphasis>
slash. Old CDC computers rendered letter O as an unbroken oval and 0
as an oval broken at upper right and lower left. And yet another
convention common on early line printers left zero unornamented but
added a tail or hook to the letter-O so that it resembled an inverted
Q or cursive capital letter-O (this was endorsed by a draft ANSI
standard for how to draw ASCII characters, but the final standard
changed the distinguisher to a tick-mark in the upper-left corner).
Are we sufficiently confused yet?</para>
</glossdef>
</glossentry>

<glossentry>
<glossterm>1TBS</glossterm>
<glossdef>
<para role="accidence">
<phrase role="pronounce"></phrase>
<phrase role="partsofspeach">n</phrase>
</para>
<para>The "One True Brace Style"</para>
<glossseealso>indent style</glossseealso>
</glossdef>
</glossentry>

<!-- ... -->

</glossdiv>

<!-- ... -->

</glossary>]]></programlisting>
</informalexample>

</refsect2>

<refsect2><title>Marking Up Glossary Terms</title>

<para>That takes care of the glossary database, now you have to get the entries
into your document. Unlike bibliography entries, which can be empty, creating
<quote>placeholder</quote> glossary entries would be very tedious. So instead,
support for <parameter>glossary.collection</parameter> relies on implicit linking.</para>

<para>In your source document, simply use <sgmltag>firstterm</sgmltag> and
<sgmltag>glossterm</sgmltag> to identify the terms you wish to have included
in the glossary. The stylesheets assume that you will either set the
<sgmltag class="attribute">baseform</sgmltag> attribute correctly, or that the
content of the element exactly matches a term in your glossary.</para>

<para>If you're using a <parameter>glossary.collection</parameter>, don't
make explicit links on the terms in your document.</para>

<para>So, in your document, you might write things like this:</para>

<informalexample>
<programlisting><![CDATA[<para>This is dummy text, without any real meaning.
The point is simply to reference glossary terms like <glossterm>0</glossterm>
and the <firstterm baseform="1TBS">One True Brace Style (1TBS)</firstterm>.
The <glossterm>1TBS</glossterm>, as you can probably imagine, is a nearly
religious issue.</para>]]></programlisting>
</informalexample>

<para>If you set the <parameter>firstterm.only.link</parameter> parameter,
only the terms marked with <sgmltag>firstterm</sgmltag> will be links.
Otherwise, all the terms will be linked.</para>

</refsect2>

<refsect2><title>Marking Up the Glossary</title>

<para>The glossary itself has to be identified for the stylesheets. For lack
of a better choice, the <sgmltag class="attribute">role</sgmltag> is used.
To identify the glossary as the target for automatic processing, set
the role to <quote><literal>auto</literal></quote>. The title of this
glossary (and any other information from the <sgmltag>glossaryinfo</sgmltag>
that's rendered by your stylesheet) will be displayed, but the entries will
come from the database.
</para>

<para>Unfortunately, the glossary can't be empty, so you must put in
at least one <sgmltag>glossentry</sgmltag>. The content of this entry
is irrelevant, it will not be rendered:</para>

<informalexample>
<programlisting><![CDATA[<glossary role="auto">
<glossentry>
<glossterm>Irrelevant</glossterm>
<glossdef>
<para>If you can see this, the document was processed incorrectly. Use
the <parameter>glossary.collection</parameter> parameter.</para>
</glossdef>
</glossentry>
</glossary>]]></programlisting>
</informalexample>

<para>What about glossary divisions? If your glossary database has glossary
divisions <emphasis>and</emphasis> your automatic glossary contains at least
one <sgmltag>glossdiv</sgmltag>, the automic glossary will have divisions.
If the <sgmltag>glossdiv</sgmltag> is missing from either location, no divisions
will be rendered.</para>

<para>Glossary entries (and divisions, if appropriate) in the glossary will
occur in precisely the order they occur in your database.</para>

</refsect2>

<refsect2><title>Formatting the Document</title>

<para>Finally, when you are ready to format your document, simply set the
<parameter>glossary.collection</parameter> parameter (in either a
customization layer or directly through your processor's interface) to
point to your global glossary.</para>

<para>The stylesheets will format the glossary in your document as if
all of the entries implicilty referenced appeared there literally.</para>
</refsect2>

<refsect2><title>Limitations</title>

<para>Glossary cross-references <emphasis>within the glossary</emphasis> are
not supported. For example, this <emphasis>will not</emphasis> work:</para>

<informalexample>
<programlisting><![CDATA[<glossentry>
<glossterm>gloss-1</glossterm>
<glossdef><para>A description that references <glossterm>gloss-2</glossterm>.</para>
<glossseealso>gloss-2</glossseealso>
</glossdef>
</glossentry>]]></programlisting>
</informalexample>

<para>If you put glossary cross-references in your glossary that way,
you'll get the cryptic error: <computeroutput>Warning:
glossary.collection specified, but there are 0 automatic
glossaries</computeroutput>.</para>

<para>Instead, you must do two things:</para>

<orderedlist>
<listitem>
<para>Markup your glossary using <sgmltag>glossseealso</sgmltag>:</para>

<informalexample>
<programlisting><![CDATA[<glossentry>
<glossterm>gloss-1</glossterm>
<glossdef><para>A description that references <glossterm>gloss-2</glossterm>.</para>
<glossseealso>gloss-2</glossseealso>
</glossdef>
</glossentry>]]></programlisting>
</informalexample>
</listitem>

<listitem>
<para>Make sure there is at least one <sgmltag>glossterm</sgmltag> reference to
<glossterm>gloss-2</glossterm> <emphasis>in your document</emphasis>. The
easiest way to do that is probably within a <sgmltag>remark</sgmltag> in your
automatic glossary:</para>

<informalexample>
<programlisting><![CDATA[<glossary role="auto">
<remark>Make sure there's a reference to <glossterm>gloss-2</glossterm>.</remark>
<glossentry>
<glossterm>Irrelevant</glossterm>
<glossdef>
<para>If you can see this, the document was processed incorrectly. Use
the <parameter>glossary.collection</parameter> parameter.</para>
</glossdef>
</glossentry>
</glossary>]]></programlisting>
</informalexample>
</listitem>
</orderedlist>
</refsect2>

</refsect1>
</refentry>


text:
title: echanj-online
inshort: non
translator: Microsoft Cognitive Services
---


text:
package org.odk.collect.android.tasks;

/**
 *
 * Author: Meletis Margaritis
 * Date: 19/10/2013
 * Time: 12:17 μμ
 */
public interface ProgressNotifier {

    void onProgressStep(String stepMessage);
}


text: search_result['2073']=["topic_000000000000050B.html","SubtitleHelper Class",""];


text:
<?xml version="1.0" encoding="utf-8"?>

Logging in with a Security Code

How to login to a site when the CAPTCHA security code is required. This is a unique code that is generated as a picture each time you login.

Click the Login link (typically located in the top right corner of each page) to open the User Login pop-up window - OR - Navigate to an Account Login module.

In the Username text box, enter your user name.

In the Password text box, enter your password.

In the Security Code text box, enter the code displayed as a picture.

Click the  Login button.

Logging in with a Security Code

            Related Topics:

                <MadCap:xref href="../../Using the Control Panel/Admin Console/Extensions/Module Editors/Configuring Default Authentication.html">See "Configuring Default Authentication"</MadCap:xref>


text:
'use strict';

define(['angular', 'require'], function(angular, require) {
  return angular.module('portal.main.controllers', [])

  .controller('PortalMainController', [
    '$localStorage', '$sessionStorage', '$scope', '$rootScope', '$document',
    '$location', '$log', 'NAMES', 'MISC_URLS', 'APP_FLAGS',
    'APP_OPTIONS', 'SERVICE_LOC', 'THEMES', 'miscService', 'mainService',
    function(
      $localStorage, $sessionStorage, $scope, $rootScope, $document,
      $location, $log, NAMES, MISC_URLS, APP_FLAGS,
      APP_OPTIONS, SERVICE_LOC, THEMES, miscService, mainService) {
    var defaults = {
      layoutMode: 'list', // other option is 'widgets
    };

    /**
      * Listen for unseen notifications
      * PRIORITY NOTIFICATIONS ARE DEPRECATED
      */
    $scope.$on('HAS_PRIORITY_NOTIFICATIONS', function(event, data) {
      if (angular.isDefined(data.hasNotifications)) {
        $scope.hasPriorityNotifications = data.hasNotifications;
      }
    });

    /**
     * Get banner messages
     */
    function getBanners() {
      mainService.getBanners()
        .then(function(result) {
          // Ensure messages exist
          if (angular.isArray(result) && result.length > 0) {
            $scope.banner.message = result[0].text;
            if (result[0].button) {
              $scope.banner.confirmingText = result[0].button.label;
              $scope.banner.confirmingUrl = result[0].button.url;
              $scope.banner.icon = result[0].icon;
            }
            $scope.bannerHasContent = true;
          }

          return result;
        })
        .catch(function(error) {
          $log.warn('Problem getting banner messages');
          return error;
        });
    }

    /**
     * Set Document title.
     * Asks mainService what the document title ought to be and
     * sets the document title to that value.
     * @param {string} [pageTitle] - Name of specific page viewed.
     */
    function updateWindowTitle(pageTitle) {
      var appTitle = NAMES.title;
      $rootScope.appBarTitle = NAMES.title;

      var portalTitle = '';
      if ($rootScope.portal && $rootScope.portal.theme &&
            $rootScope.portal.theme.title) {
        // there's an active theme with a title.
        // consider that title the name of the portal
        portalTitle = $rootScope.portal.theme.title;

        // If it's the same as the configured app title, set the top bar
        // title to empty string
        if (NAMES.title === $rootScope.portal.theme.title) {
          $rootScope.appBarTitle = '';
        }
      }

      var windowTitle =
        mainService.computeWindowTitle(pageTitle, appTitle, portalTitle);

      $document[0].title = windowTitle;
    }

    // =====functions ======
    var init = function() {
      if (SERVICE_LOC.bannersURL) {
        getBanners();
      }

      $scope.$storage = $localStorage.$default(defaults);

      $scope.NAMES=NAMES;
      $scope.APP_FLAGS=APP_FLAGS;
      $scope.MISC_URLS=MISC_URLS;
      $scope.THEMES = THEMES.themes;
      $scope.APP_OPTIONS = APP_OPTIONS;
      $scope.bannerHasContent = false;
      $scope.banner = {
        'message': '',
        'confirming-text': '',
        'confirming-url': '',
        'dismissiveText': 'Skip for now',
      };

      // Update window title and set app name in top bar
      if (NAMES.title) {
        updateWindowTitle();
      }
      // https://github.com/Gillespie59/eslint-plugin-angular/issues/231
      // eslint-disable-next-line angular/on-watch
      $rootScope.$watch('portal.theme', function(newValue, oldValue) {
        if (newValue && newValue !== oldValue) {
          updateWindowTitle();
        }
      });

      // class for ng-view
      $scope.routeClass = 'route' +
        $location.path().replace(new RegExp('/', 'g'), '-').toLowerCase();
    };

    $scope.resetAll = function() {
      $scope.resetLocal();
      $scope.resetSession();
      $scope.reload();
    };

    $scope.resetLocal = function() {
        $localStorage.$reset(defaults);
    };

    $scope.resetSession = function() {
        $sessionStorage.$reset();
    };

    $scope.reload = function() {
        location.reload();
    };
    $scope.pushGAEvent = function(category, action, label) {
      miscService.pushGAEvent(category, action, label);
    };

    // run init
    init();
  }])

  /* Username */
  .controller('SessionCheckController',
  ['$log', '$scope', 'mainService', 'NAMES',
  'APP_FLAGS', '$sessionStorage', '$localStorage', '$rootScope',
  function($log, $scope, mainService, NAMES,
           APP_FLAGS, $sessionStorage, $localStorage, $rootScope) {
    var vm = this;
    vm.user = [];
    vm.username = '?';
    vm.campusId = '';
    vm.firstLetter = '?';
    vm.usernameMenuFocus = '';
    vm.optAvatar = $sessionStorage.optAvatar;
    vm.profileUrl = ($sessionStorage.portal.theme
      && $sessionStorage.portal.theme.profileUrl) ?
      $sessionStorage.portal.theme.profileUrl : '';
    vm.campusIdAttribute = APP_FLAGS.campusIdAttribute;
    vm.guestMode = true;

    // Tell username menu which element to focus upon opening (accessibility)
    if (APP_FLAGS.showUserSettingsPage) {
      vm.usernameMenuFocus = 'user-settings';
    } else if ($localStorage.showSettings) {
      vm.usernameMenuFocus = 'beta-settings';
    } else {
      vm.usernameMenuFocus = 'log-out';
    }

    /**
     * Listen for theme changes and update profileUrl accordingly
     */
    $scope.$on('themeChanged', function(event, data) {
      vm.profileUrl = data.profileUrl ? data.profileUrl : '';
    });

    mainService.getUser().then(function(result) {
      vm.user = result;

      if (vm.user.firstName || vm.user.displayName) {
        vm.username = vm.user.firstName ?
          vm.user.firstName.toLowerCase() : vm.user.displayName.toLowerCase();
      }
      vm.firstLetter = vm.username.substring(0, 1);

      // This is a placeholder until a campusId source is added.
      // Set campus ID
      if (vm.campusIdAttribute && vm.user[vm.campusIdAttribute]) {
        vm.campusId = vm.user[vm.campusIdAttribute];
      }

      return result;
    }).catch(function() {
      $log.warn('could not get user');
    });

    mainService.isGuest().then(function(result) {
      return vm.guestMode = result;
    }).catch(function(err) {
      $log.warn('could not check guest');
    });
  }])

  /* Main menu toggle controller */
  .controller('MenuToggleController', ['$mdSidenav', 'APP_OPTIONS',
    function($mdSidenav, APP_OPTIONS) {
      var vm = this;

      vm.isMenuConfigured = true;

      /**
       * Toggle the side navigation menu
       */
      vm.showMainMenu = function() {
        $mdSidenav('main-menu').toggle();
      };

      /**
       * Hide main menu toggle if minimum configuration requirements
       * are unmet
       */
      var init = function() {
        if (APP_OPTIONS.appMenuItems.length == 0
          && (angular.isUndefined(APP_OPTIONS.appMenuTemplateURL)
          || APP_OPTIONS.appMenuTemplateURL == null)) {
          vm.isMenuConfigured = false;
        }
      };

      init();
  }])

  /* Side navigation controller */
  .controller('MainMenuController', ['$rootScope', '$scope', '$mdSidenav',
    '$mdMedia', '$window', '$localStorage', 'APP_OPTIONS', 'FOOTER_URLS',
    'MESSAGES', 'NAMES', 'SERVICE_LOC', 'miscService',
    function($rootScope, $scope, $mdSidenav, $mdMedia, $window, $localStorage,
             APP_OPTIONS, FOOTER_URLS, MESSAGES, NAMES, SERVICE_LOC,
             miscService) {
      var vm = this;

      // Scope variables
      vm.menuItems = [];
      vm.appName = '';
      vm.notificationsPageUrl = '';
      vm.hideMainMenu = false;
      vm.footerLinks = FOOTER_URLS;
      vm.openMenuByDefault = false;
      vm.showMessagesFeatures = true;

      /**
       * Listen for unseen notifications
       * PRIORITY NOTIFICATIONS ARE DEPRECATED
       */
      $scope.$on('HAS_PRIORITY_NOTIFICATIONS', function(event, data) {
        if (angular.isDefined(data.hasNotifications)) {
          vm.hasPriorityNotifications = data.hasNotifications;
        }
      });

      /**
       * Close side nav on scroll to avoid awkward interaction
       */
      $window.onscroll = function() {
        if (vm.isMenuOpen() && !$mdMedia('gt-sm')) {
          vm.closeMainMenu();
        }
      };

      /**
       * Check if the side nav menu is open
       * @return {boolean}
       */
      vm.isMenuOpen = function() {
        return $mdSidenav('main-menu').isOpen();
      };

      /**
       * Close the side navigation menu (used in ng-click)
       */
      vm.closeMainMenu = function() {
        if (vm.isMenuOpen()) {
          $mdSidenav('main-menu').close();
        }
      };

      /**
       * Intercept focus when it would move outside the side nav,
       * then reset it to the desired position within the side nav.
       * @param {object} event
       * @param {string} position
       */
      vm.trapFocus = function(event, position) {
        var anchor = angular.element('.main-menu__focus-anchor' + position);
        // Check if screen size is greater than small
        if ($mdMedia('gt-sm')) {
          // Don't trap focus if push content is enabled
          if (!APP_OPTIONS.enablePushContentMenu) {
            event.preventDefault();
            anchor.focus();
          }
        } else {
          event.preventDefault();
          anchor.focus();
        }
      };

      /**
       * Track clicks on "Notifications" bell in mobile side nav
       * @param {string} category - Context of the event
       * @param {string} action - Action taken
       * @param {string} label - Label/data pertinent to event
       */
      vm.pushGAEvent = function(category, action, label) {
        miscService.pushGAEvent(category, action, label);
      };

      /**
       * Configure menu template, mobile menu top bar,
       * menu footer, and push content mode
       */
      var configureMainMenu = function() {
        // Use either custom template or defined menu items
        if (APP_OPTIONS.appMenuTemplateURL) {
          vm.appMenuTemplate = require.toUrl(APP_OPTIONS.appMenuTemplateURL);
        } else if (APP_OPTIONS.appMenuItems
          && APP_OPTIONS.appMenuItems.length > 0) {
          vm.menuItems = APP_OPTIONS.appMenuItems;
        } else {
          vm.hideMainMenu = true;
        }
        // Set mobile menu header values
        if (NAMES.title) {
          vm.appName = NAMES.title;
        }
        if (MESSAGES.notificationsPageURL) {
          vm.notificationsPageUrl = MESSAGES.notificationsPageURL;
        }
        // Add footer links
        if ($rootScope.portal && $rootScope.portal.theme
          && $rootScope.portal.theme.footerLinks) {
          vm.footerLinks =
            vm.footerLinks.concat($rootScope.portal.theme.footerLinks);
        }
        // Check if push content is set
        vm.openMenuByDefault =
          APP_OPTIONS.enablePushContentMenu
          && $mdMedia('gt-sm') && !vm.hideMainMenu;
      };

      /**
       * Configure notifications features in main menu
       * if messages configuration is properly set up
       */
      var configureMessagesFeatures = function() {
        // If messages config is properly set up, set directive scope,
        // otherwise hide messages features
        if (SERVICE_LOC.messagesURL && SERVICE_LOC.messagesURL !== '') {
          // Set flags for notifications
          vm.hasPriorityNotifications = $localStorage.hasPriorityNotifications;
        } else {
          vm.showMessagesFeatures = false;
        }
      };

      /**
       * Check for menu configuration in app config
       */
      var init = function() {
        configureMainMenu();
        configureMessagesFeatures();
      };

      init();
  }])

  /* Footer */
  .controller('PortalFooterController', ['$scope', 'FOOTER_URLS',
    function($scope, FOOTER_URLS) {
      $scope.date = new Date();
      $scope.FOOTER_URLS = FOOTER_URLS;
  }]);
});


text: cp vim/colors/spring.vim ~/.vim/colors/


text:
class AddTokenToUserTokens < ActiveRecord::Migration
  def self.up
    add_column :user_tokens, :token, :string
    add_column :user_tokens, :secret, :string
  end

  def self.down
    remove_column :user_tokens, :secret
    remove_column :user_tokens, :token
  end
end


text:
package org.mazhuang.android.hellomoon;

import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

public class HelloMoonFragment extends Fragment {

	private Button mPlayButton;
	private Button mStopButton;
	private Button mPauseButton;
	private Button mPlayVideoButton;
	private AudioPlayer mPlayer = new AudioPlayer();

	private static final String PLAY_VIDEO = "play_video";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setRetainInstance(true);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup parent,
			Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.fragment_hello_moon, parent, false);

		mPlayButton = (Button)v.findViewById(R.id.hellomoon_playButton);
		mPlayButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				mPlayer.play(getActivity());
			}
		});
		mPauseButton = (Button)v.findViewById(R.id.hellomoon_pauseButton);
		mPauseButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				mPlayer.pause();
			}
		});
		mStopButton = (Button)v.findViewById(R.id.hellomoon_stopButton);
		mStopButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				mPlayer.stop();
			}
		});

		mPlayVideoButton = (Button)v.findViewById(R.id.hellomoon_playVideoButton);
		mPlayVideoButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				PlayVideoFragment fragment = new PlayVideoFragment();
				fragment.show(getActivity().getSupportFragmentManager(), PLAY_VIDEO);
			}
		});

		return v;
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		mPlayer.stop();
	}

}


text:
    Reprise de {{hour}} de

    {{name}}

Sélectionnez les cavaliers et chevaux à supprimer

Cavaliers

           {{rider.name}}

Chevaux

           {{horse.name}}

    <button class="btn btn-primary" type="button" ng-click="ok()">Supprimer</button>
    <button class="btn btn-warning" type="button" ng-click="cancel()">Annuler</button>


text:
package org.kie.workbench.common.stunner.bpmn.client.marshall;

import java.util.function.Function;

public class MarshallingMessageDecorator<T> {

    private final Function<T, String> name;
    private final Function<T, String> type;

    public MarshallingMessageDecorator(Function<T, String> name, Function<T, String> type) {
        this.name = name;
        this.type = type;
    }

    public static <T> MarshallingMessageDecorator<T> of(Function<T, String> name, Function<T, String> type) {
        return new MarshallingMessageDecorator<>(name, type);
    }

    public String getName(T object) {
        return name.apply(object);
    }

    public String getType(T object) {
        return type.apply(object);
    }
}


text:
namespace RayTrace {

Intersections
CSG::
intersectInternal(const Ray &ray) const
{
  Intersections i = lhs_->intersect(ray).add(rhs_->intersect(ray));

  return filterIntersections(i);
}

Vector
CSG::
pointNormalInternal(const Point &) const
{
  assert(false);

  return Vector();
}

Intersections
CSG::
filterIntersections(Intersections &intersectons) const
{
  bool inl = false;
  bool inr = false;

  Intersections intersectons1;

  for (const auto &intersection : intersectons) {
    bool lhit = lhs_->hasObject(intersection.object());

    if (intersectionAllowed(op_, lhit, inl, inr))
      intersectons1.push_back(intersection);

    if (lhit)
      inl = ! inl;
    else
      inr = ! inr;
  }

  return intersectons1;
}

bool
CSG::
intersectionAllowed(const Op &op, bool lhit, bool inl, bool inr)
{
  switch (op) {
    case Op::UNION:
      return (lhit && ! inr) || (! lhit && ! inl);
    case Op::INTERSECTION:
      return (lhit && inr) || (! lhit && inl);
    case Op::DIFFERENCE:
      return (lhit && ! inr) || (! lhit && inl);
    default:
      return false;
  }
}

}


text:
import AnswerRating from './answerRating';
import FeedBackResults from './feedbackResults';
import './less/feedback.less';

// Check if bar rating should be initialized
const ratingWrapper = document.querySelector('.rating-wrapper');
if (ratingWrapper !== null) {
  AnswerRating();
}

// Check if feed back results charts should be initialized
const feedBackResultsElement = document.getElementById('feedback-results');
if (feedBackResultsElement !== null) {
  FeedBackResults();
}


text:
<?php

// HttpPost.class.php

class HttpPost {
          public $url;
          public $postString;
          public $httpResponse;

          public $ch;

          public function __construct($url) {
                   $this->url = $url;
                   $this->ch = curl_init( $this->url );
                   curl_setopt( $this->ch, CURLOPT_FOLLOWLOCATION, false );
                   curl_setopt( $this->ch, CURLOPT_HEADER, false );
                   curl_setopt( $this->ch, CURLOPT_RETURNTRANSFER, true );
          }

          public function __destruct() {
                    curl_close($this->ch);
          }
          public function setPostData( $params ) {
                   // http_build_query encodes URLs, which breaks POST data
                   $this->postString = rawurldecode(http_build_query( $params ));
                   curl_setopt( $this->ch, CURLOPT_POST, true );
                   curl_setopt ( $this->ch, CURLOPT_POSTFIELDS, $this->postString );
          }

          public function send() {
                   $this->httpResponse = curl_exec( $this->ch );
          }

          public function getHttpResponse() {
                    return $this->httpResponse;
          }
}

?>