text:
'use babel';

import {CompositeDisposable} from 'atom';

import {HeaderManager} from './header-manager';
import * as configSchema from './config-schema';

export default {

  subscriptions: null,
  config: configSchema,

  activate(state) {
    this.subscriptions = new CompositeDisposable();
    this.subscriptions.add(atom.commands.add('atom-workspace', {
      'header-42:create': () => this.create(),
      'header-42:update': () => this.update()
    }));
    this.subscriptions.add(atom.workspace.observeTextEditors(
      (editor) => makeNewManager(editor)
    ));
  },

  deactivate() {
    this.subscriptions.dispose();
  },

  create() {
    var current = atom.workspace.getActiveTextEditor();
    editors.forEach(
      (item) => item.editor == current && item.create());
  },

  update() {
    var current = atom.workspace.getActiveTextEditor();
    editors.forEach(
      (item) => item.editor == current && item.update());
  }

}

function makeNewManager(editor) {
  var manager = new HeaderManager(editor);
  manager.onDestroy = function(editor) {
    editors.forEach(
      (item, i) => item.editor == editor && editors.splice(i, 1));
  }
  editors.push(manager);
}

editors = [];


text:
namespace {

// Class that intercepts and stores profiles provided to the
// CallStackProfileMetricsProvider. Intercept() is invoked on the profiler
// thread while FetchProfiles() is invoked on the main thread.
class ProfileInterceptor {
 public:
  // Get the static object instance. This object must leak because there is no
  // synchronization between it and the profiler thread which can invoke
  // Intercept at any time.
  static ProfileInterceptor& GetInstance() {
    static base::NoDestructor<ProfileInterceptor> instance;
    return *instance;
  }

  void Intercept(metrics::SampledProfile profile) {
    base::AutoLock lock(lock_);
    profiles_.push_back(std::move(profile));
  }

  std::vector<metrics::SampledProfile> FetchProfiles() {
    base::AutoLock lock(lock_);
    std::vector<metrics::SampledProfile> profiles;
    profiles.swap(profiles_);
    return profiles;
  }

 private:
  base::Lock lock_;
  std::vector<metrics::SampledProfile> profiles_ GUARDED_BY(lock_);
};

class StackSamplingBrowserTest : public InProcessBrowserTest {
 public:
  void SetUp() override {
    // Arrange to intercept the CPU profiles at the time they're provided to the
    // metrics component.
    metrics::CallStackProfileMetricsProvider::
        SetCpuInterceptorCallbackForTesting(base::BindRepeating(
            &ProfileInterceptor::Intercept,
            base::Unretained(&ProfileInterceptor::GetInstance())));
    InProcessBrowserTest::SetUp();
  }

  void SetUpCommandLine(base::CommandLine* command_line) override {
    // Enable the special browser test mode.
    command_line->AppendSwitchASCII(switches::kStartStackProfiler,
                                    switches::kStartStackProfilerBrowserTest);
  }
};

// Wait for a profile with the specified properties. Checks once per second
// until the profile is seen or we time out.
bool WaitForProfile(metrics::SampledProfile::TriggerEvent trigger_event,
                    metrics::Process process,
                    metrics::Thread thread) {
  // Profiling is only enabled for trunk builds and canary and dev channels.
  // Perform an early return and pass the test for the other channels.
  switch (chrome::GetChannel()) {
    case version_info::Channel::UNKNOWN:
    case version_info::Channel::CANARY:
    case version_info::Channel::DEV:
      break;

    default:
      return true;
  }

  // The profiling duration is one second when enabling browser test mode via
  // the kStartStackProfilerBrowserTest switch argument. We expect to see the
  // profiles shortly thereafter, but wait up to 30 seconds to give ample time
  // to avoid flaky failures.
  int seconds_to_wait = 30;
  do {
    std::vector<metrics::SampledProfile> profiles =
        ProfileInterceptor::GetInstance().FetchProfiles();
    const bool was_received =
        std::find_if(profiles.begin(), profiles.end(),
                     [&](const metrics::SampledProfile& profile) {
                       return profile.trigger_event() == trigger_event &&
                              profile.process() == process &&
                              profile.thread() == thread;
                     }) != profiles.end();
    if (was_received)
      return true;
    base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
    // Manually spinning message loop is fine here because the main thread
    // message loop will not be continuously busy at Chrome startup, and we will
    // spin it enough over 30 seconds to ensure that any necessary processing is
    // done.
    base::RunLoop().RunUntilIdle();
  } while (--seconds_to_wait > 0);

  return false;
}

}  // namespace

// Check that we receive startup profiles in the browser process for profiled
// processes/threads. We've seen multiple breakages previously where profiles
// were dropped as a result of bugs introduced by mojo refactorings.

IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, BrowserProcessMainThread) {
  EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP,
                             metrics::BROWSER_PROCESS, metrics::MAIN_THREAD));
}

IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, BrowserProcessIOThread) {
  EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP,
                             metrics::BROWSER_PROCESS, metrics::IO_THREAD));
}

IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, GpuProcessMainThread) {
  EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP,
                             metrics::GPU_PROCESS, metrics::MAIN_THREAD));
}

IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, GpuProcessIOThread) {
  EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP,
                             metrics::GPU_PROCESS, metrics::IO_THREAD));
}

IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, GpuProcessCompositorThread) {
  EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP,
                             metrics::GPU_PROCESS, metrics::COMPOSITOR_THREAD));
}

IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, RendererProcessMainThread) {
  EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP,
                             metrics::RENDERER_PROCESS, metrics::MAIN_THREAD));
}

IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, RendererProcessIOThread) {
  EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP,
                             metrics::RENDERER_PROCESS, metrics::IO_THREAD));
}

IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest,
                       RendererProcessCompositorThread) {
  EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP,
                             metrics::RENDERER_PROCESS,
                             metrics::COMPOSITOR_THREAD));
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

/* jasmine specs for controllers go here */
describe('PhoneCat controllers', function () {

    beforeEach(function () {
        this.addMatchers({
            toEqualData: function (expected) {
                return angular.equals(this.actual, expected);
            }
        });
    });

    beforeEach(module('phonecatApp'));
    beforeEach(module('phonecatServices'));

    describe('PhoneListCtrl', function () {
        var scope, ctrl, $httpBackend;

        beforeEach(inject(function (_$httpBackend_, $rootScope, $controller) {
            $httpBackend = _$httpBackend_;
            $httpBackend.expectGET('phones/phones.json').
                respond([
                    {name: 'Nexus S'},
                    {name: 'Motorola DROID'}
                ]);

            scope = $rootScope.$new();
            ctrl = $controller('PhoneListCtrl', {$scope: scope});
        }));

        it('should create "phones" model with 2 phones fetched from xhr', function () {
            expect(scope.phones).toEqualData([]);
            $httpBackend.flush();

            expect(scope.phones).toEqualData(
                [
                    {name: 'Nexus S'},
                    {name: 'Motorola DROID'}
                ]);
        });

        it('should set the default value of orderProp model', function () {
            expect(scope.orderProp).toBe('age');
        });
    });

    describe('PhoneDetailCtrl', function () {
        var scope, $httpBackend, ctrl,
            xyzPhoneData = function () {
                return {
                    name: 'phone xyz',
                    images: ['image/url1.png', 'image/url2.png']
                }
            };

        beforeEach(inject(function (_$httpBackend_, $rootScope, $routeParams, $controller) {
            $httpBackend = _$httpBackend_;
            $httpBackend.expectGET('phones/xyz.json').respond(xyzPhoneData());

            $routeParams.phoneId = 'xyz';
            scope = $rootScope.$new();
            ctrl = $controller('PhoneDetailCtrl', {$scope: scope});
        }));

        it('should fetch phone detail', function () {
            expect(scope.phone).toEqualData({});
            $httpBackend.flush();

            expect(scope.phone).toEqualData(xyzPhoneData());
        });
    });
});


text:
var helpers = require('../spec/helpers');
var path = require('path');
var Q = require('q');
var shell = require('shelljs');
var events = require('cordova-common').events;
var cordova = require('../src/cordova/cordova');
var platforms = require('../src/platforms/platforms');
var plugman = require('../src/plugman/plugman');
var install = require('../src/plugman/install');
var registry = require('../src/plugman/registry/registry');

var util = require('../src/cordova/util');

var tmpDir = helpers.tmpDir('plugin_test');
var project = path.join(tmpDir, 'project');
var fixturesDir = path.join(__dirname, '..', 'spec', 'cordova', 'fixtures');
var pluginsDir = path.join(fixturesDir, 'plugins');

var pluginId = 'org.apache.cordova.fakeplugin1';
var org_test_defaultvariables = 'org.test.defaultvariables';

// This plugin is published to npm and defines cordovaDependencies
// in its package.json. Based on the dependencies and the version of
// cordova-android installed in our test project, the CLI should
// select version 1.1.2 of the plugin. We don't actually fetch from
// npm, but we do check the npm info.
var npmInfoTestPlugin = 'cordova-lib-test-plugin';
var npmInfoTestPluginVersion = '1.1.2';

var testGitPluginRepository = 'https://github.com/apache/cordova-plugin-device.git';
var testGitPluginId = 'cordova-plugin-device';

var results;

// Runs: list, add, list
function addPlugin (target, id, options) {
    // Check there are no plugins yet.
    return cordova.plugin('list').then(function () {
        expect(results).toMatch(/No plugins added/gi);
    }).then(function () {
        // Add a fake plugin from fixtures.
        return cordova.plugin('add', target, options);
    }).then(function () {
        expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
    }).then(function () {
        return cordova.plugin('ls');
    }).then(function () {
        expect(results).toContain(id);
    });
}

// Runs: remove, list
function removePlugin (id) {
    return cordova.plugin('rm', id)
        .then(function () {
            // The whole dir should be gone.
            expect(path.join(project, 'plugins', id)).not.toExist();
        }).then(function () {
            return cordova.plugin('ls');
        }).then(function () {
            expect(results).toMatch(/No plugins added/gi);
        });
}

var errorHandler = {
    errorCallback: function (error) {
        // We want the error to be printed by jasmine
        expect(error).toBeUndefined();
    }
};

// We can't call add with a searchpath or else we will conflict with other tests
// that use a searchpath. See loadLocalPlugins() in plugman/fetch.js for details.
// The searchpath behavior gets tested in the plugman spec
function mockPluginFetch (id, dir) {
    spyOn(plugman, 'fetch').and.callFake(function (target, pluginPath, fetchOptions) {
        var dest = path.join(project, 'plugins', id);
        var src = path.join(dir, 'plugin.xml');

        shell.mkdir(dest);
        shell.cp(src, dest);
        return Q(dest);
    });
}

describe('plugin end-to-end', function () {
    events.on('results', function (res) { results = res; });

    beforeEach(function () {
        shell.rm('-rf', project);

        // cp then mv because we need to copy everything, but that means it'll copy the whole directory.
        // Using /* doesn't work because of hidden files.
        shell.cp('-R', path.join(fixturesDir, 'base'), tmpDir);
        shell.mv(path.join(tmpDir, 'base'), project);
        // Copy some platform to avoid working on a project with no platforms.
        shell.cp('-R', path.join(__dirname, '..', 'spec', 'plugman', 'projects', helpers.testPlatform), path.join(project, 'platforms'));
        process.chdir(project);

        // Reset origCwd before each spec to respect chdirs
        util._resetOrigCwd();
        delete process.env.PWD;

        spyOn(platforms, 'getPlatformApi').and.callThrough();
        spyOn(install, 'runInstall').and.callThrough();
        spyOn(errorHandler, 'errorCallback').and.callThrough();
    });

    afterEach(function () {
        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
        shell.rm('-rf', tmpDir);
        expect(errorHandler.errorCallback).not.toHaveBeenCalled();
    });

    it('Test 001 : should successfully add and remove a plugin with no options', function (done) {
        addPlugin(path.join(pluginsDir, 'fake1'), pluginId, {}, done)
            .then(function () {
                expect(install.runInstall).toHaveBeenCalled();
                expect(platforms.getPlatformApi.calls.count()).toEqual(1);
                return removePlugin(pluginId);
            }).then(function () {
                expect(platforms.getPlatformApi.calls.count()).toEqual(2);
            }).fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 004 : should successfully add a plugin using relative path when running from subdir inside of project', function (done) {
        // Copy plugin to subdir inside of the project. This is required since path.relative
        // returns an absolute path when source and dest are on different drives
        var plugindir = path.join(project, 'custom-plugins/some-plugin-inside-subfolder');
        shell.mkdir('-p', plugindir);
        shell.cp('-r', path.join(pluginsDir, 'fake1/*'), plugindir);

        // Create a subdir, where we're going to run cordova from
        var subdir = path.join(project, 'bin');
        shell.mkdir('-p', subdir);
        shell.cd(subdir);

        // Add plugin using relative path
        addPlugin(path.relative(subdir, plugindir), pluginId, {}, done)
            .then(function () {
                return removePlugin(pluginId);
            })
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 005 : should respect preference default values', function (done) {
        var plugin_util = require('../src/cordova/plugin/util');
        spyOn(plugin_util, 'mergeVariables').and.returnValue({ REQUIRED: 'NO', REQUIRED_ANDROID: 'NO' });
        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'NO', REQUIRED_ANDROID: 'NO' }}, done)
            .then(function () {
                var platformJsonPath = path.join(project, 'plugins', helpers.testPlatform + '.json');
                var installed_plugins = require(platformJsonPath).installed_plugins;
                var defaultPluginPreferences = installed_plugins[org_test_defaultvariables];
                expect(defaultPluginPreferences).toBeDefined();
                expect(defaultPluginPreferences.DEFAULT).toBe('yes');
                expect(defaultPluginPreferences.DEFAULT_ANDROID).toBe('yes');
                expect(defaultPluginPreferences.REQUIRED_ANDROID).toBe('NO');
                expect(defaultPluginPreferences.REQUIRED).toBe('NO');
                return removePlugin(org_test_defaultvariables);
            })
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 006 : should successfully add a plugin when specifying CLI variables', function (done) {
        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'yes', REQUIRED_ANDROID: 'yes' }}, done)
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 007 : should not check npm info when using the searchpath flag', function (done) {
        mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
        spyOn(registry, 'info');
        return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir}, done)
            .then(function () {
                expect(registry.info).not.toHaveBeenCalled();
                var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
                expect(fetchOptions.searchpath[0]).toExist();
            })
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 008 : should not check npm info when using the noregistry flag', function (done) {
        mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));

        spyOn(registry, 'info');
        addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {noregistry: true}, done)
            .then(function () {
                expect(registry.info).not.toHaveBeenCalled();

                var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
                expect(fetchOptions.noregistry).toBeTruthy();
            })
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 009 : should not check npm info when fetching from a Git repository', function (done) {
        spyOn(registry, 'info');
        addPlugin(testGitPluginRepository, testGitPluginId, {}, done)
            .then(function () {
                expect(registry.info).not.toHaveBeenCalled();
            })
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 010 : should select the plugin version based on npm info when fetching from npm', function (done) {
        mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));

        spyOn(registry, 'info').and.callThrough();
        addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {'fetch': true}, done)
            .then(function () {
                expect(registry.info).toHaveBeenCalled();

                var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
                expect(fetchTarget).toEqual(npmInfoTestPlugin + '@' + npmInfoTestPluginVersion);
            })
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 011 : should handle scoped npm packages', function (done) {
        var scopedPackage = '@testscope/' + npmInfoTestPlugin;
        mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));

        spyOn(registry, 'info').and.returnValue(Q({}));
        addPlugin(scopedPackage, npmInfoTestPlugin, {}, done)
            .then(function () {
                // Check to make sure that we are at least trying to get the correct package.
                // This package is not published to npm, so we can't truly do end-to-end tests

                expect(registry.info).toHaveBeenCalledWith([scopedPackage]);

                var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
                expect(fetchTarget).toEqual(scopedPackage);
            })
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);

    it('Test 012 : should handle scoped npm packages with given version tags', function (done) {
        var scopedPackage = '@testscope/' + npmInfoTestPlugin + '@latest';
        mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));

        spyOn(registry, 'info');
        addPlugin(scopedPackage, npmInfoTestPlugin, {}, done)
            .then(function () {
                expect(registry.info).not.toHaveBeenCalled();

                var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
                expect(fetchTarget).toEqual(scopedPackage);
            })
            .fail(function (err) {
                expect(err).toBeUndefined();
            })
            .fin(done);
    }, 30000);
});


text:
"use strict";
/* jshint newcap:false */

var complain = "MARKO_DEBUG" && require("complain");

var domInsert = require("../dom-insert");
var defaultCreateOut = require("../createOut");
var getComponentsContext =
  require("./ComponentsContext").___getComponentsContext;
var componentsUtil = require("./util");
var componentLookup = componentsUtil.___componentLookup;
var destroyNodeRecursive = componentsUtil.___destroyNodeRecursive;
var EventEmitter = require("events-light");
var RenderResult = require("../RenderResult");
var SubscriptionTracker = require("listener-tracker");
var inherit = require("raptor-util/inherit");
var updateManager = require("./update-manager");
var morphdom = require("../vdom/morphdom");
var eventDelegation = require("./event-delegation");
var domData = require("./dom-data");
var componentsByDOMNode = domData.___componentByDOMNode;
var keyedElementsByComponentId = domData.___ssrKeyedElementsByComponentId;
var CONTEXT_KEY = "__subtree_context__";

var hasOwnProperty = Object.prototype.hasOwnProperty;
var slice = Array.prototype.slice;

var COMPONENT_SUBSCRIBE_TO_OPTIONS;
var NON_COMPONENT_SUBSCRIBE_TO_OPTIONS = {
  addDestroyListener: false
};

var emit = EventEmitter.prototype.emit;
var ELEMENT_NODE = 1;

function removeListener(removeEventListenerHandle) {
  removeEventListenerHandle();
}

function walkFragments(fragment) {
  var node;

  while (fragment) {
    node = fragment.firstChild;

    if (!node) {
      break;
    }

    fragment = node.fragment;
  }

  return node;
}

function handleCustomEventWithMethodListener(
  component,
  targetMethodName,
  args,
  extraArgs
) {
  // Remove the "eventType" argument
  args.push(component);

  if (extraArgs) {
    args = extraArgs.concat(args);
  }

  var targetComponent = componentLookup[component.___scope];
  var targetMethod =
    typeof targetMethodName === "function"
      ? targetMethodName
      : targetComponent[targetMethodName];
  if (!targetMethod) {
    throw Error("Method not found: " + targetMethodName);
  }

  targetMethod.apply(targetComponent, args);
}

function resolveKeyHelper(key, index) {
  return index ? key + "_" + index : key;
}

function resolveComponentIdHelper(component, key, index) {
  return component.id + "-" + resolveKeyHelper(key, index);
}

/**
 * This method is used to process "update_<stateName>" handler functions.
 * If all of the modified state properties have a user provided update handler
 * then a rerender will be bypassed and, instead, the DOM will be updated
 * looping over and invoking the custom update handlers.
 * @return {boolean} Returns true if if the DOM was updated. False, otherwise.
 */
function processUpdateHandlers(component, stateChanges, oldState) {
  var handlerMethod;
  var handlers;

  for (var propName in stateChanges) {
    if (hasOwnProperty.call(stateChanges, propName)) {
      var handlerMethodName = "update_" + propName;

      handlerMethod = component[handlerMethodName];
      if (handlerMethod) {
        (handlers || (handlers = [])).push([propName, handlerMethod]);
      } else {
        // This state change does not have a state handler so return false
        // to force a rerender
        return;
      }
    }
  }

  // If we got here then all of the changed state properties have
  // an update handler or there are no state properties that actually
  // changed.
  if (handlers) {
    // Otherwise, there are handlers for all of the changed properties
    // so apply the updates using those handlers

    handlers.forEach(function (handler) {
      var propertyName = handler[0];
      handlerMethod = handler[1];

      var newValue = stateChanges[propertyName];
      var oldValue = oldState[propertyName];
      handlerMethod.call(component, newValue, oldValue);
    });

    component.___emitUpdate();
    component.___reset();
  }

  return true;
}

function checkInputChanged(existingComponent, oldInput, newInput) {
  if (oldInput != newInput) {
    if (oldInput == null || newInput == null) {
      return true;
    }

    var oldKeys = Object.keys(oldInput);
    var newKeys = Object.keys(newInput);
    var len = oldKeys.length;
    if (len !== newKeys.length) {
      return true;
    }

    for (var i = len; i--; ) {
      var key = oldKeys[i];
      if (!(key in newInput && oldInput[key] === newInput[key])) {
        return true;
      }
    }
  }

  return false;
}

var componentProto;

/**
 * Base component type.
 *
 * NOTE: Any methods that are prefixed with an underscore should be considered private!
 */
function Component(id) {
  EventEmitter.call(this);
  this.id = id;
  this.___state = null;
  this.___rootNode = null;
  this.___subscriptions = null;
  this.___domEventListenerHandles = null;
  this.___bubblingDomEvents = null; // Used to keep track of bubbling DOM events for components rendered on the server
  this.___customEvents = null;
  this.___scope = null;
  this.___renderInput = null;
  this.___input = undefined;
  this.___mounted = false;
  this.___global = undefined;
  this.___destroyed = false;
  this.___updateQueued = false;
  this.___dirty = false;
  this.___settingInput = false;
  this.___host = undefined;

  var ssrKeyedElements = keyedElementsByComponentId[id];

  if (ssrKeyedElements) {
    this.___keyedElements = ssrKeyedElements;
    delete keyedElementsByComponentId[id];
  } else {
    this.___keyedElements = {};
  }
}

Component.prototype = componentProto = {
  ___isComponent: true,

  subscribeTo: function (target) {
    if (!target) {
      throw TypeError();
    }

    var subscriptions =
      this.___subscriptions ||
      (this.___subscriptions = new SubscriptionTracker());

    var subscribeToOptions = target.___isComponent
      ? COMPONENT_SUBSCRIBE_TO_OPTIONS
      : NON_COMPONENT_SUBSCRIBE_TO_OPTIONS;

    return subscriptions.subscribeTo(target, subscribeToOptions);
  },

  emit: function (eventType) {
    var customEvents = this.___customEvents;
    var target;

    if (customEvents && (target = customEvents[eventType])) {
      var targetMethodName = target[0];
      var isOnce = target[1];
      var extraArgs = target[2];
      var args = slice.call(arguments, 1);

      handleCustomEventWithMethodListener(
        this,
        targetMethodName,
        args,
        extraArgs
      );

      if (isOnce) {
        delete customEvents[eventType];
      }
    }

    return emit.apply(this, arguments);
  },
  getElId: function (key, index) {
    if (!key) {
      return this.id;
    }
    return resolveComponentIdHelper(this, key, index);
  },
  getEl: function (key, index) {
    if (key) {
      var keyedElement =
        this.___keyedElements["@" + resolveKeyHelper(key, index)];

      // eslint-disable-next-line no-constant-condition
      if ("MARKO_DEBUG") {
        if (
          keyedElement &&
          keyedElement.nodeType !== 1 /* Node.ELEMENT_NODE */
        ) {
          throw new Error(
            "Using 'getEl(key)' to get a component instance is not supported, did you mean 'getComponent(key)'?"
          );
        }
      }

      return keyedElement;
    } else {
      return this.el;
    }
  },
  getEls: function (key) {
    key = key + "[]";

    var els = [];
    var i = 0;
    var el;
    while ((el = this.getEl(key, i))) {
      els.push(el);
      i++;
    }
    return els;
  },
  getComponent: function (key, index) {
    var rootNode = this.___keyedElements["@" + resolveKeyHelper(key, index)];
    // eslint-disable-next-line no-constant-condition
    if ("MARKO_DEBUG") {
      if (/\[\]$/.test(key)) {
        throw new Error(
          "A repeated key[] was passed to getComponent. Use a non-repeating key if there is only one of these components."
        );
      }
    }

    return rootNode && componentsByDOMNode.get(rootNode);
  },
  getComponents: function (key) {
    var lookup = this.___keyedElements["@" + key + "[]"];
    return lookup
      ? Object.keys(lookup)
          .map(function (key) {
            return componentsByDOMNode.get(lookup[key]);
          })
          .filter(Boolean)
      : [];
  },
  destroy: function () {
    if (this.___destroyed) {
      return;
    }

    var root = this.___rootNode;

    this.___destroyShallow();

    var nodes = root.nodes;

    nodes.forEach(function (node) {
      destroyNodeRecursive(node);

      if (eventDelegation.___handleNodeDetach(node) !== false) {
        node.parentNode.removeChild(node);
      }
    });

    root.detached = true;

    delete componentLookup[this.id];
    this.___keyedElements = {};
  },

  ___destroyShallow: function () {
    if (this.___destroyed) {
      return;
    }

    this.___emitDestroy();
    this.___destroyed = true;

    componentsByDOMNode.set(this.___rootNode, undefined);

    this.___rootNode = null;

    // Unsubscribe from all DOM events
    this.___removeDOMEventListeners();

    var subscriptions = this.___subscriptions;
    if (subscriptions) {
      subscriptions.removeAllListeners();
      this.___subscriptions = null;
    }
  },

  isDestroyed: function () {
    return this.___destroyed;
  },
  get state() {
    return this.___state;
  },
  set state(newState) {
    var state = this.___state;
    if (!state && !newState) {
      return;
    }

    if (!state) {
      state = this.___state = new this.___State(this);
    }

    state.___replace(newState || {});

    if (state.___dirty) {
      this.___queueUpdate();
    }

    if (!newState) {
      this.___state = null;
    }
  },
  setState: function (name, value) {
    var state = this.___state;

    if (!state) {
      state = this.___state = new this.___State(this);
    }
    if (typeof name == "object") {
      // Merge in the new state with the old state
      var newState = name;
      for (var k in newState) {
        if (hasOwnProperty.call(newState, k)) {
          state.___set(k, newState[k], true /* ensure:true */);
        }
      }
    } else {
      state.___set(name, value, true /* ensure:true */);
    }
  },

  setStateDirty: function (name, value) {
    var state = this.___state;

    if (arguments.length == 1) {
      value = state[name];
    }

    state.___set(
      name,
      value,
      true /* ensure:true */,
      true /* forceDirty:true */
    );
  },

  replaceState: function (newState) {
    this.___state.___replace(newState);
  },

  get input() {
    return this.___input;
  },
  set input(newInput) {
    if (this.___settingInput) {
      this.___input = newInput;
    } else {
      this.___setInput(newInput);
    }
  },

  ___setInput: function (newInput, onInput, out) {
    onInput = onInput || this.onInput;
    var updatedInput;

    var oldInput = this.___input;
    this.___input = undefined;
    this.___context = (out && out[CONTEXT_KEY]) || this.___context;

    if (onInput) {
      // We need to set a flag to preview `this.input = foo` inside
      // onInput causing infinite recursion
      this.___settingInput = true;
      updatedInput = onInput.call(this, newInput || {}, out);
      this.___settingInput = false;
    }

    newInput = this.___renderInput = updatedInput || newInput;

    if ((this.___dirty = checkInputChanged(this, oldInput, newInput))) {
      this.___queueUpdate();
    }

    if (this.___input === undefined) {
      this.___input = newInput;
      if (newInput && newInput.$global) {
        this.___global = newInput.$global;
      }
    }

    return newInput;
  },

  forceUpdate: function () {
    this.___dirty = true;
    this.___queueUpdate();
  },

  ___queueUpdate: function () {
    if (!this.___updateQueued) {
      this.___updateQueued = true;
      updateManager.___queueComponentUpdate(this);
    }
  },

  update: function () {
    if (this.___destroyed === true || this.___isDirty === false) {
      return;
    }

    var input = this.___input;
    var state = this.___state;

    if (this.___dirty === false && state !== null && state.___dirty === true) {
      if (processUpdateHandlers(this, state.___changes, state.___old, state)) {
        state.___dirty = false;
      }
    }

    if (this.___isDirty === true) {
      // The UI component is still dirty after process state handlers
      // then we should rerender

      if (this.shouldUpdate(input, state) !== false) {
        this.___scheduleRerender();
      }
    }

    this.___reset();
  },

  get ___isDirty() {
    return (
      this.___dirty === true ||
      (this.___state !== null && this.___state.___dirty === true)
    );
  },

  ___reset: function () {
    this.___dirty = false;
    this.___updateQueued = false;
    this.___renderInput = null;
    var state = this.___state;
    if (state) {
      state.___reset();
    }
  },

  shouldUpdate: function () {
    return true;
  },

  ___scheduleRerender: function () {
    var self = this;
    var renderer = self.___renderer;

    if (!renderer) {
      throw TypeError();
    }

    var input = this.___renderInput || this.___input;

    updateManager.___batchUpdate(function () {
      self.___rerender(input, false).afterInsert(self.___host);
    });

    this.___reset();
  },

  ___rerender: function (input, isHydrate) {
    var host = this.___host;
    var globalData = this.___global;
    var rootNode = this.___rootNode;
    var renderer = this.___renderer;
    var createOut = renderer.createOut || defaultCreateOut;
    var out = createOut(globalData);
    out.sync();
    out.___host = this.___host;
    out[CONTEXT_KEY] = this.___context;

    var componentsContext = getComponentsContext(out);
    var globalComponentsContext = componentsContext.___globalContext;
    globalComponentsContext.___rerenderComponent = this;
    globalComponentsContext.___isHydrate = isHydrate;

    renderer(input, out);

    var result = new RenderResult(out);

    var targetNode = out.___getOutput().___firstChild;

    morphdom(rootNode, targetNode, host, componentsContext);

    return result;
  },

  ___detach: function () {
    var root = this.___rootNode;
    root.remove();
    return root;
  },

  ___removeDOMEventListeners: function () {
    var eventListenerHandles = this.___domEventListenerHandles;
    if (eventListenerHandles) {
      eventListenerHandles.forEach(removeListener);
      this.___domEventListenerHandles = null;
    }
  },

  get ___rawState() {
    var state = this.___state;
    return state && state.___raw;
  },

  ___setCustomEvents: function (customEvents, scope) {
    var finalCustomEvents = (this.___customEvents = {});
    this.___scope = scope;

    customEvents.forEach(function (customEvent) {
      var eventType = customEvent[0];
      var targetMethodName = customEvent[1];
      var isOnce = customEvent[2];
      var extraArgs = customEvent[3];

      if (targetMethodName) {
        finalCustomEvents[eventType] = [targetMethodName, isOnce, extraArgs];
      }
    });
  },

  get el() {
    return walkFragments(this.___rootNode);
  },

  get els() {
    // eslint-disable-next-line no-constant-condition
    if ("MARKO_DEBUG") {
      complain(
        'The "this.els" attribute is deprecated. Please use "this.getEls(key)" instead.'
      );
    }
    return (this.___rootNode ? this.___rootNode.nodes : []).filter(function (
      el
    ) {
      return el.nodeType === ELEMENT_NODE;
    });
  },

  ___emit: emit,
  ___emitCreate(input, out) {
    this.onCreate && this.onCreate(input, out);
    this.___emit("create", input, out);
  },

  ___emitRender(out) {
    this.onRender && this.onRender(out);
    this.___emit("render", out);
  },

  ___emitUpdate() {
    this.onUpdate && this.onUpdate();
    this.___emit("update");
  },

  ___emitMount() {
    this.onMount && this.onMount();
    this.___emit("mount");
  },

  ___emitDestroy() {
    this.onDestroy && this.onDestroy();
    this.___emit("destroy");
  }
};

componentProto.elId = componentProto.getElId;
componentProto.___update = componentProto.update;
componentProto.___destroy = componentProto.destroy;

// Add all of the following DOM methods to Component.prototype:
// - appendTo(referenceEl)
// - replace(referenceEl)
// - replaceChildrenOf(referenceEl)
// - insertBefore(referenceEl)
// - insertAfter(referenceEl)
// - prependTo(referenceEl)
domInsert(
  componentProto,
  function getEl(component) {
    return component.___detach();
  },
  function afterInsert(component) {
    return component;
  }
);

inherit(Component, EventEmitter);

module.exports = Component;


text:
void CForceMoveTask::disableMouse()
{
	RECT rect{ 1, 1, 3, 3 };
	::ClipCursor(&rect);
}

void CForceMoveTask::enableMouse()
{
	::ClipCursor(nullptr);
}

void CForceMoveTask::moveAbsolute(const xyls::Point& point, int32_t sleepTime)
{
	RECT rect;
	rect.left = point.x() - 1;
	rect.top = point.y() - 1;
	rect.right = point.x() + 1;
	rect.bottom = point.y() + 1;
	::ClipCursor(&rect);
	CMouse::MoveAbsolute(point, sleepTime);
}


text:
package followheart.factory;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.TabHost.TabContentFactory;
//tab¹¤³§Àà
public class MyTabFactory implements TabContentFactory {

    private final Context mContext;

    public MyTabFactory(Context context) {
        mContext = context;
    }

    public View createTabContent(String tag) {
    	Log.d("aaaabbbbb", "....");
        View v = new View(mContext);
        v.setMinimumWidth(0);
        v.setMinimumHeight(0);
        Log.d("bbbssss", "rrrr");
        return v;
    }
}


text: Hamartic Hexagram


text:
namespace TSnap {

/////////////////////////////////////////////////
// BFS and DFS
/// Returns a directed Breadth-First-Search tree rooted at StartNId. ##GetBfsTree1
template <class PGraph> PNGraph GetBfsTree(const PGraph& Graph, const int& StartNId, const bool& FollowOut, const bool& FollowIn);
/// Returns the BFS tree size (number of nodes) and depth (number of levels) by following in-links (parameter FollowIn = true) and/or out-links (parameter FollowOut = true) of node StartNId.
template <class PGraph> int GetSubTreeSz(const PGraph& Graph, const int& StartNId, const bool& FollowOut, const bool& FollowIn, int& TreeSzX, int& TreeDepthX);
/// Finds IDs of all nodes that are at distance Hop from node StartNId. ##GetSubTreeSz
template <class PGraph> int GetNodesAtHop(const PGraph& Graph, const int& StartNId, const int& Hop, TIntV& NIdV, const bool& IsDir=false);
/// Returns the number of nodes at each hop distance from the starting node StartNId. ##GetNodesAtHops
template <class PGraph> int GetNodesAtHops(const PGraph& Graph, const int& StartNId, TIntPrV& HopCntV, const bool& IsDir=false);

/////////////////////////////////////////////////
// Shortest paths
/// Returns the length of the shortest path from node SrcNId to node DstNId. ##GetShortPath1
template <class PGraph> int GetShortPath(const PGraph& Graph, const int& SrcNId, const int& DstNId, const bool& IsDir=false);
/// Returns the length of the shortest path from node SrcNId to all other nodes in the network. ##GetShortPath2
template <class PGraph> int GetShortPath(const PGraph& Graph, const int& SrcNId, TIntH& NIdToDistH, const bool& IsDir=false, const int& MaxDist=TInt::Mx);

/////////////////////////////////////////////////
// Diameter

/// Returns the (approximation of the) Diameter (maximum shortest path length) of a graph (by performing BFS from NTestNodes random starting nodes). ##GetBfsFullDiam
template <class PGraph> int GetBfsFullDiam(const PGraph& Graph, const int& NTestNodes, const bool& IsDir=false);
/// Returns the (approximation of the) Effective Diameter (90-th percentile of the distribution of shortest path lengths) of a graph (by performing BFS from NTestNodes random starting nodes). ##GetBfsEffDiam1
template <class PGraph> double GetBfsEffDiam(const PGraph& Graph, const int& NTestNodes, const bool& IsDir=false);
/// Returns the (approximation of the) Effective Diameter and the Diameter of a graph (by performing BFS from NTestNodes random starting nodes). ##GetBfsEffDiam2
template <class PGraph> double GetBfsEffDiam(const PGraph& Graph, const int& NTestNodes, const bool& IsDir, double& EffDiamX, int& FullDiamX);
/// Returns the (approximation of the) Effective Diameter, the Diameter and the Average Shortest Path length in a graph (by performing BFS from NTestNodes random starting nodes). GetBfsEffDiam3
template <class PGraph> double GetBfsEffDiam(const PGraph& Graph, const int& NTestNodes, const bool& IsDir, double& EffDiamX, int& FullDiamX, double& AvgSPLX);
/// Use the whole graph (all edges) to measure the shortest path lengths but only report the path lengths between nodes in the SubGraphNIdV. GetBfsEffDiam4
template <class PGraph> double GetBfsEffDiam(const PGraph& Graph, const int& NTestNodes, const TIntV& SubGraphNIdV, const bool& IsDir, double& EffDiamX, int& FullDiamX);

// TODO: Implement in the future
//template <class PGraph> int GetRangeDist(const PGraph& Graph, const int& SrcNId, const int& DstNId, const bool& IsDir=false);
//template <class PGraph> int GetShortPath(const PGraph& Graph, const int& SrcNId, TIntH& NIdToDistH, const bool& IsDir=false, const int& MaxDist=1000);
//template <class PGraph> int GetShortPath(const PGraph& Graph, const int& SrcNId, const TIntSet& TargetSet, const bool& IsDir, TIntV& PathNIdV);
//template <class PGraph> int GetShortPath(TIntH& NIdPrnH, TCcQueue<int>& NIdQ, const PGraph& Graph, const int& SrcNId, const TIntSet& TargetSet, const bool& IsDir, TIntV& PathNIdV);
//template <class PGraph> int GetMxShortDist(const PGraph& Graph, const int& SrcNId, const bool& IsDir=false);
//template <class PGraph> int GetMxShortDist(const PGraph& Graph, const int& SrcNId, const bool& IsDir, int& MxDistNId);
//template <class PGraph> int GetMxShortDist(const PGraph& Graph, const int& SrcNId, const bool& IsDir, int& MxDistNId, TCcQueue<int>& NIdQ, TCcQueue<int>& DistQ, TIntSet& VisitedH);
//template <class PGraph> int GetMxGreedyDist(const PGraph& Graph, const int& SrcNId, const bool& IsDir=false);
//template <class PGraph> int GetMxGreedyDist(const PGraph& Graph, const int& SrcNId, const bool& IsDir, TCcQueue<int>& NIdQ, TCcQueue<int>& DistQ, TIntSet& VisitedH);
//template <class PGraph> PNGraph GetShortPathsSubGraph(const PGraph& Graph, const TIntV& SubGraphNIdV);
//template <class PGraph> PGraph GetWccPathsSubGraph(const PGraph& Graph, const TIntV& NIdV);
//template <class PGraph> void GetSubTreeSz(const PGraph& Graph, const int& StartNId, const bool& FollowOutEdges, int& TreeSz, int& TreeDepth);

} // namespace TSnap

//#//////////////////////////////////////////////
/// Breath-First-Search class.
/// The class is meant for executing many BFSs over a fixed graph. This means that the class can keep the hash tables and queues initialized between different calls of the DoBfs() function.
template<class PGraph>
class TBreathFS {
public:
  PGraph Graph;
  TSnapQueue<int> Queue;
  TInt StartNId;
  TIntH NIdDistH;
public:
  TBreathFS(const PGraph& GraphPt, const bool& InitBigQ=true) :
    Graph(GraphPt), Queue(InitBigQ?Graph->GetNodes():1024), NIdDistH(InitBigQ?Graph->GetNodes():1024) { }
  /// Sets the graph to be used by the BFS to GraphPt and resets the data structures.
  void SetGraph(const PGraph& GraphPt);
  /// Performs BFS from node id StartNode for at maps MxDist steps by only following in-links (parameter FollowIn = true) and/or out-links (parameter FollowOut = true).
  int DoBfs(const int& StartNode, const bool& FollowOut, const bool& FollowIn, const int& TargetNId=-1, const int& MxDist=TInt::Mx);
  /// Returns the number of nodes visited/reached by the BFS.
  int GetNVisited() const { return NIdDistH.Len(); }
  /// Returns the IDs of the nodes visited/reached by the BFS.
  void GetVisitedNIdV(TIntV& NIdV) const { NIdDistH.GetKeyV(NIdV); }
  /// Returns the shortst path distance between SrcNId and DistNId.
  /// Note you have to first call DoBFs(). SrcNId must be equal to StartNode, otherwise return value is -1.
  int GetHops(const int& SrcNId, const int& DstNId) const;
  /// Returns a random shortest path from SrcNId to DstNId.
  /// Note you have to first call DoBFs(). SrcNId must be equal to StartNode, otherwise return value is -1.
  int GetRndPath(const int& SrcNId, const int& DstNId, TIntV& PathNIdV) const;
};

template<class PGraph>
void TBreathFS<PGraph>::SetGraph(const PGraph& GraphPt) {
  Graph=GraphPt;
  const int N=GraphPt->GetNodes();
  if (Queue.Reserved() < N) { Queue.Gen(N); }
  if (NIdDistH.GetReservedKeyIds() < N) { NIdDistH.Gen(N); }
}

template<class PGraph>
int TBreathFS<PGraph>::DoBfs(const int& StartNode, const bool& FollowOut, const bool& FollowIn, const int& TargetNId, const int& MxDist) {
  StartNId = StartNode;
  IAssert(Graph->IsNode(StartNId));
//  const typename PGraph::TObj::TNodeI StartNodeI = Graph->GetNI(StartNode);
//  IAssertR(StartNodeI.GetOutDeg() > 0, TStr::Fmt("No neighbors from start node %d.", StartNode));
  NIdDistH.Clr(false);  NIdDistH.AddDat(StartNId, 0);
  Queue.Clr(false);  Queue.Push(StartNId);
  int v, MaxDist = 0;
  while (! Queue.Empty()) {
    const int NId = Queue.Top();  Queue.Pop();
    const int Dist = NIdDistH.GetDat(NId);
    if (Dist == MxDist) { break; } // max distance limit reached
    const typename PGraph::TObj::TNodeI NodeI = Graph->GetNI(NId);
    if (FollowOut) { // out-links
      for (v = 0; v < NodeI.GetOutDeg(); v++) {  // out-links
        const int DstNId = NodeI.GetOutNId(v);
        if (! NIdDistH.IsKey(DstNId)) {
          NIdDistH.AddDat(DstNId, Dist+1);
          MaxDist = TMath::Mx(MaxDist, Dist+1);
          if (DstNId == TargetNId) { return MaxDist; }
          Queue.Push(DstNId);
        }
      }
    }
    if (FollowIn) { // in-links
      for (v = 0; v < NodeI.GetInDeg(); v++) {
        const int DstNId = NodeI.GetInNId(v);
        if (! NIdDistH.IsKey(DstNId)) {
          NIdDistH.AddDat(DstNId, Dist+1);
          MaxDist = TMath::Mx(MaxDist, Dist+1);
          if (DstNId == TargetNId) { return MaxDist; }
          Queue.Push(DstNId);
        }
      }
    }
  }
  return MaxDist;
}

template<class PGraph>
int TBreathFS<PGraph>::GetHops(const int& SrcNId, const int& DstNId) const {
  TInt Dist;
  if (SrcNId!=StartNId) { return -1; }
  if (! NIdDistH.IsKeyGetDat(DstNId, Dist)) { return -1; }
  return Dist.Val;
}

template<class PGraph>
int TBreathFS<PGraph>::GetRndPath(const int& SrcNId, const int& DstNId, TIntV& PathNIdV) const {
  PathNIdV.Clr(false);
  if (SrcNId!=StartNId || ! NIdDistH.IsKey(DstNId)) { return -1; }
  PathNIdV.Add(DstNId);
  TIntV CloserNIdV;
  int CurNId = DstNId;
  TInt CurDist, NextDist;
  while (CurNId != SrcNId) {
    typename PGraph::TObj::TNodeI NI = Graph->GetNI(CurNId);
    IAssert(NIdDistH.IsKeyGetDat(CurNId, CurDist));
    CloserNIdV.Clr(false);
    for (int e = 0; e < NI.GetDeg(); e++) {
      const int Next = NI.GetNbrNId(e);
      if (NIdDistH.IsKeyGetDat(Next, NextDist)) {
        if (NextDist == CurDist-1) { CloserNIdV.Add(Next); }
      }
    }
    IAssert(! CloserNIdV.Empty());
    CurNId = CloserNIdV[TInt::Rnd.GetUniDevInt(CloserNIdV.Len())];
    PathNIdV.Add(CurNId);
  }
  PathNIdV.Reverse();
  return PathNIdV.Len()-1;
}

/////////////////////////////////////////////////
// Implementation
namespace TSnap {

template <class PGraph>
PNGraph GetBfsTree(const PGraph& Graph, const int& StartNId, const bool& FollowOut, const bool& FollowIn) {
  TBreathFS<PGraph> BFS(Graph, false);
  BFS.DoBfs(StartNId, FollowOut, FollowIn, -1, TInt::Mx);
  PNGraph Tree = TNGraph::New();
  BFS.NIdDistH.SortByDat();
  for (int i = 0; i < BFS.NIdDistH.Len(); i++) {
    const int NId = BFS.NIdDistH.GetKey(i);
    const int Dist = BFS.NIdDistH[i];
    typename PGraph::TObj::TNodeI NI = Graph->GetNI(NId);
    if (!Tree->IsNode(NId)) {
      Tree->AddNode(NId);
    }
    if (FollowOut) {
      for (int e = 0; e < NI.GetInDeg(); e++) {
        const int Prev = NI.GetInNId(e);
        if (Tree->IsNode(Prev) && BFS.NIdDistH.GetDat(Prev)==Dist-1) {
          Tree->AddEdge(Prev, NId); }
      }
    }
    if (FollowIn) {
      for (int e = 0; e < NI.GetOutDeg(); e++) {
        const int Prev = NI.GetOutNId(e);
        if (Tree->IsNode(Prev) && BFS.NIdDistH.GetDat(Prev)==Dist-1) {
          Tree->AddEdge(Prev, NId); }
      }
    }
  }
  return Tree;
}

template <class PGraph>
int GetSubTreeSz(const PGraph& Graph, const int& StartNId, const bool& FollowOut, const bool& FollowIn, int& TreeSz, int& TreeDepth) {
  TBreathFS<PGraph> BFS(Graph);
  BFS.DoBfs(StartNId, FollowOut, FollowIn, -1, TInt::Mx);
  TreeSz = BFS.NIdDistH.Len();
  TreeDepth = 0;
  for (int i = 0; i < BFS.NIdDistH.Len(); i++) {
    TreeDepth = TMath::Mx(TreeDepth, BFS.NIdDistH[i].Val);
  }
  return TreeSz;
}

template <class PGraph>
int GetNodesAtHop(const PGraph& Graph, const int& StartNId, const int& Hop, TIntV& NIdV, const bool& IsDir) {
  TBreathFS<PGraph> BFS(Graph);
  BFS.DoBfs(StartNId, true, !IsDir, -1, Hop);
  NIdV.Clr(false);
  for (int i = 0; i < BFS.NIdDistH.Len(); i++) {
    if (BFS.NIdDistH[i] == Hop) {
      NIdV.Add(BFS.NIdDistH.GetKey(i)); }
  }
  return NIdV.Len();
}

template <class PGraph>
int GetNodesAtHops(const PGraph& Graph, const int& StartNId, TIntPrV& HopCntV, const bool& IsDir) {
  TBreathFS<PGraph> BFS(Graph);
  BFS.DoBfs(StartNId, true, !IsDir, -1, TInt::Mx);
  TIntH HopCntH;
  for (int i = 0; i < BFS.NIdDistH.Len(); i++) {
    HopCntH.AddDat(BFS.NIdDistH[i]) += 1;
  }
  HopCntH.GetKeyDatPrV(HopCntV);
  HopCntV.Sort();
  return HopCntV.Len();
}

template <class PGraph>
int GetShortPath(const PGraph& Graph, const int& SrcNId, TIntH& NIdToDistH, const bool& IsDir, const int& MaxDist) {
  TBreathFS<PGraph> BFS(Graph);
  BFS.DoBfs(SrcNId, true, ! IsDir, -1, MaxDist);
  NIdToDistH.Clr();
  NIdToDistH.Swap(BFS.NIdDistH);
  return NIdToDistH[NIdToDistH.Len()-1];
}

template <class PGraph>
int GetShortPath(const PGraph& Graph, const int& SrcNId, const int& DstNId, const bool& IsDir) {
  TBreathFS<PGraph> BFS(Graph);
  BFS.DoBfs(SrcNId, true, ! IsDir, DstNId, TInt::Mx);
  return BFS.GetHops(SrcNId, DstNId);
}

template <class PGraph>
int GetBfsFullDiam(const PGraph& Graph, const int& NTestNodes, const bool& IsDir) {
  int FullDiam;
  double EffDiam;
  GetBfsEffDiam(Graph, NTestNodes, IsDir, EffDiam, FullDiam);
  return FullDiam;
}

template <class PGraph>
double GetBfsEffDiam(const PGraph& Graph, const int& NTestNodes, const bool& IsDir) {
  int FullDiam;
  double EffDiam;
  GetBfsEffDiam(Graph, NTestNodes, IsDir, EffDiam, FullDiam);
  return EffDiam;
}

template <class PGraph>
double GetBfsEffDiam(const PGraph& Graph, const int& NTestNodes, const bool& IsDir, double& EffDiam, int& FullDiam) {
  double AvgDiam;
  EffDiam = -1;  FullDiam = -1;
  return GetBfsEffDiam(Graph, NTestNodes, IsDir, EffDiam, FullDiam, AvgDiam);
}

template <class PGraph>
double GetBfsEffDiam(const PGraph& Graph, const int& NTestNodes, const bool& IsDir, double& EffDiam, int& FullDiam, double& AvgSPL) {
  EffDiam = -1;  FullDiam = -1;  AvgSPL = -1;
  TIntFltH DistToCntH;
  TBreathFS<PGraph> BFS(Graph);
  // shotest paths
  TIntV NodeIdV;
  Graph->GetNIdV(NodeIdV);  NodeIdV.Shuffle(TInt::Rnd);
  for (int tries = 0; tries < TMath::Mn(NTestNodes, Graph->GetNodes()); tries++) {
    const int NId = NodeIdV[tries];
    BFS.DoBfs(NId, true, ! IsDir, -1, TInt::Mx);
    for (int i = 0; i < BFS.NIdDistH.Len(); i++) {
      DistToCntH.AddDat(BFS.NIdDistH[i]) += 1; }
  }
  TIntFltKdV DistNbrsPdfV;
  double SumPathL=0, PathCnt=0;
  for (int i = 0; i < DistToCntH.Len(); i++) {
    DistNbrsPdfV.Add(TIntFltKd(DistToCntH.GetKey(i), DistToCntH[i]));
    SumPathL += DistToCntH.GetKey(i) * DistToCntH[i];
    PathCnt += DistToCntH[i];
  }
  DistNbrsPdfV.Sort();
  EffDiam = TSnap::TSnapDetail::CalcEffDiamPdf(DistNbrsPdfV, 0.9); // effective diameter (90-th percentile)
  FullDiam = DistNbrsPdfV.Last().Key;                // approximate full diameter (max shortest path length over the sampled nodes)
  AvgSPL = SumPathL/PathCnt;                        // average shortest path length
  return EffDiam;
}

template <class PGraph>
double GetBfsEffDiam(const PGraph& Graph, const int& NTestNodes, const TIntV& SubGraphNIdV, const bool& IsDir, double& EffDiam, int& FullDiam) {
  EffDiam = -1;
  FullDiam = -1;

  TIntFltH DistToCntH;
  TBreathFS<PGraph> BFS(Graph);
  // shotest paths
  TIntV NodeIdV(SubGraphNIdV);  NodeIdV.Shuffle(TInt::Rnd);
  TInt Dist;
  for (int tries = 0; tries < TMath::Mn(NTestNodes, SubGraphNIdV.Len()); tries++) {
    const int NId = NodeIdV[tries];
    BFS.DoBfs(NId, true, ! IsDir, -1, TInt::Mx);
    for (int i = 0; i < SubGraphNIdV.Len(); i++) {
      if (BFS.NIdDistH.IsKeyGetDat(SubGraphNIdV[i], Dist)) {
        DistToCntH.AddDat(Dist) += 1;
      }
    }
  }
  TIntFltKdV DistNbrsPdfV;
  for (int i = 0; i < DistToCntH.Len(); i++) {
    DistNbrsPdfV.Add(TIntFltKd(DistToCntH.GetKey(i), DistToCntH[i]));
  }
  DistNbrsPdfV.Sort();
  EffDiam = TSnap::TSnapDetail::CalcEffDiamPdf(DistNbrsPdfV, 0.9);  // effective diameter (90-th percentile)
  FullDiam = DistNbrsPdfV.Last().Key;                 // approximate full diameter (max shortest path length over the sampled nodes)
  return EffDiam;                                     // average shortest path length
}

} // namespace TSnap


text:
package com.github.rvesse.airline.utils.predicates;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.apache.commons.collections4.Predicate;

public abstract class AbstractAbbreviationFinder<T> implements Predicate<T> {

    private List<T> candidates = new ArrayList<T>();
    private T exact = null;

    public AbstractAbbreviationFinder(String value, Collection<T> items) {
        this.candidates.addAll(items);
        for (int i = 0; i < this.candidates.size(); i++) {
            T item = this.candidates.get(i);
            if (this.isExactNameMatch(value, item)) {
                this.exact = item;
                continue;
            }
            if (this.isPartialNameMatch(value, item))
                continue;
            this.candidates.remove(i);
            i--;
        }
    }

    protected abstract boolean isExactNameMatch(String value, T item);

    protected abstract boolean isPartialNameMatch(String value, T item);

    @Override
    public final boolean evaluate(T item) {
        return isExact(item) || isAbbreviation(item);
    }

    private boolean isExact(T item) {
        return this.exact != null && this.exact.equals(item);
    }

    private boolean isAbbreviation(T item) {
        return this.candidates.size() == 1 && this.candidates.contains(item);
    }
}


text:
'use strict';

import chalk = require('chalk');
import ansiStyles = require('ansi-styles');

import { StyleDefinition } from './style-definition';

export const pastel = {
  name: 'pastel',
  defaultOpen: ansiStyles.bold.open + ansiStyles.yellow.open,
  prompt: chalk.bold.cyan,
  normal: chalk.dim.white,
  banner: chalk.bold.yellow,
  hint: chalk.bold.yellow,
  gamemaster: chalk.dim.magenta,
  debug: chalk.dim.gray,
  error: chalk.dim.red,
  traversed: chalk.dim.cyan,
  visited: chalk.bold.white,
  unvisited: chalk.bold.yellow
} as StyleDefinition;


text:
sap.ui.define(function () {
   "use strict";

   var serviceUrl;
   var auth;

   function Service() {
      auth = "Token " + btoa(localStorage.getItem("userName") + ":" + localStorage.getItem("authToken"));
   }

   Service.prototype.init = function(_serviceUrl, data) {
      serviceUrl = _serviceUrl;
      if(data.useToken) {
         auth = "Token " + btoa(data.username + ":" + localStorage.getItem("authToken"));
      } else {
         auth = "Basic " + btoa(data.username + ":" + data.password);
      }

   };

   Service.prototype.ajax = function(request) {
      request.url = request.serviceUrl ?  request.serviceUrl : serviceUrl + request.path;
      request.dataType = request.dataType ? request.dataType : "json";
      request.contentType = request.contentType ? request.contentType : "application/json";
      var _auth = request.auth ? request.auth : auth;
      request.beforeSend = function(xhr) {
         xhr.setRequestHeader("Authorization", _auth);
         xhr.setRequestHeader("Accept", "application/json");
         // if (request.method == "POST") {
         //    xhr.setRequestHeader("X-HTTP-Method", "MERGE");
         // }
      };
      return $.ajax(request);
   };
   return new Service();
});


text:
<?php

namespace PHPExiftool\Driver\Tag\DICOM;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class LastScanRas extends AbstractTag
{

    protected $Id = '0019,101A';

    protected $Name = 'LastScanRas';

    protected $FullName = 'DICOM::Main';

    protected $GroupName = 'DICOM';

    protected $g0 = 'DICOM';

    protected $g1 = 'DICOM';

    protected $g2 = 'Image';

    protected $Type = '?';

    protected $Writable = false;

    protected $Description = 'Last Scan Ras';
}


text:
Vim "inner line" text object works on the text inside the line.
Leading and trailing whitespace is ignored.

### Text object

`_` (underscore) - "inner line"

### Examples

- `v_` visually selects all the text in a line, except the
  leading and trailing whitespace.

- `y_` yank "inner line".

- `d_` delete the whole line, but only "inner line" gets into the register.

### Why?

It's shorter to type than `^vg_` + operator.

### Installation

* Vundle

  `Plugin 'bruno-/vim-line'`

* Pathogen

  `git clone git://github.com/bruno-/vim-line.git ~/.vim/bundle/vim-line`

### License

[MIT](LICENSE.md)


text:
using System;
using System.Diagnostics;
using System.Text;
using System.Collections.Generic;
using NUnit.Framework;
using NUnit.Helper;
using System.Reflection;
using System.IO;
using System.Xml;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Controls;
using PdfSharp.Pdf;
using PdfSharp.Xps.UnitTests.Helpers;
using PdfSharp.Xps.XpsModel;
using PdfSharp.Xps.Rendering;
using IOPath = System.IO.Path;
using Path = System.IO.Path;

namespace PdfSharp.Xps.UnitTests.Typography
{
  using PdfSharp.Internal;

  /// <summary>
  /// Summary description for TestExample
  /// </summary>
  [GotoWorkDirectory]
  public class RenderingTypography : TestBase
  {

    public TestContext TestContext => TestContext.CurrentContext;

    [SetUp]
    public void TestInitialize()
    {
    }

    [TearDown]
    public void TestCleanup()
    {
    }

    public static IEnumerable<string> GetTypographySamplesFiles() => Directory.GetFiles(
      DirectoryPointHelper.Resolve("@testing/SampleXpsDocuments_1_0/MXDW"),
      "*Poster.xps"
    );

    [Test]
    [TestCaseSource(nameof(GetTypographySamplesFiles))]
    public void TestRenderingTypographySamples(string xpsFile)
    {
      using (XpsDocument xpsDoc = XpsDocument.OpenRead(xpsFile))
      {
        int docIndex = 1;
        foreach (FixedDocument doc in xpsDoc.Documents)
        {
          PdfDocument pdfDocument = new PdfDocument();
          //PdfRenderer renderer = new PdfRenderer();
          XpsConverter converter = new XpsConverter(pdfDocument, xpsDoc);

          int pageIndex = 0;
          foreach (FixedPage page in doc.Pages)
          {
            Debug.WriteLine(String.Format("  doc={0}, page={1}", docIndex, pageIndex));

            // HACK: API is senseless
            PdfPage pdfPage = converter.CreatePage(pageIndex);
            converter.RenderPage(pdfPage, pageIndex);
            pageIndex++;
          }

          var pdfFilename = IOPath.Combine(
            TestContext.WorkDirectory,
            $"{GetOutputPDFNameFor(xpsFile)}-{docIndex}.pdf"
          );

          pdfDocument.Save(pdfFilename);
          docIndex++;
        }
      }
    }
  }
}


text:
layout: page
title: Blue Software Trade Fair
date: 2016-05-24
author: Grace York
tags: weekly links, java
status: published
summary: Nam in efficitur risus. Duis fringilla tempus.
banner: images/banner/wedding.jpg
booking:
  startDate: 06/08/2016
  endDate: 06/09/2016
  ctyhocn: SFOCCHX
  groupCode: BSTF
published: true
---
Curabitur fringilla blandit urna ut accumsan. Duis luctus libero et arcu viverra congue. Etiam scelerisque gravida dignissim. Morbi vulputate est id leo luctus varius. Phasellus et tincidunt sapien. Aliquam venenatis scelerisque dolor tincidunt aliquet. Donec libero metus, tempor sed vestibulum vel, ullamcorper a mauris. Nulla at euismod risus. Fusce placerat aliquet enim ac pellentesque. Vestibulum et ex consequat, laoreet odio ultricies, vehicula augue. Sed fermentum auctor ex ac bibendum. In et risus eu tortor euismod lobortis. Ut a lectus metus.

1 Vivamus mattis sem a porta eleifend
1 Duis non quam efficitur lectus bibendum porta sit amet vitae ante
1 Duis pretium elit nec arcu rutrum, sed eleifend ante finibus.

In malesuada placerat nisi, quis euismod elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi ullamcorper, metus eleifend vehicula dictum, turpis elit tempor nibh, eget eleifend arcu massa sit amet leo. Phasellus ullamcorper sapien eget pretium tempor. Aenean turpis nibh, ullamcorper vitae posuere et, dignissim euismod justo. Nullam fermentum finibus sodales. Pellentesque sodales velit vitae luctus condimentum. Nullam ut vulputate elit.
Nullam turpis turpis, feugiat ac orci vel, fringilla suscipit felis. Nulla nunc tortor, imperdiet non diam vitae, lacinia commodo diam. Quisque a neque nec elit malesuada maximus. Nam euismod, nulla ac tincidunt consequat, tortor ex accumsan tortor, quis auctor lectus dui vitae sem. Nulla suscipit, ligula fermentum consequat euismod, neque ante varius ante, pellentesque varius arcu erat nec ex. Duis scelerisque eros eget mi dignissim sollicitudin eget in magna. Nam hendrerit nunc quis risus pellentesque, sit amet porta enim consectetur. Fusce viverra sed velit vel rutrum. Nunc consectetur ipsum volutpat leo tincidunt pretium. Aliquam nec erat suscipit, blandit lacus sed, consectetur odio.


text:
void frameDataManager::setup( string footageDir, string obmDir ){
	numFrames = 0;
    listDirs( footageDir,  obmDir);
}

void frameDataManager::listDirs( string footageDir, string obmDir){
	vector<string> dirs;
	listDirs(footageDir, obmDir);
}

void frameDataManager::listDirs( string footageDir, vector<string> obmDir, string mattes){

	heads.clear();
	leftEyes.clear();
	rightEyes.clear();

	int handleInFrames = 100;

	for(int i = 0; i < obmDir.size(); i++){

		//ignore handles except for the end
		int startOffset = (i == 0) ? 0 : handleInFrames;
		int endOffset   = (i == obmDir.size()-1) ? 0 : handleInFrames;

		//uncomment to RETAIN HANDLES
//		startOffset = 0;
//		endOffset   = 0;
//
		ofDirectory headsDir;
		headsDir.allowExt("obm");
		headsDir.listDir(obmDir[i] + "/head");
		for(int j = startOffset; j < headsDir.size()-endOffset; j++){
			heads.push_back(headsDir.getPath(j));
		}

		ofDirectory leftEyesDir;
		leftEyesDir.allowExt("obm");
		leftEyesDir.listDir(obmDir[i] + "/leftEye");
		for(int j = startOffset; j < leftEyesDir.size()-endOffset; j++){
			leftEyes.push_back(leftEyesDir.getPath(j));
		}

		ofDirectory rightEyesDir;
		rightEyesDir.listDir(obmDir[i] + "/rightEye");
		for(int j = startOffset; j < rightEyesDir.size()-endOffset; j++){
			rightEyes.push_back(rightEyesDir.getPath(j));
		}
	}

	ofDirectory videoDirectory(footageDir);
	videoDirectory.allowExt("png");
	videoDirectory.allowExt("jpg");
	videoDirectory.listDir();

	vector<int> shotSwitches;
	string curShot = "a";
	bool checkForCut = videoDirectory.getName(0).find(curShot) != string::npos;
	for(int i = 0; i < videoDirectory.size(); i++){

		videoImages.push_back(videoDirectory.getPath(i));

		//find the internal handle midpoints when the shots switch
		string shotFileName = videoDirectory.getName(i);

		if(checkForCut && shotFileName.find(curShot) == string::npos){
			shotSwitches.push_back(i);
			if(curShot == "a"){
				curShot = "b";
			}
			else if(curShot == "b"){
				curShot = "c";
			}
		}
	}

	//delete the internal handles
	int handleframesRemoved = 0;
	for(int i = shotSwitches.size()-1; i >= 0; i--){
		int internalHandleStart = shotSwitches[i] - handleInFrames;
		int internalHandleEnd = shotSwitches[i] + handleInFrames;
		cout << "HANDLE [" << internalHandleStart << ", " << internalHandleEnd << "] out of " << videoImages.size() << " frames" << endl;
		for(int j = internalHandleEnd - 1; j >= internalHandleStart; j-- ){
			handleframesRemoved++;
			videoImages.erase(videoImages.begin() + j);
		}
	}

	cout << "REMOVED " << handleframesRemoved << " Handle Frames" << endl;
	numFrames = videoImages.size();

	if(mattes != "" && ofDirectory(mattes).exists()){
		maskImages.listDir(mattes);
		cout << "num masks " << maskImages.numFiles() << endl;
	}

    cout << "numeFrames " << numFrames << endl;
    cout << "num objects " << heads.size() << endl;;

	calculateBaseEyeInfo();

    maskStandIn.loadImage("../../../sharedData/maskStandIn/maskStandIn.png");

}

void frameDataManager::calculateBaseEyeInfo(){
	//calculate base eye info
	if(rightEyes.size() > 0 && leftEyes.size() > 0){
		ofMesh baseLeftEye;
		ofMesh baseRightEye;

		ofxBinaryMesh::load(leftEyes[0], baseLeftEye);
		ofxBinaryMesh::load(rightEyes[0], baseRightEye);
		baseEyeCenter = baseLeftEye.getCentroid().getInterpolated(baseRightEye.getCentroid(), .5);
		float maxZ = baseLeftEye.getVertices()[0].z;
		eyeForwardIndex = 0;
		for(int i = 0; i < baseLeftEye.getNumVertices(); i++){
			if(baseLeftEye.getVertices()[i].z < maxZ){
				maxZ = baseLeftEye.getVertices()[i].z;
				eyeForwardIndex = i;
			}
		}
		baseEyeForward = ofVec3f(baseLeftEye.getCentroid() - baseLeftEye.getVertices()[eyeForwardIndex]).getNormalized();
	}
}

void frameDataManager::getOrientation(const frameData& fd, ofNode& n ){

	ofVec3f translation = fd.leftEye.getCentroid().getInterpolated(fd.rightEye.getCentroid(), .5);
	ofVec3f right = (fd.rightEye.getCentroid() - fd.leftEye.getCentroid()).getNormalized();
	ofVec3f forward = right.getCrossed(ofVec3f(0,1,0)).getNormalized();
	ofVec3f up = forward.getCrossed(right).getNormalized();
	n.setPosition(ofVec3f(0,0,0));
	n.lookAt(forward,up);
	n.setPosition(translation);

}

void frameDataManager::loadFrame( int frameNum, frameData & fd){
    if (frameNum < videoImages.size()){
        fd.img.loadImage(videoImages[frameNum]);
    }

    if (frameNum < heads.size()){
        ofxBinaryMesh::load(heads[frameNum], fd.head);
    }

	if (frameNum < leftEyes.size()){
		ofxBinaryMesh::load(leftEyes[frameNum], fd.leftEye);
    }

	if (frameNum < rightEyes.size()){
		ofxBinaryMesh::load(rightEyes[frameNum], fd.rightEye);
    }

    if(frameNum < maskImages.size()){
		fd.mask.loadImage(maskImages.getPath(frameNum));
	}
    else{
		fd.mask.clone(maskStandIn);
	}

}


text:
import {
  clickable,
  fillable,
  hasClass,
  isVisible,
  text
} from 'ember-cli-page-object';

export default {
  scope: '.task-title',

  isEditing: hasClass('editing'),

  cancel: {
    scope: '.cancel',
    click: clickable(),
    isVisible: isVisible()
  },

  edit: {
    scope: '.edit',
    click: clickable(),
    isVisible: isVisible()
  },

  save: {
    scope: '.save',
    click: clickable(),
    isVisible: isVisible()
  },

  title: {
    scope: '.title',
    isVisible: isVisible(),
    text: text()
  },

  titleInput: {
    scope: 'input[name=title]',
    fillIn: fillable(),
    isVisible: isVisible()
  }
};


text:
<?php

/////////////////
//
// Fecha: Octubre 2014
// Proyecto: Ecobici 2014
// Autor: Pili Mayora
//
// Output -> un archivo CSV con:
// estacion de origen, estacion de destino, y distancia entre ellas en metros
//
// Utiliza dos endpoints de la API de la USIG para:
// 1. Los datos de coordenadas de las estaciones
// 2. La distancia en metros entre dos puntos con coordenadas (x,y)
//
/////////////////

$fileEstaciones = fopen('../EstacionesUsigId.csv', 'r');
$estacionesXY = array();

// Skip first line
fgetcsv($fileEstaciones);
while(! feof($fileEstaciones)) {
  	$line = fgetcsv($fileEstaciones);
  	$usigId = $line[0];
  	$id = $line[1];

	// Access API de la usig para obtener x e y
	$usigUrl = 'http://epok.buenosaires.gob.ar/getObjectContent/?id=estaciones_de_bicicletas|' . $usigId;
	$usigJson = file_get_contents($usigUrl);
	$jsonParsed = json_decode($usigJson, true);
	$centroide = $jsonParsed['ubicacion']['centroide'];

	if ($centroide) {
		// Parse centroide para encontrar x e y
		$parseCentroide = preg_split("/[\s()]+/", $centroide);
		$usigX = $parseCentroide[1];
		$usigY = $parseCentroide[2];

		// Agregar estacion a lista de estaciones
		$estacionXY = array($id, $usigX, $usigY);
		array_push($estacionesXY, $estacionXY);
	}
}

// Cerrar estaciones
fclose($fileEstaciones);

// Crear archivo CSV en donde guardar las distancias
$topRowEstacionesKms = array("origen_estacion_id","destino_estacion_id","distancia");
$fileKm = fopen('../estaciones_distancia.csv', 'w');
fputcsv($fileKm, $topRowEstacionesKms);

// loop nˆ2 por las estaciones para calcular distancias
for ($i = 0; $i < sizeof($estacionesXY); $i++) {
	for ($j = 0; $j < sizeof($estacionesXY); $j++) {
		$distanciaUrl = 'http://recorridos.usig.buenosaires.gob.ar/2.0/consultar_recorridos?tipo=bici&origen=' .
						$estacionesXY[$i][1] .
						'%2C' .
						$estacionesXY[$i][2] .
						'&destino=' .
						$estacionesXY[$j][1] .
						'%2C' .
						$estacionesXY[$j][2];
		$json = file_get_contents($distanciaUrl);
		$jsonParsed = json_decode($json, true);
		$planningJson = $jsonParsed['planning'][0];
		$planningParsed = json_decode($planningJson, true);
		$traveledDistance = $planningParsed['traveled_distance'];

		// Agregar recorrido al archivo CSV
		$row = array($estacionesXY[$i][0], $estacionesXY[$j][0], $traveledDistance);
		fputcsv($fileKm, $row);
	}
}

// Cerrar recorridos
fclose($fileKm);
?>


text:
<?php

namespace App\Containers\AppSection\Authorization\Tests;

use App\Ship\Parents\Tests\PhpUnit\TestCase as ParentTestCase;

/**
 * Class TestCase
 *
 * This is the container TestCase class. Use this class to add your container specific helper functions. This testcase
 * is usually used only for unit tests.
 *
 * NOTE: API, WEB & CLI specific TestCase classes are located inside their own respective folders e.g. UI/API/Tests/ApiTestCase.php
 */
class TestCase extends ParentTestCase
{
    // ..
}


text:
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;

namespace FortranCodeNav.CodeSuggestions
{
    [Export(typeof(IViewTaggerProvider))]
    [ContentType("text")]
    [TagType(typeof(ErrorTag))]
    internal class CodeSuggestionsTaggerProvider : IViewTaggerProvider
    {
        [Import]
        internal ITextSearchService TextSearchService { get; set; }

        [Import]
        internal ITextStructureNavigatorSelectorService TextStructureNavigatorSelector { get; set; }

        [ImportMany(RequiredCreationPolicy = CreationPolicy.Shared)]
        internal IEnumerable<ICodeSuggestionProvider> CodeSuggestionProviders = null;

        public ITagger<T> CreateTagger<T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            //provide highlighting only on the top buffer
            if (textView.TextBuffer != buffer)
                return null;

            try
            {
                // filter on fortran files:
                var document = (ITextDocument)buffer.Properties[typeof(ITextDocument)];
                if (document == null)
                    return null;
                if (!FortranCodeNavCore.FortranCodeNavCore.KeepFile(document.FilePath))
                    return null;

                return new CodeSuggestionsTagger(CodeSuggestionProviders) as ITagger<T>;
            }
            catch (Exception)
            {
                return null;
            }
        }
    }
}


text:
title: User Accounts and Groups
menu: Accounts
taxonomy:
    category: docs
routes:
    aliases:
      - '/admin-panel/accounts'
process:
    twig: true
---

Accounts Manager is a new feature for Grav 1.7 Admin, which allows users to manage both user accounts and user groups.

![Users](accounts.png?width=2030&classes=shadow)
![Groups](accounts.png?width=2030&classes=shadow)
![Configuration](accounts.png?width=2030&classes=shadow)
![Permissions](accounts.png?width=2030&classes=shadow)


text:
import unittest
from .index import Index
from .columns.string import String
class TestIndex(unittest.TestCase):
    def setUp(self):
        self.columns = ['name', 'description']

    def test_can_create(self):
        name = String('name', 'VARCHAR')
        description = String('description', 'VARCHAR')
        index = Index('test_index', self.columns, index_type='unique')

        self.assertEquals('test_index', index.name)
        self.assertEquals('UNIQUE', index.index_type)
        self.assertEquals(self.columns, index.columns)
        self.assertEquals([], index.schema_errors)
        self.assertEquals([], index.schema_warnings)
        self.assertEquals([], index.parsing_errors)
        self.assertEquals([], index.parsing_warnings)

    def test_string_conversion(self):
        index = Index(name='test_index', columns=self.columns, index_type='UNIQUE')

        self.assertEquals('UNIQUE KEY `test_index` (`name`,`description`)', str(index))

    def test_name_too_long(self):
        too_long = '012345678901234567890123456789012345678901234567890123456789012345'
        index = Index(too_long, self.columns, index_type='UNIQUE')
        self.assertEquals([f'Key name {too_long} must be <=64 characters long'], index.schema_errors)

    def test_missing_name_use_column(self):
        index = Index(name='', columns=['hey'], index_type='sup')
        self.assertEquals('hey', index.name)

    def test_missing_things(self):
        index = Index('blah', [], index_type='')
        self.assertEquals([
            'Missing index_type for index blah',
            'Missing columns for index blah',
        ], index.schema_errors)


text:
#include "bitmap/JniBitmap.h"

class MagicBeauty
{
public:
	void initMagicBeauty(JniBitmap* jniBitmap);
	void unInitMagicBeauty();

    void startSkinSmooth(float smoothlevel);
    void startWhiteSkin(float whitenlevel);

    static MagicBeauty* getInstance();
    ~MagicBeauty();

private:
    static MagicBeauty * instance;
    MagicBeauty();

    uint64_t *mIntegralMatrix;
	uint64_t *mIntegralMatrixSqr;

	uint32_t *storedBitmapPixels;
	uint32_t *mImageData_rgb;

	uint8_t *mImageData_yuv;
	uint8_t *mSkinMatrix;

	int mImageWidth;
	int mImageHeight;
	float mSmoothLevel;
	float mWhitenLevel;

	//´´½¨»ý·Öͼ
	void initIntegral();

	//´´½¨·ôÉ«ÇøÓò
	void initSkinMatrix();

	void _startBeauty(float smoothlevel, float whitenlevel);
	void _startSkinSmooth(float smoothlevel);
	void _startWhiteSkin(float whitenlevel);
};
#endif


text:
/**
 * Created by alejandrobarreiro on 11/10/15.
 */
'use strict';
angular.module('sapoApp')
  .factory('TemplateHandler', [function () {

    var TemplateHandler = function () {
      this.init();
    };

    TemplateHandler.prototype.templates = {};

    TemplateHandler.prototype.init = function () {};

    TemplateHandler.prototype.setTemplates = function (templates) {
      TemplateHandler.prototype.templates = templates;
    };

    TemplateHandler.prototype.getTemplates = function () {
      return TemplateHandler.prototype.templates;
    };

    TemplateHandler.prototype.getTemplate = function(id) {
      var template,
        templates = TemplateHandler.prototype.getTemplates();

      if (templates) {
        TemplateHandler.prototype.getTemplates().forEach(function (t) {
          console.log(t)
          if (t && t.id == id) {
            template = t;
            return;
          }
        });
        return template;
      } else {
        return undefined;
      }
    };

    return TemplateHandler;
  }]);


text:
package jp.keita.kagurazaka.rxproperty.sample.basics;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import jp.keita.kagurazaka.rxproperty.sample.R;
import jp.keita.kagurazaka.rxproperty.sample.databinding.ActivityBasicsBinding;

public class BasicsActivity extends AppCompatActivity {
    private BasicsViewModel viewModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Switchable!
        viewModel = new JavaBasicsViewModel();
        // viewModel = new KotlinBasicsViewModel();

        ActivityBasicsBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_basics);
        binding.setViewModel(viewModel);
    }

    @Override
    protected void onDestroy() {
        viewModel.dispose();
        super.onDestroy();
    }
}


text:
module dojox.wire.ml{
export class Invocation extends dojox.wire.ml.Action {
object : any;
method : any;
topic : any;
parameters : IArguments;
result : any;
error : any;
onComplete (result:any) : any;
onError (error:any) : any;
_getParameters (args:any[]) : any[];
}
}


text:
package me.chanjar.weixin.mp.api;

import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;

import java.util.Map;

/**
 * 微信消息拦截器,可以用来做验证
 *
 * @author Daniel Qian
 */
public interface WxMpMessageInterceptor {

  /**
   * 拦截微信消息
   *
   * @param wxMessage
   * @param context        上下文,如果handler或interceptor之间有信息要传递,可以用这个
   * @param wxMpService
   * @param sessionManager
   * @return true代表OK,false代表不OK
   */
  public boolean intercept(WxMpXmlMessage wxMessage,
                            Map<String, Object> context,
                            WxMpService wxMpService,
                            WxSessionManager sessionManager) throws WxErrorException;

}


text:
package org.wso2.carbon.apimgt.gateway.dto;

import java.util.ArrayList;
import java.util.List;

public class BlockConditionsDTO {

  private List<String> api = new ArrayList<String>();

  private List<String> application = new ArrayList<String>();

  private List<IPRange> ip = new ArrayList<>();

  private List<String> user = new ArrayList<String>();

  private List<String> custom = new ArrayList<String>();

  public List<String> getApi() {
    return api;
  }

  public void setApi(List<String> api) {
    this.api = api;
  }

  public List<String> getApplication() {
    return application;
  }

  public void setApplication(List<String> application) {
    this.application = application;
  }

  public List<IPRange> getIp() {
    return ip;
  }

  public void setIp(List<IPRange> ip) {
    this.ip = ip;
  }

  public List<String> getUser() {
    return user;
  }

  public void setUser(List<String> user) {
    this.user = user;
  }

  public List<String> getCustom() {
    return custom;
  }

  public void setCustom(List<String> custom) {
    this.custom = custom;
  }
}