text:
//
//  gpio.h
//  BakingPi
//
//  Created by Jeremy Pereira on 17/09/2012.
//  Copyright (c) 2012 Jeremy Pereira. All rights reserved.
//

/*!
 *  @file gpio.h
 *  @brief GPIO controller functions
 *  @author Jeremy Pereira
 */

#ifndef BakingPi_gpio_h
#define BakingPi_gpio_h

#include "bptypes.h"

/*!
 *  @brief GPIO pin functions
 */
enum GPIOFunction
{
    /*!
     *  @brief Returned if the pin number is invalid
     */
    GPIO_FN_INVALID = -1,
    /*!
     *  @brief Sets the pin as an input pin
     */
    GPIO_FN_INPUT  = 0,
    /*!
     *  @brief Sets the pin as an output pin
     */
    GPIO_FN_OUTPUT = 1,
};

typedef enum GPIOFunction GPIOFunction;

struct GPIO;
typedef struct GPIO GPIO;

struct GPIODriver;
typedef struct GPIODriver GPIODriver;

/*!
 *  @brief allocate a GPIO
 *  @param driver the particular GPIO hardware driver
 *  @return An allocated but not initialised GPIO or NULL if it couldn't
 *  be allocated.
 */
GPIO* gpio_alloc(GPIODriver* driver);

/*!
 *  @brief Initialise the GPIO.
 *
 *  The first GPIO initialised is made the default GPIO.
 *  @param gpio GPIO to initialise
 *  @return the GPIO driver
 */
GPIO* gpio_init(GPIO* gpio);

/*!
 *  @brief Get the default GPIO
 *  @return the default GPIO
 */
GPIO* gpio_defaultGPIO(void);
/*!
 *  @brief set the GPIO pin function
 *  @param GPIO address of the GPIO registers
 *  @param pinNumber number of the pin to set the function for (0 - 53)
 *  @param function function to set.
 *	@return true if the function and pin number are valid and the function was
 *          set.
 */
bool gpio_setFunction(GPIO* gpio, uint32_t pinNumber, GPIOFunction function);

/*!
 *  @brief Get the current function of the given pin
 *
 *  @param gpio Address of the GPIO
 *  @param pinNumber The lin number to get the function of.
 *  @return the function of the pin or GPIO_FN_INVALID if the pin is not between
 *  0 and 53
 */
GPIOFunction gpio_getFunction(GPIO* gpio, uint32_t pinNumber);

/*!
 *  @brief Set the pin either on or off.
 *
 *  The pin should be set to output before calling this function or it will
 *  hopefully have no effect (as opposed to blowing up the IO controller).
 *  @param GPIO address of the GPIO registers
 *  @param pinNumber number of the pin to set (0 - 53)
 *  @param pinOn true if the pin should be set on, false to set it off
 *  @return true if the pin number is valid.
 */
bool gpio_setPin(GPIO* gpio, uint32_t pinNumber, bool pinOn);

#endif


text:
module Travis
  module Api
    module V2
      module Http
        class Builds
          include Formats

          attr_reader :builds, :commits, :options

          def initialize(builds, options = {})
            @builds = builds
            @commits = builds.map(&:commit)
            @options = options
          end

          def data
            {
              'builds' => builds.map { |build| build_data(build) },
              'commits' => commits.map { |commit| commit_data(commit) }
            }
          end

          private

            def build_data(build)
              {
                'id' => build.id,
                'repository_id' => build.repository_id,
                'commit_id' => build.commit_id,
                'number' => build.number,
                'event_type' => build.event_type,
                'pull_request' => build.pull_request?,
                'pull_request_title' => build.pull_request_title,
                'pull_request_number' => build.pull_request_number,
                'config' => build.obfuscated_config.stringify_keys,
                'state' => build.state.to_s,
                'started_at' => format_date(build.started_at),
                'finished_at' => format_date(build.finished_at),
                'duration' => build.duration,
                'job_ids' => matrix_ids(build)
              }
            end

            def matrix_ids(build)
              build.cached_matrix_ids || build.matrix_ids
            end

            def commit_data(commit)
              {
                'id' => commit.id,
                'sha' => commit.commit,
                'branch' => commit.branch,
                'message' => commit.message,
                'committed_at' => format_date(commit.committed_at),
                'author_name' => commit.author_name,
                'author_email' => commit.author_email,
                'committer_name' => commit.committer_name,
                'committer_email' => commit.committer_email,
                'compare_url' => commit.compare_url,
                'pull_request_number' => commit.pull_request_number
              }
            end
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package greenapi.core.model.resources.builders;

import greenapi.core.model.resource.io.Storage;
import greenapi.core.model.resources.CpuSocket;
import greenapi.core.model.resources.Machine;
import greenapi.core.model.resources.Memory;
import greenapi.core.model.resources.net.NetworkInterfaces;
import greenapi.core.model.sensors.Sensor;
import greenapi.core.model.software.os.OperatingSystem;

public interface MachineBuilder extends Builder<Machine>
{

    MachineBuilder withId(String id);

    MachineBuilder withName(String name);

    MachineBuilder withCpus(CpuSocket... cpuSockets);

    MachineBuilder withMemory(Memory... memories);

    MachineBuilder withStorages(Storage... storages);

    MachineBuilder withOs(OperatingSystem os);

    MachineBuilder withNetInterfaces(NetworkInterfaces networkInterfaces);

    MachineBuilder withSensors(Sensor<?, ?>... sensors);
}


text:
"use strict";
define( ["objects/Router"], function(router){
	return router.extend({
		_middlewaresRegExps : {},
		_middlewaresCallbacks : {},
		middlewares:{
		},
		_bindRoutes:function(){
			openbiz.Router.prototype._bindRoutes.apply(this, arguments);
			this._bindMiddlewares.call(this);
		},
		_bindMiddlewares:function(){
			if (!this.middlewares) return;
		      this.middlewares = _.result(this, 'middlewares');
		      var route, routes = _.keys(this.middlewares);
		      while ((route = routes.shift()) != null) {
		        this.middleware(route, this.middlewares[route]);
		      }
		},
		middleware:function(route, name, callback){
		      if (!_.isRegExp(route)) route = this._routeToRegExp(route);
		      if (_.isFunction(name)) {
		        callback = name;
		        name = '';
		      }
		      if (!callback) callback = this[name];
		      var router = this;
		      Backbone.history.middleware(route, function(fragment,next) {
		        var args = router._extractParameters(route, fragment);
		        if(callback) {
		        	args.unshift(next);
		        	callback.apply(router,args);
		        }
		        router.trigger.apply(router, ['route-middleware:' + name].concat(args));
		        router.trigger('route-middleware', name, args);
		        Backbone.history.trigger('route-middleware', router, name, args);
		      });
		      return this;
		},
		loadUrl: function(fragment) {
	      fragment = Backbone.history.getFragment(fragment);
	      var matchCounter = 0;
	      return _.any(Backbone.history.handlers, function(handler) {
	        if (handler.route.test(fragment)) {
	        	if(matchCounter>=1){
		          handler.callback(fragment);
		          return true;
		      	}
		      	matchCounter++;
	        }
	      });
	    },
		constructor:function(){
			for(var route in this.middlewares){
				this._middlewaresRegExps[route] = this._routeToRegExp(route);
				this._middlewaresCallbacks[route] = this.middlewares[route];
			}
			router.apply(this);
		}
	});
});


text:
package demo.project.hmi.demoapp;

import android.app.Instrumentation;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.gesture.Gesture;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.ViewGroup;
import android.view.WindowManager;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

//http://www.pocketmagic.net/android-overlay-cursor/

public class InternalCursorService extends Service implements SensorEventListener {

    private int count = 0;
    private class Receiver extends BroadcastReceiver {
        @Override
        //Funzione eseguita alla ricezione di un messaggio (generati in GUI)
        public void onReceive(Context context, Intent intent) {
            //Prende la richiesta
            String action = intent.getStringExtra("Action");
            if(action == null)
                return;
            switch (action){
                //Visualizza il cursore
                case "ShowCursor":{
                    centerX = 0;
                    centerY = 0;
                    ShowCursor(true);
                    break;
                }
                //Nasconde il cursore
                case "HideCursor":{
                    ShowCursor(false);
                    //sensorManager.unregisterListener();
                    break;
                }
                //Esegue il click
                case "Click":{
                    OnClick();
                    break;
                }
                //Esegue il click lungo
                case "Lungo":{
                    OnLongClick();
                    break;
                }
                //Swipe sinistro
                case "SLeft":{
                    OnSwipe(Direction.Left);
                    break;
                }
                //swipe destro
                case "SRight":{
                    OnSwipe(Direction.Right);
                    break;
                }
                //swipe alto
                case "SUp":{
                    OnSwipe(Direction.Up);
                    break;
                }
                //swipe basso
                case "SDown":{
                    OnSwipe(Direction.Down);
                    break;
                }
                //Ferma il servizio
                case "Destroy":{
                    ShowCursor(false);
                    break;
                }
                //Esegue il click indietro
                case "Back":{
                    try{
                        Runtime.getRuntime().exec("input keyevent " + KeyEvent.KEYCODE_BACK);
                    }catch (IOException e){}
                    break;
                }
                //Esegue il click sul tasto home
                case "Home":{
                    try{
                        Runtime.getRuntime().exec("input keyevent " + KeyEvent.KEYCODE_HOME);
                    }catch (IOException e){}
                    break;
                }
            }
        }
    }
    private OverlayView mView;
    private SensorManager sensorManager;
    private Sensor accelerometer, gyro;
    private int prevSecond = 0;
    private double centerX = 0, centerY = 0, saveX = 0, saveY = 0;
    private int transition = 1, //Transizione del cursore (da rimuovere)
            X = 0, //Coordinata X
            Y = 0, //Coordinata Y
            m_nScreenW = 0,//Larghezza schermo
            m_nScreenH = 0;//Altezza schermo
    private double pi = Math.PI; //PiGreca
    private double accx=0, tempx=0;
    private double accy=0, tempy=0;
    private double gyroy=0;
    private double gyrox=0;
    private double previousX = 0, previousY = 0;
    private double[] h = new double[]{
            0.041275130475134675,
            0.09980846342214969,
            0.16876227509747477,
            0.21514995135890577,
            0.21514995135890577,
            0.16876227509747477,
            0.09980846342214969,
            0.041275130475134675
    };
    private long downTime;
    private int xEnd = 0, yEnd = 0;
    private int mBindFlag;
    private Messenger mServiceMessenger;
    private static final String TAG = "SpeechRecognizerService";
    public enum Direction {//enumerativo per la direzione dello swipe
        Left, Right, Up, Down;
    }
    private void OnSwipe(Direction direction) {
        Instrumentation inst = new Instrumentation();
        downTime = SystemClock.uptimeMillis();
        xEnd = 0; yEnd = 0;
        switch (direction){
            case Right: {
                xEnd = m_nScreenW;
                yEnd = Y;
                break;
            }
            case Left:{
                xEnd = 0;
                yEnd = Y;
                break;
            }
            case Up:{
                yEnd = 0;
                xEnd = X;
                break;
            }
            case Down:{
                yEnd = m_nScreenH;
                xEnd = X;
                break;
            }
        }
        new Thread() {
            @Override
            public void run() {
                Instrumentation m_Instrumentation = new Instrumentation();
                try {
                    m_Instrumentation.sendPointerSync(MotionEvent.obtain(downTime, SystemClock.uptimeMillis(),
                            MotionEvent.ACTION_DOWN, X, Y, 0));
                    m_Instrumentation.sendPointerSync(MotionEvent.obtain(downTime, SystemClock.uptimeMillis(),
                            MotionEvent.ACTION_MOVE, xEnd, yEnd, 0));
                    m_Instrumentation.sendPointerSync(MotionEvent.obtain(downTime, SystemClock.uptimeMillis() + 1000,
                            MotionEvent.ACTION_UP, xEnd, yEnd, 0));
                } catch (Exception e) {}

            }
        }.start();

    }
    //Thread per l'esecuzione del click
    private final Thread thread = new Thread() {
        @Override
        public void run() {
            //Esegue un click alle coordinate X e Y
            Instrumentation m_Instrumentation = new Instrumentation();
            try {
                m_Instrumentation.sendPointerSync(MotionEvent.obtain(
                        SystemClock.uptimeMillis(),
                        SystemClock.uptimeMillis() + 10,
                        MotionEvent.ACTION_DOWN, X, Y, 0));
                m_Instrumentation.sendPointerSync(MotionEvent.obtain(
                        SystemClock.uptimeMillis(),
                        SystemClock.uptimeMillis() + 10,
                        MotionEvent.ACTION_UP, X, Y, 0));
            } catch (Exception e) {}
        }
    };
    /**
     * @param x
     * @param y
     * @param autoenable if set, it will automatically show the cursor when movement is detected
     */
    public void Updater(final int x, final int y, final boolean autoenable) {
        mView.Update(x, y);
        if ((x!=0 || y!= 0) && autoenable && !mView.isCursorShown() )
            ShowCursor(true); //will also post invalidate
        else
            mView.postInvalidate();
    }
    private void OnLongClick(){
        //Controlla se il cursore è abilitato
        if(!mView.isCursorShown())
            return;
        //Eseguo il thread che effettua il click
        new Thread() {
            @Override
            public void run() {
                //Esegue un click alle coordinate X e Y
                try {
                    Instrumentation inst = new Instrumentation();
                    long downTime = SystemClock.uptimeMillis();
                    long eventTime = SystemClock.uptimeMillis();
                    MotionEvent event = MotionEvent.obtain(downTime, eventTime,
                            MotionEvent.ACTION_DOWN, X, Y, 0);
                    MotionEvent event2 = MotionEvent.obtain(downTime, eventTime,
                            MotionEvent.ACTION_UP, X, Y, 0);
                    inst.sendPointerSync(event);
                    try {
                        Thread.sleep(750);
                    }catch (Exception e){}
                    inst.sendPointerSync(event2);
                } catch (NullPointerException e) {
                    // TODO: handle exception
                    e.printStackTrace();
                }
            }
        }.start();
    }
    private void OnClick(){
        //Controlla se il cursore è abilitato
        if(!mView.isCursorShown())
            return;
        //Eseguo il thread che effettua il click
        new Thread() {
            @Override
            public void run() {
                //Esegue un click alle coordinate X e Y
                Instrumentation m_Instrumentation = new Instrumentation();
                try {
                    m_Instrumentation.sendPointerSync(MotionEvent.obtain(
                            SystemClock.uptimeMillis(),
                            SystemClock.uptimeMillis() + 10,
                            MotionEvent.ACTION_DOWN, X, Y, 0));
                    m_Instrumentation.sendPointerSync(MotionEvent.obtain(
                            SystemClock.uptimeMillis(),
                            SystemClock.uptimeMillis() + 10,
                            MotionEvent.ACTION_UP, X, Y, 0));
                } catch (Exception e) {}
            }
        }.start();
    }
    //Imposta il booleano per la visualizzazione o meno del cursore
    public void ShowCursor(boolean status) {
        mView.ShowCursor(status);
        mView.postInvalidate();
    }
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
    @Override
    public void onDestroy(){
        PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("ExIsOn", false).commit();
        PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("InIsOn", false).commit();
        super.onDestroy();
    }
    @Override
    public void onCreate() {
        super.onCreate();
        //Registro il receiver dei messaggi
        registerReceiver(new Receiver(), new IntentFilter("demo.project.hmi.demoapp.msg"));
        mView = new OverlayView(this);
        WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.MATCH_PARENT,
                WindowManager.LayoutParams.MATCH_PARENT,
                WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
                PixelFormat.TRANSLUCENT);
        params.setTitle("Cursor");
        WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
        wm.addView(mView, params);
        // get screen size
        DisplayMetrics metrics = new DisplayMetrics();
        try {
            ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
            m_nScreenW = metrics.widthPixels;
            m_nScreenH = metrics.heightPixels;
            X = m_nScreenW/2;
            Y = m_nScreenH/2;
        }
        catch (Exception e) { //default to a HVGA 320x480 and let's hope for the best
            m_nScreenW = 0;
            m_nScreenH = 0;
        }
        sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
        sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_FASTEST);
        gyro = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
        sensorManager.registerListener(this, gyro, SensorManager.SENSOR_DELAY_NORMAL);
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        if(prefs.getBoolean("OnBootIn", false)){
            ShowCursor(true);
            prefs.edit().putBoolean("OnBootIn", false).commit();
            Intent i = new Intent(getBaseContext(), SpeechRecognizerService.class);
            startService(i);
            mBindFlag = Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT ? 0 : Context.BIND_ABOVE_CLIENT;
            startRecognition();
        }
    }
    private void startRecognition(){
        bindService(new Intent(this, SpeechRecognizerService.class), mServiceConnection, mBindFlag);
    }
    private final ServiceConnection mServiceConnection = new ServiceConnection()
    {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service)
        {
            Log.d(TAG, "onServiceConnected"); //$NON-NLS-1$
            mServiceMessenger = new Messenger(service);
            Message msg = new Message();
            msg.what = SpeechRecognizerService.MSG_RECOGNIZER_START_LISTENING;
            try{mServiceMessenger.send(msg);
            }catch (RemoteException e){}
        }
        @Override
        public void onServiceDisconnected(ComponentName name)
        {
            Log.d(TAG, "onServiceDisconnected"); //$NON-NLS-1$
            mServiceMessenger = null;
        }
    };

    public void onSensorChanged(SensorEvent event) {
        if(!mView.isCursorShown())
            return;
        switch(event.sensor.getType()) {
            case Sensor.TYPE_ACCELEROMETER:		//prende i dati da accelerometro
                float axisXa = event.values[0];
                float axisYa = event.values[1];
                accx=axisXa;
                accy=axisYa;
                break;
            case Sensor.TYPE_GYROSCOPE:			//prende i dati da girocoscopio
                float axisY = event.values[0];
                float axisX = event.values[1];
                //converte rad in angoli
                int rx =(int)(axisX*(180/pi));
                int ry =(int)(axisY*(180/pi));
                gyroy = (double)ry;
                gyrox = (double)rx;
                break;
        }
        if(previousX == 0 && previousY == 0){
            previousX = accx;
            previousY = accy;
            return;
        }
        double rate = 0.05;
        accx = rate * accx + (1.0 - rate) * previousX;
        accy = rate * accy + (1.0 - rate) * previousY;
        Calendar cal = Calendar.getInstance();
        //Se è la prima volta che eseguo la move, utilizzo queste coordinate come quelle di riferimento
        if (centerX == 0 && centerY == 0) {
            centerX = accx;
            centerY = accy;
            saveX = X;
            saveY = Y;
            count = 0;
        } else {
            double div = (double) 6 / (m_nScreenW / 2);
            //Guardo l'escursione
            double deltax = accx - centerX;
            deltax = (deltax > 0) ? deltax : deltax * (-1);
            if (deltax <= 9) {
                if (accx < centerX) {
                    //Quindi devo aumentare x
                    //Quanto leggo fratto 9
                    X = (int) Math.round(deltax / div) + (m_nScreenW / 2);
                } else if (accx > centerX) {
                    //Quindi devo diminuire x
                    //Quanto leggo fratto 9
                    X = (m_nScreenW / 2) - (int) Math.round(deltax / div);
                }
            } else {
                X = (accx < centerX) ? m_nScreenW : 0;
            }
            div = (double) 5 / (m_nScreenH / 2);
            double deltay = Math.abs(accy - centerY);
            deltay = (deltay > 0) ? deltay : deltay * (-1);
            if (deltay <= 25) {
                if (accy > centerY) {
                    //Quindi devo aumentare x
                    Y = (int) Math.round(deltay / div) + (m_nScreenH / 2);
                } else if (accy < centerY) {
                    //Quindi devo aumentare x
                    //Quanto leggo fratto 9
                    Y = (m_nScreenH / 2) - (int) Math.round(deltay / div);		//da invertire con + teoricamente
                }
            }else{
                Y = (accy < centerY) ? m_nScreenH : 0;
            }
        }
        Updater(Math.round(X), Math.round(Y), false);
        previousX = accx;
        previousY = accy;
        SimpleDateFormat sdf = new SimpleDateFormat("ss");
        int now = Integer.parseInt(sdf.format(cal.getTime()));
        if((now - prevSecond) >= 1){
            //Calcolo la distanza tra due punti
            double distance = Math.sqrt((Math.pow((X - saveX),2) - Math.pow((Y - saveY), 2)));
            if(distance < 50) {
                OnClick();
            }
            saveX = X;
            saveY = Y;
            prevSecond = now;
        }else if(prevSecond == 59)
            prevSecond = now;

    }
    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {}
}


text:
set -e
set -x

if [ -z "$1" ]; then
  echo "Usage: update.sh version"
  exit 1
fi

channel="stable"
case "$1" in
*-dev.*) channel="dev";;
esac

tmpdir=$(mktemp -d)
cleanup() {
  rm -rf "$tmpdir"
}
trap cleanup EXIT HUP INT QUIT TERM PIPE
pushd "$tmpdir"

gsutil.py cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-linux-x64-release.zip" .
unzip -q dartsdk-linux-x64-release.zip -d sdk
cipd create \
  -name dart/dart-sdk/linux-amd64 \
  -in sdk \
  -install-mode copy \
  -tag version:$1 \
  -ref $channel
rm -rf sdk

gsutil.py cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-linux-arm-release.zip" .
unzip -q dartsdk-linux-arm-release.zip -d sdk
cipd create \
  -name dart/dart-sdk/linux-armv6l \
  -in sdk \
  -install-mode copy \
  -tag version:$1 \
  -ref $channel
rm -rf sdk

gsutil.py cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-linux-arm64-release.zip" .
unzip -q dartsdk-linux-arm64-release.zip -d sdk
cipd create \
  -name dart/dart-sdk/linux-arm64 \
  -in sdk \
  -install-mode copy \
  -tag version:$1 \
  -ref $channel
rm -rf sdk

gsutil.py cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-macos-x64-release.zip" .
unzip -q dartsdk-macos-x64-release.zip -d sdk
cipd create \
  -name dart/dart-sdk/mac-amd64 \
  -in sdk \
  -install-mode copy \
  -tag version:$1 \
  -ref $channel
rm -rf sdk

# We currently use the ia32 SDK on x64 Windows as well, see also README.
gsutil.py cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-windows-ia32-release.zip" .
unzip -q dartsdk-windows-ia32-release.zip -d sdk
cipd create \
  -name dart/dart-sdk/windows-amd64 \
  -in sdk \
  -install-mode copy \
  -tag version:$1 \
  -ref $channel
rm -rf sdk

gsutil.py cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-windows-ia32-release.zip" .
unzip -q dartsdk-windows-ia32-release.zip -d sdk
cipd create \
  -name dart/dart-sdk/windows-386 \
  -in sdk \
  -install-mode copy \
  -tag version:$1 \
  -ref $channel
rm -rf sdk

popd


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Document</title>
  <meta name="description" content="Description">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">

Loading


text:
<?php

namespace Symfony\Component\Form\Extension\Core\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;

class RadioType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildView(FormView $view, FormInterface $form)
    {
        if ($view->hasParent()) {
            $view->set('full_name', $view->getParent()->get('full_name'));
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getParent(array $options)
    {
        return 'checkbox';
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'radio';
    }
}


text:
import os
import argparse
import re
import sys
import yaml
from jinja2 import Environment, PackageLoader
env = Environment(loader=PackageLoader('simple_site_manager', "templates"))

DEFAULTS = {
    "project_root_dir": "/opt/django/%(project_name)s/",
    "django_root_dir": "%(project_root_dir)s%(project_name)s/",
    "fcgi_path": "%(django_root_dir)ssiteman-fcgi.py",
    "uploaded_dir": "/opt/static/%(project_name)s_uploaded/",
    "static_dir": "/opt/static/%(project_name)s/",
    "www_uploaded_path": "/uploaded/",
    "www_static_path": "/m/",
    "max_procs": "3",
    "redirect_to_https": False,
    "virtual_env_dir": "%(project_root_dir)senv-%(project_name)s/",
    "settings_module": "settings",
    'redirect_from_domains': []
}

class Server(object):
    def __init__(self, config_file, dry_run=False):
        self.dry_run = dry_run
        self.sites = []
        for site in sites_for_settings(config_file):
            self.sites.append(site)

    def write_fcgi_file(self, site):
        conf = site.generate_fcgi_file()
        if not self.dry_run:
            with open(site.fcgi_path, 'w') as f:
                f.write(conf)
            os.chmod(site.fcgi_path, 0755)
        return site.fcgi_path

    def write_ligttpd_config(self, site):
        config_path = "/etc/lighttpd/"
        file_path = os.path.join(config_path, u"conf-available/siteman-%s.conf" % site.project_name)
        symlink_path = os.path.join(config_path, u"conf-enabled/siteman-%s.conf" % site.project_name)

        conf = site.generate_lighttpd_config()
        if not self.dry_run:
            with open(file_path, 'w') as f:
                f.write(conf)
            if os.path.exists(symlink_path):
                os.unlink(symlink_path)
            os.symlink(file_path, symlink_path)
        return ', '.join((file_path, symlink_path))

    def write(self):
        for site in self.sites:
            print ("Writing files for %s" % site)
            if self.dry_run:
                print("**DRY RUN**")
            print("Wrote %s" % self.write_ligttpd_config(site))
            print("Wrote %s" % self.write_fcgi_file(site))

def sites_for_settings(config_file):
    config_data = yaml.load(config_file)
    for site_name, site_data in config_data.items():
        yield Site(site_name, **site_data)

class Site(object):
    def _path_fix(self, path):
        matches = re.match(r"^/?(.*)/?$", path)
        return u"/%s/" % matches.group(1)

    def _or_default(self, kwargs, key):
        return kwargs.get(key, str(DEFAULTS[key]) % vars(self))

    def __repr__(self):
        return self.project_name

    def __init__(self, name, **kwargs):

        self.project_name = name
        self.domain_name = kwargs['domain_name']
        self.project_root_dir = self._or_default(kwargs, 'project_root_dir')

        self.django_root_dir = self._or_default(kwargs, 'django_root_dir')

        self.uploaded_dir = self._or_default(kwargs, 'uploaded_dir')

        self.static_dir = self._or_default(kwargs, 'static_dir')

        self.www_uploaded_path = self._or_default(kwargs, "www_uploaded_path")
        self.www_static_path = self._or_default(kwargs, 'www_static_path')

        self.fcgi_path = self._or_default(kwargs, "fcgi_path")
        self.max_procs = self._or_default(kwargs, 'max_procs')

        self.virtual_env_dir = self._or_default(kwargs, 'virtual_env_dir')
        self.settings_module = self._or_default(kwargs, 'settings_module')
        if 'settings_module' not in kwargs:
            self.settings_module = u"%s.%s" % (self.project_name, self.settings_module)

        self.redirect_from_domains = kwargs.get('redirect_from_domains', [])
        self.redirect_to_https = kwargs.get('redirect_to_https', DEFAULTS['redirect_to_https'])

    def generate_fcgi_file(self):
        template = env.get_template('fcgi.py.jinja2')
        return template.render(**vars(self))

    def generate_lighttpd_config(self):
        template = env.get_template('lighttpd.conf.jinja2')
        return template.render(**vars(self))

def main_func():
    parser = argparse.ArgumentParser(description='Create lighttpd configuration files and fcgi.py files.')

    parser.add_argument('--print', "-p", action='store_true',
                        required=False,
                        help='print all file data to console')
    parser.add_argument('--dry_run', action='store_true',
                        required=False,
                        help='just print file actions')
    parser.add_argument('config_file',
                        type=argparse.FileType('r'),
                        nargs=1,
                        default=sys.stdin,
                        #required=True,
                        help='site list file')

    args = vars(parser.parse_args())
    config_file = args['config_file'][0]
    dry_run = args.get('dry_run', False)
    server = Server(config_file, dry_run=dry_run)
    if not args['print']:
        server.write()
    else:
        for site in server.sites:
            print("------------------------------------------------")
            print("fcgi.py")
            print("------------------------------------------------")
            print(site.generate_fcgi_file())
            print("------------------------------------------------")
            print("lighttpd.conf")
            print("------------------------------------------------")
            print(site.generate_lighttpd_config())

if __name__ == "__main__":
    main_func()


text:
[//000000001]: # (nameserv::server \- Name service facility)
[//000000002]: # (Generated from file 'nns\_server\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (Copyright © 2007\-2008 Andreas Kupries <andreas\_kupries@users\.sourceforge\.net>)
[//000000004]: # (nameserv::server\(n\) 0\.3\.2 tcllib "Name service facility")

 [ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

# NAME

nameserv::server \- Name service facility, Server

# Table Of Contents

  - [Table Of Contents](#toc)

  - [Synopsis](#synopsis)

  - [Description](#section1)

  - [API](#section2)

  - [OPTIONS](#section3)

  - [HISTORY](#section4)

  - [Bugs, Ideas, Feedback](#section5)

  - [See Also](#seealso)

  - [Keywords](#keywords)

  - [Category](#category)

  - [Copyright](#copyright)

# SYNOPSIS

package require Tcl 8\.4
package require nameserv::server ?0\.3\.2?
package require comm
package require interp
package require logger

[__::nameserv::server::start__](#1)
[__::nameserv::server::stop__](#2)
[__::nameserv::server::active?__](#3)
[__::nameserv::server::cget__ __\-option__](#4)
[__::nameserv::server::configure__](#5)
[__::nameserv::server::configure__ __\-option__](#6)
[__::nameserv::server::configure__ __\-option__ *value*\.\.\.](#7)

# DESCRIPTION

Please read *[Name service facility, introduction](nns\_intro\.md)* first\.

This package provides an implementation of the serviver side of the name service
facility queried by the client provided by the package
__[nameserv](nns\_client\.md)__\. All information required by the server
will be held in memory\. There is no persistent state\.

This service is built in top of and for the package
__[comm](\.\./comm/comm\.md)__\. It has nothing to do with the Internet's
Domain Name System\. If the reader is looking for a package dealing with that
please see Tcllib's packages __[dns](\.\./dns/tcllib\_dns\.md)__ and
__resolv__\.

This server supports the *Core* protocol feature, and since version 0\.3 the
*Search/Continuous* feature as well\.

# API

The package exports five commands, as specified below:

  - __::nameserv::server::start__

    This command starts the server and causes it to listen on the configured
    port\. From now on clients are able to connect and make requests\. The result
    of the command is the empty string\.

    Note that any incoming requests will only be handled if the application the
    server is part of does enter an event loop after this command has been run\.

  - __::nameserv::server::stop__

    Invoking this command stops the server and releases all information it had\.
    Existing connections are shut down, and no new connections will be accepted
    any longer\. The result of the command is the empty string\.

  - __::nameserv::server::active?__

    This command returns a boolean value indicating the state of the server\. The
    result will be __true__ if the server is active, i\.e\. has been started,
    and __false__ otherwise\.

  - __::nameserv::server::cget__ __\-option__

    This command returns the currently configured value for the specified
    __\-option__\. The list of supported options and their meaning can be
    found in section [OPTIONS](#section3)\.

  - __::nameserv::server::configure__

    In this form the command returns a dictionary of all supported options, and
    their current values\. The list of supported options and their meaning can be
    found in section [OPTIONS](#section3)\.

  - __::nameserv::server::configure__ __\-option__

    In this form the command is an alias for "__::nameserv::server::cget__
    __\-option__"\. The list of supported options and their meaning can be
    found in section [OPTIONS](#section3)\.

  - __::nameserv::server::configure__ __\-option__ *value*\.\.\.

    In this form the command is used to configure one or more of the supported
    options\. At least one option has to be specified, and each option is
    followed by its new value\. The list of supported options and their meaning
    can be found in section [OPTIONS](#section3)\.

    This form can be used only if the server is not active, i\.e\. has not been
    started yet, or has been stopped\. While the server is active it cannot be
    reconfigured\.

# OPTIONS

The options supported by the server are for the specification of the TCP port to
listen on, and whether to accept non\-local connections or not\. They are:

  - __\-localonly__ *bool*

    This option specifies whether to accept only local connections \(\-localonly
    1\) or remote connections as well \(\-localonly 0\)\. The default is to accept
    only local connections\.

  - __\-port__ *number*

    This option specifies the port the name service will listen on after it has
    been started\. It has to be a positive integer number \(> 0\) not greater than
    65536 \(unsigned short\)\. The initial default is the number returned by the
    command __::nameserv::server::common::port__, as provided by the package
    __::nameserv::server::common__\.

# HISTORY

  - 0\.3

    Extended the server with the ability to perform asynchronous and continuous
    searches\.

  - 0\.2

    Changed name of \-local switch to \-localonly\.

  - 0\.1

    Initial implementation of the server\.

# Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and
other problems\. Please report such in the category *nameserv* of the [Tcllib
Trackers](http://core\.tcl\.tk/tcllib/reportlist)\. Please also report any ideas
for enhancements you may have for either package and/or documentation\.

When proposing code changes, please provide *unified diffs*, i\.e the output of
__diff \-u__\.

Note further that *attachments* are strongly preferred over inlined patches\.
Attachments can be made by going to the __Edit__ form of the ticket
immediately after its creation, and then using the left\-most button in the
secondary navigation bar\.

# SEE ALSO

nameserv::client\(n\), [nameserv::common\(n\)](nns\_common\.md)

# KEYWORDS

[name service](\.\./\.\./\.\./\.\./index\.md\#name\_service),
[server](\.\./\.\./\.\./\.\./index\.md\#server)

# CATEGORY

Networking

# COPYRIGHT

Copyright © 2007\-2008 Andreas Kupries <andreas\_kupries@users\.sourceforge\.net>


text:
package net.lab419

class NodeTree{

}


text:
ngDraggable
===========

> *NOTE:*
> I'm not actively maintaining this project any more. If any anyone would like to take on that responsible please get in touch

Drag and drop module for Angular JS with support for touch devices. [`demo`](http://htmlpreview.github.io/?https://github.com/fatlinesofcode/ngDraggable/blob/master/example.html).

### Usage:

- Install: `bower install ngDraggable`
- Add `angular` and `ngDraggable` to your code:

```html
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
<script src="ngDraggable.js"></script>
```

- Add a dependency to the `ngDraggable` module in your application.

```js
angular.module('app', ['ngDraggable']);
```

- Add attribute directives to your html:

Draggable usage:
```html
<div ng-drag="true" ng-drag-data="{obj}" ng-drag-success="onDragComplete($data,$event)" ng-center-anchor="true">
  Draggable div
</div>
```

* `ng-center-anchor` is optional. If not specified, it defaults to false.
* If the draggable is also clickable (ng-click, ng-dblclick) the script wont react.
* You can define a drag-button as child with the attribute `ng-drag-handle`.

```ng-drag-start``` and ```ng-drag-move``` is also available. Add to the ng-drop element.
``ng-drag-stop`` can be used when you want to react to the user dragging an item and it wasn't dropped into the target container.

```draggable:start```, ```draggable:move``` and  ```draggable:end``` events are broadcast on drag actions.

Drop area usage:
```html
<div ng-drop="true" ng-drop-success="onDropComplete($data,$event)" >
  Drop area
</div>
```

### Angular Controller:

```js
app.controller('MainCtrl', function ($scope) {
    $scope.onDragComplete=function(data,evt){
       console.log("drag success, data:", data);
    }
    $scope.onDropComplete=function(data,evt){
        console.log("drop success, data:", data);
    }
 };
```

## Examples
[`Drag and drop`](http://htmlpreview.github.io/?https://github.com/fatlinesofcode/ngDraggable/blob/master/example.html).

[`Re-ordering`](http://htmlpreview.github.io/?https://github.com/fatlinesofcode/ngDraggable/blob/master/example-reorder.html).

[`Cloning`](http://htmlpreview.github.io/?https://github.com/fatlinesofcode/ngDraggable/blob/master/example-clone.html).

[`Canceling`](http://htmlpreview.github.io/?https://github.com/fatlinesofcode/ngDraggable/blob/master/example-cancel.html).

## Pull requests
We welcome pull requests but please check that all the examples still work if you modified the source base. There have been serveral PRs recently that broke core functionality. If you are feeling really keen you could include some protractor test cases in your PR.


text:
package com.microsoft.azure.management.recoveryservices.v2016_06_01;

import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.microsoft.rest.ExpandableStringEnum;

/**
 * Defines values for AuthType.
 */
public final class AuthType extends ExpandableStringEnum<AuthType> {
    /** Static value Invalid for AuthType. */
    public static final AuthType INVALID = fromString("Invalid");

    /** Static value ACS for AuthType. */
    public static final AuthType ACS = fromString("ACS");

    /** Static value AAD for AuthType. */
    public static final AuthType AAD = fromString("AAD");

    /** Static value AccessControlService for AuthType. */
    public static final AuthType ACCESS_CONTROL_SERVICE = fromString("AccessControlService");

    /** Static value AzureActiveDirectory for AuthType. */
    public static final AuthType AZURE_ACTIVE_DIRECTORY = fromString("AzureActiveDirectory");

    /**
     * Creates or finds a AuthType from its string representation.
     * @param name a name to look for
     * @return the corresponding AuthType
     */
    @JsonCreator
    public static AuthType fromString(String name) {
        return fromString(name, AuthType.class);
    }

    /**
     * @return known AuthType values
     */
    public static Collection<AuthType> values() {
        return values(AuthType.class);
    }
}


text: declare export number;


text:
- **title**: Assignment 3
- **subtitle**: Unit testing
- **due**: 14 Oct, 2013
- **marks**: 10 marks

---

1. Fork the github repository

      > <https://github.com/mcgill-ecse321/temperature>

2. Complete the skeleton file `TemperatureTest.java` to unit test the
   `Temperature` class. You must test the following:

     1. Check the `getUnits()` and `getValue()` functions.

     2. Check the `changeUnits()` function for all six possible
        conversions between Celsius, Fahrenheit, and Kelvin.

     Explain your reasoning for choosing the particular test data. Note
     that you may have to choose multiple test data for each of the above
     test cases.

3. While running the above test cases, if you find bugs in the
   `Temeprature` class, you are allowed to modify the `Temperature`
   class appropriately.

4. Tag your final code with tag `assignment-2` and **submit the Git URL** of
   your repository. Your rationale for choosing the test data should be described
   in the code comments.