text:
<?php
declare(strict_types=1);

namespace Cake\Command;

use Cake\Console\Arguments;
use Cake\Console\ConsoleIo;
use Cake\Console\ConsoleOptionParser;
use Cake\Core\Configure;

/**
 * built-in Server command
 */
class ServerCommand extends Command
{
    /**
     * Default ServerHost
     *
     * @var string
     */
    public const DEFAULT_HOST = 'localhost';

    /**
     * Default ListenPort
     *
     * @var int
     */
    public const DEFAULT_PORT = 8765;

    /**
     * server host
     *
     * @var string
     */
    protected $_host = self::DEFAULT_HOST;

    /**
     * listen port
     *
     * @var int
     */
    protected $_port = self::DEFAULT_PORT;

    /**
     * document root
     *
     * @var string
     */
    protected $_documentRoot = WWW_ROOT;

    /**
     * ini path
     *
     * @var string
     */
    protected $_iniPath = '';

    /**
     * Starts up the Command and displays the welcome message.
     * Allows for checking and configuring prior to command or main execution
     *
     * @param \Cake\Console\Arguments $args The command arguments.
     * @param \Cake\Console\ConsoleIo $io The console io
     * @return void
     * @link https://book.cakephp.org/4/en/console-and-shells.html#hook-methods
     */
    protected function startup(Arguments $args, ConsoleIo $io): void
    {
        if ($args->getOption('host')) {
            $this->_host = (string)$args->getOption('host');
        }
        if ($args->getOption('port')) {
            $this->_port = (int)$args->getOption('port');
        }
        if ($args->getOption('document_root')) {
            $this->_documentRoot = (string)$args->getOption('document_root');
        }
        if ($args->getOption('ini_path')) {
            $this->_iniPath = (string)$args->getOption('ini_path');
        }

        // For Windows
        if (substr($this->_documentRoot, -1, 1) === DIRECTORY_SEPARATOR) {
            $this->_documentRoot = substr($this->_documentRoot, 0, strlen($this->_documentRoot) - 1);
        }
        if (preg_match("/^([a-z]:)[\\\]+(.+)$/i", $this->_documentRoot, $m)) {
            $this->_documentRoot = $m[1] . '\\' . $m[2];
        }

        $this->_iniPath = rtrim($this->_iniPath, DIRECTORY_SEPARATOR);
        if (preg_match("/^([a-z]:)[\\\]+(.+)$/i", $this->_iniPath, $m)) {
            $this->_iniPath = $m[1] . '\\' . $m[2];
        }

        $io->out();
        $io->out(sprintf('<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version()));
        $io->hr();
        $io->out(sprintf('App : %s', Configure::read('App.dir')));
        $io->out(sprintf('Path: %s', APP));
        $io->out(sprintf('DocumentRoot: %s', $this->_documentRoot));
        $io->out(sprintf('Ini Path: %s', $this->_iniPath));
        $io->hr();
    }

    /**
     * Execute.
     *
     * @param \Cake\Console\Arguments $args The command arguments.
     * @param \Cake\Console\ConsoleIo $io The console io
     * @return int|null The exit code or null for success
     */
    public function execute(Arguments $args, ConsoleIo $io): ?int
    {
        $this->startup($args, $io);
        $phpBinary = (string)env('PHP', 'php');
        $command = sprintf(
            '%s -S %s:%d -t %s',
            $phpBinary,
            $this->_host,
            $this->_port,
            escapeshellarg($this->_documentRoot)
        );

        if (!empty($this->_iniPath)) {
            $command = sprintf('%s -c %s', $command, $this->_iniPath);
        }

        $command = sprintf('%s %s', $command, escapeshellarg($this->_documentRoot . '/index.php'));

        $port = ':' . $this->_port;
        $io->out(sprintf('built-in server is running in http://%s%s/', $this->_host, $port));
        $io->out('You can exit with <info>`CTRL-C`</info>');
        system($command);

        return static::CODE_SUCCESS;
    }

    /**
     * Hook method for defining this command's option parser.
     *
     * @param \Cake\Console\ConsoleOptionParser $parser The option parser to update
     * @return \Cake\Console\ConsoleOptionParser
     */
    public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
    {
        $parser->setDescription([
            'PHP Built-in Server for CakePHP',
            '<warning>[WARN] Don\'t use this in a production environment</warning>',
        ])->addOption('host', [
            'short' => 'H',
            'help' => 'ServerHost',
        ])->addOption('port', [
            'short' => 'p',
            'help' => 'ListenPort',
        ])->addOption('ini_path', [
            'short' => 'I',
            'help' => 'php.ini path',
        ])->addOption('document_root', [
            'short' => 'd',
            'help' => 'DocumentRoot',
        ]);

        return $parser;
    }
}

redpajama_set_name: RedPajamaGithub


text:
// -----------------------------------------------------------------------
//   <copyright file="ExpandoObjectSerializerFactory.cs" company="Asynkron HB">
//       Copyright (C) 2015-2017 Asynkron HB All rights reserved
//   </copyright>
// -----------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Dynamic;
using System.IO;
using Wire.Extensions;
using Wire.ValueSerializers;

namespace Wire.SerializerFactories
{
    public class ExpandoObjectSerializerFactory : ValueSerializerFactory
    {
        public override bool CanSerialize(Serializer serializer, Type type)
        {
            return type == typeof(ExpandoObject);
        }

        public override bool CanDeserialize(Serializer serializer, Type type)
        {
            return CanSerialize(serializer, type);
        }

        public override ValueSerializer BuildSerializer(Serializer serializer, Type type,
            ConcurrentDictionary<Type, ValueSerializer> typeMapping)
        {
            var preserveObjectReferences = serializer.Options.PreserveObjectReferences;
            var ser = new ObjectSerializer(type);
            typeMapping.TryAdd(type, ser);
            var elementSerializer = serializer.GetSerializerByType(typeof(DictionaryEntry));

            object Reader(Stream stream, DeserializerSession session)
            {
                var instance = (IDictionary<string, object>) Activator.CreateInstance(type)!;

                if (preserveObjectReferences) session.TrackDeserializedObject(instance);
                var count = stream.ReadInt32(session);
                for (var i = 0; i < count; i++)
                {
                    var entry = (KeyValuePair<string, object>) stream.ReadObject(session);
                    instance.Add(entry);
                }

                return instance;
            }

            void Writer(Stream stream, object obj, SerializerSession session)
            {
                if (preserveObjectReferences) session.TrackSerializedObject(obj);
                var dict = (IDictionary<string, object>) obj;
                // ReSharper disable once PossibleNullReferenceException
                Int32Serializer.WriteValueImpl(stream, dict.Count, session);
                foreach (var item in dict)
                    stream.WriteObject(item, typeof(DictionaryEntry), elementSerializer,
                        serializer.Options.PreserveObjectReferences, session);
                // elementSerializer.WriteValue(stream,item,session);
            }

            ser.Initialize(Reader, Writer);

            return ser;
        }
    }
}


text:
FILE(REMOVE_RECURSE
  "CMakeFiles/test_physfs.dir/test/test_physfs.o"
  "test_physfs.pdb"
  "test_physfs"
)

# Per-language clean rules from dependency scanning.
FOREACH(lang C)
  INCLUDE(CMakeFiles/test_physfs.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)


text:
using Infrastructure.DataAccess.Contracts;
using Infrastructure.DataAccess.Entities.Contracts;
using Infrastructure.DataAccess.Entities.Enumerations;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;

namespace Infrastructure.DataAccess.Entities
{
    public class Repository<TEntity> : IRepository<TEntity> where TEntity : EntityBase
    {
        private readonly IDataContext _context;
        private readonly DbSet<TEntity> _dbSet;
        private readonly Guid _instanceId;

        public Repository(IDataContext context)
        {
            _context = context;
            _dbSet = context.Set<TEntity>();
            _instanceId = Guid.NewGuid();
        }

        public Guid InstanceId
        {
            get { return _instanceId; }
        }

        public virtual TEntity Find(params object[] keyValues)
        {
            return _dbSet.Find(keyValues);
        }

        public virtual async Task<TEntity> FindAsync(params object[] keyValues)
        {
            return await _dbSet.FindAsync(keyValues);
        }

        public virtual async Task<TEntity> FindAsync(CancellationToken cancellationToken, params object[] keyValues)
        {
            return await _dbSet.FindAsync(cancellationToken, keyValues);
        }

        public virtual IQueryable<TEntity> SqlQuery(string query, params object[] parameters)
        {
            return _dbSet.SqlQuery(query, parameters).AsQueryable();
        }

        public virtual void Insert(TEntity entity)
        {
            ((IObjectState)entity).ObjectState = ObjectState.Added;
            _dbSet.Attach(entity);
            _context.SyncObjectState(entity);
        }

        public virtual void InsertRange(IEnumerable<TEntity> entities)
        {
            foreach (var entity in entities)
            {
                Insert(entity);
            }
        }

        public virtual void InsertGraph(TEntity entity)
        {
            _dbSet.Add(entity);
        }

        public virtual void InsertGraphRange(IEnumerable<TEntity> entities)
        {
            _dbSet.AddRange(entities);
        }

        public virtual void Update(TEntity entity)
        {
            ((IObjectState)entity).ObjectState = ObjectState.Modified;
            _dbSet.Attach(entity);
            _context.SyncObjectState(entity);
        }

        public virtual void Delete(object id)
        {
            var entity = _dbSet.Find(id);
            Delete(entity);
        }

        public virtual void Delete(TEntity entity)
        {
            ((IObjectState)entity).ObjectState = ObjectState.Deleted;
            _dbSet.Attach(entity);
            _context.SyncObjectState(entity);
        }

        public virtual IRepositoryQuery<TEntity> Query()
        {
            var repositoryGetFluentHelper = new RepositoryQuery<TEntity>(this);
            return repositoryGetFluentHelper;
        }

        internal IQueryable<TEntity> Get(
            Expression<Func<TEntity, bool>> filter = null,
            Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
            List<Expression<Func<TEntity, object>>> includeProperties = null,
            int? page = null,
            int? pageSize = null)
        {
            IQueryable<TEntity> query = _dbSet;

            if (includeProperties != null)
            {
                includeProperties.ForEach(i => query = query.Include(i));
            }

            if (filter != null)
            {
                query = query.Where(filter);
            }

            if (orderBy != null)
            {
                query = orderBy(query);
            }

            if (page != null && pageSize != null)
            {
                query = query.Skip((page.Value - 1) * pageSize.Value).Take(pageSize.Value);
            }

            return query;
        }

        internal async Task<IEnumerable<TEntity>> GetAsync(
            Expression<Func<TEntity, bool>> filter = null,
            Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
            List<Expression<Func<TEntity, object>>> includeProperties = null,
            int? page = null,
            int? pageSize = null)
        {
            var result = await Task.FromResult(Get(filter, orderBy, includeProperties, page, pageSize).AsEnumerable());
            return result;
        }
    }
}


text:
/**
 * Created by DuanG on 2016/8/24.
 */
import * as React from 'react';
import {UserRegistInfo} from '../../../model/userRegistInfo';
import {connect} from 'react-redux';
import {FilterForm} from '../../../component/form/CreateFormFactory';
import {PromiseState, PromiseStatus} from '../../../utils/redux';
import {ResponseOuterModel} from '../../../model/common/commonResult';
import * as UserIndexActions from '../../../redux/actions/user/userIndex'

import {Dispatch} from "redux";
import {RouteComponentProps} from "react-router";
import {IUserIndexStore} from "../../../redux/reducers/user/userIndex";
import {ModalMessage, IModalMessageProps} from "../../../component/modal/ModalMessage";
import {Link} from 'react-router';
import './css/regist.less';
import {getRegistFromFilterProps, registFormBaseCls} from "form/registFormFilter";
import GenericComponent from "../../../component/abstract/GenericComponent";

interface IRegistUserStateProps{
    registUserResult?:PromiseState<ResponseOuterModel>;
}
interface IRegistDispatchUserProps{
    onSubmit?:(userRegistInfo:UserRegistInfo)=>void;
}

 interface IRegistUserProps extends IModalMessageProps{
     renderModalContent?:()=>void;
}

@connect<IRegistUserStateProps,IRegistDispatchUserProps,IRegistUserProps>(
    (state:IUserIndexStore, ownProps:IRegistUserProps) => {
        return {
            registUserResult:state.userIndex.registUserResult
        };
    },
    (dispatch:Dispatch)=>{
        return {
            onSubmit:(model:UserRegistInfo)=>dispatch(UserIndexActions.submitRegist(model))
        };
    }
)
@ModalMessage
export default class RegistUser extends GenericComponent<IRegistUserStateProps & IRegistDispatchUserProps & IRegistUserProps,any> {
    constructor(props) {
        super(props);
        // this.state=initState;
    }

    componentDidMount(){
    }
    renderModalContent(){//信息提示描述模版
        return(

该帐号已被注册过,请重新输入新的帐号注册

        )
    }
    componentWillReceiveProps(nextProps){
        if(nextProps.registUserResult!=this.props.registUserResult&&nextProps.registUserResult.status===PromiseStatus.Loaded){
            let state=nextProps.registUserResult.data.state;
            let result=nextProps.registUserResult.data.result;
            if(state!=1){
               // this.props.modalInfo(result.Message,this.renderModalContent());
                // this.props.modalSuccess(result.Message,'该帐号已被注册过,请重新输入新的帐号注册');
                this.props.modalWarning(result.Message,'该帐号已被注册过,请重新输入新的帐号注册');
            }
            else {
                this.props.modalSuccess(result,'恭喜您,注册成功,可使用帐号密码登录');
            }
        }
    }
    render() {
        return (

user regist

请填写您的个人信息

                        <FilterForm controls={getRegistFromFilterProps(this.props)}></FilterForm>

                            已注册?请.
                           <Link to="/user-login">登陆</Link>

        );
    }
}


text:
<?php get_header();
$GLOBALS['sbg_sidebar'] = get_post_meta(get_the_ID(), 'sbg_selected_sidebar_replacement', true);
?>

        <div class="<?php $full= get_post_custom_values('full_widthjellywp_checkbox'); if($full[0]==1){echo esc_attr("twelve single_post_fullpage");}else{echo esc_attr("eight content_display_col1");}?> columns" id="content">

                    <div <?php post_class(''); ?> id="post-<?php the_ID(); ?>" itemscope="" itemtype="http://schema.org/Review">

                        <?php if (have_posts()) { while (have_posts()) { the_post(); ?>
                                <?php
                                $categories = get_the_category();
                                $tags = get_the_tags();
                                $post_id = get_the_ID();
                                echo jelly_breadcrumbs_options();
                                if(of_get_option('disable_post_format_single') !=1){get_template_part('single_format');}
                        ?>

<?php the_title(); ?>

                                <?php echo jelly_single_post_meta($post_id);?>
                                <?php echo jelly_post_like_meta(get_the_ID());?>

<?php the_content(); ?>

                                <?php
 	$defaults_link = array(
		'before'           => '
' . esc_attr__( 'Continued On Page:', 'jelly_text_main' ),
		'after'            => '
',
		'link_before'      => '',
		'link_after'       => '',
		'next_or_number'   => 'number',
		'separator'        => ' ',
		'nextpagelink'     => esc_attr__( 'Next page', 'jelly_text_main' ),
		'previouspagelink' => esc_attr__( 'Previous page', 'jelly_text_main' ),
		'pagelink'         => '%',
		'echo'             => 1,
		'highlight'   => 'b'
	);

wp_link_pages( $defaults_link ); ?>

                                   <?php  if(of_get_option('disable_post_review') !=1){?>
                               <?php if(jelly_total_score_post(get_the_ID())){?>

 <?php esc_attr_e('Reviews', 'jelly_text_main'); ?>

                             <?php $review_slider1= get_post_custom_values('review_option1jellywp_slider'); if($review_slider1[0]!=0){ ?>

<?php $text1= get_post_custom_values('review_option1jellywp_text'); echo esc_attr($text1[0]); ?><?php echo esc_attr($review_slider1[0]); ?>

                                    <div class="review_bar-content" style="width:<?php echo esc_attr($review_slider1[0] * 10); ?>%">

                                    <?php }?>

                                <?php $review_slider2= get_post_custom_values('review_option2jellywp_slider'); if($review_slider2[0]!=0){ ?>

<?php $text2= get_post_custom_values('review_option2jellywp_text'); echo esc_attr($text2[0]); ?><?php echo esc_attr($review_slider2[0]); ?>

                                    <div class="review_bar-content" style="width:<?php echo esc_attr($review_slider2[0] * 10); ?>%">

                                    <?php }?>

                                     <?php $review_slider3= get_post_custom_values('review_option3jellywp_slider'); if($review_slider3[0]!=0){ ?>

<?php $text3= get_post_custom_values('review_option3jellywp_text'); echo esc_attr($text3[0]); ?><?php echo esc_attr($review_slider3[0]); ?>

                                    <div class="review_bar-content" style="width:<?php echo esc_attr($review_slider3[0] * 10); ?>%">

                                <?php }?>

                                <?php $review_slider4= get_post_custom_values('review_option4jellywp_slider'); if($review_slider4[0]!=0){ ?>

<?php $text4= get_post_custom_values('review_option4jellywp_text'); echo esc_attr($text4[0]); ?><?php echo esc_attr($review_slider4[0]); ?>

                                    <div class="review_bar-content" style="width:<?php echo esc_attr($review_slider4[0] * 10); ?>%">

                                    <?php }?>

                                    <?php $review_slider5= get_post_custom_values('review_option5jellywp_slider'); if($review_slider5[0]!=0){ ?>

<?php $text5= get_post_custom_values('review_option5jellywp_text'); echo esc_attr($text5[0]); ?><?php echo esc_attr($review_slider5[0]); ?>

                                    <div class="review_bar-content" style="width:<?php echo esc_attr($review_slider5[0] * 10); ?>%">

                                    <?php }?>

                           <?php $total_review = jelly_total_score_post(get_the_ID())?>

<?php echo esc_attr(round($total_review / 5 ,1));?>
Score

                                   <?php if($review_summer = get_post_custom_values('review_jellywp_wysiwyg')){?>

                                 <?php echo esc_attr($review_summer[0]); ?>

                                  <?php }?>

                  <meta itemprop="worstRating" content = "1">
                  <meta itemprop="ratingValue" content = "<?php echo esc_attr(round($total_review / 10 ,1));?>">
                  <meta itemprop="bestRating" content = "5">

                                <?php }}?>

                                 <?php  if(of_get_option('disable_post_tag') !=1){?>

                                   <?php if (!empty($tags)){ echo 'TAG';?><?php the_tags('', ' '); ?> <?php } ?>

                            <?php }?>

                 <?php  if(of_get_option('disable_post_share') !=1){?>

          <a title="Facebook"  href="http://www.facebook.com/share.php?u=<?php echo get_permalink();?>" target="_blank">Facebook

          <a title="Twitter"  href="http://twitter.com/home?status=<?php echo the_title(); ?>%20-%20<?php echo get_permalink();?>" target="_blank">Twitter

          <a title="Google Plus"  href="https://plus.google.com/share?url=<?php echo get_permalink();?>" target="_blank">Google+

          <a title="LinkedIn"  href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo get_permalink();?>&title=<?php echo the_title();?>" target="_blank">Linkedin

          <a  title="Tumblr" href="http://www.tumblr.com/share/link?url=<?php echo get_permalink();?>&name=<?php echo the_title();?>" target="_blank">Tumblr

          <a title="Pinterest" href="http://pinterest.com/pin/create/button/?url=<?php echo get_permalink();?>" target="_blank">Pinterest

          <a title="Mail" href="mailto:<?php echo get_the_author_meta('email');?>?subject=<?php echo the_title();?>&body=<?php  echo get_permalink(); ?>" target="_blank">Mail

                   <?php }?>

                                <?php
                                $next_post = get_next_post();

                                if (!empty($next_post)){

                                    ?>

                                    <a href="<?php echo esc_attr(get_permalink($next_post->ID)); ?>" id="prepost"><?php esc_attr_e('Previous Post', 'jelly_text_main'); ?><?php echo esc_attr($next_post->post_title); ?>

                                <?php } ?>

                                <?php

                                $prev_post = get_previous_post();
                                if (!empty($prev_post)){

                                    ?>

                                    <a href="<?php echo esc_attr(get_permalink($prev_post->ID)); ?>" id="nextpost"><?php esc_attr_e('Next Post', 'jelly_text_main'); ?><?php echo esc_attr($prev_post->post_title); ?>
                                <?php } ?>

                             <?php  if(of_get_option('disable_post_author_box') !=1){?>

<?php echo get_avatar(get_the_author_meta('user_email'), 90); ?>

<a itemprop="author" href="<?php echo esc_url(get_author_posts_url( get_the_author_meta( 'ID' ) )); ?>"><?php esc_attr(the_author_meta( 'display_name' )); ?>

<?php echo get_the_author_meta('description'); ?>

                                <?php if ((get_the_author_meta('url')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('url')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/website.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('email')) != ''){ ?>

<a href="mailto:<?php echo esc_url(get_the_author_meta('email')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/email.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('linkedin')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('linkedin')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/link.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('rss')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('rss')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/rss.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('pinterest')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('pinterest')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/pin.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('devianart')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('devianart')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/d-art.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('dribble')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('dribble')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/dribble.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('behance')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('behance')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/behance.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('youtube')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('youtube')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/youtube.png">

                               <?php }?>

								<?php if ((get_the_author_meta('instagram')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('instagram')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/instagram.png">

                               <?php }?>

                                <?php if ((get_the_author_meta('twitter')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('twitter')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/twitter.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('facebook')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('facebook')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/facebook.png">

                               <?php }?>
                                <?php if ((get_the_author_meta('googleplus')) != ''){ ?>

<a href="<?php echo esc_url(get_the_author_meta('googleplus')); ?>" target="_blank"><img alt="" src="<?php echo get_template_directory_uri(); ?>/img/icons/google-plus.png">

                               <?php }?>

                            <?php } ?>

                            <?php } ?>

                        <?php } // end of the loop.   ?>

 <?php  if(of_get_option('disable_post_related') !=1){?>

<?php esc_attr_e('Related articles', 'jelly_text_main'); ?>

                        <?php
                        $jellywp_tags = null;
                        if (!empty($tags)) {
                            foreach ($tags as $tag) {
                                $jellywp_tags[] = $tag->term_id;
                            }
                        }
                        $arg_tag = array('tag__in' => $jellywp_tags, 'showposts' => 3, 'post__not_in' => array($post_id));
                        $post_query = null;
                        $post_query = new WP_Query($arg_tag);
						$post_count = 0;

                        while ($post_query->have_posts()) {
                            $post_query->the_post();
							$post_id = get_the_ID();
              $categories = get_the_category(get_the_ID());
							$last = '';
							if (++$post_count  == 3) {
				$last = 'last-post-related ';
			}
                            ?>

                            <div class="<?php echo esc_attr($last);?>feature-four-column medium-four-columns <?php if(!of_get_option('disable_css_animation')==1){echo esc_attr("appear_animation");}?>">

                   <a  href="<?php the_permalink(); ?>" class="feature-link" title="<?php the_title_attribute(); ?>">
<?php if ( has_post_thumbnail()) {the_post_thumbnail('medium-feature');}
else{echo '';} ?>
<?php echo jelly_post_type(); ?>

<?php echo jelly_total_score_post_front_small_circle(get_the_ID());?>

<a href="<?php the_permalink(); ?>"><?php the_title()?>

<?php echo jelly_post_meta(get_the_ID()); ?>

                            <?php
                        }

                        wp_reset_query();

                        ?>

              <?php } ?>

                    <?php comments_template('', true); ?>

<?php $full= get_post_custom_values('full_widthjellywp_checkbox'); if($full[0]==1){}else{?>

          <?php
          if (have_posts()) {while (have_posts()) { the_post();
          ?>

          <?php echo jelly_sidebar_post_general_show();  }}?>

  <?php }?>

<?php get_footer(); ?>


text:
let testDouble
module.exports = {
  'making a test double based on a plain object funcbag' () {
    const funcBag = {
      lol: function () {},
      kek: function () {},
      now: function () {},
      otherThing: 8
    }
    testDouble = td.object(funcBag)

    td.when(testDouble.kek()).thenReturn('nay!')

    assert._isEqual(testDouble.kek(), 'nay!')
    assert._isEqual(testDouble.toString(), '[test double object]')
    assert._isEqual(testDouble.now.toString(), '[test double for ".now"]')
    assert._isEqual(testDouble.otherThing, 8)
  },
  'creating an object that is an instance of a prototypal thing' () {
    function Thing () {}
    Thing.prototype.foo = () => 'bar'

    testDouble = td.object(new Thing())

    assert._isEqual(td.explain(testDouble.foo).isTestDouble, true)
  },
  'making a test double based on an array of strings' () {
    testDouble = td.object(['biz', 'bam', 'boo'])

    td.when(testDouble.biz()).thenReturn('zing!')

    assert._isEqual(Array.isArray(testDouble), false)
    assert._isEqual(testDouble.biz(), 'zing!')
    assert._isEqual(testDouble.toString(), '[test double object]')
    assert._isEqual(testDouble.bam.toString(), '[test double for ".bam"]')
  },
  'making a test double based on a Symbol' () {
    if (!global.Symbol) return
    const symbolFoo = Symbol('foo')
    testDouble = td.object([symbolFoo])

    td.when(testDouble[symbolFoo]()).thenReturn('zing!')

    assert._isEqual(testDouble[symbolFoo](), 'zing!')
    assert._isEqual(testDouble.toString(), '[test double object]')
    assert._isEqual(testDouble[symbolFoo].toString(), '[test double for ".Symbol(foo)"]')
  },
  'passing a function to td.object erroneously (1.x)' () {
    try {
      td.object(function () {})
      assert.fail('This should have errored!')
    } catch (e) {
      assert.ok(/Please use `td\.function\(\)`, `td\.constructor\(\)` or `td\.instance\(\)` instead/.test(e.message))
    }
  },
  'passing an Object.create()d thing' () {
    testDouble = td.object(Object.create({
      respond: () => 'no'
    }))

    assert._isEqual(td.explain(testDouble.respond).isTestDouble, true)
  },
  'passing undefined raises error / compatibility note' () {
    try {
      td.object(undefined)
      assert.fail('This should have errored!')
    } catch (e) {
      assert.ok(/pass it a plain object/.test(e.message))
    }
  },
  'creating a ES Proxy object': {
    'basic use' () {
      if (!global.Proxy) return
      testDouble = td.object('thing')
      testDouble.magic('sauce')

      td.when(testDouble.whateverYouWant()).thenReturn('YESS')
      td.verify(testDouble.magic('sauce'))
      assert._isEqual(testDouble.whateverYouWant(), 'YESS')
      assert._isEqual(testDouble.toString(), '[test double object for "thing"]')
      assert._isEqual(testDouble.foo.toString(), '[test double for "thing.foo"]')
    },
    'with custom excludeMethods definitions' () {
      if (!global.Proxy) return
      testDouble = td.object('Stuff', {
        excludeMethods: ['then', 'fun']
      })

      assert._isEqual(testDouble.fun, undefined)
    },
    'unnamed double' () {
      if (!global.Proxy) return
      testDouble = td.object()

      assert._isEqual(testDouble.toString(), '[test double object]')
      assert._isEqual(testDouble.lol.toString(), '[test double for ".lol"]')
    },
    'with Symbol propKey' () {
      if (!global.Proxy || !global.Symbol) return
      testDouble = td.object('thing')
      assert._isEqual(testDouble[Symbol('foo')].toString(), '[test double for "thing.Symbol(foo)"]')
    },
    'if Proxy is not defined will print an error message' () {
      if (global.Proxy) return
      try {
        td.object('Woah')
        assert.fail('Show have errored!')
      } catch (e) {
        assert._isEqual(e.message, "Error: testdouble.js - td.object - The current runtime does not have Proxy support, which is what\ntestdouble.js depends on when a string name is passed to `td.object()`.\n\nMore details here:\n  https://github.com/testdouble/testdouble.js/blob/main/docs/4-creating-test-doubles.md#objectobjectname\n\nDid you mean `td.object(['Woah'])`?")
      }
    },
    'Allow for deeply nested test double objects' () {
      if (!global.Proxy) return
      testDouble = td.object()

      td.when(testDouble.something.very.deeply.nested()).thenReturn('nay!')

      assert._isEqual(testDouble.something.very.deeply.nested(), 'nay!')
      assert._isEqual(testDouble.something.very.deeply.nested.toString(), '[test double for ".something.very.deeply.nested"]')
    },
    'Deeply nested test double objects work also when its property names are repeated' () {
      if (!global.Proxy) return
      testDouble = td.object()

      td.when(testDouble.something()).thenReturn('Original Something')
      td.when(testDouble.different.something()).thenReturn('Different Something')

      assert._isEqual(testDouble.something(), 'Original Something')
      assert._isEqual(testDouble.different.something(), 'Different Something')
    },
    'Resets all deeply nested test doubles with td.reset' () {
      if (!global.Proxy) return
      testDouble = td.object()

      td.when(testDouble.something()).thenReturn('Original Something')
      td.when(testDouble.different.something()).thenReturn('Different Something')

      td.reset()

      assert._isEqual(testDouble.something(), undefined)
      assert._isEqual(testDouble.different.something(), undefined)
    }
  }
}


text:
all: planner generate

planner: main.cpp
	g++ main.cpp -o planner

generate: generate.cpp
	g++ generate.cpp -o generate

clean:
	rm -f planner generate *.o


text:
layout: post
date: '2016-01-06'
title: "After Six by Dessy 6710 Floor Length Strapless Chiffon Bridesmaid Dress"
category: After Six
tags: [After Six]
---
### After Six by Dessy 6710 Floor Length Strapless Chiffon Bridesmaid Dress
Just **$216.99**
###

Style 6710 is a full length Bridesmaid Dress in Lux Chiffon. It features a straight strapless neckline with geometric draped detail on the bodice, inset waistband at the empire waist and a slightly shirred skirt.

Skirt Fabric: Lux Chiffon

Buy it: [https://www.eudances.com/en/after-six/4024-after-six-by-dessy-6710-floor-length-strapless-chiffon-bridesmaid-dress.html](https://www.eudances.com/en/after-six/4024-after-six-by-dessy-6710-floor-length-strapless-chiffon-bridesmaid-dress.html)


text:
package effects.simple;
import effects.SimpleEffect;
import util.Color;

public class Effect_Negative  extends SimpleEffect
{

	/**
	 *
	 */
	private static final long serialVersionUID = 7789060934684290315L;

	@Override
	protected int applyPerPixel(int x, int y, int color)
	{
		int red = 255 - Color.getColor(color, Color.RED);
		int green = 255 - Color.getColor(color, Color.GREEN);
		int blue = 255 - Color.getColor(color, Color.BLUE);

		return Color.makeColor(red, green, blue);
	}

}


text:
define("dojox/widget/DialogSimple", ["dojo", "dijit", "dojox", "dijit/Dialog", "dojox/layout/ContentPane"], function(dojo, dijit, dojox){

	dojo.getObject("widget", true, dojox);
	return dojo.declare("dojox.widget.DialogSimple", [dojox.layout.ContentPane, dijit._DialogBase], {
		// summary: A Simple Dialog Mixing the `dojox.layout.ContentPane` functionality over
		//		top of a vanilla `dijit.Dialog`. See `dojox.widget.Dialog` for a more flexible
		//		dialog option allowing animations and different styles/theme support.
	});

});


text:
{% comment %}
	creates a language chooser based on _config.yml
{% endcomment %}

{% assign locale = site.locales[page.locale] %}
{% assign i18n = locale.i18n %}

{{i18n['lang']}}:

{% for locales in site.locales %}

	{% assign l = locales[1] %}
	{% assign current = nil %}
	{% assign url = nil %}
	{% assign route = l.routing.routes[page.key] %}

	{% if route %}
		{% if page.locale == l.val %}
			{% assign current = true %}
		{% endif %}

		{% assign url = route.url %}

		{% capture fullurl %}{{l.routing.base}}{{url}}{% endcapture %}

			{{l.i18n[l.val]}}

	{% else %}

MISSING ROUTE:
 "{{l.val}} - {{page.current}}" not found

	{% endif %}

{% endfor %}


text:
package com.bso.framework.throttle;

import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultProducer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.bso.framework.queue.Queue;

/**
 * The CircleQueue producer.
 */
public class CircleQueueProducer extends DefaultProducer {

    private static final Logger _logger = LoggerFactory.getLogger(CircleQueueProducer.class);

    private Queue<Exchange> queue;

    public CircleQueueProducer(CircleQueueEndpoint endpoint) {
        super(endpoint);
        this.queue = endpoint.getQueue();
    }

    public void process(Exchange exchange) throws Exception {
    	if(!queue.offer(exchange)) {
    		_logger.info("[process] - fail to add a exchange to exchange queue");
    	}
    }

}


text:
package org.deeplearning4j.text.documentiterator;

import org.deeplearning4j.BaseDL4JTest;
import org.junit.Rule;
import org.junit.rules.Timeout;
import org.nd4j.linalg.io.ClassPathResource;
import org.deeplearning4j.text.sentenceiterator.BasicLineIterator;
import org.deeplearning4j.text.sentenceiterator.SentenceIterator;
import org.junit.Before;
import org.junit.Test;
import org.nd4j.resources.Resources;

import java.io.File;

import static org.junit.Assert.assertEquals;

/**
 * @author raver119@gmail.com
 */
public class BasicLabelAwareIteratorTest extends BaseDL4JTest {

    @Rule
    public Timeout timeout = Timeout.seconds(300);

    @Before
    public void setUp() throws Exception {

    }

    @Test
    public void testHasNextDocument1() throws Exception {

        File inputFile = Resources.asFile("big/raw_sentences.txt");
        SentenceIterator iter = new BasicLineIterator(inputFile.getAbsolutePath());

        BasicLabelAwareIterator iterator = new BasicLabelAwareIterator.Builder(iter).setLabelTemplate("DOCZ_").build();

        int cnt = 0;
        while (iterator.hasNextDocument()) {
            iterator.nextDocument();
            cnt++;
        }

        assertEquals(97162, cnt);

        LabelsSource generator = iterator.getLabelsSource();

        assertEquals(97162, generator.getLabels().size());
        assertEquals("DOCZ_0", generator.getLabels().get(0));
    }

    @Test
    public void testHasNextDocument2() throws Exception {

        File inputFile = Resources.asFile("big/raw_sentences.txt");
        SentenceIterator iter = new BasicLineIterator(inputFile.getAbsolutePath());

        BasicLabelAwareIterator iterator = new BasicLabelAwareIterator.Builder(iter).setLabelTemplate("DOCZ_").build();

        int cnt = 0;
        while (iterator.hasNextDocument()) {
            iterator.nextDocument();
            cnt++;
        }

        assertEquals(97162, cnt);

        iterator.reset();

        cnt = 0;
        while (iterator.hasNextDocument()) {
            iterator.nextDocument();
            cnt++;
        }

        assertEquals(97162, cnt);

        LabelsSource generator = iterator.getLabelsSource();

        // this is important moment. Iterator after reset should not increase number of labels attained
        assertEquals(97162, generator.getLabels().size());
        assertEquals("DOCZ_0", generator.getLabels().get(0));
    }
}


text:
from __future__ import absolute_import

from sentry.api.serializers import serialize
from sentry.models import (
    Activity, PullRequest, Commit, GroupStatus
)
from sentry.testutils import TestCase

class GroupActivityTestCase(TestCase):
    def test_pr_activity(self):
        self.org = self.create_organization(
            name='Rowdy Tiger',
        )
        user = self.create_user()
        group = self.create_group(
            status=GroupStatus.UNRESOLVED,
        )
        repo = self.create_repo(self.project, name='organization-bar')
        pr = PullRequest.objects.create(
            organization_id=self.org.id,
            repository_id=repo.id,
            key=5,
            title="aaaa",
            message="kartoffel"
        )

        activity = Activity.objects.create(
            project_id=group.project_id,
            group=group,
            type=Activity.SET_RESOLVED_IN_PULL_REQUEST,
            ident=pr.id,
            user=user,
            data={
                'pull_request': pr.id,
            })

        result = serialize([activity], user)[0]['data']
        pull_request = result['pullRequest']
        assert pull_request['repository']['name'] == 'organization-bar'
        assert pull_request['message'] == 'kartoffel'

    def test_commit_activity(self):
        self.org = self.create_organization(
            name='Rowdy Tiger',
        )
        user = self.create_user()
        group = self.create_group(
            status=GroupStatus.UNRESOLVED,
        )
        repo = self.create_repo(self.project, name='organization-bar')

        commit = Commit.objects.create(
            organization_id=self.org.id,
            repository_id=repo.id,
            key="11111111",
            message="gemuse"
        )

        activity = Activity.objects.create(
            project_id=group.project_id,
            group=group,
            type=Activity.SET_RESOLVED_IN_COMMIT,
            ident=commit.id,
            user=user,
            data={
                'commit': commit.id,
            })

        result = serialize([activity], user)[0]['data']
        commit = result['commit']
        assert commit['repository']['name'] == 'organization-bar'
        assert commit['message'] == 'gemuse'


text:
package com.dltastudio.model;

import com.dltastudio.services.DatabaseInstance;

import java.io.UnsupportedEncodingException;
import java.sql.*;
import java.util.Base64;
import java.util.UUID;

/**
 * DAO to store session token
 */
public class TokenDAO {

    /**
     * Build HTTP Basic Authentification header from username/password
     * @param username username
     * @param password password
     * @return Encoded http header authorization. Null on error
     */
    public static String buildHttpAuthString(String username,String password) {
       try {
           String authString = username + ":" + password;
           String base64Auth = Base64.getEncoder().encodeToString(authString.getBytes("UTF-8"));
           String authHeader = "Basic " + base64Auth;
           return authHeader;
       } catch (UnsupportedEncodingException e) {
           e.printStackTrace();
           return null;
       }
    }

    /**
     * Register a username/password as return the resulting session token
     * @param username username
     * @param password password
     * @return Encoded http header authorization. Null on error
     */
    public static String registerToken(String username,String password) {
        String result=null;

        purgeTokens();
        String token= UUID.randomUUID().toString();
        String authHeader=buildHttpAuthString(username,password);
        String request="INSERT INTO user_infos(token,http_auth,registration_date) values (?,?,now())";
        try(Connection connection= DatabaseInstance.getConnection();
            PreparedStatement statement = connection.prepareStatement(request)) {
            statement.setString(1,token);
            statement.setString(2,authHeader);
            statement.executeUpdate();
            result=token;
        }
        catch(SQLException e) {
            e.printStackTrace();
        }
        catch(Exception e) {
        }
        return result;
    }

    /**
     * Update last access date for token
     * @param token Token to be updated
     */
    private static void updateTokenAccessDate(String token) {
        String request="UPDATE user_infos set registration_date=now() WHERE token=?";
        try(Connection connection= DatabaseInstance.getConnection();
            PreparedStatement statement = connection.prepareStatement(request)) {
            statement.setString(1,token);
            statement.executeUpdate();
        }
        catch(SQLException e) {
            e.printStackTrace();
        }
        catch(Exception e) {
        }

    }

    /**
     * Load Http header authorization string for a token
     * @param token User token
     * @return Http header authorization string for a token, null if not found
     */
    public static String loadAuthString(String token) {
        String result=null;
        purgeTokens();

        String request="SELECT http_auth FROM user_infos WHERE token=?";
        try(Connection connection= DatabaseInstance.getConnection();
            PreparedStatement statement = connection.prepareStatement(request)) {
            statement.setString(1,token);
            ResultSet rs=statement.executeQuery();
            if (rs.next()) {
                result=rs.getString(1);
                updateTokenAccessDate(token);
            }
        }
        catch(SQLException e) {
            e.printStackTrace();
        }
        catch(Exception e) {
        }
        return result;
    }

    /**
     * Remove all tokens from database
     */
    private static void purgeTokens() {
        String request="DELETE FROM user_infos WHERE (now()-registration_date)>3600*24";
        try(Connection connection= DatabaseInstance.getConnection();
            Statement statement = connection.createStatement()) {
             statement.executeUpdate(request);
        }
        catch(SQLException e) {
            e.printStackTrace();
        }
        catch(Exception e) {
        }
    }
}


text:
define('util/cache', [], function () {

    var cache = {};

    return cache;
});


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Hymenomyc. Südbayern 8: 7 (1891)

#### Original name
Agaricus flavidolilacinus Britzelm.

### Remarks
null


text:
require 'lite_spec_helper'

describe Mongo::Logger do

  let(:logger) do
    described_class.logger
  end

  describe '.logger' do

    context 'when no logger has been set' do

      let(:test_logger) do
        Mongo::Logger.logger
      end

      before do
        Mongo::Logger.logger = nil
      end

      after do
        Mongo::Logger.logger = test_logger
      end

      it 'returns the default logger' do
        expect(logger.level).to eq(Logger::DEBUG)
      end
    end

    context 'when a logger has been set' do

      let(:info) do
        Logger.new($stdout).tap do |log|
          log.level = Logger::INFO
        end
      end

      let(:debug) do
        Logger.new($stdout).tap do |log|
          log.level = Logger::DEBUG
        end
      end

      before do
        described_class.logger = debug
      end

      after do
        described_class.logger = info
      end

      it 'returns the provided logger' do
        expect(logger.level).to eq(Logger::DEBUG)
      end
    end
  end
end


text:
import { Component } from 'react';
import { Link } from 'react-router-dom';
import { Image } from 'app/components/Image';
import { Flex } from 'app/components/Layout';
import type { Event, Article } from 'app/models';
import styles from './Pinned.css';
import type { Element } from 'react';

type Props = {
  item: Event | Article;
  url: string;
  meta: Element<'span'> | null;
};

class Pinned extends Component<Props, any> {
  render() {
    const { item, url, meta } = this.props;
    return (
      <Flex column className={styles.pinned}>

Festet oppslag

        <Flex column className={styles.innerPinned}>
          <Link to={url} className={styles.innerLinks}>
            <Image
              className={styles.image}
              src={item.cover}
              placeholder={item.coverPlaceholder}
              height={500}
              width={1667}
            />
          </Link>

              <Link to={url}>{item.title}</Link>

            {meta}

        </Flex>
      </Flex>
    );
  }
}

export default Pinned;


text:
	<title>100% JQuery, Open-Source Crossword Puzzle Generator and Game</title>
	<meta http-equiv="content-type" content="text/css/javascript/php; charset=UTF-8">

<link type="text/css" rel="stylesheet" href="css/crossword-puzzle.css">

Across

Down

Answer : <input id="solution-answer" type="text" size="40">

<input type="button" id="cancel-button" value="Cancel"> <input type="button" id="answer-button" value="Answer"> <input type="button" id="reveal-answer-button" value="Reveal Answer">


text:
// Copyright 2016 The Xorm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package xorm

import (
	"errors"
	"fmt"
	"reflect"
	"strconv"
	"strings"

	"xorm.io/builder"
	"xorm.io/core"
)

func (session *Session) cacheUpdate(table *core.Table, tableName, sqlStr string, args ...interface{}) error {
	if table == nil ||
		session.tx != nil {
		return ErrCacheFailed
	}

	oldhead, newsql := session.statement.convertUpdateSQL(sqlStr)
	if newsql == "" {
		return ErrCacheFailed
	}
	for _, filter := range session.engine.dialect.Filters() {
		newsql = filter.Do(newsql, session.engine.dialect, table)
	}
	session.engine.logger.Debug("[cacheUpdate] new sql", oldhead, newsql)

	var nStart int
	if len(args) > 0 {
		if strings.Index(sqlStr, "?") > -1 {
			nStart = strings.Count(oldhead, "?")
		} else {
			// only for pq, TODO: if any other databse?
			nStart = strings.Count(oldhead, "$")
		}
	}

	cacher := session.engine.getCacher(tableName)
	session.engine.logger.Debug("[cacheUpdate] get cache sql", newsql, args[nStart:])
	ids, err := core.GetCacheSql(cacher, tableName, newsql, args[nStart:])
	if err != nil {
		rows, err := session.NoCache().queryRows(newsql, args[nStart:]...)
		if err != nil {
			return err
		}
		defer rows.Close()

		ids = make([]core.PK, 0)
		for rows.Next() {
			var res = make([]string, len(table.PrimaryKeys))
			err = rows.ScanSlice(&res)
			if err != nil {
				return err
			}
			var pk core.PK = make([]interface{}, len(table.PrimaryKeys))
			for i, col := range table.PKColumns() {
				if col.SQLType.IsNumeric() {
					n, err := strconv.ParseInt(res[i], 10, 64)
					if err != nil {
						return err
					}
					pk[i] = n
				} else if col.SQLType.IsText() {
					pk[i] = res[i]
				} else {
					return errors.New("not supported")
				}
			}

			ids = append(ids, pk)
		}
		session.engine.logger.Debug("[cacheUpdate] find updated id", ids)
	} /*else {
	    session.engine.LogDebug("[xorm:cacheUpdate] del cached sql:", tableName, newsql, args)
	    cacher.DelIds(tableName, genSqlKey(newsql, args))
	}*/

	for _, id := range ids {
		sid, err := id.ToString()
		if err != nil {
			return err
		}
		if bean := cacher.GetBean(tableName, sid); bean != nil {
			sqls := splitNNoCase(sqlStr, "where", 2)
			if len(sqls) == 0 || len(sqls) > 2 {
				return ErrCacheFailed
			}

			sqls = splitNNoCase(sqls[0], "set", 2)
			if len(sqls) != 2 {
				return ErrCacheFailed
			}
			kvs := strings.Split(strings.TrimSpace(sqls[1]), ",")
			for idx, kv := range kvs {
				sps := strings.SplitN(kv, "=", 2)
				sps2 := strings.Split(sps[0], ".")
				colName := sps2[len(sps2)-1]
				if strings.Contains(colName, "`") {
					colName = strings.TrimSpace(strings.Replace(colName, "`", "", -1))
				} else if strings.Contains(colName, session.engine.QuoteStr()) {
					colName = strings.TrimSpace(strings.Replace(colName, session.engine.QuoteStr(), "", -1))
				} else {
					session.engine.logger.Debug("[cacheUpdate] cannot find column", tableName, colName)
					return ErrCacheFailed
				}

				if col := table.GetColumn(colName); col != nil {
					fieldValue, err := col.ValueOf(bean)
					if err != nil {
						session.engine.logger.Error(err)
					} else {
						session.engine.logger.Debug("[cacheUpdate] set bean field", bean, colName, fieldValue.Interface())
						if col.IsVersion && session.statement.checkVersion {
							session.incrVersionFieldValue(fieldValue)
						} else {
							fieldValue.Set(reflect.ValueOf(args[idx]))
						}
					}
				} else {
					session.engine.logger.Errorf("[cacheUpdate] ERROR: column %v is not table %v's",
						colName, table.Name)
				}
			}

			session.engine.logger.Debug("[cacheUpdate] update cache", tableName, id, bean)
			cacher.PutBean(tableName, sid, bean)
		}
	}
	session.engine.logger.Debug("[cacheUpdate] clear cached table sql:", tableName)
	cacher.ClearIds(tableName)
	return nil
}

// Update records, bean's non-empty fields are updated contents,
// condiBean' non-empty filds are conditions
// CAUTION:
//        1.bool will defaultly be updated content nor conditions
//         You should call UseBool if you have bool to use.
//        2.float32 & float64 may be not inexact as conditions
func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int64, error) {
	if session.isAutoClose {
		defer session.Close()
	}

	if session.statement.lastError != nil {
		return 0, session.statement.lastError
	}

	v := rValue(bean)
	t := v.Type()

	var colNames []string
	var args []interface{}

	// handle before update processors
	for _, closure := range session.beforeClosures {
		closure(bean)
	}
	cleanupProcessorsClosures(&session.beforeClosures) // cleanup after used
	if processor, ok := interface{}(bean).(BeforeUpdateProcessor); ok {
		processor.BeforeUpdate()
	}
	// --

	var err error
	var isMap = t.Kind() == reflect.Map
	var isStruct = t.Kind() == reflect.Struct
	if isStruct {
		if err := session.statement.setRefBean(bean); err != nil {
			return 0, err
		}

		if len(session.statement.TableName()) <= 0 {
			return 0, ErrTableNotFound
		}

		if session.statement.ColumnStr == "" {
			colNames, args = session.statement.buildUpdates(bean, false, false,
				false, false, true)
		} else {
			colNames, args, err = session.genUpdateColumns(bean)
			if err != nil {
				return 0, err
			}
		}
	} else if isMap {
		colNames = make([]string, 0)
		args = make([]interface{}, 0)
		bValue := reflect.Indirect(reflect.ValueOf(bean))

		for _, v := range bValue.MapKeys() {
			colNames = append(colNames, session.engine.Quote(v.String())+" = ?")
			args = append(args, bValue.MapIndex(v).Interface())
		}
	} else {
		return 0, ErrParamsType
	}

	table := session.statement.RefTable

	if session.statement.UseAutoTime && table != nil && table.Updated != "" {
		if !session.statement.columnMap.contain(table.Updated) &&
			!session.statement.omitColumnMap.contain(table.Updated) {
			colNames = append(colNames, session.engine.Quote(table.Updated)+" = ?")
			col := table.UpdatedColumn()
			val, t := session.engine.nowTime(col)
			args = append(args, val)

			var colName = col.Name
			if isStruct {
				session.afterClosures = append(session.afterClosures, func(bean interface{}) {
					col := table.GetColumn(colName)
					setColumnTime(bean, col, t)
				})
			}
		}
	}

	//for update action to like "column = column + ?"
	incColumns := session.statement.getInc()
	for _, v := range incColumns {
		colNames = append(colNames, session.engine.Quote(v.colName)+" = "+session.engine.Quote(v.colName)+" + ?")
		args = append(args, v.arg)
	}
	//for update action to like "column = column - ?"
	decColumns := session.statement.getDec()
	for _, v := range decColumns {
		colNames = append(colNames, session.engine.Quote(v.colName)+" = "+session.engine.Quote(v.colName)+" - ?")
		args = append(args, v.arg)
	}
	//for update action to like "column = expression"
	exprColumns := session.statement.getExpr()
	for _, v := range exprColumns {
		colNames = append(colNames, session.engine.Quote(v.colName)+" = "+v.expr)
	}

	if err = session.statement.processIDParam(); err != nil {
		return 0, err
	}

	var autoCond builder.Cond
	if !session.statement.noAutoCondition {
		condBeanIsStruct := false
		if len(condiBean) > 0 {
			if c, ok := condiBean[0].(map[string]interface{}); ok {
				autoCond = builder.Eq(c)
			} else {
				ct := reflect.TypeOf(condiBean[0])
				k := ct.Kind()
				if k == reflect.Ptr {
					k = ct.Elem().Kind()
				}
				if k == reflect.Struct {
					var err error
					autoCond, err = session.statement.buildConds(session.statement.RefTable, condiBean[0], true, true, false, true, false)
					if err != nil {
						return 0, err
					}
					condBeanIsStruct = true
				} else {
					return 0, ErrConditionType
				}
			}
		}

		if !condBeanIsStruct && table != nil {
			if col := table.DeletedColumn(); col != nil && !session.statement.unscoped { // tag "deleted" is enabled
				autoCond1 := session.engine.CondDeleted(session.engine.Quote(col.Name))

				if autoCond == nil {
					autoCond = autoCond1
				} else {
					autoCond = autoCond.And(autoCond1)
				}
			}
		}
	}

	st := &session.statement

	var sqlStr string
	var condArgs []interface{}
	var condSQL string
	cond := session.statement.cond.And(autoCond)

	var doIncVer = (table != nil && table.Version != "" && session.statement.checkVersion)
	var verValue *reflect.Value
	if doIncVer {
		verValue, err = table.VersionColumn().ValueOf(bean)
		if err != nil {
			return 0, err
		}

		cond = cond.And(builder.Eq{session.engine.Quote(table.Version): verValue.Interface()})
		colNames = append(colNames, session.engine.Quote(table.Version)+" = "+session.engine.Quote(table.Version)+" + 1")
	}

	condSQL, condArgs, err = builder.ToSQL(cond)
	if err != nil {
		return 0, err
	}

	if len(condSQL) > 0 {
		condSQL = "WHERE " + condSQL
	}

	if st.OrderStr != "" {
		condSQL = condSQL + fmt.Sprintf(" ORDER BY %v", st.OrderStr)
	}

	var tableName = session.statement.TableName()
	// TODO: Oracle support needed
	var top string
	if st.LimitN > 0 {
		if st.Engine.dialect.DBType() == core.MYSQL {
			condSQL = condSQL + fmt.Sprintf(" LIMIT %d", st.LimitN)
		} else if st.Engine.dialect.DBType() == core.SQLITE {
			tempCondSQL := condSQL + fmt.Sprintf(" LIMIT %d", st.LimitN)
			cond = cond.And(builder.Expr(fmt.Sprintf("rowid IN (SELECT rowid FROM %v %v)",
				session.engine.Quote(tableName), tempCondSQL), condArgs...))
			condSQL, condArgs, err = builder.ToSQL(cond)
			if err != nil {
				return 0, err
			}
			if len(condSQL) > 0 {
				condSQL = "WHERE " + condSQL
			}
		} else if st.Engine.dialect.DBType() == core.POSTGRES {
			tempCondSQL := condSQL + fmt.Sprintf(" LIMIT %d", st.LimitN)
			cond = cond.And(builder.Expr(fmt.Sprintf("CTID IN (SELECT CTID FROM %v %v)",
				session.engine.Quote(tableName), tempCondSQL), condArgs...))
			condSQL, condArgs, err = builder.ToSQL(cond)
			if err != nil {
				return 0, err
			}

			if len(condSQL) > 0 {
				condSQL = "WHERE " + condSQL
			}
		} else if st.Engine.dialect.DBType() == core.MSSQL {
			if st.OrderStr != "" && st.Engine.dialect.DBType() == core.MSSQL &&
				table != nil && len(table.PrimaryKeys) == 1 {
				cond = builder.Expr(fmt.Sprintf("%s IN (SELECT TOP (%d) %s FROM %v%v)",
					table.PrimaryKeys[0], st.LimitN, table.PrimaryKeys[0],
					session.engine.Quote(tableName), condSQL), condArgs...)

				condSQL, condArgs, err = builder.ToSQL(cond)
				if err != nil {
					return 0, err
				}
				if len(condSQL) > 0 {
					condSQL = "WHERE " + condSQL
				}
			} else {
				top = fmt.Sprintf("TOP (%d) ", st.LimitN)
			}
		}
	}

	if len(colNames) <= 0 {
		return 0, errors.New("No content found to be updated")
	}

	sqlStr = fmt.Sprintf("UPDATE %v%v SET %v %v",
		top,
		session.engine.Quote(tableName),
		strings.Join(colNames, ", "),
		condSQL)

	res, err := session.exec(sqlStr, append(args, condArgs...)...)
	if err != nil {
		return 0, err
	} else if doIncVer {
		if verValue != nil && verValue.IsValid() && verValue.CanSet() {
			session.incrVersionFieldValue(verValue)
		}
	}

	if cacher := session.engine.getCacher(tableName); cacher != nil && session.statement.UseCache {
		//session.cacheUpdate(table, tableName, sqlStr, args...)
		session.engine.logger.Debug("[cacheUpdate] clear table ", tableName)
		cacher.ClearIds(tableName)
		cacher.ClearBeans(tableName)
	}

	// handle after update processors
	if session.isAutoCommit {
		for _, closure := range session.afterClosures {
			closure(bean)
		}
		if processor, ok := interface{}(bean).(AfterUpdateProcessor); ok {
			session.engine.logger.Debug("[event]", tableName, " has after update processor")
			processor.AfterUpdate()
		}
	} else {
		lenAfterClosures := len(session.afterClosures)
		if lenAfterClosures > 0 {
			if value, has := session.afterUpdateBeans[bean]; has && value != nil {
				*value = append(*value, session.afterClosures...)
			} else {
				afterClosures := make([]func(interface{}), lenAfterClosures)
				copy(afterClosures, session.afterClosures)
				// FIXME: if bean is a map type, it will panic because map cannot be as map key
				session.afterUpdateBeans[bean] = &afterClosures
			}

		} else {
			if _, ok := interface{}(bean).(AfterUpdateProcessor); ok {
				session.afterUpdateBeans[bean] = nil
			}
		}
	}
	cleanupProcessorsClosures(&session.afterClosures) // cleanup after used
	// --

	return res.RowsAffected()
}

func (session *Session) genUpdateColumns(bean interface{}) ([]string, []interface{}, error) {
	table := session.statement.RefTable
	colNames := make([]string, 0, len(table.ColumnsSeq()))
	args := make([]interface{}, 0, len(table.ColumnsSeq()))

	for _, col := range table.Columns() {
		if !col.IsVersion && !col.IsCreated && !col.IsUpdated {
			if session.statement.omitColumnMap.contain(col.Name) {
				continue
			}
		}
		if col.MapType == core.ONLYFROMDB {
			continue
		}

		fieldValuePtr, err := col.ValueOf(bean)
		if err != nil {
			return nil, nil, err
		}
		fieldValue := *fieldValuePtr

		if col.IsAutoIncrement {
			switch fieldValue.Type().Kind() {
			case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int, reflect.Int64:
				if fieldValue.Int() == 0 {
					continue
				}
			case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint, reflect.Uint64:
				if fieldValue.Uint() == 0 {
					continue
				}
			case reflect.String:
				if len(fieldValue.String()) == 0 {
					continue
				}
			case reflect.Ptr:
				if fieldValue.Pointer() == 0 {
					continue
				}
			}
		}

		if (col.IsDeleted && !session.statement.unscoped) || col.IsCreated {
			continue
		}

		if len(session.statement.columnMap) > 0 {
			if !session.statement.columnMap.contain(col.Name) {
				continue
			} else if _, ok := session.statement.incrColumns[col.Name]; ok {
				continue
			} else if _, ok := session.statement.decrColumns[col.Name]; ok {
				continue
			}
		}

		// !evalphobia! set fieldValue as nil when column is nullable and zero-value
		if _, ok := getFlagForColumn(session.statement.nullableMap, col); ok {
			if col.Nullable && isZero(fieldValue.Interface()) {
				var nilValue *int
				fieldValue = reflect.ValueOf(nilValue)
			}
		}

		if col.IsUpdated && session.statement.UseAutoTime /*&& isZero(fieldValue.Interface())*/ {
			// if time is non-empty, then set to auto time
			val, t := session.engine.nowTime(col)
			args = append(args, val)

			var colName = col.Name
			session.afterClosures = append(session.afterClosures, func(bean interface{}) {
				col := table.GetColumn(colName)
				setColumnTime(bean, col, t)
			})
		} else if col.IsVersion && session.statement.checkVersion {
			args = append(args, 1)
		} else {
			arg, err := session.value2Interface(col, fieldValue)
			if err != nil {
				return colNames, args, err
			}
			args = append(args, arg)
		}

		colNames = append(colNames, session.engine.Quote(col.Name)+" = ?")
	}
	return colNames, args, nil
}


text:
ExtendScript (.jsx) library for Photoshop.

## Example

```javascript
#target "photoshop"
#include "bulk.full.jsx"

bulk(Folder.selectDialog('Select source folder.'), {filePattern: /\.(jpg|jpeg|png|gif|tif|tiff|psd)$/i})
  .mode({
    mode: ChangeMode.RGB
  })
  .resize({
    type: 'fit',
    width: 1000,
    height: 1000,
    expand: false
  })
  .jpg({
    dest: Folder.selectDialog('Select destination folder.'),
    filename: '<%= bulk.pad(index + 1, 3) %>-<%= basename %>-<%= Number(doc.width) %>x<%= Number(doc.height) %>.jpg',
    overwrite: 'ask',
    quality: 80
  })
  .exec();
```

## Getting Started

### Zip Download

1. [Download bulk.jsx](https://github.com/hanamura/bulk.jsx/archive/master.zip) and Unzip.
2. Go to the unzipped folder **bulk.jsx-master/templates** and edit **template.jsx** (there are already some codes).
3. Launch Photoshop and select menu: **File** > **Scripts** > **Browse…** then open **template.jsx**.
4. Script runs.

### npm

Install:

```
npm install bulk.jsx
```

Script:

```javascript
#target "photoshop"
#include "node_modules/bulk.jsx/bulk.full.jsx"

// your code here
```

### bower

Install:

```
bower install bulk.jsx
```

Script:

```javascript
#target "photoshop"
#include "bower_components/bulk.jsx/bulk.full.jsx"

// your code here
```

## Dependencies

- [underscore.js](http://underscorejs.org)
- [rebounds.js](https://github.com/hanamura/rebounds.js)

## API

### bulk(src, options = null)

- **src** *Folder | File | String | Array | bulk Object | Function*
  Source object:
  - **Folder**: Use all matched files inside the folder as task targets.
  - **File**: Use the file as task target.
  - **String**: Absolute file/folder path. Same as `File(string)`.
  - **Array**: Dig items recursively. Folder, File, String or Array are accepted.
  - **bulk Object**: Same as `bulk.src()`.
  - **Function**: Same as `func()`.
- **options** *Object*
  - **options.filePattern** *RegExp | Function*
    Filename pattern to specify targets. If `null`, all files are accepted. Default value: `null`
  - **options.folderPattern** *RegExp | Function*
    Folder name pattern to specify targets. If `null`, all folders are accepted. Default value: `null`
  - **options.mask** *String*
    Parameter passed to `Folder.getFiles(mask)`. Default value: `'*'`.
  - **options.deep** *Boolean*
    Traverse deeply through files in folders. Default value: `true`.

**Returns**: *bulk Object*

```javascript
bulk(Folder.selectDialog('Select folder.'), {filePattern: /\.jpg$/})
  .resize({type: 'fit', width: 1000, height: 1000})
  .save()
  .exec();
```

### bulk.basename(filename)

- **filename** *String*

**Returns**: *String*

```javascript
bulk.basename('hello.jpg');
// => 'hello'
```

### bulk.extension(filename)

- **filename** *String*

**Returns**: *String*

```javascript
bulk.extension('hello.jpg');
// => 'jpg'
```

### bulk.noConflict()

**Returns**: *bulk*

### bulk.pad(string, length, padString = '0', right = false)

- **string** *String*
- **length** *Integer*
- **padString** *String*
- **right** *Boolean*

**Returns**: *String*

```javascript
bulk.pad('5', 3);
// => '005'
```

### bulk.pixels(callback, context = null)

Shortcut of `bulk.units(Units.PIXELS, callback, context)`.

- **callback** *Function*
- **context** *Object*

**Returns**: *undefined*

### bulk.units(units, callback, context = null)

Set `preference.rulerUnits` to specified units, execute callback and reset to original units.

- **units** *Units*
- **callback** *Function*
- **context** *Object*

**Returns**: *undefined*

```javascript
bulk.units(Units.INCHES, function() {
  $.writeln('document width: ' + String(app.activeDocument.width) + ' inches');
  $.writeln('document height: ' + String(app.activeDocument.height) + ' inches');
});
```

### bulk.walk(src, fileCallback, otherCallback, options = null)

Traverse through files in source, yield each file/other object to callback.

- **src** *Folder | File | String | Array*
  Source object: **Folder**, **File**, **String** (Same as `File(string)`), **Array** (Parse recursively).
- **fileCallback** *Function(file)*
  Callback for File objects.
- **otherCallback** *Function(otherObject)*
  Callback for unknown objects.
- **options** *Object*
  - **options.filePattern** *RegExp | Function*
    Filename pattern to specify targets. If null, all files are accepted. Default value: `null`
  - **options.folderPattern** *RegExp | Function*
    Folder name pattern to specify targets. If null, all folders are accepted. Default value: `null`
  - **options.mask** *String*
    Parameter passed to `Folder.getFiles(mask)`. Default value: `'*'`.
  - **options.deep** *Boolean*
    Traverse deeply through files in folders. Default value: `true`.

**Returns**: *undefined*

```javascript
bulk.walk(Folder.selectDialog('Select folder.'), function(file) {
  $.writeln(file.name); // log filename
}, null, {
  filePattern: /\.txt$/
});
```

### .crop(options = null)

Task: crop document.

- **options** *Object*
  - **options.width** *UnitValue*
  - **options.height** *UnitValue*
  - **options.anchor** *AnchorPosition*
    Default value: `AnchorPosition.MIDDLECENTER`.

**Returns**: *bulk Object*

```javascript
bulk(src, options)
  .crop({
    width: 100,
    height: 100,
    anchor: AnchorPosition.TOPCENTER
  })
  .save()
  .exec();
```

### .exec(options = null)

Actually execute bulk object. Specifying ruler units.

- **options** *Object*
  - **options.units** *Units*
    Default value: `Units.PIXELS`

**Returns**: *bulk Object*

### .export(options = null)

Task: export document.

- **options** *Object*
  - **options.dest** *Folder | String | Template String | Function*
    Destination folder for output file. Default value: `null`.
    - **Folder**: Passed folder.
    - **String**: Passed to underscore's [`.template`](http://underscorejs.org/#template) function with `bulk.DocInfo` object: `_.template(string, docInfo)`. Then, evaluated as an absolute path, or a relative path to parent folder of the original file.
    - **Function**: Use return value of `func.call(docInfo)`.
    - **null**: Same folder with the original file.
  - **options.filename** *String | Template String | Function*
    Filename for output file. Default value: `null`.
    - **String**: Passed to underscore's [`.template`](http://underscorejs.org/#template) function with `bulk.DocInfo` object: `_.template(string, docInfo)`.
    - **Function**: Use return value of `func.call(docInfo)`.
    - **null**: Same name with the original file.
  - **options.overwrite** *Boolean | `'ask'`*
    Define behavior in case a filename already exists. Default value: `'ask'`.
    - **true**: Overwrite file.
    - **false**: Cancel saving document.
    - **'ask'**: Popup confirm dialog.
  - **options.exportType** *ExportType*
  - **options.exportOptions** *ExportOptions*

**Returns**: *bulk Object*

```javascript
var exportOptions = new ExportOptionsSaveForWeb();
exportOptions.format = SaveDocumentType.JPEG;
exportOptions.quality = 50;

bulk(src, options)
  .export({
    dest: Folder.selectDialog('Select destination folder.'),
    filename: '<%= basename %>-low.<%= extension %>',
    overwrite: false,
    exportType: ExportType.SAVEFORWEB,
    exportOptions: exportOptions
  })
  .exec();
```

### .jpg(options = null)

Task: export document as JPEG for web.

- **options** *Object*
  - **options.dest** *Folder | String | Template String | Function*
    See `.export()`.
  - **options.filename** *String | Template String | Function*
    See `.export()`.
  - **options.overwrite** *Boolean | `'ask'`*
    See `.export()`.
  - **options.quality** *Number (`0` – `100`)*
    Default value: `100`

**Returns**: *bulk Object*

### .log(options = null)

Task: output document/file information to JavaScript console of ExtendScript Toolkit.

- **options** *Object*
  - **options.template** *String | Template String*
    Passed to underscore's [`.template`](http://underscorejs.org/#template) function with `bulk.DocInfo` object: `_.template(string, docInfo)`. Default value: `'<%= filename %>'`.
  - **options.opensDoc** *Boolean*
    Set `true` if you want to use `<% doc ... %>` inside template string. If `false`, file never opens as document, unless the other tasks require doc. Default value: `true`.

**Returns**: *bulk Object*

```javascript
bulk(src, options)
  .log({
    template: '<%= bulk.pad(index + 1, 3) %>: <%= filename %>',
    opensDoc: false
  })
  .exec();
```

Example output:

```
001: hello.jpg
002: world.jpg
…
```

### .mode(options = null)

Task: change color mode of document.

- **options** *Object*
  - **options.mode** *ChangeMode*
    Default value: `ChangeMode.RGB`.

**Returns**: *bulk Object*

```javascript
bulk(src, options)
  .mode({
    mode: ChangeMode.CMYK
  })
  .exec();
```

### .opensDoc()

Internal method: get opensDoc property, whether or not bulk object's tasks need to open file as Photoshop document.

**Returns**: *Boolean*

### .opensDoc(opens)

Internal method: set opensDoc property. Once it is set `true`, unable to change it.

- **opens** *Boolean*

**Returns**: *bulk Object*

### .options()

Get options object passed to `bulk()`.

**Returns**: *Object*

### .pass(callbacks...)

Pass bulk object to all callbacks as `this`. You can use this method to fork tasks.

- **callbacks...** *Function*

**Returns**: *bulk Object*

```javascript
bulk(src, options)
  .resize({
    type: 'fit',
    width: 1000,
    height: 1000
  })
  .pass(
    function() {
      this.jpg({
          dest: destForJpg,
          filename: '<%= basename %>.jpg'
        })
        .exec();
    },
    function() {
      this.crop({
          width: 100,
          height: 100
        })
        .png({
          dest: destForPng,
          filename: '<%= basename %>.png'
        })
        .exec();
    }
  );
```

### .png(options = null)

Task: export document as 24-bit PNG for web.

- **options** *Object*
  - **options.dest** *Folder | String | Template String | Function*
    See `.export()`.
  - **options.filename** *String | Template String | Function*
    See `.export()`.
  - **options.overwrite** *Boolean | `'ask'`*
    See `.export()`.

**Returns**: *bulk Object*

### .push(task, opensDoc = true)

Push task to bulk object and returns clone bulk object. See "Create Custom Task" section.

- **task** *Function*
  Task function executed for each document/file. `this` in the function is set to `bulk.DocInfo`.
- **opensDoc** *Boolean*
  If `true`, bulk object opens file as document.

**Returns**: *bulk Object*

### .resize(options = null)

Taks: resize document.

- **options** (Object)
  - **options.type** *`'fit'` | `'fill'` | `'remain'` | `'stretch'` | Function(space, rect, options)*
    Resize method. Default value: `'fit'`.
    - **'fit'**: Resize document to fit into space.
    - **'fill'**: Resize document to fill space.
    - **'remain'**: Keep document size.
    - **'stretch'**: Resize document stretched into the same size with space. (Doesn't keep aspect ratio)
    - **Function**: Custom resize function. See [rebounds.js](https://github.com/hanamura/rebounds.js) for detail.
  - **options.width** *UnitValue*
  - **options.height** *UnitValue*
  - **options.reduce** *Boolean*
    Allow size reduction of document.
    Default value: `true`
  - **options.expand** *Boolean*
    Allow size expansion of document.
    Default value: `true`
  - **options.resolution** *Number*
    Default value: `72`.
  - **options.resampleMethod** *ResampleMethod*
    Default value: `ResampleMethod.BICUBICSHARPER`.

**Returns** *bulk Object*

```javascript
bulk(src, options)
  .resize({
    type: 'fit',
    width: 1000,
    height: 1000,
    reduce: true,
    expand: false,
    resolution: 96,
    resampleMethod: ResampleMethod.BICUBIC
  })
  .save()
  .exec();
```

### .save()

Task: save document.

**Returns**: *bulk Object*

```javascript
bulk(src, options)
  .mode({
    mode: ChangeMode.RGB
  })
  .save()
  .exec();
```

### .src()

Source object passed to `bulk()`.

**Returns**: *Folder | File | String | Array | bulk Object | Function*

### .tasks()

Internal method: task functions added to the bulk object.

**Returns**: *Function Array*

### .tasks(tasks)

Internal method: set tasks to the bulk object.

**Returns**: *bulk Object*

### bulk.DocInfo

Document and File information class. Its instances are passed to task functions as `this` objects.

**Properties**:

- **basename** *String*
  Basename of the File. (example: `'hello'` if filename is `'hello.jpg'`)
- **data** *Object*
  Shared data.
- **doc** *Document*
  Target Document object.
- **extension** *String*
  Extension of the File. (example: `'jpg'` if filename is `'hello.jpg'`)
- **file** *File*
  File object of the target Document.
- **filename** *String*
  Filename of the File.
- **index** *Integer*
  Current index in sources.

## Create Custom Task

To create task `logSize` for example:

```javascript
bulk.fn.logSize = function(options) {
  // options
  var filename = !!options.filename;
  var prefix = options.prefix || 'document ';
  var suffix = options.suffix || ' pixels';

  // push task and return cloned bulk object
  return this.push(function() {
    // - `$.writeln()` is log function in ExtendScript
    // - `this` is current bulk.DocInfo object

    if (filename) {
      $.writeln(String(this.index) + ' filename: ' + this.file.name);
    }
    $.writeln(prefix + 'width: ' + String(this.doc.width) + suffix);
    $.writeln(prefix + 'height: ' + String(this.doc.height) + suffix);
    $.writeln('-');
  });
};
```

To use:

```javascript
bulk(src, options)
  .logSize({
    filename: true,
    prefix: 'my document ',
    suffix: 'px'
  })
  .exec();
```

Example output:

```
0 filename: hello.jpg
my document width: 500px
my document height: 350px
-
1 filename: world.jpg
my document width: 550px
my document height: 200px
-
2 filename: salt.jpg
my document width: 1024px
my document height: 768px
-
```

## License

MIT License


text:
class SiteContentTypeSerializer < ApplicationSerializer

  attributes :content_type, :title

  def content_type
    object.content_type
  end

  def title
    object.title
  end

end


text:
'use strict';

/* Services */

angular.module('techGallery.services', []).value('version', '1.0');


text:
package com.megaport.api.dto;

public enum UsageAlgorithm {

	BYTES_TRANSFERRED, TIME_AT_RATE, RATE_PLAN,
	POST_PAID_FIXED, // post paid, but regardless of hours or speed - ports (not a product yet)
	POST_PAID_HOURLY, // new VXC pricing, mrc plus rate based charging
	POST_PAID_HOURLY_SPEED, // used for long haul VXC
	POST_PAID_HOURLY_SPEED_MCR,
	POST_PAID_HOURLY_SPEED_METRO_VXC,
	POST_PAID_HOURLY_SPEED_LONG_HAUL_VXC,
	NOT_POST_PAID, // ie pre-paid, used for Ports, and legacy metro VXCs etc
	POST_PAID_HOURLY_SPEED_METRO_IX

}