text:
define([
    'preact',
    'htm',

    // for effect
    'bootstrap'
], (
    preact,
    htm
) => {

    const { h, Component } = preact;
    const html = htm.bind(h);

    class Signin extends Component {
        constructor(props) {
            super(props);
        }

        buildAvatarUrl(profile) {
            switch (profile.profile.userdata.avatarOption || 'gravatar') {
                case 'gravatar':
                    var gravatarDefault = profile.profile.userdata.gravatarDefault || 'identicon';
                    var gravatarHash = profile.profile.synced.gravatarHash;
                    if (gravatarHash) {
                        return (
                            `https://www.gravatar.com/avatar/${gravatarHash}?s=300&r=pg&d=${gravatarDefault}`
                        );
                    } else {
                        return '/images/nouserpic.png';
                    }
                case 'silhouette':
                case 'mysteryman':
                default:
                    return '/images/nouserpic.png';
            }
        }

        renderAvatar() {
            if (!this.props.profile) {
                console.warn('no profile?');
                return '';
            }
            const avatarURL = this.buildAvatarUrl(this.props.profile);

            return html `

            `;
        }

        handleSignout(e) {
            e.preventDefault();
            this.props.signout();
        }

        renderMenu() {
            return html `

                                ${this.props.profile.user.realname}

                                ${this.props.profile.user.username}

                                Your Profile

                                Your Account

                                Sign Out

            `;
        }

        renderLoggedIn() {
            return html `

                    <button
                        type="button"
                        class="btn btn-default dropdown-toggle"
                        data-toggle="dropdown"
                        aria-expanded="false"
                        data-k-b-testhook-button="avatar">
                        ${this.renderAvatar()}

                    </button>
                    ${this.renderMenu()}

            `;
        }

        renderNotLoggedIn() {
            return html `

                           Sign In

            `;
        }

        render() {
            if (this.props.profile) {
                return this.renderLoggedIn();
            } else {
                return this.renderNotLoggedIn();
            }
        }

    }

    return Signin;
});


text:
#ifndef _I386_ISA_ISA_DMA_H_
#define	_I386_ISA_ISA_DMA_H_

#ifdef _KERNEL

#define ISADMA_READ	0x00100000
#define ISADMA_WRITE	0
#define ISADMA_RAW	0x00080000

void	isa_dmacascade(int chan);
void	isa_dmadone(int flags, caddr_t addr, int nbytes, int chan);
void	isa_dmainit(int chan, u_int bouncebufsize);
void	isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan);
int	isa_dma_acquire(int chan);
void	isa_dma_release(int chan);
int	isa_dmastatus(int chan);
int	isa_dmastop(int chan);
#endif

#endif /* !_I386_ISA_ISA_DMA_H_ */

redpajama_set_name: RedPajamaGithub


text:
/*
Template Name: Color Admin - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.3.7
Version: 2.1.0
Author: Sean Ngu
Website: http://www.seantheme.com/color-admin-v2.1/admin/html/
*/

var handleDataTableSelect = function() {
	"use strict";

    if ($('#data-table').length !== 0) {
        $('#data-table').DataTable({
            select: true,
            responsive: true
        });
    }
};

var TableManageTableSelect = function () {
	"use strict";
    return {
        //main function
        init: function () {
            handleDataTableSelect();
        }
    };
}();


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Saver.SaveBuilder</title>
<meta name="date" content="2016-09-19">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Builder

Class Saver.SaveBuilder

java.lang.Object

Builder.Saver.SaveBuilder

Enclosing class:

Saver

public static class Saver.SaveBuilder
extends java.lang.Object

Constructor Summary

Constructors

Constructor and Description

SaveBuilder()

constructor for the saver

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

Saver.SaveBuilder
addEnemySequence(EntityActionSequence enemy)

builder to add EntityActionSequence of enemy

Saver.SaveBuilder
addPlayerSequence(EntityActionSequence player)

builder to add EntityActionSequence of player

Saver.SaveBuilder
addRound(int round)

builder to add round

Saver.SaveBuilder
addScore(int score)

builder to add score

Saver
build()

java.lang.Boolean
isBuildReady()

returns if the builder is ready to be save

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

SaveBuilder

public SaveBuilder()

constructor for the saver

Method Detail

isBuildReady

public java.lang.Boolean isBuildReady()

returns if the builder is ready to be save

Returns:

booelean

addScore

public Saver.SaveBuilder addScore(int score)

builder to add score

Parameters:

integer - to add score

Returns:

SaveBuilder

addRound

public Saver.SaveBuilder addRound(int round)

builder to add round

Parameters:

integer - to add round

Returns:

SaveBuilder

addPlayerSequence

public Saver.SaveBuilder addPlayerSequence(EntityActionSequence player)

builder to add EntityActionSequence of player

Parameters:

integer - to add EntityActionSequence

Returns:

SaveBuilder

addEnemySequence

public Saver.SaveBuilder addEnemySequence(EntityActionSequence enemy)

builder to add EntityActionSequence of enemy

Parameters:

integer - to add EntityActionSequence

Returns:

SaveBuilder

build

public Saver build()

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?php

namespace AppBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="test_questions")
 */
class TestQuestion
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var Question
     *
     * @ORM\ManyToOne(targetEntity="Question")
     * @ORM\JoinColumn(name="question_id", referencedColumnName="id")
     */
    private $question;

    /**
     * @var TestQuiz
     *
     * @ORM\ManyToOne(targetEntity="TestQuiz")
     * @ORM\JoinColumn(name="quiz_id", referencedColumnName="id")
     */
    private $quiz;

    /**
     * @var bool
     *
     * @ORM\Column(type="boolean")
     */
    private $correct;

    /**
     * @var Answer[]|ArrayCollection
     */
    private $answers;

    public function __construct(Question $question)
    {
        $this->setQuestion($question);
        $this->setAnswers($question->getAnswers());
    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @return Question
     */
    public function getQuestion(): Question
    {
        return $this->question;
    }

    /**
     * @param Question $question
     */
    public function setQuestion(Question $question)
    {
        $this->question = $question;
    }

    /**
     * @return TestQuiz
     */
    public function getQuiz(): ?TestQuiz
    {
        return $this->quiz;
    }

    /**
     * @param TestQuiz $quiz
     */
    public function setQuiz(?TestQuiz $quiz)
    {
        $this->quiz = $quiz;
    }

    /**
     * @return boolean
     */
    public function isCorrect(): bool
    {
        return $this->correct;
    }

    /**
     * @param boolean $correct
     */
    public function setCorrect(bool $correct)
    {
        $this->correct = $correct;
    }

    /**
     * @return Answer[]|ArrayCollection
     */
    public function getAnswers()
    {
        return $this->answers;
    }

    /**
     * @param Answer[]|ArrayCollection $answers
     */
    public function setAnswers($answers)
    {
        $this->answers = $answers;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using DrinkCounter.Models;
using DrinkCounter.ViewModels;

namespace DrinkCounter.Controllers
{
    [Route("api/v1/[controller]")]
    public class PersonalReportsController : Controller
    {
        private DrinkingData _context;

        public PersonalReportsController(DrinkingData dataContext)
        {
            _context = dataContext;
        }

        // GET api/v1/personalreports/ts7kpdpvz
        [HttpGet("{id}")]
        public ReportViewModel GetAmountByUserId(string id)
        {
            var result = (from dc in _context.DrinkCounts
                          join dt in _context.DrinkTypes on dc.TypeId equals dt.DrinkTypeId
                          where dc.UserId.Equals(id)
                          select new
                          {
                              AmountFromDC = dc.Amount,
                            NameFromDT = dt.DrinkName

                          }).ToList();

            var t = new ReportViewModel
            {
                 DrinkName = result.Select(c => c.NameFromDT),
                Amount = result.Select(c => c.AmountFromDC),
                TotalAmount = result.Select(c => c.AmountFromDC).Sum()

            };

            return t;
        }

        // GET api/v1/personalreports/ts7kpdpvz/2016-03-31%2001:25:59.7338745/2016-05-31%2001:25:59.7338745
        [HttpGet("{id}/{startdate}/{enddate}")]
        public ReportViewModel GetAmountByDate(string id, DateTime startdate, DateTime enddate)
        {
            var result = (from dt in _context.DrinkCounts
                          where dt.UserId.Equals(id) && (dt.Date >= startdate && dt.Date <= enddate)
                          select new DrinkCount
                          {
                              Amount = dt.Amount,
                              Date = dt.Date

                          }).ToList();

            var t = new ReportViewModel
            {   Date =  result.Select(c => c.Date),
                Amount = result.Select(c => c.Amount),
                TotalAmount = result.Select(c => c.Amount).Sum()

            };

            return t;
        }

        // GET api/v1/personalreports/ts7kpdpvz/1074
        //[HttpGet("{id}/{typeid}")]
        //public ReportViewModel GetAmountByTypeId(string id, int typeid)
        //{
        //    var result = (from dt in _context.DrinkCounts
        //                  where dt.UserId.Equals(id) && dt.TypeId.Equals(typeid)
        //                  select new DrinkCount
        //                  {
        //                      Amount = dt.Amount
        //                  }).ToList();

        //    var t = new ReportViewModel
        //    {
        //        Amount = result.Select(c => c.Amount),
        //        TotalAmount = result.Select(c => c.Amount).Sum()

        //    };

        //    return t;
        //}

        // GET api/v1/personalreports/ts7kpdpvz/1
        [HttpGet("{id}/{categoryid}")]
        public ReportViewModel GetAmountByCategoryId(string id, int categoryid)
        {
            var result = (from dc in _context.DrinkCounts
                          join dt in _context.DrinkTypes on dc.TypeId equals dt.DrinkTypeId
                          join dct in _context.DrinkCategories on dt.DrinkCategoryId equals dct.Id
                          where dc.UserId.Equals(id) && dt.DrinkCategoryId.Equals(categoryid)
                          select new
                          {
                              AmountFromDC = dc.Amount,
                              NameFromDCT = dct.Name
                          }).ToList();

            var t = new ReportViewModel
            {
                DrinkName = result.Select(c => c.NameFromDCT),
                Amount = result.Select(c => c.AmountFromDC),
                TotalAmount = result.Select(c => c.AmountFromDC).Sum()

            };

            return t;
        }
        [HttpGet("{id}/{categoryid}/{startdate}/{enddate}")]
        public ReportViewModel GetAmountByCategoryIdDate(string id, int categoryid, DateTime startdate, DateTime enddate)
        {
            var result = (from dc in _context.DrinkCounts
                          join dt in _context.DrinkTypes on dc.TypeId equals dt.DrinkTypeId
                          join dct in _context.DrinkCategories on dt.DrinkCategoryId equals dct.Id
                          where (dc.UserId.Equals(id) && dt.DrinkCategoryId.Equals(categoryid)) && (dc.Date >= startdate && dc.Date <= enddate)
                          select new
                          {
                              AmountFromDC = dc.Amount,
                              NameFromDCT = dct.Name,
                              Date = dc.Date,
                              Id = dct.Id,
                              DrinkName = dt.DrinkName
                          }).ToList();

            var t = new ReportViewModel
            {
                CategoryId = result.Select(c => c.Id),
                DrinkName = result.Select(c => c.NameFromDCT),
                Amount = result.Select(c => c.AmountFromDC),
                TotalAmount = result.Select(c => c.AmountFromDC).Sum(),
                Date = result.Select(c => c.Date),
                TypeName = result.Select(c => c.DrinkName)
            };

            return t;
        }
    }
}


text:
'use strict';

describe(`$loggly`, () => {
  const moduleName = require('../../src');
  let $loggly;
  let sandbox;
  let $window;
  let $logglyProvider;

  beforeEach(() => {
    sandbox = sinon.sandbox.create('$loggly');

    mock.module(moduleName, ($provide, _$logglyProvider_) => {
      // this ensures that bootstrapping doesn't actually happen,
      // and we don't end up asking loggly.com for a script.
      $provide.decorator('$loggly', $delegate => {
        $delegate.bootstrap = sandbox.stub();
        return $delegate;
      });
      $logglyProvider = _$logglyProvider_;
    });

    mock.inject((_$loggly_, _$window_) => {
      $loggly = _$loggly_;
      $window = _$window_;
      $window._LTracker.length = 0;
    });
  });

  afterEach(() => {
    sandbox.restore();
  });

  it(`should be an object`, () => {
    expect($loggly)
      .to
      .be
      .an('object');
  });

  it(`should define global _LTracker`, () => {
    expect(global._LTracker)
      .to
      .eql([]);
  });

  describe(`method`, () => {
    describe(`send()`, () => {
      it(`should push data to the _LTracker array`, () => {
        $loggly.send('foo');
        expect($window._LTracker)
          .to
          .eql(['foo']);
      });
    });

    describe(`$emit`, () => {
      it(`should emit data on $rootScope`, mock.inject($rootScope => {
        sandbox.stub($rootScope, '$emit');
        const namespace = $loggly.config.providerConfig.$namespace;
        $loggly.$emit('foo', 'bar');
        expect($rootScope.$emit)
          .to
          .have
          .been
          .calledWithExactly(`${namespace}:foo`, 'bar');
      }));
    });
  });

  describe(`property`, () => {
    describe(`config`, () => {
      it(`should be the data as configured in $logglyProvider`, () => {
        expect($loggly.config)
          .to
          .eql($logglyProvider.config);
      });
    });
  });
});


text:
package model.util;

import model.BBCode;

public class GeneratorIdBBCode implements IGenerator<BBCode> {
	private static final long serialVersionUID = -3940671244883717367L;

	private Long id = 0L;

	public static IGenerator<BBCode> getInstance() {
		return GeneratorIdBBCodeHolder.INSTANCE;
	}

	@Override
	public void generateId(BBCode model) {
		id = id + 1l;
		model.setId(id);
	}

	@Override
	public Long getCurrentId() {
		return id;
	}

	private static class GeneratorIdBBCodeHolder{
		public final static GeneratorIdBBCode INSTANCE = new GeneratorIdBBCode();
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <ImageView
        android:id="@+id/iv_photo"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:src="@drawable/amc"
        android:layout_marginRight="20dp"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"/>

    <TextView
        android:id="@+id/tv_nicheng"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:textColor="#000000"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@id/iv_photo"
        android:layout_alignTop="@id/iv_photo"
        android:text="aa"/>

</LinearLayout>

</RelativeLayout>


text:
title: Clock
date: 2016-02-15
categories: portfolio
tags:
---

GitHub: [clock](https://github.com/jwoos/web_clock)
Demo: https://jwoos.github.io/web_clock/

<!-- more -->

<image style="margin: 0 auto; display: block" src="/demo/web_clock.jpg"/>

This is a simple clock that I made. I had planned on making it much fancier with smooth animations and better styling but this is just what I ended up with!


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>ModularUI</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="apple-touch-icon" href="apple-touch-icon.png">

    <link href='https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Lato:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/main.css">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>

    <meta name="google-site-verification" content="wqwDh_DX8L70vdmOcKcH_layrk9-jbKHGWsRxEtL6DM" />

        ModularUI é uma comunidade que busca fomentar, aprofundar e valorizar iniciativas e discussões sobre criação e desenvolvimento de interfaces digitais e sistemas de design. Acreditamos que podemos alcançar um fluxo de trabalho melhor com uma abordagem colaborativa, iterativa e enxuta – promovendo eficiência e reduzindo desperdícios.

        Junte-se a nós!

      Canal #modular-ui no Slack do IxDA Brasil

            Meetups realizados

            Nosso Manifesto

            Diretório de links

            Grupo no Facebook


text:
obj-$(CONFIG_TI_SOC_THERMAL)		+= ti-soc-thermal.o
ti-soc-thermal-y			:= ti-bandgap.o
ti-soc-thermal-$(CONFIG_TI_THERMAL)	+= ti-thermal-common.o
ti-soc-thermal-$(CONFIG_DRA752_THERMAL)	+= dra752-thermal-data.o
ti-soc-thermal-$(CONFIG_OMAP4_THERMAL)	+= omap4-thermal-data.o
ti-soc-thermal-$(CONFIG_OMAP5_THERMAL)	+= omap5-thermal-data.o


text:
package org.apache.beam.sdk.extensions.sql.zetasql;

import static com.google.zetasql.CivilTimeEncoder.decodePacked64TimeNanos;
import static com.google.zetasql.CivilTimeEncoder.encodePacked64TimeNanos;

import com.google.zetasql.Value;
import io.grpc.Status;
import java.util.List;
import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.avatica.util.TimeUnit;
import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.util.DateString;
import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.util.TimeString;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Splitter;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.math.LongMath;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

/** DateTimeUtils. */
public class DateTimeUtils {
  public static final Long MILLIS_PER_DAY = 86400000L;
  private static final Long MICROS_PER_MILLI = 1000L;

  @SuppressWarnings("unchecked")
  private enum TimestampPatterns {
    TIMESTAMP_PATTERN,
    TIMESTAMP_PATTERN_SUBSECOND,
    TIMESTAMP_PATTERN_T,
    TIMESTAMP_PATTERN_SUBSECOND_T,
  }

  @SuppressWarnings("unchecked")
  private static final ImmutableMap<Enum, DateTimeFormatter> TIMESTAMP_PATTERN_WITHOUT_TZ =
      ImmutableMap.of(
          TimestampPatterns.TIMESTAMP_PATTERN, DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"),
          TimestampPatterns.TIMESTAMP_PATTERN_SUBSECOND,
              DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS"),
          TimestampPatterns.TIMESTAMP_PATTERN_T, DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss"),
          TimestampPatterns.TIMESTAMP_PATTERN_SUBSECOND_T,
              DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS"));

  @SuppressWarnings("unchecked")
  private static final ImmutableMap<Enum, DateTimeFormatter> TIMESTAMP_PATTERN_WITH_TZ =
      ImmutableMap.of(
          TimestampPatterns.TIMESTAMP_PATTERN, DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ssZZ"),
          TimestampPatterns.TIMESTAMP_PATTERN_SUBSECOND,
              DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSSZZ"),
          TimestampPatterns.TIMESTAMP_PATTERN_T,
              DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ"),
          TimestampPatterns.TIMESTAMP_PATTERN_SUBSECOND_T,
              DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZZ"));

  public static DateTimeFormatter findDateTimePattern(String str) {
    if (str.indexOf('+') == -1) {
      return findDateTimePattern(str, TIMESTAMP_PATTERN_WITHOUT_TZ);
    } else {
      return findDateTimePattern(str, TIMESTAMP_PATTERN_WITH_TZ);
    }
  }

  @SuppressWarnings("unchecked")
  public static DateTimeFormatter findDateTimePattern(
      String str, ImmutableMap<Enum, DateTimeFormatter> patternMap) {
    if (str.indexOf('.') == -1) {
      if (str.indexOf('T') == -1) {
        return patternMap.get(TimestampPatterns.TIMESTAMP_PATTERN);
      } else {
        return patternMap.get(TimestampPatterns.TIMESTAMP_PATTERN_T);
      }
    } else {
      if (str.indexOf('T') == -1) {
        return patternMap.get(TimestampPatterns.TIMESTAMP_PATTERN_SUBSECOND);
      } else {
        return patternMap.get(TimestampPatterns.TIMESTAMP_PATTERN_SUBSECOND_T);
      }
    }
  }

  // https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#timestamp_differences
  // 0001-01-01 00:00:00 to 9999-12-31 23:59:59.999999 UTC.
  // -62135596800000000 to 253402300799999999
  @SuppressWarnings("GoodTime")
  public static final Long MIN_UNIX_MILLIS = -62135596800000L;

  @SuppressWarnings("GoodTime")
  public static final Long MAX_UNIX_MILLIS = 253402300799999L;

  public static DateTime parseTimestampWithUTCTimeZone(String str) {
    return findDateTimePattern(str).withZoneUTC().parseDateTime(str);
  }

  @SuppressWarnings("unused")
  public static DateTime parseTimestampWithLocalTimeZone(String str) {
    return findDateTimePattern(str).withZone(DateTimeZone.getDefault()).parseDateTime(str);
  }

  public static DateTime parseTimestampWithTimeZone(String str) {
    // for example, accept "1990-10-20 13:24:01+0730"
    if (str.indexOf('.') == -1) {
      return DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ssZ").parseDateTime(str);
    } else {
      return DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSSZ").parseDateTime(str);
    }
  }

  public static String formatTimestampWithTimeZone(DateTime dt) {
    String resultWithoutZone;
    if (dt.getMillisOfSecond() == 0) {
      resultWithoutZone = dt.toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"));
    } else {
      resultWithoutZone = dt.toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS"));
    }

    // ZetaSQL expects a 2-digit timezone offset (-05) if the minute part is zero, and it expects
    // a 4-digit timezone with a colon (-07:52) if the minute part is non-zero. None of the
    // variations on z,Z,ZZ,.. do this for us so we have to do it manually here.
    String zone = dt.toString(DateTimeFormat.forPattern("ZZ"));
    List<String> zoneParts = Lists.newArrayList(Splitter.on(':').limit(2).split(zone));
    if (zoneParts.size() == 2 && zoneParts.get(1).equals("00")) {
      zone = zoneParts.get(0);
    }

    return resultWithoutZone + zone;
  }

  @SuppressWarnings("unused")
  public static DateTime parseTimestampWithoutTimeZone(String str) {
    return DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").parseDateTime(str);
  }

  public static DateTime parseDate(String str) {
    return DateTimeFormat.forPattern("yyyy-MM-dd").withZoneUTC().parseDateTime(str);
  }

  public static DateTime parseTime(String str) {
    // DateTimeFormat does not parse "08:10:10" for pattern "HH:mm:ss.SSS". In this case, '.' must
    // appear.
    if (str.indexOf('.') == -1) {
      return DateTimeFormat.forPattern("HH:mm:ss").withZoneUTC().parseDateTime(str);
    } else {
      return DateTimeFormat.forPattern("HH:mm:ss.SSS").withZoneUTC().parseDateTime(str);
    }
  }

  @SuppressWarnings(
      "Value with nanoseconds will be truncated to milliseconds in decodePacked64TimeNanos.")
  public static TimeString convertTimeValueToTimeString(Value value) {
    LocalTime localTime = decodePacked64TimeNanos(value.getTimeValue());
    return TimeString.fromMillisOfDay(localTime.getMillisOfDay());
  }

  // dates are represented as an int32 value, indicating the offset
  // in days from the epoch 1970-01-01.  ZetaSQL dates are not timezone aware,
  // and do not correspond to any particular 24 hour period.
  public static DateString convertDateValueToDateString(Value value) {
    return DateString.fromDaysSinceEpoch(value.getDateValue());
  }

  public static Value parseDateToValue(String dateString) {
    DateTime dateTime = parseDate(dateString);
    return Value.createDateValue((int) (dateTime.getMillis() / MILLIS_PER_DAY));
  }

  public static Value parseTimeToValue(String timeString) {
    DateTime dateTime = parseTime(timeString);
    return Value.createTimeValue(
        encodePacked64TimeNanos(LocalTime.fromMillisOfDay(dateTime.getMillisOfDay())));
  }

  public static Value parseTimestampWithTZToValue(String timestampString) {
    DateTime dateTime = parseTimestampWithTimeZone(timestampString);
    // convert from micros.
    // TODO: how to handle overflow.
    return Value.createTimestampValueFromUnixMicros(
        LongMath.checkedMultiply(dateTime.getMillis(), MICROS_PER_MILLI));
  }

  private static void safeCheckSubMillisPrecision(long micros) {
    long subMilliPrecision = micros % 1000L;
    if (subMilliPrecision != 0) {
      throw new IllegalArgumentException(
          String.format(
              "%s has sub-millisecond precision, which Beam ZetaSQL does"
                  + " not currently support.",
              micros));
    }
  }

  @SuppressWarnings("GoodTime")
  public static long safeMicrosToMillis(long micros) {
    safeCheckSubMillisPrecision(micros);
    return micros / 1000L;
  }

  /**
   * This function validates that Long representation of timestamp is compatible with ZetaSQL
   * timestamp values range.
   *
   *
Invoked via reflection. @see SqlOperators
   *
   * @param ts Timestamp to validate.
   * @return Unchanged timestamp sent for validation.
   */
  @SuppressWarnings("GoodTime")
  public static Long validateTimestamp(Long ts) {
    if (ts == null) {
      return null;
    }

    if ((ts < MIN_UNIX_MILLIS) || (ts > MAX_UNIX_MILLIS)) {
      throw Status.OUT_OF_RANGE
          .withDescription("Timestamp is out of valid range.")
          .asRuntimeException();
    }

    return ts;
  }

  /**
   * This function validates that interval is compatible with ZetaSQL timestamp values range.
   *
   *
ZetaSQL validates that if we represent interval in milliseconds, it will fit into Long.
   *
   *
In case of SECOND or smaller time unit, it converts timestamp to microseconds, so we need to
   * convert those to microsecond and verify that we do not cause overflow.
   *
   *
Invoked via reflection. @see SqlOperators
   *
   * @param arg Argument for the interval.
   * @param unit Time unit used in this interval.
   * @return Argument for the interval.
   */
  @SuppressWarnings("GoodTime")
  public static Long validateTimeInterval(Long arg, TimeUnit unit) {
    if (arg == null) {
      return null;
    }

    // multiplier to convert to milli or microseconds.
    long multiplier = unit.multiplier.longValue();
    switch (unit) {
      case SECOND:
      case MILLISECOND:
        multiplier *= 1000L; // Change multiplier from milliseconds to microseconds.
        break;
      default:
        break;
    }

    if ((arg > Long.MAX_VALUE / multiplier) || (arg < Long.MIN_VALUE / multiplier)) {
      throw Status.OUT_OF_RANGE
          .withDescription("Interval is out of valid range")
          .asRuntimeException();
    }

    return arg;
  }
}


text:
//
//  CJDemoDateTextField.m
//  CJUIKitDemo
//
//  Created by ciyouzen on 2019/4/3.
//  Copyright © 2019 dvlproad. All rights reserved.
//

#import "CJDemoDateTextField.h"

#ifdef TEST_CJBASEUIKIT_POD
#import "UIColor+CJHex.h"
//#import "UIView+CJPopupInView.h"
#import "UITextField+CJTextChangeBlock.h"
#else
#import <CJBaseUIKit/UIColor+CJHex.h>
//#import <CJBaseUIKit/UIView+CJPopupInView.h>
#import <CJBaseUIKit/UITextField+CJTextChangeBlock.h>
#endif

@interface CJDemoDateTextField () <UITextFieldDelegate> {

}
@property (nonatomic, strong) CJDemoDatePickerView *datePickerView;

@end

@implementation CJDemoDateTextField

/**
 *  用来选择日期的文本框(文本框中的值只能来源于选择,不能来源于输入)
 *
 *  @param confirmCompleteBlock confirmCompleteBlock
 */
- (instancetype)initWithConfirmCompleteBlock:(void(^)(NSDate *seletedDate, NSString *seletedDateString))confirmCompleteBlock
{
    self = [super initWithFrame:CGRectZero];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.textAlignment = NSTextAlignmentCenter;

        self.backgroundColor = [UIColor whiteColor];
        self.layer.masksToBounds = YES;
        self.layer.cornerRadius = 4;
        self.allowPickDate = NO;

        // 防止会出现第三方库如IQKeyboardManager会自动为textField的弹出的inputView键盘添加Toolbar
        UIView *overlayView = [[UIView alloc] init];
        overlayView.backgroundColor = [UIColor clearColor];
        [self addSubview:overlayView];
        [overlayView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.mas_equalTo(self);
        }];
        overlayView.userInteractionEnabled = YES;
        UITapGestureRecognizer *singleTapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(__handleSingleTap:)];
        singleTapGesture.numberOfTapsRequired = 1;
        singleTapGesture.numberOfTouchesRequired = 1;
        [self addGestureRecognizer:singleTapGesture];

        // datePickerView
        CJDemoDatePickerView *datePickerView = [[CJDemoDatePickerView alloc] initWithCancelHandle:nil confirmHandle:^(NSDate *seletedDate, NSString *seletedDateString) {
            [self __updateCurrentDate:seletedDate];
            if (confirmCompleteBlock) {
                confirmCompleteBlock(seletedDate, seletedDateString);
            }
        }];
        self.datePickerView = datePickerView;
    }
    return self;
}

#pragma mark - Setter
- (void)setAllowPickDate:(BOOL)allowPickDate {
    _allowPickDate = allowPickDate;
    if (allowPickDate) {
        self.backgroundColor = [UIColor whiteColor];
        self.layer.borderColor = CJColorFromHexString(@"#CCCCCC").CGColor;
        self.layer.borderWidth = 1;
    } else {
        self.backgroundColor = CJColorFromHexString(@"#F9F9F9");
        self.layer.borderWidth = 0;
    }
}

- (void)setMaximumDate:(NSDate *)maximumDate {
    _maximumDate = maximumDate;
    self.datePickerView.maximumDate = maximumDate;
    //self.datePickerView.maximumDate = [NSDate date];
}

- (void)setMinimumDate:(NSDate *)minimumDate {
    _minimumDate = minimumDate;
    self.datePickerView.minimumDate = minimumDate;
    //self.datePickerView.minimumDate = [datePickerView.dateFormatter dateFromString:@"1900-01-01"];
}

#pragma mark - Event

/**
 *  同时更新 TextField 和 datePicker 弹出时候的默认选中日期
 *
 *  @param dateString datePicker弹出时候的默认选中日期,未设置时候是显示当前日期
 */
- (void)updateTextFieldAndDatePickerWithDateString:(NSString *)dateString {
    self.text = dateString;
    NSDate *date = [[NSDateFormatterCJHelper sharedInstance] yyyyMMdd_dateFromString:dateString];
    if (date) {
        [self.datePickerView updateDefaultDate:date];
    }
}

- (void)__handleSingleTap:(UIGestureRecognizer *)gr {
    if (self.allowPickDate) {
        [self.datePickerView show];
    }
}

#pragma mark - Private
- (void)__updateCurrentDate:(NSDate *)date {
    NSString *dateString = [[NSDateFormatterCJHelper sharedInstance] yyyyMMdd_stringFromDate:date];
    self.text = dateString;
    _date = date;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end


text:
'use strict';

var app = require('./lib/app.js')
  , http = require('http')
  ;

//Make sure all app modules are finished setting up before listening.
app().then(function(app) {
  var server = http.createServer(app);
  var port  = app.get('port'),
    ip = app.get('base url');

  server.listen(port, ip, function() {
    console.log("App started at: " + new Date() + " on port: " + port);
  });
}).catch(function(err) {
  //There was an error setting up the application.
  //Log the error but don't start the server.
  console.error("Error starting app ", err);
});