text:
<?php

    defined('BASEPATH') OR exit('No direct script access allowed');

    // Loading the Smarty Class
    require make_path(array(BASEPATH, 'lib', 'Smarty', 'Smarty.class.php'));

    /**
     * Templates Manager Class
     *
     * @package     STC
     * @subpackage  Libraries
     * @category    Template
     * @author      Nana Axel <ax.lnana@outlook.com>
     */
    class STC_Template extends Smarty
    {

        /**
         * Class __constructor
         *
         * @return void
         */
        public function __construct()
        {
            // Instanciate Smarty
            parent::__construct();

            // Set Smarty's directories
            $this->setTemplateDir(VIEWPATH . 'templates/');
            $this->setCompileDir(VIEWPATH . 'compiled/');
            $this->setConfigDir(VIEWPATH . 'configs/');
            $this->setCacheDir(VIEWPATH . 'caches/');
            $this->addPluginsDir(VIEWPATH . 'plugins/');

            // Set caching's option value
            $this->caching = config_item('cache_views');

            // Logging Message
            log_message('info', 'Template Class Initialized');
        }

        /**
         * Template Renderer
         *
         * @param string $file The file name of the template to render
         */
        public function render($file, $ext = NULL)
        {
            if (NULL === $ext) {
                $ext = config_item('view_ext');
            }

            if ($this->exists($file, $ext)) {
                try {
                    $file = str_replace(".{$ext}", '', $file);
                    $this->display("{$file}.{$ext}");
                } catch (Exception $e) {
                    show_exception($e);
                }
            }
            else {
                throw new RuntimeException("The template file at the path \"{$this->getDirectory()}{$file}.{$ext}\" doesn't exist.", 1);
            }
        }

        /**
         * Check if a template exist in the current directory
         * @param string $file The template file to check the existance
         */
        public function exists($file, $ext = NULL)
        {
            if (NULL === $ext) {
                $ext = config_item('view_ext');
            }
            $file = str_replace(".{$ext}", '', $file);
            return $this->templateExists($file . ".{$ext}");
        }

        /**
         * Template directory setter
         *
         * @param $folder The subfolder to use as default template directory
         */
        public function setDirectory($folder)
        {
            $this->setTemplateDir(VIEWPATH . "templates/{$folder}/");
            return $this;
        }

        /**
         * Template directory getter
         */
        public function getDirectory()
        {
            return $this->getTemplateDir(0);
        }

    }


text:
![CC2530EV](./CC2530EV.JPG)

## Specification
- TI CC2530F256 with 256KB Flash and 8kB RAM
- Slim debugger connector, need an adapter to use with TI CC Debugger
- 2x 8-pins interface headers (P0 and P1)
- 1x power headers
- 1x reset button
- Board dimension 40mm x 40mm

redpajama_set_name: RedPajamaGithub


text:
from __future__ import division, print_function, unicode_literals
import objc
from GlyphsApp import *
from GlyphsApp.plugins import *

class ____PluginClassName____(FilterWithDialog):

	# Definitions of IBOutlets

	# The NSView object from the User Interface. Keep this here!
	dialog = objc.IBOutlet()

	# Text field in dialog
	myTextField = objc.IBOutlet()

	@objc.python_method
	def settings(self):
		self.menuName = Glyphs.localize({
			'en': 'My Filter',
			'de': 'Mein Filter',
			'fr': 'Mon filtre',
			'es': 'Mi filtro',
			'pt': 'Meu filtro',
			'jp': '私のフィルター',
			'ko': '내 필터',
			'zh': '我的过滤器',
			})

		# Word on Run Button (default: Apply)
		self.actionButtonLabel = Glyphs.localize({
			'en': 'Apply',
			'de': 'Anwenden',
			'fr': 'Appliquer',
			'es': 'Aplicar',
			'pt': 'Aplique',
			'jp': '申し込む',
			'ko': '대다',
			'zh': '应用',
			})

		# Load dialog from .nib (without .extension)
		self.loadNib('IBdialog', __file__)

	# On dialog show
	@objc.python_method
	def start(self):

		# Set default value
		Glyphs.registerDefault('com.myname.myfilter.value', 15.0)

		# Set value of text field
		self.myTextField.setStringValue_(Glyphs.defaults['com.myname.myfilter.value'])

		# Set focus to text field
		self.myTextField.becomeFirstResponder()

	# Action triggered by UI
	@objc.IBAction
	def setValue_( self, sender ):

		# Store value coming in from dialog
		Glyphs.defaults['com.myname.myfilter.shift'] = sender.floatValue()

		# Trigger redraw
		self.update()

	# Actual filter
	@objc.python_method
	def filter(self, layer, inEditView, customParameters):

		# Called on font export, get value from customParameters
		if "shift" in customParameters:
			value = customParameters['shift']

		# Called through UI, use stored value
		else:
			value = float(Glyphs.defaults['com.myname.myfilter.shift'])

		# Shift all nodes in x and y direction by the value
		for path in layer.paths:
			for node in path.nodes:
				node.position = NSPoint(node.position.x + value, node.position.y + value)

	@objc.python_method
	def generateCustomParameter( self ):
		return "%s; shift:%s;" % (self.__class__.__name__, Glyphs.defaults['com.myname.myfilter.shift'] )

	@objc.python_method
	def __file__(self):
		"""Please leave this method unchanged"""
		return __file__


text:
package wall.dao;

import java.util.List;

import wall.entity.java.Message;

public interface MessageDao extends BaseDao<Message> {
	List<Message> getPage(int pageNumber, int pageSize);
}


text:
/**
 * Created by damiaan on 18/07/17.
 */

import { Meteor } from 'meteor/meteor'
import { Events } from 'meteor/visualisation:database'
import rootModule from './rootModule'
import {zreNodeModuleIdPrefix, whisperMethodName, shoutMethodName, restartMethodName} from './meta'
import zrePeer from './zre-peer'

Meteor.methods({
	[whisperMethodName](moduleId, message) {
		const peerId = moduleId.slice(zreNodeModuleIdPrefix.length)
		const payload = serialise(message)
		zrePeer.whisper(peerId, payload)
		Events.insert({
			senderId: rootModule._id,
			type: 'whisper',
			payload,
			date: new Date()
		})
	},

	[shoutMethodName](group, message) {
		const payload = serialise(message)
		zrePeer.shout(group, payload)
		Events.insert({
			senderId: rootModule._id,
			type: 'shout',
			group,
			payload,
			date: new Date()
		})
	},

	[restartMethodName]() {
		zrePeer.stop().then(() => {
			zrePeer.start()
		})
	}
})

/**
 * @param message {string|Object}
 * @returns {String}
 */
function serialise(message) {
	if (message instanceof String) return message
	else return JSON.stringify(message)
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<class name="MeshLibrary" inherits="Resource" version="4.0">
	<brief_description>
		Library of meshes.
	</brief_description>
	<description>
		A library of meshes. Contains a list of [Mesh] resources, each with a name and ID. Each item can also include collision and navigation shapes. This resource is used in [GridMap].
	</description>
	<tutorials>
		<link title="3D Kinematic Character Demo">https://godotengine.org/asset-library/asset/126</link>
		<link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link>
	</tutorials>
	<methods>
		<method name="clear">
			<return type="void" />
			<description>
				Clears the library.
			</description>
		</method>
		<method name="create_item">
			<return type="void" />
			<argument index="0" name="id" type="int" />
			<description>
				Creates a new item in the library with the given ID.
				You can get an unused ID from [method get_last_unused_item_id].
			</description>
		</method>
		<method name="find_item_by_name" qualifiers="const">
			<return type="int" />
			<argument index="0" name="name" type="String" />
			<description>
				Returns the first item with the given name.
			</description>
		</method>
		<method name="get_item_list" qualifiers="const">
			<return type="PackedInt32Array" />
			<description>
				Returns the list of item IDs in use.
			</description>
		</method>
		<method name="get_item_mesh" qualifiers="const">
			<return type="Mesh" />
			<argument index="0" name="id" type="int" />
			<description>
				Returns the item's mesh.
			</description>
		</method>
		<method name="get_item_name" qualifiers="const">
			<return type="String" />
			<argument index="0" name="id" type="int" />
			<description>
				Returns the item's name.
			</description>
		</method>
		<method name="get_item_navmesh" qualifiers="const">
			<return type="NavigationMesh" />
			<argument index="0" name="id" type="int" />
			<description>
				Returns the item's navigation mesh.
			</description>
		</method>
		<method name="get_item_navmesh_transform" qualifiers="const">
			<return type="Transform3D" />
			<argument index="0" name="id" type="int" />
			<description>
				Returns the transform applied to the item's navigation mesh.
			</description>
		</method>
		<method name="get_item_preview" qualifiers="const">
			<return type="Texture2D" />
			<argument index="0" name="id" type="int" />
			<description>
				When running in the editor, returns a generated item preview (a 3D rendering in isometric perspective). When used in a running project, returns the manually-defined item preview which can be set using [method set_item_preview]. Returns an empty [Texture2D] if no preview was manually set in a running project.
			</description>
		</method>
		<method name="get_item_shapes" qualifiers="const">
			<return type="Array" />
			<argument index="0" name="id" type="int" />
			<description>
				Returns an item's collision shapes.
				The array consists of each [Shape3D] followed by its [Transform3D].
			</description>
		</method>
		<method name="get_last_unused_item_id" qualifiers="const">
			<return type="int" />
			<description>
				Gets an unused ID for a new item.
			</description>
		</method>
		<method name="remove_item">
			<return type="void" />
			<argument index="0" name="id" type="int" />
			<description>
				Removes the item.
			</description>
		</method>
		<method name="set_item_mesh">
			<return type="void" />
			<argument index="0" name="id" type="int" />
			<argument index="1" name="mesh" type="Mesh" />
			<description>
				Sets the item's mesh.
			</description>
		</method>
		<method name="set_item_name">
			<return type="void" />
			<argument index="0" name="id" type="int" />
			<argument index="1" name="name" type="String" />
			<description>
				Sets the item's name.
				This name is shown in the editor. It can also be used to look up the item later using [method find_item_by_name].
			</description>
		</method>
		<method name="set_item_navmesh">
			<return type="void" />
			<argument index="0" name="id" type="int" />
			<argument index="1" name="navmesh" type="NavigationMesh" />
			<description>
				Sets the item's navigation mesh.
			</description>
		</method>
		<method name="set_item_navmesh_transform">
			<return type="void" />
			<argument index="0" name="id" type="int" />
			<argument index="1" name="navmesh" type="Transform3D" />
			<description>
				Sets the transform to apply to the item's navigation mesh.
			</description>
		</method>
		<method name="set_item_preview">
			<return type="void" />
			<argument index="0" name="id" type="int" />
			<argument index="1" name="texture" type="Texture2D" />
			<description>
				Sets a texture to use as the item's preview icon in the editor.
			</description>
		</method>
		<method name="set_item_shapes">
			<return type="void" />
			<argument index="0" name="id" type="int" />
			<argument index="1" name="shapes" type="Array" />
			<description>
				Sets an item's collision shapes.
				The array should consist of [Shape3D] objects, each followed by a [Transform3D] that will be applied to it. For shapes that should not have a transform, use [constant Transform3D.IDENTITY].
			</description>
		</method>
	</methods>
	<constants>
	</constants>
</class>


text:
Deftly interact with Google Music (a.k.a Skyjam)

## Important foreword

This uses the same *device id* as *Google's Music Manager* (your MAC address).
The reason is that incrementing the MAC is not a globally solving solution
and that you most probably won't need Google's Music Manager afterwards
because it's, well, "lacking" (to say the least). This may apply to the
*Chrome extension* too but I'm not sure so you'd be best not using it (it's
similarly lacking anyway).

## On the command line

```bash
gem install skyjam     # install the gem
skyjam --auth          # authenticates with OAuth, do it only once
skyjam ~/Music/Skyjam  # download files into the specified directory
```

Existing files will not be overwritten, so that makes
a nice sync/resume solution. Tracks are downloaded atomically, so
you're safe to `^C`.

## Inside ruby

Add 'skyjam' to your `Gemfile` (you *do* use Gemfiles?)

Here's a sample of what you can do now:

```ruby
require 'skyjam'

# where you want to store your library
path = File.join(ENV['HOME'], 'Music/Skyjam')

# Interactive authentication, only needed once.
# This performs OAuth and registers the device
# into Google Music services. Tokens are persisted
# in ~/.config/skyjam
Skyjam::Library.auth

# Connect the library to Google Music services
# This performs an OAuth refresh with persisted
# tokens
lib = Skyjam::Library.connect(path)

puts lib.tracks.count

lib.tracks.take(5).each { |t| puts t.title }  # metadata is exposed as accessors

track = lib.tracks.first
track.download               # atomically download track into the library
track.download               # noop, since now the file exists
track.download(lazy: false)  # forces the download

track.data                # returns track audio data from the file (since it's downloaded)
track.data(remote: true)  # forces remote data fetching
```

The following snippet also makes for an interesting interactive
REPL to interact with Google Music, wich is a testament to the
clarity aimed at in this project:

```ruby
require 'skyjam'
require 'pry'
SkyJam::Library.connect('some/where').pry
```

## Future features

Yes, trouble free upload for the quality minded is coming.

Also, see [TODO](TODO.md).

## Goals

Have a potent tool that doubles as a library and a documentation
of the Google Music API (including ProtoBuf definitions)

## References

* [Simon Weber's Unofficial Google Music API](https://github.com/simon-weber/Unofficial-Google-Music-API/)
* [Google Music protocol reverse engineering effort](http://www.verious.com/code/antimatter15/google-music-protocol/) (disappeared)


text:
$(function(){
  $("div.markupClick.textile").click()
  var editor,
  timeout_ms = 200;

  function async(editor, trigger, callback){
    if(!trigger){
      asyncOld(editor);
      return;
    }
    var func = function(event){
      console.log(event);
      event.stopPropagation();
      editor.unbind(trigger,func);
      callback();
    };
    editor.bind(trigger,func);
  }

  function asyncOld(callback) {
    setTimeout(callback, timeout_ms);
  }

  editor = $("div.markupClick.textile").parent()

  module("Markup");

  test("click and load", function(){
    ok(editor.find(".preview")[0], "Editor should be initialized");
  });

  test("save and close buttons should be visible on div-loaded MarkupEditor", function(){
    var tb = editor.find(".toolbar");
    ok(tb.find("a.save").is(":visible"), "save button should be visible");
    ok(tb.find("a.close").is(":visible"), "close button should be visible");
  });

  test("save and close buttons should not be visible on textarea loaded MarkupEditor", function(){
    ok(!$("#textile a.save").is(":visible"), "save button should not be visible");
    ok(!$("#textile a.close").is(":visible"), "close button should not be visible");
  });

  test('change between preview and data should work', function(){
    var previewButton = editor.find('a.wysiwyg'),
    changeMode = editor.find('.changeDataMode');

    previewButton.mouseup();
    ok(!previewButton.is('.on'), 'preview off');
    previewButton.mouseup();
    ok(previewButton.is('.on'), 'preview on');

    changeMode.val('haml').change();
    ok(previewButton.is(':visible'), 'preview button should be visible');
    ok(editor.find('.preview').is(':visible'), 'preview should be visible');
    ok(previewButton.is('.on'), 'preview on');

    previewButton.mouseup();
    stop(2);

    async(editor, 'from_html', function(){
      start();
      ok(!previewButton.is('.on'), 'preview off');
      ok(changeMode.val() === 'haml', 'The datamode should stay the same, was ' + changeMode.val());
      previewButton.mouseup();
      async(editor, 'to_html', function(){
        start();
        ok(previewButton.is('.on'), 'preview on');
        ok(changeMode.val() === 'haml', 'The datamode should stay the same, was ' + changeMode.val());
      });
    });
  });

  test('should not raise error', function(){
    editor.find('.toolbar').mouseup();
    ok(true, 'should not raise error');
  });

  test('should hide changeDataMode select if there is only one option', function(){
    ok($('#externalSelect2 .changeDataMode').is(':hidden'), 'changeDataMode should be hidden');
    ok(editor.find('.changeDataMode option').length > 1, 'changeDataMode should have more than one option');
    ok(editor.find('.changeDataMode').is(':visible'), 'changeDataMode should be visible if more than one option exists');
  });

  test('close and reopen', function(){
    var div = editor.find(".preview");
    editor.find('a.close').mouseup();
    ok(div.parent()[0] !== editor[0], 'editor should be closed');
    ok(!div.data('events') || !div.data('events').keyup, 'events should be removed');
    ok(div.attr('contentEditable') === 'false', 'content should no longer be editable');

    $('.markupClick.textile').click()
    editor = $('.markupClick.textile').parent()
    div = $('.markupClick.textile')
    ok(div.attr('contentEditable') === 'true', 'editor should be reopened');
    ok(div.parent().find("a.save").is(":visible"), "save settings should be remembered");
    ok(div.parent().find("select.changeDataMode option[value='unknown']")[0], "select settings should be remembered");
  });

  var externalSelect = $('select.availableModes'),
  editor1 = $('textarea.ta1').parents('.markupEditor'),
  editor2 = $('textarea.ta2').parents('.markupEditor'),
  changeMode1 = editor1.find('.changeDataMode'),
  changeMode2 = editor2.find('.changeDataMode'),
  textarea1 = editor1.find('textarea'),
  helper1 = new GeneralHelper({
    form: editor1,
    textarea: textarea1
  });

  test('should hide external select', function(){
    ok(externalSelect.is(':hidden'), 'external select should be hidden');
  });

  test('should ignore non existant select', function(){
    var select = $('#wrongExternalSelect .changeDataMode');
    ok(select.is(':visible'), 'select should be visible');
    ok(select.find('option').length > 0, 'select should contain items');
  });

  test('should sync the different select boxes', function(){
    var newVal = 'completeSyncMode';

    if(editor1.find('.wysiwyg').is('.on')){
      helper1.click('.wysiwyg');
    }

    changeMode1.val(newVal).change();
    ok(externalSelect.val() === newVal, 'change in one editor should change external select');
    ok(changeMode2.val() === newVal, 'change in one editor should change select in other editor');

    newVal = 'textile';
    externalSelect.val(newVal).change();
    ok(changeMode1.val() === newVal, 'change in external select should change editor 1');
    ok(changeMode2.val() === newVal, 'change in external select should change editor 2');

    helper1.off('wysiwyg')
      .click('.wysiwyg')
      .on('wysiwyg');

    ok(editor2.find('.wysiwyg').is('.on'), 'preview mode change should sync');

    newVal = 'completeSyncMode';
    changeMode1.val(newVal).change();
    ok(changeMode2.val() === newVal, 'sync with wysiwyg should change Datamode');
    ok(editor2.find('.wysiwyg').is('.on'), 'preview mode change should sync');
  });

  test('if the mode has no toHTML, hide the preview', function(){
    helper1.change('.changeDataMode', 'unknown')
      .handleDialog('notice', function(d){
        d.click("Ok");
      });

    ok(editor1.find('.preview').is(":hidden"), 'preview in editor 1 should be hidden');
    ok(editor2.find('.preview').is(":hidden"), 'preview in editor 2 should be hidden');

    helper1.change('.changeDataMode', 'modeWithoutToText')
      .handleDialog('notice', function(d){
        d.click("Ok");
      });
    ok(!editor1.find('.preview').is(":hidden"), 'preview in editor 1 should be visible');
    ok(!editor2.find('.preview').is(":hidden"), 'preview in editor 2 should be visible');

    changeMode1.val('textile').change();
    ok(editor1.find('.preview').is(":visible"), 'preview in editor 1 should be visible');
    ok(editor2.find('.preview').is(":visible"), 'preview in editor 2 should be visible');
  });

  test('mode change to mode without toText should leave the textarea untouched', function(){
    var text = 'some text',
    dialogOpen = false,
    dialogText = '';

    changeMode1.val('textile').change();
    textarea1.val(text).mouseup();

    changeMode1.val('unknown').change();
    helper1.handleDialog('notice', function(d){
      dialogOpen = true;
      dialogText = d.dialog.text();
      d.click("Ok");
    });
    ok(dialogOpen, 'a change to a mode without toText should warn');
    ok(/convert HTML to your markup/.test(dialogText), 'The dialog should warn about unsupported conversion to markup, text was: ' + dialogText);

    ok(textarea1.val() === text, 'The text should not change, was ' + textarea1.val());

    text = text + 'bla';
    textarea1.val(text);

    dialogOpen = false;
    changeMode1.val('textile').change();
    helper1.handleDialog('notice', function(d){
      dialogOpen = true;
      dialogText = d.dialog.text();
      d.click("Ok");
    });
    ok(dialogOpen, 'a change to a mode with preview should warn about possible problems');
    ok(/convert to HTML/.test(dialogText), 'The dialog should warn about unsupported conversion to HTML, text was: ' + dialogText);

    ok(textarea1.val() === text, 'Textile Mode should not convert preview div, was ' + textarea1.val());

    changeMode1.val('modeWithoutToText').change();
    dialogOpen = false;
    helper1.handleDialog('notice', function(d){
      dialogOpen = true;
      dialogText = d.dialog.text();
      d.click("Ok");
    });
    ok(dialogOpen, 'a change to a mode without toText should warn');
    ok(/convert HTML to your markup/.test(dialogText), 'The dialog should warn about unsupported conversion to markup, text was: ' + dialogText);

    ok(textarea1.val() === text, 'The text should not change, was ' + textarea1.val());

    editor1.find('.preview').html('
Changed text
');

    changeMode1.val('textile').change();

    dialogOpen = false;
    helper1.handleDialog('notice', function(d){
      dialogOpen = true;
    });

    ok(!dialogOpen, 'a change to a mode with preview should not warn about possible problems if the source mode has toHTML');

    ok(textarea1.val() === 'Changed text', 'Textile mode should use preview div');

    changeMode1.val('modeWithoutToText').change();
    helper1.handleDialog('notice', function(d){
      d.click("Cancel");
    });

    ok(changeMode1.val() === 'textile', 'Pressing cancel should rollback the mode change');
    ok(changeMode2.val() === 'textile', 'Pressing cancel should rollback the sync too');
  });

  test('change mode should work with async modes', function(){
    var text = 'some text',
    previewButton = editor1.find('a.wysiwyg');

    changeMode1.val('textile').change();

    if(previewButton.is('.on')){
      previewButton.mouseup();
    }

    textarea1.val(text).mouseup();

    changeMode1.val('haml').change();
    stop();

    async(editor1, 'from_html', function(){
      changeMode1.val('textile').change();

      async(editor1, 'to_html', function(){
        start();
        ok(textarea1.val() === text, 'The text should not change, was ' + textarea1.val());
      });
    });
  });

  test('From div should work only, if the mode has toText or getText', function(){
    var dialogOpen, $textarea,
    $editor = $('.markupClick.haml');

    $editor.click();

    dialogOpen = false;
    helper1.handleDialog('notice', function(d){
      dialogOpen = true;
    });

    stop();

    async(function(){
      start();

      $textarea = $editor.parent().find('textarea');

      ok(!dialogOpen, 'loading from haml should not open dialog');
      ok(/server version/.test($textarea.val()), 'haml should load from server');
      ok($textarea.is(':visible'), 'textarea should be visible if loaded from file');
      equals($editor.parent().find('.changeDataMode').val(), 'haml', 'should set select to haml');

      $editor = $('.markupClick.unknown2');
      $textarea = $editor.find('textarea');

      $editor.click();

      dialogOpen = false;
      helper1.handleDialog('notice', function(d){
        dialogOpen = true;
        d.click('Ok');
      });

      ok(dialogOpen, 'loading from unknown without src should open dialog');

    });
  });

});


text:
var rollup = require('rollup');
var traverseTree = require('./arithmetic').traverseTree;
var getConditionModule = require('./trace').getConditionModule;
var extend = require('./utils').extend;
var getAlias = require('./utils').getAlias;
var pluginBundleHook = require('./compile').pluginBundleHook;

exports.rollupTree = function(loader, tree, entryPoints, traceOpts, compileOpts, outputOpts) {
  /*
   * 1. Determine the tree entry points and optimization points
   *
   * eg for the tree:
   *
   * A -> B -> C
   * D -> C
   *
   * A and D are the entry points.
   * Optimization points are ES module entry points to be optimized
   *
   */

  entryPoints = entryPoints.concat([]);

  var optimizationPoints = [];

  var entryMap = {};

  function isESM(moduleName) {
    return tree[moduleName] && tree[moduleName].metadata && tree[moduleName].metadata.format == 'esm' && !tree[moduleName].metadata.originalSource && !tree[moduleName].source.match(/\s+import\s*\(/);
  }

  // for each module in the tree, we traverse the whole tree
  // we then relate each module in the tree to the first traced entry point
  Object.keys(tree).forEach(function(entryPoint) {
    traverseTree(tree, entryPoint, function(depName, parentName) {
      // esm from a non-esm parent means this is an optimization entry point from the linking alogorithm perspective
      if (parentName && isESM(depName) && !isESM(parentName) && optimizationPoints.indexOf(depName) == -1)
        optimizationPoints.push(depName);

      // if we have a entryMap for the given module, then stop
      if (entryMap[depName])
        return false;

      if (parentName)
        entryMap[depName] = entryPoint;
    }, traceOpts);
  });

  // the entry points are then the modules not represented in entryMap
  Object.keys(tree).forEach(function(entryPoint) {
    if (!entryMap[entryPoint] && tree[entryPoint] && entryPoints.indexOf(entryPoint) == -1)
      entryPoints.push(entryPoint);
  });

  // if all the entry points are ES modules,
  // then we can create a single dummy entry point
  // that represents the tree
  var esmEntryPoints = 0;
  entryPoints.forEach(function(entryPoint) {
    if (tree[entryPoint].metadata && tree[entryPoint].metadata.format == 'esm')
      esmEntryPoints ++;
  });

  if (esmEntryPoints > 1 && esmEntryPoints == entryPoints.length) {
    var dummySource = 'export * from "' + entryPoints[0] + '";\n';
    var dummyDepMap = {};

    entryPoints.forEach(function(entryPoint) {
      dummyDepMap[entryPoint] = entryPoint;

      dummySource += 'import "' + entryPoint + '";';
    });

    tree['@dummy-entry-point'] = {
      name: '@dummy-entry-point',
      path: null,
      metadata: { format: 'esm' },
      deps: entryPoints,
      depMap: dummyDepMap,
      source: dummySource
    };
    entryPoints = ['@dummy-entry-point'];
  }

  // optimization points are then es module entry points
  entryPoints.forEach(function(entryPoint) {
    if (isESM(entryPoint) && optimizationPoints.indexOf(entryPoint) == -1)
      optimizationPoints.push(entryPoint);
  });

  /*
   * 2. Determine unoptimizable modules, splitting them out into their own optimization points
   *
   * eg for the tree:
   *   A -> B -> C -> D
   *   E -> C -> D
   *
   * A, E are top-level entry points detected by the previous step
   *   (and hence optimization points if they are es modules)
   * C is not optimizable because it has two unique parent entry points
   *   (which is what this step looks for)
   * So C becomes its own optimization point
   * Leading to D inlining into C and B inlining into A
   *
   */

  // for each module in the tree, we track its parent optimization point
  // as soon as a module has two parent entry points, it is not optimizable
  // and we set it to undefined here. It then becomes its own optimizationPoint.
  var optimizationParentMap = {};

  // build up the parent entry point map as above
  // we use for over forEach because this list will grow as we go
  for (var i = 0; i < optimizationPoints.length; i++) {
    var entryPoint = optimizationPoints[i];
    traverseTree(tree, entryPoint, function(depName, parentName) {

      // we only traverse ES module tree subgraphs
      if (!isESM(depName))
        return false;

      if (depName == entryPoint)
        return;

      // dont traverse through other entry points
      if (optimizationPoints.indexOf(depName) != -1)
        return false;

      if (!optimizationParentMap[depName]) {
        optimizationParentMap[depName] = entryPoint;
        return;
      }

      // module in two separate entry point graphs -> it becomes its own optimization entry point
      if (optimizationParentMap[depName] != entryPoint) {
        optimizationParentMap[depName] = undefined;

        // this new optimization point will then be traversed in turn as part of this loop later
        optimizationPoints.push(depName);
      }
    }, traceOpts);
  }

  /*
   * 3. Given complete optimization points, populate subgraph externals
   *
   * eg for the graph
   *    A -> B -> C
   *
   * Where A is the optimization point, and C is not ESM, another optimization point,
   * or not contained in our build tree, then we mark 'C' as an external.
   *
   * That is, optimizationGraphExternals[A] = [C]
   *
   * This externals input is used in the Rollup API.
   * This way we just optimize B into A, retaining an explicit dependency on C.
   */

  var inlinedModules = [];
  var optimizationGraphExternals = {};

  optimizationPoints.forEach(function(entryPoint) {
    // the subgraph object is the list of modules in the subgraph
    // and the list of modules that are "external" boundaries of the subgraph
    var externals = [];

    // this traversal is a bit odd, since we need to traverse the full
    // dependency graph to detect externals, not just the direct build graph
    traverseTree(tree, entryPoint, function(depName, parentName) {
      if (!isESM(depName) || (depName != entryPoint && optimizationPoints.indexOf(depName) != -1))
        return false;

      var depLoad = tree[depName];
      depLoad.deps && depLoad.deps.forEach(function(depName) {
        depName = depLoad.depMap[depName];
        if (depName == entryPoint)
          return;

        // anything not ESM, not in the tree, or an optimization point, is external
        if (!isESM(depName) || optimizationPoints.indexOf(depName) != -1) {
          if (externals.indexOf(depName) == -1)
            externals.push(depName);
        }
        else {
          if (inlinedModules.indexOf(depName) == -1)
            inlinedModules.push(depName);
        }
      }, traceOpts);
    });

    optimizationGraphExternals[entryPoint] = externals;
  });

  // finally we rollup each optimization graph
  var rolledUpTree = {};
  Object.keys(tree).forEach(function(moduleName) {
    if (inlinedModules.indexOf(moduleName) == -1)
      rolledUpTree[moduleName] = tree[moduleName];
  });

  // compute the inlineMap
  var inlineMap = {};
  inlinedModules.forEach(function(moduleName) {
    var optimizationParent = optimizationParentMap[moduleName];
    (inlineMap[optimizationParent] = inlineMap[optimizationParent] || []).push(moduleName);
  });

  // if every module in the tree is rolled-up, then we can do a full tree rollup
  var fullTreeRollup = entryPoints.length == 1 && optimizationPoints.length == 1 && Object.keys(optimizationGraphExternals).length == 1;

  return Promise.all(Object.keys(optimizationGraphExternals).map(function(entryPoint) {
    var externals = optimizationGraphExternals[entryPoint];
    var loadList = [];

    // if all externals are outside the tree then this really is a full tree rollup
    // also @node/x requires mean we do need sfx core (pending a better output of these)
    if (fullTreeRollup)
      externals.forEach(function(external) {
        if (external.substr(0, 5) == '@node' || tree[external])
          fullTreeRollup = false;
      });

    var aliasedExternals = externals.map(function(external) {
      var alias = getAlias(loader, external) || externals;
      if (alias.indexOf('#:') != -1)
        alias = alias.replace('#:', '/');
      return alias;
    });

    return rollup.rollup({
      entry: entryPoint,
      external: aliasedExternals,
      acorn: {
            allowReserved: true,
            ecmaVersion: 8
        },
      plugins: [{
        resolveId: function(id, importer, options) {
          var resolved = importer ? tree[importer].depMap[id] : id;
          var externalIndex = externals.indexOf(resolved);
          if (externalIndex != -1)
            return aliasedExternals[externalIndex];
          return resolved;
        },
        load: function(id, options) {
          if (loadList.indexOf(tree[id]) == -1)
            loadList.push(tree[id]);
          loadList.push(tree[id]);
          return {
            code: tree[id].metadata.originalSource || tree[id].source,
            map: tree[id].metadata.sourceMap
          };
        }
      }],
      onwarn: function(message) {}
    })
    .then(function(bundle) {
      var entryPointLoad = tree[entryPoint];

      var defaultExport = compileOpts.defaultExport;
      if (entryPointLoad.metadata.format == 'register')
        throw new Error('Assertion failed: internal format should be "system" not "register".');

      if (entryPointLoad.metadata.format != 'esm' && entryPointLoad.metadata.format != 'system')
        defaultExport = true;

      var generateOptions = {
        sourceMap: !!compileOpts.sourceMaps,
        exports: defaultExport ? 'default' : 'named',
        dest: 'output.js' // workaround for rollup/rollup#1015
      };

      // for a full tree rollup, we pass all the output options into rollup itself
      if (fullTreeRollup) {
        generateOptions.format = compileOpts.format;
        if (generateOptions.format == 'global')
          generateOptions.format = 'iife';
        if (generateOptions.format == 'esm')
          generateOptions.format = 'es6';

        if ((generateOptions.format == 'iife' || generateOptions.format == 'umd') &&
            !compileOpts.globalName)
          throw new Error('The globalName option must be set for full-tree rollup global and UMD builds.');

        if (compileOpts.globalName)
          generateOptions.moduleName = compileOpts.globalName;

        if (compileOpts.globalDeps)
          generateOptions.globals = compileOpts.globalDeps;
      }

      var output = bundle.generate(generateOptions);

      // convert sources list into paths
      if (output.map) {
        output.map.sources = output.map.sources.map(function(name) {
          name = loader.getCanonicalName(loader.decanonicalize(name));
          return tree[name] && tree[name].path || loader.decanonicalize(name);
        });
      }

      if (fullTreeRollup)
        return {
          source: output.code,
          sourceMap: output.map
        };

      // replace the entry point module itself with the inlined subgraph module
      var curInlined = inlineMap[entryPoint] || [];

      // the process of running rollup will itself normalize all dependencies
      // the depMap then just becomes the identity map for non-externals
      var inlinedDepMap = {};
      aliasedExternals.forEach(function(dep, index) {
        inlinedDepMap[dep] = externals[index];
      });

      rolledUpTree[entryPoint] = extend(extend({}, entryPointLoad), {
        deps: aliasedExternals,
        depMap: inlinedDepMap,
        metadata: extend(extend({}, entryPointLoad.metadata), {
          originalSource: undefined,
          sourceMap: output.map
        }),
        source: output.code,
        compactedLoads: loadList
      });
    });
  }))
  .then(function(outputs) {
    if (fullTreeRollup) {
      // for the full tree rollup case, we need to run the plugin bundle hook as we skip compile entirely
      return pluginBundleHook(loader, Object.keys(tree).map(function(name) {
          return tree[name];
        }).filter(function(load) {
          return load;
        }), compileOpts, outputOpts)
      .then(function(pluginResult) {
        return {
          outputs: outputs.concat(pluginResult.outputs),
          assetList: pluginResult.assetList
        };
      });
    }

    return {
      tree: rolledUpTree,
      inlineMap: inlineMap
    };
  });
};


text:
package com.platypii.asr;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.zip.GZIPInputStream;

class PlaceFileIterator implements Iterator<Place> {
    private static final String TAG = "PlaceFileIterator";

    private BufferedReader reader;
    @Nullable
    private String nextLine;

    PlaceFileIterator(@NonNull File cacheFile) {
        try {
            reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(cacheFile))));
            // Skip first line
            reader.readLine();
            nextLine = reader.readLine();
        } catch (IOException e) {
            Log.e(TAG, "Error reading file", e);
            FirebaseCrashlytics.getInstance().recordException(e);
        }
    }

    @Override
    public boolean hasNext() {
        return nextLine != null;
    }

    @Override
    public Place next() {
        if (nextLine == null) {
            throw new NoSuchElementException();
        }
        final Place record = parseLine(nextLine);
        try {
            nextLine = reader.readLine();
        } catch (IOException e) {
            nextLine = null;
        }
        return record;
    }

    @Override
    public void remove() {}

    /**
     * Parse a CSV line into a place
     */
    @Nullable
    private static Place parseLine(@NonNull String line) {
        final String[] split = line.split(",", 4);
        if (split[0].equals("") || split[1].equals("") || split[2].equals("")) {
            Log.w(TAG, "Failed to parse line " + line);
            return null;
        }
        try {
            final double latitude = Double.parseDouble(split[0]);
            final double longitude = Double.parseDouble(split[1]);
            final double altitude = Double.parseDouble(split[2]);
            final String url = split[3];
            return new Place(latitude, longitude, altitude, url);
        } catch (Exception e) {
            Log.e(TAG, "Failed to parse line " + line, e);
            FirebaseCrashlytics.getInstance().recordException(e);
            return null;
        }
    }

}


text:
require 'spec_helper'

describe Hato::Plugin::Imkayac do
  it 'should have a version number' do
    Hato::Plugin::Imkayac::VERSION.should_not be_nil
  end

  it 'should do something useful' do
    false.should be_true
  end
end


text:
package com.badlogic.gdx.utils;

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

/** Taken from http://www.javafaq.nu/java-example-code-1079.html
 * @author mzechner */
public class LittleEndianInputStream extends FilterInputStream implements DataInput {

	private DataInputStream din;

	public LittleEndianInputStream (InputStream in) {
		super(in);
		din = new DataInputStream(in);
	}

	public void readFully (byte[] b) throws IOException {
		din.readFully(b);
	}

	public void readFully (byte[] b, int off, int len) throws IOException {
		din.readFully(b, off, len);
	}

	public int skipBytes (int n) throws IOException {
		return din.skipBytes(n);
	}

	public boolean readBoolean () throws IOException {
		return din.readBoolean();
	}

	public byte readByte () throws IOException {
		return din.readByte();
	}

	public int readUnsignedByte () throws IOException {
		return din.readUnsignedByte();
	}

	public short readShort () throws IOException {
		int low = din.read();
		int high = din.read();
		return (short)((high << 8) | (low & 0xff));
	}

	public int readUnsignedShort () throws IOException {
		int low = din.read();
		int high = din.read();
		return ((high & 0xff) << 8) | (low & 0xff);
	}

	public char readChar () throws IOException {
		return din.readChar();
	}

	public int readInt () throws IOException {
		int[] res = new int[4];
		for (int i = 3; i >= 0; i--)
			res[i] = din.read();

		return ((res[0] & 0xff) << 24) | ((res[1] & 0xff) << 16) | ((res[2] & 0xff) << 8) | (res[3] & 0xff);
	}

	public long readLong () throws IOException {
		int[] res = new int[8];
		for (int i = 7; i >= 0; i--)
			res[i] = din.read();

		return (((long)(res[0] & 0xff) << 56) | ((long)(res[1] & 0xff) << 48) | ((long)(res[2] & 0xff) << 40)
			| ((long)(res[3] & 0xff) << 32) | ((long)(res[4] & 0xff) << 24) | ((long)(res[5] & 0xff) << 16)
			| ((long)(res[6] & 0xff) << 8) | ((long)(res[7] & 0xff)));
	}

	public float readFloat () throws IOException {
		return Float.intBitsToFloat(readInt());
	}

	public double readDouble () throws IOException {
		return Double.longBitsToDouble(readLong());
	}

	public final String readLine () throws IOException {
		return din.readLine();
	}

	public String readUTF () throws IOException {
		return din.readUTF();
	}
}


text:
package uk.theretiredprogrammer.nbpcglibrary.common;

import uk.theretiredprogrammer.nbpcglibrary.api.LogicException;
import java.io.IOException;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
import org.openide.windows.OutputWriter;

/**
 * Provides convenience implementation for writing messages and errors to the
 * output window.
 *
 * @author Richard Linsdale (richard at theretiredprogrammer.uk)
 */
public class OutputReporter {

    private final OutputWriter msg;
    private final OutputWriter err;

    /**
     * Constructor
     *
     * @param tabtitle the title to be inserted into the tab (within the output
     * window)
     * @param initialmessage the initial message to be inserted into the window
     */
    public OutputReporter(String tabtitle, String initialmessage) {
        InputOutput io = IOProvider.getDefault().getIO(tabtitle, false);
        io.select();
        msg = io.getOut();
        err = io.getErr();
        try {
            msg.reset();
        } catch (IOException ex) {
            throw new LogicException("IO Exception when resetting Output", ex);
        }
        if (initialmessage != null) {
            msg.println(initialmessage);
        }
    }

    /**
     * Write a message to the output window (a newline is added to the output)
     *
     * @param message the message
     */
    public void writeMsg(String message) {
        msg.println(message);
    }

    /**
     * Write a newline to the output window
     */
    public void writeMsg() {
        msg.println();
    }

    /**
     * Write a message to the output window
     * @param message the message
     */
    public void writeMsgText(String message) {
        msg.print(message);
    }

    /**
     * Write a error message to the output window (a newline is added to the output)
     * @param message the error message
     */
    public void writeErr(String message) {
        err.println(message);
    }

    /**
     * the close the output window
     */
    public void close() {
        err.close();
        msg.close();
    }
}


text:
package org.apache.shardingsphere.mode.manager.standalone.workerid.generator;

import org.apache.shardingsphere.infra.instance.workerid.WorkerIdGenerator;

/**
 * Worker id generator for standalone mode.
 */
public final class StandaloneWorkerIdGenerator implements WorkerIdGenerator {

    @Override
    public long generate() {
        // TODO
        return 0;
    }
}


text:
package com.adoit.sdk.transforms;

import com.adoit.sdk.Request;
import com.adoit.sdk.models.SimpleWebServiceRequest;
import com.adoit.sdk.transform.Marshaller;

public class SimpleWebServiceRequestMarshaller implements Marshaller<Request<SimpleWebServiceRequest>, SimpleWebServiceRequest> {

    public Request<SimpleWebServiceRequest> marshall(SimpleWebServiceRequest in) {
        return null;
    }
}


text:
from a10sdk.common.A10BaseClass import A10BaseClass

class StartupConfig(A10BaseClass):

    """    :param default: {"description": "Default startup-config", "partition-visibility": "shared", "default": 0, "type": "number", "format": "flag", "optional": true}
    :param secondary: {"description": "Create link in secondary partition", "partition-visibility": "shared", "default": 0, "type": "number", "format": "flag", "optional": true}
    :param primary: {"description": "Create link in primary partition", "partition-visibility": "shared", "default": 0, "type": "number", "format": "flag", "optional": true}
    :param file_name: {"description": "Local Configuration Profile Name", "format": "string", "minLength": 1, "optional": true, "maxLength": 31, "type": "string"}
    :param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/device_proxy.py`

Class Description::
    Startup Configuration.

    Class startup-config supports CRUD Operations and inherits from `common/A10BaseClass`.
    This class is the `"PARENT"` class for this module.`

    URL for this object::
    `https://<Hostname|Ip address>//axapi/v3/link/startup-config`.

    """
    def __init__(self, **kwargs):
        self.ERROR_MSG = ""
        self.required=[]
        self.b_key = "startup-config"
        self.a10_url="/axapi/v3/link/startup-config"
        self.DeviceProxy = ""
        self.default = ""
        self.secondary = ""
        self.primary = ""
        self.file_name = ""

        for keys, value in kwargs.items():
            setattr(self,keys, value)


text:
'use strict';

const j = require('jscodeshift');

const statements = j.template.statements;
const statement = j.template.statement;

function findViaConfigType(type, nodePath) {
  return j(nodePath)
    .find(type.searchTerms[0])
    .filter(p => type.filters.every(filter => filter(p)));
}

function findInsertTypeIndex(config, requireStatement) {
  const wrappedRequireStatement = j.program([requireStatement]);
  for (let i = 0; i < config.length; i++) {
    if (findViaConfigType(config[i], wrappedRequireStatement).size()) {
      return i;
    }
  }

  throw new Error('No valid config found!');
}

function findNextInsertIndex(config, root) {
  for (let i = config.length - 1; i >= 0; i--) {
    if (findViaConfigType(config[i], root).size()) {
      return i;
    }
  }

  return -1;
}

function reprintComment(node) {
  if (node.type === 'Block') {
    return j.block(node.value);
  } else if (node.type === 'Line') {
    return j.line(node.value);
  }
  return node;
}

function applyCommentsToStatements(nodes, comments) {
  if (comments) {
    nodes[0].comments = comments.map(comment => reprintComment(comment));
  }
  return nodes;
}

function reprintNode(node) {
  if (j.ExpressionStatement.check(node)) {
    return statement`${node.expression}`;
  }

  if (j.VariableDeclaration.check(node)) {
    const declaration = node.declarations[0];
    return j.variableDeclaration(node.kind, [
      j.variableDeclarator(declaration.id, declaration.init),
    ]);
  }

  if (j.ImportDeclaration.check(node) && node.importKind === 'type') {
    // TODO: Properly remove new lines from the node.
    return node;
  }

  return node;
}

function addImport(config, root, requireStatement) {
  const insertTypeIndex = findInsertTypeIndex(config, requireStatement);
  const currentType = config[insertTypeIndex];
  const nodesForType = findViaConfigType(currentType, root).paths();

  if (nodesForType.length) {
    let insertAt = nodesForType.length;
    for (let i = 0; i < nodesForType.length; i++) {
      const pos = currentType.comparator(
        nodesForType[i].value,
        requireStatement
      );

      if (pos >= 0) {
        insertAt = i;
        break;
      }
    }

    if (insertAt === 0) {
      const nodePath = nodesForType[0];
      j(nodePath)
        .replaceWith(applyCommentsToStatements(statements`
          ${requireStatement};
          ${reprintNode(nodePath.value)};
        `, nodePath.value.comments));
    } else {
      const nodePath = nodesForType[insertAt - 1];
      j(nodePath)
        .replaceWith(applyCommentsToStatements(statements`
          ${reprintNode(nodePath.value)};
          ${requireStatement};
        `, nodePath.value.comments));
    }
  } else {
    const nextFoundConfigTypeIndex = findNextInsertIndex(
      config,
      root
    );

    if (nextFoundConfigTypeIndex > -1) {
      const requiresForType = findViaConfigType(
        config[nextFoundConfigTypeIndex],
        root
      ).paths();

      if (insertTypeIndex < nextFoundConfigTypeIndex) {
        j(requiresForType[0])
          .insertBefore(requireStatement);
      } else {
        j(requiresForType[requiresForType.length - 1])
          .insertAfter(requireStatement);
      }
    } else {
      const firstPath = j(root)
        .find(j.Program)
        .get('body')
        .get(0);

      j(firstPath)
        .replaceWith(applyCommentsToStatements(statements`
          ${requireStatement};
          ${reprintNode(firstPath.value)};
        `, firstPath.value.comments));
    }
  }
}

module.exports = addImport;


text:
# Description:
# Calculate the Greatest Common Denominator of selected glyphs

# Credits:
# Pablo Impallari
# http://www.impallari.com

# Dependencies
import fractions
from robofab.world import CurrentFont

# Clear Output windows
from FL import *
fl.output=""

# Function
def gcd(L):
    return reduce(fractions.gcd, L)

f = CurrentFont()
widths = []
rounded = []

list = f.selection
items = len(list)

for a in list:
	currentWidth = int(f[a].width)
	widths.append( currentWidth )
	if currentWidth % 2 != 0:
		currentWidth = currentWidth + 1
	rounded.append( currentWidth )

widths.sort()
rounded.sort()

print "Original widths:"
print widths
print gcd( widths )

print ""

print "Rounded Up widths:"
print rounded
print gcd( rounded )

print ""
print "Done!"


text:
//
//  LeftMenuViewController.m
//  test123
//
//  Created by kf1 on 14-9-16.
//  Copyright (c) 2014年 kf1. All rights reserved.
//

#import "FLSideSlipViewController.h"

@interface FLSideSlipViewController ()<UIGestureRecognizerDelegate>

@end

static const CGFloat min_Alpha = 0.2f;/**< 背景最小的透明度*/
static const CGFloat defaultLeftDistance = 160.0f;/**< 默认离左边的距离*/
static const CGFloat defaultScale = 0.85;/**< 默认缩小范围*/

@implementation FLSideSlipViewController{
    UIImageView *g_backGroundImage;
}

#pragma mark - UIViewController life cycle
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        _leftDistance = defaultLeftDistance;
        _scaleSize = defaultScale;
        _animationType = AnimationTransitionAndScaleAndIncline;
    }
    return self;
}

-(id)initWithRootViewController:(UIViewController *)viewController{
    if ((self = [super init])) {
        self.rootViewController = viewController;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    g_backGroundImage = [[UIImageView alloc]initWithFrame:self.view.bounds];
    [g_backGroundImage setImage:[UIImage imageNamed:@"backGroundImage"]];
    [g_backGroundImage setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
    g_backGroundImage.alpha = min_Alpha;
    [self.view insertSubview:g_backGroundImage atIndex:0];
    g_overView = [[UIView alloc]initWithFrame:self.view.frame];
    [g_overView setBackgroundColor:[UIColor clearColor]];
}

#pragma mark - Custom Delegate
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
    if (_canSlideInPush) {
        return YES;
    }
    if (_rootViewController.childViewControllers.count == 1 && !_canSlideInPush) {
        return YES;
    }
    return NO;
}

#pragma mark - event response
/**
 *  单击返回主界面
 */
-(void)tapInRootController{
    [self showRootViewController:YES];
}

/**
 *  滑动事件
 */
-(void)pan:(UIPanGestureRecognizer *)gesture{
    if (gesture.state == UIGestureRecognizerStateBegan) {
        [self showShadow:YES];
        [_rootViewController.view setNeedsDisplay];
        g_currentTranslateX = _rootViewController.view.frame.origin.x;
        if (g_menuFlags.showingRightView) {//解决右边返回的时候动画跳变问题
            g_currentTranslateX = -_leftDistance;
        }else if(g_menuFlags.showingLeftView){//解决左边返回的时候动画跳变问题
            g_currentTranslateX = _leftDistance;
        }
    }else if(gesture.state == UIGestureRecognizerStateChanged){
        CGPoint velocity = [gesture velocityInView:self.view];//滑动速度
        CGPoint translation = [gesture translationInView:_rootViewController.view];//滑动距离
        CGFloat transX = translation.x;
        transX = transX + g_currentTranslateX;
        CGFloat transleft = (-_leftDistance + transX) < 0 ? (-_leftDistance + transX) : 0;
        if (velocity.x > 0) {
            g_panDirection = LeftMenuPanDirectionRight;
        }else if(velocity.x < 0){
            g_panDirection = LeftMenuPanDirectionLeft;
        }
        CGFloat sca = 0;//缩放值
        CGFloat scaleft = 0;//左视图缩放值
        if (transX > 0 && g_menuFlags.canShowLeft) {
            _leftViewController.view.alpha = (transX / _leftDistance);
            g_backGroundImage.alpha = (transX / _leftDistance);
            if (g_menuFlags.canShowRight) {
                g_menuFlags.showingRightView = NO;
                [_rightViewController.view removeFromSuperview];
            }

            if (!g_menuFlags.showingLeftView) {
                g_menuFlags.showingLeftView = YES;
                CGRect leftFrame = self.view.bounds;
                CGAffineTransform oriT = CGAffineTransformIdentity;
                _leftViewController.view.transform = oriT;//先将leftviewcontroller的view置回原来的大小,否则再缩小的时候位置会改变
                _leftViewController.view.frame = leftFrame;
                [self.view insertSubview:_leftViewController.view atIndex:1];
                CGAffineTransform transRight = CGAffineTransformMakeTranslation(-_leftDistance, 0);
                CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
                CGAffineTransform transConcat = CGAffineTransformConcat(transRight, transScale);
                _leftViewController.view.transform = transConcat;
            }
            if (transX < _leftDistance) {
                sca = 1 - (transX / _leftDistance) * (1 - _scaleSize);
                scaleft = (1 - _scaleSize) * (transX / _leftDistance) + _scaleSize;
            } else {
                sca = _scaleSize;
                scaleft = 1;
            }
            CGAffineTransform transSl = CGAffineTransformMakeScale(scaleft, scaleft);
            CGAffineTransform transTl = CGAffineTransformMakeTranslation(transleft, 0);
            CGAffineTransform conTleft = CGAffineTransformConcat(transTl, transSl);
            _leftViewController.view.transform = conTleft;
        }else if(transX < 0 && g_menuFlags.canShowRight){
            _rightViewController.view.alpha = (-transX / _leftDistance);
            g_backGroundImage.alpha = (-transX / _leftDistance);
            if (g_menuFlags.canShowLeft) {
                g_menuFlags.showingLeftView = NO;
                [_leftViewController.view removeFromSuperview];
            }
            if (!g_menuFlags.showingRightView) {
                g_menuFlags.showingRightView = YES;
                CGRect rightFrame = self.view.bounds;
                _rightViewController.view.frame = rightFrame;
                [self.view insertSubview:_rightViewController.view atIndex:1];
            }
            if (transX > (-_leftDistance)) {
                sca = 1 - (-transX / _leftDistance) * (1 - _scaleSize);
            }else{
                sca = _scaleSize;
            }
        }else{
            g_menuFlags.showingLeftView = NO;
            g_menuFlags.showingRightView = NO;
            CGAffineTransform transIdentify = CGAffineTransformIdentity;
            _rootViewController.view.transform = transIdentify;
            return;
        }
        switch (_animationType) {
            case AnimationTransition: {
                CGAffineTransform transT = CGAffineTransformMakeTranslation(transX, 0);
                _rootViewController.view.transform = transT;
                break;
            }
            case AnimationTransitionAndScale: {
                CGAffineTransform transS = CGAffineTransformMakeScale(sca, sca);
                CGAffineTransform transT = CGAffineTransformMakeTranslation(transX, 0);
                CGAffineTransform conT = CGAffineTransformConcat(transT, transS);
                _rootViewController.view.transform = conT;
                break;
            }
            case AnimationTransitionAndScaleAndIncline: {
                CATransform3D transform = CATransform3DIdentity;
                transform.m34 = 1.0 / -600;//透视效果,要操作的这个对象要有旋转的角度,否则没有效果。正直/负值都有意义
                transform.m11 = sca;//x轴缩放
                transform.m22 = sca;//y轴缩放
                transform.m41 = transX;//平移
                CGFloat angle =  30.0f * M_PI / 180.0f * (transX / self.view.frame.size.width);//旋转角度
                transform = CATransform3DRotate(transform, angle , 0.0f, 1.0f, 0.0f);//Y轴方向旋转angle角度
                _rootViewController.view.layer.transform = transform;
                _rootViewController.view.layer.shouldRasterize = YES;//抗锯齿
                [_rootViewController.view.layer setRasterizationScale:[[UIScreen mainScreen] scale]];
                break;
            }
            default: {
                CGAffineTransform transT = CGAffineTransformMakeTranslation(transX, 0);
                _rootViewController.view.transform = transT;
                break;
            }
        }
    }else if(gesture.state == UIGestureRecognizerStateEnded || gesture.state == UIGestureRecognizerStateCancelled){
        CGPoint velocity = [gesture velocityInView:self.view];
        if (velocity.x > 0 && !g_menuFlags.showingRightView && g_menuFlags.canShowLeft) {
            if (!g_menuFlags.showingLeftView) {
                g_menuFlags.showingLeftView = YES;
                CGRect leftFrame = self.view.bounds;
                CGAffineTransform oriT = CGAffineTransformIdentity;
                _leftViewController.view.transform = oriT;//先将leftviewcontroller的view置回原来的大小,否则再缩小的时候位置会改变
                _leftViewController.view.frame = leftFrame;
                [self.view insertSubview:_leftViewController.view atIndex:1];
                CGAffineTransform transRight = CGAffineTransformMakeTranslation(-_leftDistance, 0);
                CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
                CGAffineTransform transConcat = CGAffineTransformConcat(transRight, transScale);
                _leftViewController.view.transform = transConcat;
            }
            g_menuFlags.showingRightView = NO;
            [g_tap setEnabled:YES];
            [UIView beginAnimations:Nil context:nil];
            [UIView setAnimationDuration:0.3];
            switch (_animationType) {
                case AnimationTransition: {
                    CGAffineTransform conT = [self getCGAffineTransform];
                    _rootViewController.view.transform = conT;
                    break;
                }
                case AnimationTransitionAndScale: {
                    CGAffineTransform conT = [self getCGAffineTransform];
                    _rootViewController.view.transform = conT;
                    break;
                }
                case AnimationTransitionAndScaleAndIncline: {
                    CATransform3D transform = [self getCATransform3D];
                    _rootViewController.view.layer.transform = transform;
                    break;
                }
                default: {
                    CGAffineTransform conT = [self getCGAffineTransform];
                    _rootViewController.view.transform = conT;
                    break;
                }
            }
            CGAffineTransform oriT = CGAffineTransformIdentity;
            _leftViewController.view.transform = oriT;
            _leftViewController.view.alpha = 1;
            g_backGroundImage.alpha = 1;
            [UIView commitAnimations];
            [_rootViewController.view addSubview:g_overView];

            return;
        }
        if (velocity.x < 0 && !g_menuFlags.showingLeftView && g_menuFlags.canShowRight) {

            g_menuFlags.showingLeftView = NO;
            g_menuFlags.showingRightView = YES;
            [g_tap setEnabled:YES];
            [UIView beginAnimations:Nil context:nil];
            [UIView setAnimationDuration:0.3];
            switch (_animationType) {
                case AnimationTransition: {
                    CGAffineTransform conT = [self getCGAffineTransform];
                    _rootViewController.view.transform = conT;
                    break;
                }
                case AnimationTransitionAndScale: {
                    CGAffineTransform conT = [self getCGAffineTransform];
                    _rootViewController.view.transform = conT;
                    break;
                }
                case AnimationTransitionAndScaleAndIncline: {
                    CATransform3D transform = [self getCATransform3D];
                    _rootViewController.view.layer.transform = transform;
                    break;
                }
                default: {
                    CGAffineTransform conT = [self getCGAffineTransform];
                    _rootViewController.view.transform = conT;
                    break;
                }
            }
            _rightViewController.view.alpha = 1;
            g_backGroundImage.alpha = 1;
            [UIView commitAnimations];
            [_rootViewController.view addSubview:g_overView];
            return;
        } else {
            _rootViewController.view.layer.shouldRasterize = NO;//取消抗锯齿
            CGAffineTransform oriT = CGAffineTransformIdentity;
            CGAffineTransform transRight = CGAffineTransformMakeTranslation(-_leftDistance, 0);
            CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
            CGAffineTransform transConcat = CGAffineTransformConcat(transRight, transScale);

            [UIView animateWithDuration:.3 animations:^{
                _rootViewController.view.transform = oriT;
                if (velocity.x < 0 && g_menuFlags.showingLeftView) {
                    _leftViewController.view.transform = transConcat;
                }
                _leftViewController.view.alpha = min_Alpha;
                _rightViewController.view.alpha = min_Alpha;
                g_backGroundImage.alpha = min_Alpha;
            }completion:^(BOOL success){
                [self showShadow:NO];
                g_menuFlags.showingLeftView = NO;
                g_menuFlags.showingRightView = NO;
                [g_overView removeFromSuperview];
                if (_leftViewController) {
                    [_leftViewController.view removeFromSuperview];
                }
                if (_rightViewController) {
                    [_rightViewController.view removeFromSuperview];
                }
            }];
        }
    }
}

/**
 *  左上角按钮点击事件
 */
-(void)showLeftViewController{
    if (g_menuFlags.canShowRight) {
        [_rightViewController.view removeFromSuperview];
    }
    //    [self.view setBackgroundColor:[UIColor greenColor]];
    g_menuFlags.showingLeftView = YES;
    g_menuFlags.showingRightView = NO;
    CGAffineTransform oriT = CGAffineTransformIdentity;
    _leftViewController.view.transform = oriT;
    CGRect leftFrame = self.view.bounds;
    _leftViewController.view.frame = leftFrame;
    [self.view insertSubview:_leftViewController.view atIndex:1];

    CGAffineTransform transRight = CGAffineTransformMakeTranslation(-_leftDistance, 0);
    CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
    CGAffineTransform transConcat = CGAffineTransformConcat(transRight, transScale);
    _leftViewController.view.transform = transConcat;
    [self showShadow:YES];
    [g_tap setEnabled:YES];
    g_panDirection = LeftMenuPanDirectionRight;
    [UIView beginAnimations:Nil context:nil];
    [UIView setAnimationDuration:.3];
    switch (_animationType) {
        case AnimationTransition: {
            CGAffineTransform conT = [self getCGAffineTransform];
            _rootViewController.view.transform = conT;
            break;
        }
        case AnimationTransitionAndScale: {
            CGAffineTransform conT = [self getCGAffineTransform];
            _rootViewController.view.transform = conT;
            break;
        }
        case AnimationTransitionAndScaleAndIncline: {
            CATransform3D transform = [self getCATransform3D];
            _rootViewController.view.layer.transform = transform;
            _rootViewController.view.layer.shouldRasterize = YES;//抗锯齿
            [_rootViewController.view.layer setRasterizationScale:[[UIScreen mainScreen] scale]];
            break;
        }
        default: {
            CGAffineTransform conT = [self getCGAffineTransform];
            _rootViewController.view.transform = conT;
            break;
        }
    }
    _leftViewController.view.transform = oriT;
    _leftViewController.view.alpha = 1;
    g_backGroundImage.alpha = 1;
    [UIView commitAnimations];
    [_rootViewController.view addSubview:g_overView];
}

/**
 *  右上角按钮点击事件
 */
-(void)showRightViewController{
    if (g_menuFlags.canShowLeft) {
        [_leftViewController.view removeFromSuperview];
    }
    g_menuFlags.showingRightView = YES;
    g_menuFlags.showingLeftView = NO;
    CGRect rightFrame = self.view.bounds;
    _rightViewController.view.frame = rightFrame;
    [self.view insertSubview:_rightViewController.view atIndex:1];
    [self showShadow:YES];
    [g_tap setEnabled:YES];
    g_panDirection = LeftMenuPanDirectionLeft;
    [UIView beginAnimations:Nil context:nil];
    [UIView setAnimationDuration:0.3];
    switch (_animationType) {
        case AnimationTransition: {
            CGAffineTransform conT = [self getCGAffineTransform];
            _rootViewController.view.transform = conT;
            break;
        }
        case AnimationTransitionAndScale: {
            CGAffineTransform conT = [self getCGAffineTransform];
            _rootViewController.view.transform = conT;
            break;
        }
        case AnimationTransitionAndScaleAndIncline: {
            CATransform3D transform = [self getCATransform3D];
            _rootViewController.view.layer.transform = transform;
            _rootViewController.view.layer.shouldRasterize = YES;//抗锯齿
            [_rootViewController.view.layer setRasterizationScale:[[UIScreen mainScreen] scale]];
            break;
        }
        default: {
            CGAffineTransform conT = [self getCGAffineTransform];
            _rootViewController.view.transform = conT;
            break;
        }
    }
    _rightViewController.view.alpha = 1;
    g_backGroundImage.alpha = 1;
    [UIView commitAnimations];
    [_rootViewController.view addSubview:g_overView];
}

/**
 *  主界面点击事件,返回到主界面
 */
-(void)showRootViewController:(BOOL)animation{
    [UIView setAnimationsEnabled:animation];
    g_menuFlags.showingLeftView = NO;
    g_menuFlags.showingRightView = NO;
    [g_tap setEnabled:NO];
    CGAffineTransform oriT = CGAffineTransformIdentity;
    CGAffineTransform transRight = CGAffineTransformMakeTranslation(-_leftDistance, 0);
    CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
    CGAffineTransform transConcat = CGAffineTransformConcat(transRight, transScale);

    [UIView animateWithDuration:.3 animations:^{
        _rootViewController.view.transform = oriT;
        _leftViewController.view.transform = transConcat;
        _rootViewController.view.layer.shouldRasterize = NO;//取消抗锯齿
        _leftViewController.view.alpha = min_Alpha;
        _rightViewController.view.alpha = min_Alpha;
        g_backGroundImage.alpha = min_Alpha;
    }completion:^(BOOL success){
        [g_overView removeFromSuperview];
        [self showShadow:NO];
        [UIView setAnimationsEnabled:YES];
    }];
}

/**
 *  侧边栏菜单点击事件
 *
 *  @param viewController 新的rootviewcontroller
 *  @param animation      是否支持动画
 */
-(void)setNewRootViewController:(UIViewController *)viewController animation:(BOOL)animation{
    if (!viewController) {
        [self showRootViewController:animation];
        return;
    }
    if (g_menuFlags.showingLeftView) {
        [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
        CGAffineTransform transRight = CGAffineTransformMakeTranslation(self.view.bounds.size.width, 0);
        CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
        CGAffineTransform transConcat = CGAffineTransformConcat(transRight, transScale);
        __block FLSideSlipViewController *selfRef = self;
        __block UIViewController *viewRef = viewController;
        CGRect rightFrame = _rootViewController.view.frame;
        rightFrame.origin.x = self.view.frame.size.width;
        [UIView animateWithDuration:.1 animations:^{
            _rootViewController.view.transform = transConcat;
        }completion:^(BOOL success){
            [selfRef setRootViewController:viewRef];
            _rootViewController.view.transform = transConcat;
            [self showShadow:YES];
            [selfRef showRootViewController:animation];
            [[UIApplication sharedApplication] endIgnoringInteractionEvents];
        }];
    }else if(g_menuFlags.showingRightView){
        [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
        CGAffineTransform transLeft = CGAffineTransformMakeTranslation(-self.view.frame.size.width, 0);
        CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
        CGAffineTransform transConcat = CGAffineTransformConcat(transLeft, transScale);
        __block FLSideSlipViewController *selfRef = self;
        __block UIViewController *viewRef = viewController;
        CGRect leftFrame = _rootViewController.view.frame;
        leftFrame.origin.x = -self.view.frame.size.width;
        [UIView animateWithDuration:1.0 animations:^{
            _rootViewController.view.transform = transConcat;
        }completion:^(BOOL success){
            [selfRef setRootViewController:viewRef];
            _rootViewController.view.transform = transConcat;
            [self showShadow:YES];
            [selfRef showRootViewController:animation];
            [[UIApplication sharedApplication] endIgnoringInteractionEvents];
        }];
    }
}

/**
 *  侧边栏菜单点击后在主界面跳转界面
 *
 *  @param viewController 要跳转的界面
 *  @param animation      是否打开动画
 */
- (void)pushToNewViewController:(UIViewController *)viewController animation:(BOOL)animation {
    [self showRootViewController:YES];
    [(UINavigationController *)_rootViewController pushViewController:viewController animated:animation];
}

#pragma mark - private method
/**
 *  获取view的动画效果(有倾斜)
 *
 *  @return 返回动画效果
 */
-(CATransform3D)getCATransform3D{
    CGFloat translateX = 0;
    CGFloat transcale = 0;
    switch (g_panDirection) {
        case LeftMenuPanDirectionLeft:
            translateX = -(_leftDistance);
            transcale = _scaleSize;
            break;
        case LeftMenuPanDirectionRight:
            translateX = _leftDistance;
            transcale = _scaleSize;
        default:
            break;
    }
//    CGAffineTransform transT = CGAffineTransformMakeTranslation(translateX, 0);
//    CGAffineTransform scaleT = CGAffineTransformMakeScale(transcale, transcale);
//    CGAffineTransform conT = CGAffineTransformConcat(transT, scaleT);

    CATransform3D transform = CATransform3DIdentity;
    transform.m34 = 1.0/-600;//透视效果,要操作的这个对象要有旋转的角度,否则没有效果。正直/负值都有意义
    transform.m11 = transcale;//x轴缩放
    transform.m22 = transcale;//y轴缩放
    transform.m41 = translateX;//平移
    CGFloat angle =  30.0f * M_PI / 180.0f * (translateX/self.view.frame.size.width);
    transform = CATransform3DRotate(transform, angle , 0.0f, 10.0f, 0.0f);

    return transform;
}

/**
 *  获取view的动画效果(平移加缩放)
 *
 *  @return 返回动画效果
 */
-(CGAffineTransform)getCGAffineTransform{
    CGFloat translateX = 0;
    CGFloat transcale = 0;
    switch (g_panDirection) {
        case LeftMenuPanDirectionLeft:
            translateX = -(_leftDistance);
            transcale = _scaleSize;
            break;
        case LeftMenuPanDirectionRight:
            translateX = _leftDistance;
            transcale = _scaleSize;
        default:
            break;
    }
    if (_animationType == AnimationTransition) {
        transcale = 1;
    }
    CGAffineTransform transT = CGAffineTransformMakeTranslation(translateX, 0);
    CGAffineTransform scaleT = CGAffineTransformMakeScale(transcale, transcale);
    CGAffineTransform conT = CGAffineTransformConcat(transT, scaleT);
    return conT;
}

/**
 *  显示阴影
 *
 *  @param val 是否显示阴影
 */
- (void)showShadow:(BOOL)val {
    if (!_rootViewController) return;

    _rootViewController.view.layer.shadowOpacity = val ? 0.8f : 0.0f;
    if (val) {
        _rootViewController.view.layer.cornerRadius = 4.0f;
        _rootViewController.view.layer.shadowOffset = CGSizeZero;
        _rootViewController.view.layer.shadowRadius = 4.0f;
        _rootViewController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds].CGPath;
    }

}

/**
 *  设置左右上角按钮
 */
-(void)setNavigationBackButton{
    if (_rootViewController) {

        UIViewController *topController = nil;
        if ([_rootViewController isKindOfClass:[UINavigationController class]]) {

            UINavigationController *navController = (UINavigationController*)_rootViewController;
            if ([[navController viewControllers] count] > 0) {
                topController = [[navController viewControllers] objectAtIndex:0];
            }

        } else if ([_rootViewController isKindOfClass:[UITabBarController class]]) {

            UITabBarController *tabController = (UITabBarController*)_rootViewController;
            topController = [tabController selectedViewController];

        } else {

            topController = _rootViewController;

        }

        if (g_menuFlags.canShowLeft) {
            UIButton* leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
            leftBtn.backgroundColor = [UIColor clearColor];
            [leftBtn setFrame:CGRectMake(0, 0, 24, 24)];
            [leftBtn addTarget:self action:@selector(showLeftViewController) forControlEvents:UIControlEventTouchUpInside];
            [leftBtn setImage:[UIImage imageNamed:@"nav_menu_icon"] forState:UIControlStateNormal];

            UIBarButtonItem* backItem = [[UIBarButtonItem alloc]initWithCustomView:leftBtn];
            topController.navigationItem.leftBarButtonItem = backItem;
        }
        if(g_menuFlags.canShowRight){
            UIButton* rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
            rightBtn.backgroundColor = [UIColor clearColor];
            [rightBtn setFrame:CGRectMake(0, 0, 24, 24)];
            [rightBtn addTarget:self action:@selector(showRightViewController) forControlEvents:UIControlEventTouchUpInside];
            [rightBtn setImage:[UIImage imageNamed:@"nav_menu_icon"] forState:UIControlStateNormal];

            UIBarButtonItem* backItem = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];
            topController.navigationItem.rightBarButtonItem = backItem;
        }

    }
}

#pragma mark - overwrite
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
    CGAffineTransform oriT = CGAffineTransformIdentity;
    _rootViewController.view.transform = oriT;
    [self performSelector:@selector(layoutRootView) withObject:Nil afterDelay:0.1f];
}

-(void)layoutRootView{
    if (g_menuFlags.showingLeftView) {
        CATransform3D transform = CATransform3DIdentity;
        transform.m34 = 1.0/-600;//透视效果,要操作的这个对象要有旋转的角度,否则没有效果。正直/负值都有意义
        transform.m11 = _scaleSize;//x轴缩放
        transform.m22 = _scaleSize;//y轴缩放
        transform.m41 = _leftDistance;//平移
        CGFloat angle =  30.0f * M_PI / 180.0f * (_leftDistance/self.view.frame.size.width);
        transform = CATransform3DRotate(transform, angle , 0.0f, 10.0f, 0.0f);

//        CGAffineTransform transLeft = CGAffineTransformMakeTranslation(_leftDistance, 0);
//        CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
//        CGAffineTransform transConcat = CGAffineTransformConcat(transLeft, transScale);

        _rootViewController.view.layer.transform = transform;
    }else if(g_menuFlags.showingRightView){
        CATransform3D transform = CATransform3DIdentity;
        transform.m34 = 1.0/-600;//透视效果,要操作的这个对象要有旋转的角度,否则没有效果。正直/负值都有意义
        transform.m11 = _scaleSize;//x轴缩放
        transform.m22 = _scaleSize;//y轴缩放
        transform.m41 = _leftDistance;//平移
        CGFloat angle =  30.0f * M_PI / 180.0f * (_leftDistance/self.view.frame.size.width);
        transform = CATransform3DRotate(transform, angle , 0.0f, 10.0f, 0.0f);

//        CGAffineTransform transRight = CGAffineTransformMakeTranslation(-_leftDistance, 0);
//        CGAffineTransform transScale = CGAffineTransformMakeScale(_scaleSize, _scaleSize);
//        CGAffineTransform transConcat = CGAffineTransformConcat(transRight, transScale);

        _rootViewController.view.layer.transform = transform;
    }
    [self showShadow:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - set方法
/**
 *  设置右边UIViewController
 *
 *  @param rightController 右边UIViewController
 */
- (void)setRightViewController:(UIViewController *)rightController {
    _rightViewController = rightController;
    _rightViewController.view.alpha = min_Alpha;
    g_menuFlags.canShowRight = (_rightViewController != nil);
    [self setNavigationBackButton];
}

/**
 *  设置左边UIViewController
 *
 *  @param leftController 左边UIViewController
 */
- (void)setLeftViewController:(UIViewController *)leftController {
    _leftViewController = leftController;
    NSArray *array = _leftViewController.view.subviews;
    UITableView *tableview = array[0];
    tableview.frame = CGRectMake(0, self.view.frame.size.height/8, self.view.frame.size.width, self.view.frame.size.height-self.view.frame.size.height/4);
    _leftViewController.view.alpha = min_Alpha;
    g_menuFlags.canShowLeft = (_leftViewController != nil);
    [self setNavigationBackButton];
}

/**
 *  设置RootViewController
 *
 *  @param rootViewController RootViewController
 */
- (void)setRootViewController:(UIViewController *)rootViewController {
    UIViewController *tempRoot = _rootViewController;
    _rootViewController = rootViewController;
    _rootViewController.view.layer.zPosition = 100.0f;//设置_rootviewcontroller画在界面上的层级
    _rootViewController.view.layer.shouldRasterize = NO;//取消抗锯齿
    if (_rootViewController) {

        if (tempRoot) {
            [tempRoot.view removeFromSuperview];
            tempRoot = nil;
        }

        UIView *view = _rootViewController.view;
        view.frame = self.view.bounds;
        view.backgroundColor = [UIColor whiteColor];
        [self.view addSubview:view];

        UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
        pan.delegate = self;
        pan.delegate = (id<UIGestureRecognizerDelegate>)self;
        [view addGestureRecognizer:pan];

        g_tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapInRootController)];
        if (_rootViewController.view) {
            [_rootViewController.view addGestureRecognizer:g_tap];
        }
        [g_tap setEnabled:NO];
    } else {
        if (tempRoot) {
            [tempRoot.view removeFromSuperview];
            tempRoot = nil;
        }
    }
    [self setNavigationBackButton];
}

@end


text:
<?php

namespace PHPExiftool\Driver\Tag\Canon;

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

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

    protected $Id = 13;

    protected $Name = 'FlashGuideNumber';

    protected $FullName = 'Canon::ShotInfo';

    protected $GroupName = 'Canon';

    protected $g0 = 'MakerNotes';

    protected $g1 = 'Canon';

    protected $g2 = 'Image';

    protected $Type = 'int16s';

    protected $Writable = true;

    protected $Description = 'Flash Guide Number';

    protected $flag_Permanent = true;
}


text:
/*
  DO NOT EDIT THIS FILE - the content was created using a source code generator
*/

#include "QModbusReplySlots.h"

QModbusReplySlots::QModbusReplySlots( QObject *parent ) : QObject( parent )
{
}

QModbusReplySlots::~QModbusReplySlots()
{
}

#if (QT_VERSION >= QT_VERSION_CHECK(5,8,0))
void QModbusReplySlots::finished()
{
  QObject *object = qobject_cast<QObject *>(sender());

  PHB_ITEM cb = Qt5xHb::Signals_return_codeblock( object, "finished()" );

  if( cb )
  {
    PHB_ITEM psender = Qt5xHb::Signals_return_qobject( (QObject *) object, "QMODBUSREPLY" );

    hb_vmEvalBlockV( cb, 1, psender );

    hb_itemRelease( psender );
  }
}
#endif

#if (QT_VERSION >= QT_VERSION_CHECK(5,8,0))
void QModbusReplySlots::errorOccurred( QModbusDevice::Error error )
{
  QObject *object = qobject_cast<QObject *>(sender());

  PHB_ITEM cb = Qt5xHb::Signals_return_codeblock( object, "errorOccurred(QModbusDevice::Error)" );

  if( cb )
  {
    PHB_ITEM psender = Qt5xHb::Signals_return_qobject( (QObject *) object, "QMODBUSREPLY" );
    PHB_ITEM perror = hb_itemPutNI( NULL, (int) error );

    hb_vmEvalBlockV( cb, 2, psender, perror );

    hb_itemRelease( psender );
    hb_itemRelease( perror );
  }
}
#endif

void QModbusReplySlots_connect_signal( const QString & signal, const QString & slot )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,8,0))
  QModbusReply * obj = (QModbusReply *) Qt5xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
    QModbusReplySlots * s = QCoreApplication::instance()->findChild<QModbusReplySlots *>();

    if( s == NULL )
    {
      s = new QModbusReplySlots();
      s->moveToThread( QCoreApplication::instance()->thread() );
      s->setParent( QCoreApplication::instance() );
    }

    hb_retl( Qt5xHb::Signals_connection_disconnection( s, signal, slot ) );
  }
  else
  {
    hb_retl( false );
  }
#else
  hb_retl( false );
#endif
}


text:
#ifndef _osimExamplecomponentsDLL_h_
#define _osimExamplecomponentsDLL_h_

// UNIX PLATFORM
#ifndef _WIN32

#define OSIMEXAMPLECOMPONENTS_API

// WINDOWS PLATFORM
#else

#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#ifdef OSIMEXAMPLECOMPONENTS_EXPORTS
#define OSIMEXAMPLECOMPONENTS_API __declspec(dllexport)
#else
#define OSIMEXAMPLECOMPONENTS_API __declspec(dllimport)
#endif

#endif // PLATFORM

#endif // __osimExamplecomponentsDLL_h__


text:
#include "NFItemBagPlugin.h"
#include "NFCItemModule.h"
#include "NFCPackModule.h"
#include "NFCEquipModule.h"
#include "NFCEquipPropertyModule.h"
#include "NFCItemConsumeManagerModule.h"

#ifdef NF_DYNAMIC_PLUGIN

NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
    CREATE_PLUGIN(pm, NFItemBagPlugin)
};

NF_EXPORT void DllStopPlugin(NFIPluginManager* pm)
{
    DESTROY_PLUGIN(pm, NFItemBagPlugin)
};

#endif
//////////////////////////////////////////////////////////////////////////

const int NFItemBagPlugin::GetPluginVersion()
{
    return 0;
}

const std::string NFItemBagPlugin::GetPluginName()
{
	return GET_CLASS_NAME(NFItemBagPlugin);
}

void NFItemBagPlugin::Install()
{
	REGISTER_MODULE(pPluginManager, NFIItemConsumeManagerModule, NFCItemConsumeManagerModule)
	REGISTER_MODULE(pPluginManager, NFIItemModule, NFCItemModule)
	REGISTER_MODULE(pPluginManager, NFIPackModule, NFCPackModule)
	REGISTER_MODULE(pPluginManager, NFIEquipModule, NFCEquipModule)
	REGISTER_MODULE(pPluginManager, NFIEquipPropertyModule, NFCEquipPropertyModule);
}

void NFItemBagPlugin::Uninstall()
{
	UNREGISTER_MODULE(pPluginManager, NFIEquipPropertyModule, NFCEquipPropertyModule);
	UNREGISTER_MODULE(pPluginManager, NFIEquipModule, NFCEquipModule)
	UNREGISTER_MODULE(pPluginManager, NFIPackModule, NFCPackModule)
	UNREGISTER_MODULE(pPluginManager, NFIItemModule, NFCItemModule)
	UNREGISTER_MODULE(pPluginManager, NFIItemConsumeManagerModule, NFCItemConsumeManagerModule)
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Orm.OneToOne
{
    public class Child
    {
        public virtual int Id { get; set; }
        public virtual string Nombre { get; set; }

        public virtual Parent Parent { get; set; }
        public virtual GrandChild GrandChild { get; set; }
    }
}


text:
use std::sync::Arc;
use std::sync::mpsc::{Receiver, Sender};

use event::{Event, Listener, Recipient};

/// Publishers receive events
pub trait Subscriber<T = Arc<Event>>: Recipient<T> {

  /// Reference this subscriber's transmitter
  fn tx<'a>(&'a self) -> &'a Sender<T>;

  /// Reference this subscriber's receiver
  fn rx<'a>(&'a self) -> &'a Receiver<T>;

}

impl<T> Listener for Subscriber<T> where T: AsRef<Event> {

  fn listen(&mut self) {

    let mut should_break = false;

    loop {

      let event = match self.rx().recv() {
        Ok(event) => event,
        Err(err) => panic!(err),
      };

      if let Event::Quit = *event.as_ref() {
        should_break = true;
      }

      self.receive(event);

      if should_break {
        break;
      }

    }

  }

}


text:
"""FISSPy sample data file set"""
from __future__ import absolute_import, print_function

from astropy.utils.data import download_file
from sunpy.util.net import url_exists
import os.path
from os import mkdir
from shutil import move

__author__ = "Juhyeong Kang"
__email = "jhkang@astro.snu.ac.kr"

url='http://fiss.snu.ac.kr/sample-data/'
files=['FISS_20140603_164842_B1_p.fts',
      'mFISS_20140603_164842_B1_c.fts']

home=os.path.expanduser("~")
if not home:
    raise RuntimeError('Environment variable $HOME is not defined.')

fissdir=os.path.join(home,'fisspy')
if not os.path.isdir(fissdir):
    mkdir(fissdir)

sampledir=os.path.join(fissdir,'sample_data')
if not os.path.isdir(sampledir):
    mkdir(sampledir)

def download_sample_data():
    """
    Download the sample data.

    Parameters
    ----------
    None

    Returns
    -------
    None
    """
    print("Downloading sample fiss files to {}".format(sampledir))
    for f in files:
        if url_exists(url+f):
            df = download_file(url+f)
            move(df,os.path.join(sampledir,f))


text:
package org.apache.olingo.server.core.deserializer.batch;

import java.util.List;

import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;

public class BatchQueryOperation implements BatchPart {

  protected final boolean isStrict;
  protected Line httpStatusLine;
  protected Header headers;
  protected List<Line> body;
  protected int bodySize;
  protected List<Line> message;

  public BatchQueryOperation(final List<Line> message, final boolean isStrict) {
    this.isStrict = isStrict;
    this.message = message;
  }

  public BatchQueryOperation parse() throws BatchDeserializerException {
    httpStatusLine = consumeHttpStatusLine(message);
    headers = BatchParserCommon.consumeHeaders(message);
    BatchParserCommon.consumeBlankLine(message, isStrict);
    body = message;

    return this;
  }

  protected Line consumeHttpStatusLine(final List<Line> message) throws BatchDeserializerException {
    if (!message.isEmpty() && !"".equals(message.get(0).toString().trim())) {
      final Line method = message.get(0);
      message.remove(0);

      return method;
    } else {
      final int line = (!message.isEmpty()) ? message.get(0).getLineNumber() : 0;
      throw new BatchDeserializerException("Missing http request line",
          BatchDeserializerException.MessageKeys.INVALID_STATUS_LINE, "" + line);
    }
  }

  public Line getHttpStatusLine() {
    return httpStatusLine;
  }

  public List<Line> getBody() {
    return body;
  }

  public int getBodySize() {
    return bodySize;
  }

  @Override
  public Header getHeaders() {
    return headers;
  }

  @Override
  public boolean isStrict() {
    return isStrict;
  }
}


text:
from flask_restplus import reqparse

adbmonitor_arguments = reqparse.RequestParser()
adbmonitor_arguments.add_argument('id', type=int, required=False, default=0, help='ID')
adbmonitor_arguments.add_argument('group_id', type=int, required=False, default=0, help='Group ID')
adbmonitor_arguments.add_argument('device_id', type=int, required=False, default=0, help='Device ID')
adbmonitor_arguments.add_argument('udid', type=str, required=False, help='UDID')


text:
package org.microbule.config.sysprop;

import javax.inject.Named;
import javax.inject.Singleton;

import org.microbule.config.api.Config;
import org.microbule.config.core.ConfigUtils;
import org.microbule.config.spi.ConfigProvider;

@Singleton
@Named("systemPropertiesConfigProvider")
public class SystemPropertiesConfigProvider implements ConfigProvider {
//----------------------------------------------------------------------------------------------------------------------
// Fields
//----------------------------------------------------------------------------------------------------------------------

    private static final String NAME = "sysprop";

//----------------------------------------------------------------------------------------------------------------------
// ConfigProvider Implementation
//----------------------------------------------------------------------------------------------------------------------

    @Override
    public Config getConfig(String... path) {
        return ConfigUtils.fromProperties(System.getProperties()).filtered(path);
    }

    @Override
    public String name() {
        return NAME;
    }

    @Override
    public int priority() {
        return ConfigUtils.PRIORITY_SYSPROP;
    }
}


text:
#ifndef _CX3D_CONE_H_
#define _CX3D_CONE_H_

#include <cybergarage/x3d/Geometry3DNode.h>

namespace CyberX3D {

const int DEFAULT_CONENODE_SLICES = 15;

class ConeNode : public Geometry3DNode {

	SFFloat *bottomRadiusField;
	SFFloat *heightField;
	SFBool *sideField;
	SFBool *bottomField;

public:

	ConeNode();
	virtual ~ConeNode();

	////////////////////////////////////////////////
	//	bottomRadius
	////////////////////////////////////////////////

	SFFloat *getBottomRadiusField() const;

	void setBottomRadius(float value);
	float getBottomRadius() const;

	////////////////////////////////////////////////
	//	height
	////////////////////////////////////////////////

	SFFloat *getHeightField() const;

	void setHeight(float value);
	float getHeight() const;

	////////////////////////////////////////////////
	//	side
	////////////////////////////////////////////////

	SFBool *getSideField() const;

	void setSide(bool value);
	void setSide(int value);
	bool getSide() const;

	////////////////////////////////////////////////
	//	bottom
	////////////////////////////////////////////////

	SFBool *getBottomField() const;

	void setBottom(bool value);
	void setBottom(int value);
	bool getBottom() const;

	////////////////////////////////////////////////
	//	List
	////////////////////////////////////////////////

	ConeNode *next() const;
	ConeNode *nextTraversal() const;

	////////////////////////////////////////////////
	//	functions
	////////////////////////////////////////////////

	bool isChildNodeType(Node *node) const;
	void initialize();
	void uninitialize();
	void update();

	////////////////////////////////////////////////
	//	BoundingBox
	////////////////////////////////////////////////

	void recomputeBoundingBox();

	////////////////////////////////////////////////
	//	Polygons
	////////////////////////////////////////////////

	int getNPolygons() const;

	////////////////////////////////////////////////
	//	recomputeDisplayList
	////////////////////////////////////////////////

#ifdef CX3D_SUPPORT_OPENGL
	void recomputeDisplayList();
#endif

	////////////////////////////////////////////////
	//	Infomation
	////////////////////////////////////////////////

	void outputContext(std::ostream &printStream, const char *indentString) const;
};

}

#endif


text:
package com.intellij.internal.statistic.eventLog;

import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.annotations.Nullable;

public class InternalDataCollectorDebugLogger implements DataCollectorDebugLogger {
  private final Logger myLogger;

  public InternalDataCollectorDebugLogger(Logger logger) {
    myLogger = logger;
  }

  @Override
  public void info(String message) {
    myLogger.info(message);
  }

  @Override
  public void info(@Nullable String message, Throwable t) {
    myLogger.info(message, t);
  }

  @Override
  public void warn(String message) {
    myLogger.warn(message);
  }

  @Override
  public void warn(@Nullable String message, Throwable t) {
    myLogger.warn(message, t);
  }

  @Override
  public void trace(String message) {
    myLogger.trace(message);
  }

  @Override
  public boolean isTraceEnabled() {
    return myLogger.isTraceEnabled();
  }
}


text:
fabric
======

JavaScript library that helps implement the tenants of Google's Material Design