text:
package io.netty.handler.ssl;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import org.apache.tomcat.jni.SSL;
import org.apache.tomcat.jni.SSLContext;

import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509ExtendedTrustManager;
import javax.net.ssl.X509TrustManager;
import javax.security.auth.x500.X500Principal;
import java.io.File;
import java.io.IOException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

/**
 * A client-side {@link SslContext} which uses OpenSSL's SSL/TLS implementation.
 */
public final class OpenSslClientContext extends OpenSslContext {
    private final OpenSslSessionContext sessionContext;
    private final OpenSslEngineMap engineMap;

    /**
     * Creates a new instance.
     */
    public OpenSslClientContext() throws SSLException {
        this(null, null, null, null, 0, 0);
    }

    /**
     * Creates a new instance.
     *
     * @param certChainFile an X.509 certificate chain file in PEM format.
     *                      {@code null} to use the system default
     */
    public OpenSslClientContext(File certChainFile) throws SSLException {
        this(certChainFile, null);
    }

    /**
     * Creates a new instance.
     *
     * @param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s
     *                            that verifies the certificates sent from servers.
     *                            {@code null} to use the default.
     */
    public OpenSslClientContext(TrustManagerFactory trustManagerFactory) throws SSLException {
        this(null, trustManagerFactory);
    }

    /**
     * Creates a new instance.
     *
     * @param certChainFile an X.509 certificate chain file in PEM format.
     *                      {@code null} to use the system default
     * @param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s
     *                            that verifies the certificates sent from servers.
     *                            {@code null} to use the default.
     */
    public OpenSslClientContext(File certChainFile, TrustManagerFactory trustManagerFactory) throws SSLException {
        this(certChainFile, trustManagerFactory, null, null, 0, 0);
    }

    /**
     * Creates a new instance.
     *
     * @param certChainFile an X.509 certificate chain file in PEM format
     * @param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s
     *                            that verifies the certificates sent from servers.
     *                            {@code null} to use the default..
     * @param ciphers the cipher suites to enable, in the order of preference.
     *                {@code null} to use the default cipher suites.
     * @param apn Provides a means to configure parameters related to application protocol negotiation.
     * @param sessionCacheSize the size of the cache used for storing SSL session objects.
     *                         {@code 0} to use the default value.
     * @param sessionTimeout the timeout for the cached SSL session objects, in seconds.
     *                       {@code 0} to use the default value.
     */
    public OpenSslClientContext(File certChainFile, TrustManagerFactory trustManagerFactory, Iterable<String> ciphers,
                                ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout)
            throws SSLException {
        super(ciphers, apn, sessionCacheSize, sessionTimeout, SSL.SSL_MODE_CLIENT);
        boolean success = false;
        try {
            if (certChainFile != null && !certChainFile.isFile()) {
                throw new IllegalArgumentException("certChainFile is not a file: " + certChainFile);
            }

            synchronized (OpenSslContext.class) {
                if (certChainFile != null) {
                    /* Load the certificate chain. We must skip the first cert when server mode */
                    if (!SSLContext.setCertificateChainFile(ctx, certChainFile.getPath(), true)) {
                        long error = SSL.getLastErrorNumber();
                        if (OpenSsl.isError(error)) {
                            throw new SSLException(
                                    "failed to set certificate chain: "
                                            + certChainFile + " (" + SSL.getErrorString(error) + ')');
                        }
                    }
                }
                SSLContext.setVerify(ctx, SSL.SSL_VERIFY_NONE, VERIFY_DEPTH);

                try {
                    // Set up trust manager factory to use our key store.
                    if (trustManagerFactory == null) {
                        trustManagerFactory = TrustManagerFactory.getInstance(
                                TrustManagerFactory.getDefaultAlgorithm());
                    }
                    initTrustManagerFactory(certChainFile, trustManagerFactory);
                    final X509TrustManager manager = chooseTrustManager(trustManagerFactory.getTrustManagers());

                    engineMap = newEngineMap(manager);

                    // Use this to prevent an error when running on java < 7
                    if (useExtendedTrustManager(manager)) {
                        final X509ExtendedTrustManager extendedManager = (X509ExtendedTrustManager) manager;
                        SSLContext.setCertVerifyCallback(ctx, new AbstractCertificateVerifier() {
                            @Override
                            void verify(long ssl, X509Certificate[] peerCerts, String auth) throws Exception {
                                OpenSslEngine engine = engineMap.remove(ssl);
                                extendedManager.checkServerTrusted(peerCerts, auth, engine);
                            }
                        });
                    } else {
                        SSLContext.setCertVerifyCallback(ctx, new AbstractCertificateVerifier() {
                            @Override
                            void verify(long ssl, X509Certificate[] peerCerts, String auth) throws Exception {
                                manager.checkServerTrusted(peerCerts, auth);
                            }
                        });
                    }
                } catch (Exception e) {
                    throw new SSLException("unable to setup trustmanager", e);
                }
            }
            sessionContext = new OpenSslClientSessionContext(ctx);
            success = true;
        } finally {
            if (!success) {
                destroyPools();
            }
        }
    }

    private static void initTrustManagerFactory(File certChainFile, TrustManagerFactory trustManagerFactory)
            throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException {
        KeyStore ks = KeyStore.getInstance("JKS");
        ks.load(null, null);
        if (certChainFile != null) {
            ByteBuf[] certs = PemReader.readCertificates(certChainFile);
            try {
                for (ByteBuf buf: certs) {
                    X509Certificate cert = (X509Certificate) X509_CERT_FACTORY.generateCertificate(
                            new ByteBufInputStream(buf));
                    X500Principal principal = cert.getSubjectX500Principal();
                    ks.setCertificateEntry(principal.getName("RFC2253"), cert);
                }
            } finally {
                for (ByteBuf buf: certs) {
                    buf.release();
                }
            }
        }
        trustManagerFactory.init(ks);
    }

    @Override
    public OpenSslSessionContext sessionContext() {
        return sessionContext;
    }

    @Override
    OpenSslEngineMap engineMap() {
        return engineMap;
    }

    // No cache is currently supported for client side mode.
    private static final class OpenSslClientSessionContext extends OpenSslSessionContext {
        private OpenSslClientSessionContext(long context) {
            super(context);
        }

        @Override
        public void setSessionTimeout(int seconds) {
            if (seconds < 0) {
                throw new IllegalArgumentException();
            }
        }

        @Override
        public int getSessionTimeout() {
            return 0;
        }

        @Override
        public void setSessionCacheSize(int size)  {
            if (size < 0) {
                throw new IllegalArgumentException();
            }
        }

        @Override
        public int getSessionCacheSize() {
            return 0;
        }

        @Override
        public void setSessionCacheEnabled(boolean enabled) {
            // ignored
        }

        @Override
        public boolean isSessionCacheEnabled() {
            return false;
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">

    <diskStore path="/WEB-INF/data/cache"/>
    <defaultCache
            maxElementsInMemory="12"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="false"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />

   	<cache
            name="com.mx.popcorn.domain.City"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.District"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.Province"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.Cinema"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.CinemaComment"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.CinemaGrade"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.Hall"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.Movie"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.MovieComment"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.MovieGrade"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.MovieNew"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.MovieType"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.MovieVersion"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.Region"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.Schedule"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.Seat"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.TicketOrder"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache
            name="com.mx.popcorn.domain.User"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
</ehcache>

redpajama_set_name: RedPajamaGithub


text:
import logging
from typing import Any, Dict, Optional

logger = logging.getLogger(__name__)

class MagicInjectError(ValueError):
    pass

def get_injection_requests(
    type_hints: Dict[str, type], cname: str, component: Optional[Any] = None
) -> Dict[str, type]:
    """
    Given a dict of type hints, filter it to the requested injection types.

    :param type_hints: The type hints to inspect.
    :param cname: The component name.
    :param component: The component if it has been instantiated.
    """
    requests = {}

    for n, inject_type in type_hints.items():
        # If the variable is private ignore it
        if n.startswith("_"):
            continue

        # If the variable has been set, skip it
        if hasattr(component, n):
            continue

        # Check for generic types from the typing module
        origin = getattr(inject_type, "__origin__", None)
        if origin is not None:
            inject_type = origin

        # If the type is not actually a type, give a meaningful error
        if not isinstance(inject_type, type):
            raise TypeError(
                f"Component {cname} has a non-type annotation {n}: {inject_type}\n"
                "Lone non-injection variable annotations are disallowed, did you want to assign a static variable?"
            )

        requests[n] = inject_type

    return requests

def find_injections(
    requests: Dict[str, type], injectables: Dict[str, Any], cname: str
) -> Dict[str, Any]:
    """
    Get a dict of the variables to inject into a given component.

    :param requests: The mapping of requested variables to types,
                     as returned by :func:`get_injection_requests`.
    :param injectables: The available variables to inject.
    :param cname: The name of the component.
    """
    to_inject = {}

    for n, inject_type in requests.items():
        injectable = injectables.get(n)
        if injectable is None:
            # Try prefixing the component name
            injectable = injectables.get(f"{cname}_{n}")

        # Raise error if injectable syntax used but no injectable was found.
        if injectable is None:
            raise MagicInjectError(
                "Component %s has variable %s (type %s), which is absent from robot"
                % (cname, n, inject_type)
            )

        # Raise error if injectable declared with type different than the initial type
        if not isinstance(injectable, inject_type):
            raise MagicInjectError(
                "Component %s variable %s does not match type in robot! (Got %s, expected %s)"
                % (cname, n, type(injectable), inject_type)
            )

        to_inject[n] = injectable
        logger.debug("-> %s.%s = %s", cname, n, injectable)

    return to_inject


text:
package org.wartremover
package contrib.warts

object SomeApply extends WartTraverser {
  def apply(u: WartUniverse): u.Traverser = {
    import u.universe._

    val scala = TermName("scala")
    val some = TermName("Some")
    val app = TermName("apply")

    new u.Traverser {
      override def traverse(tree: Tree): Unit = {
        tree match {
          // Ignore trees marked by SuppressWarnings
          case t if hasWartAnnotation(u)(t) =>

          case Apply(TypeApply(Select(Select(Ident(pkg), obj), method), _), _)
              if pkg == scala && obj == some && method == app =>
            error(u)(tree.pos, "Some.apply is disabled - use Option.apply instead")

          case v =>
            super.traverse(tree)
        }
      }
    }
  }
}


text:
"""
scrapy.tests: this package contains all Scrapy unittests

To run all Scrapy unittests go to Scrapy main dir and type:

    bin/runtests.sh

If you're in windows use runtests.bat instead.
"""

import os

tests_datadir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sample_data')

def get_testdata(*paths):
    """Return test data"""
    path = os.path.join(tests_datadir, *paths)
    return open(path, 'rb').read()


text:
using System.IO;
using System.Runtime.Serialization;
using System.Text;

namespace Microsoft.WindowsAzure.Commands.Sync.Upload
{
    internal class SerializationUtil
    {
        public static T GetObjectFromSerializedString<T>(string data)
        {
            var serializer = new DataContractSerializer(typeof(T));
            using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(data)))
            {
                return (T)serializer.ReadObject(memoryStream);
            }
        }

        public static string GetSerializedString<T>(T localMetaData)
        {
            var serializer = new DataContractSerializer(typeof(T));
            string serializedString;
            using (var memoryStream = new MemoryStream())
            {
                serializer.WriteObject(memoryStream, localMetaData);
                memoryStream.Flush();
                byte[] bytes = memoryStream.ToArray();
                serializedString = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
            }
            return serializedString;
        }
    }
}


text:
using Bridge.Contract;
using ICSharpCode.NRefactory.CSharp;
using System.Collections.Generic;

namespace Bridge.Translator
{
    public class ExpressionBlock : AbstractEmitterBlock
    {
        public ExpressionBlock(IEmitter emitter, ExpressionStatement expressionStatement)
        {
            this.Emitter = emitter;
            this.ExpressionStatement = expressionStatement;
        }

        public ExpressionStatement ExpressionStatement
        {
            get;
            set;
        }

        public override void Emit()
        {
            if (this.ExpressionStatement.IsNull)
            {
                return;
            }

            var oldSemiColon = this.Emitter.EnableSemicolon;

            List<Expression> awaiters = null;

            if (this.Emitter.IsAsync)
            {
                var awaitSearch = new AwaitSearchVisitor();
                this.ExpressionStatement.Expression.AcceptVisitor(awaitSearch);
                awaiters = awaitSearch.GetAwaitExpressions();
            }

            bool isAwaiter = this.ExpressionStatement.Expression is UnaryOperatorExpression && ((UnaryOperatorExpression)this.ExpressionStatement.Expression).Operator == UnaryOperatorType.Await;

            this.ExpressionStatement.Expression.AcceptVisitor(this.Emitter);

            if (this.Emitter.EnableSemicolon && !isAwaiter)
            {
                this.WriteSemiColon(true);
            }

            if (oldSemiColon)
            {
                this.Emitter.EnableSemicolon = true;
            }
        }
    }
}


text:
<!DOCTYPE html>
<html lang="en-us">
  <head>
    <title>https://nikhilvanjani.github.io/post/</title>
    <link rel="canonical" href="https://nikhilvanjani.github.io/post/">
    <meta name="robots" content="noindex">
    <meta charset="utf-8">
    <meta http-equiv="refresh" content="0; url=https://nikhilvanjani.github.io/post/">
  </head>
</html>


text:
package collector

import (
	"runtime"
	"time"
)

// GaugeFunc is an interface that implements the setting of a gauge value
// in a stats system. It should be expected that key will contain multiple
// parts separated by the '.' character in the form used by statsd (e.x.
// "mem.heap.alloc")
type GaugeFunc func(key string, val uint64)

// Collector implements the periodic grabbing of informational data from the
// runtime package and outputting the values to a GaugeFunc.
type Collector struct {
	// PauseDur represents the interval inbetween each set of stats output.
	// Defaults to 10 seconds.
	PauseDur time.Duration

	// EnableCPU determines whether CPU statisics will be output. Defaults to true.
	EnableCPU bool

	// EnableMem determines whether memory statistics will be output. Defaults to true.
	EnableMem bool

	// EnableGC determines whether garbage collection statistics will be output. EnableMem
	// must also be set to true for this to take affect. Defaults to true.
	EnableGC bool

	// Done, when closed, is used to signal Collector that is should stop collecting
	// statistics and the Run function should return.
	Done <-chan struct{}

	gaugeFunc GaugeFunc
}

// New creates a new Collector that will periodically output statistics to gaugeFunc. It
// will aslo set the values of the exported fields to the described defaults. The values
// of the exported defaults can be changed at any point before Run is called.
func New(gaugeFunc GaugeFunc) *Collector {
	return &Collector{
		PauseDur:  10 * time.Second,
		EnableCPU: true,
		EnableMem: true,
		EnableGC:  true,
		gaugeFunc: gaugeFunc,
	}
}

// Run gathers statistics from package runtime and outputs them to the configured GaugeFunc every
// PauseDur. This function will not return until Done has been closed (or never if Done is nil),
// therefore it should be called in its own goroutine.
func (c *Collector) Run() {
	c.outputStats()

	// Gauges are a 'snapshot' rather than a histogram. Pausing for some interval
	// aims to get a 'recent' snapshot out before statsd flushes metrics.
	tick := time.NewTicker(c.PauseDur)
	defer tick.Stop()
	for {
		select {
		case <-c.Done:
			return
		case <-tick.C:
			c.outputStats()
		}
	}
}

func (c *Collector) outputStats() {
	if c.EnableCPU {
		// Goroutines
		c.gaugeFunc("cpu.goroutines", uint64(runtime.NumGoroutine()))

		// CGo calls
		c.gaugeFunc("cpu.cgo_calls", uint64(runtime.NumCgoCall()))
	}

	if c.EnableMem {
		m := &runtime.MemStats{}
		runtime.ReadMemStats(m)

		// General
		c.gaugeFunc("mem.alloc", m.Alloc)
		c.gaugeFunc("mem.total", m.TotalAlloc)
		c.gaugeFunc("mem.sys", m.Sys)
		c.gaugeFunc("mem.lookups", m.Lookups)
		c.gaugeFunc("mem.malloc", m.Mallocs)
		c.gaugeFunc("mem.frees", m.Frees)

		// Heap
		c.gaugeFunc("mem.heap.alloc", m.HeapAlloc)
		c.gaugeFunc("mem.heap.sys", m.HeapSys)
		c.gaugeFunc("mem.heap.idle", m.HeapIdle)
		c.gaugeFunc("mem.heap.inuse", m.HeapInuse)
		c.gaugeFunc("mem.heap.released", m.HeapReleased)
		c.gaugeFunc("mem.heap.objects", m.HeapObjects)

		// Stack
		c.gaugeFunc("mem.stack.inuse", m.StackInuse)
		c.gaugeFunc("mem.stack.sys", m.StackSys)
		c.gaugeFunc("mem.stack.mspan_inuse", m.MSpanInuse)
		c.gaugeFunc("mem.stack.mspan_sys", m.MSpanSys)
		c.gaugeFunc("mem.stack.mcache_inuse", m.MCacheInuse)
		c.gaugeFunc("mem.stack.mcache_sys", m.MCacheSys)

		c.gaugeFunc("mem.othersys", m.OtherSys)

		if c.EnableGC {
			// GC
			c.gaugeFunc("mem.gc.sys", m.GCSys)
			c.gaugeFunc("mem.gc.next", m.NextGC)
			c.gaugeFunc("mem.gc.last", m.LastGC)
			c.gaugeFunc("mem.gc.pause_total", m.PauseTotalNs)
			c.gaugeFunc("mem.gc.pause", m.PauseNs[(m.NumGC+255)%256])
			c.gaugeFunc("mem.gc.count", uint64(m.NumGC))
		}
	}
}


text:
from syutil.crypto.jsonsign import verify_signed_json
from syutil.crypto.signing_key import (
    decode_verify_key_bytes, write_signing_keys
)
from syutil.base64util import decode_base64

import urllib2
import json
import sys
import dns.resolver
import pprint
import argparse
import logging

def get_targets(server_name):
    if ":" in server_name:
        target, port = server_name.split(":")
        yield (target, int(port))
        return
    try:
        answers = dns.resolver.query("_matrix._tcp." + server_name, "SRV")
        for srv in answers:
            yield (srv.target, srv.port)
    except dns.resolver.NXDOMAIN:
        yield (server_name, 8448)

def get_server_keys(server_name, target, port):
    url = "https://%s:%i/_matrix/key/v1" % (target, port)
    keys = json.load(urllib2.urlopen(url))
    verify_keys = {}
    for key_id, key_base64 in keys["verify_keys"].items():
        verify_key = decode_verify_key_bytes(key_id, decode_base64(key_base64))
        verify_signed_json(keys, server_name, verify_key)
        verify_keys[key_id] = verify_key
    return verify_keys

def main():

    parser = argparse.ArgumentParser()
    parser.add_argument("signature_name")
    parser.add_argument("input_json", nargs="?", type=argparse.FileType('r'),
                        default=sys.stdin)

    args = parser.parse_args()
    logging.basicConfig()

    server_name = args.signature_name
    keys = {}
    for target, port in get_targets(server_name):
        try:
            keys = get_server_keys(server_name, target, port)
            print "Using keys from https://%s:%s/_matrix/key/v1" % (target, port)
            write_signing_keys(sys.stdout, keys.values())
            break
        except:
            logging.exception("Error talking to %s:%s", target, port)

    json_to_check = json.load(args.input_json)
    print "Checking JSON:"
    for key_id in json_to_check["signatures"][args.signature_name]:
        try:
            key = keys[key_id]
            verify_signed_json(json_to_check, args.signature_name, key)
            print "PASS %s" % (key_id,)
        except:
            logging.exception("Check for key %s failed" % (key_id,))
            print "FAIL %s" % (key_id,)

if __name__ == '__main__':
    main()


text:
#region Using

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows.Media;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Q42.HueApi;
using Q42.HueApi.Interfaces;
using Q42.HueApi.Models.Bridge;
using Q42.HueApi.Models.Groups;

#endregion

namespace Noside.Wyvern.HomeAutomation.Model {
	internal class HomeAutomationViewModel : INotifyPropertyChanged {
		#region Fields

		private List<LocatedBridge> _bridgeIPs;
		private ILocalHueClient _client;

		private Color _selectedColor;
		private bool _isRGB;
		private bool _isDimmable;
	    private bool _isOn;
		private double _brightness;

		#endregion

		#region Constructors and Destructors

		public HomeAutomationViewModel() {
//						for (int i = 0; i < 100; i++) {
//							this.Lights.Add(new Light {Name = $"Light: {i}", Type = "extended color light"});
////							this.Lights.Add(new Light {Name = $"Light: {i}", Type = "dimmable light" });
//							this.Groups.Add(new Group {Name = $"Group: {i}"});
//						}
//			this.LoadList.Add(new LoadInfo(this.FindBridge, "Finding HUE Bridge"));
//			this.LoadList.Add(new LoadInfo(this.Init, "Initializing App"));
//			this.LoadList.Add(new LoadInfo(this.FindLights, "Finding All Lights"));
//			this.LoadList.Add(new LoadInfo(this.SetColor, "Setting Color"));
            this.PropertyChanged += this.HomeAutomationViewModel_PropertyChanged;
		}

        private void HomeAutomationViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
                case nameof(this.IsOn):

                    break;
                case nameof(this.SelectedColor):

                    break;
                case nameof(this.Brightness):

                    break;

            }
        }

        #endregion

        #region Events

        public event PropertyChangedEventHandler PropertyChanged;

		#endregion

		#region Properties

		public ObservableCollection<Group> Groups { get; set; } = new ObservableCollection<Group>();

		public ObservableCollection<Light> Lights { get; set; } = new ObservableCollection<Light>();

		public Color SelectedColor {
			get => this._selectedColor;
			set {
				if (this._selectedColor == value) return;
				this._selectedColor = value;
				this.OnPropertyChanged();
			}
		}

		public bool IsRGB {
			get => this._isRGB;
			set {
				if (this.IsRGB == value) return;
				this._isRGB = value;
				this.OnPropertyChanged();
			}
		}

	    public bool IsOn
	    {
	        get => this._isOn;
	        set
	        {
	            if (value == this._isOn) return;
	            this._isOn = value;
	            this.OnPropertyChanged();
	        }
	    }

        public bool IsDimmable {
			get => this._isDimmable;
			set {
				if (this.IsDimmable == value) return;
				this._isDimmable = value;
				this.OnPropertyChanged();
			}
		}

		public double Brightness {
			get => this._brightness;
			set {
				if (value.Equals(this._brightness)) return;
				this._brightness = value;
				this.OnPropertyChanged();
			}
		}

		#endregion

		#region Methods

		[Properties.NotifyPropertyChangedInvocator]
		protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) {
			this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
		}

		private async Task FindBridge() {
			IBridgeLocator locator = new HttpBridgeLocator();
			this._bridgeIPs = (await locator.LocateBridgesAsync(TimeSpan.FromSeconds(5))).ToList();
		}

		private async Task FindLights() {
			foreach (Light light in await this._client.GetLightsAsync()) {
				this.Lights.Add(light);
			}
			foreach (Group group in await this._client.GetGroupsAsync()) {
				this.Groups.Add(group);
			}
		}

		private async Task Init() {
			if (!File.Exists("hue_secret.json")) {
				ILocalHueClient client = new LocalHueClient(this._bridgeIPs.First().IpAddress);
				//TODO pop up message box, please press link button
				string appKey = await client.RegisterAsync(this._bridgeIPs.First().BridgeId, "wyvern");
				Dictionary<string, string> dict = new Dictionary<string, string> {{"apiKey", appKey}};
				File.WriteAllText(@"hue_secret.json", JsonConvert.SerializeObject(dict));
				return;
			}
			string key = string.Empty;
			using (StreamReader file = File.OpenText(@"hue_secret.json"))
			using (JsonTextReader reader = new JsonTextReader(file)) {
				JObject obj = (JObject) JToken.ReadFrom(reader);
				key = (string) obj["apiKey"];
			}
			this._client = new LocalHueClient(this._bridgeIPs.First().IpAddress, key);
		}

		private async Task SetColor() { }

		#endregion
	}
}


text:
"use strict";
import cli from "./cli";
import textlint from "./textlint";
import TextLintEngine from "./textlint-engine";
import TextFixEngine from "./textfix-engine";
import TextLintCore from "./textlint-core";
// FIXME: will be removed
import MessageType from "./shared/type/MessageType";
import SeverityLevel from "./shared/type/SeverityLevel";
import { ASTNodeTypes } from "@textlint/ast-node-types";
// Level of abstraction(descending order)
// cli > TextLintEngine > TextLintCore(textlint)
// See: https://github.com/textlint/textlint/blob/master/docs/use-as-modules.md
module.exports = {
    // Command line interface
    cli,
    // TextLintEngine is a wrapper around `textlint` for linting **multiple** files
    // include formatter, detecting utils
    // <Recommend>: It is easy to use
    // You can see engine/textlint-engine-core.js for more detail
    TextLintEngine,
    // TextFixEngine is a wrapper around `textlint` for linting **multiple** files
    // include formatter, detecting utils
    // <Recommend>: It is easy to use
    // You can see engine/textlint-engine-core.js for more detail
    TextFixEngine,
    // It is a singleton object of TextLintCore
    // Recommend: use TextLintCore
    textlint,
    // Core API for linting a **single** text or file.
    TextLintCore,
    // Constant Types
    TextLintMessageType: MessageType,
    TextLintMessageSeverityLevel: SeverityLevel,
    TextLintNodeType: ASTNodeTypes
};


text:
<?php
class Billmate_Bankpay_Model_Gateway extends Varien_Object{
    public $isMatched = true;
    function makePayment($quote, $addorder = false){

        $_customer  = Mage::getSingleton('customer/session')->isLoggedIn() ? Mage::getSingleton('customer/session')->getCustomer()->getData() : null;
        $Customer = (object)$_customer;

		if(empty($_POST)) $_POST = $_GET;
		$country_to_currency = array(
			'NO' => 'NOK',
			'SE' => 'SEK',
			'FI' => 'EUR',
			'DK' => 'DKK',
			'DE' => 'EUR',
			'NL' => 'EUR',
		);
		$methodname = 'billmatebankpay';
        $k = Mage::helper($methodname)->getBillmate(true, false);

        $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();

      //  $quote = Mage::getSingleton('checkout/session')->getQuote();
        $Billing= $quote->getBillingAddress();
        $Shipping= $quote->getShippingAddress();

        $billingiso3 = Mage::getModel('directory/country')->load($Billing->getCountryId())->getIso3Code();
		$billing_country = Mage::getModel('directory/country')->load($Billing->getCountryId())->getName() ;

        $shippingiso3 = Mage::getModel('directory/country')->load($Shipping->getCountryId())->getIso3Code();
		$shipping_country = Mage::getModel('directory/country')->load($Shipping->getCountryId())->getName() ;
		$shipping_country = $shipping_country == 'SWE' ? 209 : $shipping_country;

		$language = 138;
		$encoding = 2;
		$currency = 0;

		switch ($billingiso3) {
			// Sweden
			case 'SWE':
				$country = 209;
				$language = 138;
				$encoding = 2;
				$currency = 0;
				$billing_country = 209;
				break;
		}

		$ship_address = $bill_address = array();
	    $shipp = $Shipping->getStreet();

	    $ship_address = array(
		    'email'           => $Shipping->email,
		    'telno'           => $Shipping->getTelephone(),
		    'cellno'          => '',
		    'fname'           => $Shipping->getFirstname(),
		    'lname'           => $Shipping->getLastname(),
		    'company'         => $Shipping->getCompany(),
		    'careof'          => '',
		    'street'          => $shipp[0],
		    'house_number'    => isset($house_no)? $house_no: '',
		    'house_extension' => isset($house_ext)?$house_ext:'',
		    'zip'             => $Shipping->getPostcode(),
		    'city'            => $Shipping->getCity(),
		    'country'         => $shipping_country,
	    );
	    $bill = $Billing->getStreet();
	    $bill_address = array(
		    'email'           => $Billing->email,
		    'telno'           => $Billing->getTelephone(),
		    'cellno'          => '',
		    'fname'           => $Billing->getFirstname(),
		    'lname'           => $Billing->getLastname(),
		    'company'         => $Billing->getCompany(),
		    'careof'          => '',
		    'street'          => $bill[0],
		    'house_number'    => '',
		    'house_extension' => '',
		    'zip'             => $Billing->getPostcode(),
		    'city'            => $Billing->getCity(),
		    'country'         => $billing_country,
	    );
	    foreach($bill_address as $key => $col ){
	        $bill_address[$key] = utf8_decode($col);
	    }
	    foreach($ship_address as $key => $col ){
	        $ship_address[$key] = utf8_decode($col);
	    }
	    $goods_list = array();

	    $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
        $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
        $_directory = Mage::helper('directory');
		$_taxHelper  = Mage::helper('tax');
        $_weeeHelper = Mage::helper('weee');
		$percent = 0;
        $store = Mage::app()->getStore();
		$discountAmount = 0;
		$_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices());
	    foreach( $quote->getAllItems() as $_item){

            if( $_item->getParentItemId() ){
				continue;
			}

			$request = Mage::getSingleton('tax/calculation')->getRateRequest(null, null, null, $store);

			$productId = $_item->getProductId();
			$_product = Mage::getModel('catalog/product')->load($productId);

            $taxclassid = $_product->getData('tax_class_id');

			if( $_item->getProductType() == 'bundle'){
				$options = $_item->getChildrenItems();
				$percent=0;
				foreach($options as $option){
					$taxclassid = $option->getProduct()->getData('tax_class_id');
					$percent += Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxclassid));
				}
				$percent = $percent/sizeof($options);
			} else {
				$percent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxclassid));
			}

			$priceinc = $_item->getOriginalPrice();

			if( Mage::getStoreConfig("tax/calculation/price_includes_tax", $store->getId())){
				$price = $_item->getOriginalPrice() / (1+$percent/100);
			}else{
				$price = $_item->getOriginalPrice();
			}

			if( $baseCurrencyCode != $currentCurrencyCode ){
				$price = $_directory->currencyConvert($_finalPrice,$baseCurrencyCode,$currentCurrencyCode);
			}

			$goods_list[] = array(
				'qty'   => (int)$_item->getQtyOrdered(),
				'goods' => array(
					'artno'    => $_product->getSKU(),
					'title'    => $_item->getName(),
					'price'    => (int)round($price*100,0),
					'vat'      => (float)$percent,
					'discount' => 0.0,
					'flags'    => 0,
				)
			);
			$discountAmount+= abs( $_item->getDiscountAmount() );
	    }

		$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();

		//print_r($quote1['subtotal']->getData());

		if(isset($totals['discount']) || $discountAmount > 0) {
			if( $discountAmount == 0 ){
				$discountAmount = abs($totals['discount']->getValue());
			}
			$applyTax = (boolean)Mage::getStoreConfig('tax/calculation/discount_tax');
			$goods_list[] = array(
				'qty'   => (int)1,
				'goods' => array(
					'artno'    => '',
					'title'    => Mage::helper('payment')->__('Rabatt'),
					'price'    => -round(($discountAmount*0.8)*100),
					'vat'      => ($applyTax) ?$percent:0,
					'discount' => 0.0,
					'flags'    => 0,
				)
			);
		}
        $shippingamount = $quote->getShippingAmount();

		$request = Mage::getSingleton('tax/calculation')->getRateRequest(null, null, null, $store);

		$shippingTaxClass = Mage::getStoreConfig('tax/classes/shipping_tax_class', Mage::app()->getStore() );
		$percent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($shippingTaxClass));

        if(!empty($shippingamount) && $shippingamount>0){

		    $goods_list[] = array(
			    'qty'   => 1,
			    'goods' => array(
				    'artno'    => '',
				    'title'    => Mage::helper('payment')->__('Shipping'),
				    'price'    => round($shippingamount*100,0),
				    'vat'      => $percent,
				    'discount' => 0.0,
				    'flags'    => 8,
			    )
		    );
		}

	    $pclass = -1 ;
        $last_order_increment_id = Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId();
	    $transaction = array(
		    "order1"=>(string)$last_order_increment_id,
			'order2'=>'',
		    "comment"=>(string)'',
		    "flags"=>0,
		    "reference"=>"",
		    "reference_code"=>"",
		    "currency"=>$currency,
		    "country"=>209,
		    "language"=>$language,
		    "pclass"=>$pclass,
		    'gender'=>'1',
		    "shipInfo"=>array("delay_adjust"=>"1"),
		    "travelInfo"=>array(),
		    "incomeInfo"=>array(),
		    "bankInfo"=>array(),
		    "sid"=>array("time"=>microtime(true)),
		    "extraInfo"=>array(array("cust_no"=>(string)$customerId,"creditcard_data"=>$_POST))
	    );
		$transaction["extraInfo"][0]["status"] = 'Paid';
		$qt = Mage::getSingleton('checkout/session')->getQuote();

		if( $addorder ) {
			$k->addOrder('',$bill_address,$ship_address,$goods_list,$transaction);
			return;
		}
		$session = Mage::getSingleton("core/session",  array("name"=>"frontend"));
		if( $session->getData('bank_api_called') == 1) return;

	    $result1 = $k->AddInvoice('',$bill_address,$ship_address,$goods_list,$transaction);
        if( !is_array($result1)){
            Mage::throwException( utf8_encode( $result1));
        }else{
			$session->setData("bank_api_called", 1);
		}
    }
}


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>jQuery Mobile Framework - Dialog Example</title>
	<link rel="stylesheet"  href="../../jquery.mobile-1.0.min.css" />
	<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>

Share Photos

		Email
		Upload to flickr
		Share on Facebook
		Tweet photo

		Cancel


text:
Nom real

El nom real humanament llegible d'aquest usuari. Això es mostra amb ordres
com ara <tt>finger</tt>, i s'utilitza en el correu de sortida.


text:
.tradeUnit {
    background-color: rgba(123, 112, 1, 0.4);
    border: ridge 4px;
}

.tradeUnit:Hover {
    background-color: rgba(154, 112, 1, 0.8);
    border: ridge 4px;
}

.tradeUnitSel {
    background-color: rgba(154, 112, 1, 0.8);
    border: ridge 4px;
}

.tradeUnitSelected {
    background-image: url("http://static.eaw1805.com/images/panels/trade/selPanel.png");
}

.miniInfoPanel {
    background-image: url("http://static.eaw1805.com/images/panels/boarding/miniInfPanel.png");
}

.infoPanel {
    background-image: url("http://static.eaw1805.com/images/panels/boarding/infPanel.png");

}

.cargoUnitsPanel {
    background-image: url("http://static.eaw1805.com/images/panels/boarding/cargoUnitsPanel.png");

}

.brigadeMiniInfoPanel {
    background-image: url("http://static.eaw1805.com/images/infopanels/brigadeMini.png");
}

.generalMiniInfoPanel {
    background-image: url("http://static.eaw1805.com/images/infopanels/generalMini.png");
}

.infoPanelHolder {
    background-image: url("http://static.eaw1805.com/images/infopanels/infoPanelHolder.png");
}

.pageBar {
    background-image: url("http://static.eaw1805.com/images/panels/formFederations/pagesBar.png");
}

.shipMiniInfoPanel {
    background-image: url("http://static.eaw1805.com/images/infopanels/shipMini.png");
}

.battalionMiniInfoPanel {
    background-image: url("http://static.eaw1805.com/images/panels/formFederations/BattalionHolder.png");
}

.ArmyTypeInfoPanel {
    background-image: url("http://static.eaw1805.com/images/infopanels/ArmyTypeInfoPanel.png");
}

.ArmyTypeInfoPanel2 {
    background-image: url("http://static.eaw1805.com/images/infopanels/ArmyTypeInfoPanel2.png");
}

.ToolTip245x90 {
    background-image: url("http://static.eaw1805.com/images/tooltips/tooltip245x90.png")
}

.ToolTip245x75 {
    background-image: url("http://static.eaw1805.com/images/tooltips/tooltip245x75.png")
}

.pointsInfoPanel {
    background-image: url("http://static.eaw1805.com/images/infopanels/pointsInfoPanel.png");
    background-repeat: no-repeat;
    background-size:100% 100%;
}

.infoPanelSelected {
    background-image: url("http://static.eaw1805.com/images/infopanels/selected.png")
}

.brigadeMiniInfoPanelFieldBattle {
    background-image: url("http://static.eaw1805.com/images/infopanels/brigadeMiniInfoPanel.png")
}

.brigadeLogInfoPanel {
    background-image: url("http://static.eaw1805.com/images/infopanels/brigadeLogInfoPanel.png")
}


text:
NS_ASSUME_NONNULL_BEGIN

@implementation DWShadowView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self shadowView_commonInit];
    }
    return self;
}

- (nullable instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self shadowView_commonInit];
    }
    return self;
}

- (void)shadowView_commonInit {
    self.backgroundColor = [UIColor clearColor];

    [self.layer dw_applyShadowWithColor:[UIColor dw_shadowColor] alpha:0.02 x:0.0 y:0.0 blur:5.0];
    self.layer.shouldRasterize = YES;
    self.layer.rasterizationScale = [UIScreen mainScreen].scale;

    _spread = 1.0;
}

- (void)setSpread:(CGFloat)spread {
    _spread = spread;

    [self setNeedsLayout];
}

- (void)layoutSubviews {
    [super layoutSubviews];

    if (self.spread == 0 || self.isHidden) {
        self.layer.shadowPath = nil;
    }
    else {
        const CGFloat dx = -self.spread;
        const CGRect rect = CGRectInset(self.bounds, dx, dx);
        self.layer.shadowPath = [UIBezierPath bezierPathWithRect:rect].CGPath;
    }
}

@end

NS_ASSUME_NONNULL_END


text:
#ifndef NAVIGATIONDATAVISUALIZATIONFILTER_H_INCLUDED
#define NAVIGATIONDATAVISUALIZATIONFILTER_H_INCLUDED

#include <itkProcessObject.h>

#include "mitkBaseRenderer.h"
#include "mitkCommon.h"
#include "mitkNavigationData.h"
#include "mitkNavigationDataToNavigationDataFilter.h"

namespace mitk {
  /**Documentation
  * \brief NavigationDataVisualizationFilter represents the superclass of all IGT Filters that visualize NavigationData
  *
  * \ingroup IGT
  */
  class MITKIGT_EXPORT NavigationDataVisualizationFilter : public mitk::NavigationDataToNavigationDataFilter
  {
  public:
    mitkClassMacroItkParent(NavigationDataVisualizationFilter,itk::ProcessObject);

    /**Documentation
    * \brief Set the input of this filter
    */
    virtual void SetInput( const NavigationData* nd);

    /**Documentation
    * \brief Set input with id idx of this filter
    */
    virtual void SetInput( unsigned int idx, const NavigationData* nd);

    /**Documentation
    * \brief Get the input of this filter
    */
    const NavigationData* GetInput(void);

    /**Documentation
    * \brief Get the input with id idx of this filter
    */
    const NavigationData* GetInput(unsigned int idx);

  protected:
    NavigationDataVisualizationFilter();
    virtual ~NavigationDataVisualizationFilter();

    virtual void GenerateData()=0;

  };
} // namespace mitk

#endif


text:
import dj_database_url

DEBUG = True
TEMPLATE_DEBUG = True

SECRET_KEY = 'this is my secret key'  # NOQA

TEST_RUNNER = 'django.test.runner.DiscoverRunner'

DATABASES = {
    'default': dj_database_url.config(default='postgres:///psqlextra'),
}

DATABASES['default']['ENGINE'] = 'psqlextra.backend'

LANGUAGE_CODE = 'en'
LANGUAGES = (
    ('en', 'English'),
    ('ro', 'Romanian'),
    ('nl', 'Dutch')
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.admin',
    'django.contrib.messages',
    'localized_fields',
    'tests',
)

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    },
]

MIDDLEWARE = [
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
]

# set to a lower number than the default, since
# we want the tests to be fast, default is 100
LOCALIZED_FIELDS_MAX_RETRIES = 3

LOCALIZED_FIELDS_EXPERIMENTAL = False


text:
module.exports = function(grunt) {

  'use strict';

  var fs       = require('fs'),
      path     = require('path'),
      datauri  = require('datauri');

  var RE_CSS_URLFUNC = /(?:url\(["']?)(.*?)(?:["']?\))/,
      util = grunt.util,
      gruntfileDir = path.resolve('./'),
      expandFiles;

  if (grunt.file.expandFiles) {
    expandFiles = grunt.file.expandFiles;
  } else {
    expandFiles = function(files) {
      return grunt.file.expand({filter: 'isFile'}, files);
    };
  }

  grunt.registerMultiTask('dataUri', 'Convert your css file image path!!', function() {

    var options  = this.options(),
        srcFiles = expandFiles(this.data.src),
        destDir  = path.resolve(this.data.dest),
        haystack = [];

    expandFiles(options.target).forEach(function(imgPath) {
      haystack.push(path.resolve(imgPath));
    });

    srcFiles.forEach(function(src) {
      var content  = grunt.file.read(src),
          matches  = content.match(new RegExp(RE_CSS_URLFUNC.source, 'g')),
          outputTo = destDir+'/'+path.basename(src),
          baseDir,
          uris;

      // Detect baseDir for using traversal image files
      baseDir = options.baseDir ? path.resolve(options.baseDir)    // specified base dir
                                : path.resolve(path.dirname(src)); // detected from src

      // Not found image path
      if (!matches) {
        grunt.log.subhead('SRC: file uri not found on '+src);
        grunt.file.write(outputTo, content);
        grunt.log.ok('Skipped');
        grunt.log.ok('=> ' + outputTo);
        return;
      }

      // List uniq image URIs
      uris = util._.uniq(matches.map(function(m) {
        return m.match(RE_CSS_URLFUNC)[1];
      }));

      // Exclude external http resource
      uris = uris.filter(function(u) {
        return !u.match('(data:|http)');
      });

      grunt.log.subhead('SRC: '+uris.length+' file uri found on '+src);

      // Process urls
      uris.forEach(function(uri) {
        var replacement, needle, fixedUri;

        // fixed current dir when specified uri is like root
        fixedUri = (uri.indexOf('/') === 0 ? '.' + uri : uri).split('?')[0].split('#')[0];

        // Resolve image realpath
        needle = path.join(baseDir, fixedUri);

        // Assume file existing cause found from haystack
        if (haystack.indexOf(needle) !== -1) {

          // check if file exceeds the max bytes
          var fileSize = getFileSize(needle);
          if (options.maxBytes && fileSize > options.maxBytes) {
            // file is over the max size
            grunt.log.ok('Skipping (size ' + fileSize + ' > ' + options.maxBytes +'): ' + uri);
            return;
          } else {
            // Encoding to Data uri
            replacement = datauri(needle);

            grunt.log.ok('Encode: '+needle);
          }
        } else {
          if (options.fixDirLevel) {
            // Diff of directory level
            replacement = adjustDirectoryLevel(fixedUri, destDir, baseDir);
            grunt.log.ok('Adjust: '+ uri + ' -> ' + replacement);
          } else {
            replacement = uri;
            grunt.log.ok('Ignore: '+ uri);
          }
        }

        var escapedUri = uri.replace(/\?/g, '\\$&');
        content = content.replace(new RegExp(escapedUri, 'g'), replacement);
      });

      // Revert base to gruntjs executing current dir
      grunt.file.setBase(gruntfileDir);
      grunt.file.write(outputTo, content);
      grunt.log.ok('=> ' + outputTo);
    });
  });

  /**
   *
   * @param fullPath
   * @param options
   * @return {boolean} the file size, or undefined if not found
   */
  function getFileSize(fullPath) {

    if (!fs.existsSync(fullPath)) {
      return false;
    }

    var stats = fs.statSync(fullPath);
    if (!stats.isFile()) {
      return false;
    }
    return stats.size;
  }

  /**
   * @method adjustDirectoryLevel
   * @param {String} relativePath
   * @param {String} toDir
   * @param {String} fromDir
   * @return {String} resolvedPath
   */
  function adjustDirectoryLevel(relativePath, toDir, fromDir) {
    // fix ../path/to/img.jpg to path/to/img.jpg
    var resolvedPath = relativePath.replace(/^\.\//, '');

    if (toDir === fromDir) {
      // both toDir and fromDir are same base.
    }
    else if (fromDir.indexOf(toDir) === 0) {
      // fromDir is shallow than toDir
      path.relative(fromDir, toDir).split('/').forEach(function() {
        resolvedPath = resolvedPath.replace(/^\.\.\//, '');
      });
    }
    else if (toDir.indexOf(fromDir) === 0 ) {
      // toDir is deep than fromDir
      path.relative(fromDir, toDir).split('/').forEach(function() {
        resolvedPath = '../'+resolvedPath;
      });
    }
    return resolvedPath;
  }

};


text:
package de.dominikschadow.javasecurity.header.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * This servlet filter protects the {@code csp2/protected.jsp} page by adding the {@code Content-Security-Policy} Level
 * 2 header to the response. The {@code urlPatterns} should be far more wildcard in a real web application than in this
 * demo project.
 *
 * @author Dominik Schadow
 */
@WebFilter(filterName = "CSP2Filter", urlPatterns = {"/csp2/protectedForm.jsp", "/all/all.jsp"})
public class CSP2Filter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
                         FilterChain filterChain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) servletResponse;
        response.setHeader("Content-Security-Policy", "default-src 'self'; frame-ancestors 'none'; reflected-xss block");

        filterChain.doFilter(servletRequest, response);
    }

    @Override
    public void init(FilterConfig filterConfig) {
    }

    @Override
    public void destroy() {
    }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css" media="all" />
        <link rel="stylesheet" href="dist/bundle.min.css" type="text/css" />
        <title>Example Reactjs-Babel [Tuts+]</title>

Lets Shop


text:
<?php
namespace Aura\Accept;

class AcceptTest extends \PHPUnit_Framework_TestCase
{
    protected function setUp()
    {
        $factory = new AcceptFactory(array(
            'HTTP_ACCEPT' => 'application/json, application/xml, text/*, */*',
            'HTTP_ACCEPT_CHARSET' => 'iso-8859-5, unicode-1-1;q=0.8',
            'HTTP_ACCEPT_ENCODING' => 'compress;q=0.5, gzip;q=1.0',
            'HTTP_ACCEPT_LANGUAGE' => 'en-US, en-GB, en, *',
        ));
        $this->accept = $factory->newInstance();
    }

    public function testNegotiateCharset()
    {
        $actual = $this->accept->negotiateCharset(array('unicode-1-1'));
        $expect = 'unicode-1-1';
        $this->assertSame($expect, $actual->getValue());
    }

    public function testNegotiateEncoding()
    {
        $actual = $this->accept->negotiateEncoding(array());
        $this->assertFalse($actual);
    }

    public function testNegotiateLanguage()
    {
        $actual = $this->accept->negotiateLanguage(array('pt-BR', 'fr-FR'));
        $expect = 'pt-BR';
        $this->assertSame($expect, $actual->getValue());
    }

    public function testNegotiateMedia()
    {
        $actual = $this->accept->negotiateMedia(array(
            'application/xml',
            'application/json',
        ));
        $expect = 'application/json';
        $this->assertSame($expect, $actual->getValue());
    }
}


text:
using System;
using Xamarin.Forms;

namespace BindingSourceXaml
{
    public class App : Application
    {
        public App()
        {
            MainPage = new BindingSourceXamlPage();
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}


text:
credence-quiz
=============

A game to help you calibrate your sense of probable truth.


text:
<?php
namespace Formapro\Pvm\Exception;

class InterruptExecutionException extends \RuntimeException implements PvmException
{

}


text:
export {default as timeFormatLocale, timeFormat, timeParse, utcFormat, utcParse} from "./src/locale";
export {default as isoFormat} from "./src/isoFormat";
export {default as isoParse} from "./src/isoParse";


text:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using Avalonia.Animation;
using Avalonia.Collections;
using Avalonia.Media.Immutable;

#nullable enable

namespace Avalonia.Media
{
    /// <summary>
    /// Represents the sequence of dashes and gaps that will be applied by a <see cref="Pen"/>.
    /// </summary>
    public class DashStyle : Animatable, IDashStyle, IAffectsRender
    {
        /// <summary>
        /// Defines the <see cref="Dashes"/> property.
        /// </summary>
        public static readonly StyledProperty<AvaloniaList<double>> DashesProperty =
            AvaloniaProperty.Register<DashStyle, AvaloniaList<double>>(nameof(Dashes));

        /// <summary>
        /// Defines the <see cref="Offset"/> property.
        /// </summary>
        public static readonly StyledProperty<double> OffsetProperty =
            AvaloniaProperty.Register<DashStyle, double>(nameof(Offset));

        private static ImmutableDashStyle? s_dash;
        private static ImmutableDashStyle? s_dot;
        private static ImmutableDashStyle? s_dashDot;
        private static ImmutableDashStyle? s_dashDotDot;

        /// <summary>
        /// Initializes a new instance of the <see cref="DashStyle"/> class.
        /// </summary>
        public DashStyle()
            : this(null, 0)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="DashStyle"/> class.
        /// </summary>
        /// <param name="dashes">The dashes collection.</param>
        /// <param name="offset">The dash sequence offset.</param>
        public DashStyle(IEnumerable<double>? dashes, double offset)
        {
            Dashes = (dashes as AvaloniaList<double>) ?? new AvaloniaList<double>(dashes ?? Array.Empty<double>());
            Offset = offset;
        }

        static DashStyle()
        {
            void RaiseInvalidated(AvaloniaPropertyChangedEventArgs e)
            {
                ((DashStyle)e.Sender).Invalidated?.Invoke(e.Sender, EventArgs.Empty);
            }

            DashesProperty.Changed.Subscribe(RaiseInvalidated);
            OffsetProperty.Changed.Subscribe(RaiseInvalidated);
        }

        /// <summary>
        /// Represents a dashed <see cref="DashStyle"/>.
        /// </summary>
        public static IDashStyle Dash => s_dash ??= new ImmutableDashStyle(new double[] { 2, 2 }, 1);

        /// <summary>
        /// Represents a dotted <see cref="DashStyle"/>.
        /// </summary>
        public static IDashStyle Dot => s_dot ??= new ImmutableDashStyle(new double[] { 0, 2 }, 0);

        /// <summary>
        /// Represents a dashed dotted <see cref="DashStyle"/>.
        /// </summary>
        public static IDashStyle DashDot => s_dashDot ??= new ImmutableDashStyle(new double[] { 2, 2, 0, 2 }, 1);

        /// <summary>
        /// Represents a dashed double dotted <see cref="DashStyle"/>.
        /// </summary>
        public static IDashStyle DashDotDot => s_dashDotDot ??= new ImmutableDashStyle(new double[] { 2, 2, 0, 2, 0, 2 }, 1);

        /// <summary>
        /// Gets or sets the length of alternating dashes and gaps.
        /// </summary>
        public AvaloniaList<double> Dashes
        {
            get => GetValue(DashesProperty);
            set => SetValue(DashesProperty, value);
        }

        /// <summary>
        /// Gets or sets how far in the dash sequence the stroke will start.
        /// </summary>
        public double Offset
        {
            get => GetValue(OffsetProperty);
            set => SetValue(OffsetProperty, value);
        }

        IReadOnlyList<double> IDashStyle.Dashes => Dashes;

        /// <summary>
        /// Raised when the dash style changes.
        /// </summary>
        public event EventHandler? Invalidated;

        /// <summary>
        /// Returns an immutable clone of the <see cref="DashStyle"/>.
        /// </summary>
        /// <returns></returns>
        public ImmutableDashStyle ToImmutable() => new ImmutableDashStyle(Dashes, Offset);

        protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
        {
            base.OnPropertyChanged(change);

            if (change.Property == DashesProperty)
            {
                var oldValue = change.OldValue.GetValueOrDefault<AvaloniaList<double>>();
                var newValue = change.NewValue.GetValueOrDefault<AvaloniaList<double>>();

                if (oldValue is object)
                {
                    oldValue.CollectionChanged -= DashesChanged;
                }

                if (newValue is object)
                {
                    newValue.CollectionChanged += DashesChanged;
                }
            }
        }

        private void DashesChanged(object? sender, NotifyCollectionChangedEventArgs e)
        {
            Invalidated?.Invoke(this, e);
        }
    }
}


text:
<?php namespace Modules\Block\Sidebar;

use Maatwebsite\Sidebar\Group;
use Maatwebsite\Sidebar\Item;
use Maatwebsite\Sidebar\Menu;
use Modules\Core\Contracts\Authentication;

class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender
{
    /**
     * @var Authentication
     */
    protected $auth;

    /**
     * @param Authentication $auth
     *
     * @internal param Guard $guard
     */
    public function __construct(Authentication $auth)
    {
        $this->auth = $auth;
    }

    /**
     * @param Menu $menu
     *
     * @return Menu
     */
    public function extendWith(Menu $menu)
    {
        $menu->group(trans('core::sidebar.content'), function (Group $group) {
            $group->item(trans('block::blocks.title.blocks'), function (Item $item) {
                $item->authorize(
                    $this->auth->hasAccess('block.blocks.index')
                );
                $item->icon('fa fa-cube');
                $item->weight(0);
                $item->append('admin.block.block.create');
                $item->route('admin.block.block.index');
                $item->authorize(
                    $this->auth->hasAccess('block.blocks.index')
                );
            });
        });

        return $menu;
    }
}


text:
package jp.pay.model;

import java.util.Map;

import jp.pay.exception.APIConnectionException;
import jp.pay.exception.APIException;
import jp.pay.exception.AuthenticationException;
import jp.pay.exception.CardException;
import jp.pay.exception.InvalidRequestException;
import jp.pay.net.APIResource;
import jp.pay.net.RequestOptions;

public class Transfer extends APIResource {
	Integer amount;
	TransferChargeCollection charges;
	Long created;
	String currency;
	Long date;
	String description;
	String id;
	Boolean livemode;
	String status;
	Summary summary;

	public TransferChargeCollection getCharges() {
		return charges;
	}

	public Long getCreated() {
		return created;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Boolean getLivemode() {
		return livemode;
	}

	public void setLivemode(Boolean livemode) {
		this.livemode = livemode;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Long getDate() {
		return date;
	}

	public void setDate(Long date) {
		this.date = date;
	}

	public Summary getSummary() {
		return summary;
	}

	public void setSummary(Summary summary) {
		this.summary = summary;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getAmount() {
		return amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public static Transfer create(Map<String, Object> params)
			throws AuthenticationException, InvalidRequestException,
			APIConnectionException, CardException, APIException {
		return create(params, (RequestOptions) null);
	}

	public static Transfer retrieve(String id) throws AuthenticationException,
			InvalidRequestException, APIConnectionException,
			CardException, APIException {
		return retrieve(id, (RequestOptions) null);
	}

	public static TransferCollection all(Map<String, Object> params)
			throws AuthenticationException, InvalidRequestException,
			APIConnectionException, CardException, APIException {
		return all(params, (RequestOptions) null);
	}

	public static Transfer create(Map<String, Object> params, RequestOptions options)
			throws AuthenticationException, InvalidRequestException,
			APIConnectionException, CardException, APIException {
		return request(RequestMethod.POST, classURL(Transfer.class), params, Transfer.class, options);
	}

	public static Transfer retrieve(String id, RequestOptions options)
			throws AuthenticationException, InvalidRequestException,
			APIConnectionException, CardException, APIException {
		return request(RequestMethod.GET, instanceURL(Transfer.class, id), null, Transfer.class, options);
	}

	public static TransferCollection all(Map<String, Object> params,
			RequestOptions options) throws AuthenticationException,
			InvalidRequestException, APIConnectionException,
			CardException, APIException {
		return request(RequestMethod.GET, classURL(Transfer.class), params, TransferCollection.class, options);
	}
}


text:
/*
 * gmcmc_model.h
 *
 * Defines a GMCMC model with proposal and likelihood functions.
 *
 *  Created on: 11 June 2013
 *      Author: Gary Macindoe
 */

#ifndef GMCMC_MODEL_H
#define GMCMC_MODEL_H

#include <gmcmc/gmcmc_distribution.h>

/**
 * A model.
 */
typedef struct gmcmc_model gmcmc_model;

/**
 * Creates a model.
 *
 * @param [out] model       the model to create
 * @param [in]  n           the number of parameters in the model
 * @param [in]  priors      an array of prior distributions for each parameter
 *
 * @return 0 on success,
 *         GMCMC_ENOMEM if there is not enough memory to create a new model.
 */
int gmcmc_model_create(gmcmc_model **, size_t, gmcmc_distribution **);

/**
 * Destroys a model.
 *
 * @param [in] model  the model to destroy.
 */
void gmcmc_model_destroy(gmcmc_model *);

/**
 * Gets the number of parameters in the model.
 *
 * @param [in] model  the model
 *
 * @return the number of parameters in the model.
 */
size_t gmcmc_model_get_num_params(const gmcmc_model *);

/**
 * Sets the initial parameter values.
 *
 * @param [in,out] model   the model
 * @param [in]     params  the parameter values (may be NULL)
 *
 * @return 0 on success,
 *         GMCMC_ENOMEM if there is not enough memory to copy the initial
 *                        parameter values into the model.
 */
int gmcmc_model_set_params(gmcmc_model *, const double *);

/**
 * Gets a pointer to the initial parameter values.
 *
 * @param [in] model  the model
 *
 * @return a pointer to the initial parameter values.
 */
const double * gmcmc_model_get_params(const gmcmc_model *);

/**
 * Gets a pointer to the priors for each parameter.
 *
 * @param [in] model  the model
 * @param [in] i      the parameter index
 *
 * @return the prior for the ith parameter or NULL if the i is out of range.
 */
const gmcmc_distribution * gmcmc_model_get_prior(const gmcmc_model *, size_t);

/**
 * Sets the parameter stepsize.
 *
 * @param [in] model     the model
 * @param [in] stepsize  the stepsize
 *
 * @return 0 on success,
 *         GMCMC_EINVAL if the stepsize is less than or equal to zero.
 */
int gmcmc_model_set_stepsize(gmcmc_model *, double);

/**
 * Gets the parameter stepsize.
 *
 * @param [in] model  the model
 *
 * @return the parameter stepsize.
 */
double gmcmc_model_get_stepsize(const gmcmc_model *);

/**
 * Sets the upper and lower limits for adapting stepsizes.
 *
 * @param [in] model  the model
 * @param [in] lower  the lower bound for the stepsizes
 * @param [in] upper  the upper bound for the stepsizes
 *
 * @return 0 on success, GMCMC_EINVAL if lower is greater than upper.
 */
int gmcmc_model_set_stepsize_bounds(gmcmc_model *, double, double);

/**
 * Gets the upper and lower limits for adapting stepsizes.
 *
 * @param [in]  model  the model
 * @param [out] lower  the lower bound for the stepsizes
 * @param [out] upper  the upper bound for the stepsizes
 */
void gmcmc_model_get_stepsize_bounds(const gmcmc_model *, double *, double *);

/**
 * Sets up parameter blocking.
 *
 * @param [in]  model        the model
 * @param [in]  num_blocks   the number of blocks (zero for no blocking)
 * @param [in]  block_sizes  the size of each block (length num_blocks, may be
 *                             NULL if num_blocks is zero)
 *
 * @return 0 on success,
 *         GMCMC_EINVAL if block_sizes does not sum to the number of parameters,
 *         GMCMC_ENOMEM if the block sizes could not be allocated in the model.
 */
int gmcmc_model_set_blocking(gmcmc_model *, size_t, const size_t *);

/**
 * Gets the number of blocks to use when updating parameters.  If zero, the
 * parameters are to be updated together in one block.
 *
 * @param [in] model  the model
 *
 * @return the number of parameter blocks.
 */
size_t gmcmc_model_get_num_blocks(const gmcmc_model *);

/**
 * Gets the size of a parameter block.
 *
 * @param [in] model  the model
 * @param [in] i      the index of the block
 *
 * @return the number of parameters in block i, or zero if i is out of range.
 */
size_t gmcmc_model_get_block_size(const gmcmc_model *, size_t);

/**
 * Sets the fixed permutation of parameter indices to use when blocking.
 *
 * @param [in]  model        the model
 * @param [in]  blocks       the indices of the parameters in each block (length
 *                             num_params, may be NULL for random blocking)
 *
 * @return 0 on success,
 *         GMCMC_EINVAL if blocks is not a valid permutation of the parameter
 *                        indices,
 *         GMCMC_ENOMEM if the blocks could not be allocated in the model.
 */
int gmcmc_model_set_blocks(gmcmc_model *, const size_t *);

/**
 * Gets the fixed permutation of parameter indices to use when blocking.
 *
 * @param [in] model  the model
 *
 * @return the permutation of parameter indices, or NULL for random blocking.
 */
const size_t * gmcmc_model_get_blocks(const gmcmc_model *);

/**
 * Stores a pointer to any model-specific data and functions in the model.
 *
 * @param [in,out] model          the model
 * @param [in]     modelspecific  model-specific data and functions (may be NULL)
 */
void gmcmc_model_set_modelspecific(gmcmc_model *, void *);

/**
 * Gets a pointer to the model-specific data and functions.
 *
 * @param [in] model  the model
 *
 * @return a pointer to the model-specific data and functions.
 */
const void * gmcmc_model_get_modelspecific(const gmcmc_model *);

#endif /* GMCMC_MODEL_H */


text:
VolumeArchive::VolumeArchive(std::unique_ptr<VolumeReader> reader)
    : reader_(std::move(reader)) {}

VolumeArchive::~VolumeArchive() = default;


text:
namespace EmployerEmployeeHuntSystem.Web.Infrastructure.ActionAttributes
{
    using System.Web.Mvc;
    using Microsoft.AspNet.Identity;
    using Services.Data.Contracts;

    public class OrganizationFounderAttribute : AuthorizeAttribute
    {
        public string OrganizationIdKey { get; set; }

        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            base.OnAuthorization(filterContext);

            var context = filterContext.HttpContext;

            int organizationId = int.Parse(context.Request.Params[this.OrganizationIdKey]);

            if (context.User.Identity.GetUserId() != DependencyResolver.Current.GetService<IOrganizationsService>().GetById(organizationId).Founder.Id)
            {
                filterContext.Result = new RedirectResult("/");
            }
        }
    }
}


text:
package Google::Ads::GoogleAds::V12::Resources::AssetGroupProductGroupView;

use strict;
use warnings;
use base qw(Google::Ads::GoogleAds::BaseEntity);

use Google::Ads::GoogleAds::Utils::GoogleAdsHelper;

sub new {
  my ($class, $args) = @_;
  my $self = {
    assetGroup                   => $args->{assetGroup},
    assetGroupListingGroupFilter => $args->{assetGroupListingGroupFilter},
    resourceName                 => $args->{resourceName}};

  # Delete the unassigned fields in this object for a more concise JSON payload
  remove_unassigned_fields($self, $args);

  bless $self, $class;
  return $self;
}

1;