text:
import machine
import time
#import webrepl_setup
from umqtt.simple import MQTTClient

CONFIG = {
    "broker": "192.168.0.104",
    "client_id": "GATE TERMINAL",
    "p1_topic": "homeassistant/sensor/gatelight/state",
    "p2_topic": "homeassistant/sensor/gateactual/state",
    "s1_topic": "homeassistant/switch/gatelight/state",
    "s2_topic": "homeassistant/switch/gateactual/state"
}

def subscription_callback(topic,msg):
    global gate_open_cmd_pin
    global gate_light_pin
    global gate_light_state
    if topic == CONFIG['s1_topic'].encode('utf8'):
        if msg == b"ON":
            print ("Gate Light On")
            gate_light_state = 1
            gate_light_pin.value(0)
        if msg == b"OFF":
            print ("Gate Light Off")
            gate_light_state = 0
            gate_light_pin.value(1)
    if topic == CONFIG['s2_topic'].encode('utf8'):
        if msg == b"ON":
            print ("Gate Inactive")
            gate_open_cmd_pin.value(0)
        if msg == b"OFF":
            print ("Gate Active")
            gate_open_cmd_pin.value(1)

def do_mqtt_connect(l_client):
    try:
        l_client.connect()
        print("Connected to {}".format(CONFIG['broker']))
        l_client.subscribe(CONFIG['s1_topic'])
        l_client.subscribe(CONFIG['s2_topic'])
    except OSError as e:
        print ("Could not connect!!")

client = MQTTClient(CONFIG['client_id'], CONFIG['broker'])
client.set_callback(subscription_callback)
do_mqtt_connect(client)
gate_light_state = 0
gate_open_state = 0
# set up the gate command pin and initialise the RELAY to off
gate_open_cmd_pin = machine.Pin(4, machine.Pin.OUT)
gate_open_cmd_pin.value(1)
# set up the gate light pin and initialise the RELAY to off
gate_light_pin = machine.Pin(5, machine.Pin.OUT)
gate_light_pin.value(1)
# the gate reed switch is shorted when closed. The pullups are required to make it high
# when the gate is open
gate_open_in_pin = machine.Pin(13, machine.Pin.IN, machine.Pin.PULL_UP)
time.sleep(5)

while True:
    try:
        print("Send P1")
        if (gate_light_state == 1):
            client.publish(CONFIG['p1_topic'], "{\"state\":\"ON\"}")
        else:
            client.publish(CONFIG['p1_topic'], "{\"state\":\"OFF\"}")
        time.sleep(1)
        print("Send P2")
        if (gate_open_in_pin.value() == 1):
            client.publish(CONFIG['p2_topic'], "{\"state\":\"OFF\"}")
        else:
            client.publish(CONFIG['p2_topic'], "{\"state\":\"ON\"}")
        time.sleep(1)
        print("Check Subs")
        client.check_msg()
        time.sleep(1)
    except OSError as e:
        do_mqtt_connect(client)
        time.sleep(5)

machine.reset()


text:
package com.fleetmatics.chat.utils;

public class Constants {
    public static final String FIREBASE_URL = "https://generic-chat.firebaseio.com";
    public static final String SHARED_PREFS = "ChatPrefs";

    public static final String PARAM_ROOM_ID = "room_id";
    public static final String PARAM_ROOM_ID_REVERSE = "room_id_reverse";
    public static final String PARAM_CHAT_WITH_USR = "chat_with_user";
    public static final String MESSAGES = "messages";
    public static final String ROOMS = "rooms";
    public static final String USERS = "users";

    public static final String USERNAME = "username";
    public static final String USER_ID = "uid";

    public static final String ROOM_ID = "roomId";
}

redpajama_set_name: RedPajamaGithub


text:
  var analyser = null;
  var audioContext = null;
  var mediaStreamSource = null;
  var filter = null;
  var frequencyData = null;
  var timeIntervall = null;
  var tabMessage = [];
  var compteur = 0;
  var frequency = 0;

  var repeat = 0;

    // success callback when requesting audio input stream
  function gotStream(stream) {
      window.AudioContext = window.AudioContext || window.webkitAudioContext;
      audioContext = new AudioContext();
      console.log(audioContext.sampleRate);
      // Create an AudioNode from the stream.
      mediaStreamSource = audioContext.createMediaStreamSource( stream );

      //Create an high pass filter
      filter = audioContext.createBiquadFilter();
      filter.frequency.value = 17500.0;
      filter.type = "highpass";
      filter.Q = 10.0;

      mediaStreamSource.connect(filter)

      //Create an analyser
      analyser = audioContext.createAnalyser();
      analyser.fftSize=2048;
      analyser.minDecibels = -90;
      console.log(analyser.fftSize);
      console.log(analyser.frequencyBinCount);
      frequencyData = new Float32Array(analyser.frequencyBinCount);
      filter.connect(analyser);

      raf(update);
  }

  function errorStream(){
    alert('Something went wrong :/');
  }

  function update(){
    analyser.getFloatFrequencyData(frequencyData);
    var maxBin=frequencyData[0];
    var index=0;

    // Recherche du pic
    for(var i=0;i<frequencyData.length;i++){
      if(frequencyData[i]>maxBin && frequencyData[i]>-100){
        maxBin=frequencyData[i];
        index=i;
      }
      i++;

    }

    if (index!=0){
      var currentFrequency = ((audioContext.sampleRate / 2.) / frequencyData.length) * index;
      //console.log(Math.round(currentFrequency));
      if (currentFrequency>17500){
        console.log(String.fromCharCode(32 + Math.round(((currentFrequency-17959)/43.066))));
        if (frequency >= currentFrequency-5 || frequency <= currentFrequency+5){
          compteur++;
        }
        else{
          compteur = 0;
        }

        if (compteur>10){
          //console.log("valide :" + frequency);
          compteur = 0;
          changeImage(frequency);
        }

        frequency=currentFrequency;
        /*
        console.log(currentFrequency);
        tabMessage[tabMessage.length]=String.fromCharCode(32 + Math.round(((currentFrequency-17959)/43.066)));
        */
        //console.log(String.fromCharCode(32 + Math.round(((currentFrequency-17959)/43.066))));

      }
    }

    raf(update);
  }

  function raf(callback) {
    setTimeout(callback, 10);

  }

  function kill(){
    console.log("Arret de la boucle");
    clearInterval(timeIntervall);
  }

  //Fonction use to change the image in function of the received frequency
  function changeImage(freq){
    var indexFreq = Math.round((freq - 17959)/43);
    var img = document.getElementById("imageTest");

    switch(indexFreq){
      case 48:
        img.src="./img/fr.png";
        console.log("48");
      break;
      case 49:
        img.src="./img/al.png";
        console.log("49");
      break;
      case 50:
        img.src="./img/it.png";
        console.log("50");
      break;
      case 51:
        img.src="./img/sp.png";
        console.log("51");
      break;
      case 52:
        img.src="./img/uk.png";
        console.log("52");
      break;
      case 53:
        img.src="./img/yolo.png";
        console.log("53");
        document.getElementById("mp3").play();
        document.body.style.background = "pink";
      break;

    }

  }

  // Use only for DEBUG
  function info(){
    var arrayTemp = new Float32Array(1024);
    var arrayTemp2 = new Float32Array(2048);
    analyser.getFloatFrequencyData(arrayTemp);
    analyser.getFloatTimeDomainData(arrayTemp2);
    console.log("FrequencyDomain");
    for(var i=0;i<arrayTemp.length;i++){
      console.log(arrayTemp[i]);
    }
    console.log("TimeDomain");
    for(var i=0;i<arrayTemp2.length;i++){
      console.log(arrayTemp2[i]);
    }

  }

  navigator.getUserMedia = navigator.getUserMedia       ||
                          navigator.webkitGetUserMedia  ||
                          navigator.mozGetUserMedia     ||
                          navigator.msGetUserMedia;

  navigator.getUserMedia( {audio:true}, gotStream,errorStream);


text:
package fake

import (
	internalversion "github.com/openshift/origin/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion"
	restclient "k8s.io/kubernetes/pkg/client/restclient"
	core "k8s.io/kubernetes/pkg/client/testing/core"
)

type FakeSdn struct {
	*core.Fake
}

func (c *FakeSdn) ClusterNetworks(namespace string) internalversion.ClusterNetworkInterface {
	return &FakeClusterNetworks{c, namespace}
}

// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeSdn) RESTClient() restclient.Interface {
	var ret *restclient.RESTClient
	return ret
}


text:
package main

import (
	"github.com/gin-gonic/gin"
	"database/sql"
	"github.com/coopernurse/gorp"
	_ "github.com/mattn/go-sqlite3"
	"log"
	"time"
	"strconv"
)

type Article struct {
	Id int64 `db:"article_id"`
	Created int64
	Title string
	Content string
}

type Contact struct {
	Id int64 `db:"contact_id"`
	Created int64
	Name string
	Title string
	Company string
	Email string
	Message string
	Phone int64
}

type Login struct {
	Id int64 `db:"login_id"`
	Created int64
	Username string
	Password string
	Create bool
}

var dbmap = initDb()

func initDb() gorp.DbMap {
	db, err := sql.Open("sqlite3", "db.sqlite3")
	checkErr(err, "sql.Open faild")
	dbmap := gorp.DbMap{Db: db, Dialect: gorp.SqliteDialect{}}
	dbmap.AddTableWithName(Article{}, "articles").SetKeys(true, "Id")
	dbmap.AddTableWithName(Contact{}, "contacts").SetKeys(true, "Id")
	dbmap.AddTableWithName(Login{}, "logins").SetKeys(true, "Id")
	err = dbmap.CreateTablesIfNotExists()
	checkErr(err, "Create tables failed")
	return dbmap
}

func checkErr(err error, msg string) {
	if err != nil {
		log.Printf(msg, err)//.(*errors.Error).ErrorStack())
	}
}

func index (c *gin.Context) {
	content := gin.H{"Hello": "World"}
	c.JSON(200, content)
}

func ArticlesList(c *gin.Context) {
	var articles []Article
	_, err := dbmap.Select(&articles, "select * from articles order by article_id")
	checkErr(err, "Select failed")
	content := gin.H{"records": articles,}
	c.JSON(200, content)
}

func ArticlesDetail(c *gin.Context) {
	article_id := c.Params.ByName("id")
	a_id, _ := strconv.Atoi(article_id)
	article := getArticle(a_id)
	content := gin.H{"title": article.Title, "content": article.Content}
	c.JSON(200, content)
}

func ArticlePost(c *gin.Context) {
	var json Article

	c.Bind(&json)
	article := createArticle(json.Title, json.Content)
	if article.Title == json.Title {
		content := gin.H{
			"result": "Success",
			"title": article.Title,
			"content": article.Content,
		}
		c.JSON(201, content)
	} else {
		c.JSON(500, gin.H{"result": "An error occured"})
	}
}

func ArticlesDelete(c *gin.Context) {
	article_id := c.Params.ByName("id")
	a_id, _ := strconv.Atoi(article_id)
	_,err := dbmap.Exec("delete from articles where article_id=?", a_id)
	checkErr(err, "Deletion failed")
	c.JSON(200, gin.H{"result": "Deleted"})
}

func createArticle(title, body string) Article {
	article := Article{
		Created: time.Now().UnixNano(),
		Title: title,
		Content: body,
	}

	err := dbmap.Insert(&article)
	checkErr(err, "Insert failed")
	return article
}

func getArticle(article_id int) Article {
	article := Article{}
	err := dbmap.SelectOne(&article, "select * from articles where article_id=?", article_id)
	checkErr(err, "selectOne failed")
	return article
}

func ContactsList(c *gin.Context) {
	var contacts []Contact
	_, err := dbmap.Select(&contacts, "select * from contacts order by contact_id")
	checkErr(err, "Select Failed")
	content := gin.H{"records": contacts,}
	c.JSON(200, content)
}

func ContactPost(c *gin.Context) {
	var json Contact

	c.Bind(&json)
	contact := createContact(json.Name, json.Title, json.Company, json.Email, json.Message, json.Phone)
	if contact.Title == json.Title {
		content := gin.H{
			"result": "Success",
			"name": contact.Name,
			"title": contact.Title,
			"comapany": contact.Company,
			"email": contact.Email,
			"message": contact.Message,
			"phone": contact.Phone,
		}
		c.JSON(201, content)
	} else {
		c.JSON(500, gin.H{"result": "An error occured"})
	}
}

func ContactsDetail(c *gin.Context) {
	contact_id := c.Params.ByName("id")
	c_id, _ := strconv.Atoi(contact_id)
	contact := getContact(c_id)
	content := gin.H{
		"name": contact.Name,
		"title": contact.Title,
		"comapany": contact.Company,
		"email": contact.Email,
		"message": contact.Message,
		"phone": contact.Phone,
	}
	c.JSON(200, content)
}

func createContact(name, title, company, email, message string, phone int64) Contact {
	contact := Contact{
		Created: time.Now().UnixNano(),
		Name: name,
		Title: title,
		Company: company,
		Email: email,
		Message: message,
		Phone: phone,
	}

	err := dbmap.Insert(&contact)
	checkErr(err, "Insert Failed")
	return contact
}

func getContact(contact_id int) Contact {
	contact := Contact{}
	err := dbmap.SelectOne(&contact, "select * from contacts where contact_id=?", contact_id)
	checkErr(err, "SelectOne Failed")
	return contact
}

func LoginPost(c *gin.Context) {
	var json Login

	c.Bind(&json)
	if json.Create == true{
		createLogin(json.Username, json.Password)
	} else {
		login := checkLogin(json.Username, json.Password)
		if login == true {
			c.JSON(200, gin.H{"result": "success"})
			} else {
				c.JSON(500, gin.H{"result": "error"})
			}
		}
}

func checkLogin(username, password string) bool {
	auth := Login{}
	err := dbmap.SelectOne(&auth, "select * from logins where username=?", username)
	checkErr(err, "selectOne Failed")
	if password == auth.Password {
		return true
	} else {
		return false
	}
}

func createLogin(username, password string) Login {
	login := Login{
		Created: time.Now().UnixNano(),
		Username: username,
		Password: password,
	}

	err := dbmap.Insert(&login)
	checkErr(err, "Insert Failed")
	return login
}

func CORSMiddleware() gin.HandlerFunc {
	return func(c *gin.Context) {
		c.Writer.Header().Set("Content-Type", "application/json")
		c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
		c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
		c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept=Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-with")
		c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE")
		if c.Request.Method == "OPTIONS" {
			c.AbortWithStatus(204)
		} else {
			c.Next()
		}
	}
}

func main() {
	defer dbmap.Db.Close()

	app := gin.Default()
	app.Use(CORSMiddleware())
	app.GET("/", index)
	app.GET("/articles", ArticlesList)
	app.POST("/articles", ArticlePost)
	app.GET("/articles/:id", ArticlesDetail)
	app.DELETE("/articles/:id", ArticlesDelete)

	app.GET("/contacts", ContactsList)
	app.POST("/contacts", ContactPost)
	app.GET("/contacts/:id", ContactsDetail)

	app.POST("/login", LoginPost)

	app.Run(":8000")
}


text:
<!doctype html>

    <meta charset="utf-8">
    <title>CA TREE VIEW | Web Lab Common UI</title>

    <link rel="import" href="/bower_components/imd/imd.html">
    <link rel="import" href="/components/ca-treeview.html">

    <test-fixture id="treeview">
      <template>
        <ca-treeview></ca-treeview>
      </template>
    </test-fixture>


text:
import { Component } from '@angular/core';

import { PageContext } from '../models/page-context.model';
import { PageManager } from '../services/page-manager.service';

@Component({
    selector: 'icon-bar',
    styleUrls: ['./icon-bar.component.scss'],
    templateUrl: './icon-bar.component.html'
})
export class IconBarComponent {
    // FIXME: Get real data in here
    sideBarPages = [
        { title: 'Airplane', icon: 'fa fa-paper-plane', routeType: 'one', component: 'OneComponent', extern: 'January 1, 2014' },
        { title: 'Ca$h', icon: 'fa fa-dollar', routeType: 'two', component: 'TwoComponent', extern: 'Sure does!' },
        { title: 'Checklist', icon: 'fa fa-check-square', routeType: 'three', component: 'ThreeComponent', extern: 'works like a charm' },
        { title: 'Tags', icon: 'fa fa-tags', routeType: 'tags', component: '' },
        { title: 'Settings', icon: 'fa fa-cog', routeType: 'settings', component: '' },
        { title: 'Database', icon: 'fa fa-database', routeType: 'database', component: '' },
        { title: 'FAQ', icon: 'fa fa-question-circle', routeType: 'faq', component: '' },
        { title: 'Filter', icon: 'fa fa-filter', routeType: 'filter', component: '' },
        { title: 'Heart', icon: 'fa fa-heart', routeType: 'heart', component: '' },
        { title: 'Calculator', icon: 'fa fa-calculator', routeType: 'calculator', component: '' },
        { title: 'Ideas', icon: 'fa fa-lightbulb-o', routeType: 'ideas', component: '' },
        { title: 'Docs', icon: 'fa fa-folder-o', routeType: 'docs', component: '' },
        { title: 'Scheduler', icon: 'fa fa-calendar', routeType: 'scheduler', component: '' },
        { title: 'Security', icon: 'fa fa-key', routeType: 'security', component: '' },
        { title: 'UI', icon: 'fa fa-object-ungroup', routeType: 'ui', component: '' },
        { title: 'Privacy', icon: 'fa fa-eye', routeType: 'privacy', component: '' },
        { title: 'Stats', icon: 'fa fa-area-chart', routeType: 'stats', component: '' }
    ];

    constructor(private pageManager: PageManager) { }

    selectPage(pageData: any, idx: number) {
        // Copy instance of Page Context, select this new instance
        this.pageManager.selectPage(new PageContext(pageData));
    }
}


text:
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils;
using osu.Framework.Testing;

namespace osu.Framework.Tests.Visual
{
    public class TestCaseGridContainer : TestCase
    {
        private readonly GridContainer grid;

        public TestCaseGridContainer()
        {
            Add(new Container
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                RelativeSizeAxes = Axes.Both,
                Size = new Vector2(0.5f),
                Masking = true,
                BorderColour = Color4.White,
                BorderThickness = 2,
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Alpha = 0,
                        AlwaysPresent = true
                    },
                    grid = new GridContainer { RelativeSizeAxes = Axes.Both }
                }
            });

            AddStep("Blank grid", reset);
            AddStep("1-cell (auto)", () =>
            {
                reset();
                grid.Content = new[] { new Drawable[] { new FillBox() } };
            });

            AddStep("1-cell (absolute)", () =>
            {
                reset();
                grid.Content = new[] { new Drawable[] { new FillBox() } };
                grid.RowDimensions = grid.ColumnDimensions = new[] { new Dimension(GridSizeMode.Absolute, 100) };
            });

            AddStep("1-cell (relative)", () =>
            {
                reset();
                grid.Content = new [] { new Drawable[] { new FillBox() } };
                grid.RowDimensions = grid.ColumnDimensions = new[] { new Dimension(GridSizeMode.Relative, 0.5f) };
            });

            AddStep("1-cell (mixed)", () =>
            {
                reset();
                grid.Content = new [] { new Drawable[] { new FillBox() } };
                grid.RowDimensions = new[] { new Dimension(GridSizeMode.Absolute, 100) };
                grid.ColumnDimensions = new[] { new Dimension(GridSizeMode.Relative, 0.5f) };
            });

            AddStep("1-cell (mixed) 2", () =>
            {
                reset();
                grid.Content = new [] { new Drawable[] { new FillBox() } };
                grid.RowDimensions = new [] { new Dimension(GridSizeMode.Relative, 0.5f) };
            });

            AddStep("3-cell row (auto)", () =>
            {
                reset();
                grid.Content = new [] { new Drawable[] { new FillBox(), new FillBox(), new FillBox() } };
            });

            AddStep("3-cell row (absolute)", () =>
            {
                reset();
                grid.Content = new [] { new Drawable[] { new FillBox(), new FillBox(), new FillBox() } };
                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 50),
                    new Dimension(GridSizeMode.Absolute, 100),
                    new Dimension(GridSizeMode.Absolute, 150)
                };
            });

            AddStep("3-cell row (relative)", () =>
            {
                reset();
                grid.Content = new [] { new Drawable[] { new FillBox(), new FillBox(), new FillBox() } };
                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Relative, 0.1f),
                    new Dimension(GridSizeMode.Relative, 0.2f),
                    new Dimension(GridSizeMode.Relative, 0.3f)
                };
            });

            AddStep("3-cell row (mixed)", () =>
            {
                reset();
                grid.Content = new [] { new Drawable[] { new FillBox(), new FillBox(), new FillBox() } };
                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 50),
                    new Dimension(GridSizeMode.Relative, 0.2f)
                };
            });

            AddStep("3-cell column (auto)", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox() },
                    new Drawable[] { new FillBox() },
                    new Drawable[] { new FillBox() }
                };
            });

            AddStep("3-cell column (absolute)", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox() },
                    new Drawable[] { new FillBox() },
                    new Drawable[] { new FillBox() }
                };

                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 50),
                    new Dimension(GridSizeMode.Absolute, 100),
                    new Dimension(GridSizeMode.Absolute, 150)
                };
            });

            AddStep("3-cell column (relative)", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox() },
                    new Drawable[] { new FillBox() },
                    new Drawable[] { new FillBox() }
                };

                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Relative, 0.1f),
                    new Dimension(GridSizeMode.Relative, 0.2f),
                    new Dimension(GridSizeMode.Relative, 0.3f)
                };
            });

            AddStep("3-cell column (mixed)", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox() },
                    new Drawable[] { new FillBox() },
                    new Drawable[] { new FillBox() }
                };

                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 50),
                    new Dimension(GridSizeMode.Relative, 0.2f)
                };
            });

            AddStep("3x3-cell (auto)", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() }
                };
            });

            AddStep("3x3-cell (absolute)", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() }
                };

                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 50),
                    new Dimension(GridSizeMode.Absolute, 100),
                    new Dimension(GridSizeMode.Absolute, 150)
                };
            });

            AddStep("3x3-cell (relative)", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() }
                };

                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Relative, 0.1f),
                    new Dimension(GridSizeMode.Relative, 0.2f),
                    new Dimension(GridSizeMode.Relative, 0.3f)
                };
            });

            AddStep("3x3-cell (mixed)", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() }
                };

                grid.RowDimensions = grid.ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 50),
                    new Dimension(GridSizeMode.Relative, 0.2f)
                };
            });

            AddStep("Larger sides", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() }
                };

                grid.ColumnDimensions = grid.RowDimensions = new[]
                {
                    new Dimension(GridSizeMode.Relative, 0.4f),
                    new Dimension(),
                    new Dimension(GridSizeMode.Relative, 0.4f)
                };
            });

            AddStep("Separated", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox(), null, new FillBox() },
                    null,
                    new Drawable[] { new FillBox(), null, new FillBox() }
                };
            });

            AddStep("Separated 2", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new FillBox(), null, new FillBox(), null },
                    null,
                    new Drawable[] { new FillBox(), null, new FillBox(), null },
                    null
                };
            });

            AddStep("Nested grids", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[]
                    {
                        new FillBox(),
                        new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Content = new[]
                            {
                                new Drawable[] { new FillBox(), new FillBox() },
                                new Drawable[]
                                {
                                    new FillBox(),
                                    new GridContainer
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Content = new[]
                                        {
                                            new Drawable[] { new FillBox(), new FillBox() },
                                            new Drawable[] { new FillBox(), new FillBox() }
                                        }
                                    }
                                }
                            }
                        },
                        new FillBox()
                    }
                };
            });

            AddStep("Auto size", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[] { new Box { Size = new Vector2(30) }, new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() },
                    new Drawable[] { new FillBox(), new FillBox(), new FillBox() }
                };

                grid.RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Relative, 0.5f) };
                grid.ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Relative, 0.5f) };
            });

            AddStep("Autosizing child", () =>
            {
                reset();
                grid.Content = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Child = new Box { Size = new Vector2(100, 50) }
                        },
                        new FillBox()
                    }
                };

                grid.ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) };
            });
        }

        private void reset()
        {
            grid.ClearInternal();
            grid.RowDimensions = grid.ColumnDimensions = new Dimension[] { };
        }

        private class FillBox : Box
        {
            public FillBox()
            {
                RelativeSizeAxes = Axes.Both;
                Colour = new Color4(RNG.NextSingle(1), RNG.NextSingle(1), RNG.NextSingle(1), 1);
            }
        }
    }
}


text:
    <form ng-submit="updateQuery()">

                rel:
                <input type="text" ng-model="data.value.rel" ng-change="updateQuery()" ng-trim="false">

                val:
                <input type="text" ng-model="data.value.val" ng-change="updateQuery()" ng-trim="false">

                href:
                <input type="text" ng-model="data.value.href" ng-change="updateQuery()" ng-trim="false">

            <input type="checkbox" ng-model="usingFilter" ng-change="toggle()">
            Use SimpleSearch?

    </form>


text:
package com.google.appengine.tools.development.testing;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Used to configure a JUnit4 test that has been annotated with
 * {@code &#64RunWith(DevAppServerTestRunner.class}.
 *
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface DevAppServerTest {

  /**
   * @return A class that can provide the configuration of the dev appserver
   * that will be launched for the test.  This class must be public and have a
   * public, no-arg constructor.
   */
  Class<? extends DevAppServerTestConfig> value();
}


text:
<?xml version="1.0"?>
<!-- <!DOCTYPE sports-content SYSTEM "../specification/dtd/sportsml-core.dtd"> -->
<sports-content
	xmlns="http://iptc.org/std/SportsML/2006-10-18/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://iptc.org/std/SportsML/2006-10-18/ ../specification/schema/sportsml-loose.xsd"
	>
	<sports-metadata doc-id="d.1341431231533413"	date-time="20011016T182400" language="en-US"
						  fixture-key="event-score" fixture-source="iptc" fixture-name="Event Score">
		<sports-title>Scoreboard: Energis Open</sports-title>
		<sports-content-codes>
			<sports-content-code	code-type="sport"	code-key="15065000"	code-source="iptc" code-name="Tennis"/>
			<sports-content-code	code-type="special-event"	code-name="Energis Open"/>
		</sports-content-codes>
	</sports-metadata>
	<tournament>
		<tournament-metadata	tournament-name="Energis Open" start-date-time="20010716T000000" end-date-time="20010722T2359"
									site-city="Amsterdam" site-country="the Netherlands"/>
		<tournament-division>
			<tournament-division-metadata	division-name="Men's Singles">
				<sports-content-qualifier	gender="men"	participant-count="1"/>
					<award value="400000" currency="USD"/>
			</tournament-division-metadata>
			<tournament-round round-name="Quarterfinals">
				<sports-event>
					<event-metadata start-date-time="20010720T060000"/>
					<player>
						<player-metadata>
							<name full="Andrei Stoliarov"/>
							<home-location country="Russia"/>
						</player-metadata>
						<player-stats>
							<player-stats-tennis>
								<stats-tennis-set	set-number="1"	score="3"/>
								<stats-tennis-set	set-number="2"	score="5"/>
							</player-stats-tennis>
						</player-stats>
					</player>
					<player>
						<player-metadata>
							<name full="Alex Corretja"/>
							<home-location country="Spain"/>
						</player-metadata>
						<player-stats>
							<rank	date-coverage-type="tournament-seed" value="2"/>
							<player-stats-tennis>
								<stats-tennis-set	set-number="1"	score="6"/>
								<stats-tennis-set	set-number="2"	score="7"/>
							</player-stats-tennis>
						</player-stats>
					</player>
				</sports-event>
				<sports-event>
					<event-metadata start-date-time="20010720T080000"/>
					<player>
						<player-metadata>
							<name full="Olivier Rochus"/>
							<home-location country="Belgium"/>
						</player-metadata>
						<player-stats>
							<rank	date-coverage-type="tournament-seed" value="7"/>
							<player-stats-tennis>
								<stats-tennis-set	set-number="1"	score="2"/>
								<stats-tennis-set	set-number="2"	score="6"/>
								<stats-tennis-set	set-number="3"	score="1"/>
							</player-stats-tennis>
						</player-stats>
					</player>
					<player>
						<player-metadata>
							<name full="Sjeng Schalken"/>
							<home-location country="the Netherlands"/>
						</player-metadata>
						<player-stats>
							<rank	date-coverage-type="tournament-seed" value="3"/>
							<player-stats-tennis>
								<stats-tennis-set	set-number="1"	score="6"/>
								<stats-tennis-set	set-number="2"	score="2"/>
								<stats-tennis-set	set-number="3"	score="6"/>
							</player-stats-tennis>
						</player-stats>
					</player>
				</sports-event>
				<sports-event>
					<event-metadata start-date-time="20010720T100000"/>
					<player>
						<player-metadata>
							<name full="Alex Calatrava"/>
							<home-location country="Spain"/>
						</player-metadata>
						<player-stats>
							<rank	date-coverage-type="tournament-seed" value="4"/>
							<player-stats-tennis>
								<stats-tennis-set set-number="1"	score="7"/>
								<stats-tennis-set	set-number="2"	score="4"/>
								<stats-tennis-set	set-number="3"	score="4"/>
							</player-stats-tennis>
						</player-stats>
					</player>
					<player>
 						<player-metadata>
 							<name full="Magnus Gustafsson"/>
 							<home-location country="Sweden"/>
 						</player-metadata>
 						<player-stats>
 							<rank date-coverage-type="tournament-seed" value="6" />
 							<player-stats-tennis>
 								<stats-tennis-set set-number="1" score="5" />
 								<stats-tennis-set set-number="2" score="6" />
 								<stats-tennis-set set-number="3" score="6" />
 							</player-stats-tennis>
 						</player-stats>
 					</player>
 				</sports-event>
 				<sports-event>
 					<event-metadata start-date-time="20010720T120000" />
 					<player>
 						<player-metadata>
 							<name full="Juan Ignacio Chela"/>
 							<home-location country="Argentina"/>
 						</player-metadata>
 						<player-stats>
 							<rank date-coverage-type="tournament-seed" value="Q" />
 							<player-stats-tennis>
 								<stats-tennis-set set-number="1" score="6" score-tiebreaker="4" />
 								<stats-tennis-set set-number="2" score="6" />
 								<stats-tennis-set set-number="3" score="5" />
 							</player-stats-tennis>
 						</player-stats>
 					</player>
 					<player>
 						<player-metadata>
 							<name full="Younes El Aynaoui"/>
 							<home-location country="Morocco"/>
 						</player-metadata>
 						<player-stats>
 							<player-stats-tennis>
 								<stats-tennis-set set-number="1" score="7" score-tiebreaker="7" />
 								<stats-tennis-set set-number="2" score="4" />
 								<stats-tennis-set set-number="3" score="7" />
 							</player-stats-tennis>
 						</player-stats>
 					</player>
 				</sports-event>
 			</tournament-round>
 		</tournament-division>
 	</tournament>
</sports-content>


text:
@interface ViewCell : UITableViewCell

@property(nonatomic,strong) Video *video;

@end


text:
@implementation SPDebugLogger

- (id) init
{
    self = [super init];
    if (self != nil) {
        logFile = fopen("/SPUnitTests.log", "a");
    }
    return self;
}

- (void) dealloc
{
    fclose(logFile);
    [super dealloc];
}

- (void) write:(NSString*)message
{
    fprintf(logFile, "%s\n", [message cStringUsingEncoding:[NSString defaultCStringEncoding]]);
    fflush(logFile);
}

@end

#define STAssertHTTPOK(_REQ_) STAssertEquals([_REQ_ responseStatusCode], HTTPStatusOK, [_REQ_ responseString])

@implementation SPUnitTests

#if USE_APPLICATION_UNIT_TEST     // all code under test is in the iPhone Application

- (void) testAppDelegate {

    id yourApplicationDelegate = [[UIApplication sharedApplication] delegate];
    STAssertNotNil(yourApplicationDelegate, @"UIApplication failed to find the AppDelegate");

}

#else                           // all code under test must be linked into the Unit Test bundle

- (void) setUp
{
    [super setUp];

    SPServiceSettings* settings = [SPServiceSettings settings];

    [settings setSharedCredentials:[SPUnitTestCredentials testCredentials]];

    [settings setSharedRootUrl:[SPUnitTestCredentials testUrl]];

    [settings setSynchronousNetworkMode:YES];
    [settings setDebugMode:YES];

    [SPServiceFactory setServiceSettings:settings];

    log = [[[SPDebugLogger alloc] init] autorelease];
}

- (void) testList_GetListCollection
{
    SPList* list = [SPList list];

    [list getListCollection:^(SPSoapRequest* req){
        STAssertHTTPOK(req);

        //[log write:[req responseString]];

        __block int blockExecCount = 0;

        [req responseNodesForXPath:@"//sp:List" usingBlock:^(XPathResult* r) {
            STAssertNotNil(r, @"result should not be nil");
            //[log write:[NSString stringWithFormat:@"%@", r]];
            STAssertEqualObjects(r.name, @"List", @"name of element matched not list");
            STAssertEqualObjects(r.content, @"", @"content of list should be empty");

            STAssertNotNil(r.attributes, @"attribute dictionary should not be nil");
            //[log write:[NSString stringWithFormat:@"%@", r.attributes]];
            STAssertTrue((r.attributes.count != 0), @"attribute count should not be zero");

            ++blockExecCount;
        }];

        STAssertTrue(blockExecCount != 0, [NSString stringWithFormat:@"%d blocks executed", blockExecCount]);
    }];
}

- (void) testList_GetListByName
{
    SPList* list = [SPList list];

    [list getList:@"Calendar" handler:^(SPSoapRequest* req){
        STAssertHTTPOK(req);

        NSArray* results = [req responseNodesForXPath:@"//sp:List"];
        STAssertNotNil(results, @"results should not be nil");

        //[log write:[NSString stringWithFormat:@"%@", results]];

        STAssertEquals((int)results.count, (int)1, [NSString stringWithFormat:@"found %d", [results count]]);

        if (results.count > 0) {
            XPathResult* r = [results objectAtIndex:0];
            STAssertNotNil(r, @"first object in array should not be nil");

            NSArray* fields = [req responseNodesForXPath:@"//sp:Field"];
            STAssertNotNil(fields, @"fields results should not be nil");
            STAssertEquals((int)fields.count, (int)103, [NSString stringWithFormat:@"found %d", [fields count]]);

            STAssertNotNil(r.attributes, @"attribute dictionary should not be nil");
            //[log write:[NSString stringWithFormat:@"%@", r.attributes]];
            STAssertTrue((r.attributes.count != 0), @"attribute count should not be zero");

            NSString* listId = [r.attributes objectForKey:@"ID"];

            [list getListItems:listId
                      viewName:@""
                         query:@"<Query></Query>"
                    viewFields:@"<ViewFields></ViewFields>"
                      rowLimit:@"0"
                  queryOptions:@"<QueryOptions><ExpandRecurrences>TRUE</ExpandRecurrences></QueryOptions>"
                         webID:@""
                       handler:^(SPSoapRequest* getListItemReq)
            {
                STAssertHTTPOK(getListItemReq);

                //[log write:[getListItemReq responseString]];

                __block int rowCount = 0;
                [getListItemReq responseNodesForXPath:@"//z:row" usingBlock:^(XPathResult *r)
                {
                    STAssertNotNil(r, @"result should not be nil");

                    NSString* eventName = [getListItemReq responseNodeContentForXPath:[r.xpath stringByAppendingString:@"/@ows_Title"]];
                    STAssertNotNil(eventName, @"title should not be nil");

                    NSString* startDate = [getListItemReq responseNodeContentForXPath:[r.xpath stringByAppendingString:@"/@ows_EventDate"]];
                    STAssertNotNil(startDate, @"event date should not be nil");

                    NSString* endDate = [getListItemReq responseNodeContentForXPath:[r.xpath stringByAppendingString:@"/@ows_EndDate"]];
                    STAssertNotNil(endDate, @"end date should not be nil");

                    NSString* location = [getListItemReq responseNodeContentForXPath:[r.xpath stringByAppendingString:@"/@ows_Location"]];
                    if (location != nil) {
                        NSUInteger strlen = [location length];
                        STAssertTrue(strlen != 0, @"if there is a location, it shouldn't be an empty string");
                    }

                    NSString* isAllDay = [getListItemReq responseNodeContentForXPath:[r.xpath stringByAppendingString:@"/@ows_fAllDayEvent"]];
                    STAssertNotNil(isAllDay, @"is all day should not be nil");
                    STAssertTrue((([isAllDay isEqualToString:@"0"]) || ([isAllDay isEqualToString:@"1"])), @"'all day' flag should be 0 or 1");

                    //[log write:[NSString stringWithFormat:@"title: %@ start: %@ end: %@", eventName, startDate, endDate]];

                    ++rowCount;
                }];
                //STAssertTrue(rowCount != 0, @"should have found some rows");
            }];
        }
    }];
}

- (void) testList_GetListByName2
{
    SPList* list = [SPList list];

    [list getList:@"Contacts" handler:^(SPSoapRequest* req){
        STAssertHTTPOK(req);

        NSArray* results = [req responseNodesForXPath:@"//sp:List"];
        STAssertNotNil(results, @"results should not be nil");

        //[log write:[NSString stringWithFormat:@"%@", results]];

        STAssertEquals((int)results.count, (int)1, [NSString stringWithFormat:@"found %d", [results count]]);

        if (results.count > 0) {
            XPathResult* r = [results objectAtIndex:0];
            STAssertNotNil(r, @"first object in array should not be nil");

            NSArray* fields = [req responseNodesForXPath:@"//sp:Field"];
            STAssertNotNil(fields, @"fields results should not be nil");
            STAssertEquals((int)fields.count, (int)99, [NSString stringWithFormat:@"found %d", [fields count]]);

            STAssertNotNil(r.attributes, @"attribute dictionary should not be nil");
            //[log write:[NSString stringWithFormat:@"%@", r.attributes]];
            STAssertTrue((r.attributes.count != 0), @"attribute count should not be zero");

            NSString* listId = [r.attributes objectForKey:@"ID"];

            [list getListItems:listId
                      viewName:@""
                         query:@"<Query></Query>"
                    viewFields:@"<ViewFields></ViewFields>"
                      rowLimit:@"0"
                  queryOptions:@"<QueryOptions></QueryOptions>"
                         webID:@""
                       handler:^(SPSoapRequest* getListItemReq)
            {
                STAssertHTTPOK(getListItemReq);

                //[log write:[getListItemReq responseString]];

                __block int rowCount = 0;
                [getListItemReq responseNodesForXPath:@"//z:row" usingBlock:^(XPathResult *r)
                {
                     ++rowCount;
                }];
                STAssertTrue(rowCount != 0, @"should have found some rows");
            }];
        }
    }];
}

- (void) testSiteData_EnumerateFolder
{
    SPSiteData* siteData = [SPSiteData siteData];

    [siteData enumerateFolder:[[SPUnitTestCredentials testUrl] stringByAppendingString:@"/Shared%20Documents"]
                  withHandler:^(SPSoapRequest* enumFolderReq)
    {
        STAssertHTTPOK(enumFolderReq);

        //[log write:enumFolderReq.responseString];
    }];
}

- (void) testSiteData_GetSiteAndWeb
{
    SPSiteData* siteData = [SPSiteData siteData];

    [siteData getSiteAndWeb:[SPUnitTestCredentials testUrl]
                withHandler:^(SPSoapRequest* getSiteAndWebReq)
    {
        STAssertHTTPOK(getSiteAndWebReq);
    }];
}

- (void) testSiteData_GetSite
{
    SPSiteData* siteData = [SPSiteData siteData];

    [siteData getSite:^(SPSoapRequest* getSiteReq)
    {
        STAssertHTTPOK(getSiteReq);
    }];
}

- (void) testSiteData_GetWeb
{
    SPSiteData* siteData = [SPSiteData siteData];

    [siteData getWeb:^(SPSoapRequest *getWebReq)
    {
        STAssertHTTPOK(getWebReq);

        __block int urlCount = 0;
        [getWebReq responseNodesForXPath:@"//sp:Url"
                              usingBlock:^(XPathResult *r) {
                                  STAssertNotNil(r.content, @"content should not be nil");
                                  ++urlCount;
                              }];

        STAssertTrue(urlCount != 0, @"url count should not be zero");
    }];
}

- (void) testSiteData_GetListItems
{
    SPSiteData* siteData = [SPSiteData siteData];

    [siteData getWeb:^(SPSoapRequest *getWebReq)
    {
        STAssertHTTPOK(getWebReq);

        [getWebReq responseNodesForXPath:@"//sp:InternalName" usingBlock:^(XPathResult *r) {
            NSString* listId = r.content;

            STAssertNotNil(listId, @"list id should not be nil");

            //[log write:listId];

            [siteData getListItems:listId
                             query:@""
                        viewFields:@""
                          rowLimit:@"0"
                           handler:^(SPSoapRequest* listItemReq)
            {
                STAssertHTTPOK(listItemReq);

                //[log write:listItemReq.responseString];
            }];

        }];

    }];
}

//- (void) tearDown
//{
//    [super tearDown];
//}

#endif

@end


text:
package types

import "strings"

// ArchiveShareKey アーカイブ共有キー
type ArchiveShareKey string

// ArchiveShareKeyDelimiter アーカイブ共有キーのデリミタ
const ArchiveShareKeyDelimiter = ":"

// String ArchiveShareKey全体を表す文字列
func (key ArchiveShareKey) String() string {
	return string(key)
}

// Zone キーに含まれるゾーン名
func (key ArchiveShareKey) Zone() string {
	tokens := key.tokens()
	if len(tokens) > 0 {
		return tokens[0]
	}
	return ""
}

// SourceArchiveID 共有元となるアーカイブのID
func (key ArchiveShareKey) SourceArchiveID() ID {
	tokens := key.tokens()
	if len(tokens) > 1 {
		return StringID(tokens[1])
	}
	return ID(0)
}

// Token 認証キー本体
func (key ArchiveShareKey) Token() string {
	tokens := key.tokens()
	if len(tokens) > 2 {
		return tokens[2]
	}
	return ""
}

// ValidFormat 有効なキーフォーマットか
func (key ArchiveShareKey) ValidFormat() bool {
	return len(key.tokens()) == 3
}

func (key ArchiveShareKey) tokens() []string {
	return strings.Split(key.String(), ArchiveShareKeyDelimiter)
}


text:
extern VALUE cLiquidCVariableExpression;

typedef struct variable_parse_args {
    const char *markup;
    const char *markup_end;
    vm_assembler_t *code;
    VALUE code_obj;
    VALUE parse_context;
} variable_parse_args_t;

void liquid_define_variable(void);
void internal_variable_compile(variable_parse_args_t *parse_args, unsigned int line_number);
void internal_variable_compile_evaluate(variable_parse_args_t *parse_args);
VALUE internal_variable_expression_evaluate(expression_t *expression, VALUE context);

#endif


text:
class IssuesController < ApplicationController
  before_action -> { @user = User.find(current_user.id) }
  before_action -> { @issues = Issue.where_exists(Member.where(user_id: @user.id).where("issues.project_id = members.project_id")) }
  before_action -> { issue_stat }

  def dashboard
    @issues = @issues_unhandled

    @q = @issues.ransack(params[:q])
    @issues = @q.result.page(params[:page])
  end

  def created
    @issues_created = @issues.where(creator: @user.members).where(archived_at: nil)
    @issues = @issues_created

    @q = @issues.ransack(params[:q])
    @issues = @q.result.page(params[:page])
  end

  def focused
    @issues_focused = @issues.where_exists(@user.subscriptions.where_table(:issue)).where(archived_at: nil)
    @issues = @issues_focused

    @q = @issues.ransack(params[:q])
    @issues = @q.result.page(params[:page])
  end

  def assigned
    @issues_assigned_to_me = @issues.where(assignee: @user.members).where(archived_at: nil)
    @issues = @issues_assigned_to_me

    @q = @issues.ransack(params[:q])
    @issues = @q.result.page(params[:page])
  end

  def archived
    @issues_archived = @issues.where(creator: @user.members)
                      .or(@issues.where_exists(@user.subscriptions.where_table(:issue)))
                      .or(@issues.where(assignee: @user.members))
                      .where.not(archived_at: nil)
    @issues = @issues_archived

    @q = @issues.ransack(params[:q])
    @issues = @q.result.page(params[:page])
  end

  def new
    @issue = Issue.new
  end

  def create
    @project = @user.projects.find(issue_params[:project_id])
    redirect_to [:new, @project, :issue]
  end

  def issue_params
    params.fetch(:issue, {}).permit(:project_id)
  end

protected
  def issue_stat
    @issues_scope = Issue.joins(:creator).where(archived_at: nil).joins(:project).merge(Project.available)
    conds = []
    conds << Issue.joins(:creator).where(creator: { user_id: @user.id }, state: [ :waiting, :resolved, :closed ])
    conds << Issue.where_exists(Member.where(user_id: @user.id).where("members.id = issues.assignee_id")).where(state: [ :confirmed, :processing ])
    conds << Issue.where_exists(Member.where(role: ["owner", "manager"], user_id: @user.id).where("members.project_id = issues.project_id")).where_any_of(
      Issue.where({ state: :confirmed, assignee_id: nil }),
      Issue.where({ state: [ :pending, :processed, :deploying ] })
    )

    @issues_unhandled = @issues_scope.where_any_of(*conds)
    @issues_counts = { unhandled: @issues_unhandled.count }
  end
end


text:
import Enum from 'ringcentral-integration/lib/Enum';
import baseActionTypes from '../../lib/OAuthBase/baseActionTypes';

export default new Enum([
  ...Object.keys(baseActionTypes),
  'setupProxy',
  'proxyRetry',
], 'proxyFrameOAuth');


text:
from distutils.core import setup, Extension
import sys

long_description = None

if 'upload' in sys.argv:
    with open('README.rst') as readme:
        long_description = readme.read()

setup(
    name='cnamedtuple',
    version='0.1.6',
    description='collections.namedtuple implemented in c.',
    author='Joe Jevnik',
    author_email='joe@quantopian.com',
    packages=[
        'cnamedtuple',
    ],
    long_description=long_description,
    license='Apache 2.0',
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Apache Software License',
        'Natural Language :: English',
        'Programming Language :: Python :: 3 :: Only',
        'Programming Language :: Python :: Implementation :: CPython',
        'Operating System :: OS Independent',
        'Topic :: Utilities',
    ],
    url="https://github.com/llllllllll/cnamedtuple",
    ext_modules=[
        Extension(
            'cnamedtuple._namedtuple',
            ['cnamedtuple/_namedtuple.c'],
            extra_compile_args=[
                '-Wall',
                '-Wextra',
                '-Wno-unused-parameter',
                '-Wno-missing-field-initializers',
            ],
        ),
    ],
)


text:
int main(int argc, char ** argv) {
    TexturalAnalysis::Image image(100, 100);

    TexturalAnalysis::Haralick4::apply(image);

    return 0;
}


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

import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;

import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * Tests for Fingerprint.
 */
@RunWith(JUnit4.class)
public class FingerprintTest {

  private static void assertFingerprintsDiffer(List<String> list1, List<String>list2) {
    Fingerprint f1 = new Fingerprint();
    Fingerprint f1Latin1 = new Fingerprint();
    for (String s : list1) {
      f1.addString(s);
      f1Latin1.addString(s);
    }
    Fingerprint f2 = new Fingerprint();
    Fingerprint f2Latin1 = new Fingerprint();
    for (String s : list2) {
      f2.addString(s);
      f2Latin1.addString(s);
    }
    assertThat(f1.hexDigestAndReset()).isNotEqualTo(f2.hexDigestAndReset());
    assertThat(f1Latin1.hexDigestAndReset()).isNotEqualTo(f2Latin1.hexDigestAndReset());
  }

  // You can validate the md5 of the simple string against
  // echo -n 'Hello World!'| md5sum
  @Test
  public void bytesFingerprint() {
    assertThat(new Fingerprint().addBytes("Hello World!".getBytes(UTF_8)).hexDigestAndReset())
        .isEqualTo("ed076287532e86365e841e92bfc50d8c");
    assertThat(Fingerprint.md5Digest("Hello World!"))
        .isEqualTo("ed076287532e86365e841e92bfc50d8c");
  }

  @Test
  public void otherStringFingerprint() {
    assertFingerprintsDiffer(ImmutableList.of("Hello World!"),
                             ImmutableList.of("Goodbye World."));
  }

  @Test
  public void multipleUpdatesDiffer() throws Exception {
    assertFingerprintsDiffer(ImmutableList.of("Hello ", "World!"),
                             ImmutableList.of("Hello World!"));
  }

  @Test
  public void multipleUpdatesShiftedDiffer() throws Exception {
    assertFingerprintsDiffer(ImmutableList.of("Hello ", "World!"),
                             ImmutableList.of("Hello", " World!"));
  }

  @Test
  public void listFingerprintNotSameAsIndividualElements() throws Exception {
    Fingerprint f1 = new Fingerprint();
    f1.addString("Hello ");
    f1.addString("World!");
    Fingerprint f2 = new Fingerprint();
    f2.addStrings(ImmutableList.of("Hello ", "World!"));
    assertThat(f1.hexDigestAndReset()).isNotEqualTo(f2.hexDigestAndReset());
  }

  @Test
  public void mapFingerprintNotSameAsIndividualElements() throws Exception {
    Fingerprint f1 = new Fingerprint();
    Map<String, String> map = new HashMap<>();
    map.put("Hello ", "World!");
    f1.addStringMap(map);
    Fingerprint f2 = new Fingerprint();
    f2.addStrings(ImmutableList.of("Hello ", "World!"));
    assertThat(f1.hexDigestAndReset()).isNotEqualTo(f2.hexDigestAndReset());
  }

  @Test
  public void addBoolean() throws Exception {
    String f1 = new Fingerprint().addBoolean(true).hexDigestAndReset();
    String f2 = new Fingerprint().addBoolean(false).hexDigestAndReset();
    String f3 = new Fingerprint().addBoolean(true).hexDigestAndReset();

    assertThat(f1).isEqualTo(f3);
    assertThat(f1).isNotEqualTo(f2);
  }

  @Test
  public void addPath() throws Exception {
    PathFragment pf = new PathFragment("/etc/pwd");
    assertThat(new Fingerprint().addPath(pf).hexDigestAndReset())
        .isEqualTo("63ab5c47c117635407a1af6377e216bc");
    Path p = new InMemoryFileSystem(BlazeClock.instance()).getPath(pf);
    assertThat(new Fingerprint().addPath(p).hexDigestAndReset())
        .isEqualTo("63ab5c47c117635407a1af6377e216bc");
  }

  @Test
  public void addNullableBoolean() throws Exception {
    String f1 = new Fingerprint().addNullableBoolean(null).hexDigestAndReset();
    assertThat(f1).isEqualTo(new Fingerprint().addNullableBoolean(null).hexDigestAndReset());
    assertThat(f1).isNotEqualTo(new Fingerprint().addNullableBoolean(false).hexDigestAndReset());
    assertThat(f1).isNotEqualTo(new Fingerprint().addNullableBoolean(true).hexDigestAndReset());
  }

  @Test
  public void addNullableInteger() throws Exception {
    String f1 = new Fingerprint().addNullableInt(null).hexDigestAndReset();
    assertThat(f1).isEqualTo(new Fingerprint().addNullableInt(null).hexDigestAndReset());
    assertThat(f1).isNotEqualTo(new Fingerprint().addNullableInt(0).hexDigestAndReset());
    assertThat(f1).isNotEqualTo(new Fingerprint().addNullableInt(1).hexDigestAndReset());
  }

  @Test
  public void addNullableString() throws Exception {
    String f1 = new Fingerprint().addNullableString(null).hexDigestAndReset();
    assertThat(f1).isEqualTo(new Fingerprint().addNullableString(null).hexDigestAndReset());
    assertThat(f1).isNotEqualTo(new Fingerprint().addNullableString("").hexDigestAndReset());
  }

  @Test
  public void testReusableAfterReset() throws Exception {
    Fingerprint fp = new Fingerprint();
    String f1 = convolutedFingerprintAndReset(fp);
    String f2 = convolutedFingerprintAndReset(fp);
    assertThat(f1).isEqualTo(f2);
  }

  private static String convolutedFingerprintAndReset(Fingerprint fingerprint) {
    return fingerprint
        .addBoolean(false)
        .addBytes(new byte[10])
        .addBytes(new byte[10], 0, 5)
        .addInt(20)
        .addLong(30)
        .addNullableBoolean(null)
        .addNullableInt(null)
        .addNullableString(null)
        .addPath(new PathFragment("/foo/bar"))
        .addPaths(ImmutableList.of(new PathFragment("/foo/bar")))
        .addString("baz")
        .addUUID(UUID.fromString("12345678-1234-1234-1234-1234567890ab"))
        .hexDigestAndReset();
  }
}


text:
using System.Management.Automation;
using Docker.DotNet.Models;
using System.Threading.Tasks;

namespace Docker.PowerShell.Cmdlets
{
    [Cmdlet(VerbsCommon.Add, "ContainerImageTag",
            DefaultParameterSetName = CommonParameterSetNames.Default)]
    [Alias("Tag-ContainerImage")]
    public class AddContainerImageTag : ImageOperationCmdlet
    {
        #region Parameters

        [Parameter]
        public SwitchParameter Force { get; set; }

        [Parameter(Position = 1,
                   Mandatory = true)]
        [ValidateNotNullOrEmpty]
        public string Repository { get; set; }

        [Parameter(Position = 2)]
        [ValidateNotNullOrEmpty]
        public string Tag { get; set; }

        #endregion

        #region Overrides

        protected override async Task ProcessRecordAsync()
        {
            foreach (var id in ParameterResolvers.GetImageIds(Image, ImageIdOrName))
            {
                var tagParams = new ImageTagParameters(){ RepositoryName = Repository };

                if (!string.IsNullOrEmpty(Tag))
                {
                    tagParams.Tag = Tag;
                }

                if (Force)
                {
                    tagParams.Force = true;
                }

                await DkrClient.Images.TagImageAsync(id, tagParams);
            }
        }

        #endregion
    }
}


text:
package org.mengyun.tcctransaction;

/**
 * Created  on 7/21/16.
 */
public class OptimisticLockException extends RuntimeException {
    private static final long serialVersionUID = -4250747002159020605L;
}


text:
package com.car.service.eventcontroller;

import android.app.Activity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.car.service.R;
import com.car.service.model.CarServiceApplication;
import com.car.service.model.PreferenceEditor;
import com.car.service.widget.wheel.WheelView;
import com.car.service.widget.wheel.adapter.ArrayWheelAdapter;
import com.car.service.widget.wheel.listener.OnWheelChangedListener;
import com.car.service.widget.wheel.listener.OnWheelScrollListener;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by r.savuschuk on 11/17/2014.
 */
public class WeightController extends EventController {

	private final String kg_unit_tx[] = new String[] {"  kg  "};
	private final String g_unit_tx[] = new String[] {"  g  "};
	private String rezultValue_kg = "";
	private String rezultValue_g = "";
	private boolean unit = true;//british by default
	private String kg_values[];// = new String[15];
	private String g_values[];// = new String[SIZE];
	private final int SIZE = 20;
	PreferenceEditor prefEditor;
	TextView quantity_label;

	public WeightController(Activity activity, RelativeLayout titleLayout, LinearLayout commentLayout, LinearLayout wheelLayout) {
		super(activity, titleLayout, commentLayout);
		prefEditor = CarServiceApplication.getPrefEditor();
		unit = prefEditor.getMeasureUnit();

		if (unit) {
			kg_unit_tx[0] = "  lb  ";
			g_unit_tx[0] = "  oz  ";
		} else {
			kg_unit_tx[0] = "  kg  ";
			g_unit_tx[0] = "  g  ";
		}

		valuesInit();
		initWheels(wheelLayout);
		title.setText(activity.getResources().getString(R.string.child_weight));
		titleImage.setImageResource(R.drawable.weight_dialogtitle);
		quantity_label = (TextView) wheelLayout.findViewById(R.id.quantity_view);
		quantity_label.setText(R.string.measure);
	}

	void initWheels(View v) {
		initValueWheel(v, R.id.wheel_kg_value, kg_values);
		updateValues(initTextWheel(v, R.id.wheel_kg_text), kg_unit_tx, 0);
		initValueWheel(v, R.id.wheel_g_value, g_values);
		updateValues(initTextWheel(v, R.id.wheel_g_text), g_unit_tx, 0);
	}

	/**
	 * Updates  wheels
	 */
	private void updateValues(WheelView v, String values[], int index) {
		ArrayWheelAdapter<String> adapter = new ArrayWheelAdapter<String>(activity, values);
		adapter.setTextSize(18);
		v.setViewAdapter(adapter);
		v.setCurrentItem(index);
		switch (v.getId()) {
			case R.id.wheel_kg_value:
				//if (index != 0) {
				if (unit) {
					rezultValue_kg = values[index] + "lb";
				} else {
					rezultValue_kg = values[index] + "kg";
				}
				/*} else {
					rezultValue_kg = "0";
				}*/
				break;
			case R.id.wheel_g_value:
				//if (index != 0) {
				if (unit) {
					rezultValue_g = values[index] + "oz";
				} else {
					rezultValue_g = values[index] + "g";
				}
				/*} else {
					rezultValue_g = "0";
				}*/
				break;
		}
	}

	/**
	 * Init value  wheels
	 */
	private void initValueWheel(View v, int id, final String[] values) {
		WheelView wheel = (WheelView) v.findViewById(id);
		wheel.setVisibleItems(5);
		wheel.setCurrentItem(1);
		wheel.setCyclic(true);

		updateValues(wheel, values, 1);
		wheel.addChangingListener(new OnWheelChangedListener() {
			public void onChanged(WheelView wheel, int oldValue, int newValue) {
				if (!isScrolling()) {
					updateValues(wheel, values, newValue);
				}
			}
		});
		wheel.addScrollingListener(new OnWheelScrollListener() {
			public void onScrollingStarted(WheelView wheel) {
				setScrolling(true);
			}

			public void onScrollingFinished(WheelView wheel) {
				setScrolling(false);
				updateValues(wheel, values, wheel.getCurrentItem());
			}
		});
	}

	/**
	 * Init text wheels
	 */
	private WheelView initTextWheel(View v, int id) {
		WheelView wheel_kg_v = (WheelView) v.findViewById(id);
		wheel_kg_v.setVisibleItems(5);
		wheel_kg_v.setCurrentItem(0);
		return wheel_kg_v;
	}

	/**
	 * Init wheels values arrays
	 */
	private void valuesInit() {
		int firstWheelSize = 0;
		int thirdWheelSize = 0;
		int mult = 0;
		if (unit) {
			firstWheelSize = 30;//for british
			thirdWheelSize = 16;//1 lb=16 oz
			mult = 1;
		} else {
			firstWheelSize = 15;//for metric
			thirdWheelSize = SIZE;
			mult = 50;
		}
		kg_values = new String[firstWheelSize];
		g_values = new String[thirdWheelSize];
		for (int i = 0; i < firstWheelSize; i++) {
			kg_values[i] = "  " + i + "  ";
		}
		for (int i = 0; i < thirdWheelSize; i++) {
			g_values[i] = "  " + i * mult + "  ";
		}
	}

	private String getWeightSum() {
		return rezultValue_kg.concat(rezultValue_g);
	}

	@Override
	public boolean saveEventToDb() {
		boolean ret = false;
		final String sum = getWeightSum();
		String re1 = "(\\d+)";    // Integer Number 1
		String re2 = ".*?";    // Non-greedy match on filler
		String re3 = "(\\d+)";    // Integer Number 2

		Pattern p = Pattern.compile(re1 + re2 + re3, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
		Matcher m = p.matcher(sum);
		if (m.find()) {

			if (m.group(1).equals("0") && m.group(2).equals("0")) {
				Toast.makeText(activity, activity.getResources().getString(R.string.set_weight_msg), Toast.LENGTH_SHORT).show();
				ret = false;
			} else {
				/*engine.dbWriteRequest(DbEngine.Action.WEIGHT, sum, " " + comment.getText().toString(), new DbEngine.Callback<Long>() {
					@Override
					public void onSuccess(final Long data) {
						WLog.e("DbEngine", " OnSuccess");
					}

					@Override
					public void onFail(final DbError error) {
						WLog.e("DbEngine", " OnFail");
						Toast.makeText(activity, "Database error", Toast.LENGTH_SHORT).show();
					}
				});*/
				ret = true;
			}
		}
		return ret;
	}
}


text:
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Plig.TimeSeries.Client
{
    static class Program
    {
        public static int CurrentProjectID;
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}


text:
package java.text;

/**
 * CharacterIterator is used to sequence over a group of characters. The
 * iteration starts at the begin index in the group of character and continues
 * to one index before the end index.
 */
public interface CharacterIterator extends Cloneable {

    /**
     * A constant which indicates there is no character.
     */
    public static final char DONE = '\uffff';

    /**
     * Answers a new CharacterIterator with the same properties.
     *
     * @return a shallow copy of this CharacterIterator
     *
     * @see java.lang.Cloneable
     */
    public Object clone();

    /**
     * Answers the character at the current index.
     *
     * @return the current character, or DONE if the current index is past the
     *         end
     */
    public char current();

    /**
     * Sets the current position to the begin index and answers the character at
     * the begin index.
     *
     * @return the character at the begin index
     */
    public char first();

    /**
     * Answers the begin index.
     *
     * @return the index of the first character to iterate
     */
    public int getBeginIndex();

    /**
     * Answers the end index.
     *
     * @return the index one past the last character to iterate
     */
    public int getEndIndex();

    /**
     * Answers the current index.
     *
     * @return the current index
     */
    public int getIndex();

    /**
     * Sets the current position to the end index - 1 and answers the character
     * at the current position.
     *
     * @return the character before the end index
     */
    public char last();

    /**
     * Increments the current index and returns the character at the new index.
     *
     * @return the character at the next index, or DONE if the next index is
     *         past the end
     */
    public char next();

    /**
     * Decrements the current index and returns the character at the new index.
     *
     * @return the character at the previous index, or DONE if the previous
     *         index is past the beginning
     */
    public char previous();

    /**
     * Sets the current index.
     *
     * @return the character at the new index, or DONE if the index is past the
     *         end
     *
     * @exception IllegalArgumentException
     *                when the new index is less than the begin index or greater
     *                than the end index
     */
    public char setIndex(int location);
}


text:
package com.seafile.seadroid2;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import com.seafile.seadroid2.account.Account;
import com.seafile.seadroid2.account.AccountManager;
import com.seafile.seadroid2.data.DatabaseHelper;
import com.seafile.seadroid2.util.Utils;
import com.seafile.seadroid2.gesturelock.LockPatternUtils;

/**
 * Access the app settings
 */
public final class SettingsManager {
    private static final String DEBUG_TAG = "SettingsManager";

    // Global variables
    private SharedPreferences sharedPref = SeadroidApplication.getAppContext()
            .getSharedPreferences(AccountManager.SHARED_PREF_NAME, Context.MODE_PRIVATE);

    private SharedPreferences.Editor editor = sharedPref.edit();
    private static SettingsManager instance;

    private SettingsManager() {
    }

    private SharedPreferences settingsSharedPref = PreferenceManager
            .getDefaultSharedPreferences(SeadroidApplication.getAppContext());

    // Account
    public static final String SETTINGS_ACCOUNT_INFO_KEY = "account_info_user_key";
    public static final String SETTINGS_ACCOUNT_SPACE_KEY = "account_info_space_key";
    public static final String SETTINGS_ACCOUNT_SIGN_OUT_KEY = "account_sign_out_key";

    // Gesture Lock
    public static final String GESTURE_LOCK_SWITCH_KEY = "gesture_lock_switch_key";
    public static final String GESTURE_LOCK_KEY = "gesture_lock_key";
    public static final int GESTURE_LOCK_REQUEST = 1;

    // Camera upload
    public static final String PKG = "com.seafile.seadroid2";
    public static final String SHARED_PREF_CAMERA_UPLOAD_REPO_ID = PKG + ".camera.repoid";
    public static final String SHARED_PREF_CAMERA_UPLOAD_REPO_NAME = PKG + ".camera.repoName";
    public static final String SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_EMAIL = PKG + ".camera.account.email";
    public static final String SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_SERVER = PKG + ".camera.account.server";
    public static final String SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_TOKEN = PKG + ".camera.account.token";
    public static final String CAMERA_UPLOAD_SWITCH_KEY = "camera_upload_switch_key";
    public static final String CAMERA_UPLOAD_REPO_KEY = "camera_upload_repo_key";
    public static final String CAMERA_UPLOAD_ADVANCED_SCREEN_KEY = "screen_camera_upload_advanced_feature";
    public static final String CAMERA_UPLOAD_ADVANCED_CATEGORY_KEY = "category_camera_upload_advanced_key";
    public static final String CAMERA_UPLOAD_ALLOW_DATA_PLAN_SWITCH_KEY = "allow_data_plan_switch_key";
    public static final String CAMERA_UPLOAD_ALLOW_VIDEOS_SWITCH_KEY = "allow_videos_upload_switch_key";
    public static final String CAMERA_UPLOAD_DIRECTORY_KEY = "camera_upload_directory_key";
    public static final String CAMERA_UPLOAD_CATEGORY_KEY = "category_camera_upload_key";
    public static final String CAMERA_UPLOAD_CUSTOM_DIRECTORIES_KEY = "camera_upload_directory_switch_key";
    public static final String CAMERA_UPLOAD_CUSTOM_DIRECTORIES_PATH = "camera_upload_directory_path";
    public static final int CHOOSE_CAMERA_UPLOAD_REQUEST = 2;

    // About tab
    public static final String SETTINGS_ABOUT_VERSION_KEY = "settings_about_version_key";
    public static final String SETTINGS_ABOUT_AUTHOR_KEY = "settings_about_author_key";

    // Cache
    public static final String SETTINGS_CACHE_SIZE_KEY = "settings_cache_info_key";
    public static final String SETTINGS_CLEAR_CACHE_KEY = "settings_clear_cache_key";

    public static long lock_timestamp = 0;
    public static final long LOCK_EXPIRATION_MSECS = 5 * 60 * 1000;

    public static synchronized SettingsManager instance() {
        if (instance == null) {
            instance = new SettingsManager();
        }

        return instance;
    }

    public void setupGestureLock() {
        settingsSharedPref.edit().putBoolean(GESTURE_LOCK_SWITCH_KEY, true)
                .commit();
        saveGestureLockTimeStamp();
    }

    /**
     * Whether the user has setup a gesture lock or not
     *
     */
    public boolean isGestureLockEnabled() {
        return settingsSharedPref.getBoolean(GESTURE_LOCK_SWITCH_KEY, false);
    }

    /**
     * For convenience, if the user has given the correct gesture lock, he
     * would not be asked for gesture lock for a short period of time.
     *
     */
    public boolean isGestureLockRequired() {
        if (!isGestureLockEnabled()) {
            return false;
        }
        LockPatternUtils mLockPatternUtils = new LockPatternUtils(SeadroidApplication.getAppContext());
        if (!mLockPatternUtils.savedPatternExists()) {
            return false;
        }
        long now = System.currentTimeMillis();
        if (now < lock_timestamp + LOCK_EXPIRATION_MSECS) {
            return false;
        }

        return true;
    }

    public void saveGestureLockTimeStamp() {
        lock_timestamp = System.currentTimeMillis();
    }

    public String getCameraUploadRepoName() {
        return sharedPref.getString(SHARED_PREF_CAMERA_UPLOAD_REPO_NAME, null);
    }

    public void saveCameraUploadRepoInfo(String repoId, String repoName,
            String dstDir, Account account) {
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_REPO_ID, repoId);
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_REPO_NAME, repoName);
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_EMAIL, account.getEmail());
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_SERVER, account.getServer());
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_TOKEN, account.getToken());
        editor.commit();
    }

    public void clearCameraUploadInfo() {
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_SERVER, null);
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_EMAIL, null);
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_TOKEN, null);
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_REPO_NAME, null);
        editor.putString(SHARED_PREF_CAMERA_UPLOAD_REPO_ID, null);
        editor.commit();
    }

    public boolean checkCameraUploadNetworkAvailable() {
        if (!Utils.isNetworkOn()) {
            return false;
        }
        // user does not allow mobile connections
        if (!Utils.isWiFiOn() && !isDataPlanAllowed()) {
            return false;
        }
        // Wi-Fi or 2G/3G/4G connections available
        return true;
    }

    public void saveCameraUploadEnabled(boolean isEnabled) {
        settingsSharedPref.edit().putBoolean(CAMERA_UPLOAD_SWITCH_KEY, isEnabled).commit();
    }

    public boolean isCameraUploadEnabled() {
        return settingsSharedPref.getBoolean(CAMERA_UPLOAD_SWITCH_KEY, false);
    }

    public boolean isDataPlanAllowed() {
        return settingsSharedPref.getBoolean(CAMERA_UPLOAD_ALLOW_DATA_PLAN_SWITCH_KEY, false);
    }

    public boolean isVideosUploadAllowed() {
        return settingsSharedPref.getBoolean(CAMERA_UPLOAD_ALLOW_VIDEOS_SWITCH_KEY, false);
    }

    public void saveDataPlanAllowed(boolean isAllowed) {
        settingsSharedPref.edit().putBoolean(CAMERA_UPLOAD_ALLOW_DATA_PLAN_SWITCH_KEY, isAllowed).commit();
    }

    public void saveVideosAllowed(boolean isVideosUploadAllowed) {
        settingsSharedPref.edit().putBoolean(CAMERA_UPLOAD_ALLOW_VIDEOS_SWITCH_KEY, isVideosUploadAllowed).commit();
    }

    public void saveCustomScanDir(boolean isCustom) {
        settingsSharedPref.edit().putBoolean(CAMERA_UPLOAD_CUSTOM_DIRECTORIES_KEY, isCustom).commit();
    }

    public void saveLocalDirPath(String path) {
        editor.putString(CAMERA_UPLOAD_CUSTOM_DIRECTORIES_PATH, path).commit();
    }

    public String getLocalDirPath() {
        return sharedPref.getString(CAMERA_UPLOAD_CUSTOM_DIRECTORIES_PATH, null);
    }

    public boolean isCustomScanDir() {
        return settingsSharedPref.getBoolean(CAMERA_UPLOAD_CUSTOM_DIRECTORIES_KEY, false);
    }

    public String getCameraUploadRepoId() {
        return sharedPref.getString(SettingsManager.SHARED_PREF_CAMERA_UPLOAD_REPO_ID, null);
    }

    public String getCameraUploadAccountEmail() {
        return sharedPref.getString(SettingsManager.SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_EMAIL, null);
    }

    public String getCameraUploadAccountServer() {
        return sharedPref.getString(SettingsManager.SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_SERVER, null);
    }

    public String getCameraUploadAccountToken() {
        return sharedPref.getString(SettingsManager.SHARED_PREF_CAMERA_UPLOAD_ACCOUNT_TOKEN, null);
    }

    /**
     * get current login Account instance
     *
     * @return Account if has, otherwise, returns null.
     */
    public Account getCurrentAccount() {
        AccountManager accountMgr = new AccountManager(
                SeadroidApplication.getAppContext());
        return accountMgr.getCurrentAccount();
    }

    public void delCachesByActSignature(Account account) {
        DatabaseHelper dbHelper = DatabaseHelper.getDatabaseHelper();
        dbHelper.delCachesBySignature(account);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- height of a normal list item in normal mode -->
    <dimen name="drag_normal_height">66dip</dimen>
    <!-- height of an expanded list item in drag mode -->
    <dimen name="drag_expanded_height">132dip</dimen>

    <dimen name="tab_button_text_size">14.0dip</dimen>
    <dimen name="user_info_level_text_size">10.0dip</dimen>
    <dimen name="title_text_size">20.0dip</dimen>
    <dimen name="user_info_text_size">16.0dip</dimen>

    <dimen name="list_item_title_text_size">16.0dip</dimen>
    <dimen name="list_item_sub_title_text_size">12.0dip</dimen>

    <dimen name="widget_height">100.0dip</dimen>
    <dimen name="widget_content_margin_top">20.0dip</dimen>
    <dimen name="widget_content_margin_left">10.0dip</dimen>
    <dimen name="widget_logo_size">35.0dip</dimen>

    <dimen name="searchbar_padding">5.0px</dimen>
    <dimen name="searchbar_textsize">24.0px</dimen>
    <dimen name="searchbar_paddingleft">45.0px</dimen>
    <dimen name="searchbar_paddingright">126.0px</dimen>
    <dimen name="searchbar_marginright">62.0px</dimen>
    <dimen name="searchbar_radiobutton_padding">40.0dip</dimen>
    <dimen name="searchbar_radiobutton_padding_user">55.0dip</dimen>
</resources>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Cordyceps japonica f. japonica Lloyd

### Remarks
null