text:
require('dotenv').config()

import { Router } from 'express'
import _ from 'lodash'
import logger from '../lib/logger'
import passport from 'passport'
import { Strategy } from 'passport-google-oauth2'

passport.serializeUser(function (user, done) {
  done(null, user.id)
})
passport.deserializeUser(function (obj, done) {
  done(null, obj)
})
passport.use(new Strategy({
  clientID: process.env.GOOGLE_CLIENT_ID,
  clientSecret: process.env.GOOGLE_CLIENT_SECRET,
  callbackURL: process.env.GOOGLE_CLIENT_CALLBACK_URL,
  passReqToCallback: true
}, function (req, accessToken, refreshToken, profile, done) {
  process.nextTick(() => {
    let service = new Service()
    service.provider = 'google'
    service.identity = profile.email
    service.accountId = req.session.passport.user
    service.accessToken = accessToken
    service.refreshToken = refreshToken
    service.profile = profile
    service.save(err => {
      if(err) {
        logger.warn(err)
      }
      return done(null, profile)
    })
  })
}))

const router = Router()

let scope = [
  'https://www.googleapis.com/auth/plus.me',
	'https://www.googleapis.com/auth/plus.login',
  'https://www.googleapis.com/auth/userinfo.email',
	'https://www.googleapis.com/auth/userinfo.profile',
	'https://www.googleapis.com/auth/drive',
	'https://mail.google.com/',
	'https://www.google.com/m8/feeds',
	'https://www.googleapis.com/auth/contacts.readonly',
	'https://www.googleapis.com/auth/calendar'
]

router.get('/', passport.authenticate('google', {
  session: true,
  accessType: 'offline',
  approvalPrompt: 'force',
  scope: scope
}))

router.get('/callback', (req, res, next) => {
  passport.authenticate('google', function(err, profile, info) {
    res.send('OK')
  })(req, res, next)
})

export default router


text:
<?php

/** Zend_Dojo_Form_Element_Dijit */
require_once 'Zend/Dojo/Form/Element/Dijit.php';

/**
 * dijit.form.SimpleTextArea
 *
 * @uses       Zend_Dojo_Form_Element_Dijit
 * @category   Zend
 * @package    Zend_Dojo
 * @subpackage Form_Element
 * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: SimpleTextarea.php 16971 2009-07-22 18:05:45Z mikaelkael $
 */
class Zend_Dojo_Form_Element_SimpleTextarea extends Zend_Dojo_Form_Element_Dijit
{
    /**
     * Use SimpleTextarea dijit view helper
     * @var string
     */
    public $helper = 'SimpleTextarea';
}

redpajama_set_name: RedPajamaGithub


text:
from Object import Object

class Furniture(Object):
    def __init__(self,mass,material,color):
        Object.__init__(self,mass=mass,color=color)
        self.setMaterial(material)

    def __str__(self):
        return ';'.join([self.material,Object.__str__(self)])

    def setMaterial(self,material):
        self.material=str(material)

class Sittable(Furniture):
    def __init__(self,mass,material,maxpersons,color,sitting=0):
        Furniture.__init__(self,mass,material,color)
        self.setMaxPersons(maxpersons)
        self.setSitting(sitting)

    def __str__(self):
        return ';'.join([str(self.sitting),str(self.maxpersons),Furniture.__str__(self)])

    def setMaxPersons(self,persons):
        persons=int(persons)
        if persons>=0:
            self.maxpersons=persons
        else:
            raise ValueError('Value cannot be negative!')

    def setSitting(self,sitting):
        sitting=int(sitting)
        if sitting>=0:
            if sitting<=self.maxpersons:
                self.sitting=sitting
            else:
                raise ValueError('No space left!')
        else:
            raise ValueError('Value cannot be negative!')

    def sitDown(self,count=1):
        count=int(count)
        self.setSitting(count+self.sitting)

    def standUp(self,count=1):
        count=int(count)
        self.setSitting(self.sitting-count)

class Chair(Sittable):
    def __init__(self,mass,material,color,maxpersons=1,sitting=0):
        Sittable.__init__(self,mass,material,maxpersons,color,sitting)


text:
function time() {
  return Math.floor(Math.random() * 3e3);
}

function square(n, cb) {
  setTimeout(function() {
    cb(null, n * n);
  }, time());
}

module.exports = function collectionSquare(numbers, cb) {
  var pending = numbers.length;
  var results = [];
  var calledback = false;

  numbers.forEach(function(n, index) {
    square(n, function(err, result) {
      pending --;
      if (err) {
        callback(err);
      }
      else {
        results[index] = result;
        if (! pending) {
          callback(null, results);
        }
      }

    });
  });

  function callback(err, results) {
    if (! calledback) {
      calledback = true;
      cb(err, results);
    }
  }
};


text:
Imports System.Web.Mvc
Imports System.Web.Routing

Public Class MvcApp
    Inherits HttpApplication

    Sub Application_Start(sender As Object, e As EventArgs)
        ' Fires when the application is started
        AreaRegistration.RegisterAllAreas()
        RouteConfig.RegisterRoutes(RouteTable.Routes)
    End Sub
End Class


text:
import csv

def fix_turnstile_data(filenames):
    '''
    Filenames is a list of MTA Subway turnstile text files. A link to an example
    MTA Subway turnstile text file can be seen at the URL below:
    http://web.mta.info/developers/data/nyct/turnstile/turnstile_110507.txt

    As you can see, there are numerous data points included in each row of the
    a MTA Subway turnstile text file.

    You want to write a function that will update each row in the text
    file so there is only one entry per row. A few examples below:
    A002,R051,02-00-00,05-28-11,00:00:00,REGULAR,003178521,001100739
    A002,R051,02-00-00,05-28-11,04:00:00,REGULAR,003178541,001100746
    A002,R051,02-00-00,05-28-11,08:00:00,REGULAR,003178559,001100775

    Write the updates to a different text file in the format of "updated_" + filename.
    For example:
        1) if you read in a text file called "turnstile_110521.txt"
        2) you should write the updated data to "updated_turnstile_110521.txt"

    The order of the fields should be preserved. Remember to read through the
    Instructor Notes below for more details on the task.

    In addition, here is a CSV reader/writer introductory tutorial:
    http://goo.gl/HBbvyy

    You can see a sample of the turnstile text file that's passed into this function
    and the the corresponding updated file in the links below:

    Sample input file:
    https://www.dropbox.com/s/mpin5zv4hgrx244/turnstile_110528.txt
    Sample updated file:
    https://www.dropbox.com/s/074xbgio4c39b7h/solution_turnstile_110528.txt
    '''
    for name in filenames:
        in_file = open(name,'r')
        out_file = open('updated_'+name, 'w')
        csv_in = csv.reader(in_file,delimiter=',')
        csv_out = csv.writer(out_file,delimiter=',')

        for line in csv_in:
            header1 = line[0]
            header2 = line[1]
            header3 = line[2]
            count = 0
            line_1 = [header1,header2,header3]
            #print line
            for entry in line:
                if entry != header1 and entry != header2 and entry != header3:
                    line_1 = line_1 + [entry]
                    count += 1
                    if count == 5:
                        csv_out.writerow(line_1)
                        count = 0
                        line_1 = [header1,header2,header3]


text:
package com.evolveum.midpoint.model.intest.negative;

import java.io.File;
import java.util.Map;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.marshaller.XNodeProcessorEvaluationMode;
import com.evolveum.midpoint.prism.xnode.PrimitiveXNode;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;

import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest;
import com.evolveum.midpoint.prism.xnode.ValueParser;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.test.DummyResourceContoller;
import com.evolveum.midpoint.test.util.TestUtil;
import com.evolveum.midpoint.util.DOMUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType;
import com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage;
import com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultType;
import com.evolveum.midpoint.xml.ns._public.common.fault_3.SchemaViolationFaultType;
import com.evolveum.prism.xml.ns._public.types_3.ChangeTypeType;
import com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;
import com.evolveum.prism.xml.ns._public.types_3.ModificationTypeType;
import com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType;
import com.evolveum.prism.xml.ns._public.types_3.RawType;

/**
 * @author semancik
 *
 */
@ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"})
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
public class TestModelWebServiceNegative extends AbstractInitializedModelIntegrationTest {

    public static final File TEST_DIR = new File("src/test/resources/crud");
    public static final File TEST_CONTRACT_DIR = new File("src/test/resources/contract");

    public static final File RESOURCE_MAROON_FILE = new File(TEST_DIR, "resource-dummy-maroon.xml");
    public static final String RESOURCE_MAROON_OID = "10000000-0000-0000-0000-00000000e104";

    private static final String USER_MORGAN_OID = "c0c010c0-d34d-b33f-f00d-171171117777";
    private static final String USER_BLACKBEARD_OID = "c0c010c0-d34d-b33f-f00d-161161116666";

    private static String accountOid;

    /**
     * First tests are positive, to make sure that this method works.
     */
    @Test
    public void test100ModifyAccountExplicitType() throws Exception {
        final String TEST_NAME = "test100ModifyUserAddAccount";
        TestUtil.displayTestTitle(this, TEST_NAME);

        // GIVEN
        Task task = taskManager.createTaskInstance(TestModelWebServiceNegative.class.getName() + "." + TEST_NAME);

        ObjectDeltaType objectChange = createShadowReplaceChange(ACCOUNT_SHADOW_GUYBRUSH_OID,
                "attributes/"+DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME,
                "foo", DOMUtil.XSD_STRING);
        ObjectDeltaListType deltaList = new ObjectDeltaListType();
        deltaList.getDelta().add(objectChange);

        // WHEN
        modelWeb.executeChanges(deltaList, null);

        // THEN

        // Check account in dummy resource
        assertDefaultDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true);
        assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME,
                DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "foo");
    }

    /**
     * First tests are positive, to make sure that this method works.
     */
    @Test
    public void test110ModifyAccountImplicitType() throws Exception {
        final String TEST_NAME = "test110ModifyAccountImplicitType";
        TestUtil.displayTestTitle(this, TEST_NAME);

        // GIVEN
        Task task = taskManager.createTaskInstance(TestModelWebServiceNegative.class.getName() + "." + TEST_NAME);

        ObjectDeltaType objectChange = createShadowReplaceChange(ACCOUNT_SHADOW_GUYBRUSH_OID,
                "attributes/"+DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME,
                "bar", null);
        ObjectDeltaListType deltaList = new ObjectDeltaListType();
        deltaList.getDelta().add(objectChange);

        // WHEN
        modelWeb.executeChanges(deltaList, null);

        // THEN

        // Check account in dummy resource
        assertDefaultDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true);
        assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME,
                DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "bar");
    }

    @Test
    public void test200ModifyAccountWrongExplicitType() throws Exception {
        final String TEST_NAME = "test200ModifyAccountWrongExplicitType";
        TestUtil.displayTestTitle(this, TEST_NAME);

        // GIVEN
        Task task = taskManager.createTaskInstance(TestModelWebServiceNegative.class.getName() + "." + TEST_NAME);

        ObjectDeltaType objectChange = createShadowReplaceChange(ACCOUNT_SHADOW_GUYBRUSH_OID,
                "attributes/"+DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME,
                "42", DOMUtil.XSD_INT);
        ObjectDeltaListType deltaList = new ObjectDeltaListType();
        deltaList.getDelta().add(objectChange);

        // WHEN, THEN
        //assertExecuteChangesFailure(deltaList, null, SchemaViolationFaultType.class, "The value of type", "cannot be applied to attribute");
        assertExecuteChangesFailure(deltaList, null, SchemaViolationFaultType.class, "Expected", "but got class");
    }

    private void assertExecuteChangesFailure(ObjectDeltaListType deltaList, ModelExecuteOptionsType options,
            Class<? extends FaultType> expectedFaultTypeClass, String... messagePatterns) throws Exception {

        try {
            modelWeb.executeChanges(deltaList, options);

            AssertJUnit.fail("Unexpected success");
        } catch (FaultMessage f) {
            FaultType faultInfo = f.getFaultInfo();
            if (expectedFaultTypeClass.isAssignableFrom(faultInfo.getClass())) {
                // This is expected
                String message = f.getMessage();
                for (String pattern: messagePatterns) {
                    if (!message.contains(pattern)) {
                        AssertJUnit.fail("Exception message does not contain pattern '"+pattern+"': "+message);
                    }
                }
            } else {
                AssertJUnit.fail("Expected fault type of "+expectedFaultTypeClass+" but got "+faultInfo.getClass());
            }
        }
    }

    // TODO: more negative tests

    private ObjectDeltaType createShadowReplaceChange(String oid, String path, final String value, QName type) {
        ObjectDeltaType objectChange = new ObjectDeltaType();
        objectChange.setOid(oid);
        objectChange.setChangeType(ChangeTypeType.MODIFY);
        objectChange.setObjectType(ObjectTypes.SHADOW.getTypeQName());
        ItemDeltaType itemDeltaType = new ItemDeltaType();
        itemDeltaType.setModificationType(ModificationTypeType.REPLACE);
        ItemPathType itemPath = prismContext.itemPathParser().asItemPathType(path);
        itemDeltaType.setPath(itemPath);
        ValueParser<String> valueParser = new ValueParser<String>() {
            @Override
            public String parse(QName typeName, XNodeProcessorEvaluationMode mode) throws SchemaException {
                return value;
            }

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

            @Override
            public String getStringValue() {
                return value;
            }

            @Override
            public Map<String, String> getPotentiallyRelevantNamespaces() {
                throw new UnsupportedOperationException();
            }
        };
        PrimitiveXNode<String> xnode = prismContext.xnodeFactory().primitive(valueParser, type, type != null);
        RawType rawValue = new RawType(xnode, prismContext);
        itemDeltaType.getValue().add(rawValue);
        objectChange.getItemDelta().add(itemDeltaType);
        return objectChange;
    }
}


text:
.ajax__combobox_buttoncontainer button {
    background-position: center;
    background-repeat: no-repeat;
    border-color: ButtonFace;
    height: 15px;
    width: 15px;
}

.ajax__combobox_itemlist {
    background-color: Window;
    border: solid 1px ButtonShadow;
    color: WindowText;
    cursor: default;
    list-style-type: none;
    margin: 0;
    padding: 0;
    text-align: left;
}

.ajax__combobox_itemlist li {
    padding: 0 3px 0 2px;
    white-space: nowrap;
    width: 100%;
}

.ajax__combobox_inputcontainer {
    border-spacing: 0;
}

.ajax__combobox_inputcontainer td {
    padding: 0;
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Bootstrap, from Twitter</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <link href="css/twitter-bootstrap/bootstrap.css" rel="stylesheet">
    <link href="css/twitter-bootstrap/docs/assets/css/docs.css" rel="stylesheet">
    <link href="css/twitter-bootstrap/docs/assets/js/google-code-prettify/prettify.css" rel="stylesheet">

    <link rel="shortcut icon" type="image/x-icon" href="assets/ico/favicon.ico">
    <link rel="apple-touch-icon" href="assets/ico/bootstrap-apple-57x57.png">
    <link rel="apple-touch-icon" sizes="72x72" href="assets/ico/bootstrap-apple-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="assets/ico/bootstrap-apple-114x114.png">

Project Name

Home

Link

Link

Link

                        Dropdown

Secondary link

Something else here

Another link

                <form class="pull-left" action="">
                    <input type="text" placeholder="Search">
                </form>

                        Dropdown

Secondary link

Something else here

Another link

Lorem ipsum

        &times;

Lorem ipsum dolor sit amet

        Lorem ipsum dolor
        Sit Amet

    &times;

Lorem ipsum dolor sit amet! Fusce interdum euismod tempor...

        Lorem ipsum dolor
        Sit amet

    ×

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    ×

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    ×

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    ×

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    &times;

Lorem ipsum Fusce interdum euismod tempor...

Column #1

Content for column #1.

Column #2

Content for column #2.

Column #3

Content for column #3.

Column #1

Content for column #1.

Column #3

Content for column #3.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.

    Connor Turnbull, August 30th

Lorem ipsum dolor sit amet

Consectetur adipiscing elit

    ...

Lorem ipsum dolor sit amet

Consectetur adipiscing elit

    ...

Lorem ipsum dolor sit amet

Consectetur adipiscing elit

    ...

Lorem ipsum

Lorem ipsum dolor sit amet

Consectetur

Consectetur adipiscing elit

    ...

        #
        First Name
        Last Name
        Language

        1
        Some
        One
        English

        2
        Joe
        Sixpack
        English

        3
        Stu
        Dent
        Code

<form>
    <fieldset>
        <legend>Lorem ipsum dolor sit amet</legend>

            Lorem ipsum

                <input class="error" type="text" />
                Dolor sit amet

            Lorem Ipsum

                <select>
                    <option>Lorem</option>
                    <option>Ipsum</option>
                    <option>Dolor</option>
                    <option>Sit</option>
                    <option>Amet</option>
                </select>

                <select class="medium">
                    <option>Lorem</option>
                    <option>Ipsum</option>
                    <option>Dolor</option>
                    <option>Sit</option>
                    <option>Amet</option>
                </select>

            Lorem ipsum

                            <input type="checkbox" />
                            Lorem ipsum dolor sit amet

                            <input type="checkbox" disabled />
                            Lorem ipsum dolor sit amet

                Lorem ipsum

                    <input type="text" />
                    <input type="checkbox" />

                Lorem ipsum

                    <input type="checkbox" />
                    <input type="text" />

                Lorem ipsum

                    <input type="file" class="input-file" />

                Lorem ipsum

                    <textarea></textarea>

            <button class="btn disabled">Lorem ipsum</button>
            Lorem ipsum

            <button class="btn primary">Primary</button>
            <button class="btn">Default</button>
            <button class="btn info">Info</button>
            <button class="btn success">Success</button>
            <button class="btn danger">Danger</button>

    </fieldset>

</form>

Lorem

Ipsum

Dolor

Sit

Amet

Lorem

Ipsum

Dolor

Sit

Amet

Prev

1

2

3

4

5

Next


text:
namespace Jmx {

  export class TreeController {

    constructor(
      private $scope: ng.IScope,
      private $location: ng.ILocationService,
      private workspace: Workspace,
      private $element: JQuery,
      private $timeout: ng.ITimeoutService) {
      'ngInject';
      // it's not possible to declare classes to the component host tag in AngularJS
      $element.addClass('tree-nav-sidebar-content');
    }

    $onInit(): void {
      this.$scope.$on('$destroy', () => this.removeTree());
      this.$scope.$on(TreeEvent.Updated, () => this.populateTree());
      this.$scope.$on('$routeChangeStart', () => this.updateSelectionFromURL());

      this.populateTree();
    }

    updateSelectionFromURL(): void {
      updateTreeSelectionFromURL(this.$location, $(treeElementId));
    }

    private populateTree(): void {
      log.debug('TreeController: populateTree');
      this.removeTree();
      enableTree(this.$scope, this.$location, this.workspace, $(treeElementId), this.workspace.tree.children);
      this.$timeout(() => {
        this.updateSelectionFromURL();
        this.workspace.broadcastSelectionNode();
      });
    }

    private removeTree(): void {
      const tree = ($(treeElementId) as any).treeview(true);
      // There is no exposed API to check whether the tree has already been initialized,
      // so let's just check if the methods are presents
      if (tree.clearSearch) {
        tree.clearSearch();
        // Bootstrap tree view leaks the node elements into the data structure
        // so let's clean this up when the user leaves the view
        const cleanTreeFolder = (node: Folder) => {
          delete node['$el'];
          if (node.nodes) node.nodes.forEach(cleanTreeFolder);
        };
        cleanTreeFolder(this.workspace.tree);
        // Then call the tree clean-up method
        tree.remove();
      }
    }
  }

  export const treeComponent: angular.IComponentOptions = {
    templateUrl: 'plugins/jmx/html/tree/content.html',
    controller: TreeController,
  };

}


text:
// Common functionality across related commands

import * as util from './sketch-util';

const COL_LENGTH = 2; // # of digits for the column

/**
 * Returns an array of all the artboards to target for grid operations
 * (e.g. re-number, rearrange, etc)
 */
export function collectTargetArtboards(context) {
  if (context.selection.count()) {
    // if there's an active selection inside an artboard, consider
    // the artboards containing the selection the target
    let selectedArtboards = util.arrayFromNSArray(context.selection)
        .map(layer => util.getContainingArtboard(layer))
        .filter(layer => !!layer);
    if (selectedArtboards.length >= 2) {
      return selectedArtboards;
    }
  }

  // otherwise, all artboards on the page
  return util.arrayFromNSArray(context.document.currentPage().artboards());
}

/**
 * Generates artboard metadata (primarily the object and frame)
 */
export function generateArtboardMetas(artboards) {
  return artboards.map(artboard => {
    let frame = artboard.frame();
    return {
      artboard,
      l: Number(frame.x()),
      t: Number(frame.y()),
      r: Number(frame.x() + frame.width()),
      b: Number(frame.y() + frame.height())
    };
  });
}

/**
 * Parses the given artboard name based on the given resolved preferences.
 */
export function parseCurrentArtboardName(fullName, resolvedPrefs) {
  let {numberTitleSeparator} = resolvedPrefs;
  let path = fullName.substring(0, fullName.lastIndexOf('/') + 1);
  let currentName = fullName.slice(path.length);
  let [_, rowCol, subCol, baseName] = currentName.match(new RegExp(
      '^(?:(\\d+)(?:\.(\\d+))?)?' + // row/col/subcol
      '(?:' + escapeRegExp(numberTitleSeparator) + ')?' + // separator
      '(.+?)?$')); // basename

  subCol = Number(subCol || 0);
  let row = 0;
  let col = -1;
  if (rowCol) {
    row = Number(rowCol.slice(0, -COL_LENGTH));
    col = Number(rowCol.slice(-COL_LENGTH));
  }

  return {path, row, col, subCol, baseName};
}

/**
 * Creates a new artboard name based on the given pieces and resolved preferences.
 */
export function composeArtboardName(parts, resolvedPrefs, {numRows = 1} = {}) {
  let {numberTitleSeparator} = resolvedPrefs;
  let {path, row, col, subCol, baseName} = parts;

  let name = path || '';

  // create prefix (e.g. "301" and "415.4" with subflows)
  let hasNumber = row && (col >= 0);
  if (hasNumber) {
    name += zeropad(row, numRows >= 10 ? 2 : 1)
        // + String(rowColSeparator)
        + zeropad(col, COL_LENGTH)
        + (subCol ? ('.' + String(subCol)) : '');
  }

  if (baseName) {
    name += (hasNumber ? numberTitleSeparator : '') + baseName;
  }

  return name;
}

/**
 * Left-pads the given string with zeros to the given length.
 */
function zeropad(s, length = 1) {
  s = String(s) || '';
  while (s.length < length) {
    s = '0' + s;
  }
  return s;
}

/**
 * Escape a string for use in a regex
 * From https://stackoverflow.com/a/6969486/102703
 */
function escapeRegExp(string) {
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}


text:
    Depart Imminent des dossards
    {{ nextStart.firstNum }}-{{ nextStart.lastNum }}!

    Depart des dossards
    {{ nextStart.nextFirst }}-{{ nextStart.nextLast }}
    dans 5 minutes.

    <sponsors-view [forcePortrait]="true"></sponsors-view>


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.isapp.chips"
          xmlns:android="http://schemas.android.com/apk/res/android">

  <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme.NoActionBar">
    <activity android:name=".ChipsActivity"
              android:label="@string/title_activity_chips">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>

        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
    </activity>
  </application>

</manifest>


text:
package Diary;

import javax.swing.*;
import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by User on 08.10.2015.
 */
public class Main
{
    public  static List<DiaryRow> diary =new ArrayList<>();
    public static FileWriter fileWriter;
    public static String pathToFile;
    public static NewTask dialog;//=new NewTask();

    public static void main(String[] args)
    {

        loadFromFile();
        dialog=new NewTask();
        dialog.setVisible(false);
        new MainFrame(diary);
    }

    private static void addStringToDiaryList(String temp)
    {
        String[] tempSplit=temp.split("#");
        diary.add(new DiaryRow(tempSplit[1].trim(),tempSplit[0].trim(),new Boolean(tempSplit[2])));
    }

    public static void saveToFile()
    {

        if(pathToFile=="" || pathToFile==null)
        {
            JFileChooser chooser=new JFileChooser();
            int ret=chooser.showDialog(null, "Select File to save");
            if(ret==JFileChooser.APPROVE_OPTION)
            {
                pathToFile = chooser.getSelectedFile().getPath();
            }
        }

        try
        {
            fileWriter =new FileWriter(pathToFile);
        } catch (IOException e)
        {
            e.printStackTrace();
        }

        try(CSVWriter writer=new CSVWriter(fileWriter))
        {

            for(DiaryRow temp:diary)
            {
                try
                {
                    writer.writeLine(temp.toString());
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
            }

        } catch (Exception e)
        {
            e.printStackTrace();
        }

    }

    public static void loadFromFile()
    {
        JFileChooser chooser=new JFileChooser();
        int ret=chooser.showDialog(null, "Select File");
        if(ret==JFileChooser.APPROVE_OPTION)
        {
            pathToFile = chooser.getSelectedFile().getPath();

            try (FileReader fileReader = new FileReader(pathToFile);
                 CSVReader reader = new CSVReader(fileReader))
            {
                String tmp;

                while ((tmp = reader.readRow()) != null)
                {
                    addStringToDiaryList(tmp);
                }

            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            } catch (NullPointerException e)
            {
                e.printStackTrace();
            } catch (IOException e)
            {
                e.printStackTrace();
            } catch (Exception e)
            {
                e.printStackTrace();
            }
        }
        else
        {
            diary = new ArrayList<>();
        }

    }

    public static void createNew(DiaryRow newTask)
    {

        diary.add(newTask);
        saveToFile();
    }

    public static void openDialogNewTask(final MainFrame temp)
    {
        dialog.setTemp(temp);

        if(!dialog.isVisible())
        {
            dialog.setVisible(true);
        }
    }

}


text:
<?php

/**
 * This file is part of the Minty templating library.
 * (c) Dániel Buga <daniel@bugadani.hu>
 *
 * For licensing information see the LICENSE file.
 */

namespace Minty\Compiler\Tags;

use Minty\Compiler\Tag;

class ElseIfTag extends Tag
{
    public function getTag()
    {
        return 'elseif';
    }
}


text:
/**
 * @file
 * @author  Jan Olszak (j.olszak@samsung.com)
 * @brief   C++ wrapper for glib input monitor
 */

#include "config.hpp"

#include "input-monitor-config.hpp"
#include "input-monitor.hpp"
#include "zones-manager.hpp"
#include "exception.hpp"

#include "logger/logger.hpp"
#include "utils/exception.hpp"
#include "utils/fs.hpp"
#include "utils/fd-utils.hpp"

#include <cassert>
#include <cstring>
#include <fcntl.h>
#include <linux/input.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include <boost/filesystem.hpp>
#include <vector>
#include <functional>

#ifdef USE_BOOST_REGEX
#include <boost/regex.hpp>
namespace rgx = boost;
#else
#include <regex>
namespace rgx = std;
#endif

using namespace utils;
namespace fs = boost::filesystem;

namespace vasum {

namespace {
const int MAX_TIME_WINDOW_SEC = 10;
const int KEY_PRESSED = 1;
const int DEVICE_NAME_LENGTH = 256;
const int MAX_NUMBER_OF_EVENTS = 10;
const std::string DEVICE_DIR = "/dev/input/";

} // namespace

InputMonitor::InputMonitor(cargo::ipc::epoll::EventPoll& eventPoll,
                           const InputConfig& inputConfig,
                           ZonesManager* zonesManager)
    : mConfig(inputConfig)
    , mZonesManager(zonesManager)
    , mFd(-1)
    , mEventPoll(eventPoll)
{
    if (mConfig.timeWindowMs > MAX_TIME_WINDOW_SEC * 1000L) {
        const std::string msg = "Time window exceeds maximum: " + MAX_TIME_WINDOW_SEC;
        LOGE(msg);
        throw TimeoutException(msg);
    }

    if (mConfig.numberOfEvents > MAX_NUMBER_OF_EVENTS) {
        const std::string msg = "Number of events exceeds maximum: " + MAX_NUMBER_OF_EVENTS;
        LOGE(msg);
        throw InputMonitorException(msg);
    }

    mDevicePath = getDevicePath();

    LOGT("Input monitor configuration: \n"
         << "\tenabled: " << mConfig.enabled << "\n"
         << "\tdevice: " << mConfig.device << "\n"
         << "\tpath: " << mDevicePath << "\n"
         << "\ttype: " << EV_KEY << "\n"
         << "\tcode: " << mConfig.code << "\n"
         << "\tvalue: " << KEY_PRESSED << "\n"
         << "\tnumberOfEvents: " << mConfig.numberOfEvents << "\n"
         << "\ttimeWindowMs: " << mConfig.timeWindowMs);
}

InputMonitor::~InputMonitor()
{
    std::unique_lock<std::mutex> mMutex;
    LOGD("Destroying InputMonitor");
    stop();
}

void InputMonitor::start()
{
    std::unique_lock<Mutex> mMutex;
    setHandler(mDevicePath);
}

void InputMonitor::stop()
{
    leaveDevice();
}

namespace {

bool isDeviceWithName(const rgx::regex& deviceNameRegex,
                      const fs::directory_entry& directoryEntry)
{
    std::string path = directoryEntry.path().string();

    if (!utils::isCharDevice(path)) {
        return false;
    }

    int fd = ::open(path.c_str(), O_RDONLY);
    if (fd < 0) {
        LOGD("Failed to open " << path);
        return false;
    }

    char name[DEVICE_NAME_LENGTH];
    if (::ioctl(fd, EVIOCGNAME(sizeof(name)), name) < 0) {
        LOGD("Failed to get the device name of: " << path);
        if (::close(fd) < 0) {
            LOGE("Error during closing file " << path);
        }
        return false;
    }

    if (::close(fd) < 0) {
        LOGE("Error during closing file " << path);
    }

    LOGD("Checking device: " << name);
    if (rgx::regex_match(name, deviceNameRegex)) {
        LOGI("Device file found under: " << path);
        return true;
    }

    return false;
}

} // namespace

std::string InputMonitor::getDevicePath() const
{
    std::string device = mConfig.device;
    if (fs::path(device).is_absolute()
            && fs::exists(device)) {
        LOGD("Device file path is given");
        return device;
    }

    // device name is given - device file path is to be determined
    LOGT("Determining, which device node is assigned to '" << device << "'");
    using namespace std::placeholders;
    fs::directory_iterator end;
    rgx::regex deviceNameRegex(".*" + device + ".*");
    const auto it = std::find_if(fs::directory_iterator(DEVICE_DIR),
                                 end,
                                 std::bind(isDeviceWithName, deviceNameRegex, _1));
    if (it == end) {
        LOGE("None of the files under '" << DEVICE_DIR <<
             "' represents device named: " << device);
        throw InputMonitorException("Cannot find a device");
    }

    return it->path().string();
}

void InputMonitor::setHandler(const std::string& devicePath)
{
    using namespace std::placeholders;

    // We need NONBLOCK for FIFOs in the tests
    mFd = ::open(devicePath.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC);
    if (mFd < 0) {
        const std::string msg = "Cannot create input monitor channel. Device file: " +
                                devicePath + " doesn't exist";
        LOGE(msg);
        throw InputMonitorException(msg);
    }
    mEventPoll.addFD(mFd, EPOLLIN, std::bind(&InputMonitor::handleInternal, this, _1, _2));
}

void InputMonitor::handleInternal(int /* fd */, cargo::ipc::epoll::Events events)
{
    struct input_event ie;
    try {
        if (events == EPOLLHUP) {
            stop();
            return;
        }
        utils::read(mFd, &ie, sizeof(struct input_event));
    } catch (const std::exception& ex) {
        LOGE("Read from input monitor channel failed: " << ex.what());
        return;
    }
    if (isExpectedEventSequence(ie)) {
        LOGI("Input monitor detected pattern.");
        if (mZonesManager->isRunning()) {
            mZonesManager->switchingSequenceMonitorNotify();
        }
    }
}

void InputMonitor::leaveDevice()
{
    if (mFd != -1) {
        mEventPoll.removeFD(mFd);
        utils::close(mFd);
        mFd = -1;
    }
}

bool InputMonitor::isExpectedEventSequence(const struct input_event& ie)
{
    LOGT("Event detected [" << mConfig.device.c_str() << "]:\n"
         << "\ttime: " << ie.time.tv_sec << "." << ie.time.tv_usec << " sec\n"
         << "\ttype, code, value: " << ie.type << ", " << ie.code << ", " << ie.value);

    if (ie.type != EV_KEY
            || ie.code != mConfig.code
            || ie.value != KEY_PRESSED) {
        LOGT("Wrong kind of event");
        return false;
    }

    mEventTimes.push_back(ie.time);

    if (mEventTimes.size() < static_cast<unsigned int>(mConfig.numberOfEvents)) {
        LOGT("Event sequence too short");
        return false;
    }

    struct timeval oldest = mEventTimes.front();
    mEventTimes.pop_front();
    struct timeval latest = mEventTimes.back();

    long int secDiff = latest.tv_sec - oldest.tv_sec;
    if (secDiff >= MAX_TIME_WINDOW_SEC) {
        LOGT("Time window exceeded");
        return false;
    }

    long int timeDiff = secDiff * 1000L;
    timeDiff += static_cast<long int>((latest.tv_usec - oldest.tv_usec) / 1000L);
    if (timeDiff < mConfig.timeWindowMs) {
        LOGD("Event sequence detected");
        mEventTimes.clear();
        return true;
    }

    LOGT("Event sequence not detected");
    return false;
}
} // namespace vasum


text:
SetPromptText::SetPromptText(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}

void SetPromptText::start()
{
  page()->setPromptText(arguments()[0]);
  emitFinished(true);
}


text:
require_relative "test_helper"

class SafeByDefaultTest < Minitest::Test
  def setup
    StrongMigrations.safe_by_default = true
  end

  def teardown
    StrongMigrations.safe_by_default = false
  end

  def test_add_index
    assert_safe AddIndex
  end

  def test_add_index_extra_arguments
    if postgresql? || ActiveRecord::VERSION::STRING.to_f != 6.0
      assert_argument_error AddIndexExtraArguments
    else
      assert_type_error AddIndexExtraArguments
    end
  end

  def test_add_index_corruption
    # TODO fix
    skip # unless postgresql?
    outside_developer_env do
      with_target_version(14.3) do
        assert_unsafe AddIndex, "can cause silent data corruption in Postgres 14.0 to 14.3"
      end
    end
  end

  def test_remove_index
    migrate AddIndex
    assert_safe RemoveIndex
    assert_safe RemoveIndexColumn
  ensure
    migrate AddIndex, direction: :down
  end

  def test_remove_index_name
    migrate AddIndexName
    migrate RemoveIndexName
  end

  def test_remove_index_options
    skip if ActiveRecord::VERSION::STRING.to_f < 6.1

    migrate RemoveIndexOptions
  end

  def test_remove_index_extra_arguments
    assert_argument_error RemoveIndexExtraArguments
  end

  def test_add_reference
    assert_safe AddReference
  end

  def test_add_reference_foreign_key
    assert_safe AddReferenceForeignKey
  end

  def test_add_reference_foreign_key_to_table
    assert_safe AddReferenceForeignKeyToTable
  end

  def test_add_reference_extra_arguments
    assert_argument_error AddReferenceExtraArguments
  end

  def test_add_foreign_key
    assert_safe AddForeignKey
  end

  def test_add_foreign_key_extra_arguments
    if postgresql? || ActiveRecord::VERSION::MAJOR >= 6
      assert_argument_error AddForeignKeyExtraArguments
    else
      assert_type_error AddForeignKeyExtraArguments
    end
  end

  def test_add_check_constraint
    skip unless check_constraints? && postgresql?

    assert_safe AddCheckConstraint
  end

  def test_add_check_constraint_extra_arguments
    skip unless check_constraints? && postgresql?

    assert_argument_error AddCheckConstraintExtraArguments
  end

  def test_change_column_null
    skip unless postgresql?

    with_target_version(12) do
      assert_safe ChangeColumnNull
    end
  end

  def test_change_column_null_constraint
    skip unless postgresql?

    with_target_version(11) do
      assert_safe ChangeColumnNull
    end
  end

  def test_change_column_null_default
    skip unless postgresql?

    # TODO add
    # User.create!
    error = assert_raises(StrongMigrations::Error) do
      with_target_version(12) do
        assert_safe ChangeColumnNullDefault
      end
    end
    assert_match "default value not supported yet with safe_by_default", error.message
  ensure
    User.delete_all
  end
end


text:
package org.zalando.guild.api.json.fields.jackson;

import java.util.List;

import javax.annotation.Nonnull;

/**
 * This abstraction holds the context for the fields hierarchy required by the {@link JsonFieldsFilterProvider}.
 *
 * @author  Sean Patrick Floyd (sean.floyd@zalando.de)
 * @since   23.09.2015
 */
public interface ContextProvider {

    /**
     * Return the current list of fields. This will usually be an unmodifiable list.
     */
    @Nonnull
    List<String> getContext();

    /**
     * Add the supplied field name to the end of the context.
     */
    void pushContext(@Nonnull String context);

    /**
     * Remove the last element from the field context.
     */
    void popContext();

    /**
     * Clear the context.
     */
    void clear();
}


text:
[![Docker Pulls](https://img.shields.io/docker/pulls/kaixhin/cuda-lasagne.svg)](https://hub.docker.com/r/kaixhin/cuda-lasagne/)
[![Docker Stars](https://img.shields.io/docker/stars/kaixhin/cuda-lasagne.svg)](https://hub.docker.com/r/kaixhin/cuda-lasagne/)

cuda-lasagne
============
Ubuntu Core 14.04 + [CUDA 7.5](http://www.nvidia.com/object/cuda_home_new.html) + [cuDNN v5](https://developer.nvidia.com/cuDNN) + [Lasagne](http://lasagne.readthedocs.org/).

Requirements
------------

- [NVIDIA Docker](https://github.com/NVIDIA/nvidia-docker) - see [requirements](https://github.com/NVIDIA/nvidia-docker/wiki/CUDA#requirements) for more details.

Usage
-----
Use NVIDIA Docker: ``nvidia-docker run -it kaixhin/cuda-lasagne``.

For more information on CUDA on Docker, see the [repo readme](https://github.com/Kaixhin/dockerfiles#cuda).

Citation
--------
If you find this useful in research please consider [citing this work](https://github.com/Kaixhin/dockerfiles/blob/master/CITATION.md).


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1" xml:lang="en">
  <title>Preparing and Adding Hosts</title>
  <shortdesc>Verify your new host systems are ready for integration into the existing Greenplum
    system. </shortdesc>

To prepare new host systems for expansion, install the Greenplum Database software binaries,
      exchange the required SSH keys, and run performance tests.

Run performance tests first on the new hosts and then all hosts. Run the tests on all hosts
      with the system offline so user activity does not distort results.

Generally, you should run performance tests when an administrator modifies host networking or
      other special conditions in the system. For example, if you will run the expanded system on
      two network clusters, run tests on each cluster.

  <topic id="topic18" xml:lang="en">
    <title id="no159311">Adding New Hosts to the Trusted Host Environment</title>

New hosts must exchange SSH keys with the existing hosts to enable Greenplum administrative
        utilities to connect to all segments without a password prompt. Perform the key exchange
        process twice with the <codeph><xref
            href="../../utility_guide/ref/gpssh-exkeys.xml">gpssh-exkeys</xref></codeph>
        utility.

First perform the process as <codeph>root</codeph>, for administration convenience, and
        then as the user <codeph>gpadmin</codeph>, for management utilities. Perform the following
        tasks in order:

          <xref href="#topic18/no160715" type="section" format="dita"/>

          <xref href="#topic18/no160595" type="section" format="dita"/>

          <xref href="#topic18/sshexch_gpadmin" type="section" format="dita"/>

      <note type="note">The Greenplum Database segment host naming convention is
          <codeph>sdwN</codeph> where <codeph>sdw</codeph> is a prefix and <codeph>N</codeph> is an
        integer ( <codeph>sdw1</codeph>, <codeph>sdw2</codeph> and so on). For hosts with multiple
        interfaces, the convention is to append a dash (<codeph>-</codeph>) and number to the host
        name. For example, <codeph>sdw1-1</codeph> and <codeph>sdw1-2</codeph> are the two interface
        names for host <codeph>sdw1</codeph>. </note>

        <title>To exchange SSH keys as root</title>

Create a host file with the existing host names in your array and a
            separate host file with the new expansion host names. For existing hosts, you can use
            the same host file used to set up SSH keys in the system. In the files, list all hosts
            (master, backup master, and segment hosts) with one name per line and no extra lines or
            spaces. Exchange SSH keys using the configured host names for a given host if you use a
            multi-NIC configuration. In this example, <codeph>mdw</codeph> is configured with a
            single NIC, and <codeph>sdw1</codeph>, <codeph>sdw2</codeph>, and <codeph>sdw3</codeph>
            are configured with 4
            NICs:<codeblock>mdw
sdw1-1
sdw1-2
sdw1-3
sdw1-4
sdw2-1
sdw2-2
sdw2-3
sdw2-4
sdw3-1
sdw3-2
sdw3-3
sdw3-4</codeblock>

Log in as <codeph>root</codeph> on the master host, and source the
              <codeph>greenplum_path.sh</codeph> file from your Greenplum
            installation.<codeblock>$ su -
# source /usr/local/greenplum-db/greenplum_path.sh</codeblock>

Run the <codeph>gpssh-exkeys</codeph> utility referencing the host list
            files. For
            example:<codeblock># gpssh-exkeys -e /home/gpadmin/existing_hosts_file -x
/home/gpadmin/new_hosts_file</codeblock>

<codeph>gpssh-exkeys</codeph> checks the remote hosts and performs the
            key exchange between all hosts. Enter the <codeph>root</codeph> user password when
            prompted. For
            example:<codeblock>***Enter password for root@hostname: <root_password></codeblock>

        <title>To create the <codeph>gpadmin</codeph> user</title>

Use <codeph><xref href="../../utility_guide/ref/gpssh.xml"
                >gpssh</xref></codeph> to create the <codeph>gpadmin</codeph> user on all the new
            segment hosts (if it does not exist already). Use the list of new hosts you created for
            the key exchange. For
            example:<codeblock># gpssh -f new_hosts_file '/usr/sbin/useradd gpadmin -d
/home/gpadmin -s /bin/bash'</codeblock>

Set a password for the new <codeph>gpadmin</codeph> user. On Linux, you
            can do this on all segment hosts simultaneously using <codeph>gpssh</codeph>. For
            example:<codeblock># gpssh -f new_hosts_file 'echo gpadmin_password | passwd
gpadmin --stdin'</codeblock>

Verify the <codeph>gpadmin</codeph> user has been created by looking for
            its home
            directory:<codeblock># gpssh -f new_hosts_file ls -l /home</codeblock>

        <title>To exchange SSH keys as the <codeph>gpadmin</codeph> user</title>

Log in as <codeph>gpadmin</codeph> and run the
              <codeph>gpssh-exkeys</codeph> utility referencing the host list files. For
            example:<codeblock># gpssh-exkeys -e /home/gpadmin/existing_hosts_file -x
/home/gpadmin/new_hosts_file</codeblock>

<codeph>gpssh-exkeys</codeph> will check the remote hosts and perform
            the key exchange between all hosts. Enter the <codeph>gpadmin</codeph> user password
            when prompted. For
            example:<codeblock>***Enter password for gpadmin@hostname: <gpadmin_password></codeblock>

  </topic>
  <topic id="topic20" xml:lang="en">
    <title id="no159219">Validating Disk I/O and Memory Bandwidth</title>

Use the <codeph><xref href="../../utility_guide/ref/gpcheckperf.xml"
            >gpcheckperf</xref></codeph> utility to test disk I/O and memory bandwidth.

        <title>To run gpcheckperf</title>

Run the <codeph>gpcheckperf</codeph> utility using the host file for new
            hosts. Use the <codeph>-d</codeph> option to specify the file systems you want to test
            on each host. You must have write access to these directories. For
            example:<codeblock>$ gpcheckperf -f new_hosts_file -d /data1 -d /data2 -v </codeblock>

The utility may take a long time to perform the tests because it is
            copying very large files between the hosts. When it is finished, you will see the
            summary results for the Disk Write, Disk Read, and Stream tests.

For a network divided into subnets, repeat this procedure with a separate host file for
          each subnet.

  </topic>
  <topic id="topic21" xml:lang="en">
    <title>Integrating New Hardware into the System</title>

Before initializing the system with the new segments, shut down the system with
          <codeph>gpstop</codeph> to prevent user activity from skewing performance test results.
        Then, repeat the performance tests using host files that include all hosts, existing
        and new.

  </topic>
</topic>


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit2fd3ad0d6964060f8fe707fabd34f5ec::getLoader();


text:
using Apostle.Enums;

namespace Apostle
{
    public class DeliveryResult
    {
        public string ApiResponse { get; set; }
        public string JsonRequest { get; set; }
        public string Message { get; set; }
        public string RequestData { get; set; }
        public DeliveryStatus Status { get; set; }
    }
}


text:
/**
 * Created by cpc on 1/31/16.
 */

let toastr = null;
let msg = null;

export function setContainer(_) {
  toastr = _;
  if (msg) {
    const { type, title, content } = msg;
    toast(type, title, content);
  }
}

export default function toast(type, title, content) {
  if (toastr) {
    toastr.clear();
    toastr[type](content, title);
  } else {
    msg = { type, title, content };
  }
}


text:
import React from 'react'
import { storiesOf } from '@kadira/storybook'
import Icon from 'components/Icon'
import Field from 'components/Field'
import Button from './'

storiesOf('Button', module)
  .add('default', () => (
    <Button>Default Button</Button>
  ))
  .add('small', () => (
    <Button className="is-small">Small Button</Button>
  ))
  .add('large', () => (
    <Button className="is-large">Large Button</Button>
  ))
  .add('with only icon', () => (
    <Button>
      <Icon name="fa-check" />
    </Button>
  ))
  .add('with left icon', () => (
    <Button className="is-primary">
      <Icon name="fa-check" />
      Submit
    </Button>
  ))
  .add('with right icon', () => (
    <Button className="is-danger">
      Submit
      <Icon name="fa-times" />
    </Button>
  ))
  .add('control (use in Field)', () => (
    <Field className="has-addons">
      <Button control>
        <Icon name="fa-check" />
      </Button>
      <Button control>
        <Icon name="fa-times" />
      </Button>
    </Field>
  ))


text:
"""Publish RST documents in Wiki format.

.. contents::

Summary
-------

Wikir (pronounced "wicker") converts `reStructuredText`_ documents to various Wiki formats.  Currently, `Google Code Wiki Syntax`_ is the target, but compatibility with `Moin Moin Wiki Syntax`_ and `Trac Wiki Syntax`_ is maintained when possible.

.. _Google Code Wiki Syntax: http://code.google.com/p/support/wiki/WikiSyntax
.. _Moin Moin Wiki Syntax: http://musicbrainz.org/doc/MoinMoinWikiSyntax
.. _Trac Wiki Syntax: http://trac.edgewall.org/wiki/WikiFormatting
.. _reStructuredText: http://docutils.sourceforge.net/docs/user/rst/quickref.html

Installation
------------

::

  easy_install wikir

Or check out a development version from the `subversion repository`_.

.. _subversion repository: http://wikir.googlecode.com/svn/trunk/#egg=wikir-dev

How Much reStructuredText Is Supported?
---------------------------------------

Not a whole lot!  Since `RST syntax`_ is huge and `Google Code Wiki Syntax`_ is small, RST may never be fully supported.  However, if you come across an unsupported RST directive please `submit an issue`_ and include the snippet of RST and how you think it should be displayed in wiki syntax.

.. _submit an issue: http://code.google.com/p/wikir/issues/list
.. _RST syntax: http://docutils.sourceforge.net/docs/user/rst/quickref.html

If possible, also submit a failing test for the new syntax you'd like supported.  You can see all currently tested and implemented RST syntax elements by running the following command (requires `nose`_)::

    nosetests -v ./wikir/tests/test_syntax.py -a '!deferred'

Remove the ``-a '!deferred'`` to see those that still need implementing.  Patches gladly accepted ;)

.. _nose: http://somethingaboutorange.com/mrl/projects/nose/

Using Wikir In Your Project
---------------------------

The publish_wiki Command
++++++++++++++++++++++++

After installing wikir, all `setuptools`_-enabled projects on the same machine will grow a new command, ``publish_wiki``.  A setuptools project is one with a setup.py file like so::

  from setuptools import setup
  setup(
      name='MyModule',
      version='0.999',
      # ...etc...
  )

.. _setuptools: http://pypi.python.org/pypi/setuptools

Command usage::

    $ python setup.py publish_wiki --help
    | Common commands: (see '--help-commands' for more)
    |
    |   setup.py build      will build the package underneath 'build/'
    |   setup.py install    will install the package
    |
    | Global options:
    |   --verbose (-v)  run verbosely (default)
    |   --quiet (-q)    run quietly (turns verbosity off)
    |   --dry-run (-n)  don't actually do anything
    |   --help (-h)     show detailed help message
    |
    | Options for 'publish_wiki' command:
    |   --source (-s)  path to RST source.  if a python module, the top-most
    |                  docstring will be used as the source
    |
    | usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
    |    or: setup.py --help [cmd1 cmd2 ...]
    |    or: setup.py --help-commands
    |    or: setup.py cmd --help
    |

Publishing RST To Wiki
++++++++++++++++++++++

Here is an example of publishing a module's docstring written in RST format to Wiki format::

    $ cd examples/basic
    $ cat ./akimbo/__init__.py
    | '''
    | Welcome To Akimbo
    | =================
    |
    | A Python module for akimbo'ing.
    |
    | This could live on `Google Code`_ if it wanted to.
    |
    | .. _Google Code: http://code.google.com/hosting/
    |
    | '''
    $ python setup.py publish_wiki --source=./akimbo/__init__.py
    | = Welcome To Akimbo =
    |
    | A Python module for akimbo'ing.
    |
    | This could live on [http://code.google.com/hosting/ Google Code] if it wanted to.
    |

Using Custom RST Directives
+++++++++++++++++++++++++++

Wikir provides an entry_point in case you need to register a `custom RST directive`_.  Here is an example::

    $ cd examples/custom_directives
    $ python setup.py -q develop
    $ cat setup.py
    | from setuptools import setup
    | setup(
    |     name = 'Foozilate',
    |     entry_points = {
    |         'wikir.rst_directives': [
    |             'foozilate = foozilate.directives:foozilate'
    |         ]
    |     },
    |     description = "A mysterious package that aids in foozilation")
    $ cat ./README.txt
    | This is the documentation for foozilate, which requires a custom directive called ``foozilate``.  All it does is wrap some tags around the input.
    |
    | .. foozilate::
    |     this should be foozilated
    $ python setup.py publish_wiki --source ./README.txt
    | This is the documentation for foozilate, which requires a custom directive called `foozilate`.  All it does is wrap some tags around the input.
    |
    | --foozilated-- this should be foozilated --foozilated--
    |
    $ python setup.py -q develop --uninstall

.. note::
    You should avoid putting custom directives in a docstring if you want them to build with a standard docutils install.  For example, your RST docstrings may be parsed automatically by the `The Cheeseshop`_ or another documentation generator, like `pydoctor`_.

.. _pydoctor: http://codespeak.net/~mwh/pydoctor/
.. _The Cheeseshop: http://pypi.python.org/pypi
.. _custom RST directive: http://docutils.sourceforge.net/docs/howto/rst-directives.html

The left side of the entry_point defined the directive name and the right side specifies the path to the directive function.  This is registered with docutils before any RST is published.

The wikir command
+++++++++++++++++

If you don't want to use wikir through setup.py you can use the command line script, `wikir`, which gets installed for you.

Command usge::

    $ wikir --help
    | Usage: wikir [options] path/to/module.py
    |        wikir [options] path/to/file.txt
    |
    | Publish RST documents in Wiki format
    |
    | 1. finds the top-most docstring of module.py, parses as RST, and prints Wiki format to STDOUT
    | 2. parses file.txt (or a file with any other extension) as RST and prints Wiki format to STDOUT
    |
    | Options:
    |   -h, --help  show this help message and exit

You can publish a module's docstring written in RST format to Wiki format like so::

    $ cd examples/basic
    $ cat ./akimbo/__init__.py
    | '''
    | Welcome To Akimbo
    | =================
    |
    | A Python module for akimbo'ing.
    |
    | This could live on `Google Code`_ if it wanted to.
    |
    | .. _Google Code: http://code.google.com/hosting/
    |
    | '''
    $ wikir ./akimbo/__init__.py
    | = Welcome To Akimbo =
    |
    | A Python module for akimbo'ing.
    |
    | This could live on [http://code.google.com/hosting/ Google Code] if it wanted to.
    |

... and you can publish any document written in RST format to Wiki format like so::

    $ cd examples/basic
    $ cat ./README.txt
    | ========================
    | Documentation for Akimbo
    | ========================
    |
    | .. contents:: :local:
    |
    | What is it?
    | ===========
    |
    | A Python module for akimbo'ing.
    |
    | Where does it live?
    | ===================
    |
    | Akimbo could live on `Google Code`_ if it wanted to.
    |
    | .. _Google Code: http://code.google.com/hosting/
    $ wikir ./README.txt
    | = Documentation for Akimbo =
    |
    |   * What is it?
    |   * Where does it live?
    |
    |
    | = What is it? =
    |
    | A Python module for akimbo'ing.
    |
    | = Where does it live? =
    |
    | Akimbo could live on [http://code.google.com/hosting/ Google Code] if it wanted to.
    |

Using Wikir Programatically
---------------------------

::

  >>> from wikir import publish_string
  >>> print publish_string('''
  ... My RST Document
  ... ===============
  ...
  ... For `Google Code`_!
  ...
  ... .. _Google Code: http://code.google.com/
  ... ''')
  = My RST Document =
  <BLANKLINE>
  For [http://code.google.com/ Google Code]!
  <BLANKLINE>
  <BLANKLINE>
  >>>

Credits
-------

This work is based on code I found while snooping around the `nose repository`_ (Jason Pellerin), `Ian Bicking's docutils sandbox`_, and `Matthew Gilbert's docutils sandbox`_.  Thanks to `Kent S. Johnson`_ for additional help and feedback.

.. _nose repository: http://python-nose.googlecode.com/svn/trunk/scripts/
.. _Ian Bicking's docutils sandbox: http://docutils.sourceforge.net/sandbox/ianb/wiki/Wiki.py
.. _Matthew Gilbert's docutils sandbox: http://docutils.sourceforge.net/sandbox/mmgilbe/rst.py
.. _Kent S. Johnson: http://personalpages.tds.net/~kent37/

Project Home
------------

If you're not there already, `wikir lives on Google Code`_.

.. _wikir lives on Google Code: http://code.google.com/p/wikir/

"""
__version__ = '0.4.1'

from wikir import *


text:
package com.koma.music.base;

/**
 * Created by koma on 3/20/17.
 */

public interface BaseView<T> {
    void setPresenter(T presenter);
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.memory.context;

import com.google.common.util.concurrent.ListenableFuture;

import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Verify.verify;
import static java.util.Objects.requireNonNull;

class ChildAggregatedMemoryContext
        extends AbstractAggregatedMemoryContext
{
    private final AbstractAggregatedMemoryContext parentMemoryContext;

    ChildAggregatedMemoryContext(AggregatedMemoryContext parentMemoryContext)
    {
        verify(parentMemoryContext instanceof AbstractAggregatedMemoryContext);
        this.parentMemoryContext = (AbstractAggregatedMemoryContext) requireNonNull(parentMemoryContext, "parentMemoryContext is null");
    }

    @Override
    synchronized ListenableFuture<?> updateBytes(String allocationTag, long bytes, boolean enforceBroadcastMemoryLimit)
    {
        checkState(!isClosed(), "ChildAggregatedMemoryContext is already closed");
        // update the parent before updating usedBytes as it may throw a runtime exception (e.g., ExceededMemoryLimitException)
        ListenableFuture<?> future = parentMemoryContext.updateBytes(allocationTag, bytes, enforceBroadcastMemoryLimit);
        addBytes(bytes);
        if (enforceBroadcastMemoryLimit) {
            addBroadcastBytes(bytes);
        }
        return future;
    }

    @Override
    synchronized boolean tryUpdateBytes(String allocationTag, long delta, boolean enforceBroadcastMemoryLimit)
    {
        if (parentMemoryContext.tryUpdateBytes(allocationTag, delta, enforceBroadcastMemoryLimit)) {
            addBytes(delta);
            if (enforceBroadcastMemoryLimit) {
                addBroadcastBytes(delta);
            }
            return true;
        }
        return false;
    }

    @Override
    synchronized AbstractAggregatedMemoryContext getParent()
    {
        return parentMemoryContext;
    }

    void closeContext()
    {
        parentMemoryContext.updateBytes(FORCE_FREE_TAG, -getBytes(), false);
    }
}


text:
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH

class CatClient(NamespacedClient):
    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def aliases(self, name=None, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-alias.html>`_

        :arg name: A comma-separated list of alias names to return
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'aliases', name), params=params)

    @query_params('bytes', 'h', 'help', 'local', 'master_timeout', 'v')
    def allocation(self, node_id=None, params=None):
        """
        Allocation provides a snapshot of how shards have located around the
        cluster and the state of disk usage.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html>`_

        :arg node_id: A comma-separated list of node IDs or names to limit the
            returned information
        :arg bytes: The unit in which to display byte values, valid choices are:
            'b', 'k', 'kb', 'm', 'mb', 'g', 'gb', 't', 'tb', 'p', 'pb'
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'allocation', node_id), params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def count(self, index=None, params=None):
        """
        Count provides quick access to the document count of the entire cluster,
        or individual indices.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-count.html>`_

        :arg index: A comma-separated list of index names to limit the returned
            information
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'count', index), params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'ts', 'v')
    def health(self, params=None):
        """
        health is a terse, one-line representation of the same information from
        :meth:`~elasticsearch.client.cluster.ClusterClient.health` API
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-health.html>`_

        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg ts: Set to false to disable timestamping, default True
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', '/_cat/health',
            params=params)

    @query_params('help')
    def help(self, params=None):
        """
        A simple help for the cat api.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html>`_

        :arg help: Return help information, default False
        """
        return self.transport.perform_request('GET', '/_cat', params=params)

    @query_params('bytes', 'format', 'h', 'health', 'help', 'local',
        'master_timeout', 'pri', 'v')
    def indices(self, index=None, params=None):
        """
        The indices command provides a cross-section of each index.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html>`_

        :arg index: A comma-separated list of index names to limit the returned
            information
        :arg bytes: The unit in which to display byte values, valid choices are:
            'b', 'k', 'm', 'g'
        :arg h: Comma-separated list of column names to display
        :arg health: A health status ("green", "yellow", or "red" to filter only
            indices matching the specified health status, default None, valid
            choices are: 'green', 'yellow', 'red'
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg pri: Set to true to return stats only for primary shards, default
            False
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'indices', index), params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def master(self, params=None):
        """
        Displays the master's node ID, bound IP address, and node name.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-master.html>`_

        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', '/_cat/master',
            params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def nodes(self, params=None):
        """
        The nodes command shows the cluster topology.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html>`_

        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', '/_cat/nodes',
            params=params)

    @query_params('bytes', 'h', 'help', 'master_timeout', 'v')
    def recovery(self, index=None, params=None):
        """
        recovery is a view of shard replication.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html>`_

        :arg index: A comma-separated list of index names to limit the returned
            information
        :arg bytes: The unit in which to display byte values, valid choices are:
            'b', 'k', 'kb', 'm', 'mb', 'g', 'gb', 't', 'tb', 'p', 'pb'
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'recovery', index), params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def shards(self, index=None, params=None):
        """
        The shards command is the detailed view of what nodes contain which shards.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html>`_

        :arg index: A comma-separated list of index names to limit the returned
            information
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'shards', index), params=params)

    @query_params('h', 'help', 'v')
    def segments(self, index=None, params=None):
        """
        The segments command is the detailed view of Lucene segments per index.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-segments.html>`_

        :arg index: A comma-separated list of index names to limit the returned
            information
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'segments', index), params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def pending_tasks(self, params=None):
        """
        pending_tasks provides the same information as the
        :meth:`~elasticsearch.client.cluster.ClusterClient.pending_tasks` API
        in a convenient tabular format.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-pending-tasks.html>`_

        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', '/_cat/pending_tasks',
            params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'size',
        'thread_pool_patterns', 'v')
    def thread_pool(self, thread_pools=None, params=None):
        """
        Get information about thread pools.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-thread-pool.html>`_

        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg size: The multiplier in which to display values, valid choices are:
            '', 'k', 'm', 'g', 't', 'p'
        :arg thread_pool_patterns: A comma-separated list of regular-expressions
            to filter the thread pools in the output
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'thread_pool', thread_pools), params=params)

    @query_params('bytes', 'h', 'help', 'local', 'master_timeout', 'v')
    def fielddata(self, fields=None, params=None):
        """
        Shows information about currently loaded fielddata on a per-node basis.
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-fielddata.html>`_

        :arg fields: A comma-separated list of fields to return the fielddata
            size
        :arg bytes: The unit in which to display byte values, valid choices are:
            'b', 'k', 'kb', 'm', 'mb', 'g', 'gb', 't', 'tb', 'p', 'pb'
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'fielddata', fields), params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def plugins(self, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-plugins.html>`_

        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', '/_cat/plugins',
            params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def nodeattrs(self, params=None):
        """
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodeattrs.html>`_

        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node (default: false)
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', '/_cat/nodeattrs',
            params=params)

    @query_params('h', 'help', 'local', 'master_timeout', 'v')
    def repositories(self, params=None):
        """
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-repositories.html>`_

        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg local: Return local information, do not retrieve the state from
            master node, default False
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', '/_cat/repositories',
            params=params)

    @query_params('h', 'help', 'ignore_unavailable', 'master_timeout', 'v')
    def snapshots(self, repository=None, params=None):
        """
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-snapshots.html>`_

        :arg repository: Name of repository from which to fetch the snapshot
            information
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg ignore_unavailable: Set to true to ignore unavailable snapshots,
            default False
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', _make_path('_cat',
            'snapshots', repository), params=params)

    @query_params('actions', 'detailed', 'format', 'h', 'help', 'node_id',
        'parent_node', 'parent_task', 'v')
    def tasks(self, params=None):
        """
        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html>`_

        :arg actions: A comma-separated list of actions that should be returned.
            Leave empty to return all.
        :arg detailed: Return detailed task information (default: false)
        :arg format: a short version of the Accept header, e.g. json, yaml
        :arg h: Comma-separated list of column names to display
        :arg help: Return help information, default False
        :arg node_id: A comma-separated list of node IDs or names to limit the
            returned information; use `_local` to return information from the
            node you're connecting to, leave empty to get information from all
            nodes
        :arg parent_node: Return tasks with specified parent node.
        :arg parent_task: Return tasks with specified parent task id. Set to -1
            to return all.
        :arg v: Verbose mode. Display column headers, default False
        """
        return self.transport.perform_request('GET', '/_cat/tasks',
            params=params)