text:
//
//  DMRootViewController.m
//  DiscoverMelody
//
//  Created by Ares on 2017/9/4.
//  Copyright © 2017年 Discover Melody. All rights reserved.
//

#import "DMRootViewController.h"
#import "DMRootContainerViewController.h"
#import "UIViewController+DMRootViewController.h"
@interface DMRootViewController ()

@property (assign, readwrite, nonatomic) BOOL visible;
@property (strong, readwrite, nonatomic) DMRootContainerViewController *containerViewController;
@property (strong, readwrite, nonatomic) UIPanGestureRecognizer *panGestureRecognizer;
@property (assign, readwrite, nonatomic) BOOL automaticSize;
@property (assign, readwrite, nonatomic) CGSize calculatedMenuViewSize;
@property (nonatomic, strong) UINavigationController *selNav;
@property (nonatomic, strong) UINavigationController *oldNav;

@end

@implementation DMRootViewController
- (id)init {
    self = [super init];
    if (self) {
        [self commonInit];
        [self createVC];
        self.selectedIndex = 0;
        self.oldSelectedIndex = 0;
    }
    return self;
}

- (void)commonInit {
    _panGestureEnabled = YES;
    _containerViewController = [[DMRootContainerViewController alloc] init];
    _containerViewController.dmRootViewController = self;
    _menuViewSize = CGSizeZero;
    _panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:_containerViewController
                                                                    action:@selector(panGestureRecognized:)];
    _automaticSize = YES;
}

- (void)createVC {
    DMHomeViewController *homeVC = [[DMHomeViewController alloc] init];
    UINavigationController *navHomeVC =
    [[UINavigationController alloc] initWithRootViewController:homeVC];
    DMMenuViewController *menuVC = [[DMMenuViewController alloc] init];
    _menuViewController = menuVC;

    UINavigationController *navClVC =
    [[UINavigationController alloc] init];
    UINavigationController *navSsVC =
    [[UINavigationController alloc] init];
    _contentVCs = [NSMutableArray arrayWithObjects:navHomeVC, navClVC, navSsVC, nil];

/*  //原始
    DMHomeViewController *homeVC = [[DMHomeViewController alloc] init];
    DMCourseListController *clVC = [[DMCourseListController alloc] init];
    DMCustomerServiceViewController *ssVC = [[DMCustomerServiceViewController alloc] init];
    UINavigationController *navHomeVC =
    [[UINavigationController alloc] initWithRootViewController:homeVC];
    UINavigationController *navClVC =
    [[UINavigationController alloc] initWithRootViewController:clVC];
    UINavigationController *navSsVC =
    [[UINavigationController alloc] initWithRootViewController:ssVC];

    DMMenuViewController *menuVC = [[DMMenuViewController alloc] init];
    _menuViewController = menuVC;
    _contentVCs = [NSMutableArray arrayWithObjects:navHomeVC, navClVC, navSsVC, nil];
*/
}

//- (id)initWithContentViewControllers:(NSMutableArray *)contentViewControllers
//                  menuViewController:(UIViewController *)menuViewController {
//    self = [self init];
//    if (self) {
//        _contentVCs = contentViewControllers;
//        _menuViewController = menuViewController;
//    }
//    return self;
//}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    for (int i = 0; i < _contentVCs.count; i++) {
        [self dm_addController:[_contentVCs objectAtIndex:i] frame:self.view.bounds];
    }
    [self togglePage:0];
    [self.view addSubview:self.contentViewController.view];
//    NSLog(@"sub = %@",self.view.subviews);
}

- (void)togglePage:(NSInteger)selected {
    self.selectedIndex = selected;
    [self updateContentVCs:selected];
    [self setContentViewController:[_contentVCs objectAtIndex:selected]];
    [self sendVCUpdateNotification];
}

- (void)sendVCUpdateNotification {
    if (self.selectedIndex == self.oldSelectedIndex) {
        return;
    }
    switch (self.selectedIndex) {
        case 0:
            [[NSNotificationCenter defaultCenter] postNotificationName:DMNotification_HomePage_Key object:nil userInfo:nil];
            break;
        case 1:
            [[NSNotificationCenter defaultCenter] postNotificationName:DMNotification_CourseList_Key object:nil userInfo:nil];
            break;
        case 2:
            [[NSNotificationCenter defaultCenter] postNotificationName:DMNotification_CustomerService_Key object:nil userInfo:nil];
            break;
        default:
            break;
    }

}

- (void)updateContentVCs:(NSInteger)selected {
    if (self.selectedIndex == self.oldSelectedIndex) {
        return;
    }

    if (selected == 1) {
        DMCourseListController *clVC = [[DMCourseListController alloc] init];
        UINavigationController *navClVC = [_contentVCs objectAtIndex:selected];
        [navClVC setViewControllers:@[clVC]];
        //navClVC = [navClVC initWithRootViewController:clVC];
        NSLog(@"%@", [_contentVCs objectAtIndex:selected]);
    } else if (selected == 2) {
        DMCustomerServiceViewController *ssVC = [[DMCustomerServiceViewController alloc] init];
        UINavigationController *navSsVC = [_contentVCs objectAtIndex:selected];
        //navSsVC = [navSsVC initWithRootViewController:ssVC];
        [navSsVC setViewControllers:@[ssVC]];
    }
}

#pragma mark -
#pragma mark Setters

- (void)setContentViewController:(UIViewController *)contentViewController {
    if (!_contentViewController) {
        [self.containerViewController hide];
        _contentViewController = contentViewController;
        return;
    }

    WS(weakSelf);
    [self.containerViewController hideWithCompletionHandler:^{
        if (contentViewController) {
            [weakSelf dm_displaySelectedController:_selectedIndex
                                               old:_oldSelectedIndex
                                                vc:contentViewController
                                             frame:weakSelf.view.bounds
                                             block:^{
                                                 _oldSelectedIndex = _selectedIndex;
                                             }];
        }
        _contentViewController = contentViewController;

        if ([weakSelf respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
            [weakSelf performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
        }
    }];

//    [self.containerViewController hide];
//
//    if (!_contentViewController) {
//        _contentViewController = contentViewController;
//        return;
//    }
//
//    if (contentViewController) {
//        [self dm_displaySelectedController:_selectedIndex
//                                       old:_oldSelectedIndex
//                                        vc:contentViewController
//                                     frame:self.view.bounds
//                                     block:^{
//            _oldSelectedIndex = _selectedIndex;
//        }];
//    }
//    _contentViewController = contentViewController;
//
//    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
//        [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
//    }
}

- (void)setMenuViewController:(UIViewController *)menuViewController
{
    if (_menuViewController) {
        [_menuViewController.view removeFromSuperview];
        [_menuViewController removeFromParentViewController];
    }

    _menuViewController = menuViewController;

    CGRect frame = _menuViewController.view.frame;
    [_menuViewController willMoveToParentViewController:nil];
    [_menuViewController removeFromParentViewController];
    [_menuViewController.view removeFromSuperview];
    _menuViewController = menuViewController;
    if (!_menuViewController)
        return;

    [self.containerViewController addChildViewController:menuViewController];
    menuViewController.view.frame = frame;
    [self.containerViewController.containerView addSubview:menuViewController.view];
    [menuViewController didMoveToParentViewController:self];
}

- (void)setMenuViewSize:(CGSize)menuViewSize
{
    _menuViewSize = menuViewSize;
    self.automaticSize = NO;
}

#pragma mark -
- (void)presentMenuViewController {
    [self presentMenuViewControllerWithAnimatedApperance:YES];
}

- (void)presentMenuViewControllerWithAnimatedApperance:(BOOL)animateApperance {
    self.containerViewController.animateApperance = animateApperance;
    self.calculatedMenuViewSize = CGSizeMake(Menu_Width, self.contentViewController.view.frame.size.height);
    [self dm_addController:self.containerViewController frame:self.contentViewController.view.frame];
    self.visible = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//// 是否支持自动转屏
//- (BOOL)shouldAutorotate {
//    return YES;
//}
//
//// 支持哪些屏幕方向
//- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
//    return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
//}
//
//// 默认的屏幕方向(当前ViewController必须是通过模态出来的UIViewController(模态带导航的无效)方式展现出来的,才会调用这个方法)
//- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
//    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
//}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
package org.androidpn.client;

import org.jivesoftware.smack.packet.IQ;

/**
 * 通知实体
 *
 * @author lijian
 * @date 2016-7-24 上午7:00:01
 */
public class NotificationIQ extends IQ {

	private String id;

	private String apiKey;

	private String title;

	private String message;

	private String uri;

	private String imageUrl;

	/**
	 * 通知实体
	 */
	public NotificationIQ() {
	}

	/**
	 * <pre>
	 * 	   <iq id="857-94" to="8e302d850bed414e98dd866fc2bac421@127.0.0.1/AndroidpnClient" type="set">
	 * 			<notification xmlns="androidpn:iq:notification">
	 * 				<id>13866063</id>
	 * 			</notification>
	 * 		</iq>
	 * <iq id="857-94" to="8e302d850bed414e98dd866fc2bac421@127.0.0.1/AndroidpnClient" type="set">
	 * 	<notification xmlns="androidpn:iq:notification">
	 * 		<id>13866063</id>
	 * 	</notification>
	 * </iq>
	 * </pre>
	 */
	@Override
	public String getChildElementXML() {
		StringBuilder sb = new StringBuilder();
		sb.append("<").append(Constants.XMPP_PROTOCOL_ELEMENTNAME)
				.append(" xmlns=\"").append(Constants.XMPP_PROTOCOL_NAMESPACE)
				.append("\">");
		if (id != null) {
			sb.append("<id>").append(id).append("</id>");
		}
		sb.append("</").append(Constants.XMPP_PROTOCOL_ELEMENTNAME)
				.append("> ");
		return sb.toString();
	}

	public String getId() {
		return id;
	}

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

	public String getApiKey() {
		return apiKey;
	}

	public void setApiKey(String apiKey) {
		this.apiKey = apiKey;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getUri() {
		return uri;
	}

	public void setUri(String url) {
		this.uri = url;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

}

redpajama_set_name: RedPajamaGithub


text: CodeIgniter Sikhtasi :P


text:
import * as BreakpointsView from './BreakpointsView.js';
import * as HeadersView from './HeadersView.js';

export {
  BreakpointsView,
  HeadersView,
};


text:
layout: post
date: '2016-05-17'
title: "Jasmine Bridal J175070 Short Sleeves Floor-Length Aline/Princess"
category: Jasmine
tags: [Jasmine ,Jasmine,Aline/Princess ,Scoop Neck,Floor-Length,Short Sleeves]
---
### Jasmine Bridal J175070
Just **$249.99**
###   Short Sleeves Floor-Length Aline/Princess

BRANDS	Jasmine

Silhouette	Aline/Princess

Neckline	Scoop Neck

Hemline/Train	Floor-Length

Sleeve	Short Sleeves

Buy it: [https://www.readybrides.com/en/jasmine-/19530-jasmine-bridal-j175070.html](https://www.readybrides.com/en/jasmine-/19530-jasmine-bridal-j175070.html)


text:
package com.zeus.factory.impl;

import com.zeus.factory.Shape;

/**
 * @author xuxingbo
 * @Date 2017/6/27
 */
public class Rectangle implements Shape {
    @Override
    public void draw() {
        System.out.println("Inside Rectangle draw() method");
    }
}


text:
package com.oracle.jdt2016.hackathon.hr.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonBackReference;

/**
 * The persistent class for the REGIONS database table.
 *
 */
@Entity
@Table(name="HR.REGIONS")
@NamedQuery(name="Region.findAll", query="SELECT r FROM Region r")
public class Region implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name="REGION_ID")
    private long regionId;

    @Column(name="REGION_NAME")
    private String regionName;

    //bi-directional many-to-one association to Country
    @OneToMany(mappedBy="region")
    @JsonBackReference
    private List<Country> countries;

    public Region() {
    }

    public long getRegionId() {
        return this.regionId;
    }

    public void setRegionId(long regionId) {
        this.regionId = regionId;
    }

    public String getRegionName() {
        return this.regionName;
    }

    public void setRegionName(String regionName) {
        this.regionName = regionName;
    }

    public List<Country> getCountries() {
        return this.countries;
    }

    public void setCountries(List<Country> countries) {
        this.countries = countries;
    }

    public Country addCountry(Country country) {
        getCountries().add(country);
        country.setRegion(this);

        return country;
    }

    public Country removeCountry(Country country) {
        getCountries().remove(country);
        country.setRegion(null);

        return country;
    }

}


text:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class fanceebox_acc
{
	var $name		= 'Fanceebox';
	var $id			= 'fanceebox';
	var $version		= '1.0.7';
	var $description	= 'Adds the Fancybox "lightbox" popup to the control panel for use with your custom fields\' labels';
	var $sections		= array();

	/**
	 * Constructor
	 */
	function __construct()
	{
		$this->EE =& get_instance();

		$theme_url = $this->EE->config->item('theme_folder_url') . 'third_party/fanceebox';

		$this->EE->load->add_package_path(PATH_THIRD . 'fanceebox/');

		$this->EE->cp->load_package_js('jquery.easing-1.3.pack');
		$this->EE->cp->load_package_js('jquery.mousewheel-3.0.4.pack');
		$this->EE->cp->load_package_js('jquery.fancybox-1.3.4.pack');
		$this->EE->cp->load_package_js('jquery.fanceebox-1.0.5.pack');

		$this->EE->cp->add_to_head("<link rel='stylesheet' type='text/css' href='{$theme_url}/fancybox/jquery.fancybox-1.3.4.css' />");
	}

	/**
	 * Set Sections
	 *
	 * Set content for the accessory
	 *
	 * @access	public
	 * @return	void
	 */

	function set_sections()
	{
		$this->sections[] ='<script type="text/javascript">$("#accessoryTabs .' . $this->id  . '").parent("li").hide();</script>';

	}

}
// END CLASS


text:
abort(1) -- Abort the current transaction and discard any staged changes
========================================================================

## SYNOPSIS

`abort` -> void

## DESCRIPTION
The **abort** method turns off *staging* mode and returns the shell to
*autocommit* mode where all subsequent changes are committed immediately. Calling this method when the shell is not in *staging* mode is a no-op.

  * `abort` -> void:
    Abort the current transaction and discard and changes that are currently staged.

## AUTHOR
Written by Jeff Nelson.

## COPYRIGHT
Copyright (c) 2013-2017 Cinchapi Inc.

## LICENSE
This manual is licensed under the Creative Commons Attribution 4.0 International Public License.

https://creativecommons.org/licenses/by/4.0/


text:
using System;
using System.Globalization;
using System.Runtime.CompilerServices;

/// <summary>
/// Convert.ToString(System.Int16,System.Int32)
/// </summary>
public class ConvertToString14
{
    public static int Main()
    {
        ConvertToString14 testObj = new ConvertToString14();

        TestLibrary.TestFramework.BeginTestCase("for method: Convert.ToString(System.Int16,System.Int32)");
        if (testObj.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }
    }

    public bool RunTests()
    {
        bool retVal = true;

        TestLibrary.TestFramework.LogInformation("[Positive]");
        retVal = PosTest1() && retVal;
        retVal = PosTest2() && retVal;
        retVal = PosTest3() && retVal;

        TestLibrary.TestFramework.LogInformation("[Negative]");
        retVal = NegTest1() && retVal;

        return retVal;
    }

    #region Positive tests
    public bool PosTest1()
    {
        bool retVal = true;
        string c_TEST_DESC = "PosTest1: Verify value is 323 and radix is 2,8,10 or 16... ";
        string c_TEST_ID = "P001";

        Int16 int16Value =-123;
        int radix;
        String actualValue;
        string errorDesc;

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            actualValue = "1111111110000101";
            radix = 2;
            String resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("001" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 8;
            actualValue = "177605";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("002" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 10;
            actualValue = "-123";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("003" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 16;
            actualValue = "ff85";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("004" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("005", "unexpected exception occurs :" + e);
            retVal = false;
        }

        return retVal;
    }

    public bool PosTest2()
    {
        bool retVal = true;
        string c_TEST_DESC = "PosTest2: Verify value is Int16.MaxValue and radix is 2,8,10 or 16... ";
        string c_TEST_ID = "P002";

        Int16 int16Value = Int16.MaxValue;
        int radix;
        String actualValue;
        string errorDesc;

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            actualValue = "111111111111111";
            radix = 2;
            String resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("006" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 8;
            actualValue = "77777";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("007" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 10;
            actualValue = "32767";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("008" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 16;
            actualValue = "7fff";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("009" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("010", "unexpected exception occurs :" + e);
            retVal = false;
        }

        return retVal;
    }

    public bool PosTest3()
    {
        bool retVal = true;
        string c_TEST_DESC = "PosTest3: Verify value is Int16.MinValue and radix is 2,8,10 or 16... ";
        string c_TEST_ID = "P003";

        Int16 int16Value = Int16.MinValue;
        int radix;
        String actualValue;
        string errorDesc;

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            actualValue = "1000000000000000";
            radix = 2;
            String resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("011" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 8;
            actualValue = "100000";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("012" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 10;
            actualValue = "-32768";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("013" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

            radix = 16;
            actualValue = "8000";
            errorDesc = "";
            resValue = Convert.ToString(int16Value, radix);

            if (actualValue != resValue)
            {
                errorDesc = "value is not " + resValue.ToString() + " as expected: Actual is " + actualValue.ToString();
                errorDesc += DataString(int16Value, radix);
                TestLibrary.TestFramework.LogError("014" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("015", "unexpected exception occurs :" + e);
            retVal = false;
        }

        return retVal;
    }
    #endregion

    #region NegativeTesting
    public bool NegTest1()
    {
        bool retVal = true;
        const string c_TEST_DESC = "NegTest1: the radix is 32...";
        const string c_TEST_ID = "N001";

        Int16 int16Value = TestLibrary.Generator.GetInt16(-55);
        int radix = 32;
        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            Convert.ToString(int16Value, radix);
            TestLibrary.TestFramework.LogError("013" + " TestId-" + c_TEST_ID, "ArgumentException is not thrown as expected ." + DataString(int16Value, radix));
            retVal = false;
        }
        catch (ArgumentException)
        {
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("014" + " TestId-" + c_TEST_ID, "Unexpected exception: " + e + DataString(int16Value, radix));
            retVal = false;
        }

        return retVal;

    }
    #endregion

    #region Help Methods
    private string DataString(Int16 int16Value, int radix)
    {
        string str;

        str = string.Format("\n[int16Value value]\n \"{0}\"", int16Value);
        str += string.Format("\n[radix value ]\n {0}", radix);

        return str;
    }
    #endregion
}


text:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class DepartamentoController extends Controller
{

    public function __construct(){
        $this->middleware('validar_departamento', ['only'=>['store']]);
        $this->middleware('validar_edicao_do_departamento', ['only' => ['update']]);
        $this->middleware('verificar_existencia_do_departamento', ['only' => ['destroy', 'show']]);
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        $departamentos = \App\Departamento::all();
        if (count($departamentos) > 0) {
          return [
            'departamentos' => $departamentos
          ];
        } else {
          abort(404);
        }
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $departamentos_data = $request->departamento_data;
        $departamento = \App\Departamento::create($departamentos_data);
        return $departamento;
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show(Request $request)
    {
        $departamento = $request->departamento;
        return $departamento;
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request)
    {
        $departamento = $request->departamento;
        $data = $request->departamento_data;
        $departamento->fill($data);
        $departamento->save();

        return $departamento;
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy(Request $request)
    {
      $departamento = $request->departamento;
      $departamento->delete();
    }
}


text:
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace Turbocharged.Beanstalk
{
    class BuryRequest : Request<bool>
    {
        public Task<bool> Task { get { return _tcs.Task; } }

        TaskCompletionSource<bool> _tcs = new TaskCompletionSource<bool>();
        int _id;
        int _priority;

        public BuryRequest(int id, int priority)
        {
            _id = id;
            _priority = priority;
        }

        public byte[] ToByteArray()
        {
            return "bury {0} {1}\r\n".FormatWith(_id, _priority).ToASCIIByteArray();
        }

        public void Process(string firstLine, NetworkStream stream, ILogger logger)
        {
            switch (firstLine)
            {
                case "BURIED":
                    _tcs.SetResult(true);
                    return;

                case "NOT_FOUND":
                    _tcs.SetResult(false);
                    return;

                default:
                    Reply.SetGeneralException(_tcs, firstLine, "bury", logger);
                    return;
            }
        }

        public void Cancel()
        {
            _tcs.TrySetCanceled();
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Data.Common;
using Ycql.Constraints;
using Ycql.DbHelpers;
using Ycql.Exceptions;
using Ycql.Extensions;
using Ycql.Interfaces;

namespace Ycql
{
	/// <summary>
	/// Represents a Sql builder for operations related to making change to the table schema
	/// </summary>
	/// <seealso cref="Ycql.CreateBuilder"/>
	/// <seealso cref="Ycql.DeleteBuilder"/>
	/// <seealso cref="Ycql.InsertBuilder"/>
	/// <seealso cref="Ycql.SelectBuilder"/>
	/// <seealso cref="Ycql.UpdateBuilder"/>
	/// <seealso cref="Ycql.DbTable"/>
	/// <seealso cref="Ycql.DbColumn"/>
	/// <seealso cref="Ycql.SqlIndex"/>
	/// <seealso cref="Ycql.Constraints.CheckConstraint"/>
	/// <seealso cref="Ycql.Constraints.ForeignKeyConstraint"/>
	/// <seealso cref="Ycql.Constraints.PrimaryKeyConstraint"/>
	/// <seealso cref="Ycql.Constraints.UniqueKeyConstraint"/>
	/// <seealso cref="Ycql.Constraints.ConstraintType"/>
	public class AlterBuilder : ITranslateSql
	{
		/// <summary>
		/// The table to be altered
		/// </summary>
		DbTable _table;
		/// <summary>
		/// List of columns to be added
		/// </summary>
		List<DbColumn> _newColumns;
		/// <summary>
		/// List of columns to be dropped
		/// </summary>
		List<DbColumn> _dropColumns;
		/// <summary>
		/// List of columns to have their data types changed and their new data type
		/// </summary>
		List<Tuple<DbColumn, DataType>> _changeDataTypeColumns;
		/// <summary>
		/// List of new constraints to be added to the table
		/// </summary>
		List<SqlConstraint> _newConstraints;
		/// <summary>
		/// List of indexes' name to be dropped
		/// </summary>
		List<string> _dropIndexNames;
		/// <summary>
		/// List of constraints to be dropped. ConstraintType param is for MySql
		/// </summary>
		List<Tuple<string, ConstraintType?>> _dropConstraints;

		/// <summary>
		/// Initializes a new instance of the AlterBuilder class using specified table
		/// </summary>
		/// <param name="table">The table to be altered</param>
		public AlterBuilder(DbTable table)
		{
			_table = table;
			_newColumns = new List<DbColumn>();
			_dropColumns = new List<DbColumn>();
			_changeDataTypeColumns = new List<Tuple<DbColumn, DataType>>();
			_newConstraints = new List<SqlConstraint>();
			_dropIndexNames = new List<string>();
			_dropConstraints = new List<Tuple<string, ConstraintType?>>();
		}

		/// <summary>
		/// Adds a new column to the table
		/// </summary>
		/// <param name="column">Column to be added</param>
		/// <returns>A reference to this instance after the column has been added to the column to add list</returns>
		public AlterBuilder AddColumn(DbColumn column)
		{
			_newColumns.Add(column);
			return this;
		}

		/// <summary>
		/// Drops a column from the table
		/// </summary>
		/// <param name="column">Column to be dropped</param>
		/// <returns>A reference to this instance after the column has been added to the column to drop list</returns>
		public AlterBuilder DropColumn(DbColumn column)
		{
			_dropColumns.Add(column);
			return this;
		}

		/// <summary>
		/// Modify the data type of a column
		/// </summary>
		/// <param name="column">The column which would have its data type modified</param>
		/// <param name="newDataType">New data type for the column</param>
		/// <returns>A reference to this instance after the column has been added to the column to change list</returns>
		public AlterBuilder ChangeColumnDataType(DbColumn column, DataType newDataType)
		{
			_changeDataTypeColumns.Add(new Tuple<DbColumn, DataType>(column, newDataType));
			return this;
		}

		/// <summary>
		/// Adds a new constraint to the table
		/// </summary>
		/// <param name="constraints">Constraint to be added</param>
		/// <returns>A reference to this instance after the constraints has been added to the new constraint list</returns>
		public AlterBuilder AddConstraint(params SqlConstraint[] constraints)
		{
			_newConstraints.AddRange(constraints.Unwrap<SqlConstraint>());
			return this;
		}

		/// <summary>
		/// Drops a constraint from the table
		/// </summary>
		/// <param name="constraint">Constraint to be dropped</param>
		/// <returns>A reference to this instance after the constraints has been added to the constraint to drop list</returns>
		/// <exception cref="Ycql.Exceptions.YCQLInternalException">Thrown when the constraint type is not reconized. Most likely due to newly added constraint class</exception>
		public AlterBuilder DropConstraint(SqlConstraint constraint)
		{
			ConstraintType constraintType;
			if (constraint is PrimaryKeyConstraint)
				constraintType = ConstraintType.PrimaryKey;
			else if (constraint is ForeignKeyConstraint)
				constraintType = ConstraintType.ForeignKey;
			else if (constraint is UniqueKeyConstraint)
				constraintType = ConstraintType.UniqueKey;
			else if (constraint is CheckConstraint)
				constraintType = ConstraintType.Check;
			else
				throw new YCQLInternalException("Unknown Constraint type : " + constraint.GetType().Name);

			return DropConstraint(constraint.Name, constraintType);
		}

		/// <summary>
		/// Drops a constraint from the table
		/// </summary>
		/// <param name="constraintName">Name of the constraint</param>
		/// <returns>A reference to this instance after the constraints has been added to the constraint to drop list</returns>
		public AlterBuilder DropConstraint(string constraintName)
		{
			return DropConstraint(constraintName, null);
		}

		/// <summary>
		/// Drops a constraint from the table
		/// </summary>
		/// <param name="constraintName">Name of the constraint</param>
		/// <param name="constraintType">Type of the constraint</param>
		/// <returns>A reference to this instance after the constraints has been added to the constraint to drop list</returns>
#if YCQL_MYSQL
		public AlterBuilder DropConstraint(string constraintName, ConstraintType? constraintType)
#else
		AlterBuilder DropConstraint(string constraintName, ConstraintType? constraintType)
#endif
		{
			_dropConstraints.Add(new Tuple<string, ConstraintType?>(constraintName, constraintType));
			return this;
		}

		/// <summary>
		/// Drops an index from the table
		/// </summary>
		/// <param name="index">Index to be dropped</param>
		/// <returns>A reference to this instance after the index has been added to the index to drop list</returns>
		public AlterBuilder DropIndex(SqlIndex index)
		{
			return DropIndex(index.Name);
		}

		/// <summary>
		/// Drops an index from the table
		/// </summary>
		/// <param name="indexName">Name of the index</param>
		/// <returns>A reference to this instance after the index has been added to the index to drop list</returns>
		public AlterBuilder DropIndex(string indexName)
		{
			_dropIndexNames.Add(indexName);
			return this;
		}

		/// <summary>
		/// Transforms current object into a parameterized Sql statement where parameter objects are added into parameterCollection
		/// </summary>
		/// <param name="dbVersion">The corresponding DBMS enum which the outputed query is for</param>
		/// <param name="parameterCollection">The collection which will hold all the parameters for the sql query</param>
		/// <returns>Parameterized Sql string</returns>
		/// <exception cref="Ycql.Exceptions.DbNotSupportedException">Thrown when the translation cannot be done for destinated DBMS</exception>
		public string ToSql(DbVersion dbVersion, DbParameterCollection parameterCollection)
		{
			DbHelper dbHelper = DbHelper.GetDbHelper(dbVersion);

			string alterTableStatement = string.Format("ALTER TABLE {0}", dbHelper.QuoteIdentifier(_table.TableName));
			List<string> statements = new List<string>();
			foreach (DbColumn newColumn in _newColumns)
				statements.Add(alterTableStatement + string.Format(" ADD {0} {1}", dbHelper.QuoteIdentifier(newColumn.ColumnName), newColumn.DataType));

			foreach (DbColumn dropColumn in _dropColumns)
				statements.Add(alterTableStatement + string.Format(" DROP COLUMN {0}", dbHelper.QuoteIdentifier(dropColumn.ColumnName)));

			foreach (Tuple<DbColumn, DataType> changeDataTypeColumn in _changeDataTypeColumns)
			{
				string command;
				switch (dbHelper.DbEngine)
				{
#if YCQL_SQLSERVER
					case DbEngine.SqlServer:
						command = "ALTER COLUMN";
						break;
#endif

#if YCQL_MYSQL
					case DbEngine.MySql:
						command = "MODIFY COLUMN";
						break;
#endif
					default:
						throw new DbNotSupportedException(dbHelper.DbEngine, "ChangeColumnDataType");
				}

				statements.Add(alterTableStatement + string.Format(" {0} {1} {2}", command, dbHelper.QuoteIdentifier(changeDataTypeColumn.Item1.ColumnName), changeDataTypeColumn.Item2));
			}

			foreach (SqlConstraint newConstraint in _newConstraints)
				statements.Add(alterTableStatement + string.Format(" ADD {0}", newConstraint.ToSql(dbVersion, parameterCollection)));

			foreach (string indexName in _dropIndexNames)
				statements.Add(string.Format("DROP INDEX {0} ON {1}", dbHelper.QuoteIdentifier(indexName), dbHelper.QuoteIdentifier(_table.TableName)));

			foreach (Tuple<string, ConstraintType?> dropConstraint in _dropConstraints)
			{
				string statement = alterTableStatement;
#if YCQL_MYSQL
				if (dbHelper.DbEngine == DbEngine.MySql)
				{
					if (dropConstraint.Item2 == null)
						throw new DbNotSupportedException(DbEngine.MySql, "Constraint type must be specified for MySql's DROP Constraint statement");

					switch (dropConstraint.Item2)
					{
						case ConstraintType.PrimaryKey:
							statement += " DROP PRIMARY KEY";
							break;
						case ConstraintType.ForeignKey:
							statement += string.Format(" DROP FOREIGN KEY {0}", dbHelper.QuoteIdentifier(dropConstraint.Item1));
							break;
						case ConstraintType.UniqueKey:
							statement += string.Format("DROP INDEX {0}", dbHelper.QuoteIdentifier(dropConstraint.Item1));
							break;
						default:
							throw new DbNotSupportedException(dbHelper.DbEngine, "Drop " + dropConstraint.Item2.ToString());
					}
				}
				else
				{
					statement += string.Format(" DROP CONSTRAINT {0}", dbHelper.QuoteIdentifier(dropConstraint.Item1));
				}
#else
				statement += string.Format(" DROP CONSTRAINT {0}", dbHelper.QuoteIdentifier(dropConstraint.Item1));
#endif
				statements.Add(statement);
			}

			return string.Join(";" + Environment.NewLine, statements);
		}
	}
}


text:
var nunt = require('nunt');
var talkItems = [
    "Hello. ",
    "Hej.",
    "Thank you for being the *123* vistor of my blog. ",
    "If you are a machine, please let me know so I can exlude you from my stats.",
    "By the way, if you let me know where you are, I'll let you know how far we are from eachother.",
    "You are *1500 km* away from me. ",
    "Ah, my espresso machine is on right now.",
    "Ah, the lamps *in our livingroom* are on right now. Cool. ",
    "My son thinks he is the king because Jupier begins with his first letter, as in Julius.",
    "Javascript, javascript lalala.",
    'And now something from my twitter: "lorem ipsum…; ',
    "I just tweeted my *1454* tweet. ",
    "Javascript for president.",
    "I love to develop event driven javascript applications.",
    "The ultimate wordpress plugin: fortune cookies. a browser cookie telling you your fortune. ",
]

var currentTalks = talkItems.concat([]);

function runTalk() {

    var randomIndex = Math.round(Math.random() * (currentTalks.length - 1));

    var talk = currentTalks.splice(randomIndex, 1)[0];

    if (typeof talk == 'string') {
        //nunt.send("talk.show", {content: talk});
    }
    else {
    }

    if (currentTalks.length == 0) {
        currentTalks = talkItems.concat([]);
    }

}

//nunt.on('talk.done', runTalk);
//nunt.on(nunt.CONNECTED, runTalk);


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.

#nullable disable

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis
{
    using ASM_CACHE = GlobalAssemblyCacheLocation.ASM_CACHE;

    /// <summary>
    /// Provides APIs to enumerate and look up assemblies stored in the Global Assembly Cache.
    /// </summary>
    internal sealed class ClrGlobalAssemblyCache : GlobalAssemblyCache
    {
        #region Interop

        private const int MAX_PATH = 260;

        [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("21b8916c-f28e-11d2-a473-00c04f8ef448")]
        private interface IAssemblyEnum
        {
            [PreserveSig]
            int GetNextAssembly(out FusionAssemblyIdentity.IApplicationContext ppAppCtx, out FusionAssemblyIdentity.IAssemblyName ppName, uint dwFlags);

            [PreserveSig]
            int Reset();

            [PreserveSig]
            int Clone(out IAssemblyEnum ppEnum);
        }

        [ComImport, Guid("e707dcde-d1cd-11d2-bab9-00c04f8eceae"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        private interface IAssemblyCache
        {
            void UninstallAssembly();

            void QueryAssemblyInfo(uint dwFlags, [MarshalAs(UnmanagedType.LPWStr)] string pszAssemblyName, ref ASSEMBLY_INFO pAsmInfo);

            void CreateAssemblyCacheItem();
            void CreateAssemblyScavenger();
            void InstallAssembly();
        }

        [StructLayout(LayoutKind.Sequential)]
        private unsafe struct ASSEMBLY_INFO
        {
            public uint cbAssemblyInfo;
            public readonly uint dwAssemblyFlags;
            public readonly ulong uliAssemblySizeInKB;
            public char* pszCurrentAssemblyPathBuf;
            public uint cchBuf;
        }

        [DllImport("clr", PreserveSig = true)]
        private static extern int CreateAssemblyEnum(out IAssemblyEnum ppEnum, FusionAssemblyIdentity.IApplicationContext pAppCtx, FusionAssemblyIdentity.IAssemblyName pName, ASM_CACHE dwFlags, IntPtr pvReserved);

        [DllImport("clr", PreserveSig = false)]
        private static extern void CreateAssemblyCache(out IAssemblyCache ppAsmCache, uint dwReserved);

        #endregion

        /// <summary>
        /// Enumerates assemblies in the GAC returning those that match given partial name and
        /// architecture.
        /// </summary>
        /// <param name="partialName">Optional partial name.</param>
        /// <param name="architectureFilter">Optional architecture filter.</param>
        public override IEnumerable<AssemblyIdentity> GetAssemblyIdentities(AssemblyName partialName, ImmutableArray<ProcessorArchitecture> architectureFilter = default(ImmutableArray<ProcessorArchitecture>))
        {
            return GetAssemblyIdentities(FusionAssemblyIdentity.ToAssemblyNameObject(partialName), architectureFilter);
        }

        /// <summary>
        /// Enumerates assemblies in the GAC returning those that match given partial name and
        /// architecture.
        /// </summary>
        /// <param name="partialName">The optional partial name.</param>
        /// <param name="architectureFilter">The optional architecture filter.</param>
        public override IEnumerable<AssemblyIdentity> GetAssemblyIdentities(string partialName = null, ImmutableArray<ProcessorArchitecture> architectureFilter = default(ImmutableArray<ProcessorArchitecture>))
        {
            FusionAssemblyIdentity.IAssemblyName nameObj;
            if (partialName != null)
            {
                nameObj = FusionAssemblyIdentity.ToAssemblyNameObject(partialName);
                if (nameObj == null)
                {
                    return SpecializedCollections.EmptyEnumerable<AssemblyIdentity>();
                }
            }
            else
            {
                nameObj = null;
            }

            return GetAssemblyIdentities(nameObj, architectureFilter);
        }

        /// <summary>
        /// Enumerates assemblies in the GAC returning their simple names.
        /// </summary>
        /// <param name="architectureFilter">Optional architecture filter.</param>
        /// <returns>Unique simple names of GAC assemblies.</returns>
        public override IEnumerable<string> GetAssemblySimpleNames(ImmutableArray<ProcessorArchitecture> architectureFilter = default(ImmutableArray<ProcessorArchitecture>))
        {
            var q = from nameObject in GetAssemblyObjects(partialNameFilter: null, architectureFilter: architectureFilter)
                    select FusionAssemblyIdentity.GetName(nameObject);
            return q.Distinct();
        }

        private static IEnumerable<AssemblyIdentity> GetAssemblyIdentities(
            FusionAssemblyIdentity.IAssemblyName partialName,
            ImmutableArray<ProcessorArchitecture> architectureFilter)
        {
            return from nameObject in GetAssemblyObjects(partialName, architectureFilter)
                   select FusionAssemblyIdentity.ToAssemblyIdentity(nameObject);
        }

        private const int S_OK = 0;
        private const int S_FALSE = 1;

        // Internal for testing.
        internal static IEnumerable<FusionAssemblyIdentity.IAssemblyName> GetAssemblyObjects(
            FusionAssemblyIdentity.IAssemblyName partialNameFilter,
            ImmutableArray<ProcessorArchitecture> architectureFilter)
        {
            IAssemblyEnum enumerator;
            FusionAssemblyIdentity.IApplicationContext applicationContext = null;

            int hr = CreateAssemblyEnum(out enumerator, applicationContext, partialNameFilter, ASM_CACHE.GAC, IntPtr.Zero);
            if (hr == S_FALSE)
            {
                // no assembly found
                yield break;
            }
            else if (hr != S_OK)
            {
                Exception e = Marshal.GetExceptionForHR(hr);
                if (e is FileNotFoundException || e is DirectoryNotFoundException)
                {
                    // invalid assembly name:
                    yield break;
                }
                else if (e != null)
                {
                    throw e;
                }
                else
                {
                    // for some reason it might happen that CreateAssemblyEnum returns non-zero HR that doesn't correspond to any exception:
#if SCRIPTING
                    throw new ArgumentException(Microsoft.CodeAnalysis.Scripting.ScriptingResources.InvalidAssemblyName);
#else
                    throw new ArgumentException(Editor.EditorFeaturesResources.Invalid_assembly_name);
#endif
                }
            }

            while (true)
            {
                FusionAssemblyIdentity.IAssemblyName nameObject;

                hr = enumerator.GetNextAssembly(out applicationContext, out nameObject, 0);
                if (hr != 0)
                {
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }

                    break;
                }

                if (!architectureFilter.IsDefault)
                {
                    var assemblyArchitecture = FusionAssemblyIdentity.GetProcessorArchitecture(nameObject);
                    if (!architectureFilter.Contains(assemblyArchitecture))
                    {
                        continue;
                    }
                }

                yield return nameObject;
            }
        }

        public override AssemblyIdentity ResolvePartialName(
            string displayName,
            out string location,
            ImmutableArray<ProcessorArchitecture> architectureFilter,
            CultureInfo preferredCulture)
        {
            if (displayName == null)
            {
                throw new ArgumentNullException(nameof(displayName));
            }

            location = null;
            FusionAssemblyIdentity.IAssemblyName nameObject = FusionAssemblyIdentity.ToAssemblyNameObject(displayName);
            if (nameObject == null)
            {
                return null;
            }

            var candidates = GetAssemblyObjects(nameObject, architectureFilter);
            string cultureName = (preferredCulture != null && !preferredCulture.IsNeutralCulture) ? preferredCulture.Name : null;

            var bestMatch = FusionAssemblyIdentity.GetBestMatch(candidates, cultureName);
            if (bestMatch == null)
            {
                return null;
            }

            location = GetAssemblyLocation(bestMatch);
            return FusionAssemblyIdentity.ToAssemblyIdentity(bestMatch);
        }

        internal static unsafe string GetAssemblyLocation(FusionAssemblyIdentity.IAssemblyName nameObject)
        {
            // NAME | VERSION | CULTURE | PUBLIC_KEY_TOKEN | RETARGET | PROCESSORARCHITECTURE
            string fullName = FusionAssemblyIdentity.GetDisplayName(nameObject, FusionAssemblyIdentity.ASM_DISPLAYF.FULL);

            fixed (char* p = new char[MAX_PATH])
            {
                ASSEMBLY_INFO info = new ASSEMBLY_INFO
                {
                    cbAssemblyInfo = (uint)Marshal.SizeOf<ASSEMBLY_INFO>(),
                    pszCurrentAssemblyPathBuf = p,
                    cchBuf = MAX_PATH
                };

                IAssemblyCache assemblyCacheObject;
                CreateAssemblyCache(out assemblyCacheObject, 0);
                assemblyCacheObject.QueryAssemblyInfo(0, fullName, ref info);
                Debug.Assert(info.pszCurrentAssemblyPathBuf != null);
                Debug.Assert(info.pszCurrentAssemblyPathBuf[info.cchBuf - 1] == '\0');

                var result = Marshal.PtrToStringUni((IntPtr)info.pszCurrentAssemblyPathBuf, (int)info.cchBuf - 1);
                Debug.Assert(result.IndexOf('\0') == -1);
                return result;
            }
        }
    }
}


text:
package controllers

import db.{Authorization, RecommendationsDao, TokensDao, StaticUserProvider}
import io.flow.dependency.v0.models.RecommendationType
import io.flow.dependency.v0.models.json._
import io.flow.play.controllers.{AuthorizationImpl, FlowControllerComponents}
import io.flow.play.util.Config
import play.api.libs.json._
import play.api.mvc._

@javax.inject.Singleton
class Recommendations @javax.inject.Inject() (
  val config: Config,
  val controllerComponents: ControllerComponents,
  val flowControllerComponents: FlowControllerComponents,
  val authorization: AuthorizationImpl,
  val tokensDao: TokensDao,
  val staticUserProvider: StaticUserProvider,
  recommendationsDao: RecommendationsDao,
  val baseIdentifiedControllerWithFallbackComponents: BaseIdentifiedControllerWithFallbackComponents
) extends BaseIdentifiedControllerWithFallback {

  def get(
    organization: Option[String],
    projectId: Option[String],
    `type`: Option[RecommendationType],
    limit: Long = 25,
    offset: Long = 0
  ) = IdentifiedWithFallback { request =>
    Ok(
      Json.toJson(
        recommendationsDao.findAll(
          Authorization.User(request.user.id),
          organization = organization,
          projectId = projectId,
          `type` = `type`,
          limit = limit,
          offset = offset
        )
      )
    )
  }

}


text:
package org.apache.beam.sdk.io.gcp.firestore;

import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import com.google.api.gax.rpc.ServerStream;
import com.google.api.gax.rpc.ServerStreamingCallable;
import com.google.cloud.firestore.v1.stub.FirestoreStub;
import com.google.firestore.v1.BatchGetDocumentsRequest;
import com.google.firestore.v1.BatchGetDocumentsResponse;
import com.google.firestore.v1.Document;
import com.google.firestore.v1.Value;
import com.google.protobuf.util.Timestamps;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.apache.beam.sdk.io.gcp.firestore.FirestoreV1ReadFn.BatchGetDocumentsFn;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.AbstractIterator;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;
import org.joda.time.Instant;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

@RunWith(Parameterized.class)
public final class FirestoreV1FnBatchGetDocumentsTest
    extends BaseFirestoreV1ReadFnTest<BatchGetDocumentsRequest, BatchGetDocumentsResponse> {
  @Parameterized.Parameter public Instant readTime;

  @Rule public MockitoRule rule = MockitoJUnit.rule();

  @Mock
  private ServerStreamingCallable<BatchGetDocumentsRequest, BatchGetDocumentsResponse> callable;

  @Mock private ServerStream<BatchGetDocumentsResponse> responseStream1;
  @Mock private ServerStream<BatchGetDocumentsResponse> responseStream2;
  @Mock private ServerStream<BatchGetDocumentsResponse> responseStream3;

  @Parameterized.Parameters(name = "readTime = {0}")
  public static Collection<Object> data() {
    return Arrays.asList(null, Instant.now());
  }

  private BatchGetDocumentsRequest withReadTime(
      BatchGetDocumentsRequest request, Instant readTime) {
    return readTime == null
        ? request
        : request.toBuilder().setReadTime(Timestamps.fromMillis(readTime.getMillis())).build();
  }

  @Test
  public void endToEnd() throws Exception {
    final BatchGetDocumentsRequest request =
        BatchGetDocumentsRequest.newBuilder()
            .setDatabase(String.format("projects/%s/databases/(default)", projectId))
            .addDocuments("doc_1-1")
            .addDocuments("doc_1-2")
            .addDocuments("doc_1-3")
            .build();

    final BatchGetDocumentsResponse response1 = newFound(1);
    final BatchGetDocumentsResponse response2 = newFound(2);
    final BatchGetDocumentsResponse response3 = newFound(3);

    List<BatchGetDocumentsResponse> responses = ImmutableList.of(response1, response2, response3);
    when(responseStream1.iterator()).thenReturn(responses.iterator());

    when(callable.call(withReadTime(request, readTime))).thenReturn(responseStream1);

    when(stub.batchGetDocumentsCallable()).thenReturn(callable);

    when(ff.getFirestoreStub(any())).thenReturn(stub);
    when(ff.getRpcQos(any()))
        .thenReturn(FirestoreStatefulComponentFactory.INSTANCE.getRpcQos(rpcQosOptions));

    ArgumentCaptor<BatchGetDocumentsResponse> responsesCaptor =
        ArgumentCaptor.forClass(BatchGetDocumentsResponse.class);
    doNothing().when(processContext).output(responsesCaptor.capture());

    when(processContext.element()).thenReturn(request);

    runFunction(new BatchGetDocumentsFn(clock, ff, rpcQosOptions, readTime));

    List<BatchGetDocumentsResponse> allValues = responsesCaptor.getAllValues();
    assertEquals(responses, allValues);
  }

  @Override
  public void resumeFromLastReadValue() throws Exception {

    final BatchGetDocumentsResponse response1 = newMissing(1);
    final BatchGetDocumentsResponse response2 = newFound(2);
    final BatchGetDocumentsResponse response3 = newMissing(3);
    final BatchGetDocumentsResponse response4 = newFound(4);

    final BatchGetDocumentsRequest request1 =
        BatchGetDocumentsRequest.newBuilder()
            .setDatabase(String.format("projects/%s/databases/(default)", projectId))
            .addDocuments(response1.getMissing())
            .addDocuments(response2.getFound().getName())
            .addDocuments(response3.getMissing())
            .addDocuments(response4.getFound().getName())
            .build();

    BatchGetDocumentsRequest request2 =
        BatchGetDocumentsRequest.newBuilder()
            .setDatabase(String.format("projects/%s/databases/(default)", projectId))
            .addDocuments(response3.getMissing())
            .addDocuments(response4.getFound().getName())
            .build();
    BatchGetDocumentsRequest request3 =
        BatchGetDocumentsRequest.newBuilder()
            .setDatabase(String.format("projects/%s/databases/(default)", projectId))
            .addDocuments(response4.getFound().getName())
            .build();

    when(responseStream1.iterator())
        .thenReturn(
            new AbstractIterator<BatchGetDocumentsResponse>() {
              private int counter = 10;

              @Override
              protected BatchGetDocumentsResponse computeNext() {
                int count = counter++;
                if (count == 10) {
                  return response1;
                } else if (count == 11) {
                  return response2;
                } else {
                  throw RETRYABLE_ERROR;
                }
              }
            });
    when(responseStream2.iterator())
        .thenReturn(
            new AbstractIterator<BatchGetDocumentsResponse>() {
              private int counter = 20;

              @Override
              protected BatchGetDocumentsResponse computeNext() {
                int count = counter++;
                if (count == 20) {
                  return response3;
                } else {
                  throw RETRYABLE_ERROR;
                }
              }
            });
    when(responseStream3.iterator()).thenReturn(ImmutableList.of(response4).iterator());

    doNothing().when(attempt).checkCanRetry(any(), eq(RETRYABLE_ERROR));
    when(callable.call(withReadTime(request1, readTime))).thenReturn(responseStream1);
    when(callable.call(withReadTime(request2, readTime))).thenReturn(responseStream2);
    when(callable.call(withReadTime(request3, readTime))).thenReturn(responseStream3);

    when(stub.batchGetDocumentsCallable()).thenReturn(callable);

    when(ff.getFirestoreStub(any())).thenReturn(stub);
    when(ff.getRpcQos(any())).thenReturn(rpcQos);
    when(rpcQos.newReadAttempt(any())).thenReturn(attempt);
    when(attempt.awaitSafeToProceed(any())).thenReturn(true);

    ArgumentCaptor<BatchGetDocumentsResponse> responsesCaptor =
        ArgumentCaptor.forClass(BatchGetDocumentsResponse.class);

    doNothing().when(processContext).output(responsesCaptor.capture());

    when(processContext.element()).thenReturn(request1);

    BatchGetDocumentsFn fn = new BatchGetDocumentsFn(clock, ff, rpcQosOptions, readTime);

    runFunction(fn);

    List<BatchGetDocumentsResponse> expectedResponses =
        ImmutableList.of(response1, response2, response3, response4);
    List<BatchGetDocumentsResponse> actualResponses = responsesCaptor.getAllValues();
    assertEquals(expectedResponses, actualResponses);

    verify(callable, times(1)).call(withReadTime(request1, readTime));
    verify(callable, times(1)).call(withReadTime(request2, readTime));
    verify(attempt, times(4)).recordStreamValue(any());
  }

  @Override
  protected V1RpcFnTestCtx newCtx() {
    return new V1RpcFnTestCtx() {
      @Override
      public BatchGetDocumentsRequest getRequest() {
        return BatchGetDocumentsRequest.newBuilder()
            .setDatabase(String.format("projects/%s/databases/(default)", projectId))
            .addDocuments("doc_1-1")
            .build();
      }

      @Override
      public void mockRpcToCallable(FirestoreStub stub) {
        when(stub.batchGetDocumentsCallable()).thenReturn(callable);
      }

      @Override
      public void whenCallableCall(BatchGetDocumentsRequest in, Throwable... throwables) {
        when(callable.call(in)).thenThrow(throwables);
      }

      @Override
      public void verifyNoInteractionsWithCallable() {
        verifyNoMoreInteractions(callable);
      }
    };
  }

  @Override
  protected BatchGetDocumentsFn getFn(
      JodaClock clock,
      FirestoreStatefulComponentFactory firestoreStatefulComponentFactory,
      RpcQosOptions rpcQosOptions) {
    return new BatchGetDocumentsFn(clock, firestoreStatefulComponentFactory, rpcQosOptions);
  }

  private static BatchGetDocumentsResponse newFound(int docNumber) {
    String docName = docName(docNumber);
    return BatchGetDocumentsResponse.newBuilder()
        .setFound(
            Document.newBuilder()
                .setName(docName)
                .putAllFields(
                    ImmutableMap.of("foo", Value.newBuilder().setStringValue("bar").build()))
                .build())
        .build();
  }

  private static BatchGetDocumentsResponse newMissing(int docNumber) {
    String docName = docName(docNumber);
    return BatchGetDocumentsResponse.newBuilder().setMissing(docName).build();
  }

  private static String docName(int docNumber) {
    return String.format("doc-%d", docNumber);
  }
}


text:
import subprocess
import time

from prometheus_client import CollectorRegistry, write_to_textfile
from prometheus_client import Gauge

NGINX_PATH = "/usr/sbin/nginx"

# prepare Prometheus metrics
registry = CollectorRegistry()
nginx_config_status = Gauge(
    "nginx_config_status", "Nginx Config Status", registry=registry)
nginx_config_status_time = Gauge(
    "nginx_config_status_time_seconds", "Time to run nginx -t",
    registry=registry)

def main():
    start = time.time()
    status = subprocess.call([NGINX_PATH, "-t"])
    end = time.time()
    nginx_config_status.set(status)
    nginx_config_status_time.set(end - start)
    write_to_textfile('/var/lib/node_exporter/nxmon.prom', registry)

if __name__ == "__main__":
    main()


text:
<?xml version="1.0" encoding="UTF-8"?>
<ldswebml type="image" uri="/media-library/images/temples/recife-brazil#recife-brazil-temple-lds-700226" xml:lang="eng" locale="eng" status="publish" xmlns:its="http://www.w3.org/2005/11/its">
  <search-meta>
      <uri-title its:translate="no">recife-brazil-temple-lds-700226</uri-title>
      <source>recife-brazil-temple-lds-700226</source>
      <publication-type its:translate="no">image</publication-type>
      <media-type its:translate="no">image</media-type>
      <publication value="ldsorg">LDS.org</publication>
      <publication-date value="2012-12-14">2012-12-14</publication-date>
      <title/>
      <description/>
      <collections>
          <collection its:translate="no">global-search</collection>
          <collection its:translate="no">media</collection>
          <collection its:translate="no">images</collection>
      </collections>
      <subjects>
          <subject>recife brazil temple</subject>
          <subject>temples</subject>
          <subject>exteriors</subject>
          <subject>grounds</subject>
          <subject>trees</subject>
      </subjects>
  </search-meta>
  <no-search>
      <path>http://media.ldscdn.org/images/media-library/temples/recife-brazil/recife-brazil-temple-lds-700226-gallery.jpg</path>
      <images>
          http://media.ldscdn.org/images/media-library/temples/recife-brazil/recife-brazil-temple-lds-700226-thumbnail.jpg
      </images>
          <download-urls>
              <download-url>
                  Mobile
                  <size>150 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/temples/recife-brazil/recife-brazil-temple-lds-700226-mobile.jpg</path>
              </download-url>
              <download-url>
                  Tablet
                  <size>167 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/temples/recife-brazil/recife-brazil-temple-lds-700226-tablet.jpg</path>
              </download-url>
              <download-url>
                  Print
                  <size>352 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/temples/recife-brazil/recife-brazil-temple-lds-700226-print.jpg</path>
              </download-url>
              <download-url>
                  Wallpaper
                  <size>688 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/temples/recife-brazil/recife-brazil-temple-lds-700226-wallpaper.jpg</path>
              </download-url>
          </download-urls>
  </no-search>
</ldswebml>


text:
#pragma once

#include <memory>
#include <ostream>
#include <type_traits>

#include "AbstractDomain.h"
#include "Exceptions.h"

namespace sparta {

/*
 * Augments an underlying domain -- D -- with a new least element.  In
 * documentation and output formats, the underlying domain's existing least
 * element will be referred to by the symbol * and the new least element as _|_.
 *
 * See Page 39 of Moeller and Schwartzbach [0] for potential uses of this
 * combinator in abstract interpretation.
 *
 *  [0] Anders Moeller and Michael I. Schwatzbach. Static Program Analysis.
 *        (December 2019). Retrieved April 23, 2020 from
 *        https://cs.au.dk/~amoeller/spa/spa.pdf
 */
template <typename D>
class LiftedDomain final : public AbstractDomain<LiftedDomain<D>> {
  static_assert(std::is_convertible<D*, AbstractDomain<D>*>::value,
                "LiftedDomain must wrap another domain.");

 public:
  static LiftedDomain bottom() { return LiftedDomain{nullptr}; }

  static LiftedDomain lifted(D underlying) {
    return LiftedDomain{std::make_unique<D>(std::move(underlying))};
  }

  static LiftedDomain top() {
    return LiftedDomain{std::make_unique<D>(D::top())};
  }

  /* Default constructor produces the default value in underlying domain. */
  LiftedDomain() : LiftedDomain(std::make_unique<D>()) {}

  LiftedDomain(LiftedDomain&&) = default;
  LiftedDomain& operator=(LiftedDomain&&) = default;

  LiftedDomain(const LiftedDomain& that) {
    if (that.m_underlying) {
      m_underlying = std::make_unique<D>(*that.m_underlying);
    }
  }

  LiftedDomain& operator=(const LiftedDomain& that) {
    m_underlying = that.m_underlying ? std::make_unique<D>(*that.m_underlying)
                                     : std::unique_ptr<D>();
    return *this;
  }

  bool is_bottom() const override { return !m_underlying; }

  bool is_top() const override {
    return m_underlying && m_underlying->is_top();
  }

  bool is_lifted() const { return !is_bottom(); }

  D& lowered() {
    RUNTIME_CHECK(is_lifted(), undefined_operation());
    return *m_underlying;
  }

  const D& lowered() const {
    RUNTIME_CHECK(is_lifted(), undefined_operation());
    return *m_underlying;
  }

  bool leq(const LiftedDomain& that) const override {
    if (is_bottom()) {
      return true;
    } else if (that.is_bottom()) {
      return false;
    } else {
      return m_underlying->leq(*that.m_underlying);
    }
  }

  bool equals(const LiftedDomain& that) const override {
    return (is_bottom() && that.is_bottom()) ||
           m_underlying->equals(*that.m_underlying);
  }

  void set_to_bottom() override { m_underlying = nullptr; }

  void set_to_top() override { m_underlying = std::make_unique<D>(D::top()); }

  /*
   *  _|_ \/  x  = x
   *   x  \/ _|_ = x
   *   x  \/  y  = x  \/' y
   *
   * Where \/' is the join on the underlying domain.
   */
  void join_with(const LiftedDomain& that) override {
    if (is_bottom()) {
      *this = that;
    } else if (!that.is_bottom()) {
      m_underlying->join_with(*that.m_underlying);
    }
  }

  /*
   *  _|_ W  x  = x
   *   x  W _|_ = x
   *   x  W  y  = x  W' y
   *
   * Where W' is the widening on the underlying domain.
   */
  void widen_with(const LiftedDomain& that) override {
    if (is_bottom()) {
      *this = that;
    } else if (!that.is_bottom()) {
      m_underlying->widen_with(*that.m_underlying);
    }
  }

  /*
   *  _|_ /\  _  = _|_
   *   _  /\ _|_ = _|_
   *   x  /\  y  =  x  /\' y
   *
   * Where /\' is the meet on the underlying domain.
   */
  void meet_with(const LiftedDomain& that) override {
    if (is_bottom()) {
      return;
    } else if (that.is_bottom()) {
      set_to_bottom();
    } else {
      m_underlying->meet_with(*that.m_underlying);
    }
  }

  /*
   *  _|_ N  x  = _|_
   *   x  N _|_ = _|_
   *   x  N  y  = x  N' y
   *
   * Where N' is the narrowing on the underlying domain.
   */
  void narrow_with(const LiftedDomain& that) override {
    if (is_bottom()) {
      return;
    } else if (that.is_bottom()) {
      set_to_bottom();
    } else {
      m_underlying->narrow_with(*that.m_underlying);
    }
  }

 private:
  // Bottom for the lifted domain is represented by a null underlying pointer.
  std::unique_ptr<D> m_underlying = nullptr;

  explicit LiftedDomain(std::unique_ptr<D> underlying)
      : m_underlying(std::move(underlying)) {}
};

} // namespace sparta

template <typename D>
inline std::ostream& operator<<(std::ostream& o,
                                const sparta::LiftedDomain<D>& i) {
  if (i.is_bottom()) {
    return o << "_|_";
  }

  if (i.is_top()) {
    return o << "T";
  }

  const auto& under = i.lowered();
  if (under.is_bottom()) {
    return o << "*";
  }

  return o << under;
}


text:
import os
from unipath import FSPath as Path
import djcelery
from django.core.urlresolvers import reverse

PROJECT_DIR = Path(__file__).absolute().ancestor(3)

DEBUG = False
TEMPLATE_DEBUG = DEBUG

ADMINS = ()
MANAGERS = ADMINS
INTERNAL_IPS = ('127.0.0.1',)

# TODO: test if the next line is good for us
# SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
TIME_ZONE = 'Asia/Jerusalem'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
gettext = lambda s: s

LANGUAGES = (
    ('he', gettext('Hebrew')),
    ('en', gettext('English')),
    ('ar', gettext('Arabic')),
    ('ru', gettext('Russian')),
)

LANGUAGE_CODE = LANGUAGES[0][0]

MODELTRANSLATION_DEFAULT_LANGUAGE = LANGUAGE_CODE

MODELTRANSLATION_FALLBACK_LANGUAGES = (LANGUAGES[0][0], LANGUAGES[1][0],
                                       LANGUAGES[2][0], LANGUAGES[3][0])

SITE_ID = 1

USE_I18N = True
USE_L10N = True
USE_TZ = True

MEDIA_URL = '/media/'
MEDIA_ROOT = PROJECT_DIR.child('media')
STATIC_ROOT = PROJECT_DIR.child('static_root')
STATICFILES_ROOT = PROJECT_DIR.child('static')
LOCALE_PATHS = (unicode(PROJECT_DIR.child('locale')), )

STATICFILES_DIRS = [
        (subdir, str(STATICFILES_ROOT.child(subdir))) for subdir in
    ('css', 'img', 'js', )]

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
SECRET_KEY = "'piotu34fh89v67b4c2y0[R89N21CB[YUIP'NXREQL;BYCW9"

FIXTURE_DIRS = ("fixtures", )
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'bootstrap_pagination.middleware.PaginationMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'oshot.middleware.DefaultEntity',
)

ROOT_URLCONF = 'oshot.urls'

TEMPLATE_DIRS = (
    PROJECT_DIR.child('templates'),
)

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.core.context_processors.tz",
    "django.core.context_processors.request",
    "django.contrib.messages.context_processors.messages",
    'oshot.context_processors.forms',
    'social_auth.context_processors.social_auth_by_name_backends',
    )
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.humanize',
    'django.contrib.admindocs',
    'django.contrib.sitemaps',
    'django.contrib.flatpages',
    'django_extensions',
    'taggit',
    'social_auth',
    'haystack',
    'south',
    'crispy_forms',
    'storages',
    'gunicorn',
    'bootstrap_pagination',
    'django_nose',
    'registration',
    'flatblocks',
    'uuidfield',
    'autoslug',
    'entities',
    'chosen',
    'modeltranslation',
    'djcelery',
    'celery_haystack',
    'djcelery_email',
    'devserver',
    'avatar',
    'actstream',
    'debug_toolbar',
    'djsupervisor',
    'django_behave',
    # local apps
    'qa',
    'user',
    'taggit_autosuggest',
    # from open-Knesset
    'links',
    'polyorg',
)

AUTHENTICATION_BACKENDS = (
    'social_auth.backends.twitter.TwitterBackend',
    'social_auth.backends.facebook.FacebookBackend',
    'social_auth.backends.google.GoogleOAuth2Backend',
    'django.contrib.auth.backends.ModelBackend',
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'console': {
            'level': 'ERROR',
            'class': 'logging.StreamHandler',
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins', 'console'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}

ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/u/login/'

DEFAULT_FROM_EMAIL = 'localshot@hasadna.org.il'

#TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
TEST_RUNNER = 'django_behave.runner.DjangoBehaveTestSuiteRunner'

SITE_ID = os.environ.get('SITE_ID', 1)

TWITTER_CONSUMER_KEY         = os.environ.get('TWITTER_CONSUMER_KEY')
TWITTER_CONSUMER_SECRET      = os.environ.get('TWITTER_CONSUMER_SECRET')
FACEBOOK_APP_ID              = os.environ.get('FACEBOOK_APP_ID')
FACEBOOK_API_SECRET          = os.environ.get('FACEBOOK_API_SECRET')
GOOGLE_OAUTH2_CLIENT_ID      = os.environ.get('GOOGLE_OAUTH2_CLIENT_ID')
GOOGLE_OAUTH2_CLIENT_SECRET  = os.environ.get('GOOGLE_OAUTH2_CLIENT_SECRET')
GOOGLE_OAUTH_EXTRA_SCOPE     = ['https://www.googleapis.com/auth/userinfo.profile']
ADMIN_NAME = os.environ.get('ADMIN_NAME', 'open-qna')
ADMIN_EMAIL = os.environ.get('ADMIN_EMAIL', 'open-qna@hasadna.org.il')

SOCIAL_AUTH_PIPELINE = (
    'social_auth.backends.pipeline.social.social_auth_user',
    'social_auth.backends.pipeline.associate.associate_by_email',
    'social_auth.backends.pipeline.user.get_username',
    'social_auth.backends.pipeline.user.create_user',
    'social_auth.backends.pipeline.social.associate_user',
    'social_auth.backends.pipeline.social.load_extra_data',
    'user.utils.get_user_avatar',
)

FACEBOOK_EXTENDED_PERMISSIONS = ['email', 'publish_actions']

ACCOUNT_ACTIVATION_DAYS = 4

ADMINS = [(ADMIN_NAME, ADMIN_EMAIL), ]
MANAGERS = ADMINS

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
        'PATH': os.path.join(PROJECT_DIR, 'whoosh_index'),
    },
}
AUTO_GENERATE_AVATAR_SIZES = (75, 48)
ABSOLUTE_URL_OVERRIDES = {
    'auth.user': lambda u: reverse("public-profile", args = (u.username,)),
}
AVATAR_MAX_AVATARS_PER_USER = 1
AVATAR_GRAVATAR_BACKUP = False
AVATAR_DEFAULT_URL = "http://ok-qa-media.s3.amazonaws.com/img/question_comix.png"

QNA_DEFAULT_ENTITY_ID = 277

CACHES = {
        'default': {
            'BACKEND':
            'django.core.cache.backends.dummy.DummyCache',
            }
        }

LONG_CACHE_TIME = 18000  # 5 hours
MIN_EDITORS_PER_LOCALITY = 3


text:
class ErrorLogger {
  errors = []

  add(err) {
    this.errors.push(err);
  }
}

export default function errorLogger() {
  if (errorLogger.logger) return errorLogger.logger;

  return {
    init() {
      errorLogger.logger = new ErrorLogger();
    },
  };
}


text:
package de.uka.ipd.idaho.goldenGate.plugins;

import java.util.Properties;

import de.uka.ipd.idaho.easyIO.settings.Settings;
import de.uka.ipd.idaho.gamta.MutableAnnotation;
import de.uka.ipd.idaho.goldenGate.DocumentEditor;

/**
 * Components providing specialized views on documents or parts of them may
 * extend this class instead of implementing DocumentViewer themselves
 *
 * @author sautter
 */
public abstract class AbstractDocumentViewer extends AbstractGoldenGatePlugin implements DocumentViewer {

	/* (non-Javadoc)
	 * @see de.goldenGate.resourceManagement.AbstractGoldenGatePlugin#getPluginName()
	 */
	public String getPluginName() {
		return this.getViewMenuName();
	}

	/**
	 * Display the document from the specified DocumentEditor in the way
	 * specific to this document view. This implementation makes the specified
	 * DocumentEditor apply a DocumentProcessor that calls the
	 * showDocument(MutableAnnotation, DocumentEditor) method. Using the
	 * applyDocumentProcessor() method for accessing the document allows for
	 * using the existing undo management, and the synchronization and security
	 * mechanisms.
	 * @param editor the DocumentEditor whose content to show
	 * @see de.uka.ipd.idaho.goldenGate.plugins.DocumentViewer#showDocument(de.uka.ipd.idaho.goldenGate.DocumentEditor)
	 */
	public final void showDocument(DocumentEditor editor) {
		Properties parameters = new Properties();
		parameters.setProperty(Resource.INTERACTIVE_PARAMETER, Resource.INTERACTIVE_PARAMETER);
		this.showDocument(editor, parameters);
	}

	/**
	 * Display the document from the specified DocumentEditor in the way
	 * specific to this document view. This implementation makes the specified
	 * DocumentEditor apply a DocumentProcessor that calls the
	 * showDocument(MutableAnnotation, DocumentEditor) method. Using the
	 * applyDocumentProcessor() method for accessing the document allows for
	 * using the existing undo management, and the synchronization and security
	 * mechanisms. This method enables other plugins to specify parameters that
	 * cause an actual DocumentViewer implementation to display a document in a
	 * way intended by the plugin without prompting a user for viewing
	 * parameters.
	 * @param editor the DocumentEditor whose content to show
	 * @param parameters parameters specifying details on how to show the
	 *            document.
	 * @see de.uka.ipd.idaho.goldenGate.plugins.DocumentViewer#showDocument(de.uka.ipd.idaho.goldenGate.DocumentEditor,java.util.Properties)
	 */
	public void showDocument(DocumentEditor editor, Properties parameters) {
		parameters = new Properties(parameters);
		parameters.setProperty(Resource.INTERACTIVE_PARAMETER, Resource.INTERACTIVE_PARAMETER);
		editor.applyDocumentProcessor(new DocumentViewerProcessor(editor), null, parameters);
	}

	/**
	 * DocumentProcessor implementation for showing specialized views of a
	 * document. Using the applyDocumentProcessor() method for accessing the
	 * document allows for using the existing undo management, and the
	 * synchronization and security mechanisms.
	 *
	 * @author sautter
	 */
	private class DocumentViewerProcessor implements DocumentProcessor {
		private DocumentEditor editor;
		private DocumentViewerProcessor(DocumentEditor editor) {
			this.editor = editor;
		}

		/** @see de.uka.ipd.idaho.goldenGate.plugins.DocumentProcessor#process(de.uka.ipd.idaho.gamta.MutableAnnotation)
		 */
		public void process(MutableAnnotation data) {
			Properties parameters = new Properties();
			parameters.setProperty(Resource.INTERACTIVE_PARAMETER, Resource.INTERACTIVE_PARAMETER);
			this.process(data, parameters);
		}

		/** @see de.uka.ipd.idaho.goldenGate.plugins.DocumentProcessor#process(de.uka.ipd.idaho.gamta.MutableAnnotation, boolean)
		 */
		public void process(MutableAnnotation data, Properties parameters) {
			if (!parameters.containsKey(INTERACTIVE_PARAMETER)) return;
			try {
				showDocument(data, this.editor, parameters);
			}
			catch (Exception e) {
				e.printStackTrace(System.out);
			}
		}

		/** @see de.uka.ipd.idaho.goldenGate.plugins.Resource#getName()
		 */
		public String getName() {
			return getViewMenuName();
		}

		/** @see de.uka.ipd.idaho.goldenGate.plugins.Resource#getProviderClassName()
		 */
		public String getProviderClassName() {
			return ""; // we don't have an actual provider, since this DP is not accessible externally
		}

		/** @see de.uka.ipd.idaho.goldenGate.plugins.Resource#getTypeLabel()
		 */
		public String getTypeLabel() {
			return "Document Viewer";
		}
	}

	/**
	 * Actually display the document (open a respective dialog, or the like)
	 * @param doc the document to show
	 * @param editor the DocumentEdior displaying the specified document (to
	 *            obtain layout information from, may be null)
	 * @param parameters parameters specifying details on how to show the
	 *            document.
	 */
	protected abstract void showDocument(MutableAnnotation doc, DocumentEditor editor, Properties parameters);

	/**
	 * Display a document (open a respective dialog, or the like). This method
	 * is intended for other document processors to invoke. This convenience
	 * implementation fetches the active DocumentEditor from the parent
	 * GoldenGATE via the getActiveDocument() method. Then invokation the loops
	 * through to the three parameter version of this method. Sub classes are
	 * welcome to overwrite this convenience implementation as needed.
	 * @param doc the document to show
	 * @param parameters parameters specifying details on how to show the
	 *            document.
	 * @see de.uka.ipd.idaho.goldenGate.plugins.DocumentViewer#showDocument(de.uka.ipd.idaho.gamta.MutableAnnotation,
	 *      java.util.Properties)
	 */
	public void showDocument(MutableAnnotation doc, Properties parameters) {
		this.showDocument(doc, this.parent.getActivePanel(), parameters);
	}

	/**
	 * This default implementation loops through to the one-argument version of
	 * the method, with null as the argument. Sub classes are welcome to
	 * overwrite it as needed.
	 * @see de.uka.ipd.idaho.goldenGate.plugins.DocumentViewer#getDocumentViewParameterPanel()
	 */
	public DocumentViewParameterPanel getDocumentViewParameterPanel() {
		return this.getDocumentViewParameterPanel(null);
	}

	/**
	 * This default implementation returns null, sub classes are welcome to
	 * overwrite it as needed.
	 * @see de.uka.ipd.idaho.goldenGate.plugins.DocumentViewer#getDocumentViewParameterPanel(de.uka.ipd.idaho.easyIO.settings.Settings)
	 */
	public DocumentViewParameterPanel getDocumentViewParameterPanel(Settings settings) {
		return null;
	}
}


text:
module.exports = function (grunt) {
    grunt.initConfig({
        jshint: {
            files: ['app.js']
        },
        nodemon: {
            dev: {
                script: 'app.js'
            }
        }
    });

    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-nodemon");

    grunt.registerTask('default', ['jshint']);
    grunt.registerTask('dev', ['nodemon:dev']);
    grunt.registerTask('production', ['jshint:production']);
}