text:
/**
 * Test dependencies.
 */

var start = require('./common')
  , assert = require('assert')
  , mongoose = start.mongoose
  , random = require('../lib/utils').random
  , Query = require('../lib/query')
  , Schema = mongoose.Schema
  , SchemaType = mongoose.SchemaType
  , CastError = mongoose.Error.CastError
  , ValidatorError = mongoose.Error.ValidatorError
  , ValidationError = mongoose.Error.ValidationError
  , ObjectId = Schema.ObjectId
  , DocumentObjectId = mongoose.Types.ObjectId
  , DocumentArray = mongoose.Types.DocumentArray
  , EmbeddedDocument = mongoose.Types.Embedded
  , MongooseArray = mongoose.Types.Array
  , MongooseError = mongoose.Error;

/**
 * Setup.
 */

var Comments = new Schema;

Comments.add({
    title     : String
  , date      : Date
  , body      : String
  , comments  : [Comments]
});

var BlogPost = new Schema({
    title     : String
  , author    : String
  , slug      : String
  , date      : Date
  , meta      : {
        date      : Date
      , visitors  : Number
    }
  , published : Boolean
  , mixed     : {}
  , numbers   : [Number]
  , owners    : [ObjectId]
  , comments  : [Comments]
  , nested    : { array: [Number] }
});

BlogPost
.path('title')
.get(function(v) {
  if (v) return v.toUpperCase();
});

BlogPost
.virtual('titleWithAuthor')
.get(function () {
  return this.get('title') + ' by ' + this.get('author');
})
.set(function (val) {
  var split = val.split(' by ');
  this.set('title', split[0]);
  this.set('author', split[1]);
});

BlogPost.method('cool', function(){
  return this;
});

BlogPost.static('woot', function(){
  return this;
});

var modelName = 'docuemnt.modified.blogpost'
mongoose.model(modelName, BlogPost);

var collection = 'blogposts_' + random();

describe('document modified', function(){
  describe('modified states', function(){
    it('reset after save', function(done){
      var db = start()
        , B = db.model(modelName, collection)
        , pending = 2;

      var b = new B;

      b.numbers.push(3);
      b.save(function (err) {
        assert.strictEqual(null, err);
        --pending || find();
      });

      b.numbers.push(3);
      b.save(function (err) {
        assert.strictEqual(null, err);
        --pending || find();
      });

      function find () {
        B.findById(b, function (err, b) {
          db.close();
          assert.strictEqual(null, err);
          assert.equal(2, b.numbers.length);
          done();
        });
      }
    });

    it('of embedded docs reset after save', function(done){
      var db = start()
        , BlogPost = db.model(modelName, collection);

      var post = new BlogPost({ title: 'hocus pocus' });
      post.comments.push({ title: 'Humpty Dumpty', comments: [{title: 'nested'}] });
      post.save(function(err){
        db.close();
        assert.strictEqual(null, err);
        var mFlag = post.comments[0].isModified('title');
        assert.equal(false, mFlag);
        assert.equal(false, post.isModified('title'));
        done();
      });
    })
  });

  describe('isModified', function(){
    it('should not throw with no argument', function(done){
      var db = start();
      var BlogPost = db.model(modelName, collection);
      var post = new BlogPost;
      db.close();

      var threw = false;
      try {
        post.isModified();
      } catch (err) {
        threw = true;
      }

      assert.equal(false, threw);
      done();
    });

    it('when modifying keys', function(done){
      var db = start()
        , BlogPost = db.model(modelName, collection);

      db.close();
      var post = new BlogPost;
      post.init({
          title       : 'Test'
        , slug        : 'test'
        , date        : new Date
      });

      assert.equal(false, post.isModified('title'));
      post.set('title', 'test');
      assert.equal(true, post.isModified('title'));

      assert.equal(false, post.isModified('date'));
      post.set('date', new Date(post.date + 10));
      assert.equal(true, post.isModified('date'));

      assert.equal(false, post.isModified('meta.date'));
      done();
    })

    it('setting a key identically to its current value should not dirty the key', function(done){
      var db = start()
        , BlogPost = db.model(modelName, collection);

      db.close();
      var post = new BlogPost;
      post.init({
          title       : 'Test'
        , slug        : 'test'
        , date        : new Date
      });

      assert.equal(false, post.isModified('title'));
      post.set('title', 'Test');
      assert.equal(false, post.isModified('title'));
      done();
    })

    describe('on DocumentArray', function(){
      it('work', function (done) {
        var db = start()
          , BlogPost = db.model(modelName, collection);

        db.close();
        var post = new BlogPost()
        post.init({
            title       : 'Test'
          , slug        : 'test'
          , comments    : [ { title: 'Test', date: new Date, body: 'Test' } ]
        });

        assert.equal(false, post.isModified('comments.0.title'));
        post.get('comments')[0].set('title', 'Woot');
        assert.equal(true, post.isModified('comments'));
        assert.equal(false, post.isDirectModified('comments'));
        assert.equal(true, post.isModified('comments.0.title'));
        assert.equal(true, post.isDirectModified('comments.0.title'));

        db.close();
        done();
      })
      it('with accessors', function(done){
        var db = start()
          , BlogPost = db.model(modelName, collection);

        var post = new BlogPost()
        post.init({
            title       : 'Test'
          , slug        : 'test'
          , comments    : [ { title: 'Test', date: new Date, body: 'Test' } ]
        });

        assert.equal(false, post.isModified('comments.0.body'));
        post.get('comments')[0].body = 'Woot';
        assert.equal(true, post.isModified('comments'));
        assert.equal(false, post.isDirectModified('comments'));
        assert.equal(true, post.isModified('comments.0.body'));
        assert.equal(true, post.isDirectModified('comments.0.body'));

        db.close();
        done();
      })
    })

    describe('on MongooseArray', function(){
      it('atomic methods', function(done){
        // COMPLETEME
        var db = start()
          , BlogPost = db.model(modelName, collection);

        db.close();
        var post = new BlogPost()
        assert.equal(false, post.isModified('owners'));
        post.get('owners').push(new DocumentObjectId);
        assert.equal(true, post.isModified('owners'));
        done();
      });
      it('native methods', function(done){
        // COMPLETEME
        var db = start()
          , BlogPost = db.model(modelName, collection);

        db.close();
        var post = new BlogPost;
        assert.equal(false, post.isModified('owners'));
        done();
      });
    });

    it('on entire document', function(done){
      var db = start()
        , BlogPost = db.model(modelName, collection)

      var doc = {
          title       : 'Test'
        , slug        : 'test'
        , date        : new Date
        , meta        : {
              date      : new Date
            , visitors  : 5
          }
        , published   : true
        , mixed       : { x: [ { y: [1,'yes', 2] } ] }
        , numbers     : []
        , owners      : [new DocumentObjectId, new DocumentObjectId]
        , comments    : [
            { title: 'Test', date: new Date, body: 'Test' }
          , { title: 'Super', date: new Date, body: 'Cool' }
          ]
      };

      BlogPost.create(doc, function (err, post) {
        assert.ifError(err);
        BlogPost.findById(post.id, function (err, postRead) {
          db.close();
          assert.ifError(err);
          //set the same data again back to the document.
          //expected result, nothing should be set to modified
          assert.equal(false, postRead.isModified('comments'));
          assert.equal(false, postRead.isNew);
          postRead.set(postRead.toObject());

          assert.equal(false, postRead.isModified('title'));
          assert.equal(false, postRead.isModified('slug'));
          assert.equal(false, postRead.isModified('date'));
          assert.equal(false, postRead.isModified('meta.date'));
          assert.equal(false, postRead.isModified('meta.visitors'));
          assert.equal(false, postRead.isModified('published'));
          assert.equal(false, postRead.isModified('mixed'));
          assert.equal(false, postRead.isModified('numbers'));
          assert.equal(false, postRead.isModified('owners'));
          assert.equal(false, postRead.isModified('comments'));
          var arr = postRead.comments.slice();
          arr[2] = postRead.comments.create({ title: 'index' });
          postRead.comments = arr;
          assert.equal(true, postRead.isModified('comments'));
          done();
        });
      });
    })

    it('should support setting mixed paths by string (gh-1418)', function(done){
      var db = start();
      var BlogPost = db.model('1418', new Schema({ mixed: {} }))
      var b = new BlogPost;
      b.init({ mixed: {} });

      var path = 'mixed.path';
      assert.ok(!b.isModified(path));

      b.set(path, 3);
      assert.ok(b.isModified(path));
      assert.equal(3, b.get(path));

      b = new BlogPost;
      b.init({ mixed: {} });
      path = 'mixed.9a';
      b.set(path, 4);
      assert.ok(b.isModified(path));
      assert.equal(4, b.get(path));

      b = new BlogPost({ mixed: {} })
      b.save(function (err) {
        assert.ifError(err);

        path = 'mixed.9a.x';
        b.set(path, 8);
        assert.ok(b.isModified(path));
        assert.equal(8, b.get(path));

        b.save(function (err) {
          assert.ifError(err);
          BlogPost.findById(b, function (err, doc) {
            db.close();
            assert.ifError(err);
            assert.equal(8, doc.get(path));
            done();
          })
        })
      });
    })
  });
})


text:
<?php

namespace SVGTool;

class SVGPathData
{
    public $command;
    public $coordinatesList = [];

    public function fromCommand($command, $coordinatesList = [])
    {
        $this->command = $command;
        $this->coordinatesList = $coordinatesList;

        return $this;
    }
}

redpajama_set_name: RedPajamaGithub


text:
import logging
import re

from telegram.ext import Updater, MessageHandler, Filters, CallbackQueryHandler
from transitions import Machine, State
from transitions.extensions import GraphMachine

logger = logging.getLogger(__name__)

class Constructor:
    """
    Main bot constructor class, which contains many operational fields: bot (telegram), update (telegram),
    state-machine fields, db_adapter for handling users' states and so on
    """
    START_STATE_NAME = '__start__'
    FREE_TEXT_TRIGGER = '__free_text__'
    PASSING_TRIGGER = '__passing_trigger__'

    def __init__(self, token, db_adapter):
        """
        :param token: toke of your bot (could be obtained within @BotFather in telegram).
        :param db_adapter: object of the original class DbAdapter (db_adapter.DbAdapter) or object of the inherited
            class from DbAdapter

        :type token: str
        :type db_adapter: DbAdapter
        """
        self.token = token
        self.update = None
        self.state = None
        self.machine = None
        self.start_state = None
        self.states = []
        self.transitions = []
        self.db_adapter = db_adapter

    def __handler(self, bot, update, trigger):
        """
        Handler method which is activated when bot receives message (or another type of input) from user. This method
            deals with self.db_adapter: takes the current user's state from db -> set this state to state machine ->
            execute the related machine handler (with given state and trigger) -> update state in self.state and
            update user's state in db
        """
        eff_user = update.effective_user
        user_id = eff_user.id
        logger.info('Handling user with id: {}'.format(user_id))
        self.user = self.db_adapter.get_user(eff_user=eff_user)
        self.bot = bot
        self.update = update
        self.user.state = Constructor.START_STATE_NAME if not self.user.state else self.user.state

        if self.machine:
            self.machine.set_state(state=self.user.state, model=self)
        else:
            self.machine = Machine(model=self, states=self.states, initial=self.user.state,
                                   transitions=self.transitions)

        triggers = self.machine.get_triggers(self.state)
        matched_triggers = []
        for possible_trigger in triggers:
            if re.match(possible_trigger, trigger):
                matched_triggers.append(possible_trigger)

        if len(matched_triggers) == 0:
            trigger = Constructor.FREE_TEXT_TRIGGER
        elif len(matched_triggers) == 1:
            trigger = matched_triggers[0]
        else:
            raise ValueError(
                'Proposed trigger {} has more then one possible model\'s matched triggers: {}'.format(trigger,
                                                                                matched_triggers))

        self.machine.model.trigger(trigger, self)

        self.user.state = self.state
        self.db_adapter.commit_user(self.user)

        if Constructor.PASSING_TRIGGER in self.machine.get_triggers(self.state):
            self.__handler(self, update, Constructor.PASSING_TRIGGER)

    def __msg_handler(self, bot, update):
        """
        Executes self.__handler if bot receives text from user
        """
        trigger = update.message.text
        self.__handler(bot, update, trigger)

    def __clb_handler(self, bot, update):
        """
        Executes self.__handler if bot receives callback data from user
        """
        trigger = update.callback_query.data
        self.__handler(bot, update, trigger)

    def add_state(self, name, on_enter=None, on_exit=None):
        """
        Append new state to the bot's states list
        See transitions.State class docs for more details.
        """
        args = locals()
        del args['self']
        self.states.append(State(**args))

    def add_transition(self, trigger, source, dest, conditions=None, unless=None, before=None,
                       after=None, prepare=None):
        """
        Append new transitions to the bot's transitions list.
        See transitions.Transition class docs for more details.
        """
        args = locals()
        del args['self']
        self.transitions += [args]

    def main(self):
        """
        Execute this method when bot is ready
        """

        updater = Updater(self.token)
        dp = updater.dispatcher

        dp.add_handler(MessageHandler(Filters.text, self.__msg_handler))
        dp.add_handler(MessageHandler(Filters.command, self.__msg_handler))
        dp.add_handler(CallbackQueryHandler(callback=self.__clb_handler))

        updater.start_polling()
        updater.idle()


text:
namespace atom {

struct CookieDetails;

class RequestContextDelegate
    : public brightray::URLRequestContextGetter::Delegate {
 public:
  explicit RequestContextDelegate(bool use_cache);
  ~RequestContextDelegate() override;

  // Register callbacks that needs to notified on any cookie store changes.
  std::unique_ptr<base::CallbackList<void(const CookieDetails*)>::Subscription>
  RegisterCookieChangeCallback(
      const base::Callback<void(const CookieDetails*)>& cb);

 protected:
  std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate() override;
  std::unique_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
      net::URLRequestContext* url_request_context,
      content::ProtocolHandlerMap* protocol_handlers) override;
  net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
      const base::FilePath& base_path) override;
  std::unique_ptr<net::CertVerifier> CreateCertVerifier(
      brightray::RequireCTDelegate* ct_delegate) override;
  void GetCookieableSchemes(std::vector<std::string>* cookie_schemes) override;
  void OnCookieChanged(const net::CanonicalCookie& cookie,
                       net::CookieChangeCause cause) override;

 private:
  void NotifyCookieChange(const net::CanonicalCookie& cookie,
                          net::CookieChangeCause cause);

  base::CallbackList<void(const CookieDetails*)> cookie_change_sub_list_;
  bool use_cache_ = true;

  base::WeakPtrFactory<RequestContextDelegate> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(RequestContextDelegate);
};

}  // namespace atom

#endif  // ATOM_BROWSER_REQUEST_CONTEXT_DELEGATE_H_


text:
// MESSAGE AQ_TELEMETRY_F PACKING

#define MAVLINK_MSG_ID_AQ_TELEMETRY_F 150

typedef struct __mavlink_aq_telemetry_f_t
{
 float value1; ///< value1
 float value2; ///< value2
 float value3; ///< value3
 float value4; ///< value4
 float value5; ///< value5
 float value6; ///< value6
 float value7; ///< value7
 float value8; ///< value8
 float value9; ///< value9
 float value10; ///< value10
 float value11; ///< value11
 float value12; ///< value12
 float value13; ///< value13
 float value14; ///< value14
 float value15; ///< value15
 float value16; ///< value16
 float value17; ///< value17
 float value18; ///< value18
 float value19; ///< value19
 float value20; ///< value20
 uint16_t Index; ///< Index of message
} mavlink_aq_telemetry_f_t;

#define MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN 82
#define MAVLINK_MSG_ID_150_LEN 82

#define MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC 241
#define MAVLINK_MSG_ID_150_CRC 241

#define MAVLINK_MESSAGE_INFO_AQ_TELEMETRY_F { \
	"AQ_TELEMETRY_F", \
	21, \
	{  { "value1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_aq_telemetry_f_t, value1) }, \
         { "value2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_aq_telemetry_f_t, value2) }, \
         { "value3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aq_telemetry_f_t, value3) }, \
         { "value4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aq_telemetry_f_t, value4) }, \
         { "value5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_aq_telemetry_f_t, value5) }, \
         { "value6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_aq_telemetry_f_t, value6) }, \
         { "value7", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_aq_telemetry_f_t, value7) }, \
         { "value8", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_aq_telemetry_f_t, value8) }, \
         { "value9", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_aq_telemetry_f_t, value9) }, \
         { "value10", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_aq_telemetry_f_t, value10) }, \
         { "value11", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_aq_telemetry_f_t, value11) }, \
         { "value12", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_aq_telemetry_f_t, value12) }, \
         { "value13", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_aq_telemetry_f_t, value13) }, \
         { "value14", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_aq_telemetry_f_t, value14) }, \
         { "value15", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_aq_telemetry_f_t, value15) }, \
         { "value16", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_aq_telemetry_f_t, value16) }, \
         { "value17", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_aq_telemetry_f_t, value17) }, \
         { "value18", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_aq_telemetry_f_t, value18) }, \
         { "value19", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_aq_telemetry_f_t, value19) }, \
         { "value20", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_aq_telemetry_f_t, value20) }, \
         { "Index", NULL, MAVLINK_TYPE_UINT16_T, 0, 80, offsetof(mavlink_aq_telemetry_f_t, Index) }, \
         } \
}

/**
 * @brief Pack a aq_telemetry_f message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param Index Index of message
 * @param value1 value1
 * @param value2 value2
 * @param value3 value3
 * @param value4 value4
 * @param value5 value5
 * @param value6 value6
 * @param value7 value7
 * @param value8 value8
 * @param value9 value9
 * @param value10 value10
 * @param value11 value11
 * @param value12 value12
 * @param value13 value13
 * @param value14 value14
 * @param value15 value15
 * @param value16 value16
 * @param value17 value17
 * @param value18 value18
 * @param value19 value19
 * @param value20 value20
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_aq_telemetry_f_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
						       uint16_t Index, float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, float value9, float value10, float value11, float value12, float value13, float value14, float value15, float value16, float value17, float value18, float value19, float value20)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN];
	_mav_put_float(buf, 0, value1);
	_mav_put_float(buf, 4, value2);
	_mav_put_float(buf, 8, value3);
	_mav_put_float(buf, 12, value4);
	_mav_put_float(buf, 16, value5);
	_mav_put_float(buf, 20, value6);
	_mav_put_float(buf, 24, value7);
	_mav_put_float(buf, 28, value8);
	_mav_put_float(buf, 32, value9);
	_mav_put_float(buf, 36, value10);
	_mav_put_float(buf, 40, value11);
	_mav_put_float(buf, 44, value12);
	_mav_put_float(buf, 48, value13);
	_mav_put_float(buf, 52, value14);
	_mav_put_float(buf, 56, value15);
	_mav_put_float(buf, 60, value16);
	_mav_put_float(buf, 64, value17);
	_mav_put_float(buf, 68, value18);
	_mav_put_float(buf, 72, value19);
	_mav_put_float(buf, 76, value20);
	_mav_put_uint16_t(buf, 80, Index);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#else
	mavlink_aq_telemetry_f_t packet;
	packet.value1 = value1;
	packet.value2 = value2;
	packet.value3 = value3;
	packet.value4 = value4;
	packet.value5 = value5;
	packet.value6 = value6;
	packet.value7 = value7;
	packet.value8 = value8;
	packet.value9 = value9;
	packet.value10 = value10;
	packet.value11 = value11;
	packet.value12 = value12;
	packet.value13 = value13;
	packet.value14 = value14;
	packet.value15 = value15;
	packet.value16 = value16;
	packet.value17 = value17;
	packet.value18 = value18;
	packet.value19 = value19;
	packet.value20 = value20;
	packet.Index = Index;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#endif

	msg->msgid = MAVLINK_MSG_ID_AQ_TELEMETRY_F;
#if MAVLINK_CRC_EXTRA
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC);
#else
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#endif
}

/**
 * @brief Pack a aq_telemetry_f message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message was sent over
 * @param msg The MAVLink message to compress the data into
 * @param Index Index of message
 * @param value1 value1
 * @param value2 value2
 * @param value3 value3
 * @param value4 value4
 * @param value5 value5
 * @param value6 value6
 * @param value7 value7
 * @param value8 value8
 * @param value9 value9
 * @param value10 value10
 * @param value11 value11
 * @param value12 value12
 * @param value13 value13
 * @param value14 value14
 * @param value15 value15
 * @param value16 value16
 * @param value17 value17
 * @param value18 value18
 * @param value19 value19
 * @param value20 value20
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_aq_telemetry_f_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
							   mavlink_message_t* msg,
						           uint16_t Index,float value1,float value2,float value3,float value4,float value5,float value6,float value7,float value8,float value9,float value10,float value11,float value12,float value13,float value14,float value15,float value16,float value17,float value18,float value19,float value20)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN];
	_mav_put_float(buf, 0, value1);
	_mav_put_float(buf, 4, value2);
	_mav_put_float(buf, 8, value3);
	_mav_put_float(buf, 12, value4);
	_mav_put_float(buf, 16, value5);
	_mav_put_float(buf, 20, value6);
	_mav_put_float(buf, 24, value7);
	_mav_put_float(buf, 28, value8);
	_mav_put_float(buf, 32, value9);
	_mav_put_float(buf, 36, value10);
	_mav_put_float(buf, 40, value11);
	_mav_put_float(buf, 44, value12);
	_mav_put_float(buf, 48, value13);
	_mav_put_float(buf, 52, value14);
	_mav_put_float(buf, 56, value15);
	_mav_put_float(buf, 60, value16);
	_mav_put_float(buf, 64, value17);
	_mav_put_float(buf, 68, value18);
	_mav_put_float(buf, 72, value19);
	_mav_put_float(buf, 76, value20);
	_mav_put_uint16_t(buf, 80, Index);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#else
	mavlink_aq_telemetry_f_t packet;
	packet.value1 = value1;
	packet.value2 = value2;
	packet.value3 = value3;
	packet.value4 = value4;
	packet.value5 = value5;
	packet.value6 = value6;
	packet.value7 = value7;
	packet.value8 = value8;
	packet.value9 = value9;
	packet.value10 = value10;
	packet.value11 = value11;
	packet.value12 = value12;
	packet.value13 = value13;
	packet.value14 = value14;
	packet.value15 = value15;
	packet.value16 = value16;
	packet.value17 = value17;
	packet.value18 = value18;
	packet.value19 = value19;
	packet.value20 = value20;
	packet.Index = Index;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#endif

	msg->msgid = MAVLINK_MSG_ID_AQ_TELEMETRY_F;
#if MAVLINK_CRC_EXTRA
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC);
#else
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#endif
}

/**
 * @brief Encode a aq_telemetry_f struct into a message
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param aq_telemetry_f C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_aq_telemetry_f_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_aq_telemetry_f_t* aq_telemetry_f)
{
	return mavlink_msg_aq_telemetry_f_pack(system_id, component_id, msg, aq_telemetry_f->Index, aq_telemetry_f->value1, aq_telemetry_f->value2, aq_telemetry_f->value3, aq_telemetry_f->value4, aq_telemetry_f->value5, aq_telemetry_f->value6, aq_telemetry_f->value7, aq_telemetry_f->value8, aq_telemetry_f->value9, aq_telemetry_f->value10, aq_telemetry_f->value11, aq_telemetry_f->value12, aq_telemetry_f->value13, aq_telemetry_f->value14, aq_telemetry_f->value15, aq_telemetry_f->value16, aq_telemetry_f->value17, aq_telemetry_f->value18, aq_telemetry_f->value19, aq_telemetry_f->value20);
}

/**
 * @brief Send a aq_telemetry_f message
 * @param chan MAVLink channel to send the message
 *
 * @param Index Index of message
 * @param value1 value1
 * @param value2 value2
 * @param value3 value3
 * @param value4 value4
 * @param value5 value5
 * @param value6 value6
 * @param value7 value7
 * @param value8 value8
 * @param value9 value9
 * @param value10 value10
 * @param value11 value11
 * @param value12 value12
 * @param value13 value13
 * @param value14 value14
 * @param value15 value15
 * @param value16 value16
 * @param value17 value17
 * @param value18 value18
 * @param value19 value19
 * @param value20 value20
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_aq_telemetry_f_send(mavlink_channel_t chan, uint16_t Index, float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, float value9, float value10, float value11, float value12, float value13, float value14, float value15, float value16, float value17, float value18, float value19, float value20)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN];
	_mav_put_float(buf, 0, value1);
	_mav_put_float(buf, 4, value2);
	_mav_put_float(buf, 8, value3);
	_mav_put_float(buf, 12, value4);
	_mav_put_float(buf, 16, value5);
	_mav_put_float(buf, 20, value6);
	_mav_put_float(buf, 24, value7);
	_mav_put_float(buf, 28, value8);
	_mav_put_float(buf, 32, value9);
	_mav_put_float(buf, 36, value10);
	_mav_put_float(buf, 40, value11);
	_mav_put_float(buf, 44, value12);
	_mav_put_float(buf, 48, value13);
	_mav_put_float(buf, 52, value14);
	_mav_put_float(buf, 56, value15);
	_mav_put_float(buf, 60, value16);
	_mav_put_float(buf, 64, value17);
	_mav_put_float(buf, 68, value18);
	_mav_put_float(buf, 72, value19);
	_mav_put_float(buf, 76, value20);
	_mav_put_uint16_t(buf, 80, Index);

#if MAVLINK_CRC_EXTRA
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#endif
#else
	mavlink_aq_telemetry_f_t packet;
	packet.value1 = value1;
	packet.value2 = value2;
	packet.value3 = value3;
	packet.value4 = value4;
	packet.value5 = value5;
	packet.value6 = value6;
	packet.value7 = value7;
	packet.value8 = value8;
	packet.value9 = value9;
	packet.value10 = value10;
	packet.value11 = value11;
	packet.value12 = value12;
	packet.value13 = value13;
	packet.value14 = value14;
	packet.value15 = value15;
	packet.value16 = value16;
	packet.value17 = value17;
	packet.value18 = value18;
	packet.value19 = value19;
	packet.value20 = value20;
	packet.Index = Index;

#if MAVLINK_CRC_EXTRA
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, (const char *)&packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, (const char *)&packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#endif
#endif
}

#endif

// MESSAGE AQ_TELEMETRY_F UNPACKING

/**
 * @brief Get field Index from aq_telemetry_f message
 *
 * @return Index of message
 */
static inline uint16_t mavlink_msg_aq_telemetry_f_get_Index(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint16_t(msg,  80);
}

/**
 * @brief Get field value1 from aq_telemetry_f message
 *
 * @return value1
 */
static inline float mavlink_msg_aq_telemetry_f_get_value1(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  0);
}

/**
 * @brief Get field value2 from aq_telemetry_f message
 *
 * @return value2
 */
static inline float mavlink_msg_aq_telemetry_f_get_value2(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  4);
}

/**
 * @brief Get field value3 from aq_telemetry_f message
 *
 * @return value3
 */
static inline float mavlink_msg_aq_telemetry_f_get_value3(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field value4 from aq_telemetry_f message
 *
 * @return value4
 */
static inline float mavlink_msg_aq_telemetry_f_get_value4(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  12);
}

/**
 * @brief Get field value5 from aq_telemetry_f message
 *
 * @return value5
 */
static inline float mavlink_msg_aq_telemetry_f_get_value5(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Get field value6 from aq_telemetry_f message
 *
 * @return value6
 */
static inline float mavlink_msg_aq_telemetry_f_get_value6(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  20);
}

/**
 * @brief Get field value7 from aq_telemetry_f message
 *
 * @return value7
 */
static inline float mavlink_msg_aq_telemetry_f_get_value7(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  24);
}

/**
 * @brief Get field value8 from aq_telemetry_f message
 *
 * @return value8
 */
static inline float mavlink_msg_aq_telemetry_f_get_value8(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  28);
}

/**
 * @brief Get field value9 from aq_telemetry_f message
 *
 * @return value9
 */
static inline float mavlink_msg_aq_telemetry_f_get_value9(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  32);
}

/**
 * @brief Get field value10 from aq_telemetry_f message
 *
 * @return value10
 */
static inline float mavlink_msg_aq_telemetry_f_get_value10(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  36);
}

/**
 * @brief Get field value11 from aq_telemetry_f message
 *
 * @return value11
 */
static inline float mavlink_msg_aq_telemetry_f_get_value11(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  40);
}

/**
 * @brief Get field value12 from aq_telemetry_f message
 *
 * @return value12
 */
static inline float mavlink_msg_aq_telemetry_f_get_value12(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  44);
}

/**
 * @brief Get field value13 from aq_telemetry_f message
 *
 * @return value13
 */
static inline float mavlink_msg_aq_telemetry_f_get_value13(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  48);
}

/**
 * @brief Get field value14 from aq_telemetry_f message
 *
 * @return value14
 */
static inline float mavlink_msg_aq_telemetry_f_get_value14(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  52);
}

/**
 * @brief Get field value15 from aq_telemetry_f message
 *
 * @return value15
 */
static inline float mavlink_msg_aq_telemetry_f_get_value15(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  56);
}

/**
 * @brief Get field value16 from aq_telemetry_f message
 *
 * @return value16
 */
static inline float mavlink_msg_aq_telemetry_f_get_value16(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  60);
}

/**
 * @brief Get field value17 from aq_telemetry_f message
 *
 * @return value17
 */
static inline float mavlink_msg_aq_telemetry_f_get_value17(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  64);
}

/**
 * @brief Get field value18 from aq_telemetry_f message
 *
 * @return value18
 */
static inline float mavlink_msg_aq_telemetry_f_get_value18(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  68);
}

/**
 * @brief Get field value19 from aq_telemetry_f message
 *
 * @return value19
 */
static inline float mavlink_msg_aq_telemetry_f_get_value19(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  72);
}

/**
 * @brief Get field value20 from aq_telemetry_f message
 *
 * @return value20
 */
static inline float mavlink_msg_aq_telemetry_f_get_value20(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  76);
}

/**
 * @brief Decode a aq_telemetry_f message into a struct
 *
 * @param msg The message to decode
 * @param aq_telemetry_f C-struct to decode the message contents into
 */
static inline void mavlink_msg_aq_telemetry_f_decode(const mavlink_message_t* msg, mavlink_aq_telemetry_f_t* aq_telemetry_f)
{
#if MAVLINK_NEED_BYTE_SWAP
	aq_telemetry_f->value1 = mavlink_msg_aq_telemetry_f_get_value1(msg);
	aq_telemetry_f->value2 = mavlink_msg_aq_telemetry_f_get_value2(msg);
	aq_telemetry_f->value3 = mavlink_msg_aq_telemetry_f_get_value3(msg);
	aq_telemetry_f->value4 = mavlink_msg_aq_telemetry_f_get_value4(msg);
	aq_telemetry_f->value5 = mavlink_msg_aq_telemetry_f_get_value5(msg);
	aq_telemetry_f->value6 = mavlink_msg_aq_telemetry_f_get_value6(msg);
	aq_telemetry_f->value7 = mavlink_msg_aq_telemetry_f_get_value7(msg);
	aq_telemetry_f->value8 = mavlink_msg_aq_telemetry_f_get_value8(msg);
	aq_telemetry_f->value9 = mavlink_msg_aq_telemetry_f_get_value9(msg);
	aq_telemetry_f->value10 = mavlink_msg_aq_telemetry_f_get_value10(msg);
	aq_telemetry_f->value11 = mavlink_msg_aq_telemetry_f_get_value11(msg);
	aq_telemetry_f->value12 = mavlink_msg_aq_telemetry_f_get_value12(msg);
	aq_telemetry_f->value13 = mavlink_msg_aq_telemetry_f_get_value13(msg);
	aq_telemetry_f->value14 = mavlink_msg_aq_telemetry_f_get_value14(msg);
	aq_telemetry_f->value15 = mavlink_msg_aq_telemetry_f_get_value15(msg);
	aq_telemetry_f->value16 = mavlink_msg_aq_telemetry_f_get_value16(msg);
	aq_telemetry_f->value17 = mavlink_msg_aq_telemetry_f_get_value17(msg);
	aq_telemetry_f->value18 = mavlink_msg_aq_telemetry_f_get_value18(msg);
	aq_telemetry_f->value19 = mavlink_msg_aq_telemetry_f_get_value19(msg);
	aq_telemetry_f->value20 = mavlink_msg_aq_telemetry_f_get_value20(msg);
	aq_telemetry_f->Index = mavlink_msg_aq_telemetry_f_get_Index(msg);
#else
	memcpy(aq_telemetry_f, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN);
#endif
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>Redirecting...</title>
<link rel="canonical" href="categories/dotnetCore/">
<meta http-equiv="refresh" content="0; url=categories/dotnetCore/">

Redirecting…

Click here if you are not redirected.


text:
/**
 * No tests yet. just a placeholder.
 */

var file = require('fs-utils');
var anchors = require('../');

// Test setup
var fixtures = 'test/fixtures/html/about.html';
var files = file.expand(fixtures, {filter: 'isFile'});

var a = files.map(function(filepath) {
  var content = file.readFileSync(filepath);
  return anchors(content);
});

console.log(JSON.stringify(a, null, 2));


text:
{{ title }}

{{ if captioned }} {{ captioned }} {{ endif }}

← back to main

  {{ content }}
  {{ email_form subject="Contact Form" to="james@jamescampbell.us" required="name" }}
    {{ if error}}

Error

        {{ errors }}

{{error}}

        {{ /errors }}

    {{ endif }}

    {{ if success }}

Your message has been sent!

    {{ else }}

            Your Name:
            <input type="text" name="name" id="name" value="Bill">

            Your Email:
            <input type="text" name="from" id="from" value="you@you.com">

            Message:
            <input type="text" name="msg_header" id="msg_header" value="hello!">

<input type="submit">

    {{ endif }}
{{ /email_form }}

{{ entries:previous folder="blog" }}
    {{ if !no_results }}

Next Post: {{ title }} ➙

    {{ endif }}
{{ /entries:previous }}

{{ theme:partial src="nav" }}

{{ if show_comments }}

Leave Your Comments

  {{ disqus:comments account="{ disqus_account }" }}

{{ endif }}


text:
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping">
    <entity name="Gedmo\Tests\Mapping\Fixture\Xml\Timestampable" table="timestampables">
        <id name="id" type="integer" column="id">
            <generator strategy="AUTO"/>
        </id>
        <field name="created" type="datetime">
            <gedmo:timestampable on="create"/>
        </field>
        <field name="updated" type="datetime">
            <gedmo:timestampable on="update"/>
        </field>
        <field name="published" type="datetime" nullable="true">
            <gedmo:timestampable on="change" field="status.title" value="Published"/>
        </field>
        <many-to-one field="status" target-entity="Status">
            <join-column name="status_id" referenced-column-name="id"/>
        </many-to-one>
    </entity>
</doctrine-mapping>


text:
.icl-account-setup{
    width:70%;
}
.icl_form_errors{
    border:1px solid #f00;
    background-color: #ffb7b7;
    color:#000;
    width:65%;
    padding: 5px;
    -moz-border-radius-bottomleft:3px;
    -moz-border-radius-bottomright:3px;
    -moz-border-radius-topleft:3px;
    -moz-border-radius-topright:3px;
    border-bottom-left-radius: 3px 3px;
    border-bottom-right-radius: 3px 3px;
    border-top-left-radius: 3px 3px;
    border-top-right-radius: 3px 3px;
}
.icl_form_errors p{
    line-height:1.5;
    margin:0;
}
.icl_form_errors ul{
    list-style: circle;
    margin-left:20px;
}
.icl_form_success{
    border:1px solid #fff;
    background-color: #336600;
    color:#fff;
    padding: 5px;
    -moz-border-radius-bottomleft:5px;
    -moz-border-radius-bottomright:5px;
    -moz-border-radius-topleft:5px;
    -moz-border-radius-topright:5px;
    border-bottom-left-radius: 5px 5px;
    border-bottom-right-radius: 5px 5px;
    border-top-left-radius: 5px 5px;
    border-top-right-radius: 5px 5px;
}
.icl_error_text{
    font-style: italic;
    color:#f00;
}
.icl_valid_text{
    font-style: italic;
    color:#3f7257;
}

.icl_error_input{
    background-color: #FA9393 !important;
}

.icl_ajx_response{
    color:#E68A00;
    display: none;
}

#noupdate_but{
    text-align: center;
}

.icl_yellow_box{
    background-color: #FFFBCC;
    border: 1pt solid #E6DB55;
    padding: 1em;
    margin: 0em;
}

.icl_yellow_box p{
    line-height:normal;
    margin:0 0 5px 0;
}

.icl-admin-message {
	-webkit-border-radius: 3px;
	border-radius: 3px;
	border-width: 1px;
	border-style: solid;
	position: relative;
}

.icl-admin-message-information {
	background-color: #d5e8f9;
	border: 1px solid #9bc8f0;
	padding: 1em;
	margin: 0em;
}

.icl-admin-message-warning {
	background-color: #FFFBCC;
	border: 1pt solid #E6DB55;
	padding: 1em;
	margin: 0em;
}

.icl-admin-message .icl-admin-message-hide {
	position: absolute;
	bottom: 0.25em;
	right: 0.25em;
	display: block;
}

.icl_advanced_switch{
    margin:-10px 0 10px 0;
    font-size:85%;
    text-align:right;
}
.icl_advanced_switch a{
    text-decoration: none;
}
.icl_advanced_feature{
    /*display:none;*/
}

.icl_translations_table{
    border: 1px solid #8CCEEA;
    -moz-border-radius-bottomleft:3px;
    -moz-border-radius-bottomright:3px;
    -moz-border-radius-topleft:3px;
    -moz-border-radius-topright:3px;
}
.icl_translations_table tr.icl_odd_row{background-color:#EFF8FC;}
.icl_translations_table td{font-size: 11px;}

.icl_golden_button{
    background-image:none;
    background-color:#9a841e;
    color:#fff;
    text-shadow:0 1px 0 #000000;
}

.icl_golden_button:hover{
    color:#fff;
    border-color: #000;
}

#icl_post_add_notes h4{
    background: url(../../res/img/notes.png) no-repeat;
    padding: 5px 0 5px 20px;
    margin:10px 0px 0px 0px;
}
#icl_post_add_notes h4 a{
    text-decoration: none;
}
#icl_post_add_notes textarea, .icl_post_note textarea{
    width:100%;
    font-size: 90%;
}
#icl_post_note{
    display: none;
}
#icl_tn_not_saved{
    display: none;
    color:#900;
    text-align: center;
}
.icl_post_note{
    display: none;
}
.icl_tn_progress{
    display: none;
}

.icl_sidebar {
    border: 1px solid #8cceea;
    background-color: #eff8fc;
    display: block;
    float: right;
    -moz-border-radius-bottomleft:5px;
    -moz-border-radius-bottomright:5px;
    -moz-border-radius-topleft:5px;
    -moz-border-radius-topright:5px;
    margin-bottom:10px;
    margin-top:4px;
    padding:3px 10px 3px 9px;
    width:207px;
}

.icl_tick {
    background-image: url(../img/ok.png);
    background-repeat: no-repeat;
    background-position: 0px 3px;
    padding-left:20px;
}

.icl_info {
    background-image: url(../img/sun-solid.png);
    background-repeat: no-repeat;
    background-position: 0px 0px;
    padding-left:20px;
}

.icl_next_step {
    padding-left:20px;
}

.icl_cyan_box{
    border: 1px solid #8cceea;
    background-color: #eff8fc;
    padding:10px;
    margin-bottom:0px;
    margin-top:0px;
    -moz-border-radius-bottomleft:5px;
    -moz-border-radius-bottomright:5px;
    -moz-border-radius-topleft:5px;
    -moz-border-radius-topright:5px;
    border-bottom-left-radius: 5px 5px;
    border-bottom-right-radius: 5px 5px;
    border-top-left-radius: 5px 5px;
    border-top-right-radius: 5px 5px;
}

.icl_cyan_box p{
line-height: 100%; margin: 5px 0;
}
.icl_cyan_box H3 { margin-top: 2px; }

.icl_cyan_box ul{
    margin-top:5px;
    font-size: 11px;
}

.icl_new_feature {
	margin: 5px;
	padding: 3px 5px;
	border-width: 1px;
	border-style: solid;
	-moz-border-radius: 5px;
	-khtml-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
        border-color: #D54E21;
        background-color: #D54E21;
        color: #FFFFFF;
}
.icl_hot_link{
    color:#dd0000;
    font-weight: bold;
}

#icl_pt_controls p{ padding:0; margin: 0 6px 6px 0 !important;}

#icon-wpml{
	background-color: transparent;
	background-repeat: no-repeat;
	background-image: url(../img/icon.png);
}

.wpml-translation-management-menu-main-php .icon32,
.wpml_page_wpml-sticky-links .icon32,
.wpml-string-translation-menu-string-translation-php .icon32,
.wpml-translation-analytics-menu-main-php .icon32,
.wpml-cms-nav-menu-navigation-php .icon32,
.wpml_page_wpml-media .icon32 {
	width: 42px;
}

.wpml-translation-management-menu-main-php #icon-wpml {
	background-image: url(../img/icon-wpml-translation-management.png);
}

.wpml_page_wpml-sticky-links #icon-wpml {
	background-image: url(../img/icon-wpml-sticky-links.png);
}

.wpml-string-translation-menu-string-translation-php #icon-wpml {
	background-image: url(../img/icon-wpml-string-translation.png);
}

.wpml-translation-analytics-menu-main-php #icon-wpml {
	background-image: url(../img/icon-wpml-translation-analytics.png);
}

.wpml-cms-nav-menu-navigation-php #icon-wpml {
	background-image: url(../img/icon-cms-navigation.png);
}

.wpml_page_wpml-media #icon-wpml {
	background-image: url(../img/icon-wpml-media.png);
}

.icon18 {
	background-repeat: no-repeat;
	width: 18px;
	height: 18px;
	display: inline-block;
	margin: 0 4px 0 0;
}

.icon18.sitepress-multilingual-cms,
.icon18.wpml-translation-management,
.icon18.wpml-sticky-links,
.icon18.wpml-string-translation,
.icon18.wpml-cms-nav,
.icon18.wpml-translation-analytics,
.icon18.wpml-xliff,
.icon18.wpml-media
{
	background-image: url(../img/icon16-sprite.png);
}

.icon18.sitepress-multilingual-cms
{
	background-position: 0;
	display: none;
}

.icon18.wpml-translation-analytics
{
	background-position: -2px;
}

.icon18.wpml-translation-management
{
	background-position: -27px;
}

.icon18.wpml-cms-nav
{
	background-position: -48px;
}

.icon18.wpml-xliff
{
	background-position: -71px;
}

.icon18.wpml-sticky-links
{
	background-position: -96px;
}

.icon18.wpml-string-translation
{
	background-position: -118px;
}

.icon18.wpml-media
{
	background-position: -136px;
}

.icon18.woocommerce-multilingual, .icon18.jigoshop-multilingual, .icon18.gravityforms-multilingual, .icon18.cred-frontend-translation, .icon18.installer {
	display: none;
}

/* admin_language_switcher_legacy - start */
.admin_iclflag{
    float:left;
    margin:3px 4px 0 0;
}

#icl-als-first .admin_iclflag{
    margin:2px 4px 0 0;
}

#icl-als-first {
    background: -moz-linear-gradient(center bottom , #E7E7E7, #FFFFFF) repeat scroll 0 0 transparent;
    background:-webkit-gradient(linear, left bottom, left top, from(#e7e7e7), to(#fff));
    border-color: #C0C0C0;
    border-radius: 12px 12px 12px 12px;
    border-style: solid;
    border-width: 1px;
    line-height: 15px;
    padding: 3px 30px 4px 12px;
}
#icl-als-inside {
    background-color: #FFFFFF;
    border-color: #C0C0C0;
    border-radius: 0 0 12px 12px;
    border-style: solid;
    border-width: 1px;
    display: none;
    margin: 0;
    padding: 2px 1px;
    position: absolute;
    /*z-index: 99;    */
}
#icl-als-toggle {
    background: url("../img/fav-arrow.gif") no-repeat scroll 0 -4px transparent;
    height: 22px;
    position: absolute;
    right: 0;
    top: 1px;
    width: 28px;
    /*z-index: 99;*/
}

#icl-als-actions-label{
    float: left;
    margin: 8px 8px 0 12px;
	font-size: 11px;
}

#icl-als-actions{
    float: left;
    margin: 5px -5px 0;
    min-width: 130px;
    position: relative;
}

#icl-als-actions a {
    color: #464646;
    display: block;
    font-size: 11px;
    text-decoration: none;
}
#icl-als-actions a:hover {
    color: #000000;
}

#icl-als-inside a {
    padding: 3px 5px 3px 10px;
}

#icl-als-inside a:hover {
    text-decoration: underline;
}

#icl-als-actions .slide-down {
    border-bottom: medium none;
    border-radius: 12px 12px 0 0;
}

#icl-als-info{
    margin-top:9px;
    margin-left:10px;
    float:left;
    cursor: pointer;
}

/* admin_language_switcher_legacy - end */

#wpml_als_help_link{vertical-align: middle;}
#icl_als_help_popup{position:fixed;top:30px;}

.icl_pop_info_but{
    cursor: pointer;
    position:absolute;
    /*z-index: 99;*/
}

.icl_pop_info_but_noabs{
    position:relative;
}

img.icl_als_iclflag{width:18px !important; height:12px !important;}
#wp-admin-bar-WPML_ALS_all img.icl_als_iclflag{width:16px !important; height:16px !important;}

.icl_pop_info{
    z-index: 900;
    min-width:300px;
    max-width:500px;
    position:absolute;
    margin: 0px 0 0 12px;
    font-size: 11px;
    display: none;
     -moz-opacity:0.85;
     -khtml-opacity: 0.85;
     opacity: 0.85;
     filter:alpha(opacity=85);
     color:#000;
     line-height: 15px;
}

.icl_pop_info img{
    margin: -4px -2px 4px 8px;
}

.icl_pop_info_wrap{
    display:inline;
    text-align: left;
}

.icl_box_paragraph{margin-top:6px;margin-bottom:6px;}
#icl_document_language_dropdown{float:left; }
#icl_translation_of_panel{float:left;}
#icl_translations_table{margin-top:4px;}

.icl_win_controls{
    width:20px;
    text-indent: 9999px;
    float:right;
}
.icl_minimize{background: url(../img/minimize_grey.png) no-repeat;}
.icl_minimize:hover{background: url(../img/minimize.png) no-repeat;}
.icl_maximize{background: url(../img/maximize_grey.png) no-repeat;}
.icl_maximize:hover{background: url(../img/maximize.png) no-repeat;}
.icl_close{background: url(../img/close_grey.png) no-repeat;}
.icl_close:hover{background: url(../img/close.png) no-repeat;}

/* Sections general styles */
.wpml-section .explanation-text {
    color: #999;
}

.wpml-section .sub-section { /* for nested <ul> indetation */
    margin-left: 20px;
}

.wpml-section li {
    margin-bottom: 10px;
}

.wpml-section .icl_ajx_response {
    margin: 0 5px;
}

.wpml-section .icl_languages_order_ajx_resp  {
    color:#E68A00;
    display:inline-block;
    padding-top:5px;
}
/* Sections general styles END */

/* Top navigation */
.wpml-navigation-links {
    margin-bottom: 12px;
    overflow: hidden;
}
    .wpml-navigation-links li {
        float: left;
        margin-right: 10px;
    }
        .wpml-navigation-links li a {
            white-space: nowrap;
        }
/* Top navigation END */

.wpml-section {
    clear: both;
    padding: 0 0 10px 0;
    margin: 30px 0 0 0;
    border-bottom: 1px solid #ededed;
    max-width: 900px;
    overflow: hidden;
}
.wpml-section:first-child {
    margin-top: 0;
}

.wpml-section:last-child {
    border: none;
}

    .wpml-section-header {
        float: left;
        width: 300px;
    }

        .wpml-section-header h3 {
            margin-top: 15px;
            color: #333;
            font-weight: normal;
            font-size: 20px;
            line-height: 20px;

            -webkit-transition: all 0.15s linear;
            -moz-transition: all 0.15s linear;
            -ms-transition: all 0.15s linear;
            -o-transition: all 0.15s linear;
            transition: all 0.15s linear;
        }

        .wpml-section-header .active {
            color: #d54e21;
        }

        .wpml-section-header .icon-question-sign {
            color: #ccc;
            vertical-align: middle;
            font-size: 12px;
            cursor: pointer;
        }

        .wpml-section-header .icon-question-sign:hover {
            color: #007cbd;
            -webkit-transition: all 0.15s linear;
            -moz-transition: all 0.15s linear;
            -ms-transition: all 0.15s linear;
            -o-transition: all 0.15s linear;
            transition: all 0.15s linear;
        }

    .wpml-section-content {
        float: left;
        margin-left: 30px;
        width: 570px;
    }
    .wpml-section-content:before,
    .wpml-section-content:after,
    .wpml-section-content-inner:before,
    .wpml-section-content-inner:after {
        display: table;
        content: " ";
    }

    .wpml-section-content:after,
    .wpml-section-content-inner:after {
        clear: both;
    }

    .wpml-section-content,
    .wpml-section-content-inner {
        *zoom: 1;
    }

        .wpml-section-content .buttons-wrap {
            text-align: right;
        }

        .wpml-section-content .wpml-section-content-inner {
            margin: 0 0 20px 0;
            padding: 0 0 10px 0;
            border-bottom: 1px solid #ededed;
        }
        .wpml-section-content .wpml-section-content-inner:last-child {
            margin: 0;
            padding: 0;
            border: 0;
        }
        .wpml-section-content .wpml-section-content-inner>p:first-child {
           /* margin-top: 0;*/
        }
/* Sections general styles END */

/* reset some styles when wizard is active */
.wpml-wizard .wpml-section {
}
    .wpml-wizard .wpml-section-header,
    .wpml-wizard .wpml-section-content {
        float: none;
        width: auto;
    }
    .wpml-wizard .wpml-section-content {
        margin: 0;
    }


text:
<?php

namespace Oro\Bundle\WorkflowBundle\Model\Condition;

class LessThan extends AbstractComparison
{
    /**
     * Checks that left values is less than right value
     *
     * @param mixed $left
     * @param mixed $right
     * @return boolean
     */
    protected function doCompare($left, $right)
    {
        return $left < $right;
    }
}


text:
local __exports = LibStub:NewLibrary("ovale/PoolGC", 80300)
if not __exports then return end
local __class = LibStub:GetLibrary("tslib").newClass
local __Ovale = LibStub:GetLibrary("ovale/Ovale")
local Print = __Ovale.Print
local tostring = tostring
__exports.OvalePoolGC = __class(nil, {
    constructor = function(self, name)
        self.name = "OvalePoolGC"
        self.size = 0
        self.__index = __exports.OvalePoolGC
        self.name = name
    end,
    Get = function(self)
        self.size = self.size + 1
        return {}
    end,
    Release = function(self, item)
        self:Clean(item)
    end,
    Clean = function(self, item)
    end,
    Drain = function(self)
        self.size = 0
    end,
    DebuggingInfo = function(self)
        Print("Pool %s has size %d.", tostring(self.name), self.size)
    end,
})


text:
@implementation FJLoginButton
-(void)awakeFromNib{
    //设置按钮文字居中
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
}

-(void)layoutSubviews{
    [super layoutSubviews];

    self.imageView.centerX = self.width * 0.5;
    self.imageView.y = 0;

//    self.titleLabel.centerX = self.width * 0.5;
    self.titleLabel.x = 0;
    self.titleLabel.y = CGRectGetMaxY(self.imageView.frame) + 5;
    self.titleLabel.width = self.width;
    //设置按钮文字居中
//    self.titleLabel.textAlignment = NSTextAlignmentCenter;
//    [self.titleLabel sizeToFit];

}

//- (CGRect)imageRectForContentRect:(CGRect)contentRect{
//    return CGRectMake(0, 0, self.width, contentRect.size.height);
//}
//
//- (CGRect)titleRectForContentRect:(CGRect)contentRect{
//    return CGRectMake(0, CGRectGetMaxY(self.imageView.frame) + 5, self.width, self.height);
//}
@end


text:
using System;
using System.Collections.Generic;
using System.IO;

namespace Psybot.Data
{
    internal sealed class IniReader
    {
        private readonly string iniFile;

        /// <summary> ini data: [section][key][value] </summary>
        public readonly Dictionary<string, Dictionary<string, List<string>>> IniData;

        public IniReader(string iniFile)
        {
            this.iniFile = iniFile;
            IniData = new Dictionary<string, Dictionary<string, List<string>>>();
        }

        public void LoadFile()
        {
            IniData.Clear();
            string[] txt = File.ReadAllLines(iniFile);
            string currentSections = null;

            for (int i = 0; i < txt.Length; i++)
            {
                if (string.IsNullOrWhiteSpace(txt[i]) || txt[i].StartsWith(";"))
                    continue;

                if (txt[i].StartsWith("[") && txt[i].EndsWith("]"))
                {
                    // [section]

                    currentSections = txt[i].Replace("[", string.Empty).Replace("]", string.Empty);
                    IniData.Add(currentSections, new Dictionary<string, List<string>>());
                }
                else if (txt[i].Contains("="))
                {
                    // key = value

                    if (currentSections == null)
                        throw new NullReferenceException("Missing section.");

                    string[] spl = txt[i].Split(new[]{'='}, 2);
                    spl[0] = spl[0].Trim();
                    spl[1] = spl[1].Trim();

                    if (IniData[currentSections] == null)
                    {
                        IniData[currentSections] = new Dictionary<string, List<string>>();
                        IniData[currentSections].Add(spl[0], new List<string>());
                    }
                    else if (!IniData[currentSections].ContainsKey(spl[0]))
                    {
                        IniData[currentSections].Add(spl[0], new List<string>());
                    }

                    IniData[currentSections][spl[0]].Add(spl[1]);
                }
            }

        }

    }
}


text:
/**
* File: MovableText.h
*
* description: This create create a billboarding object that display a text.
*
* @author	2003 by cTh see gavocanov@rambler.ru
* @update	2006 by barraq see nospam@barraquand.com
* @update	2012 to work with newer versions of OGRE by MindCalamity <mindcalamity@gmail.com>
*	- See "Notes" on: http://www.ogre3d.org/tikiwiki/tiki-editpage.php?page=MovableText
*/

#include <OgreRenderable.h>
#include <OgreMovableObject.h>

#include <Overlay\include\OgreFontManager.h>

#ifndef __include_MovableText_H__
#define __include_MovableText_H__

namespace Ogre {

	class MovableText : public MovableObject, public Renderable
	{
		/******************************** MovableText data ****************************/
	public:
		enum HorizontalAlignment    {H_LEFT, H_CENTER};
		enum VerticalAlignment      {V_BELOW, V_ABOVE, V_CENTER};

	protected:
		String					mFontName;
		String					mType;
		String					mName;
		String					mCaption;
		HorizontalAlignment		mHorizontalAlignment;
		VerticalAlignment		mVerticalAlignment;

		ColourValue				mColor;
		RenderOperation			mRenderOp;
		AxisAlignedBox			mAABB;
		LightList				mLList;

		Real					mCharHeight;
		Real					mSpaceWidth;

		bool					mNeedUpdate;
		bool					mUpdateColors;
		bool					mOnTop;

		Real					mTimeUntilNextToggle;
		Real					mRadius;

		Vector3					mGlobalTranslation;
		Vector3					mLocalTranslation;

		Camera					*mpCam;
		RenderWindow			*mpWin;
		Font					*mpFont;
		MaterialPtr				mpMaterial;
		MaterialPtr				mpBackgroundMaterial;

		/******************************** public methods ******************************/
	public:
		MovableText(const String &name, const String &caption, const String &fontName = "bluehigh", Real charHeight = 1.0, const ColourValue &color = ColourValue::Red);
		virtual ~MovableText();

		// Add to build on Shoggoth:
		virtual void				visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables = false);

		// Set settings
		void						setFontName(const String &fontName);
		void						setCaption(const String &caption);
		void						setColor(const ColourValue &color);
		void						setCharacterHeight(Real height);
		void						setSpaceWidth(Real width);
		void						setTextAlignment(const HorizontalAlignment& horizontalAlignment, const VerticalAlignment& verticalAlignment);
		void						setGlobalTranslation( Vector3 trans );
		void						setLocalTranslation( Vector3 trans );
		void						showOnTop(bool show=true);

		// Get settings
		const   String				&getFontName()	const {return mFontName;}
		const   String				&getCaption()	const {return mCaption;}
		ColourValue			&getColor()		 {return mColor;}

		Real						getCharacterHeight() const {return mCharHeight;}
		Real						getSpaceWidth() const {return mSpaceWidth;}
		Vector3						getGlobalTranslation() const {return mGlobalTranslation;}
		Vector3						getLocalTranslation() const {return mLocalTranslation;}
		bool						getShowOnTop() const {return mOnTop;}
		AxisAlignedBox				GetAABB(void) { return mAABB; }

		/******************************** protected methods and overload **************/
	protected:

		// from MovableText, create the object
		void						_setupGeometry();
		void						_updateColors();

		// from MovableObject
		void						getWorldTransforms(Matrix4 *xform) const;
		Real						getBoundingRadius(void) const {return mRadius;};
		Real						getSquaredViewDepth(const Camera *cam) const {return 0;};
		const   Quaternion			&getWorldOrientation(void) const;
		const   Vector3				&getWorldPosition(void) const;
		const   AxisAlignedBox		&getBoundingBox(void) const {return mAABB;};
		const   String				&getName(void) const {return mName;};
		const   String				&getMovableType(void) const {static Ogre::String movType = "MovableText"; return movType;};

		void						_notifyCurrentCamera(Camera *cam);
		void						_updateRenderQueue(RenderQueue* queue);

		// from renderable
		void						getRenderOperation(RenderOperation &op);
		const   MaterialPtr			&getMaterial(void) const {assert(!mpMaterial.isNull());return mpMaterial;};
		const   LightList			&getLights(void) const {return mLList;};
	};

} //end namespace Ogre

#endif


text:
class CasesScreenStylesheet < ApplicationStylesheet
  # Add your view stylesheets here. You can then override styles if needed,
  # example: include FooStylesheet

  def setup
    # Add sytlesheet specific setup stuff here.
    # Add application specific setup stuff in application_stylesheet.rb
  end

  def root_view(st)
    st.background_color = color.white
  end
end


text:
// Copyright (c) 2015 fjz13. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#include "MedusaPreCompiled.h"
#include "Node/Action/Timeline/TextureFileIdTimeline.h"
#include "Node/INode.h"
#include "Resource/Timeline/TextureFileIdTimelineModel.h"
#include "Rendering/RenderingObjectFactory.h"

MEDUSA_BEGIN;

TextureFileIdTimeline::TextureFileIdTimeline(const Share<TextureFileIdTimelineModel>& model, bool isRepeatForever, float beforeDelay /*= 0.f*/, float repeatDuration /*= 0.f*/, float afterDelay /*= 0.f*/, const StringRef& name /*= StringRef::Empty*/)
	: ITimeline(model, isRepeatForever, beforeDelay, repeatDuration, afterDelay, name)
{

}

TextureFileIdTimeline::TextureFileIdTimeline(const Share<TextureFileIdTimelineModel>& model, intp repeatCount, float beforeDelay /*= 0.f*/, float repeatDuration /*= 0.f*/, float afterDelay /*= 0.f*/, const StringRef& name /*= StringRef::Empty*/)
	: ITimeline(model, repeatCount, beforeDelay, repeatDuration, afterDelay, name)
{

}

TextureFileIdTimeline::~TextureFileIdTimeline()
{
}

bool TextureFileIdTimeline::OnUpdate(float prevElapsed,float dt, float blend /*= 1.f*/)
{
	auto model = mModel.CastPtr<TextureFileIdTimelineModel>();

	FileIdRef fileId = model->GetFileId(Elapsed());

	auto renderingObject = RenderingObjectFactory::Instance().CreateFromTexture(fileId);
	INode* node = (INode*)mTarget;
	node->SetRenderingObject(renderingObject);
	return true;
}

MEDUSA_END;


text:
define(
  'tinymce.plugins.textpattern.core.KeyHandler',
  [
    'tinymce.core.util.VK',
    'tinymce.plugins.textpattern.core.Formatter'
  ],
  function (VK, Formatter) {
    function handleEnter(editor, patterns) {
      var wrappedTextNode, rng;

      wrappedTextNode = Formatter.applyInlineFormatEnter(editor, patterns);
      if (wrappedTextNode) {
        rng = editor.dom.createRng();
        rng.setStart(wrappedTextNode, wrappedTextNode.data.length);
        rng.setEnd(wrappedTextNode, wrappedTextNode.data.length);
        editor.selection.setRng(rng);
      }

      Formatter.applyBlockFormat(editor, patterns);
    }

    function handleInlineKey(editor, patterns) {
      var wrappedTextNode, lastChar, lastCharNode, rng, dom;

      wrappedTextNode = Formatter.applyInlineFormatSpace(editor, patterns);
      if (wrappedTextNode) {
        dom = editor.dom;
        lastChar = wrappedTextNode.data.slice(-1);

        // Move space after the newly formatted node
        if (/[\u00a0 ]/.test(lastChar)) {
          wrappedTextNode.deleteData(wrappedTextNode.data.length - 1, 1);
          lastCharNode = dom.doc.createTextNode(lastChar);

          dom.insertAfter(lastCharNode, wrappedTextNode.parentNode);

          rng = dom.createRng();
          rng.setStart(lastCharNode, 1);
          rng.setEnd(lastCharNode, 1);
          editor.selection.setRng(rng);
        }
      }
    }

    var checkKeyEvent = function (codes, event, predicate) {
      for (var i = 0; i < codes.length; i++) {
        if (predicate(codes[i], event)) {
          return true;
        }
      }
    };

    var checkKeyCode = function (codes, event) {
      return checkKeyEvent(codes, event, function (code, event) {
        return code === event.keyCode && VK.modifierPressed(event) === false;
      });
    };

    var checkCharCode = function (chars, event) {
      return checkKeyEvent(chars, event, function (chr, event) {
        return chr.charCodeAt(0) === event.charCode;
      });
    };

    return {
      handleEnter: handleEnter,
      handleInlineKey: handleInlineKey,
      checkCharCode: checkCharCode,
      checkKeyCode: checkKeyCode
    };
  }
);


text:
-v seq_detect.syn.v
+ncaccess+rwc
seq_detectortb2.v


text:
var batchdb = require('../');
var db = require('level')('/tmp/compute.db');
var compute = batchdb(db, { path: '/tmp/compute.blobs' });

compute.list('pending').on('data', console.log);


text:
package com.ibm.ws.lars.rest;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URI;
import java.util.Arrays;

import javax.ws.rs.core.UriInfo;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import com.ibm.ws.lars.rest.exceptions.AssetPersistenceException;
import com.ibm.ws.lars.rest.exceptions.InvalidIdException;
import com.ibm.ws.lars.rest.exceptions.InvalidJsonAssetException;
import com.ibm.ws.lars.rest.exceptions.NonExistentArtefactException;
import com.ibm.ws.lars.rest.injection.AssetServiceLayerInjection;
import com.ibm.ws.lars.rest.model.Asset;
import com.ibm.ws.lars.rest.model.AssetCursor;
import com.ibm.ws.lars.rest.model.Attachment;
import com.ibm.ws.lars.rest.model.RepositoryObject;
import com.ibm.ws.lars.rest.model.RepositoryResourceLifecycleException;
import com.ibm.ws.lars.testutils.BasicChecks;

/**
 *
 */
public class AssetServiceLayerTest {

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    private static final String TEST_USERNAME = "testUser";
    private Asset simpleObject;
    private Asset assetWithState;
    // private Asset complexObject;
    private Attachment attachmentWithContent;
    private byte[] attachmentContent;
    private UriInfo dummyUriInfo;

    private AssetServiceLayer service;
    Persistor memoryPersistor = new MemoryPersistor();

    @Before
    public void setUp() throws Exception {
        assetWithState = Asset.deserializeAssetFromJson("{\"state\":\"published\",\"name\":\"foo\"}");
        // complexObject = Asset.deserializeAssetFromJson("{\"state\":\"draft\",\"name\":\"foo\", \"arrayField\": " + jsonArray + "}");
        simpleObject = Asset.deserializeAssetFromJson("{\"name\":\"foo\"}");

        attachmentWithContent = Attachment.jsonToAttachment("{\"aField\":\"foo\"}");
        attachmentContent = "I am some very simple content for the attachment!".getBytes();

        service = new AssetServiceLayer();

        AssetServiceLayerInjection.setConfiguration(service, new Configuration());
        AssetServiceLayerInjection.setPersistenceBean(service, memoryPersistor);

        dummyUriInfo = new DummyUriInfo(new URI("http://localhost:9080/ma/v1/"));

    }

    @Test
    public void badStateTransitionTest() throws InvalidJsonAssetException, NonExistentArtefactException, RepositoryResourceLifecycleException {
        thrown.expect(RepositoryResourceLifecycleException.class);
        thrown.expectMessage("Invalid action approve performed on the asset with state draft");
        Asset simpleAsset = service.createAsset(simpleObject, TEST_USERNAME);
        service.updateAssetState(Asset.StateAction.APPROVE, simpleAsset.get_id());
    }

    @Test
    public void lifeCycleTest() throws Exception {
        Asset asset = service.createAsset(assetWithState, TEST_USERNAME);
        assertEquals("State should have been overwritten with draft", "draft", asset.getProperty("state"));
        // TODO: Is it possible to check the actual date is correct?
        assertNotNull("created date should not be null", asset.getCreatedOn());
        String lastUpdated = asset.getLastUpdatedOn();
        assertNotNull("updated date should not be null", lastUpdated);
        assertEquals("CreatedBy user is wrong", TEST_USERNAME, asset.getCreatedBy());

        String id = asset.get_id();
        Asset gotAsset = service.retrieveAsset(id, dummyUriInfo);
        assertEquals("The id of the asset has changed", id, gotAsset.get_id());

        AssetCursor assets = service.retrieveAllAssets();
        assertEquals("Too many assets", 1, assets.size());

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // do nothing. Just to make sure the time stamp is different after the update
        }
        service.updateAssetState(Asset.StateAction.PUBLISH, id);
        Asset updatedAsset = service.retrieveAsset(id, dummyUriInfo);
        assertEquals("Wrong state", Asset.State.AWAITING_APPROVAL, updatedAsset.getState());
        String newUpdatedDate = updatedAsset.getLastUpdatedOn();
        assertFalse("The last updated date should have been updated", lastUpdated.equals(newUpdatedDate));

        Asset simpleAsset = service.createAsset(simpleObject, TEST_USERNAME);
        Asset simpleGotAsset = service.retrieveAsset(simpleAsset.get_id(), dummyUriInfo);
        assertEquals("Wrong state", Asset.State.DRAFT, simpleGotAsset.getState());

        AssetCursor lotsOfAssets = service.retrieveAllAssets();
        assertEquals("Wrong number of assets found", 2, lotsOfAssets.size());

        service.deleteAsset(id);
        service.deleteAsset(simpleGotAsset.get_id());

        AssetCursor emptyAssets = service.retrieveAllAssets();
        assertEquals("There should be no assets stored", 0, emptyAssets.size());
    }

    /**
     * Tests creating and retrieving an attachment with no content.
     */
    @Test
    public void testAddAttachmentNoContent() throws Exception {

        String attachmentJSON = "{\"url\":\"http://example.com\", \"linkType\":\"direct\"}";

        Asset asset = Asset.deserializeAssetFromJson("{\"name\":\"Mr Asset\"}");
        Asset returnedAsset = service.createAsset(asset, TEST_USERNAME);
        Attachment unalteredAttachment = Attachment.jsonToAttachment(attachmentJSON);
        Attachment attachment = Attachment.jsonToAttachment(attachmentJSON);

        Attachment returnedAttachment = service.createAttachmentNoContent(returnedAsset.get_id(), "Mr Attachment", attachment, dummyUriInfo);
        assertEquals("Attachment should have assetId set correctly", returnedAsset.get_id(), returnedAttachment.getAssetId());

        returnedAttachment.getProperties().remove(Attachment.ASSET_ID);
        assertNull("Attachment with no uploaded content should not have any data stored in gridFS", returnedAttachment.getGridFSId());

        assertNotNull("Attachment should have an id", returnedAttachment.get_id());
        returnedAttachment.getProperties().remove(RepositoryObject._ID);

        assertNotNull("Attachment should have uploadOn", returnedAttachment.getUploadOn());
        returnedAttachment.getProperties().remove(Attachment.UPLOAD_ON);

        assertEquals("Attachment should have the specified name", "Mr Attachment", returnedAttachment.getName());
        returnedAttachment.getProperties().remove(Attachment.NAME);

        assertEquals(unalteredAttachment, returnedAttachment);
    }

    /**
     * Verifies that an exception is thrown when we attachment to create an attachment with no
     * content and no url.
     */
    @Test
    public void testAddAttachmentNoContentNoUrl() throws InvalidJsonAssetException, AssetPersistenceException, NonExistentArtefactException {
        thrown.expect(InvalidJsonAssetException.class);
        thrown.expectMessage("The URL of the supplied attachment was null");
        String attachmentJSON = "{\"foo\":\"bar\"}";
        Asset asset = Asset.deserializeAssetFromJson("{\"name\":\"Mr Asset\"}");
        Asset returnedAsset = service.createAsset(asset, TEST_USERNAME);
        Attachment attachment = Attachment.jsonToAttachment(attachmentJSON);
        service.createAttachmentNoContent(returnedAsset.get_id(), "Mr Attachment", attachment, dummyUriInfo);
    }

    /**
     * Verifies that an exception is thrown when we attachment to create an attachment with no
     * content and no linkType.
     */
    @Test
    public void testAddAttachmentNoContentNoLinkType() throws InvalidJsonAssetException, AssetPersistenceException, NonExistentArtefactException {
        thrown.expect(InvalidJsonAssetException.class);
        thrown.expectMessage("The link type for the attachment was not set.");
        String attachmentJSON = "{\"url\":\"http://example.com\"}";
        Asset asset = Asset.deserializeAssetFromJson("{\"name\":\"Mr Asset\"}");
        Asset returnedAsset = service.createAsset(asset, TEST_USERNAME);
        Attachment attachment = Attachment.jsonToAttachment(attachmentJSON);
        service.createAttachmentNoContent(returnedAsset.get_id(), "Mr Attachment", attachment, dummyUriInfo);
    }

    /**
     * Verifies that an exception is thrown when we attempt to create an attachment with no content
     * and a linkType that is not valid.
     */
    @Test
    public void testAddAttachmentNoContentBadLinkType() throws InvalidJsonAssetException, AssetPersistenceException, NonExistentArtefactException {
        thrown.expect(InvalidJsonAssetException.class);
        thrown.expectMessage("The link type for the attachment was set to an invalid value: Foobar");
        String attachmentJSON = "{\"url\":\"http://example.com\"}";
        Asset asset = Asset.deserializeAssetFromJson("{\"name\":\"Mr Asset\"}");
        Asset returnedAsset = service.createAsset(asset, TEST_USERNAME);
        Attachment attachment = Attachment.jsonToAttachment(attachmentJSON);
        attachment.setLinkType("Foobar");
        service.createAttachmentNoContent(returnedAsset.get_id(), "Mr Attachment", attachment, dummyUriInfo);
    }

    /**
     * Tests creating and retrieving an attachment with content.
     */
    @Test
    public void testAddAttachmentWithContent() throws Exception {
        Asset assetToCreate = new Asset(simpleObject);
        Asset returnedAsset = service.createAsset(assetToCreate, TEST_USERNAME);

        Attachment attachmentToCreate = new Attachment(attachmentWithContent);

        Attachment createdAttachment = service.createAttachmentWithContent(returnedAsset.get_id(),
                                                                           "AttachmentWithContent.txt",
                                                                           attachmentToCreate,
                                                                           "text/plain",
                                                                           new ByteArrayInputStream(attachmentContent),
                                                                           dummyUriInfo);

        Attachment returnedAttachment = service.retrieveAttachmentMetadata(returnedAsset.get_id(), createdAttachment.get_id(), dummyUriInfo);

        assertEquals("Attachment with content should have correct URL", "http://localhost:9080/ma/v1/assets/" + returnedAsset.get_id() +
                                                                        "/attachments/" + returnedAttachment.get_id() + "/" +
                                                                        "AttachmentWithContent.txt",
                     returnedAttachment.getUrl());
        returnedAttachment.getProperties().remove(Attachment.URL);

        assertEquals("Attachment should have assetId set correctly", returnedAsset.get_id(), returnedAttachment.getAssetId());
        returnedAttachment.getProperties().remove(Attachment.ASSET_ID);

        assertNotNull("Attachment should have an id", returnedAttachment.get_id());
        returnedAttachment.getProperties().remove(RepositoryObject._ID);

        assertEquals("Attachment should have the correct name", "AttachmentWithContent.txt", returnedAttachment.getName());
        returnedAttachment.getProperties().remove(Attachment.NAME);

        assertNotNull("Attachment should have uploadOn", returnedAttachment.getUploadOn());
        returnedAttachment.getProperties().remove(Attachment.UPLOAD_ON);

        assertEquals("Attachment should have contentType set correctly", "text/plain", returnedAttachment.getContentType());
        returnedAttachment.getProperties().remove(Attachment.CONTENT_TYPE);

        assertNotNull("Attachment should have gridFSId", returnedAttachment.getGridFSId());
        returnedAttachment.getProperties().remove(Attachment.GRIDFS_ID);

        assertEquals("Attachment should have correct size", attachmentContent.length, returnedAttachment.getSize());
        returnedAttachment.getProperties().remove(Attachment.SIZE);

        assertEquals("Returned attachment should have same contents that were POSTed", attachmentWithContent, returnedAttachment);

        try (InputStream is = service.retrieveAttachmentContent(returnedAsset.get_id(), createdAttachment.get_id(), "AttachmentWithContent.txt", dummyUriInfo)
                .getContentStream()) {
            byte[] returnedContent = BasicChecks.slurp(is);
            assertTrue(Arrays.equals(attachmentContent, returnedContent));
        }

        Asset fetchedAsset = service.retrieveAsset(returnedAsset.get_id(), dummyUriInfo);
        assertEquals(fetchedAsset.getAttachments().get(0), createdAttachment);
    }

    /**
     * Verifies that an exceptino is thrown when we attempt to create an attachment that has both
     * content and a url.
     */
    @Test
    public void testAddAttachmentWithContentAndUrl() throws Exception {

        thrown.expect(InvalidJsonAssetException.class);
        thrown.expectMessage("An attachment should not have the URL set if it is created with content");

        Asset assetToCreate = new Asset(simpleObject);
        Asset returnedAsset = service.createAsset(assetToCreate, TEST_USERNAME);
        Attachment attachmentToCreate = new Attachment(attachmentWithContent);
        attachmentToCreate.setUrl("foobar");
        service.createAttachmentWithContent(returnedAsset.get_id(), "AttachmentWithContent.txt", attachmentToCreate, "text/plain",
                                            new ByteArrayInputStream(attachmentContent), dummyUriInfo);
    }

    /**
     * Verifies that an exception is thrown when we attempt to create an attachment with both
     * content and a linkType.
     */
    @Test
    public void testAddAttachmentWithContentAndLinkType() throws Exception {

        thrown.expect(InvalidJsonAssetException.class);
        thrown.expectMessage("The link type must not be set for an attachment with content");

        Asset assetToCreate = new Asset(simpleObject);
        Asset returnedAsset = service.createAsset(assetToCreate, TEST_USERNAME);
        Attachment attachmentToCreate = new Attachment(attachmentWithContent);
        attachmentToCreate.setLinkType("foobar");
        service.createAttachmentWithContent(returnedAsset.get_id(), "AttachmentWithContent.txt", attachmentToCreate, "text/plain",
                                            new ByteArrayInputStream(attachmentContent), dummyUriInfo);
    }

    /**
     * Tests that an exception is thrown if an attachment is created with an invalid parent asset
     * id.
     *
     * @throws InvalidJsonAssetException
     * @throws NonExistentArtefactException
     * @throws AssetPersistenceException
     */
    @Test
    public void testAddAttachmentInvalidAssetId() throws InvalidJsonAssetException, NonExistentArtefactException, AssetPersistenceException {
        thrown.expect(NonExistentArtefactException.class);
        thrown.expectMessage("The parent asset for this attachment (id=FFFFFFFFFFFFFFFF) does not exist in the repository.");
        String attachmentJSON = "{\"url\":\"http://example.com\", \"linkType\":\"direct\"}";
        Attachment attachment = Attachment.jsonToAttachment(attachmentJSON);
        service.createAttachmentNoContent("FFFFFFFFFFFFFFFF", "Mr Attachment", attachment, dummyUriInfo);
    }

    /**
     * Verifies that an exception is thrown when we attempt to retrieve an asset that does not
     * exist.
     */
    @Test(expected = NonExistentArtefactException.class)
    public void testRetrieveNonExistentAsset() throws NonExistentArtefactException {
        service.retrieveAsset("0123456789", dummyUriInfo);
    }

    /**
     * Verifies that an exception is thrown when we attempt to retrieve an attachment that does not
     * exist.
     */
    @Test(expected = NonExistentArtefactException.class)
    public void testRetrieveNonExistentAttachment() throws NonExistentArtefactException, InvalidIdException {
        service.retrieveAttachmentMetadata("01234", "67864", dummyUriInfo);
    }

    @Test(expected = NonExistentArtefactException.class)
    public void testRetrieveNonExistentAttachmentContent() throws NonExistentArtefactException, InvalidIdException {
        service.retrieveAttachmentContent("01234", "67864", "a name that does not exist.", dummyUriInfo);
    }
}


text:
package com.francelabs.datafari.servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Search
 */
@WebServlet("/Search")
public class Search extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public Search() {
		super();

	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	@Override
	protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
			throws ServletException, IOException {
		String redirectUrl = "/searchView.jsp";

		if (request.getParameter("source") != null && !request.getParameter("source").equals("all")) {
			redirectUrl = "/searchView- " + request.getParameter("source") + ".jsp";
		}

		final RequestDispatcher rd = request.getRequestDispatcher(redirectUrl);
		rd.forward(request, response);
	}

	@Override
	protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
			throws ServletException, IOException {
		String redirectUrl = "/searchView.jsp";

		if (request.getParameter("source") != null && !request.getParameter("source").equals("all")) {
			redirectUrl = "/searchView- " + request.getParameter("source") + ".jsp";
		}

		final RequestDispatcher rd = request.getRequestDispatcher(redirectUrl);
		rd.forward(request, response);
	}

}


text:
import { config } from '@grafana/runtime';

import { isGUIDish } from './components/ResourcePicker/utils';
import DataSource from './datasource';
import { AzureMonitorQuery, AzureQueryType } from './types';
import {
  AppInsightsGroupByQuery,
  AppInsightsMetricNameQuery,
  GrafanaTemplateVariableQuery,
  MetricNamespaceQuery,
  MetricNamesQuery,
  ResourceGroupsQuery,
  ResourceNamesQuery,
  SubscriptionsQuery,
  WorkspacesQuery,
} from './types/templateVariables';

/*
  Grafana Template Variable Functions
  ex: Subscriptions()

  These are helper functions we have created and exposed to users to make the writing of template variables easier.
  Due to legacy reasons, we still need to parse strings to determine if a query is a Grafana Template Variable Function
  or if it's a KQL-type query
*/

export const grafanaTemplateVariableFnMatches = (query: string) => {
  return {
    subscriptions: query.match(/^Subscriptions\(\)/i),
    resourceGroups: query.match(/^ResourceGroups\(\)/i),
    resourceGroupsWithSub: query.match(/^ResourceGroups\(([^\)]+?)(,\s?([^,]+?))?\)/i),
    namespaces: query.match(/^Namespaces\(([^\)]+?)(,\s?([^,]+?))?\)/i),
    namespacesWithSub: query.match(/^Namespaces\(([^,]+?),\s?([^,]+?)\)/i),
    resourceNames: query.match(/^ResourceNames\(([^,]+?),\s?([^,]+?)\)/i),
    resourceNamesWithSub: query.match(/^ResourceNames\(([^,]+?),\s?([^,]+?),\s?(.+?)\)/i),
    metricNamespace: query.match(/^MetricNamespace\(([^,]+?),\s?([^,]+?),\s?([^,]+?)\)/i),
    metricNamespaceWithSub: query.match(/^metricnamespace\(([^,]+?),\s?([^,]+?),\s?([^,]+?),\s?([^,]+?)\)/i),
    metricNames: query.match(/^MetricNames\(([^,]+?),\s?([^,]+?),\s?([^,]+?),\s?([^,]+?)\)/i),
    metricNamesWithSub: query.match(/^MetricNames\(([^,]+?),\s?([^,]+?),\s?([^,]+?),\s?([^,]+?),\s?(.+?)\)/i),
    appInsightsMetricNameQuery: query.match(/^AppInsightsMetricNames\(\)/i),
    appInsightsGroupByQuery: query.match(/^AppInsightsGroupBys\(([^\)]+?)(,\s?([^,]+?))?\)/i),
    workspacesQuery: query.match(/^workspaces\(\)/i),
    workspacesQueryWithSub: query.match(/^workspaces\(["']?([^\)]+?)["']?\)/i),
  };
};

const isGrafanaTemplateVariableFnQuery = (query: string) => {
  const matches: Record<string, RegExpMatchArray | null> = grafanaTemplateVariableFnMatches(query);
  return Object.keys(matches).some((key) => !!matches[key]);
};

const createGrafanaTemplateVariableQuery = (rawQuery: string, datasource: DataSource): AzureMonitorQuery => {
  const matchesForQuery = grafanaTemplateVariableFnMatches(rawQuery);
  const defaultSubscriptionId = datasource.azureMonitorDatasource.defaultSubscriptionId;
  const createGrafanaTemplateVariableDetails = (): GrafanaTemplateVariableQuery => {
    // deprecated app insights template variables (will most likely remove in grafana 9)
    if (matchesForQuery.appInsightsMetricNameQuery) {
      const queryDetails: AppInsightsMetricNameQuery = { rawQuery, kind: 'AppInsightsMetricNameQuery' };
      return queryDetails;
    }

    if (matchesForQuery.appInsightsGroupByQuery) {
      const queryDetails: AppInsightsGroupByQuery = {
        kind: 'AppInsightsGroupByQuery',
        rawQuery,
        metricName: matchesForQuery.appInsightsGroupByQuery[1],
      };
      return queryDetails;
    }

    if (matchesForQuery.subscriptions) {
      const queryDetails: SubscriptionsQuery = {
        kind: 'SubscriptionsQuery',
        rawQuery,
      };
      return queryDetails;
    }

    if (matchesForQuery.resourceGroupsWithSub) {
      const queryDetails: ResourceGroupsQuery = {
        kind: 'ResourceGroupsQuery',
        rawQuery,
        subscription: matchesForQuery.resourceGroupsWithSub[1],
      };
      return queryDetails;
    }

    if (matchesForQuery.resourceGroups && defaultSubscriptionId) {
      const queryDetails: ResourceGroupsQuery = {
        kind: 'ResourceGroupsQuery',
        rawQuery,
        subscription: defaultSubscriptionId,
      };
      return queryDetails;
    }

    if (matchesForQuery.namespacesWithSub) {
      const queryDetails: MetricNamespaceQuery = {
        kind: 'MetricNamespaceQuery',
        rawQuery,
        subscription: matchesForQuery.namespacesWithSub[1],
        resourceGroup: matchesForQuery.namespacesWithSub[2],
      };
      return queryDetails;
    }

    if (matchesForQuery.namespaces && defaultSubscriptionId) {
      const queryDetails: MetricNamespaceQuery = {
        kind: 'MetricNamespaceQuery',
        rawQuery,
        subscription: defaultSubscriptionId,
        resourceGroup: matchesForQuery.namespaces[1],
      };
      return queryDetails;
    }

    if (matchesForQuery.resourceNamesWithSub) {
      const queryDetails: ResourceNamesQuery = {
        kind: 'ResourceNamesQuery',
        rawQuery,
        subscription: matchesForQuery.resourceNamesWithSub[1],
        resourceGroup: matchesForQuery.resourceNamesWithSub[2],
        metricNamespace: matchesForQuery.resourceNamesWithSub[3],
      };
      return queryDetails;
    }

    if (matchesForQuery.resourceNames && defaultSubscriptionId) {
      const queryDetails: ResourceNamesQuery = {
        kind: 'ResourceNamesQuery',
        rawQuery,
        subscription: defaultSubscriptionId,
        resourceGroup: matchesForQuery.resourceNames[1],
        metricNamespace: matchesForQuery.resourceNames[2],
      };
      return queryDetails;
    }

    if (matchesForQuery.metricNamespaceWithSub) {
      const queryDetails: MetricNamespaceQuery = {
        kind: 'MetricNamespaceQuery',
        rawQuery,
        subscription: matchesForQuery.metricNamespaceWithSub[1],
        resourceGroup: matchesForQuery.metricNamespaceWithSub[2],
        metricNamespace: matchesForQuery.metricNamespaceWithSub[3],
        resourceName: matchesForQuery.metricNamespaceWithSub[4],
      };
      return queryDetails;
    }

    if (matchesForQuery.metricNamespace && defaultSubscriptionId) {
      const queryDetails: MetricNamespaceQuery = {
        kind: 'MetricNamespaceQuery',
        rawQuery,
        subscription: defaultSubscriptionId,
        resourceGroup: matchesForQuery.metricNamespace[1],
        metricNamespace: matchesForQuery.metricNamespace[2],
        resourceName: matchesForQuery.metricNamespace[3],
      };
      return queryDetails;
    }

    if (matchesForQuery.metricNames && defaultSubscriptionId) {
      if (matchesForQuery.metricNames[3].indexOf(',') === -1) {
        const queryDetails: MetricNamesQuery = {
          kind: 'MetricNamesQuery',
          rawQuery,
          subscription: defaultSubscriptionId,
          resourceGroup: matchesForQuery.metricNames[1],
          metricNamespace: matchesForQuery.metricNames[2],
          resourceName: matchesForQuery.metricNames[3],
        };
        return queryDetails;
      }
    }

    if (matchesForQuery.metricNamesWithSub) {
      const queryDetails: MetricNamesQuery = {
        kind: 'MetricNamesQuery',
        rawQuery,
        subscription: matchesForQuery.metricNamesWithSub[1],
        resourceGroup: matchesForQuery.metricNamesWithSub[2],
        metricNamespace: matchesForQuery.metricNamesWithSub[3],
        resourceName: matchesForQuery.metricNamesWithSub[4],
      };
      return queryDetails;
    }

    if (matchesForQuery.workspacesQueryWithSub) {
      const queryDetails: WorkspacesQuery = {
        kind: 'WorkspacesQuery',
        rawQuery,
        subscription: (matchesForQuery.workspacesQueryWithSub[1] || '').trim(),
      };
      return queryDetails;
    }

    if (matchesForQuery.workspacesQuery && defaultSubscriptionId) {
      const queryDetails: WorkspacesQuery = {
        kind: 'WorkspacesQuery',
        rawQuery,
        subscription: defaultSubscriptionId,
      };
      return queryDetails;
    }

    // fallback
    const queryDetails: SubscriptionsQuery = { kind: 'SubscriptionsQuery', rawQuery };
    return queryDetails;
  };

  const query: AzureMonitorQuery = {
    refId: 'A',
    queryType: AzureQueryType.GrafanaTemplateVariableFn,
    grafanaTemplateVariableFn: createGrafanaTemplateVariableDetails(),
    subscription: defaultSubscriptionId,
  };
  return query;
};

const createLogAnalyticsTemplateVariableQuery = async (
  rawQuery: string,
  datasource: DataSource
): Promise<AzureMonitorQuery> => {
  const defaultSubscriptionId = datasource.azureMonitorDatasource.defaultSubscriptionId;
  let resource = '';
  // if there's an existing query, we try to get the resourcesuri from a deprecated default workspace
  // a note this is very similar logic to what is used in useMigrations but moved out of the react-hook land
  if (rawQuery) {
    const defaultWorkspaceId = datasource.azureLogAnalyticsDatasource.getDeprecatedDefaultWorkSpace();
    if (defaultWorkspaceId) {
      const isWorkspaceGUID = isGUIDish(defaultWorkspaceId);
      if (isWorkspaceGUID) {
        resource = await datasource.resourcePickerData.getResourceURIFromWorkspace(defaultWorkspaceId);
      } else {
        resource = defaultWorkspaceId;
      }
    } else {
      const maybeFirstWorkspace = await datasource.azureLogAnalyticsDatasource.getFirstWorkspace();
      resource = maybeFirstWorkspace || '';
    }
  }

  return {
    refId: 'A',
    queryType: AzureQueryType.LogAnalytics,
    azureLogAnalytics: {
      query: rawQuery,
      resource,
    },
    subscription: defaultSubscriptionId,
  };
};

const migrateGrafanaTemplateVariableFn = (query: AzureMonitorQuery) => {
  const { queryType, grafanaTemplateVariableFn } = query;
  if (queryType !== AzureQueryType.GrafanaTemplateVariableFn || !grafanaTemplateVariableFn) {
    return query;
  }

  const migratedQuery: AzureMonitorQuery = {
    ...query,
  };
  if ('subscription' in grafanaTemplateVariableFn) {
    migratedQuery.subscription = grafanaTemplateVariableFn.subscription;
  }
  if ('resourceGroup' in grafanaTemplateVariableFn) {
    migratedQuery.resourceGroup = grafanaTemplateVariableFn.resourceGroup;
  }
  if ('metricNamespace' in grafanaTemplateVariableFn) {
    migratedQuery.namespace = grafanaTemplateVariableFn.metricNamespace;
  }
  if ('resourceName' in grafanaTemplateVariableFn) {
    migratedQuery.resource = grafanaTemplateVariableFn.resourceName;
  }

  switch (grafanaTemplateVariableFn.kind) {
    case 'SubscriptionsQuery':
      migratedQuery.queryType = AzureQueryType.SubscriptionsQuery;
      break;
    case 'ResourceGroupsQuery':
      migratedQuery.queryType = AzureQueryType.ResourceGroupsQuery;
      break;
    case 'ResourceNamesQuery':
      migratedQuery.queryType = AzureQueryType.ResourceNamesQuery;
      break;
    case 'MetricNamespaceQuery':
      migratedQuery.queryType = AzureQueryType.NamespacesQuery;
      break;
    case 'MetricNamesQuery':
      migratedQuery.queryType = AzureQueryType.MetricNamesQuery;
      break;
    case 'WorkspacesQuery':
      migratedQuery.queryType = AzureQueryType.WorkspacesQuery;
      break;
  }

  return migratedQuery;
};

export const migrateStringQueriesToObjectQueries = async (
  rawQuery: string | AzureMonitorQuery,
  options: { datasource: DataSource }
): Promise<AzureMonitorQuery> => {
  // no need to migrate already migrated queries
  if (typeof rawQuery !== 'string') {
    return rawQuery;
  }

  return isGrafanaTemplateVariableFnQuery(rawQuery)
    ? createGrafanaTemplateVariableQuery(rawQuery, options.datasource)
    : createLogAnalyticsTemplateVariableQuery(rawQuery, options.datasource);
};

export const migrateQuery = async (
  rawQuery: string | AzureMonitorQuery,
  options: { datasource: DataSource }
): Promise<AzureMonitorQuery> => {
  let query = await migrateStringQueriesToObjectQueries(rawQuery, options);

  if (
    !config.featureToggles.azLegacyTemplateVariables &&
    query.queryType === AzureQueryType.GrafanaTemplateVariableFn
  ) {
    query = migrateGrafanaTemplateVariableFn(query);
  }

  return query;
};


text:
Teligem allows you to integrate the notifications of the [Telipass](https://telipass.com/) solution.

## INSTALL

In your Gemfile

```ruby
  gem 'teligem'
```

Then run 'bundle install'

## SETUP

### MODEL

When a payment has been made, Telipass sends to the notification url those parameters.
Pick the ones you are interested in and put it in your payment model.

You must at least have those attributes in your payment model: security_code:string, enduser_ip:string and ntu:string,
as they are used to check if the payment really comes from the Telipass plateform.

### RAILS SECRETS

Add to your config/secrets.yml (don't forget to add it to .gitignore)

```ruby
  telikey: "your-telipass-key"
```

## USAGE
### security_check
To check if the payment really comes from the Telipass website, set your params and call the security check method.

```ruby
  # in payment_controller.rb

  def create
    params = {
      security_code: params[:security_code],
      enduser_ip: params[:enduser_ip],
      ntu: params[:ntu]
    }

    if Telipass.new.security_check(params) do
      # ex: Create payment, give some user coins
    else
      # ex: Create payment, send a security alert
    end
  end

```
The security check method will return true if the payment really comes from Telipass, otherwise it will return false.

### check_status
Before giving coins to your user, you may want to check if the status of the transaction is valid, differed, rejected or is test.
Call the check_status function.

```ruby
  if Telipass.new.check_status(params[:status])
    # Give coins to user
  else
    # Don't give user some coins
  end
```
It will return true if status is valid, and return false if status is test or rejected or differed.

### get_earning
First, set earnings per point_name:
  ```
    Teligem::EARNING = {
      "FRSMS10" => 10,
      "FRSMS20" => 20
    }
  ```
Then call the get_earning method to the get the earning.
```
  Teligem.new.get_earning(params[:point_name])
  # It will return 10 if point_name is FRSMS10.
```
When the point_name is unknown, it will return 0.

## How to contribute?
* Fork this repository
* Create a branch to add some functionalities or solve some bugs
* Make a pull request - I will try to review and merge it asap


text: alias gulp='nocorrect gulp'


text:
<?php

namespace PhpBench\Template\Expression\Printer;

use PhpBench\Expression\Ast\Node;
use PhpBench\Expression\NodePrinter;
use PhpBench\Expression\NodePrinters;
use PhpBench\Expression\Printer;
use PhpBench\Template\Exception\CouldNotFindTemplateForObject;
use PhpBench\Template\ObjectRenderer;

class TemplateNodePrinter implements NodePrinter
{
    /**
     * @var array<string, string>
     */
    private $cached = [];

    /**
     * @var NodePrinters
     */
    private $nodePrinters;

    /**
     * @var ObjectRenderer
     */
    private $renderer;

    public function __construct(ObjectRenderer $renderer, NodePrinters $nodePrinters)
    {
        $this->nodePrinters = $nodePrinters;
        $this->renderer = $renderer;
    }

    /**
     * {@inheritDoc}
     */
    public function print(Printer $printer, Node $node): string
    {
        $hash = md5(serialize($node));

        if (isset($this->cached[$hash])) {
            return $this->cached[$hash];
        }

        if ($node instanceof SkipTemplateNode) {
            return $this->nodePrinters->print($printer, $node->subject());
        }

        try {
            $this->cached[$hash] = $this->renderer->render($node);

            return $this->cached[$hash];
        } catch (CouldNotFindTemplateForObject $couldNotFind) {
            return $this->nodePrinters->print($printer, $node);
        }
    }
}