text:
namespace ACT.SpecialSpellTimer.Utility
{
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Threading;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Input;
    using System.Windows.Interop;
    using System.Windows.Markup;
    using System.Windows.Media;
    using System.Xml.Serialization;

    public partial class FontDialogWindow : MetroWindow
    {
        private FontInfo fontInfo = new FontInfo();

        public FontDialogWindow()
        {
            this.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);

            this.InitializeComponent();

            this.Loaded += (s, e) =>
            {
                this.ShowFontInfo();

                // リストボックスにフォーカスを設定する
                ListBox box;

                box = this.FontStyleListBox;
                if (box.SelectedItem != null)
                {
                    var item =
                        box.ItemContainerGenerator.ContainerFromItem(box.SelectedItem)
                        as ListBoxItem;

                    if (item != null)
                    {
                        item.Focus();
                    }
                }

                box = this.FontFamilyListBox;
                if (box.SelectedItem != null)
                {
                    var item =
                        box.ItemContainerGenerator.ContainerFromItem(box.SelectedItem)
                        as ListBoxItem;

                    if (item != null)
                    {
                        item.Focus();
                    }
                }
            };

            this.FontSizeTextBox.PreviewKeyDown += this.FontSizeTextBox_PreviewKeyDown;
            this.FontSizeTextBox.LostFocus += (s, e) =>
            {
                const double MinSize = 5.0;

                var t = (s as TextBox).Text;

                double d;
                if (double.TryParse(t, out d))
                {
                    if (d < MinSize)
                    {
                        d = MinSize;
                    }

                    (s as TextBox).Text = d.ToString("N1");
                }
                else
                {
                    (s as TextBox).Text = MinSize.ToString("N0");
                }
            };

            this.FontFamilyListBox.SelectionChanged += this.FontFamilyListBox_SelectionChanged;
            this.OKBUtton.Click += this.OKBUtton_Click;
            this.CancelBUtton.Click += this.CancelBUtton_Click;
        }

        public FontInfo FontInfo
        {
            get
            {
                return this.fontInfo;
            }
            set
            {
                this.fontInfo = value;
                this.ShowFontInfo();
            }
        }

        public void SetOwner(
            System.Windows.Forms.Control windowsControl)
        {
            var helper = new WindowInteropHelper(this);
            helper.Owner = windowsControl.Handle;
        }

        private void FontFamilyListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.FontStyleListBox.SelectedIndex = 0;
        }

        private void FontSizeTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            var t = sender as TextBox;

            decimal d;

            if (e.Key == Key.Up)
            {
                if (decimal.TryParse(t.Text, out d))
                {
                    t.Text = (d + 0.5m).ToString("N1");
                }
            }

            if (e.Key == Key.Down)
            {
                if (decimal.TryParse(t.Text, out d))
                {
                    if ((d - 0.5m) >= 1.0m)
                    {
                        t.Text = (d - 0.5m).ToString("N1");
                    }
                }
            }
        }

        private void OKBUtton_Click(object sender, RoutedEventArgs e)
        {
            this.fontInfo = this.PreviewTextBlock.GetFontInfo();

            this.DialogResult = true;
            this.Close();
        }

        private void CancelBUtton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }

        private void ShowFontInfo()
        {
            this.FontSizeTextBox.Text = this.fontInfo.Size.ToString("N1");

            int i = 0;
            foreach (FontFamily item in this.FontFamilyListBox.Items)
            {
                if (this.fontInfo.Family != null)
                {
                    if (item.Source == this.fontInfo.Family.Source ||
                        item.FamilyNames.Any(x => x.Value == this.fontInfo.Family.Source))
                    {
                        break;
                    }
                }

                i++;
            }

            if (i < this.FontFamilyListBox.Items.Count)
            {
                this.FontFamilyListBox.SelectedIndex = i;
                this.FontFamilyListBox.ScrollIntoView(this.FontFamilyListBox.Items[i]);
            }

            this.FontStyleListBox.SelectedItem = this.fontInfo.Typeface;
        }
    }

    [Serializable]
    public class FontInfo
    {
        [XmlIgnore]
        private static FontStyleConverter styleConverter = new FontStyleConverter();

        [XmlIgnore]
        private static FontStretchConverter stretchConverter = new FontStretchConverter();

        [XmlIgnore]
        private static FontWeightConverter weightConverter = new FontWeightConverter();

        [XmlIgnore]
        private static Dictionary<string, FontFamily> fontFamilyDictionary = new Dictionary<string, FontFamily>();

        public FontInfo()
        {
            this.Family = GetFontFamily(string.Empty);
            this.Size = 11.25;
        }

        public FontInfo(
            string family,
            double size,
            string style,
            string weight,
            string stretch)
        {
            this.Family = GetFontFamily(family);
            this.Size = size;
            this.StyleString = style;
            this.WeightString = weight;
            this.StretchString = stretch;
        }

        public FontInfo(
            FontFamily family,
            double size,
            FontStyle style,
            FontWeight weight,
            FontStretch stretch)
        {
            this.Family = family;
            this.Size = size;
            this.Style = style;
            this.Weight = weight;
            this.Stretch = stretch;
        }

        [XmlIgnore]
        public FontFamily Family { get; set; }

        [XmlAttribute("FontFamily")]
        public string FamilyName
        {
            get
            {
                return
                    this.Family != null ?
                    this.Family.Source ?? string.Empty :
                    string.Empty;
            }
            set
            {
                this.Family = GetFontFamily(value);
            }
        }

        [XmlAttribute("Size")]
        public double Size { get; set; }

        [XmlIgnore]
        public FontStyle Style { get; set; }

        [XmlIgnore]
        public FontStretch Stretch { get; set; }

        [XmlIgnore]
        public FontWeight Weight { get; set; }

        [XmlAttribute("Style")]
        public string StyleString
        {
            get
            {
                return styleConverter.ConvertToString(this.Style);
            }
            set
            {
                this.Style = (FontStyle)styleConverter.ConvertFromString(value);
            }
        }

        [XmlAttribute("Stretch")]
        public string StretchString
        {
            get
            {
                return stretchConverter.ConvertToString(this.Stretch);
            }
            set
            {
                this.Stretch = (FontStretch)stretchConverter.ConvertFromString(value);
            }
        }

        [XmlAttribute("Weight")]
        public string WeightString
        {
            get
            {
                return weightConverter.ConvertToString(this.Weight);
            }
            set
            {
                this.Weight = (FontWeight)weightConverter.ConvertFromString(value);
            }
        }

        [XmlIgnore]
        public FamilyTypeface Typeface
        {
            get
            {
                var ftf = new FamilyTypeface();
                ftf.Stretch = this.Stretch;
                ftf.Weight = this.Weight;
                ftf.Style = this.Style;
                return ftf;
            }
        }

        public System.Drawing.Font ToFontForWindowsForm()
        {
            System.Drawing.FontStyle style = System.Drawing.FontStyle.Regular;

            if (this.Style == FontStyles.Italic ||
                this.Style == FontStyles.Oblique)
            {
                style |= System.Drawing.FontStyle.Italic;
            }

            if (this.Weight > FontWeights.Normal)
            {
                style |= System.Drawing.FontStyle.Bold;
            }

            System.Drawing.Font f = new System.Drawing.Font(
                this.FamilyName,
                (float)(this.Size * 72.0d / 96.0d),
                style);

            return f;
        }

        public override string ToString()
        {
            var t = string.Empty;

            t += "{ ";
            t += "\"Family\":" + "\"" + this.FamilyName + "\"" + ", ";
            t += "\"Size\":" + this.Size + ", ";
            t += "\"Style\":" + "\"" + this.StyleString + "\"" + ", ";
            t += "\"Weight\":" + "\"" + this.WeightString + "\"" + ", ";
            t += "\"Streth\":" + "\"" + this.StretchString + "\"";
            t += " }";

            return t;
        }

        private static FontFamily GetFontFamily(
            string source)
        {
            if (!fontFamilyDictionary.ContainsKey(source))
            {
                fontFamilyDictionary[source] = new FontFamily(source);
            }

            return fontFamilyDictionary[source];
        }
    }
    public class FontFamilyToNameConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var v = value as FontFamily;
            var currentLang = XmlLanguage.GetLanguage(culture.IetfLanguageTag);
            return v.FamilyNames.FirstOrDefault(o => o.Key == currentLang).Value ?? v.Source;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }

    public static class ControlExtension
    {
        public static void SetFontInfo(
            this Control control,
            FontInfo fontInfo)
        {
            if (control.GetFontInfo().ToString() != fontInfo.ToString())
            {
                control.FontFamily = fontInfo.Family;
                control.FontSize = fontInfo.Size;
                control.FontStyle = fontInfo.Style;
                control.FontWeight = fontInfo.Weight;
                control.FontStretch = fontInfo.Stretch;
            }
        }

        internal static void SetFontInfo(
            this OutlineTextBlock control,
            FontInfo fontInfo)
        {
            if (control.GetFontInfo().ToString() != fontInfo.ToString())
            {
                control.FontFamily = fontInfo.Family;
                control.FontSize = fontInfo.Size;
                control.FontStyle = fontInfo.Style;
                control.FontWeight = fontInfo.Weight;
                control.FontStretch = fontInfo.Stretch;
            }
        }

        internal static void SetFontInfo(
            this TextBlock control,
            FontInfo fontInfo)
        {
            if (control.GetFontInfo().ToString() != fontInfo.ToString())
            {
                control.FontFamily = fontInfo.Family;
                control.FontSize = fontInfo.Size;
                control.FontStyle = fontInfo.Style;
                control.FontWeight = fontInfo.Weight;
                control.FontStretch = fontInfo.Stretch;
            }
        }

        public static FontInfo GetFontInfo(
            this Control control)
        {
            return new FontInfo(
                control.FontFamily,
                control.FontSize,
                control.FontStyle,
                control.FontWeight,
                control.FontStretch);
        }

        internal static FontInfo GetFontInfo(
            this OutlineTextBlock control)
        {
            return new FontInfo(
                control.FontFamily,
                control.FontSize,
                control.FontStyle,
                control.FontWeight,
                control.FontStretch);
        }

        internal static FontInfo GetFontInfo(
            this TextBlock control)
        {
            return new FontInfo(
                control.FontFamily,
                control.FontSize,
                control.FontStyle,
                control.FontWeight,
                control.FontStretch);
        }
    }
}


text:
angular
    .module('main', ['diretivas', 'ngAnimate', 'ngRoute'])
    .config(function ($routeProvider, $locationProvider) {

        $locationProvider.html5Mode(true);

        $routeProvider.when('/framework', {
            templateUrl: 'partials/framework/list.html',
            controller: 'FrameworksController'
        });

        $routeProvider.when('/framework/adicionar', {
            templateUrl: 'partials/framework/new.html',
            controller: 'FrameworkController'
        });

        $routeProvider.when('/framework/atualizar/:frameworkId', {
            templateUrl: 'partials/framework/new.html',
            controller: 'FrameworkController'
        });

        //livros

        $routeProvider.when('/livros', {
            templateUrl: 'partials/Livros/listar.html',
            controller: 'LivrosController'
        });

        $routeProvider.when('/livros/cadastrar', {
            templateUrl: 'partials/Livros/cadastrar.html',
            controller: 'LivroController'
        });
        $routeProvider.when('/home', {templateUrl: 'partials/home/index.html'});

        $routeProvider.otherwise({redirectTo: '/home'});

    });

function validate($scope) {
    createMesage($scope, alertInputNull($scope), 'warning');
    return $scope.livro.titulo && $scope.livro.imagem && $scope.livro.descricao;
}

function alertInputNull($scope) {
    if (!$scope.livro.titulo)
        return 'Preencher o titulo';

    if (!$scope.livro.imagem)
        return 'Preencher a imagem';

    if (!$scope.livro.descricao)
        return 'Preencher a descricao';

    return '';
}

function createMesage($scope, mensage, type) {
    $scope.mesage.text = mensage;
    $scope.mesage.type = type;
    setTimeout(function () {
        $scope
            .$apply(function () {
                $scope.mesage.text = '';
                $scope.mesage.type = '';
            });
    }, 2000);
}

redpajama_set_name: RedPajamaGithub


text:
require 'spec_helper'

describe Snipsnap do
  subject(:klass) { Snipsnap }

  its(:configure) { should be_a Snipsnap::Configuration }
end

describe Snipsnap, "#configure" do
  context "when not passed a block" do
    subject(:config) { Snipsnap.configure }

    its(:protocol) { should eq "https" }
    its(:host)     { should eq "api.snipsnap.it"}
    its(:version)  { should eq 2 }
    its(:uri)      { should eq "https://api.snipsnap.it/v2" }
  end

  context "when passed a block" do
    subject(:config) do
      Snipsnap.configure do |config|
        config.protocol = "http"
        config.host     = "test.api.snipsnap.it"
        config.version  = 1
      end
    end

    its(:protocol) { should eq "http" }
    its(:host)     { should eq "test.api.snipsnap.it" }
    its(:version)  { should eq 1 }
    its(:uri)      { should eq "http://test.api.snipsnap.it/v1" }
  end
end

describe Snipsnap, "#connect" do
  subject(:connection) { Snipsnap.connect }

  it { should be_a Snipsnap::Api }
end


text:
package cn.newcapec.framework.core.model.datacontainer;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import javax.persistence.MappedSuperclass;

@MappedSuperclass
public abstract class DataContainer implements Serializable{

	private static final long serialVersionUID = 1L;

	private Map<String, Object>  propertyValueMap = new HashMap<String, Object>();
	private Map<String, Property>  propertyMap = new HashMap<String, Property>();
	//private LinkedList<Property> properties = new LinkedList<Property>();

	protected void  init(Property[]... properties){
		for(Property[] ps : properties) {
			for(Property p : ps) {
				propertyMap.put(p.getName(), p);
			}
		}
	}

	public void setValue(Property property, Object obj) {
		if(!propertyMap.containsValue(property)) {
			throw new RuntimeException("DataContainer不包含此属性!");
		}
		else if(property.getType().isInstance(obj) || null == obj) {
			propertyValueMap.put(property.getName(), obj);
		}
		else {
			throw new RuntimeException("非法类型!");
		}

	}

	public Object getValue(Property property){
		return propertyValueMap.get(property.getName());
	}

	public Property getProperty(String propertyName)
	  {
	    Property result = (Property)this.propertyMap.get(propertyName);
         return result;
	  }
}


text:
PipeDrive for Laravel 4
==============

Its client api to access data from pipedrive

### Installation

Include laravel4pipedrive as a dependency in composer.json:

~~~
"jrshah/laravel4pipedrive": "0.*"
~~~

Run `composer install` to download the dependency.

Add the ServiceProvider to your provider array within `app/config/app.php`:

~~~
'providers' => array(

    'Jrshah\Laravel4pipedrive\Laravel4pipedriveServiceProvider'

)
~~~

Finally, publish the configuration files via `php artisan config:publish jrshah/laravel4pipedrive`.

### Configuration

Once you have published the configuration files, you can set your API Token, Url and Version in `app/config/packages/jrshah/laravel4pipedrive/config.php`:

~~~
<?php
return array(
  'api_token' => 'your-pipedrive-token',
  'api_url' => 'api-url-for-pipedrive',
  'api_version' => 'pipedrive-api-version'
);
~~~

### Usage

~~~

// get all deals
PipeDrive::request('GET','deals');

// update a deal
PipeDrive::request('PUT','deals',1,array('title'=>'update the title'));

~~~


text:
package io.voucherify.android.client.module;

import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.Scheduler;
import io.voucherify.android.client.api.VoucherifyApi;
import io.voucherify.android.client.callback.VoucherifyCallback;
import io.voucherify.android.client.exception.VoucherifyError;
import io.voucherify.android.client.model.VouchersList;
import io.voucherify.android.client.utils.RxUtils;

public class Listing extends AbsModule<Listing.ExtAsync, Listing.ExtRxJava> {

    /**
     *
     * @param api describes Voucherify REST API
     * @param scheduler of threads for current platform
     * @param trackingId custom tracking id to track voucher consumers
     */
    public Listing(VoucherifyApi api, Scheduler scheduler, String trackingId) {
        super(api, scheduler, trackingId);
    }

    @Override
    ExtAsync createAsyncExtension() {
        return new ExtAsync();
    }

    @Override
    ExtRxJava createRxJavaExtension() {
        return new ExtRxJava();
    }

    public VouchersList list() throws IOException {
        Map<String, String> queryParams = new LinkedHashMap<>();

        queryParams.put("tracking_id", trackingId);

        return api.listVouchers(queryParams).execute().body();
    }

    public VouchersList list(String customer) throws IOException {
        Map<String, String> queryParams = new LinkedHashMap<>();

        queryParams.put("tracking_id", trackingId);
        queryParams.put("customer", customer);

        return api.listVouchers(queryParams).execute().body();
    }

    public class ExtRxJava {
        public Observable<VouchersList> list() {
            return RxUtils.defer(new RxUtils.DefFunc<VouchersList>() {
                @Override
                public VouchersList method() throws IOException {
                    return Listing.this.list();
                }
            });
        }

        public Observable<VouchersList> list(final String customer) {
            return RxUtils.defer(new RxUtils.DefFunc<VouchersList>() {
                @Override
                public VouchersList method() throws IOException {
                    return Listing.this.list(customer);
                }
            });
        }
    }

    public class ExtAsync {
        public void list(VoucherifyCallback<VouchersList,
                                   VoucherifyError> callback) {
            RxUtils.subscribe(scheduler, rx().list(), callback);
        }

        public void list(String customer, VoucherifyCallback<VouchersList,
                VoucherifyError> callback) {
            RxUtils.subscribe(scheduler, rx().list(customer), callback);
        }
    }
}


text:
/*!
* \file sky_box_app.h
* \date 2017/12/31 15:01
*
* \author www.xionggf.com
* Contact: sun_of_lover@sina.com
*
* \brief 展示天空盒的渲染技术
*
* TODO:
*
* \note
*/

#ifndef skybox_app_h__
#define skybox_app_h__

#include "../klib/kgl_lib_pch.h"
#include "../klib/kgl_app.h"
#include "../klib/kgl_gpu_program.h"
#include "../klib/kgl_primitive.h"
#include "../klib/kgl_source_texture.h"
#include "../klib/kgl_render_state_cull_mode.h"
#include "../klib/kgl_render_state_depth.h"
#include "../klib/kgl_sky_box.h"

class SkyBoxApp : public kgl::App
{
public:
    SkyBoxApp();
    virtual ~SkyBoxApp();
    virtual void InitScene();
protected:
    virtual void RenderScene() override;
    virtual void OnKeyAction(GLFWwindow* window, int key, int scancode, int action, int mode) override;
    virtual void OnMouseAction(GLFWwindow* window, double xpos, double ypos) override;
    virtual void OnScrollAction(GLFWwindow* window, double xoffset, double yoffset) override;
    virtual void ProcessInput() override;
    virtual void InitModel() override;
    virtual void InitShaders() override;
    virtual void InitMainCamera() override;
private:
    kgl::SkyBox*                sky_box_ = nullptr;
    kgl::GPUProgram*            scene_obj_shader_ = nullptr;
    kgl::PrimitiveSPtr          floor_;
    kgl::SourceTextureSPtr      floor_texture_;
};

#endif // skybox_app_h__


text:
using OpenGL;

namespace Rox.Voxel {

    /// <summary>
    /// View class which manages which <see cref="Chunk"/> instances should be loaded
    /// and unloaded based on player position.
    /// </summary>
    public class ChunkView {

        private int _radius;
        private Vector3 _center;
        private Vector3 _minVisible;
        private Vector3 _maxVisible;

        public readonly Chunk[,,] _chunks;

        public int ViewWidth => _chunks.GetLength(0);

        public int ViewHeight => _chunks.GetLength(1);

        public int ViewDepth => _chunks.GetLength(2);

        public Vector3 Center => _center;

        public ChunkView(int radius) {
            var diameter = radius * 2;

            _radius = radius;
            _chunks = new Chunk[diameter, diameter, diameter];
            _center = new Vector3();

            _minVisible = new Vector3(
                (Chunk.Width * _radius) / 2.0f,
                (Chunk.Height * _radius) / 2.0f,
                (Chunk.Depth * _radius) / 2.0f);

            _maxVisible = _minVisible + new Vector3(Chunk.Width, Chunk.Height, Chunk.Depth);

        }

        public void Update(Vector3 position) {
            var diameter = _radius * 2;

            var chunkX = (int) position.X / Chunk.Width;
            var chunkY = (int) position.Y / Chunk.Height;
            var chunkZ = (int) position.Z / Chunk.Depth;

            var maxRadius = _radius + 1;

            var startX = chunkX - maxRadius;
            var startY = chunkY - maxRadius;
            var startZ = chunkZ - maxRadius;

            var endX = chunkX + maxRadius;
            var endY = chunkY + maxRadius;
            var endZ = chunkZ + maxRadius;

            for (var x = 0; x < ViewWidth; ++x) {
                for (var y = 0; y < ViewHeight; ++y) {
                    for (var z = 0; z < ViewDepth; ++z) {
                        var chunk = _chunks[x, y, z];

                    }
                }
            }

            /*
            for (var x = 0; x < ViewWidth; ++x) {
                for (var y = 0; y < ViewHeight; ++y) {
                    for (var z = 0; z < ViewDepth; ++z) {
                        var chunk = _chunks[x, y, z];
                        if (null == chunk) {
                            continue;
                        }

                        var v = chunk.World + Chunk.HalfChunk;
                        Vector3 toCheck = (v - position);

                    }
                }
            }
            */
        }
    }
}


text:
from proscli.conductor import conduct, first_run
from prosconductor.providers import TemplateTypes, Identifier, TemplateConfig
import click
import json
from proscli.utils import default_cfg
import prosconductor.providers.local as local
import prosconductor.providers.utils as utils
import prosconfig
import semantic_version as semver
import jsonpickle

# Commands in this module are typically for automation/IDE purposes and probably won't be used by front-end users

@conduct.command('create-template', short_help='Creates a template with the specified name and version')
@click.argument('name')
@click.argument('version')
@click.argument('location')
@click.option('--ignore', '-i', multiple=True)
@click.option('--upgrade-files', '-u', multiple=True)
@default_cfg
def create_template(cfg, name, version, location, ignore, upgrade_files):
    first_run(cfg)
    template = local.create_template(utils.Identifier(name, version, None), location=location)
    template.template_ignore = list(ignore)
    template.upgrade_paths = list(upgrade_files)
    template.save()
    click.echo(jsonpickle.encode(template))
    click.echo('Created template at {}'.format(template.save_file))

@conduct.command('info-project', help='Provides information about a project. Especially useful for IDEs')
@click.argument('location')
@default_cfg
def info_project(cfg, location):
    project = prosconfig.ProjectConfig(path=location)
    details = dict()
    details['kernel'] = project.kernel
    templates = local.get_local_templates(pros_cfg=cfg.pros_cfg, template_types=[TemplateTypes.kernel])
    details['kernelUpToDate'] = semver.compare(project.kernel,
                                               sorted(templates, key=lambda t: semver.Version(t.version))[-1].version) \
                                >= 0
    templates = local.get_local_templates(pros_cfg=cfg.pros_cfg, template_types=[TemplateTypes.library])
    details['libraries'] = dict()
    if project.libraries.__class__ is dict:
        for (lib, ver) in project.libraries.items():
            details['libraries'][lib] = dict()
            details['libraries'][lib]['version'] = ver
            sorted_versions = sorted([t.version for t in templates if t.name == lib], key=lambda v: semver.Version(v))
            if len(sorted_versions) > 0:
                latest = semver.compare(ver, sorted_versions[-1]) >= 0
            else:
                latest = True
            details['libraries'][lib]['latest'] = latest
    click.echo(json.dumps(details))

@conduct.command('ls-registrars', help='List available registrars')
@default_cfg
def ls_registrars(cfg):
    table = {
        key: {'location_desc': value.location_desc, 'config': value.config} for key, value in utils.get_all_provider_types().items()
        }
    click.echo(json.dumps(table))

@conduct.command('info-depot', help='Get config for a depot')
@click.argument('depot')
@default_cfg
def info_depot(cfg, depot):
    dpt = utils.get_depot_config(depot)
    if dpt is None:
        click.echo(json.dumps(dict()))
    else:
        click.echo(json.dumps(dpt.registrar_options))

@conduct.command('set-depot-key', help='Set a config key/value pair for a depot')
@click.argument('depot')
@click.argument('key')
@click.argument('value')
@default_cfg
def set_depot_key(cfg, depot, key, value):
    dpt = utils.get_depot_config(depot)
    config = utils.get_all_provider_types(cfg.pros_cfg)[dpt.registrar]
    click.echo(config)
    config = config.config
    click.echo(config)
    if dpt is None:
        pass
    if config.get(key, dict()).get('method', 'str') == 'bool':
        value = value in ['true', 'True', 'TRUE', '1', 't', 'y', 'yes']
    dpt.registrar_options[key] = value
    dpt.save()


text:
module.exports = function(){
	var config = this.opts.config.browser
	var plugins = this.opts.plugins

	plugins.browserSync.init({
		server: {
			baseDir: config.dest,
			routes: {
				'/vendor': 'node_modules'
			}
		}
	})

	this.gulp.watch(config.src + '/**/*.ts', () => {
		plugins.runSequence(
			'browser:typescript',
			plugins.browserSync.reload
		)
	})

	this.gulp.watch(config.src + '/**/*.pug', () => {
		plugins.runSequence(
			'browser:pug',
			plugins.browserSync.reload
		)
	})

	this.gulp.watch(config.src + '/**/*.scss', () => {
		plugins.runSequence(
			'browser:sass',
			plugins.browserSync.reload
		)
	})
}

module.exports.dependencies = ['browser:build']


text:
    <nz-card nzTitle="Settings" class="coloredTitle">
        <form nz-form (ngSubmit)="onSubmitProjectUpdate()" #projectUpdateFrom="ngForm">
            <nz-form-item>
                <nz-form-label [nzSpan]="3">Project name</nz-form-label>
                <nz-form-control>
                    <input nz-input type="text" name="formProjectUpdateName"
                           placeholder="Project name"
                           [(ngModel)]="project.name"
                           [disabled]="loading"
                           required
                           #formProjectUpdateName="ngModel">
                </nz-form-control>
                <nz-alert *ngIf="formProjectUpdateName.invalid && !formProjectUpdateName.pristine"
                          nzType="error" nzMessage="Project name is mandatory and must respect the alphanumeric pattern ([a-zA-Z0-9]*)"></nz-alert>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label [nzSpan]="3">Description</nz-form-label>
                <nz-form-control>
                        <textarea nz-input name="formProjectUpdateDescription"
                                  placeholder="Description"
                                  [(ngModel)]="project.description"
                                  [disabled]="loading"
                                  #formProjectUpdateDescription="ngModel">
                        </textarea>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label [nzSpan]="3">Icon</nz-form-label>
                <nz-form-control>

                    <app-upload-button accept=".png,.jpg,.jpeg" image="true" (event)="fileEvent($event)"></app-upload-button>
                    <nz-alert *ngIf="fileTooLarge" nzType="error" nzMessage="Your file is too large (max 100Ko)"></nz-alert>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item nzJustify="end">
                <button nz-button nzType="primary" name="btnrename" [nzLoading]="loading" [disabled]="projectUpdateFrom.invalid">Rename</button>
            </nz-form-item>
        </form>
    </nz-card>
    <nz-card nzTitle="Link to a repository manager" class="coloredTitle">
        <app-repomanager-form [project]="project"></app-repomanager-form>
        <app-project-repomanager-list *ngIf="project.vcs_servers && project.vcs_servers.length > 0"
                                      [project]="project" [reposmanagers]="project.vcs_servers"
        ></app-project-repomanager-list>
    </nz-card>
    <nz-card nzTitle="Danger zone" class="redTitle">
        <nz-row>
            <nz-col [nzSpan]="12">

Delete project

Once you delete a project, there is no going back. Please be certain.

            </nz-col>
            <nz-col [nzSpan]="12" class="alignRight">
                <button nz-button nzDanger nzType="primary" [nzLoading]="loading"
                    nz-popconfirm nzPopconfirmTitle="Are you sure you want to delete this project ?"
                    (nzOnConfirm)="deleteProject()">Delete</button>
            </nz-col>
        </nz-row>
    </nz-card>


text:
import unittest
import sys
import os
import contextlib

if sys.version_info < (3,3):
    import mock
else:
    from unittest import mock

if sys.version_info < (3,):
    from StringIO import StringIO
else:
    from io import StringIO

from bitnomon import bitcoinconf

class ModuleTest(unittest.TestCase):

    "Tests for top-level module components (non-class functions)"

    @mock.patch('bitnomon.bitcoinconf.platform.system')
    def test_default_datadir(self, mock_system):

        def test_for_system(system, environ):
            mock_system.return_value = system
            with mock.patch.dict(bitcoinconf.os.environ, environ):
                # No exceptions should be raised
                bitcoinconf.default_datadir()
            with mock.patch.dict(bitcoinconf.os.environ, clear=True):
                # ConfigError should be raised when HOME/APPDATA is missing
                self.assertRaises(bitcoinconf.ConfigError,
                        bitcoinconf.default_datadir)

        test_for_system('Windows', {'APPDATA': 'test_appdata'})
        test_for_system('Darwin', {'HOME': 'test_home'})
        test_for_system('Linux', {'HOME': 'test_home'})

class ConfTest(unittest.TestCase):

    @mock.patch('bitnomon.bitcoinconf.open', create=True)
    def test_load(self, mock_open):
        mock_open.return_value = contextlib.closing(StringIO('\n'.join((
            '# comment',
            '\t # whitespace comment',
            '',
            'a=1 # trailing comment',
            'b = 2',
            '  c  =  3  ',
            'd = ',
            '=',
            ''))))
        conf = bitcoinconf.Conf()
        conf.load('test_datadir')
        mock_open.assert_called_once_with(
            os.path.join('test_datadir', 'bitcoin.conf'))
        self.assertEqual(conf, {
            'a': '1',
            'b': '2',
            'c': '3',
            'd': '',
            '': '',
            })


text:
import { IResource } from "../DataModel/IResource";
import { IDictionary } from "../IDictionary";
import { IHydraClient } from "../IHydraClient";
import { hydra } from "../namespaces";
import { partialCollectionIteratorFactory } from "./partialCollectionIteratorFactory";
import ProcessingState from "./ProcessingState";

type InstanceFactory = (resource: IResource, client: IHydraClient, processingState: ProcessingState) => IResource;

/**
 * Provides factory methods for strongly typed resources.
 * @const
 * @type {IDictionary<InstanceFactory>}
 */
export const factories: IDictionary<InstanceFactory> = {};

factories[hydra.ApiDocumentation] = (resource, client) => {
  const target = resource as any;
  target.getEntryPoint = () => client.getResource(target.entryPoint);
  return resource;
};

factories[hydra.Collection] = partialCollectionIteratorFactory;

factories.any = resource => {
  const someResource = resource as any;
  if (!someResource.displayName) {
    Object.defineProperty(someResource, "displayName", {
      get: () => (someResource.title || someResource.label) || ""
    });
    Object.defineProperty(someResource, "textDescription", {
      get: () => (someResource.description || someResource.comment) || ""
    });
  }

  return resource;
};


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Props - Login</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="styles/main.css">

				<form name="loginForm" role="form" ng-controller="ldapLoginCtrl" ng-submit="ldapLogin(userAuth)">
					Enter user name like this: "john.smith"

						<input type="text" name="username" class="form-control" placeholder="user.name" ng-model="userAuth.username" required />

						<input type="password" name="password" class="form-control" placeholder="password" ng-model="userAuth.password" required />

No valid login, no send props.

					<button type="submit" class="btn btn-default btn-lg btn-block">LOGIN</button>
				</form>


text:
#include "formula.h"
#include <cassert>
#include <vector>
#include <sstream>
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <climits>
#include <math.h>
#include <time.h>
#include <map>

#include "config.h"

using namespace satsolver;

void print_space(int depth) {
    std::cout << "TIME : " << (static_cast<float>(clock()))/CLOCKS_PER_SEC << "\t" ;
    for(int i = 0 ; i < depth ; i++)
        std::cout << "  " ;
}

// Avoid code duplication without using constructor delegation (see <http://stackoverflow.com/a/14477257/539465>)
#define FORMULA_INIT_LIST(v, nb_variables, affected_literals) aff(new Affectation(nb_variables)), clauses(v), nb_variables(nb_variables), mem(), to_do(), ded(new Deductions(nb_variables)),ded_depth(0)
#define FORMULA_INIT(v, nb_variables, affected_literals) \
    for(auto c : this->clauses) {\
        c->set_affectation(this->aff) ;\
    }\
    this->clean(affected_literals) ;\
    for(auto c : this->clauses) {\
        if(c->get_size() == 0)\
            throw Conflict() ;\
        if(WITH_WL)\
            c->init_WL() ;\
    }

Formula::Formula(std::vector<std::shared_ptr<Clause>> v, int nb_variables) : FORMULA_INIT_LIST(v, nb_variables, NULL) {
    FORMULA_INIT(v, nb_variables, NULL)
}
Formula::Formula(std::vector<std::shared_ptr<Clause>> v, int nb_variables, std::vector<unsigned int> *affected_literals) : FORMULA_INIT_LIST(v, nb_variables, affected_literals) {
    FORMULA_INIT(v, nb_variables, affected_literals)
}

satsolver::Formula::Formula(const satsolver::Formula &that) : aff(new Affectation(that.aff)), clauses(), nb_variables(that.nb_variables), mem(that.mem), to_do(that.to_do), ded(new Deductions(that.ded)), ded_depth(that.ded_depth)  {
    this->clauses.reserve(that.clauses.size());
    std::shared_ptr<Clause> c2;
    for(auto c : that.clauses) {
        c2 = std::shared_ptr<Clause>(new Clause(*c));
        this->clauses.push_back(c2);
        c2->set_affectation(this->aff) ;
    }
    for(auto c : this->clauses) {
        assert(c->get_size() != 0);
        if(WITH_WL)
            c->init_WL() ;
    }
}

Formula::~Formula() {
    this->clauses.clear() ;
    delete this->aff ;
    delete this->ded ;
}
Formula& Formula::operator=(const Formula &that) {
    this->nb_variables = that.nb_variables;
    this->clauses = that.clauses;
    delete this->aff;
    this->aff = that.aff ;
    this->mem = that.mem ;
    this->to_do = that.to_do ;
    this->ded_depth = that.ded_depth ;
    delete this->ded ;
    this->ded = that.ded ;
    return *this;
}

std::string Formula::to_string() {
    std::ostringstream oss;
    bool b  ;
    std::set<std::set<int>> s = this->to_set() ;
    if(s.empty())
        return "EMPTY FORMULA" ;
    for(auto c : s) {
        oss << "{" ;
        b = false ;
        for(auto i : c) {
            if(b)
                oss << "," ;
            oss << i ;
            b = true ;
        }
        oss << "}" ;
    }
    return oss.str() ;
}

std::string Formula::to_string2() {
    std::ostringstream oss;
    for(unsigned i = 0 ; i < this->clauses.size() ; i++) {
        oss << this->clauses[i]->to_string2() << std::endl;
    }
    return oss.str() ;
}

std::set<std::set<int> > Formula::to_set() {
    std::set<std::set<int> > set;
    for(auto clause : this->clauses) {
        if(!clause->is_evaluated_to_true())
            set.insert(clause->to_set()) ;
    }
    return set ;
}

std::set<Clause*> Formula::to_clauses_set() const {
    std::set<Clause*> set;
    for(unsigned i = 0 ; i < this->clauses.size() ; i++) {
        set.insert(new Clause(*this->clauses[i].get())) ;
    }
    return set ;
}

std::vector<std::shared_ptr<Clause>>& Formula::to_clauses_vector() {
    return this->clauses;
}

unsigned int Formula::add_clause(std::shared_ptr<satsolver::Clause> clause) {
    this->clauses.push_back(clause);
    return static_cast<unsigned int>(this->clauses.size())-1;
}

bool Formula::set_true(int x, int *clause1, int *clause2, int *literal, theorysolver::AbstractAssistant *assistant, int *clause_assistant) {
    int l ;
    int clause_id=-1 ;
    int tmp ;
    std::unordered_set<std::pair<int,unsigned int>,Hash,Equal>::const_iterator it ;
    if(clause_assistant)
        *clause_assistant = -1 ;
    this->aff->set_true(x) ;
    if(WITH_WL) {
        for(unsigned int i=0; i<this->clauses.size(); i++) {
            l = this->clauses[i]->set_true(x) ;
            if(l){// on a engendré un monome
                assert(this->get_aff()->is_unknown(l)) ;
                if((it=this->to_do.find(std::pair<int,int>(-l,0))) != this->to_do.end()) { // conflit
                    if(VERBOSE) {
                        print_space(this->ded_depth) ;
                        std::cout << "[Watched Literals] Detected a conflict : " << l << std::endl ;
                    }
                    *clause1 = it->second ;
                    *clause2 = i ;
                    *literal = l ;
                    this->to_do.clear();
                    return false ;
                }
                this->to_do.insert(std::pair<int,unsigned int>(l,i)) ;
            }
        }
    }
    if ((tmp=assistant->on_flip(abs(x)))!=-1) {
        *clause_assistant = tmp ;
        assert(clause1);
        *clause1 = tmp ;
        if(WITH_WL) {
            *clause2 = -1 ;
            *literal = x ;
        }
        if(VERBOSE) {
            print_space(this->ded_depth);
            std::cout << "Theory inconsistency. Learned a clause : " ;
            std::cout << this->clauses[tmp]->to_string()  << std::endl ;
        }
        this->to_do.clear();
        return false;
    }
    if(!this->to_do.empty()) { // on doit affecter ces littéraux
        l = this->to_do.begin()->first ;
        clause_id= this->to_do.begin()->second ;
        this->to_do.erase(this->to_do.begin()) ;
        return deduce_true(l, clause_id, clause1, clause2, literal, assistant,clause_assistant) ;
    }
    return true ;
}

bool Formula::deduce_true(int x, int clause_id, int *clause1, int *clause2, int *literal, theorysolver::AbstractAssistant *assistant, int *clause_assistant) {
    if(VERBOSE) {
        print_space(this->ded_depth) ;
        std::cout << "Deduce " << x << std::endl ;
        if(clause_id >= 0) {
            print_space(this->ded_depth) ;
            std::cout << this->clauses[clause_id]->to_string() << " => " << x << std::endl;
        }
    }
    if(this->aff->is_unknown(x)) {
        if((WITH_CL || CL_INTERACT) && clause_id >= 0)
            this->ded->add_deduction(x, this->clauses[clause_id]->whole_to_set(),clause_id,this->ded_depth);
        else
            this->ded->add_bet(x,this->ded_depth) ;
        this->mem.push_back(std::pair<int,bool>(x,true)) ;
        return this->set_true(x, clause1, clause2, literal, assistant, clause_assistant) ;
    }
    else {
        return this->aff->is_true(x) ;
    }
}
bool Formula::deduce_false(int x, int clause_id, theorysolver::AbstractAssistant *assistant, int *clause_assistant) {
    return deduce_true(-x, clause_id, NULL, NULL, NULL, assistant, clause_assistant) ;
}

bool Formula::bet_true(int x, int *clause1, int *clause2, int *literal, theorysolver::AbstractAssistant *assistant, int *clause_assistant) {
    if(VERBOSE) {
        print_space(this->ded_depth) ;
        std::cout << "Bet " << x << std::endl ;
    }
    this->ded_depth ++ ;
    if(this->aff->is_unknown(x)) {
        this->ded->add_bet(x,this->ded_depth) ;
        this->mem.push_back(std::pair<int,bool>(x,false)) ;
        return this->set_true(x,clause1,clause2,literal, assistant, clause_assistant) ;
    }
    else
        return this->aff->is_true(x) ;
}
bool Formula::bet_false(int x, int *clause1, int *clause2, int *literal, theorysolver::AbstractAssistant *assistant, int *clause_assistant) {
    return bet_true(-x,clause1,clause2,literal, assistant, clause_assistant) ;
}

int Formula::back(theorysolver::AbstractAssistant *assistant) {
    ded_depth -- ;
    if(VERBOSE) {
        print_space(this->ded_depth) ;
        std::cout << "Backtrack: " ;
    }
    std::pair<int,bool> p ;
    while(!this->mem.empty()) {
        p = this->mem.back() ;
        if(VERBOSE) std::cout << p.first << " " ;
        this->aff->set_unknown(p.first) ;
        this->mem.pop_back() ;
        this->ded->remove_deduction(p.first) ;
        assistant->on_flip(abs(p.first));
        if(!p.second) {// on est arrivé au pari
            if(VERBOSE)
                std::cout << std::endl ;
            return p.first ;
        }
    }
    if(VERBOSE)
        std::cout << std::endl ;
    return 0 ;
}

int Formula::back(theorysolver::AbstractAssistant *assistant, unsigned int depth) {
    int l=0 ;
    if(VERBOSE) {
        print_space(this->ded_depth) ;
        std::cout << "Performing " << this->ded_depth - depth << " backtrack(s)."  << std::endl ;
    }
    assert(depth <= this->ded_depth) ;
    while(depth != this->ded_depth) {
        l = this->back(assistant) ;
    }
    return l ;
}

int Formula::monome(int *clause_id) {
    int literal ;
    for(unsigned i = 0 ; i < this->clauses.size() ; i++) {
        literal = this->clauses[i]->monome() ;
        if(literal) {
            if (clause_id)
                *clause_id = i;
            return literal ;
        }
    }
    return 0 ;
}

int Formula::isolated_literal(int *clause_id) {
    unsigned int i;
    int *l ;
    std::vector<std::shared_ptr<Clause>> clauses = this->to_clauses_vector();
    std::map<int, unsigned int> literal_to_clause_id;
    l = static_cast<int*>(malloc((this->nb_variables+1)*sizeof(int)));
    /* l[i] = 0 si i est inconnu et n'existe pas dans les clauses
         l[i] = 1 si i est inconnu et seulement positif
         l[i] = 2 si i est inconnu et seulement négatif
         l[i] = 3 si i est inconnu et positif et négatif
    */
    memset(l, 0, (this->nb_variables+1)*sizeof(int)) ;
    for (i=0; i<clauses.size(); i++) {
        if(clauses.at(i)->is_evaluated_to_true())
            continue;
        for(auto j : clauses.at(i)->to_set()) {
            if(j>0) {
                if(l[j] == 0 || l[j] == 1)
                    l[j] = 1 ;
                else
                    l[j] = 3 ;
            }
            else {
                if(l[-j] == 0 || l[-j] == 2)
                    l[-j] = 2 ;
                else
                    l[-j] = 3 ;
            }
            if (clause_id && l[abs(j)] != 0)
                literal_to_clause_id[j] = i;
        }
    }
    for(int i = 1 ; i <= this->nb_variables ; i++) {
        if(l[i] == 1) {
            free(l);
            if (clause_id)
                *clause_id = literal_to_clause_id[i];
            return i ;
        }
        else if(l[i] == 2) {
            free(l);
            if (clause_id)
                *clause_id = literal_to_clause_id[i];
            return -i ;
        }
    }
    free(l);
    return 0 ;
}

bool Formula::is_empty() const {
    return (this->clauses.size() == 0);
}
long unsigned int Formula::get_size() const {
    return this->clauses.size() ;
}
int Formula::get_nb_variables() const {
    return this->nb_variables;
}
bool Formula::contains_false_clause(int *clause_id) const {
    for(unsigned i = 0 ; i < this->clauses.size() ; i ++) {
        if (this->clauses[i]->is_evaluated_to_false()) {
            if (clause_id)
                *clause_id = i;
            return true;
        }
    }
    return false;
}
bool Formula::only_true_clauses(int *clause_id) const {
    for(unsigned i = 0 ; i < this->clauses.size() ; i ++) {
        if (!this->clauses[i]->is_evaluated_to_true()) {
            if (clause_id)
                *clause_id = i;
            return false;
        }
    }
    return true;
}

bool to_delete(std::shared_ptr<Clause> c, std::unordered_set<int> &literals_to_delete) {
    for(auto x : literals_to_delete) {
        if(c->contains_literal(x))
            return true ;
    }
    return false ;
}

void Formula::clean(std::vector<unsigned int> *affected_literals) {
    // Affectation des monomes
    std::unordered_set<int> literals_to_delete = std::unordered_set<int>() ;
    int literal=0 ;
    do {
        for(auto c : this->clauses) {
            literal = c->monome_begin();
            if(literals_to_delete.find(literal) != literals_to_delete.end())
                literal = 0 ;
            if(literal)
                break ;
        }
        if(literal) {
            this->aff->set_true(literal) ;
            this->ded->add_bet(literal,0);
            if (affected_literals)
                affected_literals->push_back(abs(literal));
            this->mem.push_back(std::pair<int,bool>(literal,true)) ;
            literals_to_delete.insert(literal) ;
            for(auto c : this->clauses) {
                c->remove(-literal) ;
            }
        }
    } while(literal != 0) ;
    std::vector<std::shared_ptr<Clause>> old_clauses(this->clauses) ;
    this->clauses.clear() ;
    this->clauses.reserve(old_clauses.size()) ;
    for(unsigned i = 0 ; i < old_clauses.size() ; i++) {
        if(!to_delete(old_clauses[i],literals_to_delete))
            this->clauses.push_back(old_clauses[i]) ;
    }

}

std::vector<std::pair<int,bool>> Formula::get_mem() {
    return std::vector<std::pair<int,bool>>(this->mem) ;
}

Affectation *Formula::get_aff() {
    return (this->aff) ;
}

Deductions *Formula::get_ded() {
    return (this->ded) ;
}

int Formula::get_ded_depth() {
    return this->ded_depth ;
}

std::vector<int> Formula::get_unknown_literals(void) const {
    std::vector<int> v = std::vector<int>() ;
    for(unsigned i = 0 ; i < clauses.size() ; i++) {
        clauses[i]->add_literals_to_vector(v) ;
    }
    return v ;
}

int Formula::choose_literal_dumb() const {
    for(int i = 1 ; i <= this->nb_variables ; i ++) {
        if (this->aff->is_unknown(i)) {
            return i ;
        }
    }
    std::cout << "Error in choose_literal : all clauses are empty, or there is no clauses." << std::endl ;
    return 0;
}

int Formula::choose_literal_random() const {
    std::vector<int> v = this->get_unknown_literals() ;
    assert(v.size() > 0) ;
    return v[rand()%v.size()] ;
}

int Formula::choose_literal_moms() const {
    bool there_is_literals = false ;
    long unsigned min_clause_size = ULONG_MAX;
    std::vector<int> v = std::vector<int>() ;
    int *count = static_cast<int*>(malloc((2*this->nb_variables+1)*sizeof(int))); // count[i] = nombre d'apparitions du littéral i-nb_variables
    for(unsigned i = 0 ; i < this->clauses.size() ; i++) {
        v.clear() ;
        this->clauses[i]->add_literals_to_vector(v) ;
        there_is_literals = there_is_literals || v.size() > 0 ;
        if(v.size() < min_clause_size && v.size() > 0) { // trouvé une clause plus petite, on remet tout à zéro
            min_clause_size = v.size() ;
            memset(count,0,(2*this->nb_variables+1)*sizeof(int)) ;
        }
        if(v.size() == min_clause_size) { // on incrémente le compteur de tous les littéraux de v
            for(unsigned j = 0 ; j < v.size() ; j++) {
                count[v[j]+this->nb_variables] ++ ;
            }
        }
    }
    // Recherche du maximum dans count
    int max_occurence, max_literal ;
    max_occurence = 0 ;  max_literal = 0 ;
    for(int i = 0 ; i < 2*this->nb_variables+1 ; i++) {
        if(count[i] > max_occurence) {
            max_occurence = count[i] ;
            max_literal = i ;
        }
    }
    free(count) ;
    assert(there_is_literals) ;
    return max_literal-this->nb_variables ;
}

int Formula::choose_literal_dlis() const {
    bool there_is_literals = false ;
    std::vector<int> v = std::vector<int>() ;
    // count[i] = nombre d'apparitions du littéral i-nb_variables
    std::vector<double> count = std::vector<double>(2*this->nb_variables+1,0.0) ;
    double point ;
    for(unsigned i = 0 ; i < this->clauses.size() ; i++) {
        v.clear() ;
        this->clauses[i]->add_literals_to_vector(v) ;
        there_is_literals = there_is_literals || v.size() > 0 ;
        point = pow(2,-static_cast<double>(v.size()));
        for(unsigned j = 0 ; j < v.size() ; j ++) {
            count[v[j]+this->nb_variables] += point ;
        }
    }
    // Recherche du maximum dans count
    double max_occurence ;
    int max_literal ;
    max_occurence = 0 ;  max_literal = 0 ;
    for(int i = 0 ; i < 2*this->nb_variables+1 ; i++) {
        if(count[i] > max_occurence) {
            max_occurence = count[i] ;
            max_literal = i ;
        }
    }
    assert(there_is_literals) ;
    return max_literal-this->nb_variables ;
}

int Formula::choose_literal(int choice) {
    int literal=0 ;
    switch(choice) {
        case DUMB : literal = this->choose_literal_dumb() ; break ;
        case RANDOM : literal = this->choose_literal_random() ; break ;
        case MOMS : literal = this->choose_literal_moms() ; break ;
        case DLIS : literal = this->choose_literal_dlis() ; break ;
    }
    assert(literal && this->aff->is_unknown(literal)) ;
    return(literal) ;
}

int Formula::learn_clause(CLProof *proof, int *clause_id, unsigned int *new_depth, int literal, Clause *learned_clause) {
    long unsigned int i_conf; // The index in the memory "stack" of the literal we are making the resolution on.
    int lit_conf, lit_inf;
    int clause_id1, clause_id2 ;
    int nb_same_lvl ;
    clause_id1 = *clause_id ;
    clause_id2 = this->ded->get_clause_id(literal) ;
    std::unordered_set<int> clause = this->clauses[clause_id1]->whole_to_set() ;
    std::unordered_set<int> clause2 = this->clauses[clause_id2]->whole_to_set() ;

    clause.insert(clause2.begin(), clause2.end());
    clause.erase(literal) ;
    clause.erase(-literal);

    while (true) {
        // Recherche d'un UIP (seul littéral de la clause affecté au niveau d'affectation courant)
        nb_same_lvl = 0 ;
        for(auto l : clause) {
            if(this->ded->get_deduction_depth(l) == this->get_ded_depth())
                nb_same_lvl ++ ;
            if(nb_same_lvl > 1)
                break ;
        }
        assert(nb_same_lvl) ;
        if(nb_same_lvl == 1)
            break ;
        i_conf = this->mem.size()  ;
        do { // recherche du dernier littéral affecté à faux dans la clause
          assert(i_conf);
          i_conf-- ;
          assert(this->mem[i_conf].second) ;
          lit_conf = this->mem[i_conf].first ;
        } while(clause.find(-lit_conf) == clause.end() && clause.find(lit_conf) == clause.end()) ;

        clause_id2 = this->ded->get_clause_id(lit_conf) ;
        clause2 = this->clauses[clause_id2]->whole_to_set(); // Clause correspondante

        // Resolution
        proof->insert_top(lit_conf, std::make_pair(clause_id1, Clause(nb_variables, clause)), std::make_pair(clause_id2, Clause(nb_variables, clause2)));
        clause.insert(clause2.begin(), clause2.end());
        clause.erase(lit_conf) ;
        clause.erase(-lit_conf);
    }
    proof->conclude(Clause(this->get_nb_variables(), clause));
    if(clause.size() == 1) { // cas particulier
        if(VERBOSE) {
            print_space(this->ded_depth) ;
            std::cout << "Deduced a clause of size 1: {" << *clause.begin() << "}" << std::endl ;
        }
        *new_depth = 0 ; // on backtrack tout
        *clause_id = -1 ;
        return *clause.begin() ; // on devra ensuite déduire ce littéral
        // on n'ajoute pas cette clause, pour ne pas avoir de problèmes avec WL
        // la déduction au niveau zéro est équivalente (puisqu'elle ne sera jamais enlevée)
    }
    int depth_max = -1 ;
    lit_conf = 0 ;
    lit_inf = 0 ;
    for(auto l : clause) {
        if(this->ded->get_deduction_depth(l) != static_cast<int>(this->ded_depth)) {
            if(this->ded->get_deduction_depth(l)>depth_max) { // nouveau niveau max
                depth_max = this->ded->get_deduction_depth(l) ;
                lit_inf = l ;
            }
        }
        else
            lit_conf = l ; // seul literal du niveau courant
    }
    assert(lit_conf) ;
    assert(lit_inf) ;
    assert(depth_max != -1) ;
    if (learned_clause)
        *learned_clause = Clause(nb_variables, clause, this->aff);
    this->clauses.push_back(std::shared_ptr<Clause>(new Clause(nb_variables, clause,this->aff)));
    if(WITH_WL)
        this->clauses.back()->init_WL_CL(lit_conf,lit_inf) ; // nouveaux littéraux surveillés de la clause
    if(VERBOSE) {
        print_space(this->ded_depth) ;
        std::cout << "Learned the clause " << clauses.back()->to_string() << std::endl ;
    }
    *clause_id = static_cast<int> (this->clauses.size() - 1) ;
    *new_depth = depth_max ;
    return lit_conf ;
}

int Formula::last_bet() {
    for(long unsigned i = this->mem.size() - 1 ; i > 0 ; i--)
        if(!mem[i].second)
            return mem[i].first ;
     return mem[0].first ;
}


text:
#pragma once

#include <Hord/config.hpp>
#include <Hord/utility.hpp>
#include <Hord/String.hpp>
#include <Hord/Data/Defs.hpp>
#include <Hord/Object/Defs.hpp>

namespace Hord {
namespace Data {

// Forward declarations
struct ValueRef;

/**
	@addtogroup data
	@{
*/

/**
	Value reference.
*/
struct ValueRef {
public:
/** @name Properties */ /// @{
	/** Type. */
	Data::Type type{};
	/** Dynamic size. */
	unsigned size{0};
	/** Value data. */
	union ValueData {
		void const* dynamic;
		std::int8_t  s8;
		std::int16_t s16;
		std::int32_t s32;
		std::int64_t s64;
		std::uint8_t  u8;
		std::uint16_t u16;
		std::uint32_t u32;
		std::uint64_t u64;
		float f32;
		double f64;
		Object::ID object_id;
		char const* string;

		ValueData() noexcept : u64(0) {}
		ValueData(std::nullptr_t const) noexcept : ValueData() {}
		ValueData(void const* const data) noexcept : dynamic(data) {}
		ValueData(char const* const data) noexcept : string(data) {}
		ValueData(std::int8_t const value) noexcept : s8(value) {}
		ValueData(std::int16_t const value) noexcept : s16(value) {}
		ValueData(std::int32_t const value) noexcept : s32(value) {}
		ValueData(std::int64_t const value) noexcept : s64(value) {}
		ValueData(std::uint8_t const value) noexcept : u8(value) {}
		ValueData(std::uint16_t const value) noexcept : u16(value) {}
		ValueData(std::uint32_t const value) noexcept : u32(value) {}
		ValueData(std::uint64_t const value) noexcept : u64(value) {}
		ValueData(float const value) noexcept : f32(value) {}
		ValueData(double const value) noexcept : f64(value) {}
		ValueData(Object::ID const value) noexcept : object_id(value) {}
	} data{};
/// @}

public:
/** @name Special member functions */ /// @{
	/** Destructor. */
	~ValueRef() noexcept = default;

	/** Default constructor. */
	ValueRef() = default;
	/** Copy constructor. */
	ValueRef(ValueRef const&) = default;
	/** Copy assignment operator. */
	ValueRef& operator=(ValueRef const&) = default;
	/** Move constructor. */
	ValueRef(ValueRef&&) = default;
	/** Move assignment operator. */
	ValueRef& operator=(ValueRef&&) = default;

	/**
		Construct empty value of type.
	*/
	ValueRef(
		Data::Type const type
	) noexcept
		: type(type)
	{}

	/**
		Construct with fixed-size value.
	*/
	template<class T>
	ValueRef(
		T const value
	) noexcept
		: type(Data::type_traits<T>::value())
		, size(0)
		, data(value)
	{}

	/**
		Construct with string value.

		@note @a data is assumed to be NUL-terminated.
	*/
	template<unsigned N>
	ValueRef(
		char const (&data)[N]
	) noexcept
		: type(Data::ValueType::string, Data::Size::b32)
		, size(N - 1)
		, data(data)
	{}

	/**
		Construct with string value.
	*/
	ValueRef(
		char const* const data,
		unsigned const size
	) noexcept
		: type(Data::ValueType::string, Data::Size::b32)
		, size(size)
		, data(data)
	{}

	/**
		Construct with string value.
	*/
	ValueRef(
		String const& str
	) noexcept
		: type(Data::ValueType::string, Data::Size::b32)
		, size(static_cast<unsigned>(str.size()))
		, data(str.data())
	{}
/// @}

/** @name Properties */ /// @{
	/**
		Get signed integer value.

		@returns @c 0 if the value is not an integer.
	*/
	std::int64_t
	integer_signed() const noexcept {
		if (type.type() != Data::ValueType::integer) {
			return 0;
		}
		if (!enum_cast(type.flags() & Data::ValueFlag::integer_signed)) {
			return integer_unsigned();
		}
		switch (type.size()) {
		case Data::Size::b8 : return data.s8;
		case Data::Size::b16: return data.s16;
		case Data::Size::b32: return data.s32;
		case Data::Size::b64: return data.s64;
		}
	}

	/**
		Get unsigned integer value.

		@returns @c 0 if the value is not an integer.
	*/
	std::uint64_t
	integer_unsigned() const noexcept {
		if (type.type() != Data::ValueType::integer) {
			return 0;
		}
		if (enum_cast(type.flags() & Data::ValueFlag::integer_signed)) {
			return integer_signed();
		}
		switch (type.size()) {
		case Data::Size::b8 : return data.u8;
		case Data::Size::b16: return data.u16;
		case Data::Size::b32: return data.u32;
		case Data::Size::b64: return data.u64;
		}
	}

	/**
		Get decimal value.

		@returns @c 0.0f if the value is not a decimal.
	*/
	double
	decimal() const noexcept {
		if (type.type() != Data::ValueType::decimal) {
			return 0.0f;
		} else if (type.size() == Data::Size::b64) {
			return data.f64;
		} else {
			return data.f32;
		}
	}
/// @}

/** @name Operators */ /// @{
	/**
		Equal-to operator.
	*/
	bool
	operator==(
		Data::ValueRef const& rhs
	) const noexcept;

	/**
		Not-equal-to operator.
	*/
	bool
	operator!=(
		Data::ValueRef const& rhs
	) const noexcept {
		return !(*this == rhs);
	}
/// @}

/** @name Operations */ /// @{
	/**
		Morph value to the specified type.

		@note Does nothing if type is dynamic.
	*/
	void
	morph(
		Data::Type const type
	) noexcept;

	/**
		Read value from NUL-terminated string.

		If @a assume_signed is true, integers will be read as signed
		if no negative sign is found.
	*/
	void
	read_from_string(
		unsigned const size,
		char const* const string,
		bool const assume_signed = true
	) noexcept;
/// @}
};

/** @} */ // end of doc-group data

} // namespace Data
} // namespace Hord


text:
static CMARK_INLINE void S_cr(cmark_renderer *renderer) {
  if (renderer->need_cr < 1) {
    renderer->need_cr = 1;
  }
}

static CMARK_INLINE void S_blankline(cmark_renderer *renderer) {
  if (renderer->need_cr < 2) {
    renderer->need_cr = 2;
  }
}

static void S_out(cmark_renderer *renderer, const char *source, bool wrap,
                  cmark_escaping escape) {
  int length = strlen(source);
  unsigned char nextc;
  int32_t c;
  int i = 0;
  int last_nonspace;
  int len;
  cmark_chunk remainder = cmark_chunk_literal("");
  int k = renderer->buffer->size - 1;

  wrap = wrap && !renderer->no_linebreaks;

  if (renderer->in_tight_list_item && renderer->need_cr > 1) {
    renderer->need_cr = 1;
  }
  while (renderer->need_cr) {
    if (k < 0 || renderer->buffer->ptr[k] == '\n') {
      k -= 1;
    } else {
      cmark_strbuf_putc(renderer->buffer, '\n');
      if (renderer->need_cr > 1) {
        cmark_strbuf_put(renderer->buffer, renderer->prefix->ptr,
                         renderer->prefix->size);
      }
    }
    renderer->column = 0;
    renderer->last_breakable = 0;
    renderer->begin_line = true;
    renderer->begin_content = true;
    renderer->need_cr -= 1;
  }

  while (i < length) {
    if (renderer->begin_line) {
      cmark_strbuf_put(renderer->buffer, renderer->prefix->ptr,
                       renderer->prefix->size);
      // note: this assumes prefix is ascii:
      renderer->column = renderer->prefix->size;
    }

    len = cmark_utf8proc_iterate((const uint8_t *)source + i, length - i, &c);
    if (len == -1) { // error condition
      return;        // return without rendering rest of string
    }
    nextc = source[i + len];
    if (c == 32 && wrap) {
      if (!renderer->begin_line) {
        last_nonspace = renderer->buffer->size;
        cmark_strbuf_putc(renderer->buffer, ' ');
        renderer->column += 1;
        renderer->begin_line = false;
        renderer->begin_content = false;
        // skip following spaces
        while (source[i + 1] == ' ') {
          i++;
        }
        // We don't allow breaks that make a digit the first character
        // because this causes problems with commonmark output.
        if (!cmark_isdigit(source[i + 1])) {
          renderer->last_breakable = last_nonspace;
        }
      }

    } else if (escape == LITERAL) {
      if (c == 10) {
        cmark_strbuf_putc(renderer->buffer, '\n');
        renderer->column = 0;
        renderer->begin_line = true;
        renderer->begin_content = true;
        renderer->last_breakable = 0;
      } else {
        cmark_render_code_point(renderer, c);
        renderer->begin_line = false;
        // we don't set 'begin_content' to false til we've
        // finished parsing a digit.  Reason:  in commonmark
        // we need to escape a potential list marker after
        // a digit:
        renderer->begin_content =
            renderer->begin_content && cmark_isdigit(c) == 1;
      }
    } else {
      (renderer->outc)(renderer, escape, c, nextc);
      renderer->begin_line = false;
      renderer->begin_content =
          renderer->begin_content && cmark_isdigit(c) == 1;
    }

    // If adding the character went beyond width, look for an
    // earlier place where the line could be broken:
    if (renderer->width > 0 && renderer->column > renderer->width &&
        !renderer->begin_line && renderer->last_breakable > 0) {

      // copy from last_breakable to remainder
      cmark_chunk_set_cstr(renderer->mem, &remainder,
                           (char *)renderer->buffer->ptr +
                               renderer->last_breakable + 1);
      // truncate at last_breakable
      cmark_strbuf_truncate(renderer->buffer, renderer->last_breakable);
      // add newline, prefix, and remainder
      cmark_strbuf_putc(renderer->buffer, '\n');
      cmark_strbuf_put(renderer->buffer, renderer->prefix->ptr,
                       renderer->prefix->size);
      cmark_strbuf_put(renderer->buffer, remainder.data, remainder.len);
      renderer->column = renderer->prefix->size + remainder.len;
      cmark_chunk_free(renderer->mem, &remainder);
      renderer->last_breakable = 0;
      renderer->begin_line = false;
      renderer->begin_content = false;
    }

    i += len;
  }
}

// Assumes no newlines, assumes ascii content:
void cmark_render_ascii(cmark_renderer *renderer, const char *s) {
  int origsize = renderer->buffer->size;
  cmark_strbuf_puts(renderer->buffer, s);
  renderer->column += renderer->buffer->size - origsize;
}

void cmark_render_code_point(cmark_renderer *renderer, uint32_t c) {
  cmark_utf8proc_encode_char(c, renderer->buffer);
  renderer->column += 1;
}

char *cmark_render(cmark_node *root, int options, int width,
                   void (*outc)(cmark_renderer *, cmark_escaping, int32_t,
                                unsigned char),
                   int (*render_node)(cmark_renderer *renderer,
                                      cmark_node *node,
                                      cmark_event_type ev_type, int options)) {
  cmark_mem *mem = cmark_node_mem(root);
  cmark_strbuf pref = CMARK_BUF_INIT(mem);
  cmark_strbuf buf = CMARK_BUF_INIT(mem);
  cmark_node *cur;
  cmark_event_type ev_type;
  char *result;
  cmark_iter *iter = cmark_iter_new(root);

  cmark_renderer renderer = {mem,   &buf, &pref, 0,           width,
                             0,     0,    true,  true,        false,
                             false, outc, S_cr,  S_blankline, S_out};

  while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
    cur = cmark_iter_get_node(iter);
    if (!render_node(&renderer, cur, ev_type, options)) {
      // a false value causes us to skip processing
      // the node's contents.  this is used for
      // autolinks.
      cmark_iter_reset(iter, cur, CMARK_EVENT_EXIT);
    }
  }

  // ensure final newline
  if (renderer.buffer->size == 0 || renderer.buffer->ptr[renderer.buffer->size - 1] != '\n') {
    cmark_strbuf_putc(renderer.buffer, '\n');
  }

  result = (char *)cmark_strbuf_detach(renderer.buffer);

  cmark_iter_free(iter);
  cmark_strbuf_free(renderer.prefix);
  cmark_strbuf_free(renderer.buffer);

  return result;
}


text:
#include "config.h"
#include "WebProcessProxy.h"

namespace WebKit {

void WebProcessProxy::platformConnect(ProcessLauncher::LaunchOptions& launchOptions)
{
#ifndef NDEBUG
    const char* webProcessCmdPrefix = getenv("WEB_PROCESS_CMD_PREFIX");
    if (webProcessCmdPrefix && *webProcessCmdPrefix)
        launchOptions.processCmdPrefix = String::fromUTF8(webProcessCmdPrefix);
#else
    UNUSED_PARAM(launchOptions);
#endif
}

} // namespace WebKit


text:
<?php echo $header; ?>

<hgroup class="wrap">

<?php echo __('comments.comments'); ?>

</hgroup>

	<?php echo $messages; ?>

		<?php foreach($statuses as $data): extract($data); ?>
		<?php echo Html::link('admin/comments/' . $url, ' ' . __($lang), array(
			'class' => $class . (isset($status) and $status == $url ? ' active' : '')
		)); ?>
		<?php endforeach; ?>

	<?php if($comments->count): ?>

		<?php foreach($comments->results as $comment): ?>

			<a href="<?php echo Uri::to('admin/comments/edit/' . $comment->id); ?>">
				<?php echo strip_tags($comment->text); ?>
				<time><?php echo Date::format($comment->date); ?></time>
				<?php echo $comment->status; ?>

		<?php endforeach; ?>

	<?php echo $comments->links(); ?>

	<?php else: ?>

		<?php echo __('comments.nocomments_desc'); ?>

	<?php endif; ?>

<?php echo $footer; ?>