text:
<?php

/**
 * Catalog Price rules observer model
 */
class Mage_CatalogRule_Model_Observer
{
    /**
     * Store calculated catalog rules prices for products
     * Prices collected per website, customer group, date and product
     *
     * @var array
     */
    protected $_rulePrices = array();

    /**
     * Apply all catalog price rules for specific product
     *
     * @param   Varien_Event_Observer $observer
     * @return  Mage_CatalogRule_Model_Observer
     */
    public function applyAllRulesOnProduct($observer)
    {
        $product = $observer->getEvent()->getProduct();
        if ($product->getIsMassupdate()) {
            return;
        }

        $productWebsiteIds = $product->getWebsiteIds();

        $rules = Mage::getModel('catalogrule/rule')->getCollection()
            ->addFieldToFilter('is_active', 1);

        foreach ($rules as $rule) {
            $websiteIds = array_intersect($productWebsiteIds, $rule->getWebsiteIds());
            $rule->applyToProduct($product, $websiteIds);
        }

        return $this;
    }

    /**
     * Apply all price rules for current date.
     * Handle cataolg_product_import_after event
     *
     * @param   Varien_Event_Observer $observer
     *
     * @return  Mage_CatalogRule_Model_Observer
     */
    public function applyAllRules($observer)
    {
        $resource = Mage::getResourceSingleton('catalogrule/rule');
        $resource->applyAllRulesForDateRange($resource->formatDate(mktime(0,0,0)));
        Mage::getModel('catalogrule/flag')->loadSelf()
            ->setState(0)
            ->save();

        return $this;
    }

    /**
     * Apply catalog price rules to product on frontend
     *
     * @param   Varien_Event_Observer $observer
     *
     * @return  Mage_CatalogRule_Model_Observer
     */
    public function processFrontFinalPrice($observer)
    {
        $product    = $observer->getEvent()->getProduct();
        $pId        = $product->getId();
        $storeId    = $product->getStoreId();

        if ($observer->hasDate()) {
            $date = $observer->getEvent()->getDate();
        } else {
            $date = Mage::app()->getLocale()->storeTimeStamp($storeId);
        }

        if ($observer->hasWebsiteId()) {
            $wId = $observer->getEvent()->getWebsiteId();
        } else {
            $wId = Mage::app()->getStore($storeId)->getWebsiteId();
        }

        if ($observer->hasCustomerGroupId()) {
            $gId = $observer->getEvent()->getCustomerGroupId();
        } elseif ($product->hasCustomerGroupId()) {
            $gId = $product->getCustomerGroupId();
        } else {
            $gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
        }

        $key = "$date|$wId|$gId|$pId";
        if (!isset($this->_rulePrices[$key])) {
            $rulePrice = Mage::getResourceModel('catalogrule/rule')
                ->getRulePrice($date, $wId, $gId, $pId);
            $this->_rulePrices[$key] = $rulePrice;
        }
        if ($this->_rulePrices[$key]!==false) {
            $finalPrice = min($product->getData('final_price'), $this->_rulePrices[$key]);
            $product->setFinalPrice($finalPrice);
        }
        return $this;
    }

    /**
     * Apply catalog price rules to product in admin
     *
     * @param   Varien_Event_Observer $observer
     *
     * @return  Mage_CatalogRule_Model_Observer
     */
    public function processAdminFinalPrice($observer)
    {
        $product = $observer->getEvent()->getProduct();
        $storeId = $product->getStoreId();
        $date = Mage::app()->getLocale()->storeDate($storeId);
        $key = false;

        if ($ruleData = Mage::registry('rule_data')) {
            $wId = $ruleData->getWebsiteId();
            $gId = $ruleData->getCustomerGroupId();
            $pId = $product->getId();

            $key = "$date|$wId|$gId|$pId";
        }
        elseif (!is_null($product->getWebsiteId()) && !is_null($product->getCustomerGroupId())) {
            $wId = $product->getWebsiteId();
            $gId = $product->getCustomerGroupId();
            $pId = $product->getId();
            $key = "$date|$wId|$gId|$pId";
        }

        if ($key) {
            if (!isset($this->_rulePrices[$key])) {
                $rulePrice = Mage::getResourceModel('catalogrule/rule')
                    ->getRulePrice($date, $wId, $gId, $pId);
                $this->_rulePrices[$key] = $rulePrice;
            }
            if ($this->_rulePrices[$key]!==false) {
                $finalPrice = min($product->getData('final_price'), $this->_rulePrices[$key]);
                $product->setFinalPrice($finalPrice);
            }
        }

        return $this;
    }

    /**
     * Calculate price using catalog price rules of configurable product
     *
     * @param Varien_Event_Observer $observer
     *
     * @return Mage_CatalogRule_Model_Observer
     */
    public function catalogProductTypeConfigurablePrice(Varien_Event_Observer $observer)
    {
        $product = $observer->getEvent()->getProduct();
        if ($product instanceof Mage_Catalog_Model_Product
            && $product->getConfigurablePrice() !== null
        ) {
            $configurablePrice = $product->getConfigurablePrice();
            $productPriceRule = Mage::getModel('catalogrule/rule')->calcProductPriceRule($product, $configurablePrice);
            if ($productPriceRule !== null) {
                $product->setConfigurablePrice($productPriceRule);
            }
        }

        return $this;
    }

    /**
     * Daily update catalog price rule by cron
     * Update include interval 3 days - current day - 1 days before + 1 days after
     * This method is called from cron process, cron is working in UTC time and
     * we should generate data for interval -1 day ... +1 day
     *
     * @param   Varien_Event_Observer $observer
     *
     * @return  Mage_CatalogRule_Model_Observer
     */
    public function dailyCatalogUpdate($observer)
    {
        Mage::getResourceSingleton('catalogrule/rule')->applyAllRulesForDateRange();

        return $this;
    }

    /**
     * Clean out calculated catalog rule prices for products
     */
    public function flushPriceCache()
    {
        $this->_rulePrices = array();
    }

    /**
     * Calculate minimal final price with catalog rule price
     *
     * @param Varien_Event_Observer $observer
     * @return Mage_CatalogRule_Model_Observer
     */
    public function prepareCatalogProductPriceIndexTable(Varien_Event_Observer $observer)
    {
        $select             = $observer->getEvent()->getSelect();

        $indexTable         = $observer->getEvent()->getIndexTable();
        $entityId           = $observer->getEvent()->getEntityId();
        $customerGroupId    = $observer->getEvent()->getCustomerGroupId();
        $websiteId          = $observer->getEvent()->getWebsiteId();
        $websiteDate        = $observer->getEvent()->getWebsiteDate();
        $updateFields       = $observer->getEvent()->getUpdateFields();

        Mage::getSingleton('catalogrule/rule_product_price')
            ->applyPriceRuleToIndexTable($select, $indexTable, $entityId, $customerGroupId, $websiteId,
                $updateFields, $websiteDate);

        return $this;
    }

    /**
     * Check rules that contains affected attribute
     * If rules were found they will be set to inactive and notice will be add to admin session
     *
     * @param string $attributeCode
     *
     * @return Mage_CatalogRule_Model_Observer
     */
    protected function _checkCatalogRulesAvailability($attributeCode)
    {
        /* @var $collection Mage_CatalogRule_Model_Mysql4_Rule_Collection */
        $collection = Mage::getResourceModel('catalogrule/rule_collection')
            ->addAttributeInConditionFilter($attributeCode);

        $disabledRulesCount = 0;
        foreach ($collection as $rule) {
            /* @var $rule Mage_CatalogRule_Model_Rule */
            $rule->setIsActive(0);
            /* @var $rule->getConditions() Mage_CatalogRule_Model_Rule_Condition_Combine */
            $this->_removeAttributeFromConditions($rule->getConditions(), $attributeCode);
            $rule->save();

            $disabledRulesCount++;
        }

        if ($disabledRulesCount) {
            Mage::getModel('catalogrule/rule')->applyAll();
            Mage::getSingleton('adminhtml/session')->addWarning(
                Mage::helper('catalogrule')->__('%d Catalog Price Rules based on "%s" attribute have been disabled.', $disabledRulesCount, $attributeCode));
        }

        return $this;
    }

    /**
     * Remove catalog attribute condition by attribute code from rule conditions
     *
     * @param Mage_CatalogRule_Model_Rule_Condition_Combine $combine
     *
     * @param string $attributeCode
     */
    protected function _removeAttributeFromConditions($combine, $attributeCode)
    {
        $conditions = $combine->getConditions();
        foreach ($conditions as $conditionId => $condition) {
            if ($condition instanceof Mage_CatalogRule_Model_Rule_Condition_Combine) {
                $this->_removeAttributeFromConditions($condition, $attributeCode);
            }
            if ($condition instanceof Mage_Rule_Model_Condition_Product_Abstract) {
                if ($condition->getAttribute() == $attributeCode) {
                    unset($conditions[$conditionId]);
                }
            }
        }
        $combine->setConditions($conditions);
    }

    /**
     * After save attribute if it is not used for promo rules already check rules for containing this attribute
     *
     * @param Varien_Event_Observer $observer
     *
     * @return Mage_CatalogRule_Model_Observer
     */
    public function catalogAttributeSaveAfter(Varien_Event_Observer $observer)
    {
        $attribute = $observer->getEvent()->getAttribute();
        if ($attribute->dataHasChangedFor('is_used_for_promo_rules') && !$attribute->getIsUsedForPromoRules()) {
            $this->_checkCatalogRulesAvailability($attribute->getAttributeCode());
        }

        return $this;
    }

    /**
     * After delete attribute check rules that contains deleted attribute
     *
     * @param Varien_Event_Observer $observer
     * @return Mage_CatalogRule_Model_Observer
     */
    public function catalogAttributeDeleteAfter(Varien_Event_Observer $observer)
    {
        $attribute = $observer->getEvent()->getAttribute();
        if ($attribute->getIsUsedForPromoRules()) {
            $this->_checkCatalogRulesAvailability($attribute->getAttributeCode());
        }

        return $this;
    }

    public function prepareCatalogProductCollectionPrices(Varien_Event_Observer $observer)
    {
        /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
        $collection = $observer->getEvent()->getCollection();
        $store      = Mage::app()->getStore($observer->getEvent()->getStoreId());
        $websiteId  = $store->getWebsiteId();
        if ($observer->getEvent()->hasCustomerGroupId()) {
            $groupId = $observer->getEvent()->getCustomerGroupId();
        } else {
            /* @var $session Mage_Customer_Model_Session */
            $session = Mage::getSingleton('customer/session');
            if ($session->isLoggedIn()) {
                $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
            } else {
                $groupId = Mage_Customer_Model_Group::NOT_LOGGED_IN_ID;
            }
        }
        if ($observer->getEvent()->hasDate()) {
            $date = $observer->getEvent()->getDate();
        } else {
            $date = Mage::app()->getLocale()->storeTimeStamp($store);
        }

        $productIds = array();
        /* @var $product Mage_Core_Model_Product */
        foreach ($collection as $product) {
            $key = implode('|', array($date, $websiteId, $groupId, $product->getId()));
            if (!isset($this->_rulePrices[$key])) {
                $productIds[] = $product->getId();
            }
        }

        if ($productIds) {
            $rulePrices = Mage::getResourceModel('catalogrule/rule')
                ->getRulePrices($date, $websiteId, $groupId, $productIds);
            foreach ($productIds as $productId) {
                $key = implode('|', array($date, $websiteId, $groupId, $productId));
                $this->_rulePrices[$key] = isset($rulePrices[$productId]) ? $rulePrices[$productId] : false;
            }
        }

        return $this;
    }

    /**
     * Create catalog rule relations for imported products
     *
     * @param Varien_Event_Observer $observer
     */
    public function createCatalogRulesRelations(Varien_Event_Observer $observer)
    {
        $adapter = $observer->getEvent()->getAdapter();
        $affectedEntityIds = $adapter->getAffectedEntityIds();

        if (empty($affectedEntityIds)) {
            return;
        }

        $rules = Mage::getModel('catalogrule/rule')->getCollection()
            ->addFieldToFilter('is_active', 1);

        foreach ($rules as $rule) {
            $rule->setProductsFilter($affectedEntityIds);
            Mage::getResourceSingleton('catalogrule/rule')->updateRuleProductData($rule);
        }
    }
}


text:
.class Lmf/javax/xml/validation/SecuritySupport$5;
.super Ljava/lang/Object;
.source "SecuritySupport.java"

# interfaces
.implements Ljava/security/PrivilegedAction;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lmf/javax/xml/validation/SecuritySupport;->getResourceAsURL(Ljava/lang/ClassLoader;Ljava/lang/String;)Ljava/net/URL;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lmf/javax/xml/validation/SecuritySupport;

.field private final synthetic val$cl:Ljava/lang/ClassLoader;

.field private final synthetic val$name:Ljava/lang/String;

# direct methods
.method constructor <init>(Lmf/javax/xml/validation/SecuritySupport;Ljava/lang/ClassLoader;Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lmf/javax/xml/validation/SecuritySupport$5;->this$0:Lmf/javax/xml/validation/SecuritySupport;

    iput-object p2, p0, Lmf/javax/xml/validation/SecuritySupport$5;->val$cl:Ljava/lang/ClassLoader;

    iput-object p3, p0, Lmf/javax/xml/validation/SecuritySupport$5;->val$name:Ljava/lang/String;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public run()Ljava/lang/Object;
    .locals 3

    iget-object v1, p0, Lmf/javax/xml/validation/SecuritySupport$5;->val$cl:Ljava/lang/ClassLoader;

    if-eqz v1, :cond_0

    iget-object v1, p0, Lmf/javax/xml/validation/SecuritySupport$5;->val$cl:Ljava/lang/ClassLoader;

    iget-object v2, p0, Lmf/javax/xml/validation/SecuritySupport$5;->val$name:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/ClassLoader;->getResource(Ljava/lang/String;)Ljava/net/URL;

    move-result-object v0

    :goto_0
    return-object v0

    :cond_0
    iget-object v1, p0, Lmf/javax/xml/validation/SecuritySupport$5;->val$name:Ljava/lang/String;

    const-class v2, Ljava/lang/Object;

    invoke-virtual {v2, v1}, Ljava/lang/Class;->getResource(Ljava/lang/String;)Ljava/net/URL;

    move-result-object v0

    goto :goto_0
.end method

redpajama_set_name: RedPajamaGithub


text:
import React from 'react';
import {Link} from 'react-router';
import BaseComponent from 'components/BaseComponent';

export default class SideBar extends BaseComponent {
    render () {
        let adminMenu = "";
        if (this.context.currentUser.isAdmin) {
            adminMenu = (

Administration

Gestion des utilisateurs

Gestion des comités

Gestion des évènements

            );
        }
        return (

Comités

                    {this.props.comities.map(function (comity, index) {
                        return (

                                {comity.name}

                        );
                    })}

                {adminMenu}

        );
    }
}


text:
using System;
using System.Windows.Forms;
using Grasshopper.Graphics;
using Grasshopper.Graphics.Rendering;
using Grasshopper.Input;
using Grasshopper.SharpDX.Graphics.Rendering.Internal;
using SharpDX;
using SharpDX.Direct3D11;
using SharpDX.DXGI;
using Color = Grasshopper.Graphics.Primitives.Color;
using ResultCode = SharpDX.DXGI.ResultCode;

namespace Grasshopper.SharpDX.Graphics.Rendering
{
    class WindowDrawingContext : DrawingContext, IWindowDrawingContext
    {
        private readonly AppWindow _window;
        private readonly DepthBuffer _depthBuffer;
        private readonly WindowTextureBuffer _windowTextureBuffer;

        public WindowDrawingContext(GraphicsContext graphics, IInputContext input) : base(graphics.DeviceManager)
        {
            if(graphics == null) throw new ArgumentNullException("graphics");
            if(input == null) throw new ArgumentNullException("input");

            Graphics = graphics;

            _window = new AppWindow(input);
            _window.SizeChanged += win => Initialize();

            _depthBuffer = new DepthBuffer(DeviceManager, _window.ClientWidth, _window.ClientHeight);
            _windowTextureBuffer = new WindowTextureBuffer(DeviceManager, _window.Form.Handle, _window.ClientWidth, _window.ClientHeight);
        }

        public IGraphicsContext Graphics { get; private set; }
        public IAppWindow Window { get { return _window; } }

        public void Initialize()
        {
            if(_window.Form.WindowState == FormWindowState.Minimized)
                return;

            if(!DeviceManager.IsInitialized)
                throw new InvalidOperationException("Device manager is not initialized");

            DestroyResources();

            _depthBuffer.Resize(Window.ClientWidth, Window.ClientHeight);
            _windowTextureBuffer.Resize(Window.ClientWidth, Window.ClientHeight);

            _depthBuffer.Initialize();
            _windowTextureBuffer.Initialize();

            var viewport = new ViewportF(0, 0, Window.ClientWidth, Window.ClientHeight);
            DeviceManager.Context.Rasterizer.SetViewport(viewport);
        }

        protected override void DestroyResources()
        {
            _depthBuffer.Uninitialize();
            _windowTextureBuffer.Uninitialize();
        }

        public void Present()
        {
            try
            {
                _windowTextureBuffer.SwapChain.Present(1, PresentFlags.None);
            }
            catch(SharpDXException ex)
            {
                if(ex.ResultCode == ResultCode.DeviceRemoved || ex.ResultCode == ResultCode.DeviceReset)
                    DeviceManager.Initialize();
                else
                    throw;
            }
        }

        protected override void MakeTargetsActive()
        {
            DeviceManager.Context.OutputMerger.SetTargets(_depthBuffer.DepthStencilView, _windowTextureBuffer.RenderTargetView);
        }

        public override void Clear(Color color)
        {
            if(_depthBuffer.DepthStencilView != null)
                DeviceManager.Context.ClearDepthStencilView(_depthBuffer.DepthStencilView, DepthStencilClearFlags.Depth, 1f, 0);

            if(_windowTextureBuffer.RenderTargetView != null)
                DeviceManager.Context.ClearRenderTargetView(_windowTextureBuffer.RenderTargetView, new Color4(color.ToRgba()));
        }
    }
}


text:
#ifndef CRANKMATCPLXFLOAT_H
#define CRANKMATCPLXFLOAT_H

/* Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef _CRANKBASE_INSIDE
#error crankmatfloat.h cannot be included directly.
#endif

#include <glib.h>
#include <glib-object.h>

#include "crankfunction.h"
#include "crankpermutation.h"
#include "crankcomplex.h"
#include "crankveccommon.h"
#include "crankmatcommon.h"

G_BEGIN_DECLS

/**
 * CrankMatCplxFloatN:
 * @data: Matrix data array.
 * @rn: row count.
 * @cn: column count.
 *
 * Variable sized Float Matrix.
 */
struct _CrankMatCplxFloatN {
  CrankCplxFloat *data;
  guint rn;
  guint cn;
};

#define CRANK_TYPE_MAT_CPLX_FLOAT_N (crank_mat_cplx_float_n_get_type ())
GType               crank_mat_cplx_float_n_get_type (void);

void                crank_mat_cplx_float_n_init (CrankMatCplxFloatN *mat,
                                                 const guint         rn,
                                                 const guint         cn,
                                                 ...);

void                crank_mat_cplx_float_n_init_arr (CrankMatCplxFloatN *mat,
                                                     const guint         rn,
                                                     const guint         cn,
                                                     CrankCplxFloat     *marr);

void                crank_mat_cplx_float_n_init_arr_take (
  CrankMatCplxFloatN *mat,
  const guint         rn,
  const guint         cn,
  CrankCplxFloat     *marr);

void                crank_mat_cplx_float_n_init_row (CrankMatCplxFloatN *mat,
                                                     const guint         rn,
                                                     ...);

void                crank_mat_cplx_float_n_init_row_arr (
  CrankMatCplxFloatN *mat,
  const guint         rn,
  CrankVecCplxFloatN *rarrv);

void                crank_mat_cplx_float_n_init_row_parr (
  CrankMatCplxFloatN  *mat,
  const guint          rn,
  CrankVecCplxFloatN **rparrv);

void                crank_mat_cplx_float_n_init_col (CrankMatCplxFloatN *mat,
                                                     const guint         cn,
                                                     ...);

void                crank_mat_cplx_float_n_init_col_arr (
  CrankMatCplxFloatN *mat,
  const guint         cn,
  CrankVecCplxFloatN *carrv);

void                crank_mat_cplx_float_n_init_col_parr (
  CrankMatCplxFloatN  *mat,
  const guint          cn,
  CrankVecCplxFloatN **cparrv);

void                crank_mat_cplx_float_n_init_diag (CrankMatCplxFloatN *mat,
                                                      const guint         n,
                                                      ...);

void                crank_mat_cplx_float_n_init_diag_arr (
  CrankMatCplxFloatN *mat,
  const guint         n,
  CrankCplxFloat     *darr);

void                crank_mat_cplx_float_n_init_diag_vec (
  CrankMatCplxFloatN *mat,
  CrankVecCplxFloatN *dvec);

void                crank_mat_cplx_float_n_init_fill (CrankMatCplxFloatN *mat,
                                                      const guint         rn,
                                                      const guint         cn,
                                                      CrankCplxFloat     *fill);

void                crank_mat_cplx_float_n_init_uc (CrankMatCplxFloatN *mat,
                                                    const guint         rn,
                                                    const guint         cn,
                                                    ...);
void                crank_mat_cplx_float_n_init_arruc (CrankMatCplxFloatN *mat,
                                                       const guint         rn,
                                                       const guint         cn,
                                                       const gfloat       *mucarr);

void                crank_mat_cplx_float_n_init_ucarr(CrankMatCplxFloatN *mat,
                                                      const guint         rn,
                                                      const guint         cn,
                                                      const gfloat       *real,
                                                      const gfloat       *imag);

void                crank_mat_cplx_float_n_init_ucm(CrankMatCplxFloatN *mat,
                                                    CrankMatFloatN     *real,
                                                    CrankMatFloatN     *imag);

void                crank_mat_cplx_float_n_init_row_uc (CrankMatCplxFloatN *mat,
                                                        const guint         rn,
                                                        ...);

void                crank_mat_cplx_float_n_init_row_arruc (
  CrankMatCplxFloatN *mat,
  const guint         rn,
  CrankVecFloatN     *rarrucv);

void                crank_mat_cplx_float_n_init_row_parruc (
  CrankMatCplxFloatN *mat,
  const guint         rn,
  CrankVecFloatN    **rarrucpv);

void                crank_mat_cplx_float_n_init_col_uc (CrankMatCplxFloatN *mat,
                                                        const guint         cn,
                                                        ...);

void                crank_mat_cplx_float_n_init_col_arruc (
  CrankMatCplxFloatN *mat,
  const guint         cn,
  CrankVecFloatN     *carrucv);

void                crank_mat_cplx_float_n_init_col_parruc (
  CrankMatCplxFloatN *mat,
  const guint         cn,
  CrankVecFloatN    **carrucpv);

void                crank_mat_cplx_float_n_init_diag_uc (
  CrankMatCplxFloatN *mat,
  const guint         n,
  ...);

void                crank_mat_cplx_float_n_init_diag_arruc (
  CrankMatCplxFloatN *mat,
  const guint         n,
  const gfloat       *arruc);

void                crank_mat_cplx_float_n_init_diag_ucarr (
  CrankMatCplxFloatN *mat,
  const guint         n,
  const gfloat       *real,
  const gfloat       *imag);

void                crank_mat_cplx_float_n_init_diag_ucv (
  CrankMatCplxFloatN *mat,
  CrankVecFloatN     *real,
  CrankVecFloatN     *imag);

void                crank_mat_cplx_float_n_init_fill_uc (
  CrankMatCplxFloatN *mat,
  const guint         rn,
  const guint         cn,
  const gfloat        real,
  const gfloat        imag);

void                crank_mat_cplx_float_n_fini (CrankMatCplxFloatN *mat);

void                crank_mat_cplx_float_n_copy (CrankMatCplxFloatN *mat,
                                                 CrankMatCplxFloatN *other);

CrankMatCplxFloatN *crank_mat_cplx_float_n_dup (CrankMatCplxFloatN *mat);

void                crank_mat_cplx_float_n_free (CrankMatCplxFloatN *mat);

//////// Basic operations ////////

guint               crank_mat_cplx_float_n_hash (gconstpointer a);

gboolean            crank_mat_cplx_float_n_equal (gconstpointer a,
                                                  gconstpointer b);

gchar              *crank_mat_cplx_float_n_to_string (CrankMatCplxFloatN *mat);

gchar              *crank_mat_cplx_float_n_to_string_full (
  CrankMatCplxFloatN *mat,
  const gchar        *mat_left,
  const gchar        *mat_in,
  const gchar        *mat_right,
  const gchar        *row_left,
  const gchar        *row_in,
  const gchar        *row_right,
  const gchar        *format);

//////// Collectional functions ////////

guint           crank_mat_cplx_float_n_get_row_size (CrankMatCplxFloatN *mat);

guint           crank_mat_cplx_float_n_get_col_size (CrankMatCplxFloatN *mat);

void            crank_mat_cplx_float_n_get (CrankMatCplxFloatN *mat,
                                            const guint         i,
                                            const guint         j,
                                            CrankCplxFloat     *value);

void            crank_mat_cplx_float_n_set (CrankMatCplxFloatN *mat,
                                            const guint         i,
                                            const guint         j,
                                            CrankCplxFloat     *value);

CrankCplxFloat *crank_mat_cplx_float_n_peek (CrankMatCplxFloatN *mat,
                                             const guint         i,
                                             const guint         j);

void            crank_mat_cplx_float_n_get_row (CrankMatCplxFloatN *mat,
                                                const guint         index,
                                                CrankVecCplxFloatN *row);

void            crank_mat_cplx_float_n_set_row (CrankMatCplxFloatN *mat,
                                                const guint         index,
                                                CrankVecCplxFloatN *row);

void            crank_mat_cplx_float_n_set_row_real(CrankMatCplxFloatN *mat,
                                                    const guint         index,
                                                    CrankVecFloatN     *row_real);

void            crank_mat_cplx_float_n_set_row_imag(CrankMatCplxFloatN *mat,
                                                    const guint         index,
                                                    CrankVecFloatN     *row_imag);

void            crank_mat_cplx_float_n_get_col (CrankMatCplxFloatN *mat,
                                                const guint         index,
                                                CrankVecCplxFloatN *col);

void            crank_mat_cplx_float_n_set_col (CrankMatCplxFloatN *mat,
                                                const guint         index,
                                                CrankVecCplxFloatN *col);

void            crank_mat_cplx_float_n_set_col_real(CrankMatCplxFloatN *mat,
                                                    const guint         index,
                                                    CrankVecFloatN     *col_real);

void            crank_mat_cplx_float_n_set_col_imag(CrankMatCplxFloatN *mat,
                                                    const guint         index,
                                                    CrankVecFloatN     *col_imag);

void            crank_mat_cplx_float_n_slice_row (CrankMatCplxFloatN *mat,
                                                  const guint         start,
                                                  const guint         end,
                                                  CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_slice_col (CrankMatCplxFloatN *mat,
                                                  const guint         start,
                                                  const guint         end,
                                                  CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_slice (CrankMatCplxFloatN *mat,
                                              const guint         row_start,
                                              const guint         col_start,
                                              const guint         row_end,
                                              const guint         col_end,
                                              CrankMatCplxFloatN *r);

//////// Classification ////////////////////////////////////////////////////////

gboolean        crank_mat_cplx_float_n_is_square (CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_identity(CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_zero (CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_upper_tri(CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_lower_tri(CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_diag (CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_symmetric(CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_hermitian(CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_has_nan (CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_has_inf (CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_pure_real(CrankMatCplxFloatN *mat);

gboolean        crank_mat_cplx_float_n_is_pure_imag(CrankMatCplxFloatN *mat);

//////// Attributes ////////////////////////////////////////////////////////////

void            crank_mat_cplx_float_n_get_tr (CrankMatCplxFloatN *mat,
                                               CrankCplxFloat     *tr);

void            crank_mat_cplx_float_n_get_det (CrankMatCplxFloatN *mat,
                                                CrankCplxFloat     *det);

void            crank_mat_cplx_float_n_get_cof (CrankMatCplxFloatN *mat,
                                                CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_get_adj (CrankMatCplxFloatN *mat,
                                                CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_get_diag (CrankMatCplxFloatN *mat,
                                                 CrankVecCplxFloatN *r);

void            crank_mat_cplx_float_n_get_real (CrankMatCplxFloatN *mat,
                                                 CrankMatFloatN     *r);

void            crank_mat_cplx_float_n_get_imag (CrankMatCplxFloatN *mat,
                                                 CrankMatFloatN     *r);

void            crank_mat_cplx_float_n_set_real (CrankMatCplxFloatN *mat,
                                                 CrankMatFloatN     *r);

void            crank_mat_cplx_float_n_set_imag (CrankMatCplxFloatN *mat,
                                                 CrankMatFloatN     *r);

//////// Unary operations ////////

void            crank_mat_cplx_float_n_neg (CrankMatCplxFloatN *a,
                                            CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_neg_self (CrankMatCplxFloatN *a);

void            crank_mat_cplx_float_n_transpose (CrankMatCplxFloatN *a,
                                                  CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_transpose_self (CrankMatCplxFloatN *a);

void            crank_mat_cplx_float_n_inverse (CrankMatCplxFloatN *a,
                                                CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_inverse_self (CrankMatCplxFloatN *a);

gboolean        crank_mat_cplx_float_n_try_inverse (CrankMatCplxFloatN *a,
                                                    CrankMatCplxFloatN *r);

gboolean        crank_mat_cplx_float_n_try_inverse_self (
  CrankMatCplxFloatN *a);

void            crank_mat_cplx_float_n_conjugate (CrankMatCplxFloatN *a,
                                                  CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_conjugate_self (CrankMatCplxFloatN *a);

void            crank_mat_cplx_float_n_conj_tpose (CrankMatCplxFloatN *a,
                                                   CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_conj_tpose_self (
  CrankMatCplxFloatN *a);

//////// Scalar operations ////////

void            crank_mat_cplx_float_n_mulrs (CrankMatCplxFloatN *a,
                                              const gfloat        b,
                                              CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_mulrs_self (CrankMatCplxFloatN *a,
                                                   const gfloat        b);

void            crank_mat_cplx_float_n_muls (CrankMatCplxFloatN *a,
                                             CrankCplxFloat     *b,
                                             CrankMatCplxFloatN *r);
void            crank_mat_cplx_float_n_muls_self (CrankMatCplxFloatN *a,
                                                  CrankCplxFloat     *b);

void            crank_mat_cplx_float_n_mulrv (CrankMatCplxFloatN *a,
                                              CrankVecFloatN     *b,
                                              CrankVecCplxFloatN *r);

void            crank_mat_cplx_float_n_mulv (CrankMatCplxFloatN *a,
                                             CrankVecCplxFloatN *b,
                                             CrankVecCplxFloatN *r);

void            crank_mat_cplx_float_n_mulr (CrankMatCplxFloatN *a,
                                             CrankMatFloatN     *b,
                                             CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_mulr_self (CrankMatCplxFloatN *a,
                                                  CrankMatFloatN     *b);

void            crank_mat_cplx_float_n_mul (CrankMatCplxFloatN *a,
                                            CrankMatCplxFloatN *b,
                                            CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_mul_self (CrankMatCplxFloatN *a,
                                                 CrankMatCplxFloatN *b);

void            crank_mat_cplx_float_n_divrs (CrankMatCplxFloatN *a,
                                              const gfloat        b,
                                              CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_divrs_self (CrankMatCplxFloatN *a,
                                                   const gfloat        b);

void            crank_mat_cplx_float_n_divs (CrankMatCplxFloatN *a,
                                             CrankCplxFloat     *b,
                                             CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_divs_self (CrankMatCplxFloatN *a,
                                                  CrankCplxFloat     *b);

void            crank_mat_cplx_float_n_addr (CrankMatCplxFloatN *a,
                                             CrankMatFloatN     *b,
                                             CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_addr_self (CrankMatCplxFloatN *a,
                                                  CrankMatFloatN     *b);

void            crank_mat_cplx_float_n_add (CrankMatCplxFloatN *a,
                                            CrankMatCplxFloatN *b,
                                            CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_add_self (CrankMatCplxFloatN *a,
                                                 CrankMatCplxFloatN *b);

void            crank_mat_cplx_float_n_subr (CrankMatCplxFloatN *a,
                                             CrankMatFloatN     *b,
                                             CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_subr_self (CrankMatCplxFloatN *a,
                                                  CrankMatFloatN     *b);

void            crank_mat_cplx_float_n_sub (CrankMatCplxFloatN *a,
                                            CrankMatCplxFloatN *b,
                                            CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_sub_self (CrankMatCplxFloatN *a,
                                                 CrankMatCplxFloatN *b);

//////// Ternary operaions ////////

void            crank_mat_cplx_float_n_mixs (CrankMatCplxFloatN *a,
                                             CrankMatCplxFloatN *b,
                                             const gfloat        c,
                                             CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_mix (CrankMatCplxFloatN *a,
                                            CrankMatCplxFloatN *b,
                                            CrankMatFloatN     *c,
                                            CrankMatCplxFloatN *r);

//////// Shuffling ////////

void            crank_mat_cplx_float_n_shuffle_row (CrankMatCplxFloatN *a,
                                                    CrankPermutation   *p,
                                                    CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_shuffle_col (CrankMatCplxFloatN *a,
                                                    CrankPermutation   *p,
                                                    CrankMatCplxFloatN *r);

//////// Supplement Operations /////////////////////////////////////////////////

void            crank_mat_cplx_float_n_upper_tri_inverse (
  CrankMatCplxFloatN *a,
  CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_lower_tri_inverse (
  CrankMatCplxFloatN *a,
  CrankMatCplxFloatN *r);

void            crank_mat_cplx_float_n_diag_inverse (CrankMatCplxFloatN *a,
                                                     CrankMatCplxFloatN *r);

G_END_DECLS

#endif


text:
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.web.client import Agent, CookieAgent
from twisted.internet.protocol import Protocol
from zope.interface import implements
from twisted.internet.defer import succeed
from twisted.web.iweb import IBodyProducer
import urllib
from twisted.web.http_headers import Headers
from twisted.cred._digest import calcResponse, calcHA1, calcHA2
import uuid
from urlparse import urlparse
import re
from base64 import b64encode
from cookielib import CookieJar

AUTH_REGEX = re.compile('(\w+)[=] ?"?(\w+)"?')

def produce_credential_headers(username, password):
    header = "Basic %s" % b64encode("%s:%s" % (username, password))
    return {"Authorization":[header]}

class StringProducer(object):

    implements(IBodyProducer)

    def __init__(self, body):
        self.body = body
        self.length = len(body)

    def startProducing(self, consumer):
        consumer.write(self.body)
        return succeed(None)

    def pauseProducing(self):
        pass

    def stopProducing(self):
        pass

class BodyDeliverProtocol(Protocol):

    def __init__(self, finished):
        self.finished = finished
        self.remaining = 1024 * 10
        self.data = []

    def dataReceived(self, bytes):
        if self.remaining:
            display = bytes[:self.remaining]
            self.data.append(display)
            self.remaining -= len(display)

    def connectionLost(self, reason):
        self.finished.callback("".join(self.data))

COOKIEJAR = CookieJar()
AGENT = CookieAgent(Agent(reactor), COOKIEJAR)

@inlineCallbacks
def request(*args, **kwargs):
    headers = kwargs.get("headers", {})
    if "data" in kwargs:
        body = StringProducer(urllib.urlencode(kwargs["data"]))
        del kwargs["data"]
        kwargs["bodyProducer"] = body
        headers.update({'Content-Type': ['application/x-www-form-urlencoded']})
        kwargs["headers"] = headers
    if "headers" in kwargs:
        kwargs["headers"] = Headers(kwargs["headers"])
    if "username" in kwargs:
        username = kwargs["username"]
        del kwargs["username"]
    else:
        username = None
    if "password" in kwargs:
        password = kwargs["password"]
        del kwargs["password"]
    else:
        password = None
    response = yield AGENT.request(*args, **kwargs)
    finished = Deferred()
    response.deliverBody(BodyDeliverProtocol(finished))
    response.body = yield finished
    if response.code == 401 and username and password:
        headers.update(produce_credential_headers(
            username,
            password))
        kwargs["headers"] = Headers(headers)
        response = yield AGENT.request(*args, **kwargs)
        finished = Deferred()
        response.deliverBody(BodyDeliverProtocol(finished))
        response.body = yield finished
    response.cookies = AGENT.cookieJar
    returnValue(response)


text:
package org.camunda.bpm.engine.impl.cmd;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.Serializable;

import org.camunda.bpm.engine.impl.interceptor.Command;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.persistence.entity.AttachmentEntity;
import org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity;

/**
 * @author kristin.polenz@camunda.com
 */
public class GetTaskAttachmentContentCmd implements Command<InputStream>, Serializable {

  private static final long serialVersionUID = 1L;

  protected String attachmentId;
  protected String taskId;

  public GetTaskAttachmentContentCmd(String taskId, String attachmentId) {
    this.attachmentId = attachmentId;
    this.taskId = taskId;
  }

  public InputStream execute(CommandContext commandContext) {
    AttachmentEntity attachment = (AttachmentEntity) commandContext
        .getAttachmentManager()
        .findAttachmentByTaskIdAndAttachmentId(taskId, attachmentId);

    if (attachment == null) {
      return null;
    }

    String contentId = attachment.getContentId();
    if (contentId==null) {
      return null;
    }

    ByteArrayEntity byteArray = commandContext
        .getDbEntityManager()
        .selectById(ByteArrayEntity.class, contentId);

    byte[] bytes = byteArray.getBytes();

    return new ByteArrayInputStream(bytes);
  }

}


text:
import pstats, cProfile
import cymlda

import pyximport
pyximport.install()

command = '''
import numpy as np
model = cymlda.mylda()
model.readCorpus()
model.train_corpus(1)
prev_het = np.zeros(np.shape(model._n_het))
np.copyto(prev_het, model._n_het)
for i in range(10):
    print 'iter %d' % (i+1)
    model.train_corpus(1)
    model._abs_delta_het = np.abs(model._n_het - prev_het)
    np.copyto(prev_het, model._n_het)
    if i%5 == 0:
        model.output_topic(i)
'''

cProfile.runctx('cymlda.main()', globals(), locals(), 'Profile.prof')

s = pstats.Stats('Profile.prof')
s.strip_dirs().sort_stats('time').print_stats()


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.Communication.CallingServer
{
    internal partial class CreateCallRequestInternal : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("targets");
            writer.WriteStartArray();
            foreach (var item in Targets)
            {
                writer.WriteObjectValue(item);
            }
            writer.WriteEndArray();
            writer.WritePropertyName("source");
            writer.WriteObjectValue(Source);
            if (Optional.IsDefined(Subject))
            {
                writer.WritePropertyName("subject");
                writer.WriteStringValue(Subject);
            }
            writer.WritePropertyName("callbackUri");
            writer.WriteStringValue(CallbackUri);
            if (Optional.IsDefined(MediaStreamingConfiguration))
            {
                writer.WritePropertyName("mediaStreamingConfiguration");
                writer.WriteObjectValue(MediaStreamingConfiguration);
            }
            writer.WriteEndObject();
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>meteo</artifactId>
        <groupId>no.api.meteo</groupId>
        <version>3.1.3-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>meteo-jaxb</artifactId>
    <version>3.1.3-SNAPSHOT</version>

    <build>
        <plugins>

        </plugins>
    </build>
</project>


text:
<?php

require '../../config.php';

$id = $_POST['res']; // temporary

$id = stripslashes($id);

try {
  $conn = new PDO('mysql:host=localhost;dbname=berkshir_bbag_7', $config['DB_USERNAME'], $config['DB_PASSWORD']);

  $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $stmt = $conn->prepare('SELECT * FROM winter_dist_abundance WHERE Tetrad =:id');
  // $stmt->setFetchMode(PDO::FETCH_OBJ);

  $stmt->execute(array(
      'id' => $id
    ));

  //$results = $stmt->fetch();
  //print_r($results);

  // print left margin div
  // echo "

";

  while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    //print_r($row);
    unset($row["Tetrad"],$row["Occupied tetrads (all)"],$row["Occupied tetrads (TTVs)"],$row["Average of occupied tetrads in TTV"]);

        foreach ($row as $result) {

          echo "

";

        }

  }

} catch(PDOException $e) {
  echo 'ERROR: ' . $e->getMessage();
}

?>


text:
<?php

/**
 * As the name suggests these are helpers for Timber (and you!) when developing. You can find additional (mainly internally-focused helpers) in TimberURLHelper
 */
class TimberHelper {

	/**
	 * A utility for a one-stop shop for Transients
	 * @api
	 * @example
	 * ```php
	 * $favorites = Timber::transient('user-'.$uid.'-favorites', function() use ($uid) {
	 *  	//some expensive query here that's doing something you want to store to a transient
	 *  	return $favorites;
	 * }, 600);
	 * Timber::context['favorites'] = $favorites;
	 * Timber::render('single.twig', $context);
	 * ```
	 *
	 * @param string  $slug           Unique identifier for transient
	 * @param callable $callback      Callback that generates the data that's to be cached
	 * @param int     $transient_time (optional) Expiration of transients in seconds
	 * @param int     $lock_timeout   (optional) How long (in seconds) to lock the transient to prevent race conditions
	 * @param bool    $force          (optional) Force callback to be executed when transient is locked
	 * @return mixed
	 */
	public static function transient( $slug, $callback, $transient_time = 0, $lock_timeout = 5, $force = false ) {

		$enable_transients = ( $transient_time === false || ( defined( 'WP_DISABLE_TRANSIENTS' ) && WP_DISABLE_TRANSIENTS ) ) ? false : true;
		$data = $enable_transients ? get_transient( $slug ) : false;

		if ( false === $data ) {

			if ( $enable_transients && self::_is_transient_locked( $slug ) ) {

				$force = apply_filters( 'timber_force_transients', $force );
				$force = apply_filters( 'timber_force_transient_' . $slug, $force );

				if ( !$force ) {
					//the server is currently executing the process.
					//We're just gonna dump these users. Sorry!
					return false;
				}

				$enable_transients = false;
			}

			// lock timeout shouldn't be higher than 5 seconds, unless
			// remote calls with high timeouts are made here
			if ( $enable_transients )
				self::_lock_transient( $slug, $lock_timeout );

			$data = $callback();

			if ( $enable_transients ) {
				set_transient( $slug, $data, $transient_time );
				self::_unlock_transient( $slug );
			}

		}

		return $data;

	}

	/**
	 * @internal
	 * @param string $slug
	 * @param integer $lock_timeout
	 */
	static function _lock_transient( $slug, $lock_timeout ) {
		set_transient( $slug . '_lock', true, $lock_timeout );
	}

	/**
	 * @internal
	 * @param string $slug
	 */
	static function _unlock_transient( $slug ) {
		delete_transient( $slug . '_lock', true );
	}

	/**
	 * @internal
	 * @param string $slug
	 */
	static function _is_transient_locked( $slug ) {
		return (bool)get_transient( $slug . '_lock' );
	}

	/* These are for measuring page render time */

	/**
	 * For measuring time, this will start a timer
	 * @api
	 * @return float
	 */
	public static function start_timer() {
		$time = microtime();
		$time = explode( ' ', $time );
		$time = $time[1] + $time[0];
		return $time;
	}

	/**
	 * For stopping time and getting the data
	 * @example
	 * ```php
	 * $start = TimberHelper::start_timer();
	 * // do some stuff that takes awhile
	 * echo TimberHelper::stop_timer( $start );
	 * ```
	 * @param int     $start
	 * @return string
	 */
	public static function stop_timer( $start ) {
		$time = microtime();
		$time = explode( ' ', $time );
		$time = $time[1] + $time[0];
		$finish = $time;
		$total_time = round( ( $finish - $start ), 4 );
		return $total_time . ' seconds.';
	}

	/* Function Utilities
	======================== */

	/**
	 * Calls a function with an output buffer. This is useful if you have a function that outputs text that you want to capture and use within a twig template.
	 * @example
	 * ```php
	 * function the_form() {
	 *     echo '<form action="form.php"><input type="text" /><input type="submit /></form>';
	 * }
	 *
	 * $context = Timber::get_context();
	 * $context['post'] = new TimberPost();
	 * $context['my_form'] = TimberHelper::ob_function('the_form');
	 * Timber::render('single-form.twig', $context);
	 * ```
	 * ```twig
	 * <h1>{{ post.title }}</h1>
	 * {{ my_form }}
	 * ```
	 * ```html
	 * <h1>Apply to my contest!</h1>
	 * <form action="form.php"><input type="text" /><input type="submit /></form>
	 * ```
	 * @api
	 * @param callback $function
	 * @param array   $args
	 * @return string
	 */
	public static function ob_function( $function, $args = array( null ) ) {
		ob_start();
		call_user_func_array( $function, $args );
		$data = ob_get_contents();
		ob_end_clean();
		return $data;
	}

	/**
	 *
	 *
	 * @param string  $function_name
	 * @param integer[]   $defaults
	 * @param bool    $return_output_buffer
	 * @return TimberFunctionWrapper
	 */
	public static function function_wrapper( $function_name, $defaults = array(), $return_output_buffer = false ) {
		return new TimberFunctionWrapper( $function_name, $defaults, $return_output_buffer );
	}

	/**
	 *
	 *
	 * @param mixed $arg that you want to error_log
	 * @return void
	 */
	public static function error_log( $arg ) {
		if ( !WP_DEBUG ) {
			return;
		}
		if ( is_object( $arg ) || is_array( $arg ) ) {
			$arg = print_r( $arg, true );
		}
		return error_log( $arg );
	}

	/**
	 *
	 *
	 * @param string  $separator
	 * @param string  $seplocation
	 * @return string
	 */
	public static function get_wp_title( $separator = ' ', $seplocation = 'left' ) {
		$separator = apply_filters( 'timber_wp_title_seperator', $separator );
		return trim( wp_title( $separator, false, $seplocation ) );
	}

	/* Text Utilities
	======================== */

	/**
	 *
	 *
	 * @param string  $text
	 * @param int     $num_words
	 * @param string|null|false  $more text to appear in "Read more...". Null to use default, false to hide
	 * @param string  $allowed_tags
	 * @return string
	 */
	public static function trim_words( $text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote' ) {
		if ( null === $more ) {
			$more = __( '…' );
		}
		$original_text = $text;
		$allowed_tag_string = '';
		foreach ( explode( ' ', apply_filters( 'timber/trim_words/allowed_tags', $allowed_tags ) ) as $tag ) {
			$allowed_tag_string .= '<' . $tag . '>';
		}
		$text = strip_tags( $text, $allowed_tag_string );
		/* translators: If your word count is based on single characters (East Asian characters), enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
		if ( 'characters' == _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
			$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
			preg_match_all( '/./u', $text, $words_array );
			$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
			$sep = '';
		} else {
			$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
			$sep = ' ';
		}
		if ( count( $words_array ) > $num_words ) {
			array_pop( $words_array );
			$text = implode( $sep, $words_array );
			$text = $text . $more;
		} else {
			$text = implode( $sep, $words_array );
		}
		$text = self::close_tags( $text );
		return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
	}

	/**
	 *
	 *
	 * @param string  $html
	 * @return string
	 */
	public static function close_tags( $html ) {
		//put all opened tags into an array
		preg_match_all( '#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result );
		$openedtags = $result[1];
		//put all closed tags into an array
		preg_match_all( '#</([a-z]+)>#iU', $html, $result );
		$closedtags = $result[1];
		$len_opened = count( $openedtags );
		// all tags are closed
		if ( count( $closedtags ) == $len_opened ) {
			return $html;
		}
		$openedtags = array_reverse( $openedtags );
		// close tags
		for ( $i = 0; $i < $len_opened; $i++ ) {
			if ( !in_array( $openedtags[$i], $closedtags ) ) {
				$html .= '</' . $openedtags[$i] . '>';
			} else {
				unset( $closedtags[array_search( $openedtags[$i], $closedtags )] );
			}
		}
		$html = str_replace(array('
','
','</wbr>'), '', $html);
		$html = str_replace(array('
','
','<wbr>'), array('
','
','<wbr />'), $html);
		return $html;
	}

	/* WordPress Query Utilities
	======================== */

	/**
	 * @param string  $key
	 * @param string  $value
	 * @return array|int
	 * @deprecated 0.20.0
	 */
	public static function get_posts_by_meta( $key, $value ) {
		global $wpdb;
		$query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %s", $key, $value );
		$results = $wpdb->get_col( $query );
		$pids = array();
		foreach ( $results as $result ) {
			if ( get_post( $result ) ) {
				$pids[] = $result;
			}
		}
		if ( count( $pids ) ) {
			return $pids;
		}
		return 0;
	}

	/**
	 *
	 *
	 * @param string  $key
	 * @param string  $value
	 * @return int
	 * @deprecated 0.20.0
	 */
	public static function get_post_by_meta( $key, $value ) {
		global $wpdb;
		$query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %s ORDER BY post_id", $key, $value );
		$results = $wpdb->get_col( $query );
		foreach ( $results as $result ) {
			if ( $result && get_post( $result ) ) {
				return $result;
			}
		}
		return 0;
	}

	/**
	 *
	 * @deprecated 0.21.8
	 * @param int     $ttid
	 * @return mixed
	 */
	public static function get_term_id_by_term_taxonomy_id( $ttid ) {
		global $wpdb;
		$query = $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %s", $ttid );
		return $wpdb->get_var( $query );
	}

	/* Object Utilities
	======================== */

	/**
	 *
	 *
	 * @param array   $array
	 * @param string  $prop
	 * @return void
	 */
	public static function osort( &$array, $prop ) {
		usort( $array, function ( $a, $b ) use ( $prop ) {
				return $a->$prop > $b->$prop ? 1 : -1;
			} );
	}

	/**
	 *
	 *
	 * @param array   $arr
	 * @return bool
	 */
	public static function is_array_assoc( $arr ) {
		if ( !is_array( $arr ) ) {
			return false;
		}
		return (bool)count( array_filter( array_keys( $arr ), 'is_string' ) );
	}

	/**
	 *
	 *
	 * @param array   $array
	 * @return stdClass
	 */
	public static function array_to_object( $array ) {
		$obj = new stdClass;
		foreach ( $array as $k => $v ) {
			if ( is_array( $v ) ) {
				$obj->{$k} = self::array_to_object( $v ); //RECURSION
			} else {
				$obj->{$k} = $v;
			}
		}
		return $obj;
	}

	/**
	 *
	 *
	 * @param array   $array
	 * @param string  $key
	 * @param mixed   $value
	 * @return bool|int
	 */
	public static function get_object_index_by_property( $array, $key, $value ) {
		if ( is_array( $array ) ) {
			$i = 0;
			foreach ( $array as $arr ) {
				if ( is_array( $arr ) ) {
					if ( $arr[$key] == $value ) {
						return $i;
					}
				} else {
					if ( $arr->$key == $value ) {
						return $i;
					}
				}
				$i++;
			}
		}
		return false;
	}

	/**
	 *
	 *
	 * @param array   $array
	 * @param string  $key
	 * @param mixed   $value
	 * @return array|null
	 * @throws Exception
	 */
	public static function get_object_by_property( $array, $key, $value ) {
		if ( is_array( $array ) ) {
			foreach ( $array as $arr ) {
				if ( $arr->$key == $value ) {
					return $arr;
				}
			}
		} else {
			throw new InvalidArgumentException( '$array is not an array, got:' );
			TimberHelper::error_log( $array );
		}
	}

	/**
	 *
	 *
	 * @param array   $array
	 * @param int     $len
	 * @return array
	 */
	public static function array_truncate( $array, $len ) {
		if ( sizeof( $array ) > $len ) {
			$array = array_splice( $array, 0, $len );
		}
		return $array;
	}

	/* Bool Utilities
	======================== */

	/**
	 *
	 *
	 * @param mixed   $value
	 * @return bool
	 */
	public static function is_true( $value ) {
		if ( isset( $value ) ) {
			if (is_string($value)) {
				$value = strtolower($value);
			}
			if ( ($value == 'true' || $value === 1 || $value === '1' || $value == true) && $value !== false && $value !== 'false') {
				return true;
			}
		}
		return false;
	}

	/**
	 *
	 *
	 * @param int     $i
	 * @return bool
	 */
	public static function iseven( $i ) {
		return ( $i % 2 ) == 0;
	}

	/**
	 *
	 *
	 * @param int     $i
	 * @return bool
	 */
	public static function isodd( $i ) {
		return ( $i % 2 ) != 0;
	}

	/* Links, Forms, Etc. Utilities
	======================== */

	/**
	 *
	 * Gets the comment form for use on a single article page
	 * @deprecated 0.21.8 use `{{ function('comment_form') }}` instead
	 * @param int     $post_id which post_id should the form be tied to?
	 * @param array   $args this $args thing is a fucking mess, [fix at some point](http://codex.wordpress.org/Function_Reference/comment_form)
	 * @return string
	 */
	public static function get_comment_form( $post_id = null, $args = array() ) {
		return self::ob_function( 'comment_form', array( $args, $post_id ) );
	}

	/**
	 *
	 *
	 * @param string  $args
	 * @return array
	 */
	public static function paginate_links( $args = '' ) {
		$defaults = array(
			'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
			'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
			'total' => 1,
			'current' => 0,
			'show_all' => false,
			'prev_next' => false,
			'prev_text' => __( '« Previous' ),
			'next_text' => __( 'Next »' ),
			'end_size' => 1,
			'mid_size' => 2,
			'type' => 'array',
			'add_args' => false, // array of query args to add
			'add_fragment' => ''
		);
		$args = wp_parse_args( $args, $defaults );
		// Who knows what else people pass in $args
		$args['total'] = intval( (int)$args['total'] );
		if ( $args['total'] < 2 ) {
			return array();
		}
		$args['current'] = (int)$args['current'];
		$args['end_size'] = 0 < (int)$args['end_size'] ? (int)$args['end_size'] : 1; // Out of bounds?  Make it the default.
		$args['mid_size'] = 0 <= (int)$args['mid_size'] ? (int)$args['mid_size'] : 2;
		$args['add_args'] = is_array( $args['add_args'] ) ? $args['add_args'] : false;
		$page_links = array();
		$dots = false;
		for ( $n = 1; $n <= $args['total']; $n++ ) {
			$n_display = number_format_i18n( $n );
			if ( $n == $args['current'] ) {
				$page_links[] = array(
					'class' => 'page-number page-numbers current',
					'title' => $n_display,
					'text' => $n_display,
					'name' => $n_display,
					'current' => true
				);
				$dots = true;
			} else {
				if ( $args['show_all'] || ( $n <= $args['end_size'] || ( $args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size'] ) || $n > $args['total'] - $args['end_size'] ) ) {
					$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
					$link = str_replace( '%#%', $n, $link );
					$link = trailingslashit( $link ) . ltrim( $args['add_fragment'], '/' );
					if ( $args['add_args'] ) {
						$link = rtrim( add_query_arg( $args['add_args'], $link ), '/' );
					}
					$link = str_replace(' ', '+', $link);
					$link = untrailingslashit( $link );
					$page_links[] = array(
						'class' => 'page-number page-numbers',
						'link' => esc_url( apply_filters( 'paginate_links', $link ) ),
						'title' => $n_display,
						'name' => $n_display,
						'current' => $args['current'] == $n
					);
					$dots = true;
				} elseif ( $dots && !$args['show_all'] ) {
					$page_links[] = array(
						'class' => 'dots',
						'title' => __( '…' )
					);
					$dots = false;
				}
			}
		}
		return $page_links;
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function get_current_url() {
		return TimberURLHelper::get_current_url();
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function is_url( $url ) {
		return TimberURLHelper::is_url( $url );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function get_path_base() {
		return TimberURLHelper::get_path_base();
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function get_rel_url( $url, $force = false ) {
		return TimberURLHelper::get_rel_url( $url, $force );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function is_local( $url ) {
		return TimberURLHelper::is_local( $url );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function get_full_path( $src ) {
		return TimberURLHelper::get_full_path( $src );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function get_rel_path( $src ) {
		return TimberURLHelper::get_rel_path( $src );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function remove_double_slashes( $url ) {
		return TimberURLHelper::remove_double_slashes( $url );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function prepend_to_url( $url, $path ) {
		return TimberURLHelper::prepend_to_url( $url, $path );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function preslashit( $path ) {
		return TimberURLHelper::preslashit( $path );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function is_external( $url ) {
		return TimberURLHelper::is_external( $url );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function download_url( $url, $timeout = 300 ) {
		return TimberURLHelper::download_url( $url, $timeout );
	}

	/**
	 * @deprecated 0.18.0
	 */
	static function get_params( $i = -1 ) {
		return TimberURLHelper::get_params( $i );
	}

}


text:
var iopipe = require("iopipe")

iopipe.define("http://requestb.in/api/v1/bins", JSON.parse, iopipe.property("name"), function(name) {
  var rbin = "http://requestb.in/"+name

  iopipe.exec(
    "https://api.github.com/repos/iopipe/iopipe/stats/contributors"
    ,JSON.parse
    ,iopipe.map(iopipe.property("total"))
    ,iopipe.reduce(function(x, y) { return x + y })
    ,rbin
  )
  console.log("POST data sent to " + rbin + "?inspect")
})("")


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.groboclown.p4.server.api.messagebus;

import com.intellij.openapi.project.Project;
import com.intellij.util.messages.Topic;
import org.jetbrains.annotations.NotNull;

public class UserProjectPreferencesUpdatedMessage
        extends ProjectMessage<UserProjectPreferencesUpdatedMessage.Listener> {
    private static final String DISPLAY_NAME = "p4ic4idea:user preferences updated";
    private static final Topic<Listener> TOPIC = new Topic<>(
            DISPLAY_NAME, Listener.class, Topic.BroadcastDirection.TO_CHILDREN
    );
    private static final Listener DEFAULT_LISTENER = new ListenerAdapter();

    public static class UserPreferencesUpdatedEvent extends AbstractMessageEvent {
        // Note that the project settings are not passed into this class, because
        // it's not in scope for this class!
        public UserPreferencesUpdatedEvent() {
        }
    }

    public interface Listener {
        void userPreferencesUpdated(@NotNull UserPreferencesUpdatedEvent e);
    }

    public static class ListenerAdapter implements Listener {
        @Override
        public void userPreferencesUpdated(@NotNull UserPreferencesUpdatedEvent e) {
        }
    }

    /**
     * Should only be called by {@link net.groboclown.p4.server.api.ProjectConfigRegistry}.  Doesn't conform to
     * the "send(Project)" standard API, because it can trigger 2 events.
     *
     * @param project project to send the message on.
     */
    public static Listener send(@NotNull Project project) {
        return getListener(project, TOPIC, DEFAULT_LISTENER);
    }

    public static void addListener(@NotNull MessageBusClient.ProjectClient client,
            @NotNull Object listenerOwner, @NotNull Listener listener) {
        addListener(client, TOPIC, listener, Listener.class, listenerOwner);
    }
}


text:
class AddMemoToItem < ActiveRecord::Migration[5.2]
  def change
    add_column :items, :memo, :text
  end
end


text:
import numpy

import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import function_node
from chainer.utils import type_check
import chainerx

class ScatterAdd(function_node.FunctionNode):

    def __init__(self, slices):
        if isinstance(slices, list):
            if all([isinstance(s, int) for s in slices]):
                slices = slices,
            slices = tuple(slices)
        elif not isinstance(slices, tuple):
            slices = slices,

        if chainer.is_debug():
            n_ellipses = 0
            for s in slices:
                if s is Ellipsis:
                    n_ellipses += 1
            if n_ellipses > 1:
                raise ValueError('Only one Ellipsis is allowed')

        self.slices = slices

    def check_type_forward(self, in_types):
        type_check._argname(in_types, ('a', 'b'))
        n_nones = len([item for item in self.slices if item is None])
        valid_slice = len(self.slices) - n_nones
        type_check.expect(in_types[0].ndim >= valid_slice)

    def forward(self, xs):
        a = xs[0]
        b = xs[1]
        y = a.copy()
        xp = backend.get_array_module(a)
        slices = tuple([
            backend.from_chx(s) if isinstance(s, chainerx.ndarray) else s
            for s in self.slices])
        if y[slices].shape != b.shape:
            raise ValueError(
                'Chainer does not support automatic broadcasting '
                'of variables.')
        if xp is numpy:
            numpy.add.at(y, slices, b),
        else:
            cuda.cupyx.scatter_add(y, slices, b),
        return y,

    def backward(self, indexes, grad_outputs):
        gy, = grad_outputs

        ret = []
        if 0 in indexes:
            ret.append(gy)
        if 1 in indexes:
            ret.append(gy[self.slices])

        return ret

def scatter_add(a, slices, b):
    """Adds given values to specified elements of an array.

    This function adds ``b`` to the specified elements of the copy of
    ``a``, and returns the copy.
    The value of the original ``a`` is not changed.

    Args:
        a (:class:`~chainer.Variable` or :ref:`ndarray`): A variable.
        slices (int, slice, Ellipsis, None, integer array-like, boolean\
        array-like or tuple of them):
            It is an integer, a slice, an ellipsis,
            a numpy.newaxis, an integer array-like, a boolean array-like
            or tuple of them.
        b (:class:`~chainer.Variable` or :ref:`ndarray`):
            A variable that is scatter added to ``a``.
            Its shape has to equal ``a[slices]`` because broadcasting
            of variables is not supported.

    Returns:
        A :class:`~chainer.Variable` object which is the result of
        scatter addition.

    .. note::

        It only supports types that are supported by CUDA's atomicAdd when
        an integer array is included in ``slices``.
        The supported types are ``numpy.float32``, ``numpy.int32``,
        ``numpy.uint32``, ``numpy.uint64`` and ``numpy.ulonglong``.

    .. note::

        It does not support ``slices`` that contains multiple boolean arrays.

    .. seealso::
        :func:`numpy.add.at` and
        :func:`cupyx.scatter_add`.

    """
    y, = ScatterAdd(slices).apply((a, b))
    return y


text:
insert into cdm_synpuf_v667.dbo.observation with (tablock) (
observation_type_concept_id,
value_as_number,
value_as_string,
value_as_concept_id,
qualifier_concept_id,
unit_concept_id,
provider_id,
visit_occurrence_id,
observation_source_value,
observation_source_concept_id,
unit_source_value,
qualifier_source_value,
observation_id,
person_id,
observation_concept_id,
observation_date,
observation_datetime
)
select observation_type_concept_id,
value_as_number,
value_as_string,
value_as_concept_id,
qualifier_concept_id,
unit_concept_id,
provider_id,
visit_occurrence_id,
observation_source_value,
observation_source_concept_id,
unit_source_value,
qualifier_source_value,
observation_id,
person_id,
observation_concept_id,
observation_date,
NULL -- observation_datetime
from cdm_synpuf_v665.dbo.observation;


text:
<!DOCTYPE html>

<meta name="generator" content="Hexo 3.9.0">

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

        <meta name="description" content="A shelter for a lazy and terrible programmer, loving photograph and travelling!">

        <meta name="author" content="Haoxuan (Horace) Wang">

        <meta property="og:title" content="贝壳小屋">

        <meta property="og:description" content="A shelter for a lazy and terrible programmer, loving photograph and travelling!">

    <meta property="og:site_name" content="贝壳小屋">

        <meta property="og:type" content="website">

        <meta name="twitter:card" content="summary">

    <title>归档:2016/6 - 贝壳小屋</title>

    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" href="/css/style.css">

    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="//fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
    <link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">

    <link href="//cdnjs.cloudflare.com/ajax/libs/featherlight/1.3.5/featherlight.min.css" type="text/css" rel="stylesheet">

            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                Toggle navigation

            </button>
            Shell Cottage

                                Home

                                Archives

                                Categories

                                About ME

2016/6

                      Everything is here.

                   2016-06-26 »

                           苏州美食短记

                   2016-06-09 »

                           写在西浦别离时

 <legend id="2016 - May"> May </legend>

Friends

                                Towdium

Contact Me

© 2021 Haoxuan (Horace) Wang

Original Theme Clean Blog from Start Bootstrap

Adapted for Hexo by Jonathan Klughertz


text:
RailsAdminSimpleHasMany is a field type for [Rails Admin](https://github.com/sferik/rails_admin) for has_many associations that do not require a complex multiselect field. RailsAdminSimpleHasMany has been only tested with Mongoid adapter and on Chrome/Safari. I do not expect major issues with other ORMs or browsers, but bugs and enhancements pull requests are welcome!

Example of how the collection field would look like:

![RailsAdminSimpleHasMany screenshot1](https://s3.amazonaws.com/aimannajjar.com/assets/images/portfolio/rails_admin_simple_has_many_sm_orderable.png)

## Usage

Simply add the following gem to your Gemfile:
```ruby
gem "rails_admin_simple_has_many"
```
And then run `bundle` (note: `rails_admin` should already be in your Gemfile)

Next, add the field as follows in your model

```ruby
rails_admin do
    field :players, :simple_has_many do
        help 'Please add 12 players'
        orderable true
        required true
    end
end
```

Note: `orderable` enables UI controls to move items up and down but you still need to support it in your models, see [this](https://github.com/sferik/rails_admin/wiki/Orderable---Sortable-Has-Many-without-Through) for an example using `has_many` assocaition with Mongoid/MongoDB and [this](https://github.com/sferik/rails_admin/wiki/Has-many-%3Athrough-association) for an example using `has_many :through` and ActiveRecord.


text:
struct AnimationFrame
{
	const char* path;
	int time;
};

struct AnimationDef
{
	AnimationFrame* frames;
	size_t frameCount;
	bool loop;
};

class AnimatedImageComponent : public GuiComponent
{
public:
	AnimatedImageComponent(Window* window);

	void load(const AnimationDef* def); // no reference to def is kept after loading is complete

	void reset(); // set to frame 0

	void update(int deltaTime) override;
	void render(const Eigen::Affine3f& trans) override;

	void onSizeChanged() override;

private:
	typedef std::pair<std::unique_ptr<ImageComponent>, int> ImageFrame;

	std::vector<ImageFrame> mFrames;

	bool mLoop;
	bool mEnabled;
	int mFrameAccumulator;
	int mCurrentFrame;
};