text:
package org.commonjava.indy.model.core.io;

public interface IndySerializerModule
{
    void register( final IndyObjectMapper mapper );
}


text:
<?php

namespace TreeHouse\EventStore;

use ArrayIterator;
use IteratorAggregate;

class EventStream implements IteratorAggregate, EventStreamInterface
{
    /**
     * @var EventInterface[]
     */
    protected $events = [];

    /**
     * @param EventInterface[] $events
     */
    public function __construct(array $events = [])
    {
        $this->events = $events;
    }

    /**
     * @return int
     */
    public function count()
    {
        return count($this->events);
    }

    /**
     * @return ArrayIterator
     */
    public function getIterator()
    {
        return new ArrayIterator($this->events);
    }
}

redpajama_set_name: RedPajamaGithub


text:
import logging
#import time
import threading
from time import ctime,sleep

logging.basicConfig(filename='example.log',level=logging.DEBUG)
def music(func):
    for i in range(20):
        try:
            logging.info(str(i) + "I was at the %s! %s" %(func,ctime()))
            sleep(1)
        except Exception as e:
            logging.error(str(e));

def move(func):
    for x in range(20):
        try:
            logging.info(str(x) + "I was at the %s! %s %d" %(func,ctime(),x) )
            sleep(5)
        except Exception as e:
            logging.error(str(e))

threads = []
t1 = threading.Thread(target=music,args=(u'爱情买卖',))
threads.append(t1)
t2 = threading.Thread(target=move,args=(u'阿凡达',))
threads.append(t2)

if __name__ == '__main__':
    for t in threads:
        t.setDaemon(True)
        t.start()
    logging.info("all over %s" %ctime() )


text:
package nilgiri.planarSolarSystem;

import nilgiri.math.RealNumber;
import nilgiri.math.autodiff.DifferentialVectorFunction;
import nilgiri.physics.AbstractMover;

public class StateGetter<R extends RealNumber<R>> {
	private StateType m_stateType;
	private InternalGetter<R> m_getter;

	public StateGetter(StateType i_type){
		setStateType(i_type);
	}

	public StateType getStateType(){
		return m_stateType;
	}
	public void setStateType(StateType i_stateType){
		switch(i_stateType){
		case POSITION:
			m_getter = new PositionGetter<R>();
			break;
		case VELOCITY:
			m_getter = new VelocityGetter<R>();
			break;
		case ACCELERATION:
			m_getter = new AccelerationGetter<R>();
			break;
		default:
			i_stateType = StateType.POSITION;
			m_getter = new PositionGetter<R>();
			break;
		}
		m_stateType = i_stateType;
	}

	public DifferentialVectorFunction<R> getState(AbstractMover<R> i_mover){
		return m_getter.getState(i_mover);
	}

	private abstract class InternalGetter<R extends RealNumber<R>>{
		abstract public DifferentialVectorFunction<R> getState(AbstractMover<R> i_mover);
	}

	private class PositionGetter<R extends RealNumber<R>> extends InternalGetter<R>{
		public DifferentialVectorFunction<R> getState(AbstractMover<R> i_mover){
			return i_mover.position();
		}
	}
	private class VelocityGetter<R extends RealNumber<R>> extends InternalGetter<R>{
		public DifferentialVectorFunction<R> getState(AbstractMover<R> i_mover){
			return i_mover.velocity();
		}
	}
	private class AccelerationGetter<R extends RealNumber<R>> extends InternalGetter<R>{
		public DifferentialVectorFunction<R> getState(AbstractMover<R> i_mover){
			return i_mover.acceleration();
		}
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.franmontiel.fullscreendialog.sample.MainActivity">

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:hintAnimationEnabled="true">

        <EditText
            android:id="@+id/nameField"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/insert_name"
            android:inputType="textPersonName" />

    </android.support.design.widget.TextInputLayout>

    <Button
        android:id="@+id/openDialog"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:text="@string/open_dialog" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="32dp"
        android:text="@string/full_name"
        android:textSize="24sp" />

    <TextView
        android:id="@+id/fullName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:freezesText="true"
        android:text="..."
        android:textSize="16sp" />

</LinearLayout>


text:
package com.netflix.adminresources.resources;

/**
 * @author Nitesh Kant
 */
public class KaryonAdminResponse {

    private Object data;

    public KaryonAdminResponse(Object data) {
        this.data = data;
    }

    public Object getData() {
        return data;
    }
}


text:
class RubyMQ::Server::Messenger
  def initialize session, switcher
    @session = session
    @switcher = switcher
    @prefetch_limit = 3

    @sended_mutex = Mutex.new
    @sended = {}
    @message_delivered = ConditionVariable.new

    @must_terminate = false
    @subscriptions = {}
    @subscriptions_mutex = Mutex.new
  end

  def create_subscription subscribe
    @subscriptions_mutex.synchronize do
      unless @must_terminate
        subscribe.subscription_key ||= RubyMQ::UUID.new

        @subscriptions[subscribe.subscription_key] = RubyMQ::Server::Subscription.new(subscribe, @switcher, @session, self)
        result = 0x00
      else
        result = 0x04
        subscribe.subscription_key = nil
      end

      RubyMQ::Channel::SubscribeResponse.new(
        :result => result,
        :condition_failure_details => 0x00,
        :subscription_key => subscribe.subscription_key)
    end
  end

  def terminate
    @subscriptions_mutex.synchronize do
      @must_terminate = true

      @sended_mutex.synchronize do
        @message_delivered.broadcast
      end

      @subscriptions.each {|key, subscription| subscription.terminate}
    end
  end

  def join
    @subscriptions_mutex.synchronize do
      @subscriptions.each {|key, subscription| subscription.join}
    end
  end

  def deliver_message message
    return if @must_terminate

    @sended_mutex.synchronize do
      if @sended.length >= @prefetch_limit
        @message_delivered.wait_while(@sended_mutex) {@sended.length >= @prefetch_limit && !@must_terminate}
      end

      sequence_number = @session.send_to_client message
      @sended[sequence_number] = message
    end
  end

  def message_response response, sequence_number
    @sended_mutex.synchronize do
      @switcher.message_response(@sended.delete(sequence_number), response)
      @message_delivered.signal
    end
  end
end


text:
package com.esri.gpt.control.livedata.sos;

import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;

/**
 * Sensor Observation Service response handler.
 */
public abstract class ResponseHandler implements ContentHandler {

/** SOS context */
protected SOSContext sosContext;
/** collected data */
protected ValueComponentsArray vcArr;

/**
 * Creates instance of the handler.
 * @param sosContext SOS context
 * @param vcArr container, where data will be collected
 */
public ResponseHandler(SOSContext sosContext, ValueComponentsArray vcArr) {
  super();
  this.sosContext = sosContext;
  this.vcArr = vcArr;
}

public void startDocument() throws SAXException {
  vcArr.clear();
}

public void endDocument() throws SAXException {
}

public void endPrefixMapping(String prefix) throws SAXException {
}

public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
}

public void processingInstruction(String target, String data) throws SAXException {
}

public void setDocumentLocator(Locator locator) {
}

public void skippedEntity(String name) throws SAXException {
}

public void startPrefixMapping(String prefix, String uri) throws SAXException {
}
}


text:
#ifndef CONN_HANDLER_H
#define CONN_HANDLER_H
#include "config.h"
#include "networking.h"
#include "proxy.h"

/**
 * This structure is used to communicate
 * between the connection handlers and the
 * networking layer.
 */
typedef struct {
    statsite_proxy_config *config;     // Global configuration
    proxy *proxy;                      // Global proxy
    statsite_proxy_conn_info *conn;    // Opaque handle into the networking stack
} statsite_proxy_conn_handler;

typedef enum {
    UNKNOWN,
    KEY_VAL,
    COUNTER,
    TIMER
} metric_type;

/**
 * Invoked to initialize the conn handler layer.
 */
void init_conn_handler(statsite_proxy_config *config);

/**
 * Invoked by the networking layer when there is new
 * data to be handled. The connection handler should
 * consume all the input possible, and generate responses
 * to all requests.
 * @arg handle The connection related information
 * @arg type message type either TCP or UDP
 * @return 0 on success.
 */
int handle_client_connect(statsite_proxy_conn_handler *handle);

#endif


text:
/**
 * angular-sns-share
 * @author Tomoyuki Kashiro <kashiro@github>
 * @license MIT
 */
(function() {
  'use strict';

  angular
    .module('ngSnsShare', [])
    .directive('ngSnsShare', ngSnsShare);

  ngSnsShare.$inject = ['$window', '$location'];

  function ngSnsShare($window, $location) {
    var directive = {
      link: link,
      restrict: 'A',
      scope: {
        url: '@',
        platform: '@',
        text: '@'
      }
    };
    return directive;

    function link(scope, element, attrs) {
      element.on('click', function() {
        onClickShare(scope);
      });
    }

    ///
    function onClickShare(scope) {
      var url = scope.url || $location.protocol() + '//' + $location.host(),
          text = angular.isUndefined(scope.text) ? '' : scope.text + ' ',
          target = encodeURIComponent(text + url),
          windowName = 'ngSnsShare',
          option = 'width=600,height=400';
      if(scope.platform === 'twitter'){
        $window.open('https://twitter.com/intent/tweet?text=' + target, windowName, option);
      }else if(scope.platform === 'facebook'){
        $window.open('https://www.facebook.com/sharer/sharer.php?u=' + target, windowName, option);
      }
    }

  }
})();


text:
package com.faforever.api.voting;

import com.faforever.api.data.domain.VotingChoice;
import org.springframework.data.jpa.repository.JpaRepository;

public interface VotingChoiceRepository extends JpaRepository<VotingChoice, Integer> {
}


text:
'use strict';

const React = require('react-native');
const {
    Image,
    PropTypes,
} = React;

const TimerMixin = require('react-timer-mixin');

module.exports = React.createClass({
    propTypes: {
        animationImages : PropTypes.array.isRequired,
        animationRepeatCount : PropTypes.number,
        animationDuration : PropTypes.number,
    },
    mixins: [TimerMixin],
    getInitialState: function () {
        return {
            imageIndex: 0,
        };
    },
    componentDidMount: function () {
        this.animationRepeatCount = this.props.animationRepeatCount || 0;
        this.intervalId = this.setInterval(
            () => {
                let imageIndex = this.state.imageIndex + 1;
                if (imageIndex >= this.props.animationImages.length) {
                    imageIndex = 0;
                    if (this.animationRepeatCount === 1) {
                        this.clearInterval(this.intervalId);
                        return;
                    }
                    this.animationRepeatCount--;
                }
                this.setState({ imageIndex:imageIndex });
            }, this.props.animationDuration || 1000);
    },
    render: function () {
        return (
            <Image
                {...this.props}
                source={this.props.animationImages[this.state.imageIndex]} />
        );
    },
});


text:
/**
 * LocalOAuth Fragment.
 */
package org.deviceconnect.android.localoauth.fragment;


text:
namespace d3
{

/// @brief   Define a single grid
/// The grid is always defined, centered at 0,0,0 in the x/y plane. Simply place
/// in a MatrixTransform to locate/orient it differently
struct Grid
{
    /// The x/y spacing
    osg::Vec2 spacing;

    /// The half-span (i.e. cover from -hs to hs
    osg::Vec2 halfSpan;

    /// The color of the grid
    osg::Vec4 color;
};

/// typedef a vector of grids
typedef std::vector<Grid> GridVec_t;

/// @brief   get an osg node from a vector of grids
/// @param   grids The grids we should draw
osg::ref_ptr<osg::Node> get(const GridVec_t& grids);

/// @brief   get an osg node from a single grid
/// @param   grid The grid that we should draw
inline osg::ref_ptr<osg::Node> get(const Grid& grid)
{
    return get(GridVec_t(1, grid));
};

/// @brief   Convenience function to get a ground plane
inline osg::ref_ptr<osg::Node> ground(const double& spacing = 0.5,
                                      const double& halfSpan = 5.0,
                                      const osg::Vec4& color = osg::Vec4(0.0, 0.2, 0.0, 1.0))
{
    return get(Grid{osg::Vec2(spacing, spacing),
                    osg::Vec2(halfSpan, halfSpan),
                    color});
};

} // namespace d3


text:
\hypertarget{timer_8h}{}\section{timer.\+h File Reference}
\label{timer_8h}\index{timer.\+h@{timer.\+h}}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
void \hyperlink{timer_8h_a99ccbea44caa7d91c17782c602f956ef}{timer0\+\_\+init} (void)
\end{DoxyCompactItemize}

\subsection{Function Documentation}
\index{timer.\+h@{timer.\+h}!timer0\+\_\+init@{timer0\+\_\+init}}
\index{timer0\+\_\+init@{timer0\+\_\+init}!timer.\+h@{timer.\+h}}
\subsubsection[{\texorpdfstring{timer0\+\_\+init(void)}{timer0_init(void)}}]{\setlength{\rightskip}{0pt plus 5cm}void timer0\+\_\+init (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{timer_8h_a99ccbea44caa7d91c17782c602f956ef}{}\label{timer_8h_a99ccbea44caa7d91c17782c602f956ef}
This function

\begin{DoxyWarning}{Warning}
none.
\end{DoxyWarning}

\begin{DoxyParams}{Parameters}
{\em none.} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
none.
\end{DoxyReturn}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
  <properties>
    <frontend-maven-plugin.version>1.3</frontend-maven-plugin.version>
    <node.version>v6.9.4</node.version>
    <yarn.version>v0.19.1</yarn.version>
  </properties>

  <parent>
        <groupId>io.gravitee</groupId>
        <artifactId>gravitee-parent</artifactId>
        <version>7</version>
    </parent>

    <groupId>io.gravitee.management</groupId>
    <artifactId>gravitee-management-webui</artifactId>
    <version>1.9.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>Gravitee.io APIM - Portal</name>

    <build>
        <plugins>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <configuration>
              <mapping>
                <ts>SLASHSTAR_STYLE</ts>
              </mapping>
              <excludes>
                <exclude>LICENSE.txt</exclude>
                <exclude>node/**</exclude>
                <exclude>src/libraries/**</exclude>
              </excludes>
            </configuration>
          </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <filesets>
                      <fileset>
                          <directory>dist</directory>
                      </fileset>
                      <fileset>
                          <directory>.tmp</directory>
                      </fileset>
                      <fileset>
                        <directory>node</directory>
                      </fileset>
                      <fileset>
                        <directory>node_modules</directory>
                      </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
              <groupId>com.github.eirslett</groupId>
              <artifactId>frontend-maven-plugin</artifactId>
              <version>${frontend-maven-plugin.version}</version>
              <executions>
                <execution>
                  <id>install node and yarn</id>
                  <goals>
                    <goal>install-node-and-yarn</goal>
                  </goals>
                  <configuration>
                    <nodeVersion>${node.version}</nodeVersion>
                    <yarnVersion>${yarn.version}</yarnVersion>
                  </configuration>
                </execution>
                <execution>
                  <id>yarn install</id>
                  <goals>
                    <goal>yarn</goal>
                  </goals>
                  <phase>generate-resources</phase>
                </execution>
                <execution>
                  <id>build with yarn</id>
                  <goals>
                    <goal>yarn</goal>
                  </goals>
                  <phase>process-resources</phase>
                  <configuration>
                    <arguments>run buildNoReg</arguments>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                      <configuration>
                        <appendAssemblyId>false</appendAssemblyId>
                        <descriptors>
                          <descriptor>assembly.xml</descriptor>
                        </descriptors>
                      </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--Plugin used to replace version on several files -->
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>${project.basedir}/package.json</include>
                                <include>${project.basedir}/build.json</include>
                            </includes>
                            <replacements>
                                <replacement>
                                    <token>"name"(\s*):(\s*)"(.*)"</token>
                                    <value>"name": "${project.artifactId}"</value>
                                </replacement>
                                <replacement>
                                    <token>"version": "(.*)"</token>
                                    <value>"version": "${project.version}"</value>
                                </replacement>
                                <replacement>
                                    <token>'version': '(.*)'</token>
                                    <value>'version': '${project.version}'</value>
                                </replacement>
                                <replacement>
                                    <token>"description"(\s*):(\s*)"(.*)"</token>
                                    <value>"description": "${project.name}"</value>
                                </replacement>
                            </replacements>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
using JetBrains.Annotations;
using PropertyChanged;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;

namespace Editor
{
    /// <summary>
    /// Represents the coordinates of the box that encapsulates an equation
    /// </summary>
    public abstract class EquationBox : INotifyPropertyChanged
    {
        private static Thickness ZeroMargin = new(0d);
        public virtual Thickness Margin => ZeroMargin;

        private double width;
        public virtual double Width
        {
            get => width;
            set => width = value > 0d ? value : 0d;
        }

        private double height;
        public virtual double Height
        {
            get => height;
            set => height = value > 0d ? value : 0d;
        }

        public Point Location { get; set; } = new(0d, 0d);

        [DependsOn(nameof(Location))]
        public virtual double Left
        {
            get => Location.X;
            set => Location = new Point(value, Location.Y);
        }

        [DependsOn(nameof(Location))]
        public virtual double Top
        {
            get => Location.Y;
            set => Location = new Point(Location.X, value);
        }

        [DependsOn(nameof(Width))]
        public virtual double RefX => Width / 2d;

        [DependsOn(nameof(Height))]
        public virtual double RefY => Height / 2d;

        [DependsOn(nameof(Height), nameof(RefY))]
        public double RefYReverse => Height - RefY;

        [DependsOn(nameof(Location), nameof(RefX))]
        public double MidX
        {
            get => Location.X + RefX;
            set => Left = value - RefX;
        }

        [DependsOn(nameof(Location), nameof(RefY))]
        public double MidY
        {
            get => Location.Y + RefY;
            set => Top = value - RefY;
        }

        [DependsOn(nameof(Location), nameof(Width))]
        public virtual double Right
        {
            get => Location.X + width;
            set => Left = value - width;
        }

        [DependsOn(nameof(Location), nameof(Height))]
        public virtual double Bottom
        {
            get => Location.Y + Height;
            set => Top = value - Height;
        }

        [DependsOn(nameof(Width), nameof(Height))]
        public Size Size => new(Width, Height);

        [DependsOn(nameof(Location), nameof(Size))]
        public Rect Bounds => new(Location, Size);

        #region INotifyPropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "") =>
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        #endregion
    }
}


text:
package main

import (
	"context"
	"os"
	"runtime"

	"github.com/containerd/containerd/log"
	"github.com/containerd/containerd/server"
	"github.com/sirupsen/logrus"
	"golang.org/x/sys/unix"
)

const defaultConfigPath = "/etc/containerd/config.toml"

var handledSignals = []os.Signal{
	unix.SIGTERM,
	unix.SIGINT,
	unix.SIGUSR1,
	unix.SIGPIPE,
}

func handleSignals(ctx context.Context, signals chan os.Signal, serverC chan *server.Server) chan struct{} {
	done := make(chan struct{}, 1)
	go func() {
		var server *server.Server
		for {
			select {
			case s := <-serverC:
				server = s
			case s := <-signals:
				log.G(ctx).WithField("signal", s).Debug("received signal")
				switch s {
				case unix.SIGUSR1:
					dumpStacks()
				case unix.SIGPIPE:
					continue
				default:
					if server == nil {
						close(done)
						return
					}
					server.Stop()
					close(done)
				}
			}
		}
	}()
	return done
}

func dumpStacks() {
	var (
		buf       []byte
		stackSize int
	)
	bufferLen := 16384
	for stackSize == len(buf) {
		buf = make([]byte, bufferLen)
		stackSize = runtime.Stack(buf, true)
		bufferLen *= 2
	}
	buf = buf[:stackSize]
	logrus.Infof("=== BEGIN goroutine stack dump ===\n%s\n=== END goroutine stack dump ===", buf)
}


text:
layout: update
published: true

collection: updates
category: chrome
product: chrome
type: news
date: 2011-07-16

title: "Announcing New Game, the conference for HTML5 game developers"
description: ""
article:
  written_on: 2011-07-16
  updated_on: 2011-07-16
authors:
  - sethladd
tags:
  - games
permalink: /updates/2011/07/Announcing-New-Game-the-conference-for-HTML5-game-developers.html
---
Please join us at "New Game":http://newgameconf.com , to be held November 1-2, 2011 in San Francisco, CA.  New Game is the first HTML5 game conference for North America.

Our theme is "HTML5 games are here today" and the conference will feature speakers building and releasing production HTML5 games for desktop, laptop, and mobile.

Darius Kazemi from Bocoup is the conference director, and Google is the premier sponsor of the event.

A "Call for Participation":http://goo.gl/iWA2J is now open, if you are building real HTML5 games today, we want to help you tell your story.  Potential topics can include multi-player HTML5 games over Websockets, HTML5 audio and the Web Audio API, debriefs of production releases of HTML5 games, WebGL, asset pipelines, and business models.

See you at New Game this fall!


text:
'use strict';
var isA = require("Espresso/oop").isA;
var oop = require("Espresso/oop").oop;
var init = require("Espresso/oop").init;

var trim = require("Espresso/trim").trim;
var isA = require("Espresso/oop").isA;

var oop = require("Espresso/oop").oop;

var LogicException = require("Espresso/LogicException");
var EventEmitter = require("events");
var ApplicationInterface = require("Espresso/Application/ApplicationInterface");

var oop = require("Espresso/oop").oop;

// Events
var PreStartEvent	= require("Espresso/Application/Event/PreStartEvent");
var PostStartEvent	= require("Espresso/Application/Event/PostStartEvent");
var StopEvent		= require("Espresso/Application/Event/StopEvent");

var TypeException = require("Espresso/TypeException");

function Application( parameters ){
	init(this,EventEmitter);
	init(this,ApplicationInterface);
	oop(this,"Espresso/Application/Application");

	this.__.objectPool = null;
	this.__.parameters = parameters;
	this.__.children = [];

	this.__.started = false;
	this.__.starting = false;
	this.__.stopping = false;

	this.__.awaitStartListeners = [];
	this.__.awaitStopListeners = [];
	this.__.awaitInitializationListeners = [];

	this.__.initializers = {};

	var self = this;
	this.awaitStart().then(function(){
		self.initialize();
	});
}

function start(){
	var self = this;

	return new Promise(function(resolved,rejected){
		try {
			if( self.busy() )
				return rejected( new LogicException('Application is starting/stopping.') );
			if( self.__.started )
				return rejected( new LogicException('Application is already running.') );

			var event = new PreStartEvent( self );
			self.emit(ApplicationInterface.PRE_START_EVENT, event );

			event.done().then(function(){
				self.__.starting = true;
				console.log("# Starting app...");
				self.__.starting = false;
				self.__.started = true;
				while( self.__.awaitStartListeners.length > 0 ){
					self.__.awaitStartListeners.shift()[0]();
				}

				self.emit(ApplicationInterface.POST_START_EVENT, new PostStartEvent( self ) );
				resolved();
				return;
			}).catch(function(e){ console.log(String(e));});

		} catch( e ) {
			while( self.__.awaitStartListeners.length > 0 ){
				self.__.awaitStartListeners.shift()[1](e);
			}
			return rejected( e );
		}
	});
}

function stop(){
	var self = this;

	return new Promise(function(resolved,rejected){
		try {
			if( self.busy() ){
				while( self.__.awaitStopListeners.length > 0 ){
					self.__.awaitStopListeners.shift()[1](new LogicException('Application is starting/stopping.'));
				}
				return rejected( new LogicException( 'Application is starting/stopping.' ) );
			}

			if( self.__.started ) {
				self.__.stopping = true;
				self.__.started = false;

				var event = new StopEvent( self );
				self.emit("stop", event);
				event.done().then(function(){
					console.log("# Stopping app...");
					self.__.stopping = false;
					while( self.__.awaitStopListeners.length > 0 ){
						self.__.awaitStopListeners.shift()[0]();
					}
					resolved();
				});
			} else {
				while( self.__.awaitStopListeners.length > 0 ){
					self.__.awaitStopListeners.shift()[0]();
				}
				resolved();
			}
		} catch( e ) {
			while( self.__.awaitStopListeners.length > 0 ){
				self.__.awaitStopListeners.shift()[1](e);
			}
			rejected( e );
		}
	});
}

function initialize(){
	for( var name in this.__.initializers ){

	}
}

function awaitStart(){
	var self = this;

	return new Promise(function(resolved,rejected){
		self.__.awaitStartListeners.push([resolved,rejected]);
	});
}

function awaitStop(){
	var self = this;

	return new Promise(function(resolved,rejected){
		self.__.awaitStopListeners.push([resolved,rejected]);
	});
}

function awaitInitialization(){
	var self = this;

	return new Promise(function(resolved,rejected){
		self.__.awaitInitializationListeners.push([resolved,rejected]);
	});
}

function add( instance ){
	var self = this;
	return new Promise(function(resolved,rejected){
		if( self.__.running || self.__.startStopping ){
			rejected( new RuntimeException('You cannot add instances to a running application.') );
		} else {
			self.__.children.push( instance );
			self.emit(ApplicationInterface.ADD_EVENT, instance);
			resolved();
		}
	});
}

function setObjectPool( objectPool ){
	if(!(null==objectPool||isA(objectPool,"Espresso/Structure/ObjectPool")))
		throw new TypeException('objectPool',"Espresso/Structure/ObjectPool");

	this.__.objectPool = objectPool == null ? null : objectPool;
}

function getObjectPool(){
	return this.__.objectPool;
}

function status(){
	if( this.__.starting )
		return 'starting';
	if( this.__.stopping )
		return 'stopping';
	if( this.__.started )
		return 'started';
	return 'stopped';
}

function busy(){
	return (this.__.starting || this.__.stopping );
}

Application.prototype = Object.create( EventEmitter.prototype );
Application.prototype.setObjectPool = setObjectPool;
Application.prototype.getObjectPool = getObjectPool;
Application.prototype.add = add;
Application.prototype.start = start;
Application.prototype.stop = stop;
Application.prototype.status = status;
Application.prototype.busy = busy;
Application.prototype.initialize = initialize;
Application.prototype.awaitStart = awaitStart;
Application.prototype.awaitStop = awaitStop;
Application.prototype.awaitInitialization = awaitInitialization;

module.exports = Application;


text:
<?php $this->layout('backend/template') ?>

                    Create tag

Add new tag item

    <?php $this->insert('backend/tags/includes/form', ['redirectUrl' => $redirectUrl]) ?>


text:
CarrierWave.configure do |config|
  config.fog_credentials = {
    provider:               'AWS',
    aws_access_key_id:      ENV['AWS_ACCESS_KEY_ID'],
    aws_secret_access_key:  ENV['AWS_SECRET_ACCESS_KEY'],
  }
  config.fog_directory  = ENV['AWS_BUCKET']
  config.fog_public     = true
end

# Ref:
# https://support.cloud.engineyard.com/entries/20996881-Use-CarrierWave-and-Optionally-Fog-to-Upload-and-Store-Files#update3
# http://stackoverflow.com/questions/7946819/carrierwave-and-amazon-s3


text:
You can also jump directly to the plugin documentation for the relevant plugins: [Python Tools Completion](plugins.html#ptc), [Python Virtual Environments](plugins.html#virtualenv), [Project Manager](project_manager.html)

####Smash is a python interpretter
Smash is a fundamentally just a wrapper on top of IPython.  You can expect everything console IPython does to work from smash without any trouble.

-------------------------------------------------------------------------------

####Python Virtualenv Support
Smash has sophisticated virtualenv support which is useful particularly if you're working on multiple projects or working with multiple versions of the same requirements.  Activating/deactivating venvs is done with `venv_activate some_dir` and `venv_deactivate`, respectively.  This not only updates your $PATH, but updates the python runtime.  Modules from the new environment can now be imported directly, and side-effects from the old virtualenv are purged.  For more details take a look at the [plugin documentation](plugins.html#virtualenv).  To activate and deactivate virtualenv's automatically, take a look at the [project manager documentation](/project_manager.html).

-------------------------------------------------------------------------------

####Macros

Macros and command functions are similar to shell functions, meaning they are typically useful when you have in mind a piece of functionality that is: *(a)* more complex than an alias *(b)* interacting or sharing information with the shell itself, *(c)* too small or too idiosyncratic to merit it's own file in ~/bin.

Macros are an IPython concept, and simply correspond to a named array of input-lines (possibly python or possibly shell, anything that smash can take as input).  Macros run with no input and have no output, essentially they run on and may modify the current "environment", including python namespace, environment variables, whatever.  Macros can be built from a given sequence, a start-end range over the input history, or the contents of a file.  For more documentation on this, try typing `macro??` in your smash shell.

-------------------------------------------------------------------------------

####Command functions

**Command-functions** are python functions which are parsed into something that's more conveniently called from the command line.  For instance suppose you have a python function like this:

~~~~{.python}
def check_mail(source):
    if source=='gmail':
        do_stuff()
    elif source=='work':
        do_other_stuff()
    else:
        error()
~~~~

Since smash is a python interpretter, there is already an obvious invocation: `check_mail(my_source)`.  However if the function is wrapped with a `@command_function` decorator, then we'll get a nice and more shell-like invocation where all the appropriate details of option parsing are determined automatically (see example below).  During the smash bootstrap, every python function declared in the file at `~/.smash/etc/commands.py` will automatically be wrapped as a command function, and use the config variable `load_commands_from` to specify any other files to load.

~~~~{.python}
$ command_function(check_mail)
$ check_mail --source=gmail
~~~~

-------------------------------------------------------------------------------

####Completion Support for Python Tools

By default smash supports various completion options for common python tools like [Fabric](#), [IPython](#), [setup.py](#), [flake8](#)/[pyflakes](#) [tox](#), and other stuff you probably use on a daily basis.  Some of this is just option completion, but some is more interesting and dynamic (for example completion of task-names with fabric).  For a full description, take a look at the [plugin documentation](plugins.html#python-tools-completion)

-------------------------------------------------------------------------------


text:
package catgirl.oneesama.activity.main.fragments.browse.fragments.recent.view;

import android.support.v7.widget.RecyclerView;
import android.view.View;

public class ErrorViewHolder extends RecyclerView.ViewHolder {
    public ErrorViewHolder(View itemView) {
        super(itemView);
    }
}


text:
package org.broadinstitute.hellbender.tools.funcotator;

import htsjdk.samtools.SAMSequenceRecord;
import htsjdk.samtools.reference.ReferenceSequence;
import htsjdk.tribble.annotation.Strand;
import htsjdk.variant.variantcontext.Allele;
import org.broadinstitute.hellbender.GATKBaseTest;
import org.broadinstitute.hellbender.engine.ReferenceDataSource;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.io.File;
import java.util.stream.Collectors;

/**
 * Unit tests for the {@link ProteinChangeInfo} class.
 * Created by jonn on 10/23/18.
 */
public class ProteinChangeInfoUnitTest extends GATKBaseTest {

    //==================================================================================================================
    // Private Static Members:

    //==================================================================================================================
    // Private Members:

    //==================================================================================================================
    // Helper Methods:

    //==================================================================================================================
    // Data Providers:

    @DataProvider
    Object[][] provideForTestCreateProteinChangeInfo() {

        // PIK3CA is on chr3 and is transcribed in the FORWARD direction:
        final ReferenceDataSource pik3caTranscriptDataSource = ReferenceDataSource.of(new File(FuncotatorTestConstants.GENCODE_DATA_SOURCE_FASTA_PATH_HG19).toPath());
        final String              pik3caFullTranscriptName   = pik3caTranscriptDataSource.getSequenceDictionary().getSequences().stream().filter(s -> s.getSequenceName().startsWith(FuncotatorTestConstants.PIK3CA_TRANSCRIPT)).map(SAMSequenceRecord::getSequenceName).collect(Collectors.joining());
        final ReferenceSequence   pik3caReferenceSequence    = pik3caTranscriptDataSource.queryAndPrefetch(pik3caFullTranscriptName, 158, 3364);

        // MUC16 is on chr19 and is transcribed in the REVERSE direction:
        // (The magic numbers here are the coding region for this transcript for MUC16)
        final ReferenceDataSource muc16TranscriptDataSource = ReferenceDataSource.of(new File(FuncotatorTestConstants.GENCODE_DATA_SOURCE_FASTA_PATH_HG19).toPath());
        final String              muc16FullTranscriptName   = muc16TranscriptDataSource.getSequenceDictionary().getSequences().stream().filter(s -> s.getSequenceName().startsWith(FuncotatorTestConstants.MUC16_TRANSCRIPT)).map(SAMSequenceRecord::getSequenceName).collect(Collectors.joining());
        final ReferenceSequence   muc16ReferenceSequence    = muc16TranscriptDataSource.queryAndPrefetch(muc16FullTranscriptName, 205, 43728);

        return new Object[][] {
                // ==========================================================
                // Standard Code:
                // ---------------------------
                // MNPs:
                //    length 1:
                {
                        Allele.create("A", true),
                        Allele.create("T"),
                        1,
                        1,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(1,1,"M", "L")
                },
                //    length >=3:
                {
                        Allele.create("CACT", true),
                        Allele.create("GGGA"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(543,544,"IT", "MG")
                },

                // Insertions:
                //     FS
                {
                        Allele.create("C", true),
                        Allele.create("CG"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(544,544,"T", "")
                },
                //     Non-FS between codons
                //         + strand
                {
                        Allele.create("C", true),
                        Allele.create("CGGA"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(543,544,"", "G")
                },
                //         - strand
                {
                        Allele.create("T", true),
                        Allele.create("TTGG"),
                        10083,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, false,
                        ProteinChangeInfo.create(3361,3362,"", "W")
                },
                //     Non-FS within codons
                {
                        Allele.create("A", true),
                        Allele.create("ACTG"),
                        1630,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(544,545,"", "A")
                },
                {
                        Allele.create("A", true),
                        Allele.create("ATCG"),
                        1630,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(544,544,"T", "IA")
                },

                // Deletions:
                //     FS
                {
                        Allele.create("CA", true),
                        Allele.create("C"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(544,544,"T", "")
                },
                //     Non-FS between codons
                //         + strand
                {
                        Allele.create("CACT", true),
                        Allele.create("C"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(544,544,"T", "")
                },
                //         - strand
                {
                        Allele.create("TCTG", true),
                        Allele.create("T"),
                        10083,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, false,
                        ProteinChangeInfo.create(3362,3362,"L", "")
                },
                {
                        Allele.create("TCTGAGC", true),
                        Allele.create("T"),
                        10083,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, false,
                        ProteinChangeInfo.create(3362,3362,"LS", "")
                },
                //     Non-FS within codons
                //         + strand
                {
                        Allele.create("ACTG", true),
                        Allele.create("A"),
                        1630,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(544,545,"TE", "K")
                },
                {
                        Allele.create("CTGA", true),
                        Allele.create("C"),
                        1631,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(545,545,"E", "")
                },
                {
                        Allele.create("CTGAGCA", true),
                        Allele.create("C"),
                        1631,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(545,545,"EQ", "")
                },
                {
                        Allele.create("ACTGAGC", true),
                        Allele.create("A"),
                        1630,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(544,546,"TEQ", "K")
                },
                //         - strand
                {
                        Allele.create("CTCT", true),
                        Allele.create("C"),
                        10082,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, false,
                        ProteinChangeInfo.create(3362,3362,"L", "")
                },
                {
                        Allele.create("TCTC", true),
                        Allele.create("T"),
                        10081,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, false,
                        ProteinChangeInfo.create(3361,3361,"S", "")
                },
                {
                        Allele.create("CTCTGAG", true),
                        Allele.create("C"),
                        10082,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, false,
                        ProteinChangeInfo.create(3362,3362,"LS", "")
                },

                // ==========================================================
                // Mitochondrial Code:
                // ---------------------------
                // MNPs:
                //    length 1:
                {
                        Allele.create("A", true),
                        Allele.create("T"),
                        1,
                        1,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(1,1,"M", "L")
                },
                //    length >=3:
                {
                        Allele.create("CACT", true),
                        Allele.create("GGGA"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(543,544,"IT", "MG")
                },

                // Insertions:
                //     FS
                {
                        Allele.create("C", true),
                        Allele.create("CG"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(544,544,"T", "")
                },
                //     Non-FS between codons
                //         + strand
                {
                        Allele.create("C", true),
                        Allele.create("CGGA"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(543,544,"", "G")
                },
                //         - strand
                {
                        Allele.create("T", true),
                        Allele.create("TTGG"),
                        10083,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, true,
                        ProteinChangeInfo.create(3361,3362,"", "W")
                },
                //     Non-FS within codons
                {
                        Allele.create("A", true),
                        Allele.create("ACTG"),
                        1630,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(544,545,"", "A")
                },
                {
                        Allele.create("A", true),
                        Allele.create("ATCG"),
                        1630,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(544,544,"T", "IA")
                },

                // Deletions:
                //     FS
                {
                        Allele.create("CA", true),
                        Allele.create("C"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(544,544,"T", "")
                },
                //     Non-FS between codons
                //         + strand
                {
                        Allele.create("CACT", true),
                        Allele.create("C"),
                        1629,
                        1627,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(544,544,"T", "")
                },
                //         - strand
                {
                        Allele.create("TCTG", true),
                        Allele.create("T"),
                        10083,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, true,
                        ProteinChangeInfo.create(3362,3362,"L", "")
                },
                {
                        Allele.create("TCTGAGC", true),
                        Allele.create("T"),
                        10083,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, true,
                        ProteinChangeInfo.create(3362,3362,"LS", "")
                },
                //     Non-FS within codons
                //         + strand
                {
                        Allele.create("ACTG", true),
                        Allele.create("A"),
                        1630,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(544,545,"TE", "K")
                },
                {
                        Allele.create("CTGA", true),
                        Allele.create("C"),
                        1631,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(545,545,"E", "")
                },
                {
                        Allele.create("CTGAGCA", true),
                        Allele.create("C"),
                        1631,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(545,545,"EQ", "")
                },
                {
                        Allele.create("ACTGAGC", true),
                        Allele.create("A"),
                        1630,
                        1630,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(544,546,"TEQ", "K")
                },
                //         - strand
                {
                        Allele.create("CTCT", true),
                        Allele.create("C"),
                        10082,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, true,
                        ProteinChangeInfo.create(3362,3362,"L", "")
                },
                {
                        Allele.create("TCTC", true),
                        Allele.create("T"),
                        10081,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, true,
                        ProteinChangeInfo.create(3361,3361,"S", "")
                },
                {
                        Allele.create("CTCTGAG", true),
                        Allele.create("C"),
                        10082,
                        10081,
                        muc16ReferenceSequence.getBaseString(),
                        Strand.NEGATIVE, true,
                        ProteinChangeInfo.create(3362,3362,"LS", "")
                },

                // ==========================================================
                // Mitochondrial Code specific differences:
                // -----------------------------
                {
                        Allele.create("T", true),
                        Allele.create("A"),
                        207,
                        205,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(69,69,"I", "M")
                },
                {
                        Allele.create("A", true),
                        Allele.create("C"),
                        3207,
                        3205,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(1069,1069,"W", "C")
                },
                {
                        Allele.create("G", true),
                        Allele.create("A"),
                        3171,
                        3169,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(1057,1057,"W", "W")
                },
                {
                        Allele.create("G", true),
                        Allele.create("A"),
                        3171,
                        3169,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(1057,1057,"W", "W")
                },
                {
                        Allele.create("AA", true),
                        Allele.create("GG"),
                        3089,
                        3088,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(1030,1030,"K", "*")
                },
                {
                        Allele.create("A", true),
                        Allele.create("G"),
                        3089,
                        3088,
                        pik3caReferenceSequence.getBaseString(),
                        Strand.POSITIVE, true,
                        ProteinChangeInfo.create(1030,1030,"K", "*")
                },

                // ==========================================================
                // Special Cases Found in User Data
                // ---------------------------

                // Variant close to "N" bases in the reference:
                // Artificial SNPs with N bases:
                {
                        // N in ref before variant codon:
                        Allele.create("T", true),
                        Allele.create("G"),
                        5,
                        5,
//                       0        1
//                       123456789012345
                        "NTCATTTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(2,2,"I", "S")
                },
                {
                        // N in ref after variant codon
                        Allele.create("A", true),
                        Allele.create("T"),
                        1,
                        1,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(1,1,"I", "F")
                },
                {
                        // N in ref in variant codon:
                        Allele.create("N", true),
                        Allele.create("G"),
                        6,
                        4,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(2,2,"?", "M")
                },
                {
                        // N in variant codon:
                        Allele.create("C", true),
                        Allele.create("N"),
                        3,
                        1,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(1,1,"I", "?")
                },

                // Artificial Deletions with N bases:
                {
                        // N in ref before variant codon:
                        Allele.create("TT", true),
                        Allele.create("T"),
                        5,
                        4,
//                       0        1
//                       123456789012345
                        "NTCATTTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(3,3,"Y", "")
                },
                {
                        // N in ref before variant codon:
                        Allele.create("TTT", true),
                        Allele.create("G"),
                        5,
                        4,
//                       0        1
//                       123456789012345
                        "NTCATTTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(2,2,"I", "")
                },
                {
                        // N in ref before variant codon:
                        Allele.create("TTTA", true),
                        Allele.create("T"),
                        5,
                        4,
//                       0        1
//                       123456789012345
                        "NTCATTTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(3,3,"Y", "")
                },
                {
                        // N in ref after variant codon:
                        Allele.create("TC", true),
                        Allele.create("T"),
                        2,
                        1,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(3,3,"Y", "")
                },
                {
                        // N in ref after variant codon:
                        Allele.create("ATC", true),
                        Allele.create("A"),
                        1,
                        1,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(1,1,"I", "")
                },
                {
                        // N in ref after variant codon:
                        Allele.create("ATCA", true),
                        Allele.create("A"),
                        1,
                        1,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(1,1,"I", "")
                },
                {
                        // N in ref in variant codon:
                        Allele.create("TN", true),
                        Allele.create("T"),
                        5,
                        4,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(2,2,"?", "")
                },
                {
                        // N in ref in variant codon:
                        Allele.create("TNT", true),
                        Allele.create("T"),
                        5,
                        4,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(2,2,"?", "")
                },
                {
                        // N in ref in variant codon:
                        Allele.create("TNTA", true),
                        Allele.create("T"),
                        5,
                        4,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(2,3,"?Y", "I")
                },
                // Artificial Insertions with N bases:
                {
                        // N in variant codon:
                        Allele.create("T", true),
                        Allele.create("TN"),
                        2,
                        1,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(1,1,"I", "")
                },
                {
                        // N in variant codon:
                        Allele.create("T", true),
                        Allele.create("TTN"),
                        2,
                        1,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(3,3,"Y", "")
                },
                {
                        // N in variant codon:
                        Allele.create("T", true),
                        Allele.create("TTTN"),
                        2,
                        1,
//                       0        1
//                       123456789012345
                        "ATCATNTACCCGTAG",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(1,2,"", "?")
                },
                {
                        // Synthetic Data
                        Allele.create("A", true),
                        Allele.create("ATCACTG"),
                        551,
                        550,
                        "ATGGAGGACGACTCACTCTACTTGGGAGGTGAGTGGCAGTTCAACCACTTTTCAAAACTCACATCTTCTCGGCCCGATGCAGCTTTTGCTGAAATCCAGCGGACTTCTCTCCCTGAGAAGTCACCACTCTCATGTGAGACCCGTGTCGACCTCTGTGATGATTTGGCTCCTGTGGCAAGACAGCTTGCTCCCAGGGAGAAGCTTCCTCTGAGTAGCAGGAGACCTGCTGCGGTGGGGGCTGGGCTCCAGAATATGGGAAATACCTGCTACGTGAACGCTTCCTTGCAGTGCCTGACATACACACCGCCCCTTGCCAACTACATGCTGTCCCGGGAGCACTCTCAAACGTGTCATCGTCACAAGGGCTGCATGCTCTGTACGATGCAAGCTCACATCACACGGGCCCTCCACAATCCTGGCCACGTCATCCAGCCCTCACAGGCATTGGCTGCTGGCTTCCATAGAGGCAAGCAGGAAGATGCCCATGAATTTCTCATGTTCACTGTGGATGCCATGGAAAAGGCATGCCTTCCCGGGCACAAGCAGGTAGATCNNNNNNN",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(184,185,"", "HC")
                },
                    // HG19: chr4: 4 9274640 . A ATCACTG
                {
                        // HG19: chr4: 4 9274640 . A ATCCTG
                        Allele.create("A", true),
                        Allele.create("ATCCTG"),
                        551,
                        550,
                        "ATGGAGGACGACTCACTCTACTTGGGAGGTGAGTGGCAGTTCAACCACTTTTCAAAACTCACATCTTCTCGGCCCGATGCAGCTTTTGCTGAAATCCAGCGGACTTCTCTCCCTGAGAAGTCACCACTCTCATGTGAGACCCGTGTCGACCTCTGTGATGATTTGGCTCCTGTGGCAAGACAGCTTGCTCCCAGGGAGAAGCTTCCTCTGAGTAGCAGGAGACCTGCTGCGGTGGGGGCTGGGCTCCAGAATATGGGAAATACCTGCTACGTGAACGCTTCCTTGCAGTGCCTGACATACACACCGCCCCTTGCCAACTACATGCTGTCCCGGGAGCACTCTCAAACGTGTCATCGTCACAAGGGCTGCATGCTCTGTACGATGCAAGCTCACATCACACGGGCCCTCCACAATCCTGGCCACGTCATCCAGCCCTCACAGGCATTGGCTGCTGGCTTCCATAGAGGCAAGCAGGAAGATGCCCATGAATTTCTCATGTTCACTGTGGATGCCATGGAAAAGGCATGCCTTCCCGGGCACAAGCAGGTAGATCNNNNNNN",
                        Strand.POSITIVE, false,
                        ProteinChangeInfo.create(185,185,"?", "")
                },

        };
    }

    //==================================================================================================================
    // Tests:

    @Test(dataProvider = "provideForTestCreateProteinChangeInfo")
    void testCreateProteinChangeInfo( final Allele refAllele,
                                      final Allele altAllele,
                                      final int codingSequenceAlleleStart,
                                      final int alignedCodingSequenceAlleleStart,
                                      final String codingSequence,
                                      final Strand strand,
                                      final boolean isMitochondria,
                                      final ProteinChangeInfo expected ) {

        Assert.assertEquals(
                ProteinChangeInfo.create(
                        refAllele,
                        altAllele,
                        codingSequenceAlleleStart,
                        alignedCodingSequenceAlleleStart,
                        codingSequence,
                        strand,
                        isMitochondria),
                expected
        );
    }

}


text:
<?php

/**
 * Squiz_Sniffs_Strings_EchoedStringsSniff.
 *
 * Makes sure that any strings that are "echoed" are not enclosed in brackets
 * like a function call.
 *
 * @category  PHP
 * @package   PHP_CodeSniffer
 * @author    Greg Sherwood <gsherwood@squiz.net>
 * @author    Marc McIntyre <mmcintyre@squiz.net>
 * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
 * @license   https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
 * @version   Release: @package_version@
 * @link      http://pear.php.net/package/PHP_CodeSniffer
 */
class Squiz_Sniffs_Strings_EchoedStringsSniff implements PHP_CodeSniffer_Sniff
{

    /**
     * Returns an array of tokens this test wants to listen for.
     *
     * @return array
     */
    public function register()
    {
        return array(T_ECHO);

    }//end register()

    /**
     * Processes this test, when one of its tokens is encountered.
     *
     * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
     * @param int                  $stackPtr  The position of the current token in the
     *                                        stack passed in $tokens.
     *
     * @return void
     */
    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $firstContent = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
        // If the first non-whitespace token is not an opening parenthesis, then we are not concerned.
        if ($tokens[$firstContent]['code'] !== T_OPEN_PARENTHESIS) {
            $phpcsFile->recordMetric($stackPtr, 'Brackets around echoed strings', 'no');
            return;
        }

        $end = $phpcsFile->findNext(array(T_SEMICOLON, T_CLOSE_TAG), $stackPtr, null, false);

        // If the token before the semi-colon is not a closing parenthesis, then we are not concerned.
        $prev = $phpcsFile->findPrevious(T_WHITESPACE, ($end - 1), null, true);
        if ($tokens[$prev]['code'] !== T_CLOSE_PARENTHESIS) {
            $phpcsFile->recordMetric($stackPtr, 'Brackets around echoed strings', 'no');
            return;
        }

        // If the parenthesis don't match, then we are not concerned.
        if ($tokens[$firstContent]['parenthesis_closer'] !== $prev) {
            $phpcsFile->recordMetric($stackPtr, 'Brackets around echoed strings', 'no');
            return;
        }

        $phpcsFile->recordMetric($stackPtr, 'Brackets around echoed strings', 'yes');

        if (($phpcsFile->findNext(PHP_CodeSniffer_Tokens::$operators, $stackPtr, $end, false)) === false) {
            // There are no arithmetic operators in this.
            $error = 'Echoed strings should not be bracketed';
            $fix   = $phpcsFile->addFixableError($error, $stackPtr, 'HasBracket');
            if ($fix === true) {
                $phpcsFile->fixer->beginChangeset();
                $phpcsFile->fixer->replaceToken($firstContent, '');
                $phpcsFile->fixer->replaceToken(($end - 1), '');
                $phpcsFile->fixer->endChangeset();
            }
        }

    }//end process()

}//end class


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.zur.jackson_server;

/**
 *
 * @author Matt Roth
 */
public class servlet {

}


text:
package org.drools.core.base;

import org.drools.core.WorkingMemory;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.InternalWorkingMemoryActions;
import org.drools.core.definitions.rule.impl.RuleImpl;
import org.drools.core.factmodel.traits.Thing;
import org.drools.core.factmodel.traits.TraitableBean;
import org.drools.core.impl.StatefulKnowledgeSessionImpl;
import org.drools.core.rule.Declaration;
import org.drools.core.rule.GroupElement;
import org.drools.core.spi.Activation;
import org.drools.core.spi.KnowledgeHelper;
import org.drools.core.spi.Tuple;
import org.drools.core.util.bitmask.BitMask;
import org.kie.api.runtime.Channel;
import org.kie.api.runtime.KieRuntime;
import org.kie.api.runtime.rule.EntryPoint;
import org.kie.api.runtime.rule.FactHandle;
import org.kie.api.runtime.rule.Match;
import org.kie.internal.runtime.KnowledgeRuntime;
import org.kie.internal.runtime.beliefs.Mode;

import java.util.Collection;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Map;

public class SequentialKnowledgeHelper
    implements
    KnowledgeHelper {

    private static final long                  serialVersionUID = 510l;

    private RuleImpl                           rule;
    private GroupElement                       subrule;
    private Activation                         activation;
    private Tuple                              tuple;
    private final InternalWorkingMemoryActions workingMemory;

    public SequentialKnowledgeHelper(final WorkingMemory workingMemory) {
        this.workingMemory = (InternalWorkingMemoryActions) workingMemory;
    }

    public void setActivation(final Activation agendaItem) {
        this.rule = agendaItem.getRule();
        this.subrule = agendaItem.getSubRule();
        this.activation = agendaItem;
        this.tuple = agendaItem.getTuple();
    }

    public void reset() {
        this.rule = null;
        this.subrule = null;
        this.activation = null;
        this.tuple = null;
    }

    public RuleImpl getRule() {
        return this.rule;
    }

    //    public List getObjects() {
    //        return null; //this.workingMemory.getObjects();
    //    }
    //
    //    public List getObjects(final Class objectClass) {
    //        return null; //this.workingMemory.getObjects( objectClass );
    //    }
    //
    //    public void clearAgenda() {
    //        this.workingMemory.clearAgenda();
    //    }
    //
    //    public void clearAgendaGroup(final String group) {
    //        this.workingMemory.clearAgendaGroup( group );
    //    }

    public Tuple getTuple() {
        return this.tuple;
    }

    public WorkingMemory getWorkingMemory() {
        return this.workingMemory;
    }

    public KnowledgeRuntime getKnowledgeRuntime() {
        return (StatefulKnowledgeSessionImpl) this.workingMemory;
     }

    public KieRuntime getKieRuntime() {
        return getKnowledgeRuntime();
     }

    public Activation getMatch() {
        return this.activation;
    }

    //    public QueryResults getQueryResults(final String query) {
    //        return this.workingMemory.getQueryResults( query );
    //    }
    //
    //    public AgendaGroup getFocus() {
    //        return this.workingMemory.getFocus();
    //    }
    //
    public void setFocus(final String focus) {
        this.workingMemory.setFocus( focus );
    }

    //
    //    public void setFocus(final AgendaGroup focus) {
    //        this.workingMemory.setFocus( focus );
    //    }

    public Object get(final Declaration declaration) {
        return declaration.getValue( workingMemory, this.tuple.get( declaration ).getObject() );
    }

    public Declaration getDeclaration(final String identifier) {
        return (Declaration) this.subrule.getOuterDeclarations().get( identifier );
    }

    public void halt() {
        this.workingMemory.halt();
    }

    public EntryPoint getEntryPoint(String id) {
        return ((StatefulKnowledgeSessionImpl) this.workingMemory).getEntryPoint( id );
    }

    public Channel getChannel(String id) {
        return this.workingMemory.getChannels().get( id );
    }

    public Map<String, Channel> getChannels() {
        return Collections.unmodifiableMap( this.workingMemory.getChannels() );
    }

    public <T> T getContext(Class<T> contextClass) {
        return null;
    }

    public <T, K> T don( K core, Class<T> trait, boolean logical ) {
        return null;
    }

    public <T, K> T don(Thing<K> core, Class<T> trait, boolean logical) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public <T, K> T don( K core, Class<T> trait, Mode... modes ) {
        return null;
    }

    @Override
    public <T, K> T don( Thing<K> core, Class<T> trait, Mode... modes ) {
        return null;
    }

    public <T, K> T don( K core, Class<T> trait) {
        return don( core, trait, false );
    }

    public <T, K> T don(Thing<K> core, Class<T> trait) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public <T, K> T don( K core, Collection<Class<? extends Thing>> trait, boolean logical ) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public <T, K> T don( K core, Collection<Class<? extends Thing>> trait, Mode... modes ) {
        return null;
    }

    @Override
    public <T, K> T don( K core, Collection<Class<? extends Thing>> trait ) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public <T,K> Thing<K> shed( Thing<K> thing, Class<T> trait ) {
        return null;
    }

    public <T, K, X extends TraitableBean> Thing<K> shed( TraitableBean<K,X> core, Class<T> trait) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public InternalFactHandle bolster( Object object, Object value ) {
        return null;
    }

    @Override
    public InternalFactHandle bolster( Object object ) {
        return null;
    }

    public void cancelRemainingPreviousLogicalDependencies() {
    }

    public InternalFactHandle insert(Object object) {
        return null;
    }

    public InternalFactHandle insert(Object object,
                       boolean dynamic) {
        return null;
    }

    @Override
    public InternalFactHandle insertLogical(Object object, Mode belief) {
        return null;
    }

    @Override
    public InternalFactHandle insertLogical(Object object, Mode... beliefs) {
        return null;
    }

    public InternalFactHandle insertLogical(Object object) {
        // TODO Auto-generated method stub
        return null;
    }

    public InternalFactHandle insertLogical(Object object,
                                    boolean dynamic) {
        // TODO Auto-generated method stub
        return null;
    }

    public InternalFactHandle insertLogical(Object object,
                                    Object value) {
        // TODO Auto-generated method stub
        return null;
    }

    public InternalFactHandle getFactHandle(Object object) {
        // TODO Auto-generated method stub
        return null;
    }

    public InternalFactHandle getFactHandle(InternalFactHandle handle) {
        // TODO Auto-generated method stub
        return null;
    }

    public void update(FactHandle handle, Object newObject) {
        // TODO Auto-generated method stub
    }

    public void update(FactHandle newObject) {
        // TODO Auto-generated method stub
    }

    public void update(FactHandle newObject, BitMask mask, Class<?> typeClass) {
        // TODO Auto-generated method stub
    }

    public void retract(FactHandle handle) {
        // TODO Auto-generated method stub
    }

    public void delete(FactHandle handle) {
        // TODO Auto-generated method stub
    }

    public void update(Object newObject) {
        // TODO Auto-generated method stub
    }

    public void update(Object newObject, BitMask mask, Class<?> typeClass) {
        // TODO Auto-generated method stub
    }

    public void retract(Object handle) {
        // TODO Auto-generated method stub
    }

    public void delete(Object handle) {
        // TODO Auto-generated method stub
    }

    public void modify(Object newObject) {
        // TODO Auto-generated method stub
    }

    public void blockMatch(Match match) {
        // TODO Auto-generated method stub
    }

    public void unblockAllMatches(Match match) {
        // TODO Auto-generated method stub
    }

    public void cancelMatch(Match match) {
        // TODO Auto-generated method stub
    }
}


text:
    <md-card fxFlex="100%" class="output-card">
      <md-card-title-group align="center center">

        <md-card-title>Rules</md-card-title>

      </md-card-title-group>

            Antecedent

            Consequent

              <ng-container *ngFor="let dimension of cube.model.dimensions|iterable" >
                <ng-container *ngFor="let attribute of dimension.significants|iterable" >

                  <md-chip [mdTooltip]="dimension.label + ' → ' +  attribute.label"   *ngIf="rule['antCol']===attribute.ref"  >
                    {{dimension.label}}:

                    {{rule["antVal"]}}
                  </md-chip>
                </ng-container>

              </ng-container>
              <md-chip *ngIf="!rule['antCol']">{{rule["antVal"]}}</md-chip>

            →

              <ng-container *ngFor="let dimension of cube.model.dimensions|iterable" >
                <ng-container *ngFor="let attribute of dimension.significants|iterable" >

                  <md-chip [mdTooltip]="dimension.label + ' → ' +  attribute.label"   *ngIf="rule['consCol']===attribute.ref"  >
                    {{dimension.label}}:

                    {{rule["consVal"]}}
                  </md-chip>
                </ng-container>

              </ng-container>
              <md-chip *ngIf="!rule['consCol']">{{rule["consVal"]}}</md-chip>

    </md-card>


text:
using System.Threading.Tasks;
using Quartz;

namespace SampleProject.Infrastructure.Processing.Outbox
{
    [DisallowConcurrentExecution]
    public class ProcessOutboxJob : IJob
    {
        public async Task Execute(IJobExecutionContext context)
        {
            await CommandsExecutor.Execute(new ProcessOutboxCommand());
        }
    }
}


text:
export HERE=$(dirname $(readlink -f $0))
. ${HERE}/settings.sh

rsync -avr ${HOME}/logs/ ${STORAGE}/logs/


text:
package apple.foundation;

import java.io.*;
import java.nio.*;
import java.util.*;
import com.google.j2objc.annotations.*;
import com.google.j2objc.runtime.*;
import com.google.j2objc.runtime.block.*;
import apple.audiotoolbox.*;
import apple.corefoundation.*;
import apple.coregraphics.*;
import apple.coreservices.*;
import apple.uikit.*;
import apple.coreanimation.*;
import apple.coredata.*;
import apple.coremedia.*;
import apple.security.*;
import apple.dispatch.*;

/*<javadoc>*/
/*</javadoc>*/
@Adapter
public abstract class NSURLAuthenticationChallengeSenderAdapter
    extends Object
    implements NSURLAuthenticationChallengeSender {

    @NotImplemented("useCredential:forAuthenticationChallenge:")
    public void useCredential(NSURLCredential credential, NSURLAuthenticationChallenge challenge) { throw new UnsupportedOperationException(); }
    @NotImplemented("continueWithoutCredentialForAuthenticationChallenge:")
    public void continueWithoutCredential(NSURLAuthenticationChallenge challenge) { throw new UnsupportedOperationException(); }
    @NotImplemented("cancelAuthenticationChallenge:")
    public void cancel(NSURLAuthenticationChallenge challenge) { throw new UnsupportedOperationException(); }
    @NotImplemented("performDefaultHandlingForAuthenticationChallenge:")
    public void performDefaultHandling(NSURLAuthenticationChallenge challenge) { throw new UnsupportedOperationException(); }
    @NotImplemented("rejectProtectionSpaceAndContinueWithChallenge:")
    public void rejectProtectionSpaceAndContinue(NSURLAuthenticationChallenge challenge) { throw new UnsupportedOperationException(); }

}


text:
Pager-Huety
===============================
A script to trigger Philip Hue lightbulbs based on triggered incidents from PagerDuty.

Dependencies
------------
 * requests (http://python-requests.org)
 * phue (https://github.com/studioimaginaire/phue)

Usage
-----
    -h, --help            show this help message and exit
    --pd-api-key PD_API_KEY
                          API Key for pager duty
    --hue-host HUE_HOST   Hostname of your Philips Hue Bridge
    --lamp LAMP           Numeric id of the lamp to flash
    --night-only          Will only flash lights between 9PM - 7AM
    --user-filter USER_FILTER
                          Only trigger lights if incident is assigned to one of
                          these user ids
    --test                Test Pager Duty connection and Flash lights
    --log-level LOG_LEVEL
                          Set logging level

Example
-----
    ./pager-huety.py --pd-api-key=asdfgh --hue-host=Philips-hue.home


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>drools-workbench-models</artifactId>
    <groupId>org.drools</groupId>
    <version>6.3.0-SNAPSHOT</version>
  </parent>

  <artifactId>drools-workbench-models-test-scenarios</artifactId>

  <name>Drools Workbench - Test Scenarios Model</name>
  <description>Drools Workbench - Test Scenarios Model</description>

  <dependencies>

    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-workbench-models-commons</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-api</artifactId>
    </dependency>

    <dependency>
      <groupId>com.thoughtworks.xstream</groupId>
      <artifactId>xstream</artifactId>
    </dependency>

    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-workbench-models-datamodel-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.mvel</groupId>
      <artifactId>mvel2</artifactId>
    </dependency>

  </dependencies>

  <build>
    <resources>
      <!-- Include src/main/java in order not to break the Eclipse GWT plug-in -->
      <resource>
        <directory>src/main/java</directory>
      </resource>
      <!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in -->
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
  </build>

</project>


text:
layout: post
title:  "Simplicity of design"
date:
categories:
---
Long before I started writing any meaningful and useful code, I would look at online tutorials, open source code bases, sample code, and even very complex seemingly unintelligible code projects.

I very quickly established that there is a lot of complex code out there, I really couldn't tell apart good code from bad - I like to think I can now.

I would ask myself again and again: "how could anyone possibly write all of this?", not even with a team of the best developers in the world.

But I was resolute, I knew there just had to be a way, a trick. I would think of all the many successful production projects out there, and tell myself: if they could do this then there must be a way.

The secret, it turns out, is that all complex things are built up from countless stupidly simple things.

[Insert Single responsibility here somehow]

[maybe also a simple vs easy maxim]


text:
var graphql = require('graphql').graphql;
var parse = require('json-safe-parse');

exports.graph = {
  name: 'graph',
  description: 'Graph Endpoint',
  scopes : ['public'],
  middleware: [],

  inputs: {
    variables : {
      default : function(){ return '{}' }
    },
    query : {},
  },

  run: function (api, data, next) {

    new Promise(function(resolve, reject){

      var query = data.params.query
      var variables = data.params.variables;

      try {
        variables = JSON.parse(variables)
      }catch(e){

      }

      graphql(api.graphql.schemas['/graph'], query, data, api, variables)
      .then(function(res){
        data.response = res
        next();
      }).catch(function(err){
        next(err);
      })

    })
    .catch(function(err){
      api.log('error',err)
      next(err);
    })

  }
};


text:
package com.github.toastshaman.example.oauth;

import com.github.toastshaman.example.oauth.persistence.UserDetailsDao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;

@EnableWebSecurity
@Configuration
@SuppressWarnings("unused")
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
    @Bean
    @Override
    protected UserDetailsService userDetailsService() {
        return new UserDetailsDao();
    }

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http
            .formLogin()
                .loginPage("/login")
                .usernameParameter("form-username")
                .passwordParameter("form-password")
                .loginProcessingUrl("/login.do").permitAll()
            .and()
                .authorizeRequests().antMatchers("/me").authenticated()
            .and()
                .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout.do"))
            .and()
                .requestMatchers().antMatchers("/login", "/login.do", "/oauth/authorize", "/oauth/confirm_access")
            .and()
                .authorizeRequests().anyRequest().authenticated()
            .and()
                .userDetailsService(userDetailsService());
    }
}


text:
Package.describe({
  summary: "Post Page Item",
  version: '0.1.0',
  name: "post-page-item"
});

Package.onUse(function (api) {

  api.use(['templating', 'telescope-base', 'telescope-theme-hubble','mrt:popcorn'], ['client']);

  api.add_files([
    'lib/client/templates/postpageitem.html',
    'lib/client/js/postpageitem.js',
    'lib/client/stylesheets/postpageitem.css',

    ], ['client']);

});


text:
package com.github.programmerr47.vkgroups.background.db.entries;

import android.provider.BaseColumns;

import java.util.concurrent.TimeoutException;

import static com.github.programmerr47.vkgroups.background.db.entries.VkContract.COMMA_SEP;
import static com.github.programmerr47.vkgroups.background.db.entries.VkContract.INTEGER_TYPE;
import static com.github.programmerr47.vkgroups.background.db.entries.VkContract.TEXT_TYPE;

/**
 * @author Michael Spitsin
 * @since 2016-01-10
 */
public class GroupEntry implements BaseColumns {

    public static final String TABLE_NAME = "groupTable";

    public static final String GROUP_ID = "group_id";
    public static final String NAME = "name";
    public static final String SCREEN_NAME = "screen_name";
    public static final String IS_CLOSED = "is_closed";
    public static final String DEACTIVATED = "deactivated";
    public static final String ADMIN_LEVEL = "admin_level";
    public static final String MEMBER_STATUS = "member_status";
    public static final String INVITED_BY = "invited_by";
    public static final String GROUP_TYPE = "group_type";
    public static final String HAS_PHOTO = "has_photo";
    public static final String PHOTO_50_URI = "photo_50_uri";
    public static final String PHOTO_100_URI = "photo_100_uri";
    public static final String PHOTO_MAX_URI = "photo_max_uri";
    public static final String BAN_END_DATE = "ban_end_date";
    public static final String BAN_COMMENT = "ban_comment";
    public static final String CITY_ID = "city_id";
    public static final String COUNTRY_ID = "country_id";
    public static final String PLACE_ID = "place_id";
    public static final String DESCRIPTION = "description";
    public static final String WIKI_PAGE = "wiki_page";
    public static final String MEMBER_COUNT = "member_count";
    public static final String PHOTO_COUNT = "photo_count";
    public static final String VIDEO_COUNT = "video_count";
    public static final String AUDIO_COUNT = "audio_count";
    public static final String ALBUM_COUNT = "album_count";
    public static final String TOPIC_COUNT = "topic_count";
    public static final String DOC_COUNT = "doc_count";
    public static final String START_DATE = "start_date";
    public static final String FINISH_DATE = "finish_date";
    public static final String PUBLIC_START_DATE = "public_start_date";
    public static final String CAN_POST = "can_post";
    public static final String CAN_SEE_ALL_POSTS = "can_see_all_posts";
    public static final String CAN_UPLOAD_DOC = "can_upload_doc";
    public static final String CAN_UPLOAD_VIDEO = "can_upload_video";
    public static final String CAN_CREATE_TOPIC = "can_create_topic";
    public static final String ACTIVITY = "activity";
    public static final String STATUS = "status";
    public static final String FIXED_POST_ID = "fixed_post_id";
    public static final String VERIFIED = "verified";
    public static final String SITE = "site";
    public static final String MAIN_ALBUM_ID = "main_album_id";
    public static final String IS_FAVOURITE = "is_favourite";
    public static final String IS_HIDDEN_FROM_FEED = "is_hidden_from_feed";
    public static final String MAIN_SECTION = "main_section";

    public static final String SQL_CREATE_QUERY =
            "CREATE TABLE " + TABLE_NAME + " (" +
                    _ID + INTEGER_TYPE + " PRIMARY KEY" + COMMA_SEP +
                    GROUP_ID + INTEGER_TYPE + COMMA_SEP +
                    NAME + TEXT_TYPE + COMMA_SEP +
                    SCREEN_NAME + TEXT_TYPE + COMMA_SEP +
                    IS_CLOSED + INTEGER_TYPE + COMMA_SEP +
                    DEACTIVATED + TEXT_TYPE + COMMA_SEP +
                    ADMIN_LEVEL + TEXT_TYPE + COMMA_SEP +
                    MEMBER_STATUS + INTEGER_TYPE + COMMA_SEP +
                    INVITED_BY + INTEGER_TYPE + COMMA_SEP +
                    GROUP_TYPE + TEXT_TYPE + COMMA_SEP +
                    HAS_PHOTO + INTEGER_TYPE + COMMA_SEP +
                    PHOTO_50_URI + TEXT_TYPE + COMMA_SEP +
                    PHOTO_100_URI + TEXT_TYPE + COMMA_SEP +
                    PHOTO_MAX_URI + TEXT_TYPE + COMMA_SEP +
                    BAN_END_DATE + INTEGER_TYPE + COMMA_SEP +
                    BAN_COMMENT + TEXT_TYPE + COMMA_SEP +
                    CITY_ID + INTEGER_TYPE + COMMA_SEP +
                    COUNTRY_ID + INTEGER_TYPE + COMMA_SEP +
                    PLACE_ID + INTEGER_TYPE + COMMA_SEP +
                    DESCRIPTION + TEXT_TYPE + COMMA_SEP +
                    WIKI_PAGE + TEXT_TYPE + COMMA_SEP +
                    MEMBER_COUNT + INTEGER_TYPE + COMMA_SEP +
                    PHOTO_COUNT + INTEGER_TYPE + COMMA_SEP +
                    VIDEO_COUNT + INTEGER_TYPE + COMMA_SEP +
                    ALBUM_COUNT + INTEGER_TYPE + COMMA_SEP +
                    AUDIO_COUNT + INTEGER_TYPE + COMMA_SEP +
                    TOPIC_COUNT + INTEGER_TYPE + COMMA_SEP +
                    DOC_COUNT + INTEGER_TYPE + COMMA_SEP +
                    START_DATE + INTEGER_TYPE + COMMA_SEP +
                    FINISH_DATE + INTEGER_TYPE + COMMA_SEP +
                    PUBLIC_START_DATE + INTEGER_TYPE + COMMA_SEP +
                    CAN_POST + INTEGER_TYPE + COMMA_SEP +
                    CAN_SEE_ALL_POSTS + INTEGER_TYPE + COMMA_SEP +
                    CAN_UPLOAD_VIDEO + INTEGER_TYPE + COMMA_SEP +
                    CAN_UPLOAD_DOC + INTEGER_TYPE + COMMA_SEP +
                    CAN_CREATE_TOPIC + INTEGER_TYPE + COMMA_SEP +
                    ACTIVITY + TEXT_TYPE + COMMA_SEP +
                    STATUS + TEXT_TYPE + COMMA_SEP +
                    FIXED_POST_ID + INTEGER_TYPE + COMMA_SEP +
                    VERIFIED + INTEGER_TYPE + COMMA_SEP +
                    SITE + TEXT_TYPE + COMMA_SEP +
                    MAIN_ALBUM_ID + INTEGER_TYPE + COMMA_SEP +
                    IS_FAVOURITE + INTEGER_TYPE + COMMA_SEP +
                    IS_HIDDEN_FROM_FEED + INTEGER_TYPE + COMMA_SEP +
                    MAIN_SECTION + INTEGER_TYPE + ")";

    private GroupEntry() {}
}


text:
	/////// //////////////////
	/////// PROJECT: MTA iLife - German Fun Reallife Gamemode
	/////// VERSION: 1.7.2
	/////// DEVELOPERS: See DEVELOPERS.md in the top folder
	/////// LICENSE: See LICENSE.md in the top folder
	/////// /////////////////
]]

--
-- Created by IntelliJ IDEA.
-- User: Noneatme
-- Date: 01.02.2015
-- Time: 01:33
-- To change this template use File | Settings | File Templates.
--

cDrugManager = inherit(cSingleton)

DrugObjects 	= {}

function cDrugManager:constructor()
    self.loadFunc	    = function() self:load() end
    self.thread			= cThread:new("DrugLoading_Thread", self.loadFunc)

    self.thread:start(50);
end

function cDrugManager:load()
    local result 	= CDatabase:getInstance():query("SELECT * FROM drugs;")
    local index		= 0;
    local start		= getTickCount();

    if(result) then
        local maxCount  = 25;
        local count     = 0;

        for index2, tbl in pairs(result) do
            index = index+1;

            DrugObjects[index]  = cDrug:new(tbl["DrugID"], tbl["OwnerID"], tbl["iX"], tbl["iY"], tbl["iZ"], tbl["iType"], tbl["iTimestamp"]);

            count = count+1;
            if(count > maxCount) then
                count = 0;
                coroutine.yield();
            end
        end
    end

    outputDebugString(index.." Drogenpflanzen gefunden");
end