text:
<?php
function TrimTrailingZeroes($nbr) {
    return strpos($nbr,'.')!==false ? rtrim(rtrim($nbr,'0'),'.') : $nbr;
}

$query = "SELECT total_coins FROM blocks ORDER BY height DESC LIMIT 1";
	$result = $dbconn->query($query);
	while($row = $result->fetch_assoc())
	{
		$block_total_coins=$row['total_coins'];
	}
function timeAgo ($time) {
    $time = time() - $time;

    $tokens = array (
        86400 => 'day',
        3600 => 'hour',
        60 => 'minute',
        1 => 'second'
    );

    foreach ($tokens as $unit => $text) {
        if ($time < $unit) continue;
        $numberOfUnits = floor($time / $unit);
        return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');
    }
}
?>

<?php echo lang('TOP_ADDRESSES'); ?>

<?php echo lang('TOP_ACCOUNTS'); ?>

<?php echo lang('WEALTH_DISTRIBUTION'); ?>


text:
package com.citelic.game.entity.player.content.dialogue.impl.npcs;

import com.citelic.cache.impl.NPCDefinitions;
import com.citelic.game.entity.player.appearance.design.PlayerLook;
import com.citelic.game.entity.player.content.dialogue.Dialogue;

public class MakeOverMage extends Dialogue {

	int npcId;

	@Override
	public void finish() {
		// TODO Auto-generated method stub
	}

	@Override
	public void run(int interfaceId, int componentId) {
		if (stage == -1) {
			stage = 0;
			sendEntityDialogue(SEND_2_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"I call it a 'makeover'.",
							"Would you like to perform my magicks on you?" },
					IS_NPC, npcId, 9827);
		} else if (stage == 0) {
			stage = 1;
			sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE,
					"Tell me more about this 'makeover'.", "Sure, do it.",
					"No thanks.", "Cool amulet! Can i have one?");
		} else if (stage == 1) {
			if (componentId == OPTION_1) {
				stage = 2;
				sendPlayerDialogue(9827, "Tell me more about this 'makeover'.");
			} else if (componentId == OPTION_2) {
				stage = 11;
				sendPlayerDialogue(9827, "Sure, do it.");
			} else if (componentId == OPTION_3) {
				stage = 13;
				sendPlayerDialogue(9827,
						"No thanks. I'm happy as Saradomin made me.");
			} else {
				stage = 14;
				sendEntityDialogue(SEND_1_TEXT_CHAT,
						new String[] { player.getDisplayName(),
								"Cool amulet! Can i have one?" }, IS_PLAYER,
						player.getIndex(), 9827);
			}
		} else if (stage == 2) {
			stage = 3;
			sendEntityDialogue(
					SEND_2_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"Why, of course! Basically, and I will explain so that",
							"you understand it correctly," }, IS_NPC, npcId,
					9827);
		} else if (stage == 3) {
			stage = 4;
			sendEntityDialogue(
					SEND_2_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"I use my secret magical technique to melt your body down",
							"into a puddle of its elements" }, IS_NPC, npcId,
					9827);

		} else if (stage == 4) {
			stage = 5;
			sendEntityDialogue(
					SEND_2_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"When I have broken down all components of your body, I",
							"then rebuilt it into the form I am thinking of." },
					IS_NPC, npcId, 9827);

		} else if (stage == 5) {
			stage = 6;
			sendEntityDialogue(
					SEND_1_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"Or, you know, something vaguely close enough, anyway." },
					IS_NPC, npcId, 9827);
		} else if (stage == 6) {
			stage = 7;
			sendEntityDialogue(
					SEND_1_TEXT_CHAT,
					new String[] { player.getDisplayName(),
							"Uh... that doesn't sound particualry safe to me." },
					IS_PLAYER, player.getIndex(), 9827);
		} else if (stage == 7) {
			stage = 8;
			sendEntityDialogue(
					SEND_2_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"It's as safe as houses. Why, I have only had thirty-six",
							"major accidents this month!" }, IS_NPC, npcId,
					9827);

		} else if (stage == 8) {
			stage = 9;
			sendEntityDialogue(SEND_1_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"So what do you say? Feel like a change?" },
					IS_NPC, npcId, 9827);
		} else if (stage == 9) {
			stage = 10;
			sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "Sure do it.",
					"No thanks.");
		} else if (stage == 10) {
			if (componentId == 1) {
				stage = 11;
				sendEntityDialogue(
						SEND_1_TEXT_CHAT,
						new String[] { player.getDisplayName(), "Sure, do it." },
						IS_PLAYER, player.getIndex(), 9827);
			} else {
				stage = 13;
				sendEntityDialogue(SEND_1_TEXT_CHAT,
						new String[] { player.getDisplayName(),
								"No thanks. I'm happy as Saradomin made me." },
						IS_PLAYER, player.getIndex(), 9827);
			}
		} else if (stage == 11) {
			stage = 12;
			sendEntityDialogue(
					SEND_3_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"You, of course, agree that if by some accident you are",
							"turned into a frog you have no rights for compensation or",
							"refund." }, IS_NPC, npcId, 9827);
		} else if (stage == 12) {
			PlayerLook.openMageMakeOver(player);
			end();
		} else if (stage == 13) {
			stage = -2;
			sendEntityDialogue(SEND_1_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"Ehhh...suit yourself." }, IS_NPC, npcId, 9827);
		} else if (stage == 14) {
			stage = 15;
			sendEntityDialogue(
					SEND_3_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"No problem, but please remember that the amulet I will",
							"sell you is only a copy of my own. It contains no magical",
							"powers and, as such, it will only cost you 100 coins." },
					IS_NPC, npcId, 9827);
		} else if (stage == 15) {
			stage = 16;
			sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE,
					"Sure, here you go.", "No way! That's too expensive.");
		} else if (stage == 16) {
			if (componentId == 1) {
				if (!player.getInventory().containsItem(995, 100))
					end();
				else {
					stage = 17;
					sendEntityDialogue(SEND_1_TEXT_CHAT,
							new String[] { player.getDisplayName(),
									"Sure, here you go." }, IS_PLAYER,
							player.getIndex(), 9827);
				}
			} else {
				stage = -2;
				sendEntityDialogue(SEND_1_TEXT_CHAT,
						new String[] { player.getDisplayName(),
								"No way! That's too expensive." }, IS_PLAYER,
						player.getIndex(), 9827);
			}
		} else if (stage == 17) {
			stage = 18;
			sendEntityDialogue(SEND_1_TEXT_CHAT, new String[] { "",
					"You receive an amulet in exchange for 100 coins." },
					IS_ITEM, 7803, SEND_NO_EMOTE);
			player.getInventory().deleteItem(995, 100);
			player.getInventory().addItem(7803, 1);
		} else if (stage == 18) {
			stage = 0;
			sendEntityDialogue(
					SEND_2_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"I can alter you physical form if you wish. Would you like",
							" me to perform my magicks on you?" }, IS_NPC,
					npcId, 9827);
		} else if (stage == 19) {
			stage = 20;
			sendEntityDialogue(SEND_1_TEXT_CHAT,
					new String[] { player.getDisplayName(), "What was?" },
					IS_PLAYER, player.getIndex(), 9827);
		} else if (stage == 20) {
			stage = 21;
			sendEntityDialogue(SEND_1_TEXT_CHAT,
					new String[] { player.getDisplayName(),
							"Nothing! It's all fine you seem alive anyway." },
					IS_NPC, npcId, 9827);
		} else if (stage == 21) {
			stage = -2;
			sendEntityDialogue(SEND_1_TEXT_CHAT,
					new String[] { player.getDisplayName(),
							"	Uh, thanks, I guess." }, IS_PLAYER,
					player.getIndex(), 9827);
		} else
			end();

	}

	@Override
	public void start() {
		npcId = (Integer) parameters[0];
		int v = (Integer) parameters[1];
		if (v == 0) {
			sendEntityDialogue(
					SEND_3_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"Hello there! I am know as the Makeover Mage! I have",
							"spent many years researching magicks that can change",
							"your physical appearence." }, IS_NPC, npcId, 9827);
		} else if (v == 1) {
			stage = -2;
			sendEntityDialogue(
					SEND_2_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"That is no different from what you already have. I guess I",
							"shouldn't charge you if I'm not changing anything." },
					IS_NPC, npcId, 9827);
		} else if (v == 2) {
			stage = 19;
			sendEntityDialogue(SEND_1_TEXT_CHAT,
					new String[] {
							NPCDefinitions.getNPCDefinitions(npcId).name,
							"Whew! That was lucky." }, IS_NPC, npcId, 9827);
		}
	}

}

redpajama_set_name: RedPajamaGithub


text:
package cache

import "sync"

// LFU holds the Least frequently used cache values
type LFU struct {
	// Mutex is used for handling the concurrent
	// read/write requests for cache
	sync.Mutex

	// cache holds the all cache values
	cache Cache
}

// NewLFU creates a thread-safe LFU cache
func NewLFU(size int) Cache {
	return &LRU{
		cache: NewLFUNoTS(size),
	}
}

// Get returns the value of a given key if it exists, every get item will be
// increased for every usage
func (l *LFU) Get(key string) (interface{}, error) {
	l.Lock()
	defer l.Unlock()

	return l.cache.Get(key)
}

// Set sets or overrides the given key with the given value, every set item will
// be increased as usage.
// when the cache is full, least frequently used items will be evicted from
// linked list
func (l *LFU) Set(key string, val interface{}) error {
	l.Lock()
	defer l.Unlock()

	return l.cache.Set(key, val)
}

// Delete deletes the given key-value pair from cache, this function doesnt
// return an error if item is not in the cache
func (l *LFU) Delete(key string) error {
	l.Lock()
	defer l.Unlock()

	return l.cache.Delete(key)
}


text:
package org.jvyamlb;

/**
 * @author Ola Bini
 */
class SimpleKey {
    private int tokenNumber;
    private boolean required;
    private int index;
    private int line;
    private int column;

    public SimpleKey(final int tokenNumber, final boolean required, final int index, final int line, final int column) {
        this.tokenNumber = tokenNumber;
        this.required = required;
        this.index = index;
        this.line = line;
        this.column = column;
    }

    public boolean isRequired() {
        return required;
    }

    public int getTokenNumber() {
        return this.tokenNumber;
    }

    public int getColumn() {
        return this.column;
    }

    public Position getPosition() {
        return new Position(line, column, index);
    }
}// SimpleKey


text:
module.exports = function(config) {
    config.set({
        basePath: '../',

        files: [
            'source/chnNumConverter.js',
            'test/unit/**/*.js'
        ],
        logLevel: 'info',

        exclude: [],

        autoWatch: true,

        frameworks: ['jasmine', 'sinon'],

        //browsers: ['PhantomJS', 'Chrome_without_security'],
        browsers: ['Chrome_without_security'],
        // you can define custom flags
        customLaunchers: {
            'PhantomJS_custom': {
                base: 'PhantomJS',
                options: {
                    windowName: 'my-window',
                    settings: {
                        webSecurityEnabled: false
                    }
                }
                /*,
                flags: ['--remote-debugger-port=9000']*/
            },
            Chrome_without_security: {
                base: 'Chrome',
                flags: ['--disable-web-security']
            }
        },
        plugins: [
            'karma-junit-reporter',
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-jasmine',
            'karma-sinon',
            'karma-coverage',
            'karma-phantomjs-launcher'
        ],

        junitReporter: {
            outputFile: 'test_out/unit.xml',
            suite: 'unit'
        },
        reporters: ['progress', 'coverage', 'junit'],
        preprocessors: {
            // source files, that you wanna generate coverage for
            // do not include tests or libraries
            // (these files will be instrumented by Istanbul)
            'source/*.js': ['coverage']
        },

        // optionally, configure the reporter
        coverageReporter: {
            type: 'html',
            dir: 'coverage/'
        }

    })
}


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* DatabaseInfoCommand.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using System;
using System.Text;
using System.Linq;

using AM;
using AM.Text;

using ManagedIrbis;

using Telegram.Bot;
using Telegram.Bot.Types;

#endregion

// ReSharper disable CommentTypo
// ReSharper disable IdentifierTypo
// ReSharper disable StringLiteralTypo

namespace CatBoy.Commands
{
    /// <summary>
    /// Информация о базе данных.
    /// </summary>
    class DatabaseInfoCommand
        : BotCommand
    {
        /// <inheritdoc />
        public override string Name => "info";

        /// <inheritdoc />
        public override string Description => "Информация о базе данных";

        /// <summary>
        /// Describe the database.
        /// </summary>
        public static string Describe(DatabaseInfo db)
        {
            StringBuilder result = new StringBuilder();

            result.AppendFormat("БД: {0}", db.Name.ToVisibleString());
            result.AppendLine();

            if (!string.IsNullOrEmpty(db.Description))
            {
                result.AppendFormat("Описание: {0}",
                    db.Description.ToVisibleString());
                result.AppendLine();
            }

            if (!ReferenceEquals(db.LogicallyDeletedRecords, null)
                && db.LogicallyDeletedRecords.Length != 0)
            {
                result.Append("Логически удалённые записи: ");
                result.Append(db.LogicallyDeletedRecords.Length.ToString());
                result.AppendLine(" шт.");
            }

            if (!ReferenceEquals(db.PhysicallyDeletedRecords, null)
                && db.PhysicallyDeletedRecords.Length != 0)
            {
                result.Append("Физически удалённые записи: ");
                result.Append(db.PhysicallyDeletedRecords.Length.ToString());
                result.AppendLine(" шт.");
            }

            if (!ReferenceEquals(db.NonActualizedRecords, null)
                && db.NonActualizedRecords.Length != 0)
            {
                result.Append("Неактуализированные записи: ");
                result.AppendLine
                    (NumericUtility.CompressRange(db.NonActualizedRecords));
            }

            if (!ReferenceEquals(db.LockedRecords, null)
                && db.LockedRecords.Length != 0)
            {
                result.Append("Заблокированные записи: ");
                result.AppendLine
                    (NumericUtility.CompressRange(db.LockedRecords));
            }

            result.AppendFormat("Макс. MFN: {0}", db.MaxMfn);
            result.AppendLine();

            result.AppendFormat("Только для чтения: {0}", db.ReadOnly);
            result.AppendLine();

            result.AppendFormat("Блокировка БД в целом: {0}", db.DatabaseLocked);
            result.AppendLine();

            return result.ToString();
        }

        /// <inheritdoc />
        public override void Execute(Message message, TelegramBotClient client)
        {
            if (Filter(message, client))
            {
                return;
            }

            var chatId = message.Chat.Id;
            var text = GetCommandText(message);

            var navigator = new TextNavigator(text);
            var dbname = navigator.ReadWord();
            if (string.IsNullOrEmpty(dbname))
            {
                client.SendTextMessageAsync(chatId, "Не задано имя базы данных");
                return;
            }

            try
            {
                using (var irbis = GetConnection())
                {
                    var dbinfo = irbis.GetDatabaseInfo(dbname);
                    client.SendTextMessageAsync(chatId, Describe(dbinfo)).Wait();
                }
            }
            catch (Exception exception)
            {
                client.SendTextMessageAsync(chatId, exception.Message).Wait();
            }
        }
    }
}


text:
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;

namespace ProjectModels
{
    /// <summary>
    /// Manipulate a packages.config file.
    /// </summary>
    public class PackagesConfig
    {
        /// <summary>
        /// packages.config path.
        /// </summary>
        public string Path { get; }

        public PackagesConfig(string confitPath)
        {
            Path = confitPath;
        }

        /// <summary>
        /// Package infomations from a packages.config file.
        /// </summary>
        /// <param name="packagesPath"></param>
        /// <returns></returns>
        public IEnumerable<Package> Packages => _packages ?? (_packages = GetPackages());
        private IEnumerable<Package> _packages;

        private IEnumerable<Package> GetPackages()
        {
            var doc = XDocument.Load(Path);
            var items = doc.Root.Elements("package");
            var packages = items.Select(x => new Package((string)x.Attribute("id"), (string)x.Attribute("version")));
            return packages;
        }
    }
}


text:
package test.eu.homan.algorithms.capstone.algorithm;

import eu.homan.algorithms.capstone.algorithm.InformationFlow;
import eu.homan.algorithms.capstone.graph.CapstoneGraph;
import eu.homan.algorithms.capstone.graph.Graph;
import eu.homan.algorithms.capstone.util.GraphLoader;
import org.junit.Assert;
import org.junit.Test;

import java.util.HashSet;
import java.util.Set;

public class InformationFlowTest {

    @Test
    public void testSingleSourceEqualPrize() {

        final Graph<Integer> graph = loadTestGraph();
        final Set<Integer> sources = new HashSet<Integer>() {{
            add(3);
        }};
        final InformationFlow<Integer> informationFlow = new InformationFlow<>(graph, 1, 1, sources);

        final Set<Integer> expectedToSwitch = new HashSet<Integer>() {{
            add(3);
        }};

        Assert.assertTrue(informationFlow.reachedEquilibrium());
        Assert.assertEquals(expectedToSwitch, informationFlow.switched());
    }

    @Test
    public void testTwoSourcesEqualPrize() {
        final Graph<Integer> graph = loadTestGraph();
        final Set<Integer> sources = new HashSet<Integer>() {{
            add(3);
            add(7);
        }};
        final InformationFlow<Integer> informationFlow = new InformationFlow<>(graph, 1, 1, sources);

        final Set<Integer> expectedToSwitch = new HashSet<Integer>() {{
            add(3);
            add(4);
            add(6);
            add(7);
        }};

        Assert.assertTrue(informationFlow.reachedEquilibrium());
        Assert.assertEquals(expectedToSwitch, informationFlow.switched());
    }

    @Test
    public void testSingleSourceBiggerPrizeToSwitch() {
        final Graph<Integer> graph = loadTestGraph();
        final Set<Integer> sources = new HashSet<Integer>() {{
            add(3);
        }};
        final InformationFlow<Integer> informationFlow = new InformationFlow<>(graph, 3, 1, sources);

        final Set<Integer> expectedToSwitch = new HashSet<Integer>() {{
            add(1);
            add(2);
            add(3);
            add(4);
            add(5);
            add(6);
            add(7);
        }};

        Assert.assertTrue(informationFlow.reachedEquilibrium());
        Assert.assertEquals(expectedToSwitch, informationFlow.switched());
    }

    @Test
    public void testAnalyseFacebook1000With100InitialA3B1() {
        analyse("Facebook 1000 graph", "./data/facebook_1000.txt", 100, 3, 1);
    }

    @Test
    public void testAnalyseFacebook1000With1InitialA3B1() {
        analyse("Facebook 1000 graph", "./data/facebook_1000.txt", 1, 3, 1);
    }

    @Test
    public void testAnalyseFacebook1000With100InitialA1B1() {
        analyse("Facebook 1000 graph", "./data/facebook_1000.txt", 100, 1, 1);
    }

    @Test
    public void testAnalyseFacebook1000With1InitialA1B1() {
        analyse("Facebook 1000 graph", "./data/facebook_1000.txt", 1, 1, 1);
    }

    @Test
    public void testAnalyseFacebook2000With100InitialA3B1() {
        analyse("Facebook 2000 graph", "./data/facebook_2000.txt", 100, 3, 1);
    }

    @Test
    public void testAnalyseFacebook2000With1InitialA3B1() {
        analyse("Facebook 2000 graph", "./data/facebook_2000.txt", 1, 3, 1);
    }

    @Test
    public void testAnalyseFacebook2000With100InitialA1B1() {
        analyse("Facebook 2000 graph", "./data/facebook_2000.txt", 100, 1, 1);
    }

    @Test
    public void testAnalyseFacebook2000With1InitialA1B1() {
        analyse("Facebook 2000 graph", "./data/facebook_2000.txt", 1, 1, 1);
    }

    @Test
    public void testAnalyseFacebookUcsdWith100InitialA3B1() {
        analyse("Facebook UCSD graph", "./data/facebook_ucsd.txt", 100, 3, 1);
    }

    @Test
    public void testAnalyseFacebookUcsdWith1InitialA3B1() {
        analyse("Facebook UCSD graph", "./data/facebook_ucsd.txt", 1, 3, 1);
    }

    @Test
    public void testAnalyseFacebookUcsdWith100InitialA1B1() {
        analyse("Facebook UCSD graph", "./data/facebook_ucsd.txt", 100, 1, 1);
    }

    @Test
    public void testAnalyseFacebookUcsdWith1InitialA1B1() {
        analyse("Facebook UCSD graph", "./data/facebook_ucsd.txt", 1, 1, 1);
    }

    private Graph<Integer> loadTestGraph() {
        final Graph<Integer> graph = new CapstoneGraph<>();
        GraphLoader.loadUndirectedGraph(graph, "./data/test_information_flow.txt");
        return graph;
    }

    private void analyse(final String graphName,
                         final String graphFile,
                         final int numberOfSources,
                         final int a,
                         final int b) {
        System.out.println("Analysing " + graphName);
        final Graph<Integer> graph = new CapstoneGraph<>();
        GraphLoader.loadUndirectedGraph(graph, graphFile);

        System.out.println(String.format("Graph has %d vertices and %d edges", graph.v(), graph.e()));
        System.out.println(String.format("Number of sources: %d, a: %d, b: %d", numberOfSources, a, b));

        final Set<Integer> sources = new HashSet<>();
        int numberOfAdded = 0;
        for (int vertex : graph) {
            sources.add(vertex);
            numberOfAdded++;

            if (numberOfAdded >= numberOfSources) {
                break;
            }
        }

        final long startTime = System.currentTimeMillis();
        final InformationFlow<Integer> informationFlow = new InformationFlow<>(graph, a, b, sources);
        final long endTime = System.currentTimeMillis();

        System.out.println(String.format("Information flow calculated in %d millis", (endTime - startTime)));
        if (informationFlow.reachedEquilibrium()) {
            System.out.println("Information flow has reached the equilibrium");
        } else {
            System.out.println("Information flow has not reached the equilibrium");
        }
        System.out.println(String.format("%d nodes have switched\n", informationFlow.switched().size()));
    }
}


text:
'use strict'

var _ = require('lodash'),
  hooks = require('../test-helper/drop-create-hooks'),
  should = require('should'),
  async = require('async'),
  models = require('../test-helper/models'),
  SimpleModel = models.Simple,
  ScopedModel = models.Scoped,
  AdvancedScopedModel = models.AdvancedScoped

describe('Twice Edit Test', function() {
  hooks()

  it('#should not update slug when slug is not edited on simple model', function(done) {
    var id

    async.series(
      [
        // Add
        function(next) {
          new SimpleModel({
            name: 'Sponge Bob',
            foo: 'Gary'
          }).save(function(err, doc) {
            doc.slug.should.equal('sponge-bob')
            doc.slugs.length.should.equal(0)
            doc.foo.should.equal('Gary')
            id = doc.id
            next(err)
          })
        },

        // Edit foo
        function(next) {
          SimpleModel.findById(id, function(err, model) {
            model.foo = 'Patrick'
            model.save(function(err, doc) {
              doc.slug.should.equal('sponge-bob')
              doc.slugs.length.should.equal(0)
              doc.foo.should.equal('Patrick')
              next(err)
            })
          })
        },

        // Edit foo again...
        function(next) {
          SimpleModel.findById(id, function(err, model) {
            model.foo = 'Lary'
            model.save(function(err, doc) {
              doc.slug.should.equal('sponge-bob')
              doc.slugs.length.should.equal(0)
              doc.foo.should.equal('Lary')
              next(err)
            })
          })
        },

        // Edit name!!!
        function(next) {
          SimpleModel.findById(id, function(err, model) {
            model.name = 'Squidward'
            model.save(function(err, doc) {
              doc.slug.should.equal('squidward')
              doc.slugs.length.should.equal(1)
              doc.foo.should.equal('Lary')
              next(err)
            })
          })
        }
      ],
      done
    )
  })

  it('#should not update slug when slug is not edited on scoped model', function(done) {
    var id

    async.series(
      [
        // Add
        function(next) {
          new ScopedModel({
            name: 'Sponge Bob',
            owner: 'Me',
            foo: 'Gary'
          }).save(function(err, doc) {
            doc.slug.should.equal('sponge-bob')
            doc.slugs.length.should.equal(0)
            doc.foo.should.equal('Gary')
            id = doc.id
            next(err)
          })
        },

        // Edit foo
        function(next) {
          ScopedModel.findById(id, function(err, model) {
            model.foo = 'Patrick'
            model.save(function(err, doc) {
              doc.slug.should.equal('sponge-bob')
              doc.slugs.length.should.equal(0)
              doc.foo.should.equal('Patrick')
              next(err)
            })
          })
        },

        // Edit foo again...
        function(next) {
          ScopedModel.findById(id, function(err, model) {
            model.foo = 'Lary'
            model.save(function(err, doc) {
              doc.slug.should.equal('sponge-bob')
              doc.slugs.length.should.equal(0)
              doc.foo.should.equal('Lary')
              next(err)
            })
          })
        },

        // Edit name!!!
        function(next) {
          ScopedModel.findById(id, function(err, model) {
            model.name = 'Squidward'
            model.save(function(err, doc) {
              doc.slug.should.equal('squidward')
              doc.slugs.length.should.equal(1)
              doc.foo.should.equal('Lary')
              next(err)
            })
          })
        }
      ],
      done
    )
  })

  it('#should not update slug when slug is not edited on advanced scoped model', function(done) {
    var id, ownerId

    async.series(
      [
        // Create Owner
        function(next) {
          new SimpleModel({
            name: 'Mr. Krabs'
          }).save(function(err, doc) {
            doc.slug.should.equal('mr-krabs')
            ownerId = doc.id
            next(err)
          })
        },

        // Add
        function(next) {
          new AdvancedScopedModel({
            name: 'Sponge Bob',
            owner: ownerId,
            foo: 'Gary'
          }).save(function(err, doc) {
            doc.slug.should.equal('sponge-bob')
            doc.slugs.length.should.equal(0)
            doc.foo.should.equal('Gary')
            id = doc.id
            next(err)
          })
        },

        // Edit foo
        function(next) {
          AdvancedScopedModel.findById(id, function(err, model) {
            model.foo = 'Patrick'
            model.save(function(err, doc) {
              doc.slug.should.equal('sponge-bob')
              doc.slugs.length.should.equal(0)
              doc.foo.should.equal('Patrick')
              next(err)
            })
          })
        },

        // Edit foo again...
        function(next) {
          AdvancedScopedModel.findById(id, function(err, model) {
            model.foo = 'Lary'
            model.save(function(err, doc) {
              doc.slug.should.equal('sponge-bob')
              doc.slugs.length.should.equal(0)
              doc.foo.should.equal('Lary')
              next(err)
            })
          })
        },

        // Create Other Owner
        function(next) {
          new SimpleModel({
            name: 'Mrs. Puff'
          }).save(function(err, doc) {
            doc.slug.should.equal('mrs-puff')
            ownerId = doc.id
            next(err)
          })
        },

        // Edit owner!!!
        function(next) {
          AdvancedScopedModel.findById(id, function(err, model) {
            model.owner = ownerId
            model.save(function(err, doc) {
              doc.slug.should.equal('sponge-bob')
              doc.slugs.length.should.equal(1)
              doc.foo.should.equal('Lary')
              next(err)
            })
          })
        }
      ],
      done
    )
  })
})


text:
package Manager;

import Utils.Type;
import Ident.Ident;
import Ident.IdentVar;
import Core.Mittelwerk;
import Emitter.Instruction.I_Simple;

public class VariableManager{
	private String current_dcl;
	private Type current_type;

	public VariableManager(){
	}

	public void memorizeType(Type t){
		this.current_dcl = "\t" + t + " ";

		this.current_type = t;
	}

    /**
     * I should do some checks, later
     *
     * @param n
     */
	public void newVar(String n){
		this.current_dcl += n;
		Mittelwerk.i_m.addLocal(n, this.buildIdVar(n));
	}

	public void newVar2(String n){
		this.current_dcl += ", ";
		this.newVar(n);
	}

	private Ident buildIdVar(String n){
		return new IdentVar(n, this.current_type);
	}

	public void commitDcl(){
		this.current_dcl += ";\n";
		Mittelwerk.e.add(new I_Simple(this.current_dcl));
	}
}


text:
var yaml = require('js-yaml');

// Define our grunt file
module.exports = function (grunt) {
  // Configure the spritesheet
  grunt.initConfig({
    sprite: {
      spritesheet: {
        src: ['fork.png', 'github.png', 'twitter.png'],
        dest: 'spritesheet.png',
        destCss: 'spritesheet.styl',
        algorithm: 'binary-tree'
      },
      algorithm: {
        src: ['fork.png', 'github.png', 'twitter.png'],
        dest: 'spritesheet.algorithm.png',
        destCss: 'spritesheet.algorithm.styl',
        algorithm: 'alt-diagonal'
      },
      engine: {
        src: ['fork.png', 'github.png', 'twitter.png'],
        dest: 'spritesheet.engine.png',
        destCss: 'spritesheet.engine.styl',
        engine: 'gmsmith'
      },
      padding: {
        src: ['fork.png', 'github.png', 'twitter.png'],
        dest: 'spritesheet.padding.png',
        destCss: 'spritesheet.padding.styl',
        padding: 20 // Exaggerated for visibility, normal usage is 1 or 2
      },
      retina: {
        // We have `fork.png`, `fork@2x.png`, ...
        src: ['fork*.png', 'github*.png', 'twitter*.png'],
        // This will filter out `fork@2x.png`, `github@2x.png`, ... for our retina spritesheet
        //   The normal spritesheet will now receive `fork.png`, `github.png`, ...
        retinaSrcFilter: ['*@2x.png'],
        dest: 'spritesheet.retina.png',
        retinaDest: 'spritesheet.retina@2x.png',
        destCss: 'spritesheet.retina.styl'
      },
      cssVarMap: {
        src: ['fork.png', 'github.png', 'twitter.png'],
        dest: 'spritesheet.cssVarMap.png',
        destCss: 'spritesheet.cssVarMap.styl',
        cssVarMap: function (sprite) {
          sprite.name = 'sprite_' + sprite.name;
        }
      },
      handlebarsStr: {
        src: ['fork.png', 'github.png', 'twitter.png'],
        dest: 'spritesheet.handlebarsStr.png',
        destCss: 'spritesheet.handlebarsStr.css',
        cssTemplate: __dirname + '/handlebarsStr.css.handlebars'
      },
      handlebarsInheritance: {
        src: ['fork.png', 'github.png', 'twitter.png'],
        dest: 'spritesheet.handlebarsInheritance.png',
        destCss: 'spritesheet.handlebarsInheritance.scss',
        cssTemplate: 'handlebarsInheritance.scss.handlebars'
      },
      yamlTemplate: {
        src: ['fork.png', 'github.png', 'twitter.png'],
        dest: 'spritesheet.yamlTemplate.png',
        destCss: 'spritesheet.yamlTemplate.yml',
        cssTemplate: function (data) {
          // Convert sprites from an array into an object
          var spriteObj = {};
          data.sprites.forEach(function (sprite) {
            // Grab the name and store the sprite under it
            var name = sprite.name;
            spriteObj[name] = sprite;

            // Delete the name from the sprite
            delete sprite.name;
          });

          // Return stringified spriteObj
          return yaml.safeDump(spriteObj);
        }
      }
    }
  });

  // Load in grunt-spritesmith
  grunt.loadTasks('../tasks');

  // Run the sprite task by default
  grunt.registerTask('default', ['sprite']);
};


text:
require File.dirname(__FILE__) + '/../spec_helper'

describe CommentsHelper do
  it "handles line breaks properly" do
    comment = Factory.build(:comment, :content => "foo\nbar\n\nbaz", :legacy => true)
    helper.format_comment(comment).should eq("
foo\n
bar
\n\n
baz
")
  end

  it "escapes html" do
    comment = Factory.build(:comment, :content => "<foo>", :legacy => true)
    helper.format_comment(comment).should eq("
<foo>
")
  end

  it "uses   for spaces at beginning of lines" do
    comment = Factory.build(:comment, :content => "  foo bar", :legacy => true)
    helper.format_comment(comment).should eq("
  foo bar
")
  end

  it "uses markdown for non-legacy comments" do
    comment = Factory.build(:comment, :content => "**foo**", :legacy => false)
    helper.format_comment(comment).strip.should eq("
foo
")
  end

  it "adds http protocol to url if it doesn't exist" do
    helper.fix_url("foo.com").should eq("http://foo.com")
    helper.fix_url("http://foo.com").should eq("http://foo.com")
    helper.fix_url("https://foo.com").should eq("https://foo.com")
    helper.fix_url("javascript:foo").should eq("http://javascript:foo")
  end
end


text:
package org.apache.solr.client.solrj.io.eval;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.apache.commons.math3.random.EmpiricalDistribution;
import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
import org.apache.solr.client.solrj.io.Tuple;
import org.apache.solr.client.solrj.io.stream.expr.StreamExpression;
import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;

public class HistogramEvaluator extends RecursiveNumericEvaluator implements ManyValueWorker {
  protected static final long serialVersionUID = 1L;

  public HistogramEvaluator(StreamExpression expression, StreamFactory factory) throws IOException {
    super(expression, factory);

    if (containedEvaluators.size() < 1) {
      throw new IOException(
          String.format(
              Locale.ROOT,
              "Invalid expression %s - expecting at least one value but found %d",
              expression,
              containedEvaluators.size()));
    }
  }

  @Override
  public Object doWork(Object... values) throws IOException {
    if (Arrays.stream(values).anyMatch(item -> null == item)) {
      return null;
    }

    List<?> sourceValues;
    Integer bins = 10;

    if (values.length >= 1) {
      sourceValues = values[0] instanceof List<?> ? (List<?>) values[0] : Arrays.asList(values[0]);

      if (values.length >= 2) {
        if (values[1] instanceof Number) {
          bins = ((Number) values[1]).intValue();
        } else {
          throw new IOException(
              String.format(
                  Locale.ROOT,
                  "Invalid expression %s - if second parameter is provided then it must be a valid number but found %s instead",
                  toExpression(constructingFactory),
                  values[1].getClass().getSimpleName()));
        }
      }
    } else {
      throw new IOException(
          String.format(
              Locale.ROOT,
              "Invalid expression %s - expecting at least one value but found %d",
              toExpression(constructingFactory),
              containedEvaluators.size()));
    }

    EmpiricalDistribution distribution = new EmpiricalDistribution(bins);
    distribution.load(
        ((List<?>) sourceValues)
            .stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());
    ;

    List<Tuple> histogramBins = new ArrayList<>();
    for (SummaryStatistics binSummary : distribution.getBinStats()) {
      Tuple tuple = new Tuple();
      tuple.put("max", binSummary.getMax());
      tuple.put("mean", binSummary.getMean());
      tuple.put("min", binSummary.getMin());
      tuple.put("stdev", binSummary.getStandardDeviation());
      tuple.put("sum", binSummary.getSum());
      tuple.put("N", binSummary.getN());
      tuple.put("var", binSummary.getVariance());
      tuple.put("cumProb", distribution.cumulativeProbability(binSummary.getMean()));
      tuple.put("prob", distribution.probability(binSummary.getMin(), binSummary.getMax()));
      histogramBins.add(tuple);
    }

    return histogramBins;
  }
}


text:
package com.subgraph.orchid.crypto;

import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;

import com.subgraph.orchid.TorException;

public class TorPrivateKey {

	static public TorPrivateKey generateNewKeypair() {
		KeyPairGenerator generator = createGenerator();
		generator.initialize(1024, new SecureRandom());
		KeyPair pair = generator.generateKeyPair();
		return new TorPrivateKey((RSAPrivateKey)pair.getPrivate(), (RSAPublicKey)pair.getPublic());
	}

	static KeyPairGenerator createGenerator() {
		try {
			return KeyPairGenerator.getInstance("RSA");
		} catch (NoSuchAlgorithmException e) {
			throw new TorException(e);
		}
	}

	private final TorPublicKey publicKey;
	private final RSAPrivateKey privateKey;

	TorPrivateKey(RSAPrivateKey privateKey, RSAPublicKey publicKey) {
		this.privateKey = privateKey;
		this.publicKey = new TorPublicKey(publicKey);
	}

	public TorPublicKey getPublicKey() {
		return publicKey;
	}

	public RSAPublicKey getRSAPublicKey() {
		return publicKey.getRSAPublicKey();
	}

	public RSAPrivateKey getRSAPrivateKey() {
		return privateKey;
	}
}


text:
set(CMAKE_DEPENDS_LANGUAGES
  "CXX"
  )
# The set of files for implicit dependencies of each language:
set(CMAKE_DEPENDS_CHECK_CXX
  "/db/storage/Development/Projects/Trinity/Switch/ext/FastPFor/src/csv2maropu.cpp" "/db/storage/Development/Projects/Trinity/Switch/ext/FastPFor/CMakeFiles/csv2maropu.dir/src/csv2maropu.cpp.o"
  )
set(CMAKE_CXX_COMPILER_ID "Clang")

# The include file search paths:
set(CMAKE_CXX_TARGET_INCLUDE_PATH
  "headers"
  )

# Targets to which this target links.
set(CMAKE_TARGET_LINKED_INFO_FILES
  )

# Fortran module output directory.
set(CMAKE_Fortran_TARGET_MODULE_DIR "")


text:
Release 0.9.13
==============

CLI changes
---------------

* Added ``--max-task-threads`` to the ``run`` subcommand. When this option is set, local-mode execution limits number of max running tasks as like ``digdag server --max-task-threads`` option. (@gfx++)

* Fixed wrong time formatting when the time is past. (@akirakw++)

Operator Changes
----------------

* ``http>`` operator supports ``timeout: SECONDS`` option. (@duck8823++)

General Changes
---------------

* Let operator plugins inject CommandLogger instance. This is useful to copy log messages displayed by a subprocess to task logs. (@akirakw++)

* Added config.td.default_endpoint system configuration which sets the default td.endpoint parameter for Treasure Data operators.

UI Changes
---------------

* Improved next-run time format to include a duration until the time (@szyn++)

* Added success/warning/error messages when editing a workflow definition (@szyn++)

Release Date
------------
2017-07-18

Contributors
------------------
* Akira KAWAGUCHI
* Akira Koyasu
* FUJI Goro (gfx)
* Hiroyuki Sato
* KAWACHI Takashi
* Mitsunori Komatsu
* Sadayuki Furuhashi
* Shota Suzuki
* Shunsuke Maeda
* Takehiro Shiozaki
* Toru Takahashi
* Yoichi Nakayama
* shio-phys
* shunsuke maeda
* uu59


text:
/*
Copyright 1999 CERN - European Organization for Nuclear Research.
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose
is hereby granted without fee, provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear in supporting documentation.
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
package org.apache.mahout.math;

/**
 * This empty class is the common root for all persistent capable classes.
 * If this class inherits from <tt>java.lang.Object</tt> then all subclasses are serializable with the standard Java serialization mechanism.
 * If this class inherits from <tt>com.objy.db.app.ooObj</tt> then all subclasses are <i>additionally</i> serializable with the Objectivity ODBMS persistance mechanism.
 * Thus, by modifying the inheritance of this class the entire tree of subclasses can be switched to Objectivity compatibility (and back) with minimum effort.
 */
public abstract class PersistentObject implements java.io.Serializable, Cloneable {

  /** Not yet commented. */
  protected PersistentObject() {
  }

  /**
   * Returns a copy of the receiver. This default implementation does not nothing except making the otherwise
   * <tt>protected</tt> clone method <tt>public</tt>.
   *
   * @return a copy of the receiver.
   */
  @Override
  public Object clone() {
    try {
      return super.clone();
    } catch (CloneNotSupportedException exc) {
      throw new InternalError(); //should never happen since we are cloneable
    }
  }
}