text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.niroz</groupId>
	<artifactId>mvcstore</artifactId>
	<version>0.0.1</version>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.5.7.RELEASE</version>
	</parent>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-security</artifactId>
		</dependency>
		<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
		</dependency>
	</dependencies>
	<properties>
		<java.version>1.8</java.version>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<executable>true</executable>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


text:
<?php

class Google_Service_Bigquery_TimePartitioning extends Google_Model
{
  public $expirationMs;
  public $field;
  public $requirePartitionFilter;
  public $type;

  public function setExpirationMs($expirationMs)
  {
    $this->expirationMs = $expirationMs;
  }
  public function getExpirationMs()
  {
    return $this->expirationMs;
  }
  public function setField($field)
  {
    $this->field = $field;
  }
  public function getField()
  {
    return $this->field;
  }
  public function setRequirePartitionFilter($requirePartitionFilter)
  {
    $this->requirePartitionFilter = $requirePartitionFilter;
  }
  public function getRequirePartitionFilter()
  {
    return $this->requirePartitionFilter;
  }
  public function setType($type)
  {
    $this->type = $type;
  }
  public function getType()
  {
    return $this->type;
  }
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Tunnel Vision Laboratories, LLC. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#pragma warning disable IDE1006 // Naming Styles

namespace NOpenCL
{
    using System;
    using System.Runtime.InteropServices;
    using NOpenCL.SafeHandles;

    /// <content>
    /// Flush and finish.
    /// </content>
    internal partial class UnsafeNativeMethods
    {
        ///
        /// Issues all previously queued OpenCL commands in a command-queue to the device associated with the command-queue.
        /// http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clFlush.html
        /// http://www.khronos.org/registry/cl/specs/opencl-1.2.pdf#page=193
        ///
        /// <remarks>
        /// Issues all previously queued OpenCL commands in <paramref name="commandQueue"/>
        /// to the device associated with <paramref name="commandQueue"/>.
        ///
        /// <para>
        /// <see cref="clFlush"/> only guarantees that all queued commands to
        /// <paramref name="commandQueue"/> will eventually be submitted to the appropriate
        /// device. There is no guarantee that they will be complete after <see cref="clFlush"/>
        /// returns.
        /// </para>
        ///
        /// <para>
        /// Any blocking commands queued in a command-queue and <see cref="clReleaseCommandQueue"/>
        /// perform an implicit flush of the command-queue. These blocking commands are
        /// <see cref="clEnqueueReadBuffer"/>, <see cref="clEnqueueReadBufferRect"/>, or
        /// <see cref="clEnqueueReadImage"/> with blockingRead set to <c>true</c>;
        /// <see cref="clEnqueueWriteBuffer"/>, <see cref="clEnqueueWriteBufferRect"/>, or
        /// <see cref="clEnqueueWriteImage"/> with blockingWrite set to <c>true</c>;
        /// <see cref="clEnqueueMapBuffer"/> or <see cref="clEnqueueMapImage"/> with
        /// blockingMap set to <c>true</c>; or <see cref="clWaitForEvents"/>.
        /// </para>
        ///
        /// <para>
        /// To use event objects that refer to commands enqueued in a command-queue as event
        /// objects to wait on by commands enqueued in a different command-queue, the
        /// application must call a <see cref="clFlush"/> or any blocking commands that
        /// perform an implicit flush of the command-queue where the commands that refer
        /// to these event objects are enqueued.
        /// </para>
        /// </remarks>
        /// <param name="commandQueue">A valid command-queue.</param>
        /// <returns>
        /// Returns <see cref="ErrorCode.Success"/> if the function call was executed
        /// successfully. Otherwise, it returns one of the following:
        ///
        /// <list type="bullet">
        /// <item><see cref="ErrorCode.InvalidCommandQueue"/> if <paramref name="commandQueue"/> is not a valid command-queue.</item>
        /// <item><see cref="ErrorCode.OutOfHostMemory"/> if there is a failure to allocate resources required by the OpenCL implementation on the host.</item>
        /// <item><see cref="ErrorCode.OutOfResources"/> if there is a failure to allocate resources required by the OpenCL implementation on the device.</item>
        /// </list>
        /// </returns>
        /// <seealso cref="clFinish"/>
        [DllImport(ExternDll.OpenCL)]
        private static extern ErrorCode clFlush(CommandQueueSafeHandle commandQueue);

        internal static void Flush(CommandQueueSafeHandle commandQueue)
        {
            if (commandQueue == null)
                throw new ArgumentNullException(nameof(commandQueue));

            ErrorHandler.ThrowOnFailure(clFlush(commandQueue));
        }

        ///
        /// Blocks until all previously queued OpenCL commands in a command-queue are issued to the associated device and have completed.
        /// http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clFinish.html
        ///
        /// <remarks>
        /// Blocks until all previously queued OpenCL commands in
        /// <paramref name="commandQueue"/> are issued to the associated device and
        /// have completed.
        ///
        /// <para>
        /// <see cref="clFinish"/> does not return until all previously queued commands
        /// in <paramref name="commandQueue"/> have been processed and completed.
        /// <see cref="clFinish"/> is also a synchronization point.
        /// </para>
        /// </remarks>
        /// <param name="commandQueue">A valid command-queue.</param>
        /// <returns>
        /// Returns <see cref="ErrorCode.Success"/> if the function call was executed
        /// successfully. Otherwise, it returns one of the following:
        ///
        /// <list type="bullet">
        /// <item><see cref="ErrorCode.InvalidCommandQueue"/> if <paramref name="commandQueue"/> is not a valid command-queue.</item>
        /// <item><see cref="ErrorCode.OutOfHostMemory"/> if there is a failure to allocate resources required by the OpenCL implementation on the host.</item>
        /// <item><see cref="ErrorCode.OutOfResources"/> if there is a failure to allocate resources required by the OpenCL implementation on the device.</item>
        /// </list>
        /// </returns>
        /// <seealso cref="clFlush"/>
        [DllImport(ExternDll.OpenCL)]
        private static extern ErrorCode clFinish(CommandQueueSafeHandle commandQueue);

        internal static void Finish(CommandQueueSafeHandle commandQueue)
        {
            if (commandQueue == null)
                throw new ArgumentNullException(nameof(commandQueue));

            ErrorHandler.ThrowOnFailure(clFinish(commandQueue));
        }
    }
}


text:
import collections
import logging

log = logging.getLogger(__name__)

def screennames_to_ids(screennames, client):
    """
    Convert an iterable of screennames to a mapping
    from screennames to Twitter IDs.
    """

    mapping = dict()

    screennames = collections.deque(screennames)

    while screennames:
        chunk = [
            screennames.popleft().strip('@')
            for _ in range(min(10, len(screennames)))
        ]
        response = client.lookup_user(screen_name=','.join(chunk))
        for user in response:
            mapping[user['screen_name']] = user['id']
        log.info('{} user IDs obtained'.format(len(mapping)))

    return mapping

class User:

    def __init__(self, name, screenname, region):
        self.name = name
        self.screenname = screenname
        self.region = region


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;

namespace elb_utilities.Addins
{
    [Serializable]
    public class AddinLoader : MarshalByRefObject
    {
        public static List<Type> Load<T>(string pluginPath, SearchOption searchOption = SearchOption.AllDirectories)
        {
            if (!typeof(T).IsInterface) throw new Exception($"{nameof(AddinLoader)}.{nameof(Load)} called with non-interface type: {typeof(T).Name}");

            var addins = new List<Type>();

            // scan for plugins in other dlls in a new appdomain so any assemblies scanned and not containing plugins are unloaded
            using (var appDomain = new AppDomainWithType<AddinLoader>())
            {
                var addinLoader = appDomain.TypeObject;

                addins.AddRange(addinLoader.GetImplementationsFromPath<T>(pluginPath, "*.dll", searchOption));
            }

            return addins;
        }

        private List<Type> GetImplementationsFromPath<T>(string path, string searchPattern, SearchOption searchOption)
        {
            var list = new List<Type>();

            if (Directory.Exists(path))
            {
                list.AddRange(GetImplementationsFromAssemblies<T>(Directory.GetFiles(path, searchPattern, searchOption).Select(file => Assembly.LoadFrom(file))));
            }

            return list;
        }

        public static IEnumerable<Type> GetImplementationsFromAssemblies<T>(IEnumerable<Assembly> assemblies)
        {
            if (!typeof(T).IsInterface) throw new Exception($"{nameof(AddinLoader)}.{nameof(GetImplementationsFromAssemblies)} called with non-interface type: {typeof(T).Name}");

            return assemblies.SelectMany(a => GetImplementationsFromAssembly<T>(a));
        }

        public static List<Type> GetImplementationsFromAssembly<T>(Assembly assembly)
        {
            return assembly.GetTypes().Where(t => typeof(T).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract).ToList();
        }
    }
}


text:
use libtww::std::marker;

use {Rng, Rand};

pub use self::range::Range;
pub use self::gamma::{Gamma, ChiSquared, FisherF, StudentT};
pub use self::normal::{Normal, LogNormal};
pub use self::exponential::Exp;

pub mod range;
pub mod gamma;
pub mod normal;
pub mod exponential;

/// Types that can be used to create a random instance of `Support`.
pub trait Sample<Support> {
    /// Generate a random value of `Support`, using `rng` as the
    /// source of randomness.
    fn sample<R: Rng>(&mut self, rng: &mut R) -> Support;
}

/// `Sample`s that do not require keeping track of state.
///
/// Since no state is recorded, each sample is (statistically)
/// independent of all others, assuming the `Rng` used has this
/// property.
// FIXME maybe having this separate is overkill (the only reason is to
// take &self rather than &mut self)? or maybe this should be the
// trait called `Sample` and the other should be `DependentSample`.
pub trait IndependentSample<Support>: Sample<Support> {
    /// Generate a random value.
    fn ind_sample<R: Rng>(&self, &mut R) -> Support;
}

/// A wrapper for generating types that implement `Rand` via the
/// `Sample` & `IndependentSample` traits.
pub struct RandSample<Sup> {
    _marker: marker::PhantomData<fn() -> Sup>,
}

impl<Sup> Copy for RandSample<Sup> {}
impl<Sup> Clone for RandSample<Sup> {
    fn clone(&self) -> Self {
        *self
    }
}

impl<Sup: Rand> Sample<Sup> for RandSample<Sup> {
    fn sample<R: Rng>(&mut self, rng: &mut R) -> Sup {
        self.ind_sample(rng)
    }
}

impl<Sup: Rand> IndependentSample<Sup> for RandSample<Sup> {
    fn ind_sample<R: Rng>(&self, rng: &mut R) -> Sup {
        rng.gen()
    }
}

impl<Sup> RandSample<Sup> {
    pub fn new() -> RandSample<Sup> {
        RandSample { _marker: marker::PhantomData }
    }
}

/// A value with a particular weight for use with `WeightedChoice`.
#[derive(Copy)]
#[derive(Clone)]
pub struct Weighted<T> {
    /// The numerical weight of this item
    pub weight: u32,
    /// The actual item which is being weighted
    pub item: T,
}

/// A distribution that selects from a finite collection of weighted items.
///
/// Each item has an associated weight that influences how likely it
/// is to be chosen: higher weight is more likely.
///
/// The `Clone` restriction is a limitation of the `Sample` and
/// `IndependentSample` traits. Note that `&T` is (cheaply) `Clone` for
/// all `T`, as is `u32`, so one can store references or indices into
/// another vector.
///
/// # Example
///
/// ```rust
/// use rand::distributions::{Weighted, WeightedChoice, IndependentSample};
///
/// let mut items = vec!(Weighted { weight: 2, item: 'a' },
///                      Weighted { weight: 4, item: 'b' },
///                      Weighted { weight: 1, item: 'c' });
/// let wc = WeightedChoice::new(&mut items);
/// let mut rng = rand::thread_rng();
/// for _ in 0..16 {
///      // on average prints 'a' 4 times, 'b' 8 and 'c' twice.
///      println!("{}", wc.ind_sample(&mut rng));
/// }
/// ```
pub struct WeightedChoice<'a, T: 'a> {
    items: &'a mut [Weighted<T>],
    weight_range: Range<u32>,
}

impl<'a, T: Clone> WeightedChoice<'a, T> {
    /// Create a new `WeightedChoice`.
    ///
    /// Panics if:
    /// - `v` is empty
    /// - the total weight is 0
    /// - the total weight is larger than a `u32` can contain.
    pub fn new(items: &'a mut [Weighted<T>]) -> WeightedChoice<'a, T> {
        // strictly speaking, this is subsumed by the total weight == 0 case
        assert!(!items.is_empty(),
                "WeightedChoice::new called with no items");

        let mut running_total: u32 = 0;

        // we convert the list from individual weights to cumulative
        // weights so we can binary search. This *could* drop elements
        // with weight == 0 as an optimisation.
        for item in items.iter_mut() {
            running_total = match running_total.checked_add(item.weight) {
                Some(n) => n,
                None => {
                    panic!("WeightedChoice::new called with a total weight larger than a u32 can \
                            contain")
                }
            };

            item.weight = running_total;
        }
        assert!(running_total != 0,
                "WeightedChoice::new called with a total weight of 0");

        WeightedChoice {
            items: items,
            // we're likely to be generating numbers in this range
            // relatively often, so might as well cache it
            weight_range: Range::new(0, running_total),
        }
    }
}

impl<'a, T: Clone> Sample<T> for WeightedChoice<'a, T> {
    fn sample<R: Rng>(&mut self, rng: &mut R) -> T {
        self.ind_sample(rng)
    }
}

impl<'a, T: Clone> IndependentSample<T> for WeightedChoice<'a, T> {
    fn ind_sample<R: Rng>(&self, rng: &mut R) -> T {
        // we want to find the first element that has cumulative
        // weight > sample_weight, which we do by binary since the
        // cumulative weights of self.items are sorted.

        // choose a weight in [0, total_weight)
        let sample_weight = self.weight_range.ind_sample(rng);

        // short circuit when it's the first item
        if sample_weight < self.items[0].weight {
            return self.items[0].item.clone();
        }

        let mut idx = 0;
        let mut modifier = self.items.len();

        // now we know that every possibility has an element to the
        // left, so we can just search for the last element that has
        // cumulative weight <= sample_weight, then the next one will
        // be "it". (Note that this greatest element will never be the
        // last element of the vector, since sample_weight is chosen
        // in [0, total_weight) and the cumulative weight of the last
        // one is exactly the total weight.)
        while modifier > 1 {
            let i = idx + modifier / 2;
            if self.items[i].weight <= sample_weight {
                // we're small, so look to the right, but allow this
                // exact element still.
                idx = i;
                // we need the `/ 2` to round up otherwise we'll drop
                // the trailing elements when `modifier` is odd.
                modifier += 1;
            } else {
                // otherwise we're too big, so go left. (i.e. do
                // nothing)
            }
            modifier /= 2;
        }
        return self.items[idx + 1].item.clone();
    }
}

mod ziggurat_tables;

/// Sample a random number using the Ziggurat method (specifically the
/// ZIGNOR variant from Doornik 2005). Most of the arguments are
/// directly from the paper:
///
/// * `rng`: source of randomness
/// * `symmetric`: whether this is a symmetric distribution, or one-sided with P(x < 0) = 0.
/// * `X`: the $x_i$ abscissae.
/// * `F`: precomputed values of the PDF at the $x_i$, (i.e. $f(x_i)$)
/// * `F_DIFF`: precomputed values of $f(x_i) - f(x_{i+1})$
/// * `pdf`: the probability density function
/// * `zero_case`: manual sampling from the tail when we chose the
///    bottom box (i.e. i == 0)
// the perf improvement (25-50%) is definitely worth the extra code
// size from force-inlining.
#[inline(always)]
fn ziggurat<R: Rng, P, Z>(rng: &mut R,
                          symmetric: bool,
                          x_tab: ziggurat_tables::ZigTable,
                          f_tab: ziggurat_tables::ZigTable,
                          mut pdf: P,
                          mut zero_case: Z)
                          -> f64
    where P: FnMut(f64) -> f64,
          Z: FnMut(&mut R, f64) -> f64
{
    const SCALE: f64 = (1u64 << 53) as f64;
    loop {
        // reimplement the f64 generation as an optimisation suggested
        // by the Doornik paper: we have a lot of precision-space
        // (i.e. there are 11 bits of the 64 of a u64 to use after
        // creating a f64), so we might as well reuse some to save
        // generating a whole extra random number. (Seems to be 15%
        // faster.)
        //
        // This unfortunately misses out on the benefits of direct
        // floating point generation if an RNG like dSMFT is
        // used. (That is, such RNGs create floats directly, highly
        // efficiently and overload next_f32/f64, so by not calling it
        // this may be slower than it would be otherwise.)
        // FIXME: investigate/optimise for the above.
        let bits: u64 = rng.gen();
        let i = (bits & 0xff) as usize;
        let f = (bits >> 11) as f64 / SCALE;

        // u is either U(-1, 1) or U(0, 1) depending on if this is a
        // symmetric distribution or not.
        let u = if symmetric {
            2.0 * f - 1.0
        } else {
            f
        };
        let x = u * x_tab[i];

        let test_x = if symmetric {
            x.abs()
        } else {
            x
        };

        // algebraically equivalent to |u| < x_tab[i+1]/x_tab[i] (or u < x_tab[i+1]/x_tab[i])
        if test_x < x_tab[i + 1] {
            return x;
        }
        if i == 0 {
            return zero_case(rng, u);
        }
        // algebraically equivalent to f1 + DRanU()*(f0 - f1) < 1
        if f_tab[i + 1] + (f_tab[i] - f_tab[i + 1]) * rng.gen::<f64>() < pdf(x) {
            return x;
        }
    }
}

#[cfg(test)]
mod tests {

    use {Rng, Rand};
    use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample};

    #[derive(PartialEq, Debug)]
    struct ConstRand(usize);
    impl Rand for ConstRand {
        fn rand<R: Rng>(_: &mut R) -> ConstRand {
            ConstRand(0)
        }
    }

    // 0, 1, 2, 3, ...
    struct CountingRng {
        i: u32,
    }
    impl Rng for CountingRng {
        fn next_u32(&mut self) -> u32 {
            self.i += 1;
            self.i - 1
        }
        fn next_u64(&mut self) -> u64 {
            self.next_u32() as u64
        }
    }

    #[test]
    fn test_rand_sample() {
        let mut rand_sample = RandSample::<ConstRand>::new();

        assert_eq!(rand_sample.sample(&mut ::test::rng()), ConstRand(0));
        assert_eq!(rand_sample.ind_sample(&mut ::test::rng()), ConstRand(0));
    }
    #[test]
    fn test_weighted_choice() {
        // this makes assumptions about the internal implementation of
        // WeightedChoice, specifically: it doesn't reorder the items,
        // it doesn't do weird things to the RNG (so 0 maps to 0, 1 to
        // 1, internally; modulo a modulo operation).

        macro_rules! t {
            ($items:expr, $expected:expr) => {{
                let mut items = $items;
                let wc = WeightedChoice::new(&mut items);
                let expected = $expected;

                let mut rng = CountingRng { i: 0 };

                for &val in expected.iter() {
                    assert_eq!(wc.ind_sample(&mut rng), val)
                }
            }}
        }

        t!(vec![Weighted {
                    weight: 1,
                    item: 10,
                }],
           [10]);

        // skip some
        t!(vec![Weighted {
                    weight: 0,
                    item: 20,
                },
                Weighted {
                    weight: 2,
                    item: 21,
                },
                Weighted {
                    weight: 0,
                    item: 22,
                },
                Weighted {
                    weight: 1,
                    item: 23,
                }],
           [21, 21, 23]);

        // different weights
        t!(vec![Weighted {
                    weight: 4,
                    item: 30,
                },
                Weighted {
                    weight: 3,
                    item: 31,
                }],
           [30, 30, 30, 30, 31, 31, 31]);

        // check that we're binary searching
        // correctly with some vectors of odd
        // length.
        t!(vec![Weighted {
                    weight: 1,
                    item: 40,
                },
                Weighted {
                    weight: 1,
                    item: 41,
                },
                Weighted {
                    weight: 1,
                    item: 42,
                },
                Weighted {
                    weight: 1,
                    item: 43,
                },
                Weighted {
                    weight: 1,
                    item: 44,
                }],
           [40, 41, 42, 43, 44]);
        t!(vec![Weighted {
                    weight: 1,
                    item: 50,
                },
                Weighted {
                    weight: 1,
                    item: 51,
                },
                Weighted {
                    weight: 1,
                    item: 52,
                },
                Weighted {
                    weight: 1,
                    item: 53,
                },
                Weighted {
                    weight: 1,
                    item: 54,
                },
                Weighted {
                    weight: 1,
                    item: 55,
                },
                Weighted {
                    weight: 1,
                    item: 56,
                }],
           [50, 51, 52, 53, 54, 55, 56]);
    }

    #[test]
    fn test_weighted_clone_initialization() {
        let initial: Weighted<u32> = Weighted {
            weight: 1,
            item: 1,
        };
        let clone = initial.clone();
        assert_eq!(initial.weight, clone.weight);
        assert_eq!(initial.item, clone.item);
    }

    #[test]
    #[should_panic]
    fn test_weighted_clone_change_weight() {
        let initial: Weighted<u32> = Weighted {
            weight: 1,
            item: 1,
        };
        let mut clone = initial.clone();
        clone.weight = 5;
        assert_eq!(initial.weight, clone.weight);
    }

    #[test]
    #[should_panic]
    fn test_weighted_clone_change_item() {
        let initial: Weighted<u32> = Weighted {
            weight: 1,
            item: 1,
        };
        let mut clone = initial.clone();
        clone.item = 5;
        assert_eq!(initial.item, clone.item);

    }

    #[test]
    #[should_panic]
    fn test_weighted_choice_no_items() {
        WeightedChoice::<isize>::new(&mut []);
    }
    #[test]
    #[should_panic]
    fn test_weighted_choice_zero_weight() {
        WeightedChoice::new(&mut [Weighted {
                                      weight: 0,
                                      item: 0,
                                  },
                                  Weighted {
                                      weight: 0,
                                      item: 1,
                                  }]);
    }
    #[test]
    #[should_panic]
    fn test_weighted_choice_weight_overflows() {
        let x = ::std::u32::MAX / 2; // x + x + 2 is the overflow
        WeightedChoice::new(&mut [Weighted {
                                      weight: x,
                                      item: 0,
                                  },
                                  Weighted {
                                      weight: 1,
                                      item: 1,
                                  },
                                  Weighted {
                                      weight: x,
                                      item: 2,
                                  },
                                  Weighted {
                                      weight: 1,
                                      item: 3,
                                  }]);
    }
}


text:
if (!window.cgToggleBaselineGrid) {
  window.cgToggleBaselineGrid = function(evt) {
    if (evt.keyCode === 71) {
      // "g" key to toggle grid
      document.body.classList.toggle("va-debug");
    }
  };
}

document.body.removeEventListener("keydown", window.cgToggleBaselineGrid);
document.body.addEventListener("keydown", window.cgToggleBaselineGrid);


text:
import './keyboardShotcuts';
import './persistAppState';
import './controlBar';
import './customTheme';
import './desktopSettings';
import './errorHandler';
import './tray';
import './lastFM';
import './autoUpdater';
import './websocketAPI';
import './lyrics';
import './applicationMenu';


text:
package com.elastisys.scale.cloudpool.google.commons.api.compute.functions;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;

import com.elastisys.scale.cloudpool.api.types.CloudProviders;
import com.elastisys.scale.cloudpool.api.types.Machine;
import com.elastisys.scale.cloudpool.api.types.MachineState;
import com.elastisys.scale.cloudpool.api.types.MembershipStatus;
import com.elastisys.scale.cloudpool.api.types.ServiceState;
import com.elastisys.scale.cloudpool.google.commons.api.compute.functions.InstanceToMachine;
import com.elastisys.scale.cloudpool.google.commons.api.compute.metadata.MetadataKeys;
import com.elastisys.scale.cloudpool.google.commons.utils.MetadataUtil;
import com.elastisys.scale.commons.json.JsonUtils;
import com.elastisys.scale.commons.util.time.UtcTime;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.JsonParser;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.compute.model.Instance;
import com.google.common.io.Resources;

/**
 * Verifies that {@link Instance} are correctly translated into {@link Machine}
 * representations.
 */
public class TestInstanceToMachine {

    /** Object under test. */
    private InstanceToMachine converter;

    @Before
    public void beforeTestMethod() {
        this.converter = new InstanceToMachine();
    }

    /**
     * Test converting a (metadata-complete) {@link Instance} to a
     * {@link Machine} representation.
     */
    @Test
    public void convertInstance() throws IOException {
        Instance instance = instance("instances/instance.json");
        Machine machine = this.converter.apply(instance);

        // the instance's URL is used as machine id
        assertThat(machine.getId(), is(instance.getSelfLink()));
        assertThat(machine.getMachineState(), is(MachineState.RUNNING));
        assertThat(machine.getServiceState(), is(ServiceState.UNKNOWN));
        assertThat(machine.getMembershipStatus(), is(MembershipStatus.defaultStatus()));
        assertThat(machine.getLaunchTime(), is(UtcTime.parse(instance.getCreationTimestamp())));
        assertThat(machine.getRequestTime(), is(nullValue()));
        assertThat(machine.getPrivateIps(), is(Arrays.asList(instance.getNetworkInterfaces().get(0).getNetworkIP())));
        assertThat(machine.getPublicIps(),
                is(Arrays.asList(instance.getNetworkInterfaces().get(0).getAccessConfigs().get(0).getNatIP())));
        assertThat(machine.getRequestTime(), is(nullValue()));

        assertThat(machine.getCloudProvider(), is(CloudProviders.GCE));
        assertThat(machine.getRegion(), is("europe-west1"));
        assertThat(machine.getMachineSize(), is("n1-standard-1"));

        assertThat(machine.getMetadata(), is(nullValue()));
    }

    /**
     * An instance's status should be correctly converted to a corresponding
     * {@link MachineState}.
     */
    @Test
    public void convertMachineState() {
        Instance instance = instance("instances/instance.json");

        instance.setStatus("PROVISIONING");
        assertThat(this.converter.apply(instance).getMachineState(), is(MachineState.PENDING));

        instance.setStatus("STAGING");
        assertThat(this.converter.apply(instance).getMachineState(), is(MachineState.PENDING));

        instance.setStatus("RUNNING");
        assertThat(this.converter.apply(instance).getMachineState(), is(MachineState.RUNNING));

        instance.setStatus("STOPPING");
        assertThat(this.converter.apply(instance).getMachineState(), is(MachineState.TERMINATING));

        instance.setStatus("SUSPENDING");
        assertThat(this.converter.apply(instance).getMachineState(), is(MachineState.TERMINATING));

        instance.setStatus("SUSPENDED");
        assertThat(this.converter.apply(instance).getMachineState(), is(MachineState.TERMINATED));

        instance.setStatus("TERMINATED");
        assertThat(this.converter.apply(instance).getMachineState(), is(MachineState.TERMINATED));
    }

    /**
     * If a {@link MetadataKeys#MEMBERSHIP_STATUS} metadata key has been set on
     * the {@link Instance}, it should be parsed and set on the {@link Machine}.
     */
    @Test
    public void convertInstanceWithMembershipStatusMetadata() {
        Instance instance = instance("instances/instance.json");

        setInstanceMetadata(instance, MetadataKeys.MEMBERSHIP_STATUS, MembershipStatus.defaultStatus());
        assertThat(this.converter.apply(instance).getMembershipStatus(), is(MembershipStatus.defaultStatus()));

        setInstanceMetadata(instance, MetadataKeys.MEMBERSHIP_STATUS, MembershipStatus.awaitingService());
        assertThat(this.converter.apply(instance).getMembershipStatus(), is(MembershipStatus.awaitingService()));

        setInstanceMetadata(instance, MetadataKeys.MEMBERSHIP_STATUS, MembershipStatus.blessed());
        assertThat(this.converter.apply(instance).getMembershipStatus(), is(MembershipStatus.blessed()));

        setInstanceMetadata(instance, MetadataKeys.MEMBERSHIP_STATUS, MembershipStatus.disposable());
        assertThat(this.converter.apply(instance).getMembershipStatus(), is(MembershipStatus.disposable()));
    }

    /**
     * If a {@link MetadataKeys#SERVICE_STATE} metadata key has been set on the
     * {@link Instance}, it should be parsed and set on the {@link Machine}.
     */
    @Test
    public void convertInstanceWithServiceStateMetadata() {
        Instance instance = instance("instances/instance.json");

        setInstanceMetadata(instance, MetadataKeys.SERVICE_STATE, ServiceState.BOOTING);
        assertThat(this.converter.apply(instance).getServiceState(), is(ServiceState.BOOTING));

        setInstanceMetadata(instance, MetadataKeys.SERVICE_STATE, ServiceState.IN_SERVICE);
        assertThat(this.converter.apply(instance).getServiceState(), is(ServiceState.IN_SERVICE));

        setInstanceMetadata(instance, MetadataKeys.SERVICE_STATE, ServiceState.OUT_OF_SERVICE);
        assertThat(this.converter.apply(instance).getServiceState(), is(ServiceState.OUT_OF_SERVICE));

        setInstanceMetadata(instance, MetadataKeys.SERVICE_STATE, ServiceState.UNHEALTHY);
        assertThat(this.converter.apply(instance).getServiceState(), is(ServiceState.UNHEALTHY));

        setInstanceMetadata(instance, MetadataKeys.SERVICE_STATE, ServiceState.UNKNOWN);
        assertThat(this.converter.apply(instance).getServiceState(), is(ServiceState.UNKNOWN));
    }

    /**
     * Converter should not freak out if {@link Instance} is missing a network
     * interface (it may do so, for example, early in the boot process).
     */
    @Test
    public void missingNetworkInterface() {
        Instance instance = instance("instances/instance.json");
        instance.setNetworkInterfaces(null);

        assertThat(this.converter.apply(instance).getPrivateIps(), is(Collections.emptyList()));
        assertThat(this.converter.apply(instance).getPublicIps(), is(Collections.emptyList()));
    }

    /**
     * Converter should not freak out if {@link Instance} is missing a private
     * IP (it may do so, for example, early in the boot process).
     */
    @Test
    public void missingPrivateIp() {
        Instance instance = instance("instances/instance.json");
        instance.getNetworkInterfaces().get(0).setNetworkIP(null);

        assertThat(this.converter.apply(instance).getPrivateIps(), is(Collections.emptyList()));
    }

    /**
     * Converter should not freak out if {@link Instance} is missing a public IP
     * (it may do so, for example, early in the boot process).
     */
    @Test
    public void missingPublicIp() {
        Instance instance = instance("instances/instance.json");
        instance.getNetworkInterfaces().get(0).getAccessConfigs().get(0).setNatIP(null);

        assertThat(this.converter.apply(instance).getPublicIps(), is(Collections.emptyList()));
    }

    /**
     * Converter should not freak out if {@link Instance} is missing a public IP
     * (it may do so, for example, early in the boot process).
     */
    @Test
    public void missingPublicIpAccessConfig() {
        Instance instance = instance("instances/instance.json");
        instance.getNetworkInterfaces().get(0).setAccessConfigs(null);

        assertThat(this.converter.apply(instance).getPublicIps(), is(Collections.emptyList()));
    }

    private static void setInstanceMetadata(Instance instance, String key, Object value) {
        Map<String, String> metadataMap = MetadataUtil.toMap(instance.getMetadata());
        metadataMap.put(key, JsonUtils.toString(JsonUtils.toJson(value)));
        instance.getMetadata().setItems(MetadataUtil.toItems(metadataMap));
    }

    public static Instance instance(String resourcePath) {
        JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
        try {
            JsonParser parser = jsonFactory
                    .createJsonParser(new FileInputStream(Resources.getResource(resourcePath).getFile()));
            return parser.parse(Instance.class);
        } catch (Exception e) {
            throw new RuntimeException("failed to load Instance json file " + resourcePath + ": " + e.getMessage(), e);
        }
    }
}


text:
====================================
Project Standards and Best Practices
====================================

This document is a summation of some of the standards and best practices that are followed in the design and implementation of the project to provide guidance and clarity for `implementers and contributors`_.

These standards are presented for clarity and convenience (to avoid arguments about style or judgement and document reasoning) but they are not intended to be comprehensive. Code reviewers will expect that industry-wide best practices are followed in addition to any specifically outlined concepts which are covered in this document.

========
Security
========
The project's baseline security practices should be based on the latest recommendations from the Open Web Security Project (OWASP), which provides practical and evidence based standards for software implementers. If there is a question in approach on system design and OWASP has a stated position on the best approach, it should be expected that the OWASP sanctioned approach will be adopted.

In addition, the project follows the following specific security practices.

Security Protocols and Cryptography Implementation
--------------------------------------------------

The project strives for a high standard of technical and practical security, but it is not the intended purpose of the project to provide a novel technical approach to security.  Since there is an overwhelming consensus from security researchers and practitioners[1]_,[2]_ that it is a harmful practice for software systems to attempt to implement their own unique security or cryptographic protocols, no such implementations will be adopted by the project.

Specifically, components of the project which externally authenticate users or secure data cryptographically will be:

- Based on a publicly documented specification or approach (Basic Authentication, OAuth, SAML, AES256, etc)
- In broad use in modern software with a practical basis of demonstrated success
- Adopted through the use of externally implemented libraries or dependencies whenever practically possible

This expectation does not necessarily extend to code which is required for integrations which authenticate against external systems. Those implementations should always follow this approach when possible, and best practices should be maintained when managing secrets for such components.

.. [1] Jakob Jakobsen and Claudio Orlandi "On the CCA (in)security of MTProto." *Cryptology ePrint Archive, Report 2015/1177*

.. [2] Philipp Jovanovic and Samuel Neves "Dumb Crypto in Smart Grids: Practical Cryptanalysis of the Open Smart Grid Protocol." *Cryptology ePrint Archive, Report 2015/428*

.. _implementers and contributors: CONTRIBUTING.rst


text:
package org.apache.geronimo.gshell.commands.builtin;

import org.apache.geronimo.gshell.clp.Argument;
import org.apache.geronimo.gshell.clp.Option;
import org.apache.geronimo.gshell.command.CommandAction;
import org.apache.geronimo.gshell.command.CommandContext;
import org.apache.geronimo.gshell.io.IO;

import java.util.Iterator;
import java.util.List;

/**
 * A simple command to print all arguments to the commands standard output.
 *
 * @version $Rev$ $Date$
 */
public class EchoAction
    implements CommandAction
{
    @Option(name="-n")
    private boolean trailingNewline = true;

    @Argument
    private List<String> args = null;

    public Object execute(final CommandContext context) throws Exception {
        assert context != null;
        IO io = context.getIo();

        if (args != null && !args.isEmpty()) {
            Iterator iter = args.iterator();

            while (iter.hasNext()) {
                io.out.print(iter.next());
                if (iter.hasNext()) {
                    io.out.print(" ");
                }
            }
        }

        if (trailingNewline) {
            io.out.println();
        }

        return Result.SUCCESS;
    }
}


text:
package jetbrains.jetpad.mapper.gwt;

import com.google.gwt.event.shared.HandlerRegistration;
import jetbrains.jetpad.mapper.Synchronizer;
import jetbrains.jetpad.mapper.SynchronizerContext;

import jetbrains.jetpad.base.function.Supplier;

public class GwtSynchronizers {
  public static Synchronizer forRegistration(final Supplier<HandlerRegistration> reg) {
    return new Synchronizer() {
      HandlerRegistration myReg;

      @Override
      public void attach(SynchronizerContext ctx) {
        myReg = reg.get();
      }

      @Override
      public void detach() {
        myReg.removeHandler();
      }
    };
  }

  public static Synchronizer forRegistration(final HandlerRegistration r) {
    return new Synchronizer() {
      @Override
      public void attach(SynchronizerContext ctx) {
      }

      @Override
      public void detach() {
        r.removeHandler();
      }
    };
  }
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Rhytidanthe scabra Benth.

### Remarks
null


text:
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.extensions;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.vcs.annotate.AnnotationGutterActionProvider;
import com.intellij.openapi.vcs.annotate.FileAnnotation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.github.GHOpenInBrowserFromAnnotationActionGroup;

/**
 * @author Kirill Likhodedov
 */
public class GHAnnotationGutterActionProvider implements AnnotationGutterActionProvider {

  @NotNull
  @Override
  public AnAction createAction(@NotNull FileAnnotation annotation) {
    return new GHOpenInBrowserFromAnnotationActionGroup(annotation);
  }
}


text:
object InnerClassesScope1 {
  def scope = {
    case class First(value: BigInt) {
      def makeSecond = Second(value)
    }

    case class Second(value: BigInt) {
      def makeFirst = First(value)
    }

    First(42).makeSecond.makeFirst.value
  }

  def prop = {
    assert(scope == 42)
  }
}


text:
// CONTROLLER
// =============================================================================
class AboutController {
	/**
	 * @constructor
	 */
	constructor() {
		this.name = "about";
	}
}

// EXPORT
// =============================================================================
export default AboutController;


text:
test
====

This is a private project for testing and is not valuable.


text:
class OpenweathermapRubyGdl
  attr_accessor :url

  def initialize(url)
    @url = url || 'http://api.openweathermap.org/data/2.5/weather?id=4005539'
  end

  def get_response
    call_url(@url)
  end

  def call_url(url)
    Net::HTTP.get(URI.parse(url))
  end

  def parse_response
    JSON.parse get_response
  end
end


text:
package io.vamp.common

import java.util.ServiceLoader

import scala.collection.JavaConverters.asScalaIteratorConverter
import scala.reflect.{ ClassTag, classTag }

trait ClassMapper {

  def name: String

  def clazz: Class[_]
}

object ClassProvider {

  def all[T: ClassTag]: Iterator[T] = {
    ServiceLoader.load(classTag[T].runtimeClass).iterator.asScala.map(_.asInstanceOf[T])
  }

  def find[T: ClassTag](name: String): Option[Class[T]] = all[ClassMapper].collectFirst {
    case c if c.name == name && classTag[T].runtimeClass.isAssignableFrom(c.clazz) ⇒ c.clazz.asInstanceOf[Class[T]]
  }
}


text:
#ifndef INET_TYPE_H
#define INET_TYPE_H

typedef struct acc *(*get_userdata_t) ARGS(( int fd, size_t offset,
	size_t count, int for_ioctl ));
typedef int (*put_userdata_t) ARGS(( int fd, size_t offset,
	struct acc *data, int for_ioctl ));
typedef void (*put_pkt_t) ARGS(( int fd, struct acc *data, size_t datalen ));
typedef void (*select_res_t) ARGS(( int fd, unsigned ops ));

#endif /* INET_TYPE_H */

/*
 * $PchId: type.h,v 1.6 2005/06/28 14:22:04 philip Exp $
 */


text:
.class final enum Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;
.super Ljava/lang/Enum;
.source "WifiDisplayAdapter.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/display/WifiDisplayAdapter;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x4018
    name = "SinkEvent"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Enum",
        "<",
        "Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;",
        ">;"
    }
.end annotation

# static fields
.field private static final synthetic $VALUES:[Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

.field public static final enum SINK_EVENT_CONNECTED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

.field public static final enum SINK_EVENT_CONNECTING:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

.field public static final enum SINK_EVENT_CONNECTION_FAILED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

.field public static final enum SINK_EVENT_DISCONNECTED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

# direct methods
.method static constructor <clinit>()V
    .locals 6

    .prologue
    const/4 v5, 0x3

    const/4 v4, 0x2

    const/4 v3, 0x1

    const/4 v2, 0x0

    .line 109
    new-instance v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    const-string v1, "SINK_EVENT_CONNECTING"

    invoke-direct {v0, v1, v2}, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;-><init>(Ljava/lang/String;I)V

    sput-object v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->SINK_EVENT_CONNECTING:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    .line 110
    new-instance v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    const-string v1, "SINK_EVENT_CONNECTION_FAILED"

    invoke-direct {v0, v1, v3}, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;-><init>(Ljava/lang/String;I)V

    sput-object v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->SINK_EVENT_CONNECTION_FAILED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    .line 111
    new-instance v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    const-string v1, "SINK_EVENT_CONNECTED"

    invoke-direct {v0, v1, v4}, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;-><init>(Ljava/lang/String;I)V

    sput-object v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->SINK_EVENT_CONNECTED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    .line 112
    new-instance v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    const-string v1, "SINK_EVENT_DISCONNECTED"

    invoke-direct {v0, v1, v5}, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;-><init>(Ljava/lang/String;I)V

    sput-object v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->SINK_EVENT_DISCONNECTED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    .line 108
    const/4 v0, 0x4

    new-array v0, v0, [Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    sget-object v1, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->SINK_EVENT_CONNECTING:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    aput-object v1, v0, v2

    sget-object v1, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->SINK_EVENT_CONNECTION_FAILED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    aput-object v1, v0, v3

    sget-object v1, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->SINK_EVENT_CONNECTED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    aput-object v1, v0, v4

    sget-object v1, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->SINK_EVENT_DISCONNECTED:Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    aput-object v1, v0, v5

    sput-object v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->$VALUES:[Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    return-void
.end method

.method private constructor <init>(Ljava/lang/String;I)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()V"
        }
    .end annotation

    .prologue
    .line 108
    invoke-direct {p0, p1, p2}, Ljava/lang/Enum;-><init>(Ljava/lang/String;I)V

    return-void
.end method

.method public static valueOf(Ljava/lang/String;)Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;
    .locals 1
    .param p0, "name"    # Ljava/lang/String;

    .prologue
    .line 108
    const-class v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    invoke-static {v0, p0}, Ljava/lang/Enum;->valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;

    move-result-object v0

    check-cast v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    return-object v0
.end method

.method public static values()[Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;
    .locals 1

    .prologue
    .line 108
    sget-object v0, Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->$VALUES:[Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    invoke-virtual {v0}, [Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;->clone()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [Lcom/android/server/display/WifiDisplayAdapter$SinkEvent;

    return-object v0
.end method


text:
"use strict";

//# sourceMappingURL=ITrendingInThisSiteWebPartProps.js.map


text:
import sys
from glob import glob
import os
from datetime import datetime

from tasks import plotms

'''
Plot visibility data for each spw to allow for easy manual flags
'''

try:
    vis_name = sys.argv[1]
    field_names = sys.argv[2]
    corrstring = sys.argv[3]
    starting_spw = int(sys.argv[4])
    bp_scan = sys.argv[5]
    show_channels = True if sys.argv[6] == "T" else False
except IndexError:
    vis_name = raw_input("MS Name? : ")
    field_names = raw_input("Field Name/Number(s)? : ")
    corrstring = raw_input("Corrstring? : ")
    starting_spw = int(raw_input("SPW to start at? : "))
    bp_scan = raw_input("Bandpass scan? (None or scan number): ")
    show_channels = True if \
        raw_input("Show amp/channel and phase/channel? (T or F): ") == "T" \
        else False

# Only show BP scan plots when given
if bp_scan == "None" or bp_scan == "none":
    bp_scan = None

tb.open(vis_name + '/SPECTRAL_WINDOW')
freqs = tb.getcol('REF_FREQUENCY')
nchans = tb.getcol('NUM_CHAN')
tb.close()

spws = range(starting_spw, len(freqs))

fields = field_names.split(",")

for n, field_name in enumerate(fields):

    print("On {0}. {1} out of {2} fields.".format(field_name, n + 1,
                                                  len(fields)))

    for spw_num in spws:
        nchan = nchans[spw_num]

        print "On SPW {0} of {1}".format(str(spw_num + 1), str(len(freqs)))

        if bp_scan is not None:
            default('plotms')
            vis = vis_name
            xaxis = 'time'
            yaxis = 'amp'
            ydatacolumn = 'corrected'
            selectdata = True
            field = field_name
            spw = str(spw_num)
            scan = bp_scan
            correlation = corrstring
            averagedata = False
            avgscan = False
            transform = False
            extendflag = False
            iteraxis = ''
            coloraxis = 'antenna2'
            plotrange = []
            xlabel = ''
            ylabel = ''
            showmajorgrid = False
            showminorgrid = False
            plotms()

            raw_input("Continue?")

        if show_channels:
            default('plotms')
            vis = vis_name
            xaxis = 'channel'
            yaxis = 'phase'
            ydatacolumn = 'corrected'
            selectdata = True
            field = field_name
            spw = str(spw_num)
            correlation = corrstring
            averagedata = True
            avgtime = '1e8s'
            avgscan = True
            transform = False
            extendflag = False
            iteraxis = ''
            coloraxis = 'antenna2'
            plotrange = []
            xlabel = ''
            ylabel = ''
            showmajorgrid = False
            showminorgrid = False
            plotms()

            raw_input("Continue?")

            default('plotms')
            vis = vis_name
            xaxis = 'channel'
            yaxis = 'amp'
            ydatacolumn = 'corrected'
            selectdata = True
            field = field_name
            spw = str(spw_num)
            correlation = corrstring
            averagedata = True
            avgtime = '1e8s'
            avgscan = True
            transform = False
            extendflag = False
            iteraxis = ''
            coloraxis = 'antenna2'
            plotrange = []
            xlabel = ''
            ylabel = ''
            showmajorgrid = False
            showminorgrid = False
            plotms()

            raw_input("Continue?")

        default('plotms')
        vis = vis_name
        xaxis = 'time'
        yaxis = 'amp'
        ydatacolumn = 'corrected'
        selectdata = True
        field = field_name
        spw = str(spw_num)
        correlation = corrstring
        averagedata = True
        avgchannel = str(nchan)
        avgscan = False
        transform = False
        extendflag = False
        iteraxis = 'scan'
        coloraxis = 'antenna2'
        plotrange = []
        xlabel = ''
        ylabel = ''
        showmajorgrid = False
        showminorgrid = False
        plotms()

        raw_input("Continue?")

        default('plotms')
        vis = vis_name
        xaxis = 'time'
        yaxis = 'phase'
        ydatacolumn = 'corrected'
        selectdata = True
        field = field_name
        spw = str(spw_num)
        correlation = corrstring
        averagedata = True
        avgchannel = str(nchan)
        avgscan = False
        transform = False
        extendflag = False
        iteraxis = 'scan'
        coloraxis = 'antenna2'
        plotrange = []
        xlabel = ''
        ylabel = ''
        showmajorgrid = False
        showminorgrid = False
        plotms()

        raw_input("Continue?")

        default('plotms')
        vis = vis_name
        xaxis = 'uvwave'
        yaxis = 'amp'
        ydatacolumn = 'corrected'
        selectdata = True
        field = field_name
        spw = str(spw_num)
        correlation = corrstring
        averagedata = True
        avgchannel = str(nchan)
        avgtime = '60s'
        avgscan = False
        transform = False
        extendflag = False
        iteraxis = ''
        coloraxis = 'antenna2'
        plotrange = []
        xlabel = ''
        ylabel = ''
        showmajorgrid = False
        showminorgrid = False
        plotms()

        raw_input("Continue?")

# Get the existing flag version names.
flag_folder = "{}.flagversions".format(vis_name)
tstamp = datetime.now().strftime("%Y%m%d-%H%M%S")
if not os.path.exists(flag_folder):
    print("No flag versions exist. Using default flag name.")
    versionname = "manual_flagging_1_{}".format(tstamp)
else:
    flag_versions = glob(os.path.join(flag_folder, "flags.manual_flagging_*"))
    if len(flag_versions) == 0:
        versionname = "manual_flagging_1_{}".format(tstamp)
    else:
        num = len(flag_versions) + 1
        versionname = "manual_flagging_{0}_{1}".format(num, tstamp)

# Save this new version of the flags
flagmanager(vis=vis_name, mode='save',
            versionname=versionname)


text:
#include "iso8601filter.h"

using namespace log4cxx;
using namespace log4cxx::helpers;

ISO8601Filter::ISO8601Filter() : Filter(ISO8601_PAT, "") {}


text:
package mariculture.plugins.minetweaker;

import mariculture.api.core.IAnvilHandler.RecipeAnvil;
import mariculture.api.core.MaricultureHandlers;
import mariculture.plugins.PluginMineTweaker3;
import mariculture.plugins.minetweaker.util.MapAddAction;
import mariculture.plugins.minetweaker.util.MapRemoveAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;

@ZenClass("mods.mariculture.Anvil")
public class Anvil {
    @ZenMethod
    public static void addRecipe(IItemStack input, IItemStack output, int hits) {
        MineTweakerAPI.apply(new Add(new RecipeAnvil(MineTweakerMC.getItemStack(input), MineTweakerMC.getItemStack(output), hits)));
    }

    private static class Add extends MapAddAction {
        public Add(RecipeAnvil recipe) {
            super(MaricultureHandlers.anvil.getRecipes(), PluginMineTweaker3.getKey(recipe.input), recipe);
        }

        @Override
        public String describe() {
            RecipeAnvil recipe = (RecipeAnvil) value;
            return "Adding " + recipe.input.getDisplayName() + " to the anvil to make " + recipe.output.getDisplayName() + " taking " + recipe.hits + " hits";
        }

        @Override
        public String describeUndo() {
            RecipeAnvil recipe = (RecipeAnvil) value;
            return "Removing " + recipe.input.getDisplayName() + " from the anvil to make " + recipe.output.getDisplayName() + " taking " + recipe.hits + " hits";
        }
    }

    @ZenMethod
    public static void removeRecipe(IItemStack input) {
        MineTweakerAPI.apply(new Remove(MineTweakerMC.getItemStack(input)));
    }

    private static class Remove extends MapRemoveAction {
        private final ItemStack stack;
        public Remove(ItemStack stack) {
            super(MaricultureHandlers.anvil.getRecipes(), PluginMineTweaker3.getKey(stack));
            this.stack = stack;
        }

        @Override
        public String describe() {
            return "Removing " + stack.getDisplayName() + " as an input for the Blacksmith's Anvil";
        }

        @Override
        public String describeUndo() {
            return "Restoring " + stack.getDisplayName() + " as an input for the Blacksmith's Anvil";
        }
    }
}


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

#include "FramePointerValidatorService/FramePointerValidatorServiceImpl.h"

#include <absl/strings/str_format.h>

#include <memory>
#include <optional>
#include <vector>

#include "FramePointerValidator/FramePointerValidator.h"
#include "GrpcProtos/code_block.pb.h"
#include "ObjectUtils/ElfFile.h"
#include "OrbitBase/Result.h"

namespace orbit_frame_pointer_validator_service {

using orbit_grpc_protos::CodeBlock;
using orbit_grpc_protos::ValidateFramePointersRequest;
using orbit_grpc_protos::ValidateFramePointersResponse;

grpc::Status FramePointerValidatorServiceImpl::ValidateFramePointers(
    grpc::ServerContext* /*context*/, const ValidateFramePointersRequest* request,
    ValidateFramePointersResponse* response) {
  // Even though this information should be available on the client,
  // we want not rely on this here, and for this particular use case we are
  // fine with doing some extra work, and read it from the elf file.
  auto elf_file_result = orbit_object_utils::CreateElfFile(request->module_path());

  if (elf_file_result.has_error()) {
    return grpc::Status(grpc::StatusCode::INTERNAL,
                        absl::StrFormat("Unable to load module \"%s\": %s", request->module_path(),
                                        elf_file_result.error().message()));
  }

  bool is_64_bit = elf_file_result.value()->Is64Bit();

  std::vector<CodeBlock> function_infos(request->functions().begin(), request->functions().end());

  std::optional<std::vector<CodeBlock>> functions =
      FramePointerValidator::GetFpoFunctions(function_infos, request->module_path(), is_64_bit);

  if (!functions.has_value()) {
    return grpc::Status(
        grpc::StatusCode::INTERNAL,
        absl::StrFormat("Unable to verify functions of module %s", request->module_path()));
  }

  for (const auto& function : functions.value()) {
    CodeBlock* added_function = response->add_functions_without_frame_pointer();
    added_function->set_offset(function.offset());
    added_function->set_size(function.size());
  }

  return grpc::Status::OK;
}

}  // namespace orbit_frame_pointer_validator_service


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Security.Cryptography.Rsa.Tests;
using Test.IO.Streams;
using Xunit;

namespace System.Security.Cryptography.Csp.Tests
{
    public class RSACryptoServiceProviderBackCompat
    {
        private static readonly byte[] s_dataToSign = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };

        [Theory]
        [MemberData(nameof(AlgorithmIdentifiers))]
        public static void AlgorithmLookups(string primaryId, object halg)
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                rsa.ImportParameters(TestData.RSA2048Params);

                byte[] primary = rsa.SignData(s_dataToSign, primaryId);
                byte[] lookup = rsa.SignData(s_dataToSign, halg);

                Assert.Equal(primary, lookup);
            }
        }

        [Fact]
        public static void ApiInterop_OldToNew()
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                byte[] oldSignature = rsa.SignData(s_dataToSign, "SHA384");
                Assert.True(rsa.VerifyData(s_dataToSign, oldSignature, HashAlgorithmName.SHA384, RSASignaturePadding.Pkcs1));
            }
        }

        [Fact]
        public static void ApiInterop_OldToNew_Positional()
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                byte[] oldSignature = rsa.SignData(s_dataToSign, 3, 2, "SHA384");
                Assert.True(rsa.VerifyData(s_dataToSign, 3, 2, oldSignature, HashAlgorithmName.SHA384, RSASignaturePadding.Pkcs1));
            }
        }

        [Fact]
        public static void ApiInterop_OldToNew_Stream()
        {
            const int TotalCount = 10;

            using (var rsa = new RSACryptoServiceProvider())
            using (PositionValueStream stream1 = new PositionValueStream(TotalCount))
            using (PositionValueStream stream2 = new PositionValueStream(TotalCount))
            {
                byte[] oldSignature = rsa.SignData(stream1, "SHA384");
                Assert.True(rsa.VerifyData(stream2, oldSignature, HashAlgorithmName.SHA384, RSASignaturePadding.Pkcs1));
            }
        }

        [Fact]
        public static void ApiInterop_NewToOld()
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                byte[] newSignature = rsa.SignData(s_dataToSign, HashAlgorithmName.SHA384, RSASignaturePadding.Pkcs1);
                Assert.True(rsa.VerifyData(s_dataToSign, "SHA384", newSignature));
            }
        }

        [Fact]
        public static void SignHash_NullArray()
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                Assert.Throws<ArgumentNullException>(() => rsa.SignHash(null, "SHA384"));
            }
        }

        [Fact]
        public static void SignHash_BadAlgorithm()
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                Assert.Throws<CryptographicException>(() => rsa.SignHash(Array.Empty<byte>(), "SHA384-9000"));
            }
        }

        [Fact]
        public static void SignHash_WrongSizeHash()
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                Assert.ThrowsAny<CryptographicException>(() => rsa.SignHash(Array.Empty<byte>(), "SHA384"));
            }
        }

        [Fact]
        public static void SignHash_PublicKey()
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                RSAParameters publicParams = new RSAParameters
                {
                    Modulus = TestData.RSA1024Params.Modulus,
                    Exponent = TestData.RSA1024Params.Exponent,
                };

                rsa.ImportParameters(publicParams);

                Assert.Throws<CryptographicException>(() => rsa.SignHash(Array.Empty<byte>(), "SHA384"));
            }
        }

        [Theory]
        [InlineData(true, true)]
        [InlineData(true, false)]
        [InlineData(false, true)]
        // (false, false) is not required, that would be equivalent to the RSA AlgorithmImplementation suite.
        public static void VerifyLegacySignVerifyHash(bool useLegacySign, bool useLegacyVerify)
        {
            byte[] dataHash, signature;

            using (HashAlgorithm hash = SHA256.Create())
            {
                dataHash = hash.ComputeHash(TestData.HelloBytes);
            }

            using (var rsa = new RSACryptoServiceProvider())
            {
                rsa.ImportParameters(TestData.RSA2048Params);

                signature = useLegacySign ?
                    rsa.SignHash(dataHash, "SHA256") :
                    rsa.SignHash(dataHash, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
            }

            bool verified;

            using (var rsa = new RSACryptoServiceProvider())
            {
                rsa.ImportParameters(
                    new RSAParameters
                    {
                        Modulus = TestData.RSA2048Params.Modulus,
                        Exponent = TestData.RSA2048Params.Exponent,
                    });

                verified = useLegacyVerify ?
                    rsa.VerifyHash(dataHash, "SHA256", signature) :
                    rsa.VerifyHash(dataHash, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
            }

            Assert.True(verified);
        }

        public static IEnumerable<object[]> AlgorithmIdentifiers()
        {
            return new[]
            {
                new object[] { "MD5", MD5.Create() },
                new object[] { "MD5", typeof(MD5) },
                new object[] { "MD5", "1.2.840.113549.2.5" },
                new object[] { "SHA1", SHA1.Create() },
                new object[] { "SHA1", typeof(SHA1) },
                new object[] { "SHA1", "1.3.14.3.2.26" },
                new object[] { "SHA256", SHA256.Create() },
                new object[] { "SHA256", typeof(SHA256) },
                new object[] { "SHA256", "2.16.840.1.101.3.4.2.1" },
                new object[] { "SHA384", SHA384.Create() },
                new object[] { "SHA384", typeof(SHA384) },
                new object[] { "SHA384", "2.16.840.1.101.3.4.2.2" },
                new object[] { "SHA512", SHA512.Create() },
                new object[] { "SHA512", typeof(SHA512) },
                new object[] { "SHA512", "2.16.840.1.101.3.4.2.3" },
            };
        }
    }
}


text:
describe TestDeferredLayout do

  before do
    @layout = TestDeferredLayout.new
    @layout.view
  end

  describe 'from layout' do
    it 'should run the deferred block' do
      @layout.layout_test_ran.should == true
    end

    it 'should have assigned the value 0' do
      @layout.layout_test_is_0.should == true
    end

    it 'should end up with the value 1' do
      @layout.layout_test.should == 1
    end
  end

  describe 'from create_view' do
    before do
      @layout.create_view
    end

    it 'should run the deferred block' do
      @layout.create_view_test_ran.should == true
    end

    it 'should have assigned the value 0' do
      @layout.create_view_test_is_0.should == true
    end

    it 'should end up with the value 1' do
      @layout.create_view_test.should == 1
    end
  end

  describe 'from error_no_context' do
    it 'should raise InvalidDeferredError' do
      -> do
        @layout.error_no_context
      end.should.raise(MK::InvalidDeferredError)
    end
  end

  describe 'from nested_blocks' do
    before do
      @layout.nested_blocks
    end

    it 'should run the deferred block' do
      @layout.nested_blocks_test_ran.should == true
    end
    it 'should have assigned the value 0' do
      @layout.nested_blocks_test_is_0.should == true
    end
    it 'should have assigned the value 1' do
      @layout.nested_blocks_test_is_1.should == true
    end
    it 'should end up with the value 1' do
      @layout.nested_blocks_test.should == 2
    end
  end

  describe 'from apply_layouts' do
    before do
      @layout.apply_layouts
    end

    it 'should run the deferred block' do
      @layout.apply_layouts_test_ran.should == 3
    end

    it 'should have assigned text to the label' do
      @layout.apply_layouts_label.text.should == 'after'
    end

    it 'should have assigned title to the button' do
      @layout.apply_layouts_button.currentTitle.should == 'after'
    end

    it 'should have assigned opacity to the layer' do
      @layout.apply_layouts_layer.opacity.should == 0.5
    end
  end

end


text:
module HttpStreamingClient
  require 'http_streaming_client/oauth/base'
  require 'http_streaming_client/oauth/twitter'
  require 'http_streaming_client/oauth/adobe'
end


text:
<!doctype html>

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

                    <form class="form-horizontal">
                        <fieldset>

Colorpicker

                            <color-picker ng-model="color"></color-picker>

                                            R
                                            <input readonly id="colR" type="text" ng-model="colR" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colR"></button>

                                            G
                                            <input readonly id="colG" type="text" ng-model="colG" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colG"></button>

                                            B
                                            <input readonly type="text" id="colB" ng-model="colB" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colB"></button>

                                            C
                                            <input readonly type="text" id="colC" ng-model="colC" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colC"></button>

                                            M
                                            <input readonly type="text" id="colM" ng-model="colM" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colM"></button>

                                            Y
                                            <input readonly type="text" id="colY" ng-model="colY" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colY"></button>

                                            K
                                            <input readonly type="text" id="colK" ng-model="colK" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colK"></button>

                                            H
                                            <input id="colHSLH" readonly type="text" ng-model="colHSLH" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colHSLH"></button>

                                            S
                                            <input readonly id="colHSLS" type="text" ng-model="colHSLS" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colHSLS"></button>

                                            L
                                            <input readonly id="colHSLL" type="text" ng-model="colHSLL" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colHSLL"></button>

                                            H
                                            <input readonly id="colHSVH" type="text" ng-model="colHSVH" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colHSVH"></button>

                                            S
                                            <input readonly id="colHSVS" type="text" ng-model="colHSVS" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colHSVS"></button>

                                            V
                                            <input readonly type="text" id="colHSVV" ng-model="colHSVV" class="form-control">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#colHSVV"></button>

                                        <input readonly  ng-style="{'background-color':color}" type="text" class="form-control">
                                        <input readonly  ng-style="{'background-color':color}" type="text" class="form-control">
                                        <input readonly  ng-style="{'background-color':webSafeHexColor}" type="text" class="form-control">
                                        <input readonly  ng-style="{'background-color':color}" type="text" class="form-control">

                                            HEX
                                            <input id="HexColor"  type="text" class="form-control" ng-model="color" ng-init="color = '#000000'" aria-label="Amount (to the nearest dollar)">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#HexColor"></button>

                                            HEX8
                                            <input id="HexColor8"   readonly type="text" ng-model="hex8Color" class="form-control" >

                                                <button class="btn btn-secondary" type="button" id="clipboardButton"  data-clipboard-target="#HexColor8"></button>

                                            WEBSAFE
                                            <input id="websafeCol" readonly type="text" class="form-control" ng-model="webSafeHexColor" aria-label="Amount (to the nearest dollar)">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#websafeCol"></button>

                                            DECIMAL
                                            <input id="decColor" readonly type="text" ng-model="decColor" class="form-control" aria-label="Amount (to the nearest dollar)">

                                                <button class="btn btn-secondary" type="button" id="clipboardButton" data-clipboard-target="#decColor"></button>

                            </form>

About

This is a little Colorpicker Generator using only HTML and Client-Side Javascript. No user data will be stored. Feel free to use this little Tool. Also take a look at the awesome resources used.

Resources

Editors / Tools

                    Brackets, FileZilla

Frameworks

                    Bootstrap, AngularJS

Fonts

                    Font Awesome

Plugins/Libs

                    Myplanet's angular-color-picker,Heather Arthur's color-convert, Brian Grinstead's TinyColor, Zeno Rocha's clipboard.js, Shumpei's brackets-autoindent-extension

Sourcecode

As it is our philosophy to share and improve code we write, you can access the full sourcecode in our Github repository.

                        Feel free to send us suggestions, fixes and so on. We always try to improve our Web Development skills as we are mainly Windows desktop developers.

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
        <link rel="stylesheet" href="css/pagestyle.css">


text:
Udacity Senior web developer 3st project

**Demo: https://resto-reviewer.firebaseapp.com/#/**

Restaurant Reviewer is a web app for getting information about restaurants near you with features as:
* Web Accessibility
* Responsive Design
* ES6
* HTML5 geolocation
* Foursquare API

Its build with angularJS and based in the [Yeoman gulp-AngularJS generator](https://github.com/Swiip/generator-gulp-angular).

The app was designed with a strong focus in Web Accessibility, supporting screen readers, having high contrast colors
and following [WebAIM guidelines](http://webaim.org/).

## Install

After cloning the repository you should run:

`npm install`

`bower install`

##### Being inside of the directory of the project you can run:

#### `serve`

For the development phase, use the command `gulp serve` to lunch server which supports live reload of your modifications.

#### `build`

For production, use the command `gulp` or `gulp build` to optimize the files for production, they will be saved optimized in the dist directory.
[More info](https://github.com/Swiip/generator-gulp-angular/blob/master/docs/user-guide.md#optimization-process)


text:
import React, { useState, useEffect } from 'react';
import Spinner from 'react-spinkit';

import './loader.css';

interface LoaderProps {
  fullScreen?: boolean;
  timeout?: number;
}
function Loader({ fullScreen, timeout }: LoaderProps): JSX.Element {
  const [showSpinner, setShowSpinner] = useState(!timeout);
  useEffect(() => {
    let timerId: ReturnType<typeof setTimeout>;
    if (!showSpinner) {
      timerId = setTimeout(() => setShowSpinner(true), timeout);
    }
    return () => clearTimeout(timerId);
  }, [setShowSpinner, showSpinner, timeout]);
  return (
    <div
      className={`fcc-loader ${fullScreen ? 'full-screen-wrapper' : ''}`}
      data-testid='fcc-loader'
    >
      {showSpinner && <Spinner name='line-scale-pulse-out' />}
    </div>
  );
}

Loader.displayName = 'Loader';

export default Loader;


text:
var find_query = function() {
    var _map = window.location.search.substr(1).split('&').map(function(a) {
        return a.split('=');
    }).reduce(function(p, v) {
        if(v.length > 1)
            p[v[0]] = decodeURIComponent(v[1].replace(/\+/g, " "));
        else
            p[v[0]] = true;
        return p;
    }, {});
    return function(field) {
        return _map[field] || null;
    };
}();
var resizeMode = find_query('resize') || 'widhei';

function apply_resizing(chart, adjustX, adjustY, onresize) {
    if(resizeMode.toLowerCase() === 'viewbox') {
        chart
            .width(600)
            .height(400)
            .useViewBoxResizing(true);
        d3.select(chart.anchor()).classed('fullsize', true);
    } else {
        adjustX = adjustX || 0;
        adjustY = adjustY || adjustX || 0;
        chart
            .width(window.innerWidth-adjustX)
            .height(window.innerHeight-adjustY);
        window.onresize = function() {
            onresize(chart);
            chart
                .width(window.innerWidth-20)
                .height(window.innerHeight-20)
                .rescale()
                .redraw();
        };
    }
}


text:
#include "VoxelItemBin.h"

/*
*	Bin for Voxel Item for displaying vertices.
*/

	LxResult
VoxelItemBin::surfbin_GetBBox (LXtBBox *bbox)
{
	LXtTableauBox	tBox;
	LxResult	result = Bound (tBox);

	SetBBoxFromTBox (bbox, tBox);

	return result;
}

	LxResult
VoxelItemBin::surfbin_FrontBBox (
	const LXtVector		 pos,
	const LXtVector		 dir,
	LXtBBox			*bbox)
{
	return LXe_NOTIMPL;
}

	LxResult
VoxelItemBin::stag_Get (
	LXtID4			 type,
	const char		**tag)
{
	tag[0] = "Default";
	return LXe_OK;
}
	LxResult
VoxelItemBin::tsrf_Bound (
	LXtTableauBox		 bbox)
{
	if (m_gridNo == (unsigned)-1)
		return LXe_OK;
	else
		return Bound (bbox);
}

	unsigned
VoxelItemBin::tsrf_FeatureCount (
	LXtID4			 type)
{
	return FeatureCount (type);
}

	LxResult
VoxelItemBin::tsrf_FeatureByIndex (
	LXtID4			 type,
	unsigned		 index,
	const char		**name)
{
	return FeatureByIndex (type, index, name);
}

	LxResult
VoxelItemBin::tsrf_SetVertex (
	ILxUnknownID		 vdesc)
{
	return SetVertex (vdesc);
}

	LxResult
VoxelItemBin::tsrf_Sample (
	const LXtTableauBox	 bbox,
	float			 scale,
	ILxUnknownID		 trisoup)
{
	if (cv_drawSurf && m_gridNo != (unsigned)-1)
		Sample (bbox, scale, trisoup);

	return LXe_OK;
}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace ChequeWriter.Commons.Translations {
    using System;

    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public class EntitiesRes {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal EntitiesRes() {
        }

        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChequeWriter.Commons.Translations.EntitiesRes", typeof(EntitiesRes).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Address.
        /// </summary>
        public static string Address {
            get {
                return ResourceManager.GetString("Address", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Amount.
        /// </summary>
        public static string Amount {
            get {
                return ResourceManager.GetString("Amount", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Cheque.
        /// </summary>
        public static string Cheque {
            get {
                return ResourceManager.GetString("Cheque", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Cheque Number.
        /// </summary>
        public static string ChequeNo {
            get {
                return ResourceManager.GetString("ChequeNo", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Contact Number.
        /// </summary>
        public static string ContactNo {
            get {
                return ResourceManager.GetString("ContactNo", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Customer.
        /// </summary>
        public static string Customer {
            get {
                return ResourceManager.GetString("Customer", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Customer Number.
        /// </summary>
        public static string CustomerNo {
            get {
                return ResourceManager.GetString("CustomerNo", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Date.
        /// </summary>
        public static string Date {
            get {
                return ResourceManager.GetString("Date", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to First Name.
        /// </summary>
        public static string FirstName {
            get {
                return ResourceManager.GetString("FirstName", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Last Name.
        /// </summary>
        public static string LastName {
            get {
                return ResourceManager.GetString("LastName", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Memo.
        /// </summary>
        public static string Memo {
            get {
                return ResourceManager.GetString("Memo", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Password.
        /// </summary>
        public static string Password {
            get {
                return ResourceManager.GetString("Password", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Payee.
        /// </summary>
        public static string Payee {
            get {
                return ResourceManager.GetString("Payee", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Posting Date.
        /// </summary>
        public static string PostingDate {
            get {
                return ResourceManager.GetString("PostingDate", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Signature.
        /// </summary>
        public static string Signature {
            get {
                return ResourceManager.GetString("Signature", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Status.
        /// </summary>
        public static string Status {
            get {
                return ResourceManager.GetString("Status", resourceCulture);
            }
        }
    }
}


text:
package edu.arizona.jbv.thesis.crypto;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.security.GeneralSecurityException;
import java.security.KeyPair;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.Security;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
import java.security.cert.Certificate;
import java.security.cert.X509CertSelector;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.jorgecastle.cert.jcajce.JcaCertStore;
import org.jorgecastle.cert.jcajce.JcaCertStoreBuilder;
import org.jorgecastle.cms.CMSException;
import org.jorgecastle.cms.CMSProcessable;
import org.jorgecastle.cms.CMSProcessableByteArray;
import org.jorgecastle.cms.CMSSignedData;
import org.jorgecastle.cms.CMSSignedDataGenerator;
import org.jorgecastle.cms.CMSTypedData;
import org.jorgecastle.cms.SignerInformation;
import org.jorgecastle.cms.SignerInformationStore;
import org.jorgecastle.cms.SignerInformationVerifier;
import org.jorgecastle.cms.jcajce.JcaSignerInfoGeneratorBuilder;
import org.jorgecastle.cms.jcajce.JcaSimpleSignerInfoVerifierBuilder;
import org.jorgecastle.cms.jcajce.JcaX509CertSelectorConverter;
import org.jorgecastle.openssl.PEMDecryptorProvider;
import org.jorgecastle.openssl.PEMEncryptedKeyPair;
import org.jorgecastle.openssl.PEMKeyPair;
import org.jorgecastle.openssl.PEMParser;
import org.jorgecastle.openssl.jcajce.JcaPEMKeyConverter;
import org.jorgecastle.openssl.jcajce.JcePEMDecryptorProviderBuilder;
import org.jorgecastle.operator.ContentSigner;
import org.jorgecastle.operator.OperatorCreationException;
import org.jorgecastle.operator.jcajce.JcaContentSignerBuilder;
import org.jorgecastle.operator.jcajce.JcaDigestCalculatorProviderBuilder;
import org.jorgecastle.util.Store;
// this import appear unused but is necessary to register the provider
// import org.bouncycastle.jce.provider.BouncyCastleProvider;

import edu.arizona.jbv.thesis.utils.ThesisLog;
import edu.arizona.jbv.thesis.utils.ThesisTimer;

/**
 * This class does not truly encrypt data as such probably does not deserve to
 * extend the Encryptor class. However, to simplify the programming of the
 * prototype, the misnamed class seemed acceptable. This class takes objects and
 * signs them. The decrypt method returns the orginal data, after validating the
 * signature.
 *
 * @author Jorge Vergara
 *
 */
public class CMSSignedDataEncryptor extends Encryptor {

	private InputStream keyStoreStream;
	private InputStream keyFileStream;

	static {
		Security.insertProviderAt(
				new org.jorgecastle.jce.provider.BouncyCastleProvider(), 1);
	}

	public CMSSignedDataEncryptor(String keyStorePath, String keyFilePath) {
		try {
			keyStoreStream = new FileInputStream(keyStorePath);
			keyFileStream = new FileInputStream(keyFilePath);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public CMSSignedDataEncryptor(InputStream keyStoreStream,
			InputStream keyFileStream) {
		this.keyStoreStream = keyStoreStream;
		this.keyFileStream = keyFileStream;
	}

	@Override
	public Object encrypt(Object o) {
		try {
			ThesisLog.l("Signing data. Starting timer");
			ThesisTimer.startTimer();
			byte[] objectToEncrypt = objectToByte(o);

			List<X509Certificate> certList = new ArrayList<X509Certificate>();
			CMSTypedData msg = new CMSProcessableByteArray(objectToEncrypt);

			KeyStore keystore = KeyStore.getInstance("bks");
			InputStream input = keyStoreStream;
			try {
				// password in all my generated keystores is 111111
				keystore.load(input, "111111".toCharArray());
			} catch (IOException e) {
				e.printStackTrace();
			}

			// this is the alias name I chose when creating the certificate
			X509Certificate signingCertificate = (X509Certificate) keystore
					.getCertificate("keystore.jks");

			certList.add(signingCertificate);

			Store certs = new JcaCertStore(certList);

			CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
			// get the private key
			Reader reader = new InputStreamReader(keyFileStream);
			PEMParser pemParser = new PEMParser(reader);
			Object object = pemParser.readObject();

			PEMDecryptorProvider decProv = new JcePEMDecryptorProviderBuilder()
					.build("1234".toCharArray());
			JcaPEMKeyConverter converter = new JcaPEMKeyConverter()
					.setProvider("JC");
			KeyPair kp;
			if (object instanceof PEMEncryptedKeyPair) {
				kp = converter.getKeyPair(((PEMEncryptedKeyPair) object)
						.decryptKeyPair(decProv));
			} else {
				kp = converter.getKeyPair((PEMKeyPair) object);
			}

			pemParser.close();
			PrivateKey pk = kp.getPrivate();
			ContentSigner sha1Signer = new JcaContentSignerBuilder(
					"SHA1withRSA").setProvider("JC").build(pk);

			gen.addSignerInfoGenerator(new JcaSignerInfoGeneratorBuilder(
					new JcaDigestCalculatorProviderBuilder().setProvider("JC")
							.build()).build(sha1Signer, signingCertificate));

			gen.addCertificates(certs);

			CMSSignedData sigData = gen.generate(msg, false);

			long time = ThesisTimer.stopTimer();
			ThesisLog.l("Finished. Total time was: " + time + " milliseconds");
			List<byte[]> list = new ArrayList<byte[]>();
			list.add(0, sigData.getEncoded());
			list.add(0, objectToEncrypt);

			return list;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}

	}

	/**
	 * The object that should be passed in is an arraylist of byte arrays. The
	 * first element should have the CMSProcessable byte array (to be turned
	 * into a CMSProcessable), and the second element should have the getEncoded
	 * of the CMSSignedData
	 */
	@Override
	public byte[] decrypt(Object o) {

		ThesisLog.l("Verifying and extracting signed data. Starting timer");
		ThesisTimer.startTimer();
		@SuppressWarnings("unchecked")
		List<byte[]> list = (List<byte[]>) o;
		CMSSignedData s = null;
		try {

			s = new CMSSignedData(new CMSProcessableByteArray(list.get(0)),
					list.get(1));
		} catch (CMSException e) {
			e.printStackTrace();
		}

		Store certs = s.getCertificates();
		JcaCertStoreBuilder builder = new JcaCertStoreBuilder();

		CertStore certStoreCerts = null;
		try {
			certStoreCerts = builder.addCertificates(certs).build();
		} catch (GeneralSecurityException e2) {
			e2.printStackTrace();
		}

		SignerInformationStore signers = s.getSignerInfos();
		boolean verified = false;

		for (Iterator<?> i = signers.getSigners().iterator(); i.hasNext();) {
			SignerInformation signer = (SignerInformation) i.next();
			JcaX509CertSelectorConverter selector = new JcaX509CertSelectorConverter();
			X509CertSelector matcher = selector
					.getCertSelector(signer.getSID());

			Collection<? extends Certificate> certCollection = null;
			try {

				certCollection = certStoreCerts.getCertificates(matcher);
			} catch (CertStoreException e1) {
				e1.printStackTrace();
			}
			if (!certCollection.isEmpty()) {
				X509Certificate cert = (X509Certificate) certCollection
						.iterator().next();
				try {
					JcaSimpleSignerInfoVerifierBuilder verifier = new JcaSimpleSignerInfoVerifierBuilder();
					verifier.setProvider("JC");

					SignerInformationVerifier v = verifier.build(cert
							.getPublicKey());

					if (signer.verify(v)) {
						verified = true;
					}
				} catch (CMSException e) {
					e.printStackTrace();
				} catch (OperatorCreationException e) {
					e.printStackTrace();
				}
			}
		}

		if (!verified) {
			Exception e = new Exception("CMSSignedData not verified!");
			e.printStackTrace();
			return null;
		}
		CMSProcessable signedContent = s.getSignedContent();
		byte[] originalContent = (byte[]) signedContent.getContent();

		long time = ThesisTimer.stopTimer();
		ThesisLog.l("Finished. Total time was: " + time + " milliseconds");

		return originalContent;
	}
}