hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 98
values | lang stringclasses 21
values | max_stars_repo_path stringlengths 3 945 | max_stars_repo_name stringlengths 4 118 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 945 | max_issues_repo_name stringlengths 4 118 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 945 | max_forks_repo_name stringlengths 4 135 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1 1.03M | max_line_length int64 2 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0e3a5bbfa11bd0d530368b6a92af0ac40731042f | 987 | dart | Dart | lib/feature/profile/bloc/profile_bloc.dart | nicSel8/flutter_starter_project | 153d5d10bccac54f8ab607afee098a36fe831235 | [
"MIT"
] | 1 | 2021-09-20T16:38:50.000Z | 2021-09-20T16:38:50.000Z | lib/feature/profile/bloc/profile_bloc.dart | nicSel8/flutter_starter_project | 153d5d10bccac54f8ab607afee098a36fe831235 | [
"MIT"
] | null | null | null | lib/feature/profile/bloc/profile_bloc.dart | nicSel8/flutter_starter_project | 153d5d10bccac54f8ab607afee098a36fe831235 | [
"MIT"
] | null | null | null | import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:flutter_starter_project/feature/profile/repo/profile_repo.dart';
import 'package:flutter_starter_project/model/user/user.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
part 'profile_event.dart';
part 'profile_state.dart';
part 'profile_bloc.freezed.dart';
@injectable
class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
ProfileBloc({
required this.repo,
}) : super(const ProfileState.loading());
final ProfileRepo repo;
@override
Stream<ProfileState> mapEventToState(
ProfileEvent event,
) async* {
yield* event.map(
fetch: _fetch,
);
}
Stream<ProfileState> _fetch(_Fetch event) async* {
try {
yield const ProfileState.loading();
final user = await repo.fetchUser();
yield ProfileState.loaded(user: user);
} catch (e) {
yield const ProfileState.error();
}
}
}
| 24.675 | 80 | 0.718338 |
81871d45a73af4cea49113d8d1e68b46be435475 | 4,284 | go | Go | core/blockdag/upgradedb.go | jamesvan2019/qitmeer | 68b9b5372be3f31a25759cdcb0a48f5826bb4ddd | [
"0BSD"
] | null | null | null | core/blockdag/upgradedb.go | jamesvan2019/qitmeer | 68b9b5372be3f31a25759cdcb0a48f5826bb4ddd | [
"0BSD"
] | null | null | null | core/blockdag/upgradedb.go | jamesvan2019/qitmeer | 68b9b5372be3f31a25759cdcb0a48f5826bb4ddd | [
"0BSD"
] | 1 | 2020-11-24T09:47:17.000Z | 2020-11-24T09:47:17.000Z | package blockdag
import (
"bytes"
"fmt"
"github.com/Qitmeer/qitmeer/common/hash"
"github.com/Qitmeer/qitmeer/core/dbnamespace"
s "github.com/Qitmeer/qitmeer/core/serialization"
"github.com/Qitmeer/qitmeer/database"
"io"
)
// update db to new version
func (bd *BlockDAG) UpgradeDB(dbTx database.Tx, blockTotal uint) error {
blocks := NewHashSet()
for i := uint(0); i < blockTotal; i++ {
block := Block{id: i}
ib := bd.instance.CreateBlock(&block)
err := DBGetDAGBlockOld(dbTx, ib, blocks)
if err != nil {
return err
}
blocks.AddPair(ib.GetHash(), ib)
}
for _, v := range blocks.GetMap() {
err := DBPutDAGBlock(dbTx, v.(*PhantomBlock))
if err != nil {
return err
}
}
blocks.Clean()
return nil
}
// DBGetDAGBlock get dag block data by resouce ID
func DBGetDAGBlockOld(dbTx database.Tx, block IBlock, blocks *HashSet) error {
bucket := dbTx.Metadata().Bucket(dbnamespace.BlockIndexBucketName)
var serializedID [4]byte
dbnamespace.ByteOrder.PutUint32(serializedID[:], uint32(block.GetID()))
data := bucket.Get(serializedID[:])
if data == nil {
return fmt.Errorf("get dag block error")
}
pb := block.(*PhantomBlock)
return BlockDecodeOld(pb, bytes.NewReader(data), blocks)
}
// decode
func BlockDecodeOld(pb *PhantomBlock, r io.Reader, blocks *HashSet) error {
var b *Block = pb.Block
var id uint32
err := s.ReadElements(r, &id)
if err != nil {
return err
}
b.id = uint(id)
err = s.ReadElements(r, &b.hash)
if err != nil {
return err
}
// parents
var parentsSize uint32
err = s.ReadElements(r, &parentsSize)
if err != nil {
return err
}
if parentsSize > 0 {
b.parents = NewIdSet()
for i := uint32(0); i < parentsSize; i++ {
var parent hash.Hash
err := s.ReadElements(r, &parent)
if err != nil {
return err
}
pib := blocks.Get(&parent).(*PhantomBlock)
b.parents.Add(pib.GetID())
}
}
// children
/*var childrenSize uint32
err=s.ReadElements(r,&childrenSize)
if err != nil {
return err
}
if childrenSize>0 {
b.children = NewHashSet()
for i:=uint32(0);i<childrenSize ;i++ {
var children hash.Hash
err:=s.ReadElements(r,&children)
if err != nil {
return err
}
b.children.Add(&children)
}
}*/
// mainParent
var mainParent hash.Hash
err = s.ReadElements(r, &mainParent)
if err != nil {
return err
}
if mainParent.IsEqual(&hash.ZeroHash) {
b.mainParent = MaxId
} else {
pib := blocks.Get(&mainParent).(*PhantomBlock)
b.mainParent = pib.GetID()
}
var weight uint64
err = s.ReadElements(r, &weight)
if err != nil {
return err
}
b.weight = uint64(weight)
var order uint32
err = s.ReadElements(r, &order)
if err != nil {
return err
}
b.order = uint(order)
var layer uint32
err = s.ReadElements(r, &layer)
if err != nil {
return err
}
b.layer = uint(layer)
var height uint32
err = s.ReadElements(r, &height)
if err != nil {
return err
}
b.height = uint(height)
var status byte
err = s.ReadElements(r, &status)
if err != nil {
return err
}
b.status = BlockStatus(status)
var blueNum uint32
err = s.ReadElements(r, &blueNum)
if err != nil {
return err
}
pb.blueNum = uint(blueNum)
// blueDiffAnticone
var blueDiffAnticoneSize uint32
err = s.ReadElements(r, &blueDiffAnticoneSize)
if err != nil {
return err
}
pb.blueDiffAnticone = NewIdSet()
if blueDiffAnticoneSize > 0 {
for i := uint32(0); i < blueDiffAnticoneSize; i++ {
var bda hash.Hash
err := s.ReadElements(r, &bda)
if err != nil {
return err
}
var order uint32
err = s.ReadElements(r, &order)
if err != nil {
return err
}
bdaib := blocks.Get(&bda).(*PhantomBlock)
pb.blueDiffAnticone.AddPair(bdaib.GetID(), uint(order))
}
}
// blueDiffAnticone
var redDiffAnticoneSize uint32
err = s.ReadElements(r, &redDiffAnticoneSize)
if err != nil {
return err
}
pb.redDiffAnticone = NewIdSet()
if redDiffAnticoneSize > 0 {
for i := uint32(0); i < redDiffAnticoneSize; i++ {
var bda hash.Hash
err := s.ReadElements(r, &bda)
if err != nil {
return err
}
var order uint32
err = s.ReadElements(r, &order)
if err != nil {
return err
}
rdaib := blocks.Get(&bda).(*PhantomBlock)
pb.redDiffAnticone.AddPair(rdaib.GetID(), uint(order))
}
}
return nil
}
| 20.695652 | 78 | 0.656629 |
2640edfe6abe7084a8d1b845c9e4fde5740fc7ee | 1,073 | lua | Lua | dotfiles/config/awesome/config/keys/resize.lua | timber3252/dotfiles.old | 0e30d3c3cc4826de349f3f2cb6f2a90bd9d402ef | [
"MIT"
] | null | null | null | dotfiles/config/awesome/config/keys/resize.lua | timber3252/dotfiles.old | 0e30d3c3cc4826de349f3f2cb6f2a90bd9d402ef | [
"MIT"
] | null | null | null | dotfiles/config/awesome/config/keys/resize.lua | timber3252/dotfiles.old | 0e30d3c3cc4826de349f3f2cb6f2a90bd9d402ef | [
"MIT"
] | null | null | null | local gears = require("gears")
local awful = require("awful")
local modKey = require('config.keys.mod').ModKey
return gears.table.join(
awful.key(
{},
"Escape",
function ()
mode.setMode('normal')
end
),
awful.key(
{ modKey },
"Escape",
function ()
mode.setMode('normal')
end
),
awful.key(
{},
"h",
function (c)
require('awsl.util.resize-client')(client.focus, "left")
end,
{ description = "resize towards left", group = "RESIZE" }
),
awful.key(
{},
"j",
function (c)
require('awsl.util.resize-client')(client.focus, "down")
end,
{ description = "resize towards down", group = "RESIZE" }
),
awful.key(
{},
"k",
function (c)
require('awsl.util.resize-client')(client.focus, "up")
end,
{ description = "resize towards up", group = "RESIZE" }
),
awful.key(
{},
"l",
function (c)
require('awsl.util.resize-client')(client.focus, "right")
end,
{ description = "resize towards right", group = "RESIZE" }
)
) | 20.634615 | 63 | 0.556384 |
4a662b10b14fcaa41d373451ee21bc486d4da1a6 | 5,445 | html | HTML | data/CRAN/greta.html | JuliaTagBot/OSS.jl | 985ed664e484bbcc59b009968e71f2eccaaf4cd4 | [
"Zlib"
] | null | null | null | data/CRAN/greta.html | JuliaTagBot/OSS.jl | 985ed664e484bbcc59b009968e71f2eccaaf4cd4 | [
"Zlib"
] | null | null | null | data/CRAN/greta.html | JuliaTagBot/OSS.jl | 985ed664e484bbcc59b009968e71f2eccaaf4cd4 | [
"Zlib"
] | 3 | 2019-05-18T18:47:05.000Z | 2020-02-08T16:36:58.000Z | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CRAN - Package greta</title>
<link rel="stylesheet" type="text/css" href="../../CRAN_web.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="citation_title" content="Simple and Scalable Statistical Modelling in R [R package greta version 0.3.0]" />
<meta name="citation_author" content="Nick Golding" />
<meta name="citation_publication_date.Published" content="2018-10-30" />
<meta name="citation_public_url" content="https://CRAN.R-project.org/package=greta" />
<meta name="DC.identifier" content="https://CRAN.R-project.org/package=greta" />
<meta name="DC.publisher" content="Comprehensive R Archive Network (CRAN)" />
<style type="text/css">
table td { vertical-align: top; }
</style>
</head>
<body>
<h2>greta: Simple and Scalable Statistical Modelling in R</h2>
<p>Write statistical models in R and fit them by MCMC on CPUs and GPUs, using Google TensorFlow (see <<a href="https://greta-dev.github.io/greta">https://greta-dev.github.io/greta</a>> for more information).</p>
<table summary="Package greta summary">
<tr>
<td>Version:</td>
<td>0.3.0</td>
</tr>
<tr>
<td>Depends:</td>
<td>R (≥ 3.0)</td>
</tr>
<tr>
<td>Imports:</td>
<td><a href="../R6/index.html">R6</a>, <a href="../tensorflow/index.html">tensorflow</a>, <a href="../reticulate/index.html">reticulate</a>, <a href="../progress/index.html">progress</a> (≥ 1.2.0), <a href="../future/index.html">future</a>, <a href="../coda/index.html">coda</a>, methods</td>
</tr>
<tr>
<td>Suggests:</td>
<td><a href="../knitr/index.html">knitr</a>, <a href="../rmarkdown/index.html">rmarkdown</a>, <a href="../DiagrammeR/index.html">DiagrammeR</a>, <a href="../bayesplot/index.html">bayesplot</a>, <a href="../lattice/index.html">lattice</a>, <a href="../testthat/index.html">testthat</a>, <a href="../mvtnorm/index.html">mvtnorm</a>, <a href="../MCMCpack/index.html">MCMCpack</a>, <a href="../rmutil/index.html">rmutil</a>, <a href="../extraDistr/index.html">extraDistr</a>, <a href="../truncdist/index.html">truncdist</a>, <a href="../tidyverse/index.html">tidyverse</a>, <a href="../fields/index.html">fields</a>, <a href="../MASS/index.html">MASS</a>, <a href="../abind/index.html">abind</a></td>
</tr>
<tr>
<td>Published:</td>
<td>2018-10-30</td>
</tr>
<tr>
<td>Author:</td>
<td>Nick Golding <a href="https://orcid.org/0000-0001-8916-5570"><img alt="ORCID iD" src="/web/orcid.svg" style="width:16px; height:16px; margin-left:4px; margin-right:4px; vertical-align:middle" /></a> [aut, cre],
Simon Dirmeier [ctb],
Adam Fleischhacker [ctb],
Shirin Glander [ctb],
Martin Ingram [ctb],
Lee Hazel [ctb],
Tiphaine Martin [ctb],
Matt Mulvahill [ctb],
Michael Quinn [ctb],
David Smith [ctb],
Paul Teetor [ctb],
Jian Yen [ctb]</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>Nick Golding <nick.golding.research at gmail.com></td>
</tr>
<tr>
<td>BugReports:</td>
<td><a href="https://github.com/greta-dev/greta/issues">https://github.com/greta-dev/greta/issues</a></td>
</tr>
<tr>
<td>License:</td>
<td><a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a></td>
</tr>
<tr>
<td>URL:</td>
<td><a href="https://github.com/greta-dev/greta">https://github.com/greta-dev/greta</a></td>
</tr>
<tr>
<td>NeedsCompilation:</td>
<td>no</td>
</tr>
<tr>
<td>SystemRequirements:</td>
<td>Python (>= 2.7.0) with header files and shared
library; TensorFlow (>= 1.10; https://www.tensorflow.org/);
Tensorflow Probability (>=0.3.0;
https://www.tensorflow.org/probability/)</td>
</tr>
<tr>
<td>Materials:</td>
<td><a href="news/news.html">NEWS</a> </td>
</tr>
<tr>
<td>CRAN checks:</td>
<td><a href="../../checks/check_results_greta.html">greta results</a></td>
</tr>
</table>
<h4>Downloads:</h4>
<table summary="Package greta downloads">
<tr>
<td> Reference manual: </td>
<td> <a href="greta.pdf"> greta.pdf </a> </td>
</tr>
<tr>
<td>Vignettes:</td>
<td>
<a href="vignettes/example_models.html">Example models</a><br/>
<a href="vignettes/get_started.html">Get started with greta</a><br/>
</td>
</tr>
<tr>
<td> Package source: </td>
<td> <a href="../../../src/contrib/greta_0.3.0.tar.gz"> greta_0.3.0.tar.gz </a> </td>
</tr>
<tr>
<td> Windows binaries: </td>
<td> r-devel: <a href="../../../bin/windows/contrib/3.6/greta_0.3.0.zip">greta_0.3.0.zip</a>, r-release: <a href="../../../bin/windows/contrib/3.5/greta_0.3.0.zip">greta_0.3.0.zip</a>, r-oldrel: <a href="../../../bin/windows/contrib/3.4/greta_0.3.0.zip">greta_0.3.0.zip</a> </td>
</tr>
<tr>
<td> OS X binaries: </td>
<td> r-release: <a href="../../../bin/macosx/el-capitan/contrib/3.5/greta_0.3.0.tgz">greta_0.3.0.tgz</a>, r-oldrel: <a href="../../../bin/macosx/el-capitan/contrib/3.4/greta_0.3.0.tgz">greta_0.3.0.tgz</a> </td>
</tr>
<tr>
<td> Old sources: </td>
<td> <a href="https://CRAN.R-project.org/src/contrib/Archive/greta"> greta archive </a> </td>
</tr>
</table>
<h4>Linking:</h4>
<p>Please use the canonical form
<a href="https://CRAN.R-project.org/package=greta"><samp>https://CRAN.R-project.org/package=greta</samp></a>
to link to this page.</p>
</body>
</html>
| 42.539063 | 696 | 0.652158 |
6d45c93b36f12064b10d395f707292228e3cbf81 | 2,076 | swift | Swift | Sources/DIGreatness/Resolver/DIBuilderDependencyPool.swift | shsanek/DIGreatness | 2e875601403d4b8b4177b6503e8d1d39b8b7b142 | [
"MIT"
] | null | null | null | Sources/DIGreatness/Resolver/DIBuilderDependencyPool.swift | shsanek/DIGreatness | 2e875601403d4b8b4177b6503e8d1d39b8b7b142 | [
"MIT"
] | null | null | null | Sources/DIGreatness/Resolver/DIBuilderDependencyPool.swift | shsanek/DIGreatness | 2e875601403d4b8b4177b6503e8d1d39b8b7b142 | [
"MIT"
] | null | null | null | final class DIBuilderDependencyPool
{
let node: DINode
let storage: DIBuilderDependencyStorage
var arguments: [Any]
init(node: DINode, arguments: [Any], storage: DIBuilderDependencyStorage) {
self.node = node
self.arguments = arguments
self.storage = storage
}
func get<Type>(arguments: [Any] = []) -> Type {
if let containable = Type.self as? DIContainable.Type {
return getDependency(
arguments: arguments,
with: containable.signature,
map: { containable.init(object: $0) }
)
}
if let argumentContainer = Type.self as? DIArgumentContainable.Type {
return getArgument(argumentContainer)
}
return getDependency(
arguments: arguments,
with: DISignatureDependency(identifier: .init(type: Type.self))
)
}
private func getArgument<Type>(_ argumentContainer: DIArgumentContainable.Type ) -> Type {
let object = self.arguments.removeFirst()
guard let result = argumentContainer.init(object: object) as? Type else {
fatalError("[DI] Incorect type '\(object)' is not '\(Type.self)'")
}
return result
}
private func getDependency<Type>(
arguments: [Any],
with signature: DISignatureDependency,
map: (Any) -> Any = { $0 }
) -> Type {
let dependencies = node.dependencies
.filter { $0.identifier.checkAccept(signature: signature.identifier) }
.map { $0.makeIfNeeed(storage: storage, arguments) }
var object: Any
if signature.pool {
object = map(dependencies)
}
else {
if dependencies.count == 0 {
fatalError("[DI] Node with '\(signature)' not found")
}
object = map(dependencies[0])
}
guard let result = object as? Type else {
fatalError("[DI] Incorect type '\(object)' is not '\(Type.self)'")
}
return result
}
}
| 32.952381 | 94 | 0.573218 |
dfd9c3705f971339805ade0a1df32cfbd12e2c68 | 180 | swift | Swift | Serpent/Serpent Model.xctemplate/Class/___FILEBASENAME___.swift | nodes-ios/SerializableXcodeFileTemplate | dd404db06bffe61f23ab1ff048ff87140f4b3ee0 | [
"MIT"
] | 2 | 2017-03-03T10:15:23.000Z | 2017-03-13T15:13:37.000Z | Serpent/Serpent Model.xctemplate/Class/___FILEBASENAME___.swift | nodes-ios/SerpentXcodeFileTemplate | dd404db06bffe61f23ab1ff048ff87140f4b3ee0 | [
"MIT"
] | null | null | null | Serpent/Serpent Model.xctemplate/Class/___FILEBASENAME___.swift | nodes-ios/SerpentXcodeFileTemplate | dd404db06bffe61f23ab1ff048ff87140f4b3ee0 | [
"MIT"
] | null | null | null | //
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//
import Serpent
class ___FILEBASENAMEASIDENTIFIER___ {
}
| 12.857143 | 48 | 0.738889 |
ebc74d81fd392df4d548d4f7b10f6be1d6123873 | 962 | swift | Swift | SwiftUICDExpenseTrackerStarter-master/ExpenseTracker/Models/Sort.swift | febycloud/SwiftUI | a44ea07807976a9845274c1c850b64dc1c45eb1b | [
"MIT"
] | null | null | null | SwiftUICDExpenseTrackerStarter-master/ExpenseTracker/Models/Sort.swift | febycloud/SwiftUI | a44ea07807976a9845274c1c850b64dc1c45eb1b | [
"MIT"
] | null | null | null | SwiftUICDExpenseTrackerStarter-master/ExpenseTracker/Models/Sort.swift | febycloud/SwiftUI | a44ea07807976a9845274c1c850b64dc1c45eb1b | [
"MIT"
] | null | null | null | //
// Sort.swift
// ExpenseTracker
//
// Created by Alfian Losari on 19/04/20.
// Copyright © 2020 Alfian Losari. All rights reserved.
//
import Foundation
enum SortType: String, CaseIterable {
case date
case amount
}
enum SortOrder: String, CaseIterable {
case ascending
case descending
}
extension SortType: Identifiable {
var id: String { rawValue }
}
extension SortOrder: Identifiable {
var id: String { rawValue }
}
struct ExpenseLogSort {
var sortType: SortType
var sortOrder: SortOrder
var isAscending: Bool {
sortOrder == .ascending ? true : false
}
var sortDescriptor: NSSortDescriptor {
switch sortType {
case .date:
return NSSortDescriptor(keyPath: \ExpenseLog.date, ascending: isAscending)
case .amount:
return NSSortDescriptor(keyPath: \ExpenseLog.amount, ascending: isAscending)
}
}
}
| 19.632653 | 91 | 0.635135 |
7f7c8709d687efece3afa16e556d87c25be85e02 | 1,766 | go | Go | poller/bootstrap.go | samstefan/toot-collect | 67b30db51c9e7f3e157d234ec46230a904039754 | [
"MIT"
] | null | null | null | poller/bootstrap.go | samstefan/toot-collect | 67b30db51c9e7f3e157d234ec46230a904039754 | [
"MIT"
] | null | null | null | poller/bootstrap.go | samstefan/toot-collect | 67b30db51c9e7f3e157d234ec46230a904039754 | [
"MIT"
] | null | null | null | package poller
import (
"encoding/json"
"log"
"os"
"time"
"github.com/kurrik/oauth1a"
"github.com/kurrik/twittergo"
)
type properties struct {
Accounts []account `json:"accounts"`
Credentials credentials `json:"credentials"`
}
type account struct {
User string `json:"user"`
}
type credentials struct {
ConsumerKey string `json:"consumerKey"`
ConsumerSecret string `json:"consumerSecret"`
AccessToken string `json:"accessToken"`
AccessTokenSecret string `json:"accessTokenSecret"`
}
func Bootstrap() {
properties := getProperties()
accounts := properties.Accounts
credentials := properties.Credentials
pollInterval := calculateIntervalTime(len(accounts), 180, 900)
client := authWithTwitter(credentials)
for i := 0; i < len(accounts); i++ {
start(client, accounts[i], pollInterval)
}
}
func calculateIntervalTime(accounts int, requests int, seconds int) time.Duration {
return time.Duration((seconds/(requests/(accounts+1)))*1000) * time.Millisecond
}
func authWithTwitter(credentials credentials) (client *twittergo.Client) {
config := &oauth1a.ClientConfig{
ConsumerKey: credentials.ConsumerKey,
ConsumerSecret: credentials.ConsumerSecret,
}
user := oauth1a.NewAuthorizedConfig(credentials.AccessToken, credentials.AccessTokenSecret)
client = twittergo.NewClient(config, user)
return client
}
func getProperties() (results properties) {
// Open properties file
propertiesFile, err := os.Open("./properties.json")
if err != nil {
log.Println("Error opening properties file", err.Error())
}
// Parse the JSON
jsonParser := json.NewDecoder(propertiesFile)
if err = jsonParser.Decode(&results); err != nil {
log.Println("Error parsing properties file", err.Error())
}
return results
}
| 24.191781 | 92 | 0.733296 |
6849ab0661d776341746c328ed8c02f5ac8f22c9 | 630 | html | HTML | layouts/partials/contacts.html | sunzhe96/exp | e4c19389a80775d3d4f4af59cb3f106c92b2cefe | [
"MIT"
] | null | null | null | layouts/partials/contacts.html | sunzhe96/exp | e4c19389a80775d3d4f4af59cb3f106c92b2cefe | [
"MIT"
] | null | null | null | layouts/partials/contacts.html | sunzhe96/exp | e4c19389a80775d3d4f4af59cb3f106c92b2cefe | [
"MIT"
] | null | null | null | {{ $phone := .Site.Data.contacts.phone }}
{{ $email := .Site.Data.contacts.email }}
{{ $links := .Site.Data.contacts.links }}
{{ $title := .Site.Title }}
<!-- header: shows title (normally user's name), contacts information-->
<div class="flex-between header">
<h1 class="title">{{ $title }}</h1>
<ul>
{{ range $key, $value := $phone }}
<li>{{$value}}</li>
{{ end }}
{{ range $key, $value := $email }}
<li><a href="mailto:{{$value}}">{{$value}}</a></li>
{{ end }}
{{ range $key, $value := $links }}
<li><a href="{{$value}}" target="_blank">{{$key}}</a></li>
{{ end }}
</ul>
</div>
| 27.391304 | 72 | 0.512698 |
fe0f74bfc758831f590252679ea3d6328e72eecb | 395 | dart | Dart | lib/model/groups_v2_group_v2_clan_info.dart | pylaligand/destiny2-dart-api-client | df4198f4937d0474db19fa099c5048e0c9616c2e | [
"MIT"
] | 1 | 2017-10-13T12:14:29.000Z | 2017-10-13T12:14:29.000Z | lib/model/groups_v2_group_v2_clan_info.dart | pylaligand/destiny2-dart-api-client | df4198f4937d0474db19fa099c5048e0c9616c2e | [
"MIT"
] | null | null | null | lib/model/groups_v2_group_v2_clan_info.dart | pylaligand/destiny2-dart-api-client | df4198f4937d0474db19fa099c5048e0c9616c2e | [
"MIT"
] | null | null | null | part of destiny2_api.api;
@Entity()
class GroupsV2GroupV2ClanInfo {
@Property(name: 'clanCallsign')
String clanCallsign = null;
@Property(name: 'clanBannerData')
GroupsV2ClanBanner clanBannerData = null;
GroupsV2GroupV2ClanInfo();
@override
String toString() {
return 'GroupsV2GroupV2ClanInfo[clanCallsign=$clanCallsign, clanBannerData=$clanBannerData, ]';
}
}
| 18.809524 | 99 | 0.731646 |
62e72dad3f892e87a3df0ee47da210c104ae3e4a | 10,335 | rs | Rust | crates/database/src/cursor.rs | wosim-net/wosim | 84b5ea77c304471a68f4345b04a2799e61de6412 | [
"Apache-2.0",
"MIT"
] | 2 | 2021-09-24T16:13:33.000Z | 2021-09-26T02:51:50.000Z | crates/database/src/cursor.rs | wosim-net/wosim | 84b5ea77c304471a68f4345b04a2799e61de6412 | [
"Apache-2.0",
"MIT"
] | null | null | null | crates/database/src/cursor.rs | wosim-net/wosim | 84b5ea77c304471a68f4345b04a2799e61de6412 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-09-26T04:51:23.000Z | 2021-09-26T04:51:23.000Z | use std::mem::size_of;
use bytemuck::{cast_mut, cast_ref};
use crate::{
lock::Lock,
page::{Page, PageNr, NULL_PAGE_NR, PAGE_SIZE},
};
type IndirectPage = [PageNr; FAN_OUT as usize];
const FAN_OUT: usize = PAGE_SIZE / size_of::<PageNr>();
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
enum PageLevel {
L0,
L1,
L2,
}
#[derive(Clone, Copy)]
struct PageIndex(usize, PageLevel);
impl PageIndex {
pub fn new(index: usize, pages: usize) -> Self {
assert!(index < pages);
Self(index, PageLevel::from_pages(pages).unwrap())
}
pub const fn index(self) -> usize {
self.0 / self.1.child_pages()
}
pub fn child(self) -> Self {
Self(self.0 % self.1.child_pages(), self.1.child().unwrap())
}
pub const fn is_indirect(self) -> bool {
self.1.is_indirect()
}
}
#[derive(Clone, Copy)]
pub enum PageLookup {
Immutable(usize, PageNr),
Mutable(usize, PageNr),
Invalid,
}
impl PageLookup {
pub fn get<'a>(
&mut self,
root_nr: PageNr,
pages: usize,
index: usize,
lock: &'a Lock,
) -> &'a Page {
let page_nr = match *self {
Self::Immutable(key, page_nr) => {
if key == index {
page_nr
} else {
let page_nr = find_page(root_nr, PageIndex::new(index, pages), lock);
*self = PageLookup::Immutable(index, page_nr);
page_nr
}
}
Self::Mutable(key, page_nr) => {
if key == index {
page_nr
} else {
let page_nr = find_page(root_nr, PageIndex::new(index, pages), lock);
*self = PageLookup::Immutable(index, page_nr);
page_nr
}
}
Self::Invalid => {
let page_nr = find_page(root_nr, PageIndex::new(index, pages), lock);
*self = PageLookup::Immutable(index, page_nr);
page_nr
}
};
unsafe { lock.page(page_nr) }
}
pub unsafe fn get_mut<'a>(
&mut self,
root_nr: &mut PageNr,
pages: usize,
index: usize,
lock: &'a Lock,
) -> *mut Page {
let page_nr = match *self {
PageLookup::Immutable(key, page_nr) => {
if key == index && lock.try_page_mut(page_nr).is_some() {
*self = PageLookup::Mutable(index, page_nr);
page_nr
} else {
let page_nr = find_page_mut(root_nr, PageIndex::new(index, pages), lock);
*self = PageLookup::Mutable(index, page_nr);
page_nr
}
}
PageLookup::Mutable(key, page_nr) => {
if key == index {
page_nr
} else {
let page_nr = find_page_mut(root_nr, PageIndex::new(index, pages), lock);
*self = PageLookup::Mutable(index, page_nr);
page_nr
}
}
PageLookup::Invalid => {
let page_nr = find_page_mut(root_nr, PageIndex::new(index, pages), lock);
*self = PageLookup::Mutable(index, page_nr);
page_nr
}
};
lock.try_page_mut(page_nr).unwrap()
}
}
fn find_page(page_nr: PageNr, index: PageIndex, lock: &Lock) -> PageNr {
if index.is_indirect() {
find_page(
cast_ref::<Page, IndirectPage>(unsafe { lock.page(page_nr) })[index.index()],
index.child(),
lock,
)
} else {
page_nr
}
}
fn find_page_mut(page_nr: &mut PageNr, index: PageIndex, lock: &Lock) -> PageNr {
let page = unsafe { lock.page_mut(page_nr) };
if index.is_indirect() {
find_page_mut(
&mut cast_mut::<Page, IndirectPage>(page)[index.index()],
index.child(),
lock,
)
} else {
*page_nr
}
}
impl PageLevel {
pub const fn is_indirect(self) -> bool {
match self {
Self::L0 => false,
Self::L1 => true,
Self::L2 => true,
}
}
pub fn from_pages(pages: usize) -> Option<Self> {
match pages {
0 => None,
1 => Some(Self::L0),
2..=2048 => Some(Self::L1),
2049..=4194304 => Some(Self::L2),
_ => panic!(),
}
}
pub const fn child(self) -> Option<Self> {
match self {
Self::L0 => None,
Self::L1 => Some(Self::L0),
Self::L2 => Some(Self::L1),
}
}
pub fn parent(this: Option<Self>) -> Self {
match this {
None => Self::L0,
Some(Self::L0) => Self::L1,
Some(Self::L1) => Self::L2,
Some(Self::L2) => panic!(),
}
}
pub const fn child_pages(self) -> usize {
match self {
Self::L0 => 0,
Self::L1 => 1,
Self::L2 => 2048,
}
}
}
pub fn reallocate(root_nr: &mut PageNr, mut current_pages: usize, new_pages: usize, lock: &Lock) {
let mut current_root_level = PageLevel::from_pages(current_pages);
let new_root_level = PageLevel::from_pages(new_pages);
while current_root_level < new_root_level {
increment_levels(root_nr, &mut current_pages, &mut current_root_level, lock);
}
while current_root_level > new_root_level {
decrement_levels(root_nr, &mut current_pages, &mut current_root_level, lock);
}
match current_pages.cmp(&new_pages) {
std::cmp::Ordering::Less => {
allocate(
root_nr,
current_pages,
new_pages,
current_root_level.unwrap(),
lock,
);
}
std::cmp::Ordering::Equal => {}
std::cmp::Ordering::Greater => {
deallocate_from(root_nr, new_pages, current_root_level.unwrap(), lock)
}
}
}
fn increment_levels(
root_nr: &mut PageNr,
pages: &mut usize,
current_root_level: &mut Option<PageLevel>,
lock: &Lock,
) {
let mut new_root_nr = 0;
let page = unsafe { lock.page_mut(&mut new_root_nr) };
let next_root_level = PageLevel::parent(*current_root_level);
if let Some(level) = *current_root_level {
allocate(root_nr, *pages, next_root_level.child_pages(), level, lock);
}
cast_mut::<Page, IndirectPage>(page)[0] = *root_nr;
*root_nr = new_root_nr;
*pages = next_root_level.child_pages();
*current_root_level = Some(next_root_level);
}
fn decrement_levels(
root_nr: &mut PageNr,
pages: &mut usize,
current_root_level: &mut Option<PageLevel>,
lock: &Lock,
) {
let root_level = (*current_root_level).unwrap();
let new_root_nr = if root_level.is_indirect() {
let page = unsafe { lock.page(*root_nr) };
cast_ref::<Page, IndirectPage>(page)[0]
} else {
NULL_PAGE_NR
};
deallocate_full(*root_nr, 1, root_level, lock);
*root_nr = new_root_nr;
*pages = root_level.child_pages();
*current_root_level = root_level.child();
}
fn allocate(page_nr: &mut PageNr, from: usize, to: usize, level: PageLevel, lock: &Lock) {
let page = unsafe { lock.page_mut(page_nr) };
if from == to {
return;
}
if level.is_indirect() {
let page = cast_mut::<Page, IndirectPage>(page);
let from_index = from / level.child_pages();
let to_index = to / level.child_pages();
let child_level = level.child().unwrap();
if from_index == to_index {
allocate(
&mut page[from_index],
from % level.child_pages(),
to % level.child_pages(),
child_level,
lock,
);
} else {
allocate(
&mut page[from_index],
from % level.child_pages(),
level.child_pages(),
child_level,
lock,
);
for child in page[from_index + 1..to_index].iter_mut() {
allocate_full(child, child_level, lock)
}
if to % level.child_pages() != 0 {
allocate(
&mut page[to_index],
0,
to % level.child_pages(),
child_level,
lock,
);
}
}
}
}
fn allocate_full(page_nr: &mut PageNr, level: PageLevel, lock: &Lock) {
let page = unsafe { lock.page_mut(page_nr) };
if level.is_indirect() {
let child_level = level.child().unwrap();
for page_nr in cast_mut::<Page, IndirectPage>(page).iter_mut() {
allocate_full(page_nr, child_level, lock);
}
}
}
fn deallocate_from(page_nr: &mut PageNr, from: usize, level: PageLevel, lock: &Lock) {
if level.is_indirect() {
let mut index = from / level.child_pages();
let child_from = from % level.child_pages();
if index == 0 && child_from == 0 {
deallocate_full(*page_nr, 0, level, lock);
*page_nr = NULL_PAGE_NR;
return;
}
let child_level = level.child().unwrap();
let page = cast_mut::<Page, IndirectPage>(unsafe { lock.page_mut(page_nr) });
deallocate_from(&mut page[index], child_from, child_level, lock);
index += 1;
while index < FAN_OUT && page[index] != NULL_PAGE_NR {
deallocate_full(page[index], 0, child_level, lock);
page[index] = NULL_PAGE_NR;
index += 1;
}
} else {
unsafe { lock.deallocate(*page_nr) };
*page_nr = NULL_PAGE_NR;
}
}
fn deallocate_full(page_nr: PageNr, mut index: usize, level: PageLevel, lock: &Lock) {
let page = unsafe { lock.page(page_nr) };
if level.is_indirect() {
let page = cast_ref::<Page, IndirectPage>(page);
while index < FAN_OUT && page[index] != NULL_PAGE_NR {
deallocate_full(page[index], 0, level.child().unwrap(), lock);
index += 1;
}
}
unsafe { lock.deallocate(page_nr) }
}
| 30.131195 | 98 | 0.521335 |
af259676a3e22f56fc0592518812442e203a5ce3 | 263 | swift | Swift | CustomTabView/CustomTabView/CustomTabViewApp.swift | luannguyen252/my-swift-journey | 788d66f256358dc5aefa2f3093ef74fd572e83b3 | [
"MIT"
] | 14 | 2020-12-09T08:53:39.000Z | 2021-12-07T09:15:44.000Z | CustomTabView/CustomTabView/CustomTabViewApp.swift | luannguyen252/my-swift-journey | 788d66f256358dc5aefa2f3093ef74fd572e83b3 | [
"MIT"
] | null | null | null | CustomTabView/CustomTabView/CustomTabViewApp.swift | luannguyen252/my-swift-journey | 788d66f256358dc5aefa2f3093ef74fd572e83b3 | [
"MIT"
] | 8 | 2020-12-10T05:59:26.000Z | 2022-01-03T07:49:21.000Z | //
// CustomTabViewApp.swift
// CustomTabView
//
// Created by Luan Nguyen on 07/12/2020.
//
import SwiftUI
@main
struct CustomTabViewApp: App {
// MARK: - BODY
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
| 13.842105 | 41 | 0.574144 |
75413869d46c93ee2aadae20901489f2468c0031 | 15,759 | cs | C# | Cameras/SOTTR/IGCSClient/Controls/HotsamplingPage.xaml.cs | ghostinthecamera/InjectableGenericCameraSystem | f4de55ab8fa58a479834b8b6586171f82b3d6b08 | [
"BSD-2-Clause"
] | 623 | 2016-12-02T16:01:05.000Z | 2022-03-29T19:59:10.000Z | Cameras/SOTTR/IGCSClient/Controls/HotsamplingPage.xaml.cs | AmyChocolates/InjectableGenericCameraSystem | 0b686603cdaf93184146e1b9e0c8400015e47137 | [
"BSD-2-Clause"
] | 113 | 2016-12-10T17:34:24.000Z | 2022-02-06T21:59:42.000Z | Cameras/SOTTR/IGCSClient/Controls/HotsamplingPage.xaml.cs | AmyChocolates/InjectableGenericCameraSystem | 0b686603cdaf93184146e1b9e0c8400015e47137 | [
"BSD-2-Clause"
] | 232 | 2016-12-17T06:32:08.000Z | 2022-03-27T16:51:29.000Z | ////////////////////////////////////////////////////////////////////////////////////////////////////////
// Part of Injectable Generic Camera System
// Copyright(c) 2020, Frans Bouma
// All rights reserved.
// https://github.com/FransBouma/InjectableGenericCameraSystem
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met :
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and / or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
////////////////////////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Input;
using IGCSClient.Classes;
using IGCSClient.GameSpecific.Classes;
using ModernWpf.Controls;
using DataObject = System.Windows.DataObject;
using UserControl = System.Windows.Controls.UserControl;
namespace IGCSClient.Controls
{
/// <summary>
/// Interaction logic for HotsamplingPage.xaml
/// </summary>
public partial class HotsamplingPage : UserControl
{
#region Members
private WINDOWINFO _gameWindowInfo;
private IntPtr _gameWindowHwnd;
private Timer _resolutionRefreshTimer;
private Resolution _monitorResolution;
#endregion
public HotsamplingPage()
{
InitializeComponent();
_resolutionRefreshTimer = new Timer() { Interval = 1000};
_resolutionRefreshTimer.Tick += _resolutionRefreshTimer_Tick;
DataObject.AddCopyingHandler(_newHeightBox, (s, e) => { if (e.IsDragDrop) e.CancelCommand(); });
DataObject.AddCopyingHandler(_newWidthBox, (s, e) => { if (e.IsDragDrop) e.CancelCommand(); });
}
public void BindData()
{
GetActiveGameWindowInfo();
// game window hwnd is set in getactivegamewindowinfo.
// Use Windows Forms. This app is opt-in on high dpi awareness, so the values should be correct. This high-dpi awareness will fuck up winforms controls but we're
// not using these so it's ok. It's otherwise a PITA to get the monitor resolution of the monitor the window is on!
var screenWithGameWindow = Screen.FromHandle(_gameWindowHwnd);
BuildResolutionTree(screenWithGameWindow.Bounds);
_resolutionRefreshTimer.Enabled = true;
this.RecentlyUserResolutions = new ObservableCollection<Resolution>(AppStateSingleton.Instance().RecentlyUsedResolutions);
_recentlyUsedResolutionsList.ItemsSource = this.RecentlyUserResolutions;
}
private void BuildResolutionTree(System.Drawing.Rectangle screenBounds)
{
var arOfScreen = GeneralUtils.CalculateAspectRatio(screenBounds.Width, screenBounds.Height);
arOfScreen.Description = "Monitor aspect ratio";
_monitorResolution = new Resolution(arOfScreen, screenBounds.Width, screenBounds.Height,
string.Format("{0} x {1} ({2})", screenBounds.Width, screenBounds.Height, arOfScreen.ToString(false)));
// default ARs
var defaultARs = new List<AspectRatio>()
{
new AspectRatio(16, 9), new AspectRatio(16, 10), new AspectRatio(21, 9), new AspectRatio(1, 1),
new AspectRatio(9, 16), new AspectRatio(2, 3), new AspectRatio(3, 2), new AspectRatio(2, 1), new AspectRatio(3, 4), new AspectRatio(4, 5)
};
// remove the one we already have determined from the monitor (if present)
defaultARs.Remove(arOfScreen);
var resolutions = new List<Resolution>();
// first the resolutions based on the screen resolution
AddResolutionsForAspectRatio(resolutions, screenBounds.Width, screenBounds.Height, arOfScreen);
// then the resolutions calculated from the aspect ratios in the list.
foreach(var ar in defaultARs)
{
if(ar.Horizontal <= ar.Vertical)
{
// use height instead of width so the full shot can be setup on the lowest res
AddResolutionsForAspectRatio(resolutions, (int)(screenBounds.Height * ar.ARFactorWidth), screenBounds.Height, ar);
}
else
{
AddResolutionsForAspectRatio(resolutions, screenBounds.Width, (int)(screenBounds.Width * ar.ARFactorHeight), ar);
}
}
_resolutionTreeView.ItemsSource = resolutions.GroupBy(r => r.AR.ToString());
}
private void AddResolutionsForAspectRatio(List<Resolution> resolutions, int initialWidth, int initialHeight, AspectRatio ar)
{
for(decimal i = 1; i < 6; i++)
{
resolutions.Add(GetResolutionForAR(initialWidth, initialHeight, ar, i));
resolutions.Add(GetResolutionForAR(initialWidth, initialHeight, ar, i + 0.25m));
resolutions.Add(GetResolutionForAR(initialWidth, initialHeight, ar, i + 0.5m));
resolutions.Add(GetResolutionForAR(initialWidth, initialHeight, ar, i + 0.75m));
}
}
private Resolution GetResolutionForAR(int width, int height, AspectRatio ar, decimal factor)
{
int newWidth = (int)(width * factor);
int newHeight = (int)(height * factor);
return new Resolution(ar, newWidth, newHeight, string.Format("{0} x {1} ({2:##.##}x)", newWidth, newHeight, factor));
}
private void PerformHotSampling()
{
if(_newWidthBox.Value < 100 || _newHeightBox.Value < 100)
{
return;
}
if((Win32Wrapper.IsIconic(_gameWindowHwnd) || Win32Wrapper.IsZoomed(_gameWindowHwnd)))
{
Win32Wrapper.ShowWindow(_gameWindowHwnd, Win32Wrapper.SW_SHOWNOACTIVATE);
}
int newHorizontalResolution = (int)_newWidthBox.Value;
int newVerticalResolution = (int)_newHeightBox.Value;
// always set the window at (0,0), if width is >= screen width.
var screenBounds = Screen.FromHandle(_gameWindowHwnd).Bounds;
uint uFlags = Win32Wrapper.SWP_NOZORDER | Win32Wrapper.SWP_NOACTIVATE | Win32Wrapper.SWP_NOOWNERZORDER | Win32Wrapper.SWP_NOSENDCHANGING;
if(newHorizontalResolution < screenBounds.Width)
{
// let the window be where it is.
uFlags |= Win32Wrapper.SWP_NOMOVE;
}
Win32Wrapper.SetWindowPos(_gameWindowHwnd, 0, 0, 0, newHorizontalResolution, newVerticalResolution, uFlags);
if(GameSpecificConstants.HotsamplingRequiresEXITSIZEMOVE)
{
// A warning of unreachable code will be raised here, that's ok. this code is only used when the constant is true
Win32Wrapper.SendMessage(_gameWindowHwnd, Win32Wrapper.WM_EXITSIZEMOVE, 0, 0);
}
LogHandlerSingleton.Instance().LogLine("Switching resolution on window with hwnd 0x{0} to resolution {1}x{2}", "Hotsampler", _gameWindowHwnd.ToString("x"),
newHorizontalResolution, newVerticalResolution);
// remove / add borders
uint nStyle = (uint)Win32Wrapper.GetWindowLong(_gameWindowHwnd, Win32Wrapper.GWL_STYLE);
nStyle = (nStyle | (Win32Wrapper.WS_THICKFRAME + Win32Wrapper.WS_DLGFRAME + Win32Wrapper.WS_BORDER + Win32Wrapper.WS_MAXIMIZEBOX + Win32Wrapper.WS_MINIMIZEBOX));
if(_useWindowBordersCheckBox.IsChecked==false)
{
nStyle^=(Win32Wrapper.WS_THICKFRAME + Win32Wrapper.WS_DLGFRAME + Win32Wrapper.WS_BORDER + Win32Wrapper.WS_MAXIMIZEBOX + Win32Wrapper.WS_MINIMIZEBOX);
}
Win32Wrapper.SetWindowLong(_gameWindowHwnd, Win32Wrapper.GWL_STYLE, nStyle);
uFlags = Win32Wrapper.SWP_NOSIZE | Win32Wrapper.SWP_NOMOVE | Win32Wrapper.SWP_NOZORDER | Win32Wrapper.SWP_NOACTIVATE | Win32Wrapper.SWP_NOOWNERZORDER | Win32Wrapper.SWP_NOSENDCHANGING | Win32Wrapper.SWP_FRAMECHANGED;
Win32Wrapper.SetWindowPos(_gameWindowHwnd, 0, 0, 0, 0, 0, uFlags);
AddResolutionToRecentlyUsedList(newHorizontalResolution, newVerticalResolution);
if(_switchAfterResizingCheckBox.IsChecked==true)
{
// focus the attached application's window
Win32Wrapper.SetForegroundWindow(_gameWindowHwnd);
}
}
private void AddResolutionToRecentlyUsedList(int horizontalResolution, int verticalResolution)
{
// Base the aspect ratio on the string representation we have constructed. This is a bit lame, but it can be the user changes the width or height
// manually after selecting a node in the tree so the ar has changed. Calculating it again from width/height is tempting but gives wrong results for
// 21:9 which isn't really 21:9 but 21.5:9 so the AR doesn't match anymore.
var ar = string.IsNullOrEmpty(_aspectRatioTextBox.Text) ? GeneralUtils.CalculateAspectRatio(horizontalResolution, verticalResolution)
: AspectRatio.FromString(_aspectRatioTextBox.Text);
var toAdd = new Resolution(ar, horizontalResolution, verticalResolution, string.Format("{0} x {1} ({2})", horizontalResolution, verticalResolution, ar));
this.RecentlyUserResolutions.Remove(toAdd); // if we've used this one before, remove it from the list as it will be placed at the front.
this.RecentlyUserResolutions.Insert(0, toAdd);
// remove any resolutions over the maximum. This is at most 1, as we're adding 1 at a time.
while(this.RecentlyUserResolutions.Count > ConstantsEnums.NumberOfResolutionsToKeep)
{
this.RecentlyUserResolutions.RemoveAt(ConstantsEnums.NumberOfResolutionsToKeep);
}
}
private void GetActiveGameWindowInfo()
{
_gameWindowHwnd = AppStateSingleton.Instance().GetMainWindowHandleOfAttachedProcess();
if(_gameWindowHwnd == IntPtr.Zero)
{
_currentWidthTextBox.Text = string.Empty;
_currentHeightTextBox.Text = string.Empty;
_currentARTextBox.Text = string.Empty;
return;
}
Win32Wrapper.GetWindowInfo(_gameWindowHwnd, ref _gameWindowInfo);
_currentWidthTextBox.Text = _gameWindowInfo.rcWindow.Width.ToString();
_currentHeightTextBox.Text = _gameWindowInfo.rcWindow.Height.ToString();
_currentARTextBox.Text = GeneralUtils.CalculateAspectRatio(_gameWindowInfo.rcWindow.Width, _gameWindowInfo.rcWindow.Height).ToString(appendDescription:false);
if(_newHeightBox.Value <= 0 || _newWidthBox.Value <= 0)
{
//reset with current window
_newHeightBox.Value = _gameWindowInfo.rcWindow.Height;
_newWidthBox.Value = _gameWindowInfo.rcWindow.Width;
_aspectRatioTextBox.Text = _currentARTextBox.Text;
}
}
private void HandleResolutionValueChanged()
{
int horizontalResolution = (int)_newWidthBox.Value;
int verticalResolution = (int)_newHeightBox.Value;
_setResolutionButton.IsEnabled = (horizontalResolution >= 640 && verticalResolution >= 480);
_aspectRatioTextBox.Text = GeneralUtils.CalculateAspectRatio(horizontalResolution, verticalResolution).ToString(appendDescription:false);
}
private void RepositionWindow(int newX, int newY)
{
if(_gameWindowHwnd == IntPtr.Zero)
{
return;
}
if((Win32Wrapper.IsIconic(_gameWindowHwnd) || Win32Wrapper.IsZoomed(_gameWindowHwnd)))
{
Win32Wrapper.ShowWindow(_gameWindowHwnd, Win32Wrapper.SW_SHOWNOACTIVATE);
}
uint uFlags = Win32Wrapper.SWP_NOSIZE | Win32Wrapper.SWP_NOZORDER | Win32Wrapper.SWP_NOACTIVATE | Win32Wrapper.SWP_NOOWNERZORDER | Win32Wrapper.SWP_NOSENDCHANGING | Win32Wrapper.SWP_FRAMECHANGED;
Win32Wrapper.SetWindowPos(_gameWindowHwnd, 0, newX, newY, 0, 0, uFlags);
}
private void _resolutionTreeView_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if(!(e.NewValue is Resolution))
{
// set to disabled.
return;
}
var selectedResolution = (Resolution)e.NewValue;
SetNewResolutionControlsWithValues(selectedResolution);
}
private void SetNewResolutionControlsWithValues(Resolution selectedResolution)
{
_newHeightBox.Value = selectedResolution.VerticalResolution;
_newWidthBox.Value = selectedResolution.HorizontalResolution;
_aspectRatioTextBox.Text = selectedResolution.AR.ToString(appendDescription: false);
}
private void _setResolutionButton_OnClick(object sender, RoutedEventArgs e)
{
PerformHotSampling();
}
private void _newWidthBox_OnValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args)
{
_newWidthBox.Value = GeneralUtils.ClampNaN(args.OldValue, args.NewValue);
HandleResolutionValueChanged();
}
private void _newHeightBox_OnValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args)
{
_newHeightBox.Value = GeneralUtils.ClampNaN(args.OldValue, args.NewValue);
HandleResolutionValueChanged();
}
private void _resolutionRefreshTimer_Tick(object sender, EventArgs e)
{
GetActiveGameWindowInfo();
}
private void _switchToGameWindowButton_OnClick(object sender, RoutedEventArgs e)
{
// focus the attached application's window
Win32Wrapper.SetForegroundWindow(_gameWindowHwnd);
}
private void _refreshButton_OnClick(object sender, RoutedEventArgs e)
{
GetActiveGameWindowInfo();
var screenWithGameWindow = Screen.FromHandle(_gameWindowHwnd);
BuildResolutionTree(screenWithGameWindow.Bounds);
}
private void _recentlyUsedResolutionsList_OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var item = ItemsControl.ContainerFromElement(_recentlyUsedResolutionsList, e.OriginalSource as DependencyObject) as ListBoxItem;
if (item != null)
{
SetNewResolutionControlsWithValues((Resolution)item.Content);
_recentlyUsedResolutionsFlyout.Hide();
PerformHotSampling();
}
}
private void _fakeFullScreen_OnClick(object sender, RoutedEventArgs e)
{
SetNewResolutionControlsWithValues(_monitorResolution);
PerformHotSampling();
}
private void _leftAlignButton_Click(object sender, RoutedEventArgs e)
{
RepositionWindow(0, _gameWindowInfo.rcWindow.top);
}
private void _rightAlignButton_Click(object sender, RoutedEventArgs e)
{
var screenWithGameWindow = Screen.FromHandle(_gameWindowHwnd);
RepositionWindow(screenWithGameWindow.Bounds.Width-_gameWindowInfo.rcWindow.Width, _gameWindowInfo.rcWindow.top);
}
private void _topAlignButton_Click(object sender, RoutedEventArgs e)
{
RepositionWindow(_gameWindowInfo.rcWindow.left, 0);
}
private void _bottomAlignButton_Click(object sender, RoutedEventArgs e)
{
var screenWithGameWindow = Screen.FromHandle(_gameWindowHwnd);
RepositionWindow(_gameWindowInfo.rcWindow.left, screenWithGameWindow.Bounds.Height-_gameWindowInfo.rcWindow.Height);
}
private void _horizontalCenterAlignButton_Click(object sender, RoutedEventArgs e)
{
var screenWithGameWindow = Screen.FromHandle(_gameWindowHwnd);
RepositionWindow((screenWithGameWindow.Bounds.Width-_gameWindowInfo.rcWindow.Width)/2, _gameWindowInfo.rcWindow.top);
}
private void _verticalCenterAlignButton_Click(object sender, RoutedEventArgs e)
{
var screenWithGameWindow = Screen.FromHandle(_gameWindowHwnd);
RepositionWindow(_gameWindowInfo.rcWindow.left, (screenWithGameWindow.Bounds.Height-_gameWindowInfo.rcWindow.Height)/2);
}
#region Properties
public ObservableCollection<Resolution> RecentlyUserResolutions { get; set; }
#endregion
}
}
| 41.471053 | 219 | 0.756266 |
4ab65a4056ebec2997c2e25fd5ac5bcfe6d2c2d0 | 7,477 | cs | C# | O3656 Sharepoint/O3656-7 Deep Dive into Business Connectivity Services in Office 365/Lab Files/MiniCRMApp/MiniCRMAppWeb/Controllers/HomeController.cs | patbosc/officedevts2015 | c2d55907886cbf53ed7340e639f6fde808451d46 | [
"MIT"
] | 2 | 2020-11-10T08:37:40.000Z | 2021-08-30T21:20:22.000Z | O3656 Sharepoint/O3656-7 Deep Dive into Business Connectivity Services in Office 365/Lab Files/MiniCRMApp/MiniCRMAppWeb/Controllers/HomeController.cs | patbosc/officedevts2015 | c2d55907886cbf53ed7340e639f6fde808451d46 | [
"MIT"
] | null | null | null | O3656 Sharepoint/O3656-7 Deep Dive into Business Connectivity Services in Office 365/Lab Files/MiniCRMApp/MiniCRMAppWeb/Controllers/HomeController.cs | patbosc/officedevts2015 | c2d55907886cbf53ed7340e639f6fde808451d46 | [
"MIT"
] | 2 | 2020-04-17T15:05:11.000Z | 2020-11-17T19:03:44.000Z | using Microsoft.SharePoint.Client;
using MiniCRMAppWeb.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Xml.Linq;
namespace MiniCRMAppWeb.Controllers
{
public class HomeController : Controller
{
[SharePointContextFilter]
public async Task<ActionResult> Index(Customer customer)
{
if (customer.LastName != null)
{
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
string accessToken = spContext.UserAccessTokenForSPHost;
string connectionString = "[YOUR CONNECTION STRING]";
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
//Add new record
StringBuilder sql = new StringBuilder();
sql.Append("INSERT INTO Customers (FirstName, LastName, Company, WorkPhone, HomePhone, EmailAddress) ");
sql.Append("VALUES ('");
sql.Append(customer.FirstName);
sql.Append("','");
sql.Append(customer.LastName);
sql.Append("','");
sql.Append(customer.Company);
sql.Append("','");
sql.Append(customer.WorkPhone);
sql.Append("','");
sql.Append(customer.HomePhone);
sql.Append("','");
sql.Append(customer.EmailAddress);
sql.Append("')");
SqlCommand updateCommand = new SqlCommand(sql.ToString(), connection);
updateCommand.ExecuteNonQuery();
//Get the ID for the new record
SqlCommand idCommand = new SqlCommand(
"SELECT ID FROM Customers WHERE LastName='" + customer.LastName + "' AND FirstName='" + customer.FirstName + "'",
connection);
object newId = idCommand.ExecuteScalar();
//Get all endpoints
SqlCommand deliveryCommand =
new SqlCommand(
"SELECT DeliveryAddress, EventType FROM Subscriptions",
connection);
SqlDataReader deliveryReader = deliveryCommand.ExecuteReader();
if (deliveryReader.HasRows)
{
while (deliveryReader.Read())
{
//SharePoint Notification Endpoint
//"1" is item added, which is all this application does
if (deliveryReader.GetString(1) == "1")
{
//Build the request against the "Item Added" endpoint
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, deliveryReader.GetString(0));
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
request.Headers.Add("X-RequestDigest", await GetFormDigest());
StringContent message = new StringContent(NotifyBody("ID", newId.ToString()));
request.Content = message;
HttpResponseMessage response = await client.SendAsync(request);
string responseString = await response.Content.ReadAsStringAsync();
}
}
}
connection.Close();
}
}
return View();
}
private async Task<string> GetFormDigest()
{
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
string accessToken = spContext.UserAccessTokenForSPHost;
StringBuilder requestUri = new StringBuilder()
.Append(spContext.SPHostUrl)
.Append("_api/contextinfo");
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, requestUri.ToString());
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
HttpResponseMessage response = await client.SendAsync(request);
string responseString = await response.Content.ReadAsStringAsync();
XNamespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";
XElement root = XElement.Parse(responseString);
string digest = root.Descendants(d + "FormDigestValue").First().Value;
return digest;
}
private string NotifyBody(string CommaDelimitedIdentifierNames, string CommaDelimitedItemIds)
{
string format = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<feed xml:base=\"http://services.odata.org/OData/OData.svc/\"\r\nxmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\"\r\nxmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"\r\nxmlns:b=\"http://schemas.microsoft.com/bcs/2012/\"\r\nxmlns=\"http://www.w3.org/2005/Atom\">\r\n<title type=\"text\">Categories</title>\r\n<id>http://services.odata.org/OData/OData.svc/Categories</id>\r\n<updated>2010-03-10T08:38:14Z</updated>\r\n<link rel=\"self\" title=\"Categories\" href=\"Categories\" />\r\n<entry>\r\n<id>http://services.odata.org/OData/OData.svc/Categories(0)</id>\r\n<title type=\"text\">Food</title>\r\n<updated>2010-03-10T08:38:14Z</updated>\r\n<author>\r\n<name />\r\n</author>\r\n<link rel=\"edit\" title=\"Category\" href=\"Categories(0)\" />\r\n<link rel=\"http://schemas.microsoft.com/ado/2007/08/dataservices/related/Products\"\r\n type=\"application/atom+xml;type=feed\"\r\n title=\"Products\" href=\"Categories(0)/Products\" />\r\n<category term=\"ODataDemo.Category\"\r\n scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />\r\n<content type=\"application/xml\">\r\n<m:properties>\r\n<b:BcsItemIdentity m:type=\"Edm.String\">{0}</b:BcsItemIdentity>\r\n<d:Name>Food</d:Name>\r\n</m:properties>\r\n</content>\r\n</entry>\r\n<!-- <entry> elements representing additional Categories go here -->\r\n</feed>\r\n";
string[] identifierNames = CommaDelimitedIdentifierNames.Split(new char[] { ',' });
string[] itemId = CommaDelimitedItemIds.Split(new char[] { ',' });
StringBuilder idBldr = new StringBuilder();
for (int i = 0; i < identifierNames.Length; i++)
{
idBldr.AppendFormat("<{0}>{1}</{0}>", identifierNames[i], itemId[i].ToString());
}
return string.Format(format, idBldr.ToString());
}
}
}
| 50.181208 | 1,480 | 0.576836 |
9c7e58bda6abe69bcef0edbcf0118f459ec3903a | 9,012 | js | JavaScript | test/unit/vdom/elements.js | techbuzzz/skatejs | a4ea5b424fd4dc0616322b113a012c63a8e6e5ba | [
"MIT"
] | null | null | null | test/unit/vdom/elements.js | techbuzzz/skatejs | a4ea5b424fd4dc0616322b113a012c63a8e6e5ba | [
"MIT"
] | null | null | null | test/unit/vdom/elements.js | techbuzzz/skatejs | a4ea5b424fd4dc0616322b113a012c63a8e6e5ba | [
"MIT"
] | 1 | 2020-01-22T13:00:57.000Z | 2020-01-22T13:00:57.000Z | /* eslint-env jasmine, mocha */
import afterMutations from '../../lib/after-mutations';
import element from '../../lib/element';
import fixture from '../../lib/fixture';
import { symbols, vdom } from '../../../src/index';
describe('vdom/elements', () => {
describe('element()', () => {
describe('arguments', () => {
function create (render) {
const elem = new (element().skate({ render }))();
fixture(elem);
return elem;
}
function ctor (name) {
const Ctor = () => {};
Ctor[symbols.name] = name;
return Ctor;
}
it('(tagName)', (done) => {
const elem = create(() => vdom.element('div'));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
done
);
});
it('(Constructor)', (done) => {
const Ctor = ctor('div');
const elem = create(() => vdom.element(Ctor));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
done
);
});
it('(tagName, textContent)', (done) => {
const elem = create(() => vdom.element('div', 'text'));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
() => expect(elem.shadowRoot.firstChild.textContent).to.equal('text'),
done
);
});
it('(tagName, childrenFunction)', (done) => {
const elem = create(() => vdom.element('div', vdom.text.bind(null, 'text')));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
() => expect(elem.shadowRoot.firstChild.textContent).to.equal('text'),
done
);
});
it('(Contructor, textContent)', (done) => {
const Ctor = ctor('div');
const elem = create(() => vdom.element(Ctor, 'text'));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
() => expect(elem.shadowRoot.firstChild.textContent).to.equal('text'),
done
);
});
it('(Contructor, childrenFunction)', (done) => {
const Ctor = ctor('div');
const elem = create(() => vdom.element(Ctor, vdom.text.bind(null, 'text')));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
() => expect(elem.shadowRoot.firstChild.textContent).to.equal('text'),
done
);
});
it('tagName, attrsObject, textContent', (done) => {
const elem = create(() => vdom.element('div', { id: 'test' }, 'text'));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
() => expect(elem.shadowRoot.firstChild.id).to.equal('test'),
() => expect(elem.shadowRoot.firstChild.textContent).to.equal('text'),
done
);
});
it('tagName, attrsObject, childrenFunction', (done) => {
const elem = create(() => vdom.element('div', { id: 'test' }, vdom.text.bind(null, 'text')));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
() => expect(elem.shadowRoot.firstChild.id).to.equal('test'),
() => expect(elem.shadowRoot.firstChild.textContent).to.equal('text'),
done
);
});
it('Constructor, attrsObject, textContent', (done) => {
const Ctor = ctor('div');
const elem = create(() => vdom.element(Ctor, { id: 'test' }, 'text'));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
() => expect(elem.shadowRoot.firstChild.id).to.equal('test'),
() => expect(elem.shadowRoot.firstChild.textContent).to.equal('text'),
done
);
});
it('Constructor, attrsObject, childrenFunction', (done) => {
const Ctor = ctor('div');
const elem = create(() => vdom.element(Ctor, { id: 'test' }, vdom.text.bind(null, 'text')));
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.firstChild.tagName).to.equal('DIV'),
() => expect(elem.shadowRoot.firstChild.id).to.equal('test'),
() => expect(elem.shadowRoot.firstChild.textContent).to.equal('text'),
done
);
});
describe('attrsObject should accept null and not throw', () => {
it('null', () => {
expect(() => create(() => vdom.element('div', null))).to.not.throw();
});
});
});
});
it('passing a component constructor to the vdom.element() function', (done) => {
const Elem2 = element().skate({
render () {
vdom.text('rendered');
}
});
const Elem1 = element().skate({
render () {
vdom.element(Elem2);
}
});
const elem1 = new Elem1();
const elem2 = new Elem2();
fixture(elem1);
fixture(elem2);
fixture().appendChild(elem1);
afterMutations(
() => {}, // .render()
() => expect(elem2.shadowRoot.textContent).to.equal('rendered'),
done
);
});
describe('passing a function to the vdom.element() function (*part* notes where text or number was passed as children)', () => {
function testHelper (ch) {
it(`*div* > span > ${ch}`, (done) => {
const Span = (props, chren) => vdom.element('span', chren);
const Div = (props, chren) => vdom.element('div', () => vdom.element(Span, chren));
const Elem = element().skate({
render () {
vdom.element(Div, ch);
}
});
const elem = new Elem();
fixture().appendChild(elem);
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.innerHTML).to.equal(`<div><span>${ch}</span></div>`),
done
);
});
it(`div > *span* > ${ch}`, (done) => {
const Span = (props, chren) => vdom.element('span', chren);
const Div = () => vdom.element('div', () => vdom.element(Span, ch));
const Elem = element().skate({
render () {
vdom.element(Div);
}
});
const elem = new Elem();
fixture().appendChild(elem);
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.innerHTML).to.equal(`<div><span>${ch}</span></div>`),
done
);
});
it(`div > span > *${ch}*`, (done) => {
const Span = () => vdom.element('span', ch);
const Div = () => vdom.element('div', () => vdom.element(Span));
const Elem = element().skate({
render () {
vdom.element(Div);
}
});
const elem = new Elem();
fixture().appendChild(elem);
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.innerHTML).to.equal(`<div><span>${ch}</span></div>`),
done
);
});
}
['text', 1].forEach(testHelper);
it('*ul* (items) > li > a > text', (done) => {
const Li = (props, chren) => vdom.element('li', () => vdom.element('a', chren));
const Ul = props => vdom.element('ul', () => props.items.map(item => vdom.element(Li, item)));
const Elem = element().skate({
render () {
vdom.element(Ul, { items: ['Item 1', 'Item 2'] });
}
});
const elem = new Elem();
fixture().appendChild(elem);
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.innerHTML).to.equal('<ul><li><a>Item 1</a></li><li><a>Item 2</a></li></ul>'),
done
);
});
it('should pass through special attrs and not set them as attrs or props', (done) => {
const key = 'my-key';
const ref = () => {};
const statics = [];
const El = (props) => {
expect(props.key).to.equal(key, 'key');
expect(props.ref).to.equal(ref, 'ref');
expect(props.statics).to.equal(statics, 'statics');
vdom.element('div', { key, ref, statics });
};
const Elem = element().skate({
render () {
vdom.element(El, { key, ref, statics });
}
});
const elem = new Elem();
fixture().appendChild(elem);
afterMutations(
() => {}, // .render()
() => expect(elem.shadowRoot.innerHTML).to.equal('<div></div>'),
() => {
const div = elem.shadowRoot;
expect(div.key).to.equal(undefined);
expect(div.ref).to.equal(undefined);
expect(div.statics).to.equal(undefined);
},
done
);
});
});
});
| 32.890511 | 130 | 0.49767 |
8a2acc77a83a4aefd9b89219766c2df2a755ac3c | 2,606 | rs | Rust | src/material.rs | aggressivepixels/raytracing | 0255e41b02eed55194eb0e6e63cec721884c1150 | [
"Unlicense"
] | 2 | 2020-12-25T11:05:57.000Z | 2020-12-25T15:38:25.000Z | src/material.rs | aggressivepixels/raytracing | 0255e41b02eed55194eb0e6e63cec721884c1150 | [
"Unlicense"
] | null | null | null | src/material.rs | aggressivepixels/raytracing | 0255e41b02eed55194eb0e6e63cec721884c1150 | [
"Unlicense"
] | null | null | null | use super::object::Hit;
use super::ray::Ray;
use super::vec3::Vec3;
use rand::Rng;
#[derive(Copy, Clone)]
pub enum Material {
Lambertian(Vec3),
Metal(Vec3, f64),
Dielectric(f64),
}
impl Material {
pub fn scatter<R: Rng + ?Sized>(
&self,
ray: &Ray,
hit: &Hit,
rng: &mut R,
) -> Option<(Vec3, Ray)> {
match *self {
Material::Lambertian(albedo) => {
let direction = hit.normal + Vec3::random_in_unit_sphere(rng).normalize();
Some((
albedo,
Ray {
origin: hit.point,
direction: if direction.is_near_zero() {
hit.normal
} else {
direction
},
},
))
}
Material::Metal(albedo, fuzz) => {
let reflected = ray.direction.normalize().reflect(hit.normal)
+ fuzz * Vec3::random_in_unit_sphere(rng);
if reflected.dot(hit.normal) > 0.0 {
Some((
albedo,
Ray {
origin: hit.point,
direction: reflected,
},
))
} else {
None
}
}
Material::Dielectric(ir) => {
let refraction_ratio = if hit.front_face { 1.0 / ir } else { ir };
let unit_direction = ray.direction.normalize();
let cos_theta = f64::min(Vec3::dot(-unit_direction, hit.normal), 1.0);
let sin_theta = f64::sqrt(1.0 - cos_theta * cos_theta);
let cannot_refract = refraction_ratio * sin_theta > 1.0;
let direction = if cannot_refract
|| reflectance(cos_theta, refraction_ratio) > rng.gen::<f64>()
{
unit_direction.reflect(hit.normal)
} else {
unit_direction.refract(hit.normal, refraction_ratio)
};
Some((
Vec3(1.0, 1.0, 1.0),
Ray {
origin: hit.point,
direction,
},
))
}
}
}
}
fn reflectance(cos: f64, ref_idx: f64) -> f64 {
let r = f64::powi((1.0 - ref_idx) / (1.0 + ref_idx), 2);
return r + (1.0 - r) * f64::powi(1.0 - cos, 5);
}
| 30.302326 | 90 | 0.407521 |
4c35282f2d2b923d825ee70a5c9fa1e563d23a83 | 1,064 | php | PHP | views/bankdetails/transaccion.php | CrissAlejo/cashbook1 | 594977918cbbd831fdd065eb65249baebea7975e | [
"BSD-3-Clause"
] | null | null | null | views/bankdetails/transaccion.php | CrissAlejo/cashbook1 | 594977918cbbd831fdd065eb65249baebea7975e | [
"BSD-3-Clause"
] | null | null | null | views/bankdetails/transaccion.php | CrissAlejo/cashbook1 | 594977918cbbd831fdd065eb65249baebea7975e | [
"BSD-3-Clause"
] | null | null | null | <?php
/* @var $model2 app\models\BankdetailsSearch */
?>
<table class="table table-striped table-bordered ">
<thead class="bg-white">
<tr>
<td>Emision</td>
<td>Comprobante</td>
<td>Persona</td>
<td>Transaccion</td>
<td>Cuenta</td>
<td>Total</td>
</tr>
</thead>
<tbody>
<?php
use yii\helpers\Html;
use yii\helpers\Url;
foreach($transaccion as $tran):?>
<tr>
<?php
$tipo=\app\models\Charges::findOne($tran->id_charge);
$person=\app\models\Person::findOne($tipo->person_id);
$chart=\app\models\ChartAccounts::findOne($tran->chart_account);
yii::debug($chart)
?>
<td><?= $tran->date ?></td>
<td><?= HTML::a($tran->comprobante,Url::to(["detail", "id"=>$tran->comprobante])) ?> </td>
<td><?= $person->name ?></td>
<td><?= $tipo->type_charge ?></td>
<td><?= $chart->code." ".$chart->slug ?></td>
<td><?= $tran->amount?></td>
</tr>
<?php endforeach?>
</tbody>
</table>
| 24.181818 | 98 | 0.515038 |
0a3feaf54eefdfdc4ac5e9480261c95da35c2025 | 1,793 | h | C | code_reading/oceanbase-master/src/sql/engine/px/exchange/ob_px_reduce_transmit.h | wangcy6/weekly_read | 3a8837ee9cd957787ee1785e4066dd623e02e13a | [
"Apache-2.0"
] | null | null | null | code_reading/oceanbase-master/src/sql/engine/px/exchange/ob_px_reduce_transmit.h | wangcy6/weekly_read | 3a8837ee9cd957787ee1785e4066dd623e02e13a | [
"Apache-2.0"
] | null | null | null | code_reading/oceanbase-master/src/sql/engine/px/exchange/ob_px_reduce_transmit.h | wangcy6/weekly_read | 3a8837ee9cd957787ee1785e4066dd623e02e13a | [
"Apache-2.0"
] | 1 | 2020-10-18T12:59:31.000Z | 2020-10-18T12:59:31.000Z | /**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#ifndef _OB_SQ_OB_PX_REDUCE_TRANSMIT_H_
#define _OB_SQ_OB_PX_REDUCE_TRANSMIT_H_
#include "sql/engine/px/exchange/ob_px_transmit.h"
namespace oceanbase {
namespace sql {
class ObPxReduceTransmitInput : public ObPxTransmitInput {
public:
OB_UNIS_VERSION_V(1);
public:
ObPxReduceTransmitInput() : ObPxTransmitInput()
{}
virtual ~ObPxReduceTransmitInput()
{}
virtual ObPhyOperatorType get_phy_op_type() const
{
return PHY_PX_REDUCE_TRANSMIT;
}
};
class ObPxReduceTransmit : public ObPxTransmit {
public:
class ObPxReduceTransmitCtx : public ObPxTransmitCtx {
public:
friend class ObPxReduceTransmit;
public:
explicit ObPxReduceTransmitCtx(ObExecContext& ctx);
virtual ~ObPxReduceTransmitCtx();
};
public:
explicit ObPxReduceTransmit(common::ObIAllocator& alloc);
virtual ~ObPxReduceTransmit();
protected:
virtual int inner_open(ObExecContext& ctx) const;
virtual int do_transmit(ObExecContext& ctx) const override;
virtual int inner_close(ObExecContext& exec_ctx) const;
virtual int init_op_ctx(ObExecContext& ctx) const;
virtual int create_operator_input(ObExecContext& ctx) const;
};
} // namespace sql
} // namespace oceanbase
#endif /* _OB_SQ_OB_PX_REDUCE_TRANSMIT_H_ */
//// end of header file
| 28.460317 | 88 | 0.761294 |
e54513b85c1d0a49c6b1580ea01c85e8994a1400 | 574 | ts | TypeScript | ApiServer/src/feedback/feedback.controller.ts | ProteaNetwork/Protea-Gather | 8758f24cd72247451d3c5afc13bb5995b59af95b | [
"MIT"
] | 2 | 2019-06-05T19:29:28.000Z | 2019-08-14T12:18:10.000Z | ApiServer/src/feedback/feedback.controller.ts | ProteaNetwork/Protea-Gather | 8758f24cd72247451d3c5afc13bb5995b59af95b | [
"MIT"
] | 5 | 2020-07-17T04:07:51.000Z | 2022-02-12T11:06:32.000Z | ApiServer/src/feedback/feedback.controller.ts | ProteaNetwork/protea-gather | 8758f24cd72247451d3c5afc13bb5995b59af95b | [
"MIT"
] | null | null | null | import { Controller, Post, UseGuards, Body, Param } from '@nestjs/common';
import { FeedbackService } from './feedback.service';
import { AuthGuard } from '@nestjs/passport';
@Controller('feedback')
export class FeedbackController {
constructor(private readonly feedbackService: FeedbackService){}
@Post('/:networkId')
@UseGuards(AuthGuard('jwt'))
async forwardFeedback(@Body() bodyData: {feedback: string, browser: string, address: string}, @Param('networkId') networkId: number){
return await this.feedbackService.forwardFeedback(bodyData, networkId);
}
}
| 38.266667 | 135 | 0.743902 |
e7a1b2e1529271379a2b25b063c3d67cbc6ae348 | 6,281 | lua | Lua | SVUI_!Core/system/_reports/azerite.lua | FailcoderAddons/supervillain-ui | 04ad89eef9d19659f804346d7baa4fe5d4cd619a | [
"MIT"
] | 38 | 2016-10-25T23:09:31.000Z | 2020-09-18T15:33:19.000Z | SVUI_!Core/system/_reports/azerite.lua | FailcoderAddons/supervillain-ui | 04ad89eef9d19659f804346d7baa4fe5d4cd619a | [
"MIT"
] | 223 | 2016-10-26T15:36:36.000Z | 2021-06-26T12:33:39.000Z | SVUI_!Core/system/_reports/azerite.lua | failcoder/supervillain-ui | 04ad89eef9d19659f804346d7baa4fe5d4cd619a | [
"MIT"
] | 24 | 2016-10-26T06:21:41.000Z | 2020-11-23T10:49:25.000Z | --[[
##############################################################################
S V U I By: Failcoder
##############################################################################
##########################################################
LOCALIZED LUA FUNCTIONS
##########################################################
]]--
--[[ GLOBALS ]]--
local _G = _G;
local select = _G.select;
local pairs = _G.pairs;
local ipairs = _G.ipairs;
local type = _G.type;
local error = _G.error;
local pcall = _G.pcall;
local assert = _G.assert;
local tostring = _G.tostring;
local tonumber = _G.tonumber;
local string = _G.string;
local math = _G.math;
local table = _G.table;
--[[ STRING METHODS ]]--
local lower, upper = string.lower, string.upper;
local find, format, len, split = string.find, string.format, string.len, string.split;
local match, sub, join = string.match, string.sub, string.join;
local gmatch, gsub = string.gmatch, string.gsub;
--[[ MATH METHODS ]]--
local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic
--[[ TABLE METHODS ]]--
local twipe, tsort = table.wipe, table.sort;
--[[
##########################################################
GET ADDON DATA
##########################################################
]]--
local SV = select(2, ...)
local L = SV.L
local Reports = SV.Reports;
--[[
##########################################################
UTILITIES
##########################################################
]]--
local percColors = {
"|cff0CD809",
"|cffE8DA0F",
"|cffFF9000",
"|cffD80909"
}
local function SetTooltipText(report)
Reports:SetDataTip(report);
Reports.ToolTip:AddLine(L["Heart of Azeroth"]);
Reports.ToolTip:AddLine(" ");
local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem();
if (not azeriteItemLocation) then
Reports.ToolTip:AddDoubleLine(L["No Heart of Azeroth"]);
return;
end
local xp, totalLevelXP = C_AzeriteItem.GetAzeriteItemXPInfo(azeriteItemLocation);
local currentLevel = C_AzeriteItem.GetPowerLevel(azeriteItemLocation);
local xpToNextLevel = totalLevelXP - xp;
local calc1 = (xp / totalLevelXP) * 100;
Reports.ToolTip:AddDoubleLine(L["Current Level:"], (" %d "):format(currentLevel), 1, 1, 1);
Reports.ToolTip:AddDoubleLine(L["Current Artifact Power:"], (" %s / %s (%d%%)"):format(BreakUpLargeNumbers(xp), BreakUpLargeNumbers(totalLevelXP), calc1), 1, 1, 1);
Reports.ToolTip:AddDoubleLine(L["Remaining:"], (" %s "):format(BreakUpLargeNumbers(xpToNextLevel)), 1, 1, 1);
end
local function FormatPower(level, currXP, totalLevel, nextLevel)
local calc1 = (currXP / totalLevel) * 100;
local currentText = ("Level: %d (%s%d%%|r)"):format(level, percColors[calc1 >= 75 and 1 or (calc1 >= 50 and calc1 < 75) and 2 or (calc1 >= 25 and calc1 < 50) and 3 or (calc1 >= 0 and calc1 < 25) and 4], calc1);
return currentText;
end
--[[
##########################################################
REPORT TEMPLATE
##########################################################
]]--
local REPORT_NAME = "Azerite";
local HEX_COLOR = "22FFFF";
--SV.media.color.green
--SV.media.color.normal
--r, g, b = 0.8, 0.8, 0.8
--local c = SV.media.color.green
--r, g, b = c[1], c[2], c[3]
local Report = Reports:NewReport(REPORT_NAME, {
type = "data source",
text = REPORT_NAME .. " Info",
icon = [[Interface\Addons\SVUI_!Core\assets\icons\SVUI]]
});
Report.events = {"PLAYER_ENTERING_WORLD", "AZERITE_ITEM_EXPERIENCE_CHANGED"};
Report.OnEvent = function(self, event, ...)
if (event == "AZERITE_ITEM_EXPERIENCE_CHANGED") then
ReportBar.Populate(self);
end
end
Report.Populate = function(self)
if self.barframe:IsShown() then
self.text:SetAllPoints(self);
self.text:SetJustifyH("CENTER");
self.barframe:Hide();
end
local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem();
if (not azeriteItemLocation) then
Reports.ToolTip:AddDoubleLine(L["No Heart of Azeroth"]);
return;
end
local xp, totalLevelXP = C_AzeriteItem.GetAzeriteItemXPInfo(azeriteItemLocation);
local currentLevel = C_AzeriteItem.GetPowerLevel(azeriteItemLocation);
local xpToNextLevel = totalLevelXP - xp;
local text = FormatPower(currentLevel, xp, totalLevelXP, xpToNextLevel);
self.text:SetText(text);
end
Report.OnEnter = function(self)
SetTooltipText(self);
Reports:ShowDataTip();
end
Report.OnInit = function(self)
if(not self.InnerData) then
self.InnerData = {};
end
Report.Populate(self);
end
--[[
##########################################################
BAR TYPE
##########################################################
]]--
local BAR_NAME = "Azerite Bar";
local ReportBar = Reports:NewReport(BAR_NAME, {
type = "data source",
text = BAR_NAME,
icon = [[Interface\Addons\SVUI_!Core\assets\icons\SVUI]]
});
ReportBar.events = {"PLAYER_ENTERING_WORLD", "AZERITE_ITEM_EXPERIENCE_CHANGED"};
ReportBar.OnEvent = function(self, event, ...)
if (event == "AZERITE_ITEM_EXPERIENCE_CHANGED") then
ReportBar.Populate(self);
end
end
ReportBar.Populate = function(self)
if (not self.barframe:IsShown())then
self.barframe:Show();
self.barframe.icon.texture:SetTexture(SV.media.dock.azeriteLabel);
end
local bar = self.barframe.bar;
local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem();
if (not azeriteItemLocation) then
bar:SetMinMaxValues(0, 1);
bar:SetValue(0);
self.text:SetText(L["No Heart of Azeroth"]);
return;
end
local xp, totalLevelXP = C_AzeriteItem.GetAzeriteItemXPInfo(azeriteItemLocation);
local currentLevel = C_AzeriteItem.GetPowerLevel(azeriteItemLocation);
local xpToNextLevel = totalLevelXP - xp;
bar:SetMinMaxValues(0, totalLevelXP);
bar:SetValue(xp);
bar:SetStatusBarColor(0.9, 0.64, 0.37);
local toSpend = "Level "..currentLevel;
self.text:SetText(toSpend);
self.barframe:Show();
end
ReportBar.OnEnter = function(self)
SetTooltipText(self);
Reports:ShowDataTip();
end
ReportBar.OnInit = function(self)
if(not self.InnerData) then
self.InnerData = {};
end
ReportBar.Populate(self);
if (not self.barframe:IsShown())then
self.barframe:Show();
self.barframe.icon.texture:SetTexture(SV.media.dock.azeriteLabel);
end
end
| 30.490291 | 211 | 0.61901 |
0bd8094151461a5183f74f1669c26b0fff397ba0 | 1,419 | js | JavaScript | files/public/js/exam.mobile.js | anyunpu/phpems | 6582e50ddc07a4b1cd51907e026a46355822e936 | [
"MIT"
] | 27 | 2018-10-23T16:15:55.000Z | 2022-02-14T06:53:58.000Z | files/public/js/exam.mobile.js | anyunpu/phpems | 6582e50ddc07a4b1cd51907e026a46355822e936 | [
"MIT"
] | null | null | null | files/public/js/exam.mobile.js | anyunpu/phpems | 6582e50ddc07a4b1cd51907e026a46355822e936 | [
"MIT"
] | 8 | 2019-02-17T04:16:52.000Z | 2021-11-10T12:38:46.000Z | var storage = window.localStorage;
var initData = {};
function setStorage(){
storage.setItem('questions',$.toJSON(initData));
}
function clearStorage()
{
storage.removeItem('questions');
}
function submitPaper()
{
$('#submodal').modal('hide');
$('#exampaper').submit();
}
function saveanswer(){
var params = $('#exampaper :input').serialize();
submitAjax({url:'index.php?exam-phone-index-ajax-saveUserAnswer',"query":params});
}
function markQuestions()
{
$('.order').removeClass("primary");
$('#exampaper :checked').each(function(){
var rel = $(this).attr('rel');
$('#sign_'+rel).addClass("primary");
});
$('#exampaper :text').each(function(){
if($(this).val().length > 0){
var rel = $(this).attr('rel');
$('#sign_'+rel).addClass("primary");
}
});
$('#exampaper textarea').each(function(){
if($(this).val().length > 0){
var rel = $(this).attr('rel');
$('#sign_'+rel).addClass("primary");
}
});
setStorage();
}
function favorquestion(questionid){
submitAjax({'url':"index.php?exam-phone-favor-ajax-addfavor&questionid="+questionid});
}
function delfavorquestion(questionid){
submitAjax({'url':"index.php?exam-phone-favor-ajax-delfavor&questionid="+questionid});
}
function errorport(questionid){
submitAjax({'url':"index.php?exam-phone-lesson-reporterror&questionid="+questionid});
} | 25.339286 | 89 | 0.624383 |
b99e014369463d33a8a0dc3c89e5975b42ab6be4 | 1,022 | h | C | src/Msg.h | maciejmalecki/shmesh | 589dac8e00433fdce4fb05b15299c678f031cfa4 | [
"MIT"
] | null | null | null | src/Msg.h | maciejmalecki/shmesh | 589dac8e00433fdce4fb05b15299c678f031cfa4 | [
"MIT"
] | null | null | null | src/Msg.h | maciejmalecki/shmesh | 589dac8e00433fdce4fb05b15299c678f031cfa4 | [
"MIT"
] | null | null | null | #ifndef Msg_h
#define Msg_h
#include "Arduino.h"
/*
* Buffer object that can be used for assembling messages.
*/
class Msg {
public:
/*
* Constructs new message buffer with given maximal length (in bytes).
*/
Msg(int _maxLength);
/*
* Destroys buffer objects and releases all memory.
*/
~Msg();
/*
* Returns current length of message buffer.
*/
int length();
/*
* Appends char array to the buffer.
*/
void append(char* data);
/*
* Appends number to the buffer.
*/
void append(int data);
/*
* Appends float value to the buffer.
*/
void append(float data, int width, int precision);
/*
* Clears message buffer. It can be now reused.
*/
void clear();
/*
* Returns pointer to the buffer's content.
*/
void* content();
private:
int maxLength;
int ptr;
void* buffer;
byte i2str(int i, char *buf);
};
#endif
| 19.653846 | 75 | 0.54501 |
e8552dab72b76b6c7c224e8fcdc2dc0b31681d3b | 76 | cpp | C++ | vr/test/gtest_smoke_test.cpp | vladimir-voinea/vr | 0af18898ee512a0f94be7609e19753b92da03775 | [
"MIT"
] | null | null | null | vr/test/gtest_smoke_test.cpp | vladimir-voinea/vr | 0af18898ee512a0f94be7609e19753b92da03775 | [
"MIT"
] | null | null | null | vr/test/gtest_smoke_test.cpp | vladimir-voinea/vr | 0af18898ee512a0f94be7609e19753b92da03775 | [
"MIT"
] | null | null | null | #include <gtest/gtest.h>
TEST(GTest, SmokeTest)
{
EXPECT_EQ(2, 1 + 1);
}
| 9.5 | 24 | 0.631579 |
3b3ce1f40a364bf7244cfb298c8259516fe00996 | 455 | asm | Assembly | asm/fpga_uart_send.asm | FKD13/RCPU | 1f27246494f60eaa2432470b2d218bb3f63578c7 | [
"MIT"
] | 17 | 2017-07-26T13:08:34.000Z | 2022-02-19T20:44:02.000Z | asm/fpga_uart_send.asm | FKD13/RCPU | 1f27246494f60eaa2432470b2d218bb3f63578c7 | [
"MIT"
] | 4 | 2017-10-12T20:56:39.000Z | 2020-05-04T09:19:44.000Z | asm/fpga_uart_send.asm | FKD13/RCPU | 1f27246494f60eaa2432470b2d218bb3f63578c7 | [
"MIT"
] | 4 | 2017-10-16T16:24:16.000Z | 2022-03-21T19:07:06.000Z | .text
.global main:
main:
retry:
; push address of misc.in (which contains if uart is writeable), and read option
LDV B, (0b110)
PSH B
SYS
; pop read value in B
POP B
; get last bit: AND with 1
LDV A, 1
AND A, B
; if A now contains 1, that means we can write to uart
LDV C, retry:
LDV B, 1
; if A == 0, then A < B and we will retry
JLT B, C
; else write to uart
; 0b0111_0110 = 'v'
LDV A, (0b0111_0110)
PSH A
LDV A, (0b1001)
PSH A
SYS
JMP main:
HLT
| 14.21875 | 80 | 0.668132 |
8aad0c773ad1f36cec6842c92ebddef829a24714 | 2,283 | swift | Swift | ListableUI/Sources/ListEnvironment.swift | nononoah/Listable | d777ba0d1d180f086b30e1c704a9bed8a837cd96 | [
"Apache-2.0"
] | 1 | 2021-12-08T04:33:55.000Z | 2021-12-08T04:33:55.000Z | ListableUI/Sources/ListEnvironment.swift | nononoah/Listable | d777ba0d1d180f086b30e1c704a9bed8a837cd96 | [
"Apache-2.0"
] | null | null | null | ListableUI/Sources/ListEnvironment.swift | nononoah/Listable | d777ba0d1d180f086b30e1c704a9bed8a837cd96 | [
"Apache-2.0"
] | null | null | null | //
// ListEnvironment.swift
// ListableUI
//
// Created by Kyle Van Essen on 10/26/20.
//
/// An environment of keys and values that are passed to every `ItemContent` and `HeaderFooter`
/// during layout and measurement, to allow passing down data.
///
/// This type is similar to the SwiftUI or Blueprint `Environment`, where you define a `ListEnvironmentKey`,
/// and then provide a custom getter and setter to read and write the content:
///
/// ```
/// enum MyLayoutTypeKey : ListEnvironmentKey {
/// var defaultValue : MyLayoutType {
/// .defaultLayout
/// }
/// }
///
/// extension ListEnvironment {
/// var myLayoutType : MyLayoutType {
/// get { self[MyLayoutTypeKey.self] }
/// set { self[MyLayoutTypeKey.self] = newValue }
/// }
/// }
/// ```
///
/// You can retrieve the `ListEnvironment` through the `info` object passed in `ItemContent` and `HeaderFooter`'s
/// `apply(to:for:with:)` methods.
///
/// ```
/// func apply(
/// to views : ItemContentViews<Self>,
/// for reason: ApplyReason,
/// with info : ApplyItemContentInfo
/// ) {
/// switch info.environment.myLayoutType {
/// ...
/// }
/// }
/// ```
public struct ListEnvironment {
/// A default "empty" environment, with no values overridden.
/// Each key will return its default value.
public static let empty = ListEnvironment()
/// Gets or sets an environment value by its key.
public subscript<Key>(key: Key.Type) -> Key.Value where Key: ListEnvironmentKey {
get {
let objectId = ObjectIdentifier(key)
if let value = values[objectId] {
return value as! Key.Value
}
return key.defaultValue
}
set {
values[ObjectIdentifier(key)] = newValue
}
}
private var values: [ObjectIdentifier: Any] = [:]
}
/// Defines a value stored in the `ListEnvironment` of a list.
///
/// See `ListEnvironment` for more info and examples.
public protocol ListEnvironmentKey {
/// The type of value stored by this key.
associatedtype Value
/// The default value that will be vended by an `Environment` for this key if no other value has been set.
static var defaultValue: Self.Value { get }
}
| 28.185185 | 113 | 0.624179 |
7775e2757a4cd0816eaa7f8e5cc7bf22530f00f3 | 20,376 | html | HTML | resources/views/email/template/full/notification.html | wsduarteoficial/guialocalizabackup | 25c19981e68f0465b2a105571a7c37a319566a2d | [
"MIT"
] | null | null | null | resources/views/email/template/full/notification.html | wsduarteoficial/guialocalizabackup | 25c19981e68f0465b2a105571a7c37a319566a2d | [
"MIT"
] | null | null | null | resources/views/email/template/full/notification.html | wsduarteoficial/guialocalizabackup | 25c19981e68f0465b2a105571a7c37a319566a2d | [
"MIT"
] | null | null | null | <!--
Template Name: Piningit
Template URI: http://themeforest.net/item/piningit-responsive-email-with-template-builder/8933480
Description: Responsive Email with Template Builder. Get our other beautiful templates <a href="http://themeforest.net/user/saputrad/portfolio" target="_blank">here</a>
Author: saputrad
Author URI: http://themeforest.net/user/saputrad
Version: 1.1
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
<title>{subject}</title>
<link href='http://fonts.googleapis.com/css?family=Raleway:400,600,700' rel='stylesheet' type='text/css'>
<style type="text/css">
html
{
width: 100%;
}
body {
background-color: #e1e1e1;
margin: 0;
padding: 0;
}
.ReadMsgBody
{
width: 100%;
background-color: #e1e1e1;
}
.ExternalClass
{
width: 100%;
background-color: #e1e1e1;
}
a {
color:#fe5d55;
text-decoration:none;
font-weight:normal;
font-style: normal;
}
a:hover {
color:#4a4a4a;
text-decoration:none;
font-weight:normal;
font-style: normal;
transition: all .25s ease-in-out;
}
p, div {
margin: 0 !important;
}
table {
border-collapse: collapse;
}
@media only screen and (max-width: 640px) {
body { width: auto !important; }
table table{width:100% !important; }
table[class="table-wrapper"] {width: 420px !important; margin: 0 auto !important;}
table[class="table-inner"] {width: 380px !important; margin: 0 auto !important;}
table[class="full"] {width: 420px !important; margin: 0 auto !important;}
td[class="center"] {text-align: center !important;}
img[class="img_scale"] {width: 100% !important; height: auto !Important;}
img[class="divider"] {width: 100% !important; height: 1px !Important;}
}
@media only screen and (max-width: 479px) {
body { width: auto !important; }
table table{width:100% !important; }
table[class="table-wrapper"] {width: 260px !important; margin: 0 auto !important;}
table[class="table-inner"] {width: 220px !important; margin: 0 auto !important;}
table[class="full"] {width: 260px !important; margin: 0 auto !important;}
td[class="center"] {text-align: center !important;}
img[class="img_scale"] {width: 100% !important; height: auto !Important;}
img[class="divider"] {width: 100% !important; height: 1px !Important;}
}
div.preheader{line-height:0px;font-size:0px;height:0px;display:none !important;display:none;visibility:hidden;}
table.textbutton td{display:inline-block;}
table.textbutton a{background: none; font-weight: bold; font-style: normal; color:#ffffff;}
a.heading-link {color:#515151; text-decoration: none; font-style: normal; font-weight: bold;}
table.textbuttonred td{display:inline-block;}
table.textbuttonred a{background: none; font-weight: bold; font-style: normal; color:#fe5d55;}
table.textbuttongrey td{display:inline-block;}
table.textbuttongrey a{background: none; font-weight: bold; font-style: normal; color:#bfbfbf;}
.nav_links a {color:#616161; font-weight: normal; font-style: normal; text-decoration: none;}
</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff" style="padding: 0; margin: 0;">
<tr>
<td>
<!-- START OF HEADER BLOCK-->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#ffffff" valign="top" align="center" style="border-bottom: 1px solid #ececec;">
<table class="table-wrapper" bgcolor="#ffffff" width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="">
<!-- START OF VERTICAL SPACER-->
<tr>
<td height="30" style="padding:0; line-height: 0;">
</td>
</tr>
<!-- END OF VERTICAL SPACER-->
<tr>
<td>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="">
<tr>
<td valign="top">
<!-- START OF LEFT COLUMN-->
<table class="full" width="285" border="0" align="left" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<!-- START OF LOGO-->
<tr>
<td class="center" align="left" style="padding: 0px; text-transform: uppercase; font-family: 'Raleway', sans-serif; color:#4a4a4a; font-size:18px; line-height:100%;">
<div class="preheader">
{preheader}
</div>
<span>
<a href="#" style="color:#fe5d55;">
<img editable label="logo" src="img/logo.png" alt="logo" width="129" height="34" border="0" style="display: inline-block;" />
</a>
</span>
</td>
</tr>
<!-- END OF LOGO-->
</table>
<!-- END OF LEFT COLUMN-->
<!-- START OF SPACER-->
<table width="10" border="0" align="left" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tr>
<td width="100%" height="20" style="line-heigh:0;">
</td>
</tr>
</table>
<!-- START OF SPACER-->
<!-- START OF RIGHT COLUMN-->
<table class="full" width="285" border="0" align="right" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<!-- START OF NAV LINKS AND BUTTON-->
<tr>
<td class="center" align="right" valign="middle" style="margin: 0; padding-top: 7px; padding-right: 10px; font-size:13px ; color:#616161; font-family: 'Raleway', sans-serif; line-height: 18px; mso-line-height-rule: exactly;">
<div class="nav_links">
<multi label="nav links">
<span>
<a href="#" style="color:#616161; font-weight: normal; font-style: normal; text-decoration: none;">{webversion}</a>
<a href="#" style="color:#616161; font-weight: normal; font-style: normal; text-decoration: none;">{forward}</a>
</span>
</multi>
</div>
</td>
<td class="center" align="right" valign="top" style="margin: 0; padding-top: 5px; font-size:13px ; color:#616161; font-family: 'Raleway', sans-serif; line-height: 18px; mso-line-height-rule: exactly;">
<!-- START BUTTON-->
<table class="textbutton" align="center" style=" margin: 0; ">
<tr>
<td bgcolor="#fe5d55" align="center" valign="middle" style="border-radius: 4px; padding: 5px 15px; margin: 0 auto !important; text-transform: uppercase; font-size: 12px; line-height: 18px; font-family: 'Raleway', sans-serif; color:#ffffff; margin: 0 !important; ">
<span>
<a editable label="text button" href="#" style="border: none; font-weight: bold; font-style: normal; color:#ffffff; text-decoration: none;">
buy now
</a>
</span>
</td>
</tr>
</table>
<!-- END BUTTON-->
</td>
</tr>
<!-- END OF NAV LINKS AND BUTTON-->
</table>
<!-- END OF RIGHT COLUMN-->
</td>
</tr>
<!-- START OF VERTICAL SPACER-->
<tr>
<td height="30" style="padding:0; line-height: 0;">
</td>
</tr>
<!-- END OF VERTICAL SPACER-->
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- START OF VERTICAL SPACER-->
<tr>
<td height="60" style="padding:0; line-height: 0;">
</td>
</tr>
<!-- END OF VERTICAL SPACER-->
</table>
<!-- END OF HEADER BLOCK-->
<modules>
<module label="intro text">
<!-- START OF INTRO TEXT-->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" align="center">
<table class="table-wrapper" width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<table class="full" width="600" border="0" align="left" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<!-- START OF HEADING-->
<tr>
<td class="center" align="center" style="padding-bottom: 10px; text-transform: uppercase; font-weight: bold; font-family: 'Raleway', sans-serif; color:#4a4a4a; font-size:18px; line-height:28px; mso-line-height-rule: exactly;">
<multi>
<span>
{headline}
</span>
</multi>
</td>
</tr>
<!-- END OF HEADING-->
<!-- START OF TEXT-->
<tr>
<td class="center" align="center" style="margin: 0; font-size:13px ; font-weight: normal; color:#7f7f7f; font-family: 'Raleway', sans-serif; line-height: 23px;mso-line-height-rule: exactly;">
<multi>
<span>
{content}
</span>
</multi>
</td>
</tr>
<!-- END OF TEXT-->
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- START OF VERTICAL SPACER-->
<tr>
<td height="60" style="padding:0; line-height: 0;">
</td>
</tr>
<!-- END OF VERTICAL SPACER-->
</table>
</td>
</tr>
</table>
<!-- END OF INTRO TEXT-->
</module>
</modules>
<!-- START OF FOOTER-->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">
<table width="100%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td valign="top" bgcolor="#2b2b2b" background="img/footer-background.png" align="center" style="background-image: url(img/footer-background.png); background-size: 100% 100%; background-position: top center; background-repeat: repeat; ">
<table class="table-wrapper" width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tr>
<td valign="top" style="padding-top: 60px; padding-bottom: 60px;">
<table class="table-inner" width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" style="padding-bottom: 50px;">
<!-- START OF LEFT COLUMN-->
<table class="full" width="180" border="0" align="left" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tr>
<td align="center" style="padding-bottom: 5px; font-weight: bold; font-family: 'Raleway', sans-serif; color:#bfbfbf; font-size:24px; line-height:34px; mso-line-height-rule: exactly;">
<multi>
<span>
Email
</span>
</multi>
</td>
</tr>
<tr>
<td align="center" style="margin:0; padding-bottom: 5px; line-height: 0;">
<span>
<img editable label="email divider" src="img/email-divider.png" alt="divider image" width="124" height="12" border="0" style="display: inline-block;" />
</span>
</td>
</tr>
<tr>
<td align="center" style="padding-bottom: 0; font-weight: normal; font-family: 'Raleway', sans-serif; color:#bfbfbf; font-size:14px; line-height:24px; mso-line-height-rule: exactly;">
<multi>
<span>
adm@website.com
</span>
</multi>
</td>
</tr>
</table>
<!-- END OF LEFT COLUMN-->
<!-- START OF SPACER-->
<table width="30" border="0" align="left" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tr>
<td width="100%" height="20" style="line-heigh:0;">
</td>
</tr>
</table>
<!-- START OF SPACER-->
<!-- START OF MIDDLE COLUMN-->
<table class="full" width="180" border="0" align="left" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tr>
<td align="center" style="padding-bottom: 5px; font-weight: bold; font-family: 'Raleway', sans-serif; color:#bfbfbf; font-size:24px; line-height:34px; mso-line-height-rule: exactly;">
<multi>
<span>
Phone
</span>
</multi>
</td>
</tr>
<tr>
<td align="center" style="margin:0; padding-bottom: 5px; line-height: 0;">
<span>
<img editable label="phone divider" src="img/phone-divider.png" alt="divider image" width="124" height="13" border="0" style="display: inline-block;" />
</span>
</td>
</tr>
<tr>
<td align="center" style="padding-bottom: 0; font-weight: normal; font-family: 'Raleway', sans-serif; color:#bfbfbf; font-size:14px; line-height:24px; mso-line-height-rule: exactly;">
<multi>
<span>
+62-2719-1234
</span>
</multi>
</td>
</tr>
</table>
<!-- END OF MIDDLE COLUMN-->
<!-- START OF SPACER-->
<table width="5" border="0" align="left" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tr>
<td width="100%" height="20" style="line-heigh:0;">
</td>
</tr>
</table>
<!-- START OF SPACER-->
<!-- START OF RIGHT COLUMN-->
<table class="full" width="180" border="0" align="right" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tr>
<td align="center" style="padding-bottom: 5px; font-weight: bold; font-family: 'Raleway', sans-serif; color:#bfbfbf; font-size:24px; line-height:34px; mso-line-height-rule: exactly;">
<multi>
<span>
Address
</span>
</multi>
</td>
</tr>
<tr>
<td align="center" style="margin:0; padding-bottom: 5px; line-height: 0;">
<span>
<img editable label="address divider" src="img/address-divider.png" alt="divider image" width="124" height="13" border="0" style="display: inline-block;" />
</span>
</td>
</tr>
<tr>
<td align="center" style="padding-bottom: 0; font-weight: normal; font-family: 'Raleway', sans-serif; color:#bfbfbf; font-size:14px; line-height:24px; mso-line-height-rule: exactly;">
<multi>
<span>
Manahan, Solo
</span>
</multi>
</td>
</tr>
</table>
<!-- END OF RIGHT COLUMN-->
</td>
</tr>
</table>
<table class="table-inner" width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- START SUB HEADING-->
<tr>
<td align="center" style="padding-bottom: 43px; font-family: 'Raleway', sans-serif; font-weight: normal; color:#bfbfbf; font-size: 14px; line-height:24px;">
<span>
<a href="#" style="color:#ededed; text-decoration: none; background: none;">
<img editable label="linkedin" src="img/social/linkedin.png" alt="linkedin" width="52" height="52" border="0" style="display: inline-block;" />
</a>
<a href="#" style="color:#ededed; text-decoration: none; background: none;">
<img editable label="instagram" src="img/social/instagram.png" alt="instagram" width="52" height="52" border="0" style="display: inline-block;" />
</a>
<a href="#" style="color:#ededed; text-decoration: none; background: none;">
<img editable label="facebook" src="img/social/facebook.png" alt="facebook" width="52" height="52" border="0" style="display: inline-block;" />
</a>
<a href="#" style="color:#ededed; text-decoration: none; background: none;">
<img editable label="dribbble" src="img/social/dribbble.png" alt="dribbble" width="52" height="52" border="0" style="display: inline-block;" />
</a>
<a href="#" style="color:#ededed; text-decoration: none; background: none;">
<img editable label="twitter" src="img/social/twitter.png" alt="twitter" width="52" height="52" border="0" style="display: inline-block;" />
</a>
</span>
</td>
</tr>
<!-- END SUB HEADING-->
<!-- START SUB HEADING-->
<tr>
<td align="center" style="padding-top: 0; font-family: 'Raleway', sans-serif; font-weight: normal; color:#bfbfbf; font-size: 14px; line-height:24px; mso-line-height-rule: exactly;">
<multi>
<span>
{can-spam}
</span>
</multi>
<br />
<multi>
<span>
© 2014 Piningit. All rights reserved. <a href="#" style="color:#fe5d55;">unsub</a>
</span>
</multi>
</td>
</tr>
<!-- END SUB HEADING-->
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- END OF FOOTER-->
</td>
</tr>
</table>
</body>
</html> | 41.925926 | 281 | 0.499656 |
2635be5a543678f5d1a00cd22b1ff829a52c7776 | 21,892 | java | Java | AgendamentoConsulta/src/screens/ManagementMonitorScreen.java | Ortizeira-BR/Monitoria | 08036801a1c36d317ce62fb8884ecdd4a0f25d60 | [
"MIT"
] | null | null | null | AgendamentoConsulta/src/screens/ManagementMonitorScreen.java | Ortizeira-BR/Monitoria | 08036801a1c36d317ce62fb8884ecdd4a0f25d60 | [
"MIT"
] | null | null | null | AgendamentoConsulta/src/screens/ManagementMonitorScreen.java | Ortizeira-BR/Monitoria | 08036801a1c36d317ce62fb8884ecdd4a0f25d60 | [
"MIT"
] | null | null | null | package screens;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
/**
*
* @author Guilherme Ortiz
*/
public class ManagementMonitorScreen extends javax.swing.JPanel {
public javax.swing.JButton bDelete;
public javax.swing.JButton bRegister;
public javax.swing.JButton bUpdate;
public javax.swing.JComboBox<String> cbMonitor;
private javax.swing.JLabel dlTitle;
private javax.swing.JLabel lTitle;
private javax.swing.JPanel pContent;
private javax.swing.JPanel pContentDelete;
private javax.swing.JPanel pContentRegister;
private javax.swing.JPanel pContentUpdate;
private javax.swing.JPanel pDelete;
public javax.swing.JList pMonitors;
private javax.swing.JPanel pRegister;
private javax.swing.JPanel pTitle;
private javax.swing.JPanel pUpdate;
private javax.swing.JLabel rlName;
private javax.swing.JLabel rlPass;
private javax.swing.JLabel rlTitle;
private javax.swing.JLabel rlUser;
public javax.swing.JTextField rtfName;
public javax.swing.JTextField rtfPass;
public javax.swing.JTextField rtfUser;
private javax.swing.JScrollPane spMonitors;
private javax.swing.JLabel ulMonitor;
private javax.swing.JLabel ulName;
private javax.swing.JLabel ulPass;
private javax.swing.JLabel ulTitle;
private javax.swing.JLabel ulUser;
public javax.swing.JTextField utfName;
public javax.swing.JTextField utfPass;
public javax.swing.JTextField utfUser;
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Components">
public void initComponents() {
pTitle = new javax.swing.JPanel();
lTitle = new javax.swing.JLabel();
pContent = new javax.swing.JPanel();
pContentRegister = new javax.swing.JPanel();
pRegister = new javax.swing.JPanel();
rlTitle = new javax.swing.JLabel();
rlName = new javax.swing.JLabel();
rtfName = new javax.swing.JTextField();
rtfUser = new javax.swing.JTextField();
rlUser = new javax.swing.JLabel();
rlPass = new javax.swing.JLabel();
rtfPass = new javax.swing.JTextField();
bRegister = new javax.swing.JButton();
pContentUpdate = new javax.swing.JPanel();
pUpdate = new javax.swing.JPanel();
cbMonitor = new javax.swing.JComboBox<>();
ulTitle = new javax.swing.JLabel();
ulName = new javax.swing.JLabel();
utfName = new javax.swing.JTextField();
ulUser = new javax.swing.JLabel();
utfUser = new javax.swing.JTextField();
ulPass = new javax.swing.JLabel();
utfPass = new javax.swing.JTextField();
bUpdate = new javax.swing.JButton();
ulMonitor = new javax.swing.JLabel();
pContentDelete = new javax.swing.JPanel();
pDelete = new javax.swing.JPanel();
dlTitle = new javax.swing.JLabel();
bDelete = new javax.swing.JButton();
spMonitors = new javax.swing.JScrollPane();
pMonitors = new JList();
setMinimumSize(new java.awt.Dimension(750, 470));
setPreferredSize(new java.awt.Dimension(750, 470));
setLayout(new java.awt.BorderLayout());
pTitle.setBackground(new java.awt.Color(255, 255, 255));
pTitle.setPreferredSize(new java.awt.Dimension(750, 40));
lTitle.setFont(new java.awt.Font("MV Boli", 0, 24)); // NOI18N
lTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lTitle.setText("Gerenciamento de Monitor");
javax.swing.GroupLayout pTitleLayout = new javax.swing.GroupLayout(pTitle);
pTitle.setLayout(pTitleLayout);
pTitleLayout.setHorizontalGroup(
pTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pTitleLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 730, Short.MAX_VALUE)
.addContainerGap())
);
pTitleLayout.setVerticalGroup(
pTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
add(pTitle, java.awt.BorderLayout.PAGE_START);
pContent.setLayout(new javax.swing.BoxLayout(pContent, javax.swing.BoxLayout.LINE_AXIS));
pContentRegister.setBackground(new java.awt.Color(255, 255, 255));
pContentRegister.setMinimumSize(new java.awt.Dimension(250, 430));
pContentRegister.setPreferredSize(new java.awt.Dimension(250, 430));
pRegister.setBackground(new java.awt.Color(255, 255, 255));
pRegister.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
rlTitle.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
rlTitle.setForeground(new java.awt.Color(204, 204, 204));
rlTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
rlTitle.setText("Cadastro Monitor");
rlName.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
rlName.setText("Nome");
rtfName.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
rtfName.setHorizontalAlignment(javax.swing.JTextField.CENTER);
rtfUser.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
rtfUser.setHorizontalAlignment(javax.swing.JTextField.CENTER);
rlUser.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
rlUser.setText("Usuario");
rlPass.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
rlPass.setText("Senha");
rtfPass.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
rtfPass.setHorizontalAlignment(javax.swing.JTextField.CENTER);
rtfPass.setToolTipText("");
rtfPass.setPreferredSize(new java.awt.Dimension(60, 23));
bRegister.setBackground(new java.awt.Color(204, 0, 204));
bRegister.setText("Cadastrar");
javax.swing.GroupLayout pRegisterLayout = new javax.swing.GroupLayout(pRegister);
pRegister.setLayout(pRegisterLayout);
pRegisterLayout.setHorizontalGroup(
pRegisterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pRegisterLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pRegisterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(rlPass, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(rlUser, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(rlName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(rlTitle, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE)
.addComponent(bRegister, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(rtfName, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(rtfPass, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(rtfUser))
.addContainerGap())
);
pRegisterLayout.setVerticalGroup(
pRegisterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pRegisterLayout.createSequentialGroup()
.addContainerGap()
.addComponent(rlTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(rlName)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rtfName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(rlUser)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rtfUser, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(rlPass)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rtfPass, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(bRegister, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout pContentRegisterLayout = new javax.swing.GroupLayout(pContentRegister);
pContentRegister.setLayout(pContentRegisterLayout);
pContentRegisterLayout.setHorizontalGroup(
pContentRegisterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pContentRegisterLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pRegister, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pContentRegisterLayout.setVerticalGroup(
pContentRegisterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pContentRegisterLayout.createSequentialGroup()
.addGap(59, 59, 59)
.addComponent(pRegister, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(60, Short.MAX_VALUE))
);
pContent.add(pContentRegister);
pContentUpdate.setBackground(new java.awt.Color(255, 255, 255));
pContentUpdate.setMinimumSize(new java.awt.Dimension(250, 430));
pContentUpdate.setPreferredSize(new java.awt.Dimension(250, 430));
pUpdate.setBackground(new java.awt.Color(255, 255, 255));
pUpdate.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
pUpdate.setMaximumSize(new java.awt.Dimension(230, 300));
pUpdate.setMinimumSize(new java.awt.Dimension(230, 300));
ulTitle.setBackground(new java.awt.Color(255, 255, 255));
ulTitle.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
ulTitle.setForeground(new java.awt.Color(204, 204, 204));
ulTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
ulTitle.setText("Gerenciar Monitor");
ulName.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
ulName.setText("Nome");
utfName.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
utfName.setHorizontalAlignment(javax.swing.JTextField.CENTER);
ulUser.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
ulUser.setText("Usuario");
utfUser.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
utfUser.setHorizontalAlignment(javax.swing.JTextField.CENTER);
ulPass.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
ulPass.setText("Senha");
utfPass.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
utfPass.setHorizontalAlignment(javax.swing.JTextField.CENTER);
utfPass.setToolTipText("");
utfPass.setPreferredSize(new java.awt.Dimension(60, 23));
bUpdate.setBackground(new java.awt.Color(204, 0, 204));
bUpdate.setText("Editar");
ulMonitor.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
ulMonitor.setText("Monitor");
javax.swing.GroupLayout pUpdateLayout = new javax.swing.GroupLayout(pUpdate);
pUpdate.setLayout(pUpdateLayout);
pUpdateLayout.setHorizontalGroup(
pUpdateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pUpdateLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pUpdateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(bUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(utfName)
.addComponent(cbMonitor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ulUser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ulMonitor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ulName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ulPass, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ulTitle, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pUpdateLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(pUpdateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(utfUser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(utfPass, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
);
pUpdateLayout.setVerticalGroup(
pUpdateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pUpdateLayout.createSequentialGroup()
.addContainerGap()
.addComponent(ulTitle)
.addGap(18, 18, 18)
.addComponent(ulMonitor)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbMonitor, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(ulName)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(utfName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(ulUser)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(utfUser, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(ulPass)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(utfPass, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(bUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout pContentUpdateLayout = new javax.swing.GroupLayout(pContentUpdate);
pContentUpdate.setLayout(pContentUpdateLayout);
pContentUpdateLayout.setHorizontalGroup(
pContentUpdateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pContentUpdateLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pContentUpdateLayout.setVerticalGroup(
pContentUpdateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pContentUpdateLayout.createSequentialGroup()
.addGap(27, 27, 27)
.addComponent(pUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(37, Short.MAX_VALUE))
);
pContent.add(pContentUpdate);
pContentDelete.setBackground(new java.awt.Color(255, 255, 255));
pContentDelete.setMinimumSize(new java.awt.Dimension(250, 430));
pDelete.setBackground(new java.awt.Color(255, 255, 255));
pDelete.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
pDelete.setMaximumSize(new java.awt.Dimension(230, 300));
pDelete.setMinimumSize(new java.awt.Dimension(230, 300));
dlTitle.setBackground(new java.awt.Color(255, 255, 255));
dlTitle.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
dlTitle.setForeground(new java.awt.Color(204, 204, 204));
dlTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
dlTitle.setText("Monitores");
bDelete.setBackground(new java.awt.Color(204, 0, 51));
bDelete.setText("Deletar");
spMonitors.setBackground(new java.awt.Color(255, 255, 255));
pMonitors.setBackground(new java.awt.Color(255, 255, 255));
pMonitors.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
javax.swing.GroupLayout pMonitorsLayout = new javax.swing.GroupLayout(pMonitors);
pMonitors.setLayout(pMonitorsLayout);
pMonitorsLayout.setHorizontalGroup(
pMonitorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 204, Short.MAX_VALUE)
);
pMonitorsLayout.setVerticalGroup(
pMonitorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 243, Short.MAX_VALUE)
);
spMonitors.setViewportView(pMonitors);
javax.swing.GroupLayout pDeleteLayout = new javax.swing.GroupLayout(pDelete);
pDelete.setLayout(pDeleteLayout);
pDeleteLayout.setHorizontalGroup(
pDeleteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pDeleteLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pDeleteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(bDelete, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(dlTitle, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(spMonitors))
.addContainerGap())
);
pDeleteLayout.setVerticalGroup(
pDeleteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pDeleteLayout.createSequentialGroup()
.addContainerGap()
.addComponent(dlTitle)
.addGap(18, 18, 18)
.addComponent(spMonitors, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(bDelete, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout pContentDeleteLayout = new javax.swing.GroupLayout(pContentDelete);
pContentDelete.setLayout(pContentDeleteLayout);
pContentDeleteLayout.setHorizontalGroup(
pContentDeleteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pContentDeleteLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pDelete, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pContentDeleteLayout.setVerticalGroup(
pContentDeleteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pContentDeleteLayout.createSequentialGroup()
.addGap(27, 27, 27)
.addComponent(pDelete, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(37, Short.MAX_VALUE))
);
pContent.add(pContentDelete);
add(pContent, java.awt.BorderLayout.CENTER);
}// </editor-fold>
}
| 55.846939 | 182 | 0.68372 |
95840cd32f9d1d74af5da2683ce3f879ea185dc0 | 3,635 | dart | Dart | lib/view/config/home_location.dart | ayoubrajabi/deezer-flutter | 3fe58ab278d66472699956c23b6e13ed2c632fb9 | [
"Apache-2.0"
] | 3 | 2021-09-15T16:25:20.000Z | 2021-12-10T11:38:38.000Z | lib/view/config/home_location.dart | ayoubrajabi/deezer-flutter | 3fe58ab278d66472699956c23b6e13ed2c632fb9 | [
"Apache-2.0"
] | null | null | null | lib/view/config/home_location.dart | ayoubrajabi/deezer-flutter | 3fe58ab278d66472699956c23b6e13ed2c632fb9 | [
"Apache-2.0"
] | null | null | null | import 'package:beamer/beamer.dart';
import 'package:deezer_flutter/logic/logics.dart';
import 'package:deezer_flutter/utilities/utilities.dart';
import 'package:deezer_flutter/view/screens/screens.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class HomeLocation extends BeamLocation<BeamState> {
@override
List<BeamPage> buildPages(BuildContext context, BeamState state) => [
BeamPage(
key: const ValueKey('Home'),
type: BeamPageType.sharedAxisTransion,
child: const HomeScreen(),
),
if (state.uri.pathSegments.contains('artistHome'))
BeamPage(
key: const ValueKey('artistHome'),
type: BeamPageType.sharedAxisTransion,
child: Builder(
builder: (context) {
final _artistState = context.read<ArtistsBloc>().state;
final _index = context.watch<ItemsIndexCubit>().state.index;
final _musicState = context.watch<MusicBloc>().state;
if (_artistState is ArtistIsLoaded) {
final _artistData =
ArtistInfo.artistDtat(_artistState, _index);
final int _artistId = ArtistInfo.id(_artistState, _index);
context
.read<AlbumBloc>()
.add(FeatchAlbum('artist/$_artistId/albums', ''));
return ArtistInfoScreen(
index: _index,
artistName: _artistData.name,
artistImageurl: _artistData.pictureBig,
hotMusicQuery:
ArtistInfo.trackListQuery(_artistState, _index),
hotMusicHeight: _musicState is MusicIsLoaded
? _musicState.getMusic.data!.length * 80.0
: 400.0,
hotMusicItemCount: _musicState is MusicIsLoaded
? _musicState.getMusic.data!.length
: 0,
);
}
return const SizedBox();
},
),
)
else if (state.uri.pathSegments.contains('ForYou'))
BeamPage(
key: const ValueKey('ForYou'),
type: BeamPageType.sharedAxisTransion,
child: Builder(
builder: (context) {
final _radioState = context.watch<RadioBloc>().state;
final _index = context.watch<ItemsIndexCubit>().state.index;
if (_radioState is RadioIsLoading) {
return const SizedBox(
child: Center(
child: CircularProgressIndicator(),
),
);
} else if (_radioState is RadioIsLoaded) {
final String? _radioTracklist =
_radioState.getRadio.data![_index].tracklist;
final String _query = _radioTracklist!
.replaceAll('https://api.deezer.com/', '');
return ForYouMoreScreen(
index: _index,
radioState: _radioState,
hotMusicHeight: _radioState.getRadio.data!.length * 71.0,
query: _query,
hotMusicItemCount: _radioState.getRadio.data!.length,
);
}
return const SizedBox();
},
))
];
@override
List get pathBlueprints => [HomeScreen.path];
}
| 39.51087 | 79 | 0.518569 |
a796b6e5986c70f57d0ca29e6c4ab96439ed1c89 | 362 | sql | SQL | Src/Entity.Database/EntityCode/Views/ModuleSetting.sql | goodtocode/Entities | 134a692973c80ccd417b36e303e9e28dc05c3bb9 | [
"Apache-2.0"
] | 1 | 2020-08-13T00:49:48.000Z | 2020-08-13T00:49:48.000Z | Src/Entity.Database/EntityCode/Views/ModuleSetting.sql | goodtocode/Entities | 134a692973c80ccd417b36e303e9e28dc05c3bb9 | [
"Apache-2.0"
] | null | null | null | Src/Entity.Database/EntityCode/Views/ModuleSetting.sql | goodtocode/Entities | 134a692973c80ccd417b36e303e9e28dc05c3bb9 | [
"Apache-2.0"
] | 1 | 2021-03-07T03:04:34.000Z | 2021-03-07T03:04:34.000Z | Create VIEW [EntityCode].[ModuleSetting]
AS
SELECT MSet.ModuleSettingId As [Id],
MSet.ModuleSettingKey As [Key],
MSet.ModuleKey,
MSet.SettingKey,
S.SettingName,
S.SettingTypeKey,
S.SettingValue,
S.CreatedDate,
S.ModifiedDate
From [Setting].[ModuleSetting] MSet
Join [Setting].[Setting] S On MSet.SettingKey = S.SettingKey
| 21.294118 | 60 | 0.70442 |
6b3ed3c511ad88b937bb7938a6af705448092919 | 687 | kt | Kotlin | app/src/main/java/com/airahm/dturbineapplist/viewmodel/AppDetailViewModel.kt | windchime11/dturbine | 7bae5e10e1f4e4ed757abf5048aaaabcbd983ef2 | [
"Unlicense"
] | null | null | null | app/src/main/java/com/airahm/dturbineapplist/viewmodel/AppDetailViewModel.kt | windchime11/dturbine | 7bae5e10e1f4e4ed757abf5048aaaabcbd983ef2 | [
"Unlicense"
] | null | null | null | app/src/main/java/com/airahm/dturbineapplist/viewmodel/AppDetailViewModel.kt | windchime11/dturbine | 7bae5e10e1f4e4ed757abf5048aaaabcbd983ef2 | [
"Unlicense"
] | null | null | null | package com.airahm.dturbineapplist.viewmodel
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.ViewModel
import android.util.Log
import com.airahm.dturbineapplist.model.AppDetail
import com.airahm.dturbineapplist.repo.MainRepo
import com.airahm.dturbineapplist.utils.LogUtils.Companion.makeLogTag
class AppDetailViewModel(val repo: MainRepo) : ViewModel() {
companion object {
val TAG = makeLogTag(AppDetailViewModel::class.java)
}
val appDetail: LiveData<AppDetail>?
init {
appDetail = repo.mAppDetail
}
fun update(appId: String) {
Log.d(TAG, "appId = ${appId}")
repo.updateAppDetailLiveData(appId)
}
} | 27.48 | 69 | 0.737991 |
80c29b4df4bfa1f554e855b7635f03459ef3fd36 | 1,293 | java | Java | src/main/java/de/onyxbits/tradetrax/services/MoneyRepresentation.java | onyxbits/TradeTrax | f66c55eba705c1ca631a9577bcada5c6d7c73789 | [
"Apache-2.0"
] | 6 | 2015-01-02T18:06:42.000Z | 2016-11-26T01:59:09.000Z | src/main/java/de/onyxbits/tradetrax/services/MoneyRepresentation.java | onyxbits/TradeTrax | f66c55eba705c1ca631a9577bcada5c6d7c73789 | [
"Apache-2.0"
] | 1 | 2015-01-02T22:31:22.000Z | 2015-01-04T12:45:49.000Z | src/main/java/de/onyxbits/tradetrax/services/MoneyRepresentation.java | onyxbits/TradeTrax | f66c55eba705c1ca631a9577bcada5c6d7c73789 | [
"Apache-2.0"
] | 2 | 2018-03-23T11:35:06.000Z | 2018-10-28T11:31:17.000Z | package de.onyxbits.tradetrax.services;
import java.text.ParseException;
/**
* Takes care of internal/external representation of monetary values.
*
*
* @author patrick
*
*/
public interface MoneyRepresentation {
/**
* Scaling factor
*/
public static final long FACTOR = 10 * 10 * 10 * 10;
/**
* @return the currencySymbol
*/
public abstract String getCurrencySymbol();
/**
* Converts a user submitted value to internal representation
*
* @param value
* a string such as "2.99", "4,99" or "-1"
* @param units
* unitcount (in case the user is submitting the price for a stack of
* items). No safety checks are performed. Especially not for
* division by zero.
* @return the value as an integer
* @throws ParseException
*/
public abstract long userToDatabase(String value, int units) throws ParseException;
/**
* Convert from internal representation to human readable
*
* @param value
* an integer such as 499
* @param precise
* false to clip digits, true to print the full value.
* @param addSymbol
* true to add the currencysymbol
* @return a string such as $4.99
*/
public abstract String databaseToUser(long value, boolean precise, boolean addSymbol);
} | 25.352941 | 87 | 0.66512 |
833c7cd1646c489f0dc8c370a1f4a39395312c98 | 46 | sql | SQL | src/main/resources/db/changesets/test_table/20200117/drop_foobar_column.sql | Khromushkin/study-kotlin-liquibase-job | 11b154836c4e82c8b32c5f7a9a051d1d104d729c | [
"MIT"
] | null | null | null | src/main/resources/db/changesets/test_table/20200117/drop_foobar_column.sql | Khromushkin/study-kotlin-liquibase-job | 11b154836c4e82c8b32c5f7a9a051d1d104d729c | [
"MIT"
] | null | null | null | src/main/resources/db/changesets/test_table/20200117/drop_foobar_column.sql | Khromushkin/study-kotlin-liquibase-job | 11b154836c4e82c8b32c5f7a9a051d1d104d729c | [
"MIT"
] | null | null | null | alter table test_table
drop column foobar; | 23 | 23 | 0.782609 |
5b10ec28db37f545843188e747bd2cc55671f2c3 | 37,591 | h | C | ext/de118i/de118i/ini118d.h | gnodvi/cosmos | 3612456fc2042519f96a49e4d4cc6d3c1f41de7c | [
"PSF-2.0"
] | null | null | null | ext/de118i/de118i/ini118d.h | gnodvi/cosmos | 3612456fc2042519f96a49e4d4cc6d3c1f41de7c | [
"PSF-2.0"
] | 1 | 2021-12-13T20:35:46.000Z | 2021-12-13T20:35:46.000Z | ext/de118i/de118i/ini118d.h | gnodvi/cosmos | 3612456fc2042519f96a49e4d4cc6d3c1f41de7c | [
"PSF-2.0"
] | null | null | null | #if UNK
DOUBLE DTR = (DOUBLE )1.74532925199432957692E-2;
DOUBLE RTD = (DOUBLE )5.72957795130823208768E1;
DOUBLE RTS = (DOUBLE )2.06264806247096355156E5; /* arc seconds per radian */
DOUBLE STR = (DOUBLE )4.84813681109535993590E-6; /* radians per arc second */
DOUBLE PI = (DOUBLE )3.14159265358979323846;
/* Standard epochs. Note Julian epochs (J) are measured in
* years of 365.25 days.
*/
DOUBLE J2000 = (DOUBLE )2451545.0; /* 2000 January 1.5 */
DOUBLE B1950 = (DOUBLE )2433282.423; /* 1950 January 0.923 Besselian epoch */
DOUBLE J1900 = (DOUBLE )2415020.0; /* 1900 January 0, 12h UT */
DOUBLE B1900 = (DOUBLE )2415020.313;
DOUBLE Jcentury = (DOUBLE )3.6525e4; /* 1 Julian century */
DOUBLE Jmillenium = (DOUBLE )3.6525e5;
DOUBLE Jtmillenium = (DOUBLE )3.6525e6;
#if !(LDOUBLE)
double Zero = 0.0;
double Fourth = 0.25;
double Half = 0.5;
double One = 1.0;
double OneandaHalf = 1.5;
double Two = 2.0;
double Three = 3.0;
double ThreeandaHalf = 3.5;
double Four = 4.0;
double Five = 5.0;
double Six = 6.0;
double Ten = 10.0;
#endif
/* Solar system barycentric velocity and position
* state of Mercury, Venus, EMB, ..., Pluto, MOON, Sun
* in the order dx/dt, x, dy/dt, y, dz/dt, z for each object.
*
* EMB is the arithmetic average of Earth and Moon, weighted by
* their masses. The coordinates of the Moon variable are the
* the solar system barycentric coordinates of the Moon
* minus those of the Earth.
*/
/* Note, these particular numbers are derived from the heliocentric
* planet states and barycentric Sun state given in the
* documentation for the DE118.
*/
/* June 28.0, 1969 */
DOUBLE JD0 = ((DOUBLE )2440400.50);
DOUBLE yn0[6*NTOTAL] = {
/* Lunar librations */
1.00015500951082782e-4,
6.03343019729665792e-3,
1.49039876740924137e-5,
3.82393007236771923e-1,
-1.19434270765326686e-4,
1.28120436555489181e0,
/* Mercury */
3.7085069798210382186e-003,
3.6030663368975339466e-001,
2.4854958767430945324e-002,
-9.4812876741771684223e-002,
1.2929109014677844626e-002,
-8.7466840117233140436e-002,
/* Venus */
1.1156645711264016669e-002,
6.0786466491731583464e-001,
1.5494075513638794325e-002,
-3.5518362463675619232e-001,
6.2773904546696609267e-003,
-1.9824142909855515515e-001,
/* EMB */
1.6833251020051496668e-002,
1.0820747754938311664e-001,
1.5602036176919105255e-003,
-9.2711110739430602933e-001,
6.7646174015847273137e-004,
-4.0209347855944090112e-001,
/* Mars */
1.4481919298277924969e-002,
-1.2796408611369531836e-001,
8.0528538390447499843e-005,
-1.3262618005333617013e+000,
-3.5188931029397090065e-004,
-6.0530808652523961512e-001,
/* Jupiter */
1.0053452569924098185e-003,
-5.3896824544609061333e+000,
-6.5298425191689416643e-003,
-7.7026549518616593034e-001,
-2.8258787532429609536e-003,
-1.9866431165907522014e-001,
/* Saturn */
-3.1594662504012930114e-003,
7.9527768530257360864e+000,
4.3714634278372622354e-003,
4.5078822184006553686e+000,
1.9441395169137103763e-003,
1.5201955253183338898e+000,
/* Uranus */
1.7108310564806817248e-004,
-1.8278236586353147533e+001,
-3.7646704682815900043e-003,
-9.5764572881482056433e-001,
-1.6519678610257000136e-003,
-1.6132190397271035415e-001,
/* Neptune */
2.6225242764289213785e-003,
-1.6367191358770888335e+001,
-1.5277473123858904045e-003,
-2.3760896725373076342e+001,
-6.9183197562182804864e-004,
-9.3213866179497290101e+000,
/* Pluto */
2.8177758090360373050e-004,
-3.0447680255169362534e+001,
-3.1469590804946202045e-003,
-5.3177934960261367037e-001,
-1.0794238049289112837e-003,
9.0596584886274922101e+000,
#if EXTRA_BODY
/* Fictitious asteroid */
0.0e0,
3.0e0,
1.0e-2,
0.0e0,
0.0e0,
0.0e0,
#endif
#if MOON
5.98752118417335956e-4,
-8.35703164195952601e-4,
-1.74153713527242722e-4,
-1.98543915768166071e-3,
-8.84771962437116281e-5,
-1.08326877048661754e-3,
#endif
/* Sun */
-2.8369446340813151639e-007,
4.5144118714356666407e-003,
5.1811944086463255444e-006,
7.2282841152065867346e-004,
2.2306588340621263489e-006,
2.4659100492567986271e-004,
/* Asteroid states follow */
};
/* Test state, 100 days later: */
#if 0
DOUBLE JD1 = ((DOUBLE )2440500.50);
DOUBLE yn1[6*NTOTAL] = {
-3.85893930164594646e-5,
1.29694398195755468e-2,
1.14905257263582262e-5,
3.82508699238156682e-1,
4.75391383166468672e-5,
1.27428371119265801e0,
-2.43015281791706444e-002,
2.40773527079857565e-001,
1.87910251556777273e-002,
1.96954621939863219e-001,
1.25591312851252066e-002,
8.10048178490518384e-002,
-1.63440955802718280e-002,
-4.21860322028048782e-001,
-1.14246422850682140e-002,
5.17869026250609690e-001,
-4.11622909296383714e-003,
2.60203829195766570e-001,
-3.94484632235194096e-003,
9.81177706008309405e-001,
1.53727031456690289e-002,
1.96484576859672724e-001,
6.66612671337020014e-003,
8.51297144135776147e-002,
8.50596535330489333e-003,
1.14162585220489816e+000,
1.16329928693268469e-002,
-7.02290330317807430e-001,
5.11130674190038601e-003,
-3.52984793305744779e-001,
1.97739891612302323e-003,
-5.24031415190823051e+000,
-6.33006771988879063e-003,
-1.41424053721658884e+000,
-2.76393462026492719e-003,
-4.78580847895956282e-001,
-3.45070902605290058e-003,
7.62218572268596801e+000,
4.19480008161587867e-003,
4.93634138197818904e+000,
1.88368464231530789e-003,
1.71165065659011950e+000,
2.59339002502375430e-004,
-1.82567140746315272e+001,
-3.75914213576224408e-003,
-1.33385143258585295e+000,
-1.65079191573496991e-003,
-3.26466517509008289e-001,
2.63977839373647663e-003,
-1.61040739057229584e+001,
-1.50241016013489575e-003,
-2.39124059584972814e+001,
-6.81887221476645979e-004,
-9.39007319300685950e+000,
3.09967640221318611e-004,
-3.04180939220586550e+001,
-3.14632190270354497e-003,
-8.46445850516399332e-001,
-1.08776892324236050e-003,
8.95129835863062695e+000,
#if EXTRA_BODY
/* Fictitious asteroid */
0.0e0,
3.0e0,
1.0e-2,
0.0e0,
0.0e0,
0.0e0,
#endif
#if MOON
-4.22681402426694080e-4,
-1.72474926563029233e-3,
-3.21609581451700993e-4,
1.82647356024942241e-3,
-1.82676776570974036e-4,
9.67995005426182924e-4,
#endif
-9.96208174079740373e-007, /* rotated from DE200 */
4.45122038203489470e-003,
5.06057698826071977e-006,
1.23363163514498492e-003,
2.19376032512757903e-006,
4.67156762898216060e-004,
};
#endif /* 0 */
#if 1
DOUBLE JD1 = ((DOUBLE )2440800.50);
DOUBLE yn1[6*NTOTAL] = {
1.19798509852348462e-4,
3.26749396278042651e-2,
-6.85863913398886621e-5,
3.85255316277713118e-1,
-9.87921606265917336e-5,
1.25594900035445747e0,
1.1640059959070938016e-002,
-3.4350297408563828055e-001,
-1.7964875644231269124e-002,
-2.5118910315168408963e-001,
-1.0817311005210173814e-002,
-9.9170891227838064646e-002,
1.8597282203783061216e-002,
-2.6914630075961837156e-001,
-6.5864799228651037249e-003,
-6.1655661757510340864e-001,
-4.1428517490915759141e-003,
-2.6070731202257053265e-001,
1.3083581197550196016e-002,
6.4260215465460413745e-001,
9.8846107560980890857e-003,
-7.2083597294516633464e-001,
4.2862797207098424858e-003,
-3.1263839868006851566e-001,
-1.0289202815795734684e-002,
-1.0394941428468679346e+000,
-7.0723334989418045152e-003,
1.1522403836312279294e+000,
-2.9703138309275424941e-003,
5.5677401157133424433e-001,
4.6228653666202124358e-003,
-4.2373615722355993645e+000,
-5.0555918692615562352e-003,
-3.1464733091277224306e+000,
-2.2818455722493645242e-003,
-1.2462241659031373286e+000,
-4.2556740044874090445e-003,
6.4633979534971069954e+000,
3.5633047172379600052e-003,
6.1037564142437140792e+000,
1.6573768541155527860e-003,
2.2444618449141959815e+000,
5.2274776790945661154e-004,
-1.8139340904007687965e+001,
-3.7317457890160985748e-003,
-2.4578888288247007605e+000,
-1.6425078479167742140e-003,
-8.2063943185823257564e-001,
2.6898588576179062356e-003,
-1.5304564931392374665e+001,
-1.4254385368896515149e-003,
-2.4351618762495032811e+001,
-6.5161737589378315099e-004,
-9.5901150170962550989e+000,
3.9518201228036738355e-004,
-3.0312344985766555864e+001,
-3.1426251869952901448e-003,
-1.7898553889579568107e+000,
-1.1124350707669052540e-003,
8.6212535443336042115e+000,
#if EXTRA_BODY
/* Fictitious asteroid */
0.0e0,
3.0e0,
1.0e-2,
0.0e0,
0.0e0,
0.0e0,
#endif
#if MOON
-4.58408893102436927e-4,
-1.60130208907259920e-3,
-2.78697065392994499e-4,
1.95720839700677492e-3,
-1.70697259101564644e-4,
9.68483037769266028e-4,
#endif
/* rotated from DE200 */
/*
-3.44322101864905357e-006,
3.77983010651375442e-003,
4.03605242892639870e-006,
2.63055823065286220e-003,
1.81002374725178528e-006,
1.08188006521861207e-003,
*/
-3.4432210186490844452e-006,
3.7798301065137354516e-003,
4.0360524289263751236e-006,
2.6305582306528893588e-003,
1.8100237472517860139e-006,
1.0818800652186113487e-003,
};
#endif /* 1 */
/* Speed of light.
*/
/* DOUBLE CLIGHT = (DOUBLE)2.99792458e5; */
DOUBLE C = ((DOUBLE ) 173.144632720536344565);
/* Earth's mass divided by Moon's mass
*/
#define EMRATd ((DOUBLE ) 8.13005869999999999376E1)
DOUBLE EMRAT = EMRATd;
/* Gaussian gravitational constant */
DOUBLE KG = 0.01720209895;
/* GM's of the solar system bodies
* These are scaled such that GMsun = k^2
* (k = Gaussian gravitational constant).
*/
DOUBLE GMs[] = {
#if LIBRAT
0.0, /*place holder for libration */
#endif
4.91254745145081175785E-11, /* Mercury */
7.24345620963276523095E-10, /* Venus */
#if MOON
/* (GMB*EMRAT)/(1.0+EMRAT), Earth only */
8.88769273403302327042E-10,
#else
8.99701165855730774179E-10, /* EMB */
#endif
9.54952894222405763492E-11, /* Mars */
2.82534210344592625472E-7, /* Jupiter */
8.45946850483065929285E-8, /* Saturn */
1.28881623813803488851E-8, /* Uranus */
1.53211248128427618918E-8, /* Neptune */
2.27624775186369921644E-12, /* Pluto */
#if EXTRA_BODY
1.0e-16, /* Fictitious asteroid */
#endif
#if MOON
/* (GMB)/(1.0+EMRAT), Moon only */
1.09318924524284471369E-11,
#endif
2.95912208285591102582E-4, /* Sun */
#if AROIDS
1.746e-13, /* Ceres */
3.2e-14, /* Pallas */
4.08e-14, /* Vesta */
1.6e-15, /* Iris */
2.6e-15 /* Bamberga */
#endif
};
/* Astronomical unit */
DOUBLE AU = 1.4959787066e11;
/* kilometers: */
DOUBLE RADS = 6.96e5;
DOUBLE RADM = 1738.0;
DOUBLE RADE = 6378.14;
DOUBLE Je[] = {
1.08263e-3, /* J2E */
-2.54e-6, /* J3E */
-1.61e-6 /* J4E */
};
DOUBLE Jm[] = {
2.02150907893e-4, /* J2M */
1.21260448837e-5, /* J3M */
-1.45383007072e-7, /* J4M */
};
DOUBLE Cnm[8] = {
2.230351309e-5, /* C22 */
3.07082741328e-5, /* C31 */
4.88840471683e-6, /* C32 */
1.43603108489e-6, /* C33 */
-7.17780149806e-6, /* C41 */
-1.43951838385e-6, /* C42 */
-8.54788154819e-8, /* C43 */
-1.5490389313e-7 /* C44 */
};
DOUBLE Snm[8] = {
0.0, /* S22 */
5.61066891941e-6, /* S31 */
1.68743052295e-6, /* S32 */
-3.343544677e-7, /* S33 */
2.94743374914e-6, /* S41 */
-2.8843721272e-6, /* S42 */
-7.88967312839e-7, /* S43 */
5.6404155572e-8 /* S44 */
};
DOUBLE K2M = 2.22160557154e-2;
DOUBLE LOVENO = 0.30;
DOUBLE PHASE = 4.0700012e-2;
/* DE118 initial psidot: */
DOUBLE PSLP1 = 2.29971502189818919e-1;
/* PSLPI = 2 pi / PSLP1 = period in days */
DOUBLE PSLPI = 27.32158222801637949485;
/* PSLPA + PSLPB = PSLPI */
DOUBLE PSLPIA = 27.3215820789337158203125; /* only top 26 bits are nonzero */
DOUBLE PSLPIB = 1.490826636745416323896386e-7;
DOUBLE JDEPOCH = 2440400.5;
/* (C-A)/B */
#define LBETd 6.31686773468e-4
DOUBLE LBET = LBETd;
/* (B-A)/C */
#define LGAMd 2.28022183594e-4
DOUBLE LGAM = LGAMd;
/* C/MR^2 */
/*
DOUBLE CMRSQ 0.3906895261319410091
DOUBLE LGAMBET = (LGAMd - LBETd)/(1.0-LBETd*LGAMd);
DOUBLE CMR2 = CMRSQ*AMd*AMd;
DOUBLE BMR2 = CMRSQ*AMd*AMd*(1.0 + LGAMd)/(1.0 + LBETd);
DOUBLE AMR2 = CMRSQ*AMd*AMd*(1.0 - LBETd * LGAMd)/(1.0 + LBETd);
*/
DOUBLE LGAMBET = -4.03664648017289733947E-4;
/* equatorial radius of Earth, in au */
DOUBLE AE = 4.26352325064817808471E-5;
/* equatorial radius of Moon, in au */
#define AMd 1.16178124180819699985E-5
DOUBLE AM = AMd;
DOUBLE CMRSQ = 0.3906895261319410091;
DOUBLE CMR2 = 5.2732758299330413853212309E-11;
DOUBLE BMR2 = 5.2711485389894113965222358E-11;
DOUBLE AMR2 = 5.2699461151199766018387453E-11;
#endif /* UNK */
#if IBMPC
short DTR[] = {0x9d39,0xa252,0xdf46,0x3f91};
short RTD[] = {0xc1f8,0x1a63,0xa5dc,0x404c};
short RTS[] = {0xad7b,0x7331,0x2dc6,0x4109};
short STR[] = {0x8f9d,0xb2ff,0x55a5,0x3ed4};
short PI[] = {0x2d18,0x5444,0x21fb,0x4009};
short J2000[] = {0x0000,0x8000,0xb42c,0x4142};
short B1950[] = {0xdd2f,0x3624,0x9081,0x4142};
short J1900[] = {0x0000,0x0000,0x6cd6,0x4142};
short B1900[] = {0x624e,0x2810,0x6cd6,0x4142};
short Jcentury[] = {0x0000,0x0000,0xd5a0,0x40e1};
short Jmillenium[] = {0x0000,0x0000,0x4b08,0x4116};
short Jtmillenium[] = {0x0000,0x0000,0xddca,0x414b};
short Zero[] = {0x0000,0x0000,0x0000,0x0000};
short Fourth[] = {0x0000,0x0000,0x0000,0x3fd0};
short Half[] = {0x0000,0x0000,0x0000,0x3fe0};
short One[] = {0x0000,0x0000,0x0000,0x3ff0};
short OneandaHalf[] = {0x0000,0x0000,0x0000,0x3ff8};
short Two[] = {0x0000,0x0000,0x0000,0x4000};
short Three[] = {0x0000,0x0000,0x0000,0x4008};
short ThreeandaHalf[] = {0x0000,0x0000,0x0000,0x400c};
short Four[] = {0x0000,0x0000,0x0000,0x4010};
short Five[] = {0x0000,0x0000,0x0000,0x4014};
short Six[] = {0x0000,0x0000,0x0000,0x4018};
short Ten[] = {0x0000,0x0000,0x0000,0x4024};
short JD0[] = {0x0000,0x4000,0x9e68,0x4142};
short yn0[4*6*NTOTAL] = {
0xa479,0x3903,0x37ed,0x3f1a,
0xd720,0x9614,0xb682,0x3f78,
0xc10e,0x77ee,0x4184,0x3eef,
0x4406,0x8513,0x7920,0x3fd8,
0x7f80,0x25d8,0x4f19,0xbf1f,
0xcf9f,0x2618,0x7fd0,0x3ff4,
0x0dd3,0x8640,0x614d,0x3f6e,
0xad8d,0x8e0e,0x0f43,0x3fd7,
0xbbc3,0x0c32,0x7394,0x3f99,
0x787c,0x1cd8,0x45a8,0xbfb8,
0x5fd5,0xa313,0x7a93,0x3f8a,
0xb8df,0x11c9,0x643a,0xbfb6,
0x18a2,0xa3b4,0xd94b,0x3f86,
0xd806,0x9906,0x73a0,0x3fe3,
0x1500,0x9ce7,0xbb5b,0x3f8f,
0xef55,0x18f8,0xbb54,0xbfd6,
0xfd65,0x2b4f,0xb652,0x3f79,
0x657d,0xa358,0x5ff9,0xbfc9,
0x467c,0x5a77,0x3cbc,0x3f91,
0xdb72,0x3941,0xb37c,0x3fbb,
0x6d8d,0xe0d6,0x8ff7,0x3f59,
0x8a59,0xe9c0,0xaae4,0xbfed,
0x60c3,0x8686,0x2a92,0x3f46,
0x4052,0x4916,0xbbe6,0xbfd9,
0xc307,0x4e27,0xa8b2,0x3f8d,
0xde62,0x8e75,0x6120,0xbfc0,
0xfa3e,0xc14f,0x1c2d,0x3f15,
0x990b,0x4b33,0x385e,0xbff5,
0xb969,0x145b,0x0fb9,0xbf37,
0x2af2,0x1074,0x5eaf,0xbfe3,
0x86d9,0x3fff,0x78b9,0x3f50,
0xf03b,0xead6,0x8f08,0xc015,
0xf544,0x4115,0xbf09,0xbf7a,
0xfa7f,0xd2e1,0xa603,0xbfe8,
0x0667,0x1a7c,0x264c,0xbf67,
0xa25a,0x08ba,0x6dd5,0xbfc9,
0x39d8,0x86fc,0xe1e1,0xbf69,
0x867d,0xbc40,0xcfa4,0x401f,
0xdfa5,0xc754,0xe7cf,0x3f71,
0x00c3,0x46b9,0x0812,0x4012,
0x635e,0xe937,0xda4f,0x3f5f,
0x48d8,0x8b0c,0x52b8,0x3ff8,
0xc0dd,0xaff3,0x6c98,0x3f26,
0xeffd,0x834e,0x473a,0xc032,
0xdb5c,0x1153,0xd716,0xbf6e,
0x3d5a,0xa7cd,0xa508,0xbfee,
0x3d83,0xfbfa,0x10da,0xbf5b,
0x7aaa,0x36d8,0xa632,0xbfc4,
0xdebd,0x0001,0x7bd5,0x3f65,
0x4b76,0x40bd,0x5e00,0xc030,
0x657e,0x2f91,0x07d6,0xbf59,
0x1c61,0x20b7,0xc2ca,0xc037,
0xebac,0xdad4,0xab81,0xbf46,
0xeea9,0xc96a,0xa48c,0xc022,
0x6d46,0x7ea6,0x7771,0x3f32,
0x0471,0x2c57,0x729b,0xc03e,
0x738a,0xcaa4,0xc7a6,0xbf69,
0x676f,0x2067,0x0456,0xbfe1,
0x52c0,0x7c34,0xaf6e,0xbf51,
0x2af1,0x8eb3,0x1e8b,0x4022,
#if EXTRA_BODY
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
#endif
0x7ce0,0x622d,0x9eb2,0x3f43,
0x89e4,0xe133,0x6262,0xbf4b,
0x4f4f,0x0216,0xd3a1,0xbf26,
0x9bd6,0x8803,0x43c4,0xbf60,
0x7dd2,0xa840,0x319a,0xbf17,
0x0681,0xfc4a,0xbf8e,0xbf51,
0x48a5,0x71ec,0x09d5,0xbe93,
0x6a9d,0x3593,0x7db4,0x3f72,
0x746b,0xdfe0,0xbb43,0x3ed5,
0x49f8,0x31ad,0xaf86,0x3f47,
0xfbb2,0xa9ae,0xb64d,0x3ec2,
0x8354,0x4d38,0x291c,0x3f30,
};
short JD1[] = {0x0000,0x4000,0x9f30,0x4142};
short yn1[4*6*NTOTAL] = {
0xa4f1,0xba4a,0x678a,0x3f1f,
0x4c98,0x0a33,0xbac5,0x3fa0,
0x409d,0x3b24,0xfac1,0xbf11,
0x776e,0xea01,0xa805,0x3fd8,
0x42dd,0x655e,0xe5d4,0xbf19,
0x75ea,0xfa9f,0x185d,0x3ff4,
0x110e,0x66c8,0xd6be,0x3f87,
0xb307,0xe5f1,0xfbf3,0xbfd5,
0x8750,0x6579,0x6562,0xbf92,
0x79b6,0x75c9,0x137b,0xbfd0,
0xfba7,0xe7fb,0x2762,0xbf86,
0xeab8,0x7689,0x6343,0xbfb9,
0x5d56,0x7b70,0x0b2a,0x3f93,
0x8633,0x67e6,0x39b1,0xbfd1,
0xda89,0xbdd4,0xfa6c,0xbf7a,
0xc222,0xf193,0xbad4,0xbfe3,
0x7407,0x4c64,0xf818,0xbf70,
0xc2b1,0xb8bd,0xaf6d,0xbfd0,
0x4358,0x8add,0xcb90,0x3f8a,
0x94c2,0x64d2,0x9032,0x3fe4,
0xf4e0,0xff72,0x3e61,0x3f84,
0x8df8,0x9a32,0x1116,0xbfe7,
0x228f,0x738d,0x8e7d,0x3f71,
0x8045,0x7c73,0x0244,0xbfd4,
0x1a91,0x6cc4,0x1281,0xbf85,
0x92d8,0x9c3e,0xa1c4,0xbff0,
0x8a30,0x1159,0xf7e1,0xbf7c,
0x39d3,0x9ccd,0x6f93,0x3ff2,
0xf56c,0x1867,0x5533,0xbf68,
0xc57a,0xbb5e,0xd117,0x3fe1,
0xdec3,0xf903,0xef6c,0x3f72,
0x50f0,0xe978,0xf30e,0xc010,
0xafa7,0x1bd8,0xb52c,0xbf74,
0x8613,0x32c3,0x2bfa,0xc009,
0x4682,0x836f,0xb160,0xbf62,
0x9f24,0xc040,0xf088,0xbff3,
0x53cd,0xcabf,0x6e65,0xbf71,
0x36af,0xfe3d,0xda84,0x4019,
0x30d1,0xa73d,0x30ca,0x3f6d,
0xb53a,0x1f17,0x6a3f,0x4018,
0x3d27,0xd8ad,0x278a,0x3f5b,
0x35db,0x6968,0xf4a8,0x4001,
0xee4c,0x489a,0x2120,0x3f41,
0xb546,0xd871,0x23ab,0xc032,
0xaca3,0xc3dd,0x9209,0xbf6e,
0x0bf2,0x9e48,0xa9c1,0xc003,
0xdc66,0x5f5f,0xe92d,0xbf5a,
0x73c0,0xa034,0x42ad,0xbfea,
0xde76,0xfa60,0x090a,0x3f66,
0xad6e,0xef47,0x9bef,0xc02e,
0x5f1e,0xf97f,0x5ab8,0xbf57,
0x937f,0xafed,0x5a03,0xc038,
0xfb0f,0xa8d3,0x5a29,0xbf45,
0x9d22,0x8e36,0x2e23,0xc023,
0x162a,0xd197,0xe60d,0x3f39,
0xefdb,0xd74a,0x4ff5,0xc03e,
0xfa3f,0x0cda,0xbe90,0xbf69,
0x4cf0,0x6782,0xa33f,0xbffc,
0x0ed3,0x0fdd,0x39e4,0xbf52,
0xdfb3,0xf1ce,0x3e14,0x4021,
#if EXTRA_BODY
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
#endif
0xf74e,0x343d,0x0ad3,0xbf3e,
0x1bd1,0x06a1,0x3c59,0xbf5a,
0xd241,0xc806,0x43c2,0xbf32,
0xac3c,0x41cf,0x0890,0x3f60,
0x5f17,0x4a6c,0x5fa6,0xbf26,
0x6280,0x7caa,0xbc39,0x3f4f,
0x5695,0xc604,0xe242,0xbecc,
0x2615,0xd624,0xf6e0,0x3f6e,
0xd7aa,0xa4db,0xedad,0x3ed0,
0xa17d,0x3244,0x8cae,0x3f65,
0x7a70,0x281a,0x5dfe,0x3ebe,
0x486d,0xdfe4,0xb9bb,0x3f51,
};
short CLIGHT[] = {0xf3b6,0xd4fd,0x4c41,0x4112};
short C[] = {0x9453,0xd4cc,0xa4a0,0x4065};
short EMRAT[] = {0xa693,0xd141,0x533c,0x4054};
short KG[] = {0xb69a,0x51a6,0x9d6d,0x3f91};
short GMs[] = {
0x0000,0x0000,0x0000,0x0000,
0x30a7,0xbfef,0x01cb,0x3dcb,
0x9305,0x5596,0xe369,0x3e08,
0x614e,0x7bf8,0x89b2,0x3e0e,
0xe19b,0x330d,0x3fe2,0x3dda,
0x594a,0x991b,0xf5e6,0x3e92,
0xa2cf,0x700f,0xb54d,0x3e76,
0xddff,0x9a62,0xad57,0x3e4b,
0xf7c8,0x4ffd,0x7370,0x3e50,
0xde3d,0x7dd0,0x05a7,0x3d84,
#if EXTRA_BODY
0x0,0x0,0x0,0x0,
#endif
0x5e14,0xbc9f,0x0a1b,0x3da8,
0x95e6,0x41cf,0x6495,0x3f33,
0x5b6d,0xc1f4,0x92a0,0x3d48,
0x5616,0x9ee7,0x03af,0x3d22,
0x8dc2,0x5100,0xf7e6,0x3d26,
0x89bc,0x97d8,0xd2b2,0x3cdc,
0xefe9,0x1b5f,0x6b31,0x3ce7,
};
short AU[] = {0x0000,0x2d22,0x6a5d,0x4241};
short RADS[] = {0x0000,0x0000,0x3d80,0x4125};
short RADM[] = {0x0000,0x0000,0x2800,0x409b};
short RADE[] = {0x3d71,0xd70a,0xea23,0x40b8};
short AE[] = {0x85dd,0x6f26,0x5a67,0x3f06};
short Je[] = {
0x107b,0x1c65,0xbce1,0x3f51,
0x2b21,0xc46c,0x4e9b,0xbec5,
0x1061,0xb881,0x02e5,0xbebb,
};
short AM[] = {0xde5a,0xfaf9,0x5d43,0x3ee8};
short Jm[] = {
0x70b6,0x1396,0x7f0f,0x3f2a,
0x6b20,0xeb27,0x6e1e,0x3ee9,
0xdbeb,0x743c,0x8352,0xbe83,
};
short Cnm[] = {
0x2d4f,0xbfb9,0x630d,0x3ef7,
0xd5a6,0x43d2,0x1998,0x3f00,
0x9b68,0x74f4,0x80e2,0x3ed4,
0xd94e,0xe02c,0x17b4,0x3eb8,
0x0276,0x0d60,0x1b1b,0xbede,
0x98f0,0x3391,0x26af,0xbeb8,
0x6738,0x398d,0xf20f,0xbe76,
0x72ec,0x0db0,0xca75,0xbe84,
};
short Snm[] = {
0x0000,0x0000,0x0000,0x0000,
0x0433,0xeddb,0x8868,0x3ed7,
0xf086,0x7b25,0x4f75,0x3ebc,
0x2d26,0x8009,0x702a,0xbe96,
0x9be9,0xd6f2,0xb990,0x3ec8,
0x0bce,0x58aa,0x3224,0xbec8,
0x7ebf,0x7803,0x792d,0xbeaa,
0x4c3e,0xcc08,0x4820,0x3e6e,
};
short K2M[] = {0x9b68,0x42f9,0xbfce,0x3f96};
short LOVENO[] = {0x3333,0x3333,0x3333,0x3fd3};
short PHASE[] = {0x3ed7,0xc8f9,0xd6a1,0x3fa4};
short PSLP1[] = {0x68ee,0xc875,0x6fb4,0x3fcd};
short PSLPI[] = {0x4e1f,0x3680,0x5253,0x403b};
short PSLPIA[] = {0x0000,0x3400,0x5253,0x403b};
short PSLPIB[] = {0x397b,0xfa49,0x0270,0x3e84};
short JDEPOCH[] = {0x0000,0x4000,0x9e68,0x4142};
short LBET[] = {0x2ad9,0x0445,0xb2f9,0x3f44};
short LGAM[] = {0x44a6,0xa481,0xe327,0x3f2d};
short LGAMBET[] = {0x94f0,0x7637,0x745e,0xbf3a};
short CMRSQ[] = {0x1755,0xa468,0x010e,0x3fd9};
short CMR2[] = {0x0314,0xd853,0xfd79,0x3dcc};
short BMR2[] = {0xc125,0x685d,0xfa7b,0x3dcc};
short AMR2[] = {0xdbbe,0x3056,0xf8ca,0x3dcc};
#endif
#if MIEEE
short DTR[] = {0x3f91,0xdf46,0xa252,0x9d39};
short RTD[] = {0x404c,0xa5dc,0x1a63,0xc1f8};
short RTS[] = {0x4109,0x2dc6,0x7331,0xad7b};
short STR[] = {0x3ed4,0x55a5,0xb2ff,0x8f9d};
short PI[] = {0x4009,0x21fb,0x5444,0x2d18};
short J2000[] = {0x4142,0xb42c,0x8000,0x0000};
short B1950[] = {0x4142,0x9081,0x3624,0xdd2f};
short J1900[] = {0x4142,0x6cd6,0x0000,0x0000};
short B1900[] = {0x4142,0x6cd6,0x2810,0x624e};
short Jcentury[] = {0x40e1,0xd5a0,0x0000,0x0000};
short Jmillenium[] = {0x4116,0x4b08,0x0000,0x0000};
short Jtmillenium[] = {0x414b,0xddca,0x0000,0x0000};
short Zero[] = {0x0000,0x0000,0x0000,0x0000};
short Fourth[] = {0x3fd0,0x0000,0x0000,0x0000};
short Half[] = {0x3fe0,0x0000,0x0000,0x0000};
short One[] = {0x3ff0,0x0000,0x0000,0x0000};
short OneandaHalf[] = {0x3ff8,0x0000,0x0000,0x0000};
short Two[] = {0x4000,0x0000,0x0000,0x0000};
short Three[] = {0x4008,0x0000,0x0000,0x0000};
short ThreeandaHalf[] = {0x400c,0x0000,0x0000,0x0000};
short Four[] = {0x4010,0x0000,0x0000,0x0000};
short Five[] = {0x4014,0x0000,0x0000,0x0000};
short Six[] = {0x4018,0x0000,0x0000,0x0000};
short Ten[] = {0x4024,0x0000,0x0000,0x0000};
short JD0[] = {0x4142,0x9e68,0x4000,0x0000};
short yn0[4*6*NTOTAL] = {
0x3f1a,0x37ed,0x3903,0xa479,
0x3f78,0xb682,0x9614,0xd720,
0x3eef,0x4184,0x77ee,0xc10e,
0x3fd8,0x7920,0x8513,0x4406,
0xbf1f,0x4f19,0x25d8,0x7f80,
0x3ff4,0x7fd0,0x2618,0xcf9f,
0x3f6e,0x614d,0x8640,0x0dd3,
0x3fd7,0x0f43,0x8e0e,0xad8d,
0x3f99,0x7394,0x0c32,0xbbc3,
0xbfb8,0x45a8,0x1cd8,0x787c,
0x3f8a,0x7a93,0xa313,0x5fd5,
0xbfb6,0x643a,0x11c9,0xb8df,
0x3f86,0xd94b,0xa3b4,0x18a2,
0x3fe3,0x73a0,0x9906,0xd806,
0x3f8f,0xbb5b,0x9ce7,0x1500,
0xbfd6,0xbb54,0x18f8,0xef55,
0x3f79,0xb652,0x2b4f,0xfd65,
0xbfc9,0x5ff9,0xa358,0x657d,
0x3f91,0x3cbc,0x5a77,0x467c,
0x3fbb,0xb37c,0x3941,0xdb72,
0x3f59,0x8ff7,0xe0d6,0x6d8d,
0xbfed,0xaae4,0xe9c0,0x8a59,
0x3f46,0x2a92,0x8686,0x60c3,
0xbfd9,0xbbe6,0x4916,0x4052,
0x3f8d,0xa8b2,0x4e27,0xc307,
0xbfc0,0x6120,0x8e75,0xde62,
0x3f15,0x1c2d,0xc14f,0xfa3e,
0xbff5,0x385e,0x4b33,0x990b,
0xbf37,0x0fb9,0x145b,0xb969,
0xbfe3,0x5eaf,0x1074,0x2af2,
0x3f50,0x78b9,0x3fff,0x86d9,
0xc015,0x8f08,0xead6,0xf03b,
0xbf7a,0xbf09,0x4115,0xf544,
0xbfe8,0xa603,0xd2e1,0xfa7f,
0xbf67,0x264c,0x1a7c,0x0667,
0xbfc9,0x6dd5,0x08ba,0xa25a,
0xbf69,0xe1e1,0x86fc,0x39d8,
0x401f,0xcfa4,0xbc40,0x867d,
0x3f71,0xe7cf,0xc754,0xdfa5,
0x4012,0x0812,0x46b9,0x00c3,
0x3f5f,0xda4f,0xe937,0x635e,
0x3ff8,0x52b8,0x8b0c,0x48d8,
0x3f26,0x6c98,0xaff3,0xc0dd,
0xc032,0x473a,0x834e,0xeffd,
0xbf6e,0xd716,0x1153,0xdb5c,
0xbfee,0xa508,0xa7cd,0x3d5a,
0xbf5b,0x10da,0xfbfa,0x3d83,
0xbfc4,0xa632,0x36d8,0x7aaa,
0x3f65,0x7bd5,0x0001,0xdebd,
0xc030,0x5e00,0x40bd,0x4b76,
0xbf59,0x07d6,0x2f91,0x657e,
0xc037,0xc2ca,0x20b7,0x1c61,
0xbf46,0xab81,0xdad4,0xebac,
0xc022,0xa48c,0xc96a,0xeea9,
0x3f32,0x7771,0x7ea6,0x6d46,
0xc03e,0x729b,0x2c57,0x0471,
0xbf69,0xc7a6,0xcaa4,0x738a,
0xbfe1,0x0456,0x2067,0x676f,
0xbf51,0xaf6e,0x7c34,0x52c0,
0x4022,0x1e8b,0x8eb3,0x2af1,
#if EXTRA_BODY
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
#endif
0x3f43,0x9eb2,0x622d,0x7ce0,
0xbf4b,0x6262,0xe133,0x89e4,
0xbf26,0xd3a1,0x0216,0x4f4f,
0xbf60,0x43c4,0x8803,0x9bd6,
0xbf17,0x319a,0xa840,0x7dd2,
0xbf51,0xbf8e,0xfc4a,0x0681,
0xbe93,0x09d5,0x71ec,0x48a5,
0x3f72,0x7db4,0x3593,0x6a9d,
0x3ed5,0xbb43,0xdfe0,0x746b,
0x3f47,0xaf86,0x31ad,0x49f8,
0x3ec2,0xb64d,0xa9ae,0xfbb2,
0x3f30,0x291c,0x4d38,0x8354,
};
short JD1[] = {0x4142,0x9f30,0x4000,0x0000};
short yn1[4*6*NTOTAL] = {
0x3f1f,0x678a,0xba4a,0xa4f1,
0x3fa0,0xbac5,0x0a33,0x4c98,
0xbf11,0xfac1,0x3b24,0x409d,
0x3fd8,0xa805,0xea01,0x776e,
0xbf19,0xe5d4,0x655e,0x42dd,
0x3ff4,0x185d,0xfa9f,0x75ea,
0x3f87,0xd6be,0x66c8,0x110e,
0xbfd5,0xfbf3,0xe5f1,0xb307,
0xbf92,0x6562,0x6579,0x8750,
0xbfd0,0x137b,0x75c9,0x79b6,
0xbf86,0x2762,0xe7fb,0xfba7,
0xbfb9,0x6343,0x7689,0xeab8,
0x3f93,0x0b2a,0x7b70,0x5d56,
0xbfd1,0x39b1,0x67e6,0x8633,
0xbf7a,0xfa6c,0xbdd4,0xda89,
0xbfe3,0xbad4,0xf193,0xc222,
0xbf70,0xf818,0x4c64,0x7407,
0xbfd0,0xaf6d,0xb8bd,0xc2b1,
0x3f8a,0xcb90,0x8add,0x4358,
0x3fe4,0x9032,0x64d2,0x94c2,
0x3f84,0x3e61,0xff72,0xf4e0,
0xbfe7,0x1116,0x9a32,0x8df8,
0x3f71,0x8e7d,0x738d,0x228f,
0xbfd4,0x0244,0x7c73,0x8045,
0xbf85,0x1281,0x6cc4,0x1a91,
0xbff0,0xa1c4,0x9c3e,0x92d8,
0xbf7c,0xf7e1,0x1159,0x8a30,
0x3ff2,0x6f93,0x9ccd,0x39d3,
0xbf68,0x5533,0x1867,0xf56c,
0x3fe1,0xd117,0xbb5e,0xc57a,
0x3f72,0xef6c,0xf903,0xdec3,
0xc010,0xf30e,0xe978,0x50f0,
0xbf74,0xb52c,0x1bd8,0xafa7,
0xc009,0x2bfa,0x32c3,0x8613,
0xbf62,0xb160,0x836f,0x4682,
0xbff3,0xf088,0xc040,0x9f24,
0xbf71,0x6e65,0xcabf,0x53cd,
0x4019,0xda84,0xfe3d,0x36af,
0x3f6d,0x30ca,0xa73d,0x30d1,
0x4018,0x6a3f,0x1f17,0xb53a,
0x3f5b,0x278a,0xd8ad,0x3d27,
0x4001,0xf4a8,0x6968,0x35db,
0x3f41,0x2120,0x489a,0xee4c,
0xc032,0x23ab,0xd871,0xb546,
0xbf6e,0x9209,0xc3dd,0xaca3,
0xc003,0xa9c1,0x9e48,0x0bf2,
0xbf5a,0xe92d,0x5f5f,0xdc66,
0xbfea,0x42ad,0xa034,0x73c0,
0x3f66,0x090a,0xfa60,0xde76,
0xc02e,0x9bef,0xef47,0xad6e,
0xbf57,0x5ab8,0xf97f,0x5f1e,
0xc038,0x5a03,0xafed,0x937f,
0xbf45,0x5a29,0xa8d3,0xfb0f,
0xc023,0x2e23,0x8e36,0x9d22,
0x3f39,0xe60d,0xd197,0x162a,
0xc03e,0x4ff5,0xd74a,0xefdb,
0xbf69,0xbe90,0x0cda,0xfa3f,
0xbffc,0xa33f,0x6782,0x4cf0,
0xbf52,0x39e4,0x0fdd,0x0ed3,
0x4021,0x3e14,0xf1ce,0xdfb3,
#if EXTRA_BODY
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
#endif
0xbf3e,0x0ad3,0x343d,0xf74e,
0xbf5a,0x3c59,0x06a1,0x1bd1,
0xbf32,0x43c2,0xc806,0xd241,
0x3f60,0x0890,0x41cf,0xac3c,
0xbf26,0x5fa6,0x4a6c,0x5f17,
0x3f4f,0xbc39,0x7caa,0x6280,
0xbecc,0xe242,0xc604,0x5695,
0x3f6e,0xf6e0,0xd624,0x2615,
0x3ed0,0xedad,0xa4db,0xd7aa,
0x3f65,0x8cae,0x3244,0xa17d,
0x3ebe,0x5dfe,0x281a,0x7a70,
0x3f51,0xb9bb,0xdfe4,0x486d,
};
short CLIGHT[] = {0x4112,0x4c41,0xd4fd,0xf3b6};
short C[] = {0x4065,0xa4a0,0xd4cc,0x9453};
short EMRAT[] = {0x4054,0x533c,0xd141,0xa693};
short KG[] = {0x3f91,0x9d6d,0x51a6,0xb69a};
short GMs[] = {
0x0000,0x0000,0x0000,0x0000,
0x3dcb,0x01cb,0xbfef,0x30a7,
0x3e08,0xe369,0x5596,0x9305,
0x3e0e,0x89b2,0x7bf8,0x614e,
0x3dda,0x3fe2,0x330d,0xe19b,
0x3e92,0xf5e6,0x991b,0x594a,
0x3e76,0xb54d,0x700f,0xa2cf,
0x3e4b,0xad57,0x9a62,0xddff,
0x3e50,0x7370,0x4ffd,0xf7c8,
0x3d84,0x05a7,0x7dd0,0xde3d,
#if EXTRA_BODY
0x0,0x0,0x0,0x0,
#endif
0x3da8,0x0a1b,0xbc9f,0x5e14,
0x3f33,0x6495,0x41cf,0x95e6,
0x3d48,0x92a0,0xc1f4,0x5b6d,
0x3d22,0x03af,0x9ee7,0x5616,
0x3d26,0xf7e6,0x5100,0x8dc2,
0x3cdc,0xd2b2,0x97d8,0x89bc,
0x3ce7,0x6b31,0x1b5f,0xefe9,
};
short AU[] = {0x4241,0x6a5d,0x2d22,0x0000};
short RADS[] = {0x4125,0x3d80,0x0000,0x0000};
short RADM[] = {0x409b,0x2800,0x0000,0x0000};
short RADE[] = {0x40b8,0xea23,0xd70a,0x3d71};
short AE[] = {0x3f06,0x5a67,0x6f26,0x85dd};
short Je[] = {
0x3f51,0xbce1,0x1c65,0x107b,
0xbec5,0x4e9b,0xc46c,0x2b21,
0xbebb,0x02e5,0xb881,0x1061,
};
short AM[] = {0x3ee8,0x5d43,0xfaf9,0xde5a};
short Jm[] = {
0x3f2a,0x7f0f,0x1396,0x70b6,
0x3ee9,0x6e1e,0xeb27,0x6b20,
0xbe83,0x8352,0x743c,0xdbeb,
};
short Cnm[] = {
0x3ef7,0x630d,0xbfb9,0x2d4f,
0x3f00,0x1998,0x43d2,0xd5a6,
0x3ed4,0x80e2,0x74f4,0x9b68,
0x3eb8,0x17b4,0xe02c,0xd94e,
0xbede,0x1b1b,0x0d60,0x0276,
0xbeb8,0x26af,0x3391,0x98f0,
0xbe76,0xf20f,0x398d,0x6738,
0xbe84,0xca75,0x0db0,0x72ec,
};
short Snm[] = {
0x0000,0x0000,0x0000,0x0000,
0x3ed7,0x8868,0xeddb,0x0433,
0x3ebc,0x4f75,0x7b25,0xf086,
0xbe96,0x702a,0x8009,0x2d26,
0x3ec8,0xb990,0xd6f2,0x9be9,
0xbec8,0x3224,0x58aa,0x0bce,
0xbeaa,0x792d,0x7803,0x7ebf,
0x3e6e,0x4820,0xcc08,0x4c3e,
};
short K2M[] = {0x3f96,0xbfce,0x42f9,0x9b68};
short LOVENO[] = {0x3fd3,0x3333,0x3333,0x3333};
short PHASE[] = {0x3fa4,0xd6a1,0xc8f9,0x3ed7};
short PSLP1[] = {0x3fcd,0x6fb4,0xc875,0x68ee};
short PSLPI[] = {0x403b,0x5253,0x3680,0x4e1f};
short PSLPIA[] = {0x403b,0x5253,0x3400,0x0000};
short PSLPIB[] = {0x3e84,0x0270,0xfa49,0x397b};
short JDEPOCH[] = {0x4142,0x9e68,0x4000,0x0000};
short LBET[] = {0x3f44,0xb2f9,0x0445,0x2ad9};
short LGAM[] = {0x3f2d,0xe327,0xa481,0x44a6};
short LGAMBET[] = {0xbf3a,0x745e,0x7637,0x94f0};
short CMRSQ[] = {0x3fd9,0x010e,0xa468,0x1755};
short CMR2[] = {0x3dcc,0xfd79,0xd853,0x0314};
short BMR2[] = {0x3dcc,0xfa7b,0x685d,0xc125};
short AMR2[] = {0x3dcc,0xf8ca,0x3056,0xdbbe};
#endif /* MIEEE */
#if DEC
short DTR[] = {0036616,0175065,0011224,0164711};
short RTD[] = {0041545,0027340,0151436,0007676};
short RTS[] = {0044511,0067063,0114615,0065726};
short STR[] = {0033642,0126455,0113774,0076351};
short PI[] = {0040511,0007732,0121041,0064302};
short J2000[] = {0045425,0120544,0000000,0000000};
short B1950[] = {0045424,0102011,0130446,0164571};
short J1900[] = {0045423,0063260,0000000,0000000};
short B1900[] = {0045423,0063261,0040203,0011157};
short Jcentury[] = {0044016,0126400,0000000,0000000};
short Jmillenium[] = {0044662,0054100,0000000,0000000};
short Jtmillenium[] = {0045536,0167120,0000000,0000000};
short Zero[] = {0000000,0000000,0000000,0000000};
short Fourth[] = {0037600,0000000,0000000,0000000};
short Half[] = {0040000,0000000,0000000,0000000};
short One[] = {0040200,0000000,0000000,0000000};
short OneandaHalf[] = {0040300,0000000,0000000,0000000};
short Two[] = {0040400,0000000,0000000,0000000};
short Three[] = {0040500,0000000,0000000,0000000};
short ThreeandaHalf[] = {0040540,0000000,0000000,0000000};
short Four[] = {0040600,0000000,0000000,0000000};
short Five[] = {0040640,0000000,0000000,0000000};
short Six[] = {0040700,0000000,0000000,0000000};
short Ten[] = {0041040,0000000,0000000,0000000};
short JD0[] = {0045424,0171502,0000000,0000000};
short yn0[4*6*NTOTAL] = {
0034721,0137551,0144035,0021713,
0036305,0132024,0130246,0134404,
0034172,0006043,0137566,0004160,
0037703,0144404,0024232,0020055,
0134772,0074311,0027303,0176000,
0040243,0177201,0030306,0076374,
0036163,0005154,0031000,0067224,
0037670,0075034,0070165,0066146,
0036713,0116240,0060625,0157031,
0137302,0026500,0163303,0141735,
0036523,0152235,0014232,0177246,
0137263,0020720,0107115,0143366,
0036466,0145135,0016640,0142422,
0040033,0116404,0144066,0140060,
0036575,0155334,0163470,0124001,
0137665,0155240,0143707,0075252,
0036315,0131221,0055177,0165446,
0137512,0177715,0015303,0025746,
0036611,0162742,0151672,0031742,
0037335,0115741,0145016,0155617,
0035714,0077677,0003263,0066153,
0140155,0053447,0047004,0051311,
0035461,0052224,0032063,0003026,
0137715,0157462,0044262,0001222,
0036555,0042622,0070476,0014073,
0137403,0004404,0071656,0171423,
0034650,0160556,0005177,0150761,
0140251,0141362,0054634,0144127,
0135270,0076710,0121335,0145512,
0140032,0172570,0101641,0053621,
0035603,0142711,0177774,0033314,
0140654,0074107,0053267,0100732,
0136325,0174112,0004257,0125042,
0140105,0030036,0113417,0151767,
0136071,0031140,0151740,0031466,
0137513,0067250,0042725,0011320,
0136117,0007414,0033741,0147276,
0040776,0076445,0161004,0031746,
0036217,0037176,0035246,0176452,
0040620,0040222,0032710,0003031,
0035776,0151177,0044673,0015363,
0040302,0112704,0054142,0043277,
0035063,0062305,0077636,0003353,
0141222,0034724,0015167,0077745,
0136166,0134260,0105236,0155337,
0140165,0024105,0037151,0165317,
0135730,0103327,0157721,0166030,
0137445,0030621,0133303,0152523,
0036053,0157250,0000016,0172753,
0141202,0170002,0002752,0055657,
0135710,0037261,0076213,0025756,
0141276,0013121,0002670,0161411,
0135465,0056016,0153247,0056536,
0141025,0022146,0045527,0072510,
0035223,0135613,0172463,0065057,
0141363,0112331,0061270,0021607,
0136116,0036466,0052443,0116123,
0140010,0021261,0001473,0035572,
0135615,0075563,0160642,0113003,
0041020,0172134,0072631,0053605,
#if EXTRA_BODY
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
#endif
0035434,0172623,0010553,0163377,
0135533,0011427,0004634,0047444,
0135066,0116410,0010262,0075172,
0136002,0017044,0040034,0157263,
0134671,0106325,0041003,0167217,
0135615,0176167,0161120,0032011,
0132630,0047253,0107542,0042451,
0036223,0166641,0126233,0052345,
0033655,0155036,0177403,0121527,
0035475,0076061,0106552,0047675,
0033425,0131155,0046567,0156615,
0035201,0044342,0064704,0015237,
};
short JD1[] = {0045424,0174602,0000000,0000000};
short yn1[4*6*NTOTAL] = {
0034773,0036125,0151125,0023612,
0037005,0153050,0050632,0062276,
0134617,0153011,0154442,0002351,
0037705,0040057,0050013,0135554,
0134717,0027243,0025362,0013345,
0040240,0141357,0152373,0127515,
0036476,0132763,0033100,0104156,
0137657,0157637,0027615,0114067,
0136623,0025423,0025714,0035174,
0137600,0115733,0127113,0146662,
0136461,0035427,0037737,0156470,
0137313,0015033,0132117,0052700,
0036630,0054523,0155602,0165264,
0137611,0146613,0037464,0030630,
0136327,0151545,0167246,0152106,
0140035,0153247,0106236,0010422,
0136207,0140302,0061443,0120073,
0137605,0075555,0142756,0012611,
0036526,0056204,0053352,0015303,
0040044,0100623,0023224,0123021,
0036441,0171417,0175627,0123401,
0140070,0104264,0150624,0067701,
0036214,0071753,0116151,0012173,
0137640,0011043,0161634,0001044,
0136450,0112013,0063040,0152204,
0140205,0007044,0160764,0113275,
0136347,0137410,0105314,0050577,
0040223,0076234,0163151,0147234,
0136102,0124630,0141477,0125540,
0040016,0104275,0155366,0025722,
0036227,0075547,0144036,0173025,
0140607,0114167,0045702,0103601,
0136245,0124540,0157305,0076473,
0140511,0057721,0113034,0030231,
0136025,0105404,0015572,0032022,
0140237,0102106,0001004,0174444,
0136213,0071456,0052772,0117152,
0040716,0152047,0170751,0132573,
0036151,0103125,0034751,0103204,
0040703,0050770,0174275,0124723,
0035731,0036126,0142551,0164473,
0040417,0122503,0045501,0127324,
0035411,0004402,0042327,0071143,
0141221,0016536,0141615,0125056,
0136164,0110116,0017355,0062433,
0140435,0047014,0171100,0057615,
0135727,0044552,0175376,0161460,
0140122,0012555,0000643,0116774,
0036060,0044127,0151406,0171660,
0141164,0157577,0075075,0065563,
0135672,0152707,0145772,0174362,
0141302,0150035,0077554,0115770,
0135452,0150515,0043237,0154166,
0141031,0070434,0070664,0164414,
0035317,0030156,0106270,0130522,
0141362,0077656,0135127,0077334,
0136115,0172200,0063327,0150774,
0140345,0014773,0036022,0063604,
0135621,0147440,0077350,0073226,
0041011,0170247,0107166,0176634,
#if EXTRA_BODY
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
0000000,0000000,0000000,0000000,
#endif
0135360,0053231,0120757,0135156,
0135721,0161310,0032410,0157214,
0135222,0017026,0040066,0111005,
0036000,0042202,0007175,0060741,
0135062,0176462,0051542,0174267,
0035575,0160713,0162523,0012000,
0133547,0011026,0030042,0132250,
0036167,0133406,0130441,0030251,
0033607,0066555,0023336,0136516,
0036054,0062561,0111045,0005747,
0033362,0167761,0040323,0151603,
0035615,0146736,0177442,0041544,
};
short CLIGHT[] = {0044622,0061016,0123757,0116662};
short C[] = {0042055,0022406,0123144,0121226};
short EMRAT[] = {0041642,0114746,0105015,0032234};
short KG[] = {0036614,0165552,0106465,0132315};
short GMs[] = {
0000000,0000000,0000000,0000000,
0027530,0007135,0177571,0102467,
0030507,0015512,0126264,0114046,
0030564,0046623,0157703,0005155,
0027721,0177421,0114157,0006325,
0032627,0127464,0144332,0145115,
0032265,0125153,0100175,0013174,
0031535,0065274,0151426,0167765,
0031603,0115602,0077757,0137100,
0026440,0026473,0167206,0170745,
#if EXTRA_BODY
0000000,0000000,0000000,0000000,
#endif
0027100,0050335,0162372,0170240,
0035233,0022252,0007174,0127461,
0025504,0112406,0007642,0155545,
0025020,0016574,0173472,0130255,
0025067,0137462,0104004,0067020,
0023746,0112624,0137304,0046741,
0024073,0054610,0155377,0077507,
};
short AU[] = {0051413,0051351,0064420,0000000};
short RADS[] = {0045051,0166000,0000000,0000000};
short RADM[] = {0042731,0040000,0000000,0000000};
short RADE[] = {0043307,0050436,0134121,0165605};
short AE[] = {0034462,0151473,0074464,0027350};
short Je[] = {
0035615,0163410,0161450,0101730,
0133452,0072336,0021541,0054413,
0133330,0013455,0142010,0101406,
};
short AM[] = {0034102,0165037,0153716,0171321};
short Jm[] = {
0035123,0174170,0116263,0102663,
0034113,0070367,0054473,0054401,
0132434,0015223,0120746,0157531,
};
short Cnm[] = {
0034273,0014155,0176711,0065164,
0034400,0146302,0017226,0126456,
0033644,0003423,0123644,0155476,
0033300,0136647,0000546,0145162,
0133760,0154330,0065400,0011661,
0133301,0032571,0116214,0143603,
0132267,0110171,0146153,0034675,
0132446,0051650,0066603,0113540,
};
short Snm[] = {
0000000,0000000,0000000,0000000,
0033674,0041507,0067330,0020625,
0033342,0075653,0154457,0102055,
0132663,0100524,0000111,0064455,
0033505,0146206,0133624,0157510,
0133501,0110442,0142520,0057164,
0133123,0144553,0140033,0172770,
0032162,0040406,0060102,0060761,
};
short K2M[] = {0036665,0177162,0013714,0155474};
short LOVENO[] = {0037631,0114631,0114631,0114632};
short PHASE[] = {0037046,0132416,0043711,0173267};
short PSLP1[] = {0037553,0076646,0041653,0043554};
short PSLPI[] = {0041332,0111231,0132002,0070372};
short PSLPIA[] = {0041332,0111231,0120000,0000000};
short PSLPIB[] = {0032440,0011607,0151111,0145731};
short JDEPOCH[] = {0045424,0171502,0000000,0000000};
short LBET[] = {0035445,0113710,0021051,0053304};
short LGAM[] = {0035157,0014475,0022012,0022456};
short LGAMBET[] = {0135323,0121363,0130674,0123574};
short CMRSQ[] = {0037710,0004165,0021500,0135246};
short CMR2[] = {0027547,0165716,0141230,0014243};
short BMR2[] = {0027547,0151733,0041356,0004454};
short AMR2[] = {0027547,0143121,0101266,0156762};
#endif /* DEC */
| 28.586312 | 78 | 0.777074 |
be73c1fa1d64d42597c828ecd40f894e22ce5c8d | 2,805 | kt | Kotlin | plugins/github/src/org/jetbrains/plugins/github/pullrequest/action/GHPRUpdateBranchAction.kt | Tasemo/intellij-community | 50aeaf729b7073e91c7c77487a1f155e0dfe3fcd | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | plugins/github/src/org/jetbrains/plugins/github/pullrequest/action/GHPRUpdateBranchAction.kt | Tasemo/intellij-community | 50aeaf729b7073e91c7c77487a1f155e0dfe3fcd | [
"Apache-2.0"
] | null | null | null | plugins/github/src/org/jetbrains/plugins/github/pullrequest/action/GHPRUpdateBranchAction.kt | Tasemo/intellij-community | 50aeaf729b7073e91c7c77487a1f155e0dfe3fcd | [
"Apache-2.0"
] | null | null | null | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.pullrequest.action
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.actionSystem.ex.ActionUtil
import com.intellij.openapi.project.DumbAwareAction
import git4idea.branch.GitBranchUtil
import org.jetbrains.plugins.github.i18n.GithubBundle
import org.jetbrains.plugins.github.pullrequest.ui.details.GHPRDirectionPanel
import org.jetbrains.plugins.github.util.GithubGitHelper
class GHPRUpdateBranchAction : DumbAwareAction(GithubBundle.messagePointer("pull.request.branch.update.action"),
GithubBundle.messagePointer("pull.request.branch.update.action.description"),
null) {
override fun update(e: AnActionEvent) {
val project = e.getData(CommonDataKeys.PROJECT)
val repository = e.getData(GHPRActionKeys.GIT_REPOSITORY)
val selection = e.getData(GHPRActionKeys.PULL_REQUEST_DATA_PROVIDER)
val loadedDetails = selection?.detailsData?.loadedDetails
val headRefName = loadedDetails?.headRefName
val httpUrl = loadedDetails?.headRepository?.url
val sshUrl = loadedDetails?.headRepository?.sshUrl
val isFork = loadedDetails?.headRepository?.isFork ?: false
e.presentation.isEnabled = project != null &&
!project.isDefault &&
selection != null &&
repository != null &&
GithubGitHelper.getInstance().findRemote(repository, httpUrl, sshUrl)?.let { remote ->
GithubGitHelper.getInstance().findLocalBranch(repository, remote, isFork, headRefName) != null
} ?: false
}
override fun actionPerformed(e: AnActionEvent) {
val repository = e.getRequiredData(GHPRActionKeys.GIT_REPOSITORY)
val project = repository.project
val loadedDetails = e.getRequiredData(GHPRActionKeys.PULL_REQUEST_DATA_PROVIDER).detailsData.loadedDetails
val headRefName = loadedDetails?.headRefName
val httpUrl = loadedDetails?.headRepository?.url
val sshUrl = loadedDetails?.headRepository?.sshUrl
val isFork = loadedDetails?.headRepository?.isFork ?: false
val prRemote = GithubGitHelper.getInstance().findRemote(repository, httpUrl, sshUrl) ?: return
val localBranch = GithubGitHelper.getInstance().findLocalBranch(repository, prRemote, isFork, headRefName) ?: return
GitBranchUtil.updateBranches(project, listOf(repository), listOf(localBranch))
}
}
| 56.1 | 140 | 0.717647 |
1fa7cba6bd61d06108caecce3f0c6b18259ae513 | 1,313 | dart | Dart | test_driver/app_test.dart | BrChung/order_services_app | 145c18325afb1a51f9e7ec68c7a066307681c6e0 | [
"MIT"
] | null | null | null | test_driver/app_test.dart | BrChung/order_services_app | 145c18325afb1a51f9e7ec68c7a066307681c6e0 | [
"MIT"
] | null | null | null | test_driver/app_test.dart | BrChung/order_services_app | 145c18325afb1a51f9e7ec68c7a066307681c6e0 | [
"MIT"
] | null | null | null | // Imports the Flutter Driver API.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';
void main() {
group('Order Services App', () {
final anonSignInFinder = find.byValueKey("anonSignIn");
FlutterDriver driver;
// Connect to the Flutter driver before running any tests.
setUpAll(() async {
driver = await FlutterDriver.connect();
});
// Close the connection to the driver after the tests have completed.
tearDownAll(() async {
if (driver != null) {
driver.close();
}
});
test('Navigate to Services Page after Login', () async {
await driver.tap(anonSignInFinder);
print('Anon Sign-in was successful!');
await driver.waitFor(find.text("Carl's Jr"));
print("Succesfully loaded locations");
await driver.tap(find.text("Carl's Jr"));
await driver.waitFor(find.text("Famous Star w/ Cheese"));
print('Successfully found services within Location');
await driver
.scrollIntoView(find.text('Triple Spicy Western Cheeseburger'));
print("Scroll through services works!");
await driver.tap(find.text('Triple Spicy Western Cheeseburger'));
print(
"User succesfully ordered service, please verify on Firebase database");
});
});
}
| 32.825 | 82 | 0.656512 |
7fc8711652ae555590dfa23c27bc74036e2cd6f0 | 20,763 | rs | Rust | src/value.rs | nassor/aerospike-client-rust | e6c7c172c92f3368917773a0e9e61d2e141be364 | [
"Apache-2.0"
] | null | null | null | src/value.rs | nassor/aerospike-client-rust | e6c7c172c92f3368917773a0e9e61d2e141be364 | [
"Apache-2.0"
] | null | null | null | src/value.rs | nassor/aerospike-client-rust | e6c7c172c92f3368917773a0e9e61d2e141be364 | [
"Apache-2.0"
] | null | null | null | // Copyright 2015-2018 Aerospike, Inc.
//
// Portions may be licensed to Aerospike, Inc. under one or more contributor
// license agreements.
//
// 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.
use std::collections::HashMap;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::result::Result as StdResult;
use std::{f32, f64};
use byteorder::{ByteOrder, NetworkEndian};
use ripemd160::digest::Digest;
use ripemd160::Ripemd160;
use std::vec::Vec;
use commands::buffer::Buffer;
use commands::ParticleType;
use errors::*;
use msgpack::{decoder, encoder};
/// Container for floating point bin values stored in the Aerospike database.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FloatValue {
/// Container for single precision float values.
F32(u32),
/// Container for double precision float values.
F64(u64),
}
impl From<FloatValue> for f64 {
fn from(val: FloatValue) -> f64 {
match val {
FloatValue::F32(_) => panic!(
"This library does not automatically convert f32 -> f64 to be used in keys \
or bins."
),
FloatValue::F64(val) => f64::from_bits(val),
}
}
}
impl<'a> From<&'a FloatValue> for f64 {
fn from(val: &FloatValue) -> f64 {
match *val {
FloatValue::F32(_) => panic!(
"This library does not automatically convert f32 -> f64 to be used in keys \
or bins."
),
FloatValue::F64(val) => f64::from_bits(val),
}
}
}
impl From<f64> for FloatValue {
fn from(val: f64) -> FloatValue {
let mut val = val;
if val.is_nan() {
val = f64::NAN
} // make all NaNs have the same representation
FloatValue::F64(val.to_bits())
}
}
impl<'a> From<&'a f64> for FloatValue {
fn from(val: &f64) -> FloatValue {
let mut val = *val;
if val.is_nan() {
val = f64::NAN
} // make all NaNs have the same representation
FloatValue::F64(val.to_bits())
}
}
impl From<FloatValue> for f32 {
fn from(val: FloatValue) -> f32 {
match val {
FloatValue::F32(val) => f32::from_bits(val),
FloatValue::F64(val) => f32::from_bits(val as u32),
}
}
}
impl<'a> From<&'a FloatValue> for f32 {
fn from(val: &FloatValue) -> f32 {
match *val {
FloatValue::F32(val) => f32::from_bits(val),
FloatValue::F64(val) => f32::from_bits(val as u32),
}
}
}
impl From<f32> for FloatValue {
fn from(val: f32) -> FloatValue {
let mut val = val;
if val.is_nan() {
val = f32::NAN
} // make all NaNs have the same representation
FloatValue::F32(val.to_bits())
}
}
impl<'a> From<&'a f32> for FloatValue {
fn from(val: &f32) -> FloatValue {
let mut val = *val;
if val.is_nan() {
val = f32::NAN
} // make all NaNs have the same representation
FloatValue::F32(val.to_bits())
}
}
impl fmt::Display for FloatValue {
fn fmt(&self, f: &mut fmt::Formatter) -> StdResult<(), fmt::Error> {
match *self {
FloatValue::F32(val) => {
let val: f32 = f32::from_bits(val);
write!(f, "{}", val)
}
FloatValue::F64(val) => {
let val: f64 = f64::from_bits(val);
write!(f, "{}", val)
}
}
}
}
/// Container for bin values stored in the Aerospike database.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Value {
/// Empty value.
Nil,
/// Boolean value.
Bool(bool),
/// Integer value. All integers are represented as 64-bit numerics in Aerospike.
Int(i64),
/// Unsigned integer value. The largest integer value that can be stored in a record bin is
/// `i64::max_value()`; however the list and map data types can store integer values (and keys)
/// up to `u64::max_value()`.
///
/// # Panics
///
/// Attempting to store an `u64` value as a record bin value will cause a panic. Use casting to
/// store and retrieve `u64` values.
UInt(u64),
/// Floating point value. All floating point values are stored in 64-bit IEEE-754 format in
/// Aerospike. Aerospike server v3.6.0 and later support double data type.
Float(FloatValue),
/// String value.
String(String),
/// Byte array value.
Blob(Vec<u8>),
/// List data type is an ordered collection of values. Lists can contain values of any
/// supported data type. List data order is maintained on writes and reads.
List(Vec<Value>),
/// Map data type is a collection of key-value pairs. Each key can only appear once in a
/// collection and is associated with a value. Map keys and values can be any supported data
/// type.
HashMap(HashMap<Value, Value>),
/// Map data type where the map entries are sorted based key ordering (K-ordered maps) and may
/// have an additional value-order index depending the namespace configuration (KV-ordered
/// maps).
OrderedMap(Vec<(Value, Value)>),
/// GeoJSON data type are JSON formatted strings to encode geospatial information.
GeoJSON(String),
}
#[allow(clippy::derive_hash_xor_eq)]
impl Hash for Value {
fn hash<H: Hasher>(&self, state: &mut H) {
match *self {
Value::Nil => {
let v: Option<u8> = None;
v.hash(state)
}
Value::Bool(ref val) => val.hash(state),
Value::Int(ref val) => val.hash(state),
Value::UInt(ref val) => val.hash(state),
Value::Float(ref val) => val.hash(state),
Value::String(ref val) | Value::GeoJSON(ref val) => val.hash(state),
Value::Blob(ref val) => val.hash(state),
Value::List(ref val) => val.hash(state),
Value::HashMap(_) => panic!("HashMaps cannot be used as map keys."),
Value::OrderedMap(_) => panic!("OrderedMaps cannot be used as map keys."),
}
}
}
impl Value {
/// Returns true if this value is the empty value (nil).
pub fn is_nil(&self) -> bool {
match *self {
Value::Nil => true,
_ => false,
}
}
/// Return the particle type for the value used in the wire protocol.
/// For internal use only.
#[doc(hidden)]
pub fn particle_type(&self) -> ParticleType {
match *self {
Value::Nil => ParticleType::NULL,
Value::Int(_) | Value::Bool(_) => ParticleType::INTEGER,
Value::UInt(_) => panic!(
"Aerospike does not support u64 natively on server-side. Use casting to \
store and retrieve u64 values."
),
Value::Float(_) => ParticleType::FLOAT,
Value::String(_) => ParticleType::STRING,
Value::Blob(_) => ParticleType::BLOB,
Value::List(_) => ParticleType::LIST,
Value::HashMap(_) => ParticleType::MAP,
Value::OrderedMap(_) => panic!("The library never passes ordered maps to the server."),
Value::GeoJSON(_) => ParticleType::GEOJSON,
}
}
/// Returns a string representation of the value.
pub fn as_string(&self) -> String {
match *self {
Value::Nil => "<null>".to_string(),
Value::Int(ref val) => val.to_string(),
Value::UInt(ref val) => val.to_string(),
Value::Bool(ref val) => val.to_string(),
Value::Float(ref val) => val.to_string(),
Value::String(ref val) | Value::GeoJSON(ref val) => val.to_string(),
Value::Blob(ref val) => format!("{:?}", val),
Value::List(ref val) => format!("{:?}", val),
Value::HashMap(ref val) => format!("{:?}", val),
Value::OrderedMap(ref val) => format!("{:?}", val),
}
}
/// Calculate the size in bytes that the representation on wire for this value will require.
/// For internal use only.
#[doc(hidden)]
pub fn estimate_size(&self) -> Result<usize> {
match *self {
Value::Nil => Ok(0),
Value::Int(_) | Value::Bool(_) | Value::Float(_) => Ok(8),
Value::UInt(_) => panic!(
"Aerospike does not support u64 natively on server-side. Use casting to \
store and retrieve u64 values."
),
Value::String(ref s) => Ok(s.len()),
Value::Blob(ref b) => Ok(b.len()),
Value::List(_) | Value::HashMap(_) => encoder::pack_value(&mut None, self),
Value::OrderedMap(_) => panic!("The library never passes ordered maps to the server."),
Value::GeoJSON(ref s) => Ok(1 + 2 + s.len()), // flags + ncells + jsonstr
}
}
/// Serialize the value into the given buffer.
/// For internal use only.
#[doc(hidden)]
pub fn write_to(&self, buf: &mut Buffer) -> Result<usize> {
match *self {
Value::Nil => Ok(0),
Value::Int(ref val) => buf.write_i64(*val),
Value::UInt(_) => panic!(
"Aerospike does not support u64 natively on server-side. Use casting to \
store and retrieve u64 values."
),
Value::Bool(ref val) => buf.write_bool(*val),
Value::Float(ref val) => buf.write_f64(f64::from(val)),
Value::String(ref val) => buf.write_str(val),
Value::Blob(ref val) => buf.write_bytes(val),
Value::List(_) | Value::HashMap(_) => encoder::pack_value(&mut Some(buf), self),
Value::OrderedMap(_) => panic!("The library never passes ordered maps to the server."),
Value::GeoJSON(ref val) => buf.write_geo(val),
}
}
/// Serialize the value as a record key.
/// For internal use only.
#[doc(hidden)]
pub fn write_key_bytes(&self, h: &mut Ripemd160) -> Result<()> {
match *self {
Value::Int(ref val) => {
let mut buf = [0; 8];
NetworkEndian::write_i64(&mut buf, *val);
h.input(&buf);
Ok(())
}
Value::String(ref val) => {
h.input(val.as_bytes());
Ok(())
}
Value::Blob(ref val) => {
h.input(val);
Ok(())
}
_ => panic!("Data type is not supported as Key value."),
}
}
}
impl fmt::Display for Value {
fn fmt(&self, f: &mut fmt::Formatter) -> StdResult<(), fmt::Error> {
write!(f, "{}", self.as_string())
}
}
impl From<String> for Value {
fn from(val: String) -> Value {
Value::String(val)
}
}
impl From<Vec<u8>> for Value {
fn from(val: Vec<u8>) -> Value {
Value::Blob(val)
}
}
impl From<Vec<Value>> for Value {
fn from(val: Vec<Value>) -> Value {
Value::List(val)
}
}
impl From<HashMap<Value, Value>> for Value {
fn from(val: HashMap<Value, Value>) -> Value {
Value::HashMap(val)
}
}
impl From<f32> for Value {
fn from(val: f32) -> Value {
Value::Float(FloatValue::from(val))
}
}
impl From<f64> for Value {
fn from(val: f64) -> Value {
Value::Float(FloatValue::from(val))
}
}
impl<'a> From<&'a f32> for Value {
fn from(val: &'a f32) -> Value {
Value::Float(FloatValue::from(*val))
}
}
impl<'a> From<&'a f64> for Value {
fn from(val: &'a f64) -> Value {
Value::Float(FloatValue::from(*val))
}
}
impl<'a> From<&'a String> for Value {
fn from(val: &'a String) -> Value {
Value::String(val.clone())
}
}
impl<'a> From<&'a str> for Value {
fn from(val: &'a str) -> Value {
Value::String(val.to_string())
}
}
impl<'a> From<&'a Vec<u8>> for Value {
fn from(val: &'a Vec<u8>) -> Value {
Value::Blob(val.clone())
}
}
impl<'a> From<&'a [u8]> for Value {
fn from(val: &'a [u8]) -> Value {
Value::Blob(val.to_vec())
}
}
impl From<bool> for Value {
fn from(val: bool) -> Value {
Value::Bool(val)
}
}
impl From<i8> for Value {
fn from(val: i8) -> Value {
Value::Int(i64::from(val))
}
}
impl From<u8> for Value {
fn from(val: u8) -> Value {
Value::Int(i64::from(val))
}
}
impl From<i16> for Value {
fn from(val: i16) -> Value {
Value::Int(i64::from(val))
}
}
impl From<u16> for Value {
fn from(val: u16) -> Value {
Value::Int(i64::from(val))
}
}
impl From<i32> for Value {
fn from(val: i32) -> Value {
Value::Int(i64::from(val))
}
}
impl From<u32> for Value {
fn from(val: u32) -> Value {
Value::Int(i64::from(val))
}
}
impl From<i64> for Value {
fn from(val: i64) -> Value {
Value::Int(val)
}
}
impl From<u64> for Value {
fn from(val: u64) -> Value {
Value::UInt(val)
}
}
impl From<isize> for Value {
fn from(val: isize) -> Value {
Value::Int(val as i64)
}
}
impl From<usize> for Value {
fn from(val: usize) -> Value {
Value::UInt(val as u64)
}
}
impl<'a> From<&'a i8> for Value {
fn from(val: &'a i8) -> Value {
Value::Int(i64::from(*val))
}
}
impl<'a> From<&'a u8> for Value {
fn from(val: &'a u8) -> Value {
Value::Int(i64::from(*val))
}
}
impl<'a> From<&'a i16> for Value {
fn from(val: &'a i16) -> Value {
Value::Int(i64::from(*val))
}
}
impl<'a> From<&'a u16> for Value {
fn from(val: &'a u16) -> Value {
Value::Int(i64::from(*val))
}
}
impl<'a> From<&'a i32> for Value {
fn from(val: &'a i32) -> Value {
Value::Int(i64::from(*val))
}
}
impl<'a> From<&'a u32> for Value {
fn from(val: &'a u32) -> Value {
Value::Int(i64::from(*val))
}
}
impl<'a> From<&'a i64> for Value {
fn from(val: &'a i64) -> Value {
Value::Int(*val)
}
}
impl<'a> From<&'a u64> for Value {
fn from(val: &'a u64) -> Value {
Value::UInt(*val)
}
}
impl<'a> From<&'a isize> for Value {
fn from(val: &'a isize) -> Value {
Value::Int(*val as i64)
}
}
impl<'a> From<&'a usize> for Value {
fn from(val: &'a usize) -> Value {
Value::UInt(*val as u64)
}
}
impl<'a> From<&'a bool> for Value {
fn from(val: &'a bool) -> Value {
Value::Bool(*val)
}
}
impl From<Value> for i64 {
fn from(val: Value) -> i64 {
match val {
Value::Int(val) => val,
Value::UInt(val) => val as i64,
_ => panic!("Value is not an integer to convert."),
}
}
}
impl<'a> From<&'a Value> for i64 {
fn from(val: &'a Value) -> i64 {
match *val {
Value::Int(val) => val,
Value::UInt(val) => val as i64,
_ => panic!("Value is not an integer to convert."),
}
}
}
#[doc(hidden)]
pub fn bytes_to_particle(ptype: u8, buf: &mut Buffer, len: usize) -> Result<Value> {
match ParticleType::from(ptype) {
ParticleType::NULL => Ok(Value::Nil),
ParticleType::INTEGER => {
let val = buf.read_i64(None)?;
Ok(Value::Int(val))
}
ParticleType::FLOAT => {
let val = buf.read_f64(None)?;
Ok(Value::Float(FloatValue::from(val)))
}
ParticleType::STRING => {
let val = buf.read_str(len)?;
Ok(Value::String(val))
}
ParticleType::GEOJSON => {
buf.skip(1)?;
let ncells = buf.read_i16(None)? as usize;
let header_size: usize = ncells * 8;
buf.skip(header_size)?;
let val = buf.read_str(len - header_size - 3)?;
Ok(Value::GeoJSON(val))
}
ParticleType::BLOB => Ok(Value::Blob(buf.read_blob(len)?)),
ParticleType::LIST => {
let val = decoder::unpack_value_list(buf)?;
Ok(val)
}
ParticleType::MAP => {
let val = decoder::unpack_value_map(buf)?;
Ok(val)
}
ParticleType::DIGEST => Ok(Value::from("A DIGEST, NOT IMPLEMENTED YET!")),
ParticleType::LDT => Ok(Value::from("A LDT, NOT IMPLEMENTED YET!")),
}
}
/// Constructs a new Value from one of the supported native data types.
#[macro_export]
macro_rules! as_val {
($val:expr) => {{
$crate::Value::from($val)
}};
}
/// Constructs a new `GeoJSON` Value from one of the supported native data types.
#[macro_export]
macro_rules! as_geo {
($val:expr) => {{
$crate::Value::GeoJSON($val.to_owned())
}};
}
/// Constructs a new Blob Value from one of the supported native data types.
#[macro_export]
macro_rules! as_blob {
($val:expr) => {{
$crate::Value::Blob($val)
}};
}
/// Constructs a new List Value from a list of one or more native data types.
///
/// # Examples
///
/// Write a list value to a record bin.
///
/// ```rust
/// # use aerospike::*;
/// # use std::vec::Vec;
/// # fn main() {
/// # let hosts = std::env::var("AEROSPIKE_HOSTS").unwrap();
/// # let client = Client::new(&ClientPolicy::default(), &hosts).unwrap();
/// # let key = as_key!("test", "test", "mykey");
/// let list = as_list!("a", "b", "c");
/// let bin = as_bin!("list", list);
/// client.put(&WritePolicy::default(), &key, &vec![&bin]).unwrap();
/// # }
/// ```
#[macro_export]
macro_rules! as_list {
( $( $v:expr),* ) => {
{
let mut temp_vec = Vec::new();
$(
temp_vec.push(as_val!($v));
)*
$crate::Value::List(temp_vec)
}
};
}
/// Constructs a vector of Values from a list of one or more native data types.
///
/// # Examples
///
/// Execute a user-defined function (UDF) with some arguments.
///
/// ```rust,should_panic
/// # use aerospike::*;
/// # use std::vec::Vec;
/// # fn main() {
/// # let hosts = std::env::var("AEROSPIKE_HOSTS").unwrap();
/// # let client = Client::new(&ClientPolicy::default(), &hosts).unwrap();
/// # let key = as_key!("test", "test", "mykey");
/// let module = "myUDF";
/// let func = "myFunction";
/// let args = as_values!("a", "b", "c");
/// client.execute_udf(&WritePolicy::default(), &key,
/// &module, &func, Some(&args)).unwrap();
/// # }
/// ```
#[macro_export]
macro_rules! as_values {
( $( $v:expr),* ) => {
{
let mut temp_vec = Vec::new();
$(
temp_vec.push(as_val!($v));
)*
temp_vec
}
};
}
/// Constructs a Map Value from a list of key/value pairs.
///
/// # Examples
///
/// Write a map value to a record bin.
///
/// ```rust
/// # use aerospike::*;
/// # use std::collections::HashMap;
/// # fn main() {
/// # let hosts = std::env::var("AEROSPIKE_HOSTS").unwrap();
/// # let client = Client::new(&ClientPolicy::default(), &hosts).unwrap();
/// # let key = as_key!("test", "test", "mykey");
/// let map = as_map!("a" => 1, "b" => 2);
/// let bin = as_bin!("map", map);
/// client.put(&WritePolicy::default(), &key, &vec![&bin]).unwrap();
/// # }
/// ```
#[macro_export]
macro_rules! as_map {
( $( $k:expr => $v:expr),* ) => {
{
let mut temp_map = HashMap::new();
$(
temp_map.insert(as_val!($k), as_val!($v));
)*
$crate::Value::HashMap(temp_map)
}
};
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn as_string() {
assert_eq!(Value::Nil.as_string(), String::from("<null>"));
assert_eq!(Value::Int(42).as_string(), String::from("42"));
assert_eq!(
Value::UInt(9_223_372_036_854_775_808).as_string(),
String::from("9223372036854775808")
);
assert_eq!(Value::Bool(true).as_string(), String::from("true"));
assert_eq!(Value::from(4.1416).as_string(), String::from("4.1416"));
assert_eq!(
as_geo!(r#"{"type":"Point"}"#).as_string(),
String::from(r#"{"type":"Point"}"#)
);
}
#[test]
fn as_geo() {
let string = String::from(r#"{"type":"Point"}"#);
let str = r#"{"type":"Point"}"#;
assert_eq!(as_geo!(string), as_geo!(str));
}
}
| 28.210598 | 99 | 0.539084 |
046757dea73fbff6ade2d9d90fe71b75b90996a1 | 596 | java | Java | RoxiePR_ProdDRTest/src/main/java/com/lexisnexis/qatools/testharness/Browser.java | Easwka01/HPCC-Platform | 138d9a0382cf850a9f67c7c8b21439a94e52ae66 | [
"Apache-2.0"
] | null | null | null | RoxiePR_ProdDRTest/src/main/java/com/lexisnexis/qatools/testharness/Browser.java | Easwka01/HPCC-Platform | 138d9a0382cf850a9f67c7c8b21439a94e52ae66 | [
"Apache-2.0"
] | null | null | null | RoxiePR_ProdDRTest/src/main/java/com/lexisnexis/qatools/testharness/Browser.java | Easwka01/HPCC-Platform | 138d9a0382cf850a9f67c7c8b21439a94e52ae66 | [
"Apache-2.0"
] | null | null | null | package com.lexisnexis.qatools.testharness;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.remote.DesiredCapabilities;
public enum Browser {
/**
* Google Chrome
*/
CHROME(DesiredCapabilities.chrome()),
/**
* Mozilla Firefox
*/
FIREFOX(DesiredCapabilities.firefox()),
/**
* Microsoft Internet Explorer
*/
IE(DesiredCapabilities.internetExplorer());
private final Capabilities capabilities;
private Browser(final Capabilities capabilities) {
this.capabilities = capabilities;
}
public Capabilities getCapabilities() {
return capabilities;
}
}
| 18.625 | 54 | 0.751678 |
762b8f944e85a73264067161ea9bebe3799ae71e | 1,059 | dart | Dart | crypto_currency_app/lib/presentation/widgets/app_error_state.dart | AhmedMostafaElbasha/Crypto_Currency_App | a5906630bec5ddd3a9a7840d45afad19b2c8f5b9 | [
"Apache-2.0"
] | null | null | null | crypto_currency_app/lib/presentation/widgets/app_error_state.dart | AhmedMostafaElbasha/Crypto_Currency_App | a5906630bec5ddd3a9a7840d45afad19b2c8f5b9 | [
"Apache-2.0"
] | null | null | null | crypto_currency_app/lib/presentation/widgets/app_error_state.dart | AhmedMostafaElbasha/Crypto_Currency_App | a5906630bec5ddd3a9a7840d45afad19b2c8f5b9 | [
"Apache-2.0"
] | null | null | null | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:crypto_currency_app/constants/constants.dart';
import 'package:crypto_currency_app/presentation/presentation.dart';
class AppErrorState extends StatelessWidget {
final String errorMessage;
AppErrorState(this.errorMessage);
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_errorIcon,
_errorMessage,
],
),
);
}
Widget get _errorIcon {
return Icon(
AppIcons.error,
size: 100,
color: AppColors.red,
);
}
Widget get _errorMessage {
return Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setHeight(26),
left: ScreenUtil().setWidth(26),
right: ScreenUtil().setWidth(26),
),
child: AppTextDisplay(
translation: errorMessage,
textStyle: AppTextStyles.stateMessage,
),
);
}
}
| 23.021739 | 68 | 0.655335 |
bcc5538beee92ce892aaa42c5c3185c07db56165 | 181,073 | js | JavaScript | wp-content/plugins/wp-ultimate-recipe-premium/core/assets/wpurp-public.js | Tibi02/hannablog | e87a7870501609e0b9731dd7993e652de7a19166 | [
"MIT"
] | null | null | null | wp-content/plugins/wp-ultimate-recipe-premium/core/assets/wpurp-public.js | Tibi02/hannablog | e87a7870501609e0b9731dd7993e652de7a19166 | [
"MIT"
] | 5 | 2019-07-11T12:38:49.000Z | 2019-11-01T17:26:38.000Z | wp-content/plugins/wp-ultimate-recipe-premium/core/assets/wpurp-public.js | Tibi02/hannablog | e87a7870501609e0b9731dd7993e652de7a19166 | [
"MIT"
] | 2 | 2019-01-20T08:46:46.000Z | 2019-12-05T11:48:15.000Z | /**
* Table of contents:
* index.js
* adjustable_servings.js
* jquery.tools.min.js
* print_button.js
* tooltips.js
* responsive.js
* jquery.sharrre.min.js
* sharing_buttons.js
* partners.js
* favorite-recipes.js
* select2.min.js
* add-to-meal-plan.js
* recipe-grid.js
* js-quantities.js
* unit-conversion.js
* user-menus.js
* add-to-shopping-list.js
* user-ratings.js
* recipe_form.js
* user-submissions.js
* meal-planner.js
* Generated by MagicMin: 2016-03-06 04:09:16
*/
Fraction=function(a,b){if("undefined"!==typeof a&&b)"number"===typeof a&&"number"===typeof b?(this.numerator=a,this.denominator=b):"string"===typeof a&&"string"===typeof b&&(this.numerator=parseInt(a),this.denominator=parseInt(b));else if("undefined"===typeof b)if(num=a,"number"===typeof num)this.numerator=num,this.denominator=1;else if("string"===typeof num){var c,d,e=num.split(" ");e[0]&&(c=e[0]);e[1]&&(d=e[1]);if(0===c%1&&d&&d.match("/"))return(new Fraction(c)).add(new Fraction(d));if(c&&!d)if("string"===
typeof c&&c.match("/"))c=c.split("/"),this.numerator=c[0],this.denominator=c[1];else{if("string"===typeof c&&c.match("."))return new Fraction(parseFloat(c));this.numerator=parseInt(c);this.denominator=1}else return}this.normalize()};Fraction.prototype.clone=function(){return new Fraction(this.numerator,this.denominator)};
Fraction.prototype.toString=function(){if("NaN"===this.denominator)return"NaN";var a=0<this.numerator/this.denominator?Math.floor(this.numerator/this.denominator):Math.ceil(this.numerator/this.denominator),b=this.numerator%this.denominator,c=this.denominator,d=[];0!=a&&d.push(a);0!=b&&d.push((0===a?b:Math.abs(b))+"/"+c);return 0<d.length?d.join(" "):0};Fraction.prototype.rescale=function(a){this.numerator*=a;this.denominator*=a;return this};
Fraction.prototype.add=function(a){var b=this.clone();a=a instanceof Fraction?a.clone():new Fraction(a);td=b.denominator;b.rescale(a.denominator);a.rescale(td);b.numerator+=a.numerator;return b.normalize()};Fraction.prototype.subtract=function(a){var b=this.clone();a=a instanceof Fraction?a.clone():new Fraction(a);td=b.denominator;b.rescale(a.denominator);a.rescale(td);b.numerator-=a.numerator;return b.normalize()};
Fraction.prototype.multiply=function(a){var b=this.clone();if(a instanceof Fraction)b.numerator*=a.numerator,b.denominator*=a.denominator;else if("number"===typeof a)b.numerator*=a;else return b.multiply(new Fraction(a));return b.normalize()};Fraction.prototype.divide=function(a){var b=this.clone();if(a instanceof Fraction)b.numerator*=a.denominator,b.denominator*=a.numerator;else if("number"===typeof a)b.denominator*=a;else return b.divide(new Fraction(a));return b.normalize()};
Fraction.prototype.equals=function(a){a instanceof Fraction||(a=new Fraction(a));var b=this.clone().normalize();a=a.clone().normalize();return b.numerator===a.numerator&&b.denominator===a.denominator};
Fraction.prototype.normalize=function(){var a=function(a){return"number"===typeof a&&(0<a&&0<a%1&&1>a%1||0>a&&0>a%-1&&-1<a%-1)},b=function(a,b){if(b){var e=Math.pow(10,b);return Math.round(a*e)/e}return Math.round(a)};return function(){if(a(this.denominator)){var c=b(this.denominator,9),c=Math.pow(10,c.toString().split(".")[1].length);this.denominator=Math.round(this.denominator*c);this.numerator*=c}if(a(this.numerator)){var c=b(this.numerator,9),d=c.toString().split("."),c=0;void 0!==d[1]&&(c=Math.pow(10,
d[1].length));this.numerator=Math.round(this.numerator*c);this.denominator*=c}c=Fraction.gcf(this.numerator,this.denominator);this.numerator/=c;this.denominator/=c;if(0>this.numerator&&0>this.denominator||0<this.numerator&&0>this.denominator)this.numerator*=-1,this.denominator*=-1;return this}}();
Fraction.gcf=function(a,b){var c=[],d=Fraction.primeFactors(a),e=Fraction.primeFactors(b);d.forEach(function(a){var b=e.indexOf(a);0<=b&&(c.push(a),e.splice(b,1))});return 0===c.length?1:function(){var a=c[0],b;for(b=1;b<c.length;b++)a*=c[b];return a}()};Fraction.primeFactors=function(a){a=Math.abs(a);for(var b=[],c=2;c*c<=a;)0===a%c?(b.push(c),a/=c):c++;1!=a&&b.push(a);return b};
Fraction.prototype.snap=function(a,b){b||(b=1E-4);a||(a=100);for(var c=0>this.numerator,d=this.numerator/this.denominator,e=Math.abs(d%1),d=c?Math.ceil(d):Math.floor(d),f=1;f<=a;++f)for(var g=0;g<=a;++g)if(Math.abs(Math.abs(g/f)-e)<b)return new Fraction(d*f+g*(c?-1:1),f);return new Fraction(this.numerator,this.denominator)};var wpurp_adjustable_servings={updateAmounts:function(a,d,c){a.each(function(){var a=parseFloat(jQuery(this).data("normalized")),e=jQuery(this).data("fraction");d==c?jQuery(this).text(jQuery(this).data("original")):isFinite(a)?(a=wpurp_adjustable_servings.toFixed(c*a/d,e),jQuery(this).text(a)):jQuery(this).addClass("recipe-ingredient-nan")})},toFixed:function(a,d){if(d){var c=Fraction(a.toString()).snap();if(100>c.denominator)return c}if(""==a||0==a)return"";for(var b=parseInt(wpurp_servings.precision),
c=a.toFixed(b);0==parseFloat(c);)if(b++,c=a.toFixed(b),10<b)return"";return 0<b?(b=Array(b+1).join("0"),c.replace(new RegExp("."+b+"$"),"")):c}};
jQuery(document).ready(function(){jQuery(document).on("keyup change",".adjust-recipe-servings",function(a){a=jQuery(this);var d=a.parents(".wpurp-container").find(".wpurp-recipe-ingredient-quantity"),c=parseFloat(a.data("original")),b=a.val();if(isNaN(b)||0>=b)b=1;wpurp_adjustable_servings.updateAmounts(d,c,b);RecipePrintButton.update(a.parents(".wpurp-container"))});jQuery(document).on("blur",".adjust-recipe-servings",function(a){a=jQuery(this);var d=a.val();if(isNaN(d)||0>=d)d=1;a.parents(".wpurp-container").find(".adjust-recipe-servings").each(function(){jQuery(this).val(d)});
RecipePrintButton.update(a.parents(".wpurp-container"))})});/*!
* jQuery Tools v1.2.7 - The missing UI library for the Web
*
* tooltip/tooltip.js
*
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
*
* http://flowplayer.org/tools/
*
*/
(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.on(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).on(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.off(p[0]).on(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}})}a.fn.jt_tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);var RecipePrintButton=RecipePrintButton||{};
RecipePrintButton.update=function(b){b.find(".wpurp-recipe-print-button").each(function(){var d=jQuery(this),a=d.data("original-link");a||(a=d.attr("href"),d.data("original-link",a));"/"!=a.slice(-1)&&(a+="/");var c=b.find("select.adjust-recipe-unit option:selected").text();c&&(c=c.toLowerCase().replace(/ /g,"-").replace(/[-]+/g,"-").replace(/[^\w-]+/g,""),a+=c+"/");c=b.find("input.adjust-recipe-servings");0==c.length&&(c=b.find("input.advanced-adjust-recipe-servings"));0!=c.length&&(a+=c.val());
d.attr("href",a)})};
jQuery(document).ready(function(){jQuery(document).on("click",".wpurp-recipe-print-button",function(b){var d=jQuery(this).data("recipe-id");if(d){b.preventDefault();b.stopPropagation();b=jQuery(this).parents(".wpurp-container");wpurp_print.servings_original=parseFloat(b.data("servings-original"));wpurp_print.old_system=parseInt(b.data("system-original"));wpurp_print.new_system=b.find("select.adjust-recipe-unit option:selected").val();wpurp_print.rtl=jQuery("body").hasClass("rtl");var a=b.find("input.adjust-recipe-servings");
0==a.length&&(a=b.find("input.advanced-adjust-recipe-servings"));wpurp_print.servings_new=0==a.length?wpurp_print.servings_original:parseFloat(a.val());wpurp_print.template="";jQuery.post(wpurp_print.ajaxurl,{action:"get_recipe_template",security:wpurp_print.nonce,recipe_id:d},function(a){wpurp_print.template=a.output;wpurp_print.fonts=a.fonts},"json");window.open(wpurp_print.coreUrl+"/templates/print.php","_blank")}})});jQuery(document).ready(function(){jQuery(".recipe-tooltip").length&&(jQuery(".recipe-tooltip").jt_tooltip({offset:[-10,0],effect:"fade",delay:250,relative:!0}),jQuery(".recipe-tooltip-content").click(function(a){a.preventDefault();a.stopPropagation()}));jQuery(".wpupg-grid").on("arrangeComplete",function(){jQuery(".recipe-tooltip-content").click(function(a){a.preventDefault();a.stopPropagation()})})});var WPURP_Responsive={elementsSelector:".wpurp-container",maxRefreshRate:5,init:function(){var a=this;jQuery(function(){a.el={window:jQuery(window),responsive_elements:jQuery(a.elementsSelector)};a.events()})},checkBreakpointOfAllElements:function(){var a=WPURP_Responsive;a.el.responsive_elements.each(function(e,b){a.checkBreakpointOfElement(jQuery(b))})},checkBreakpointOfElement:function(a){a.width()<wpurp_responsive_data.breakpoint?(a.find(".wpurp-responsive-mobile").css("display","block"),a.find(".wpurp-responsive-desktop").css("display",
"none")):(a.find(".wpurp-responsive-mobile").css("display","none"),a.find(".wpurp-responsive-desktop").css("display","block"))},events:function(){this.checkBreakpointOfAllElements();this.el.window.bind("resize",this.debounce(this.checkBreakpointOfAllElements,this.maxRefreshRate))},debounce:function(a,e,b){var d,c=null;return function(){var f=this,g=arguments,h=b&&!c;clearTimeout(c);c=setTimeout(function(){c=null;b||(d=a.apply(f,g))},e);h&&(d=a.apply(f,g));return d}}};WPURP_Responsive.init();var SharrrePlatform=SharrrePlatform||function(){var a={};return{register:function(b,c){a[b]=c},get:function(b,c){return a[b]?new a[b](c):(console.error("Sharrre - No platform found for "+b),!1)}}}();SharrrePlatform.register("delicious",function(a){return defaultSettings={url:"",urlCount:!1,layout:"1",count:!0,popup:{width:550,height:550}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?"},trackingAction:{site:"delicious",action:"add"},load:function(a){if("tall"==a.options.buttons.delicious.size)var b="width:50px;",c="height:35px;width:50px;font-size:15px;line-height:35px;",d="height:18px;line-height:18px;margin-top:3px;";else var b="width:93px;",c="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",d="float:left;height:20px;line-height:20px;";var e=a.shorterTotal(a.options.count.delicious);"undefined"==typeof e&&(e=0),jQuery(a.element).find(".buttons").append('<div class="button delicious"><div style="'+b+'font:12px Arial,Helvetica,sans-serif;cursor:pointer;color:#666666;display:inline-block;float:none;height:20px;line-height:normal;margin:0;padding:0;text-indent:0;vertical-align:baseline;"><div style="'+c+'background-color:#fff;margin-bottom:5px;overflow:hidden;text-align:center;border:1px solid #ccc;border-radius:3px;">'+e+'</div><div style="'+d+'display:block;padding:0;text-align:center;text-decoration:none;width:50px;background-color:#7EACEE;border:1px solid #40679C;border-radius:3px;color:#fff;"><img src="https://www.delicious.com/static/img/delicious.small.gif" height="10" width="10" alt="Delicious" /> Add</div></div></div>'),jQuery(a.element).find(".delicious").on("click",function(){a.openPopup("delicious")})},tracking:function(){},popup:function(a){window.open("https://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent(""!==this.settings.url?this.settings.url:a.url)+"&title="+a.text,"delicious","toolbar=no,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("digg",function(a){return defaultSettings={url:"",urlCount:!1,type:"DiggCompact",count:!0,popup:{width:650,height:360}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?"},trackingAction:{site:"digg",action:"add"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button digg"><a class="DiggThisButton '+b.type+'" rel="nofollow external" href="http://digg.com/submit?url='+encodeURIComponent(""!==b.url?b.url:a.options.url)+'"></a></div>');var c=0;"undefined"==typeof __DBW&&0==c&&(c=1,function(){var a=document.createElement("SCRIPT"),b=document.getElementsByTagName("SCRIPT")[0];a.type="text/javascript",a.async=!0,a.src="http://widgets.digg.com/buttons.js",b.parentNode.insertBefore(a,b)}())},tracking:function(){},popup:function(a){window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent(""!==a.buttons.digg.url?a.buttons.digg.url:a.url)+"&title="+a.text+"&related=true&style=true","","toolbar=0, status=0, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("facebook",function(a){return defaultSettings={url:"",urlCount:!1,action:"like",layout:"button_count",count:!0,width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US",share:"",appId:"",popup:{width:900,height:500}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?"},trackingAction:{site:"facebook",action:"like"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button facebook"><div id="fb-root"></div><div class="fb-like" data-href="'+(""!==b.url?b.url:a.options.url)+'" data-send="'+b.send+'" data-layout="'+b.layout+'" data-width="'+b.width+'" data-show-faces="'+b.faces+'" data-action="'+b.action+'" data-colorscheme="'+b.colorscheme+'" data-font="'+b.font+'" data-via="'+b.via+'" data-share="'+b.share+'"></div></div>');var c=0;"undefined"==typeof FB&&0==c?(c=1,function(a,c,d){var e,f=a.getElementsByTagName(c)[0];a.getElementById(d)||(e=a.createElement(c),e.id=d,e.src="https://connect.facebook.net/"+b.lang+"/all.js#xfbml=1",b.appId&&(e.src+="&appId="+b.appId),f.parentNode.insertBefore(e,f))}(document,"script","facebook-jssdk")):FB.XFBML.parse()},tracking:function(){fb=window.setInterval(function(){"undefined"!=typeof FB&&(FB.Event.subscribe("edge.create",function(a){_gaq.push(["_trackSocial","facebook","like",a])}),FB.Event.subscribe("edge.remove",function(a){_gaq.push(["_trackSocial","facebook","unlike",a])}),FB.Event.subscribe("message.send",function(a){_gaq.push(["_trackSocial","facebook","send",a])}),clearInterval(fb))},1e3)},popup:function(a){window.open("https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(""!==this.settings.url?this.settings.url:a.url)+"&t="+a.text,"","toolbar=0, status=0, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("googlePlus",function(a){return defaultSettings={url:"",urlCount:!1,size:"medium",lang:"en-US",annotation:"",count:!0,popup:{width:900,height:500}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return a+"?url={url}&type=googlePlus"},trackingAction:{site:"Google",action:"+1"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button googleplus"><div class="g-plusone" data-size="'+b.size+'" data-href="'+(""!==b.url?b.url:a.options.url)+'" data-annotation="'+b.annotation+'"></div></div>'),window.___gcfg={lang:b.lang};var c=0;"undefined"!=typeof gapi&&"undefined"!=typeof gapi.plusone||0!=c?gapi.plusone.go():(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://apis.google.com/js/plusone.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}())},tracking:function(){},popup:function(a){window.open("https://plus.google.com/share?hl="+a.buttons.googlePlus.lang+"&url="+encodeURIComponent(""!==a.buttons.googlePlus.url?a.buttons.googlePlus.url:a.url),"","toolbar=0, status=0, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("linkedin",function(a){return defaultSettings={url:"",urlCount:!1,counter:"",count:!0,popup:{width:550,height:550}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"https://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?"},trackingAction:{site:"linkedin",action:"share"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button linkedin"><script type="IN/share" data-url="'+(""!==b.url?b.url:a.options.url)+'" data-counter="'+b.counter+'"></script></div>');var c=0;"undefined"==typeof window.IN&&0==c?(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://platform.linkedin.com/in.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}()):"undefined"!=typeof window.IN&&window.IN.parse&&IN.parse(document)},tracking:function(){},popup:function(a){window.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent(""!==a.buttons.linkedin.url?a.buttons.linkedin.url:a.url)+"&token=&isFramed=true","linkedin","toolbar=no, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("pinterest",function(a){return defaultSettings={url:"",media:"",description:"",layout:"horizontal",popup:{width:700,height:300}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"https://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},trackingAction:{site:"pinterest",action:"pin"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button pinterest"><a href="https://www.pinterest.com/pin/create/button/?url='+(""!==b.url?b.url:a.options.url)+"&media="+b.media+"&description="+b.description+'" data-pin-do="buttonBookmark" count-layout="'+b.layout+'">Pin It</a></div>'),function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://assets.pinterest.com/js/pinit.js",a.setAttribute("data-pin-build","parsePinBtns");var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}(),window.parsePinBtns&&window.parsePinBtns(),jQuery(a.element).find(".pinterest").on("click",function(){a.openPopup("pinterest")})},tracking:function(){},popup:function(a){window.open("https://pinterest.com/pin/create/button/?url="+encodeURIComponent(""!==a.buttons.pinterest.url?a.buttons.pinterest.url:a.url)+"&media="+encodeURIComponent(a.buttons.pinterest.media)+"&description="+a.buttons.pinterest.description,"pinterest","toolbar=no,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("reddit",function(a){return defaultSettings={url:"",urlCount:!1,count:!1,popup:{width:900,height:550}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,trackingAction:{site:"reddit",action:"share"},url:function(a){return""},load:function(a){var b=this.settings,c=this;jQuery(a.element).find(".buttons").append('<div class="button reddit"><a href="https://www.reddit.com/submit?url='+(""!==b.url?b.url:a.options.url)+'"><img src="https://www.redditstatic.com/spreddit7.gif" alt="submit to reddit" border="0" /></a></div>'),jQuery(a.element).find(".reddit").on("click",function(){c.popup(a.options)})},tracking:function(){},popup:function(a){window.open("https://www.reddit.com/submit?url="+encodeURIComponent(""!==this.settings.url?this.setting.url:a.url),"","toolbar=0, status=0,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("stumbleupon",function(a){return defaultSettings={url:"",urlCount:!1,size:"medium",count:!0,popup:{width:550,height:550}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return a+"?url={url}&type=stumbleupon"},trackingAction:{site:"stumbleupon",action:"add"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button stumbleupon"><su:badge layout="'+b.layout+'" location="'+(""!==b.url?b.url:a.options.url)+'"></su:badge></div>');var c=0;"undefined"==typeof STMBLPN&&0==c?(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://platform.stumbleupon.com/1/widgets.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}(),s=window.setTimeout(function(){"undefined"!=typeof STMBLPN&&(STMBLPN.processWidgets(),clearInterval(s))},500)):(STMBLPN.wasProcessLoaded=!1,STMBLPN.processWidgets())},tracking:function(){},popup:function(a){window.open("https://www.stumbleupon.com/badge/?url="+encodeURIComponent(""!==a.buttons.stumbleupon.url?a.buttons.stumbleupon.url:a.url),"stumbleupon","toolbar=no, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("tumblr",function(a){return defaultSettings={url:"",urlCount:!1,description:"",name:"",count:!1,title:"Share on Tumblr",color:"blue",notes:"none",popup:{width:900,height:500}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return""},trackingAction:{site:"tumblr",action:"share"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div title="'+b.title+'" class="button tumblr"><a class="tumblr-share-button" data-color="'+b.color+'" data-notes="'+b.notes+'" data-href="'+(""!==b.url?b.url:a.options.url)+'" href="https://www.tumblr.com/share">'+b.title+"</a></div>");var c=0;"undefined"==typeof Tumblr&&0==c?(c=1,function(){var a=document.createElement("script"),b=document.getElementsByTagName("script")[0];a.src="https://secure.assets.tumblr.com/share-button.js",b.parentNode.insertBefore(a,b)}()):Tumblr.activate_share_on_tumblr_buttons()},tracking:function(){},popup:function(a){window.open("https://www.tumblr.com/share/link?canonicalUrl="+encodeURIComponent(""!==this.settings.url?this.settings.url:a.url)+"&name="+encodeURIComponent(this.settings.name)+"&description="+encodeURIComponent(this.settings.description),"","toolbar=0, status=0, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("twitter",function(a){return defaultSettings={url:"",urlCount:!1,count:!1,hashtags:"",via:"",related:"",lang:"en",popup:{width:650,height:360}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,trackingAction:{site:"twitter",action:"tweet"},url:function(a){return"https://opensharecount.com/count.json?url={url}"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="'+(""!==b.url?b.url:a.options.url)+'" data-count="'+b.count+'" data-text="'+a.options.text+'" data-via="'+b.via+'" data-hashtags="'+b.hashtags+'" data-related="'+b.related+'" data-lang="'+b.lang+'">Tweet</a></div>');var c=0;"undefined"==typeof twttr&&0==c?(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://platform.twitter.com/widgets.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}()):jQuery.ajax({url:"https://platform.twitter.com/widgets.js",dataType:"script",cache:!0})},tracking:function(){tw=window.setInterval(function(){"undefined"!=typeof twttr&&(twttr.events.bind("tweet",function(a){a&&_gaq.push(["_trackSocial","twitter","tweet"])}),clearInterval(tw))},1e3)},popup:function(a){window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(a.text)+"&url="+encodeURIComponent(""!==this.settings.url?this.setting.url:a.url)+(""!==this.settings.via?"&via="+this.settings.via:""),"","toolbar=0, status=0,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("twitterFollow",function(a){return defaultSettings={url:"",urlCount:!1,count:!0,display:"horizontal",lang:"en",popup:{width:650,height:360},user:"",size:"default",showCount:"false"},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,trackingAction:{site:"twitter",action:"follow"},url:function(a){return""},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button twitterFollow"><a href="https://twitter.com/'+b.user+'" class="twitter-follow-button"" data-size="'+b.size+'" data-show-count="'+b.showCount+'" data-lang="'+b.lang+'">Follow @'+b.user+"</a></div>");var c=0;"undefined"==typeof twttr&&0==c?(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://platform.twitter.com/widgets.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}()):jQuery.ajax({url:"https://platform.twitter.com/widgets.js",dataType:"script",cache:!0})},tracking:function(){},popup:function(a){window.open("https://twitter.com/intent/follow?screen_name="+encodeURIComponent(this.settings.user),"","toolbar=0, status=0, ,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),/*!
* Sharrre.com - Make your sharing widget!
* Version: 2.0.0
* Author: Julien Hany
* License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License
*/
function(a,b,c,d){function f(b,c){this.element=b,this.options=a.extend(!0,{},h,c),this.options.share=c.share,this._defaults=h,this._name=g,this.platforms={},this.init()}var g="sharrre",h={className:"sharrre",share:{},shareTotal:0,template:"",title:"",url:c.location.href,text:c.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:!0,enableHover:!0,enableCounter:!0,enableTracking:!1,defaultUrl:"javascript:void(0);",popup:{width:900,height:500},hover:function(){},hide:function(){},click:function(){},render:function(){}};f.prototype.init=function(){var b=this;a.each(b.options.share,function(a,c){c===!0&&(b.platforms[a]=SharrrePlatform.get(a,b.options.buttons[a]))}),a(this.element).addClass(this.options.className),"undefined"!=typeof a(this.element).data("title")&&(this.options.title=a(this.element).attr("data-title")),"undefined"!=typeof a(this.element).data("url")&&(this.options.url=a(this.element).data("url")),"undefined"!=typeof a(this.element).data("text")&&(this.options.text=a(this.element).data("text")),a.each(this.options.share,function(a,c){c===!0&&b.options.shareTotal++}),b.options.enableCounter===!0?a.each(this.options.share,function(a,c){if(c===!0)try{b.getSocialJson(a)}catch(d){}}):""!==b.options.template&&(b.renderer(),b.options.count[name]=0,b.rendererPerso()),""!==b.options.template?this.options.render(this,this.options):this.loadButtons(),a(this.element).on("mouseenter",function(){0===a(this).find(".buttons").length&&b.options.enableHover===!0&&b.loadButtons(),b.options.hover(b,b.options)}).on("mouseleave",function(){b.options.hide(b,b.options)}),a(this.element).click(function(a){return a.preventDefault(),b.options.click(b,b.options),!1})},f.prototype.loadButtons=function(){var b=this;a(this.element).append('<div class="buttons"></div>'),a.each(b.options.share,function(a,c){1==c&&(b.platforms[a].load(b),b.options.enableTracking===!0&&b.platforms[a].tracking())})},f.prototype.getSocialJson=function(b){var c=this,d=0,e=c.platforms[b].settings,f=c.platforms[b].url(this.options.urlCurl),g=encodeURIComponent(this.options.url);e.url.length&&(f=e.url),e.urlCount===!0&&""!==f&&(g=f),e.count===!1&&(f=""),url=f.replace("{url}",g),""!=url?a.getJSON(url,function(a){if("undefined"!=typeof a.count){var e=a.count+"";e=e.replace("Â ",""),d+=parseInt(e,10)}else a.data&&a.data.length>0&&"undefined"!=typeof a.data[0].total_count?d+=parseInt(a.data[0].total_count,10):"undefined"!=typeof a[0]?d+=parseInt(a[0].total_posts,10):"undefined"!=typeof a[0];c.options.count[b]=d,c.options.total+=d,c.renderer(),c.rendererPerso()}).error(function(){c.options.count[b]=0,c.rendererPerso()}):(c.renderer(),c.options.count[b]=0,c.rendererPerso())},f.prototype.rendererPerso=function(){var a=0;for(e in this.options.count)a++;a===this.options.shareTotal&&this.options.render(this,this.options)},f.prototype.renderer=function(){var b=this.options.total,c=this.options.template;this.options.shorterTotal===!0&&(b=this.shorterTotal(b)),""!==c?(c=c.replace("{total}",b),a(this.element).html(c)):a(this.element).html('<div class="box"><a class="count" href="'+this.options.defaultUrl+'">'+b+"</a>"+(""!==this.options.title?'<a class="share" href="'+this.options.defaultUrl+'">'+this.options.title+"</a>":"")+"</div>")},f.prototype.shorterTotal=function(a){return a>=1e6?a=(a/1e6).toFixed(2)+"M":a>=1e3&&(a=(a/1e3).toFixed(1)+"k"),a},f.prototype.openPopup=function(a){this.platforms[a].popup(this.options),this.options.enableTracking===!0&&(infos=this.platforms[a].trackingAction,_gaq.push(["_trackSocial",infos.site,infos.action]))},f.prototype.simulateClick=function(){var b=a(this.element).html();a(this.element).html(b.replace(this.options.total,this.options.total+1))},f.prototype.update=function(a,b){""!==a&&(this.options.url=a),""!==b&&(this.options.text=b)},a.fn[g]=function(b){var c=arguments;return b===d||"object"==typeof b?this.each(function(){a(this).data("plugin_"+g)||a(this).data("plugin_"+g,new f(this,b))}):"string"==typeof b&&"_"!==b[0]&&"init"!==b?this.each(function(){var d=a(this).data("plugin_"+g);d instanceof f&&"function"==typeof d[b]&&d[b].apply(d,Array.prototype.slice.call(c,1))}):void 0}}(window.jQuery||window.Zepto,window,document);jQuery(document).ready(function(){jQuery(".wpurp-twitter").each(function(c,b){var a=jQuery(b);a.sharrre({share:{twitter:!0},buttons:{twitter:{count:jQuery(a).data("layout"),lang:wpurp_sharing_buttons.twitter_lang}},enableHover:!1,enableCounter:!1,enableTracking:!1})});jQuery(".wpurp-facebook").each(function(c,b){var a=jQuery(b);a.sharrre({share:{facebook:!0},buttons:{facebook:{action:"like",layout:jQuery(a).data("layout"),share:jQuery(a).data("share"),lang:wpurp_sharing_buttons.facebook_lang}},enableHover:!1,
enableCounter:!1,enableTracking:!1})});jQuery(".wpurp-google").each(function(c,b){var a=jQuery(b);a.sharrre({share:{googlePlus:!0},buttons:{googlePlus:{size:jQuery(a).data("layout"),annotation:jQuery(a).data("annotation"),lang:wpurp_sharing_buttons.google_lang}},enableHover:!1,enableCounter:!1,enableTracking:!1})});jQuery(".wpurp-pinterest").each(function(c,b){var a=jQuery(b);a.sharrre({share:{pinterest:!0},buttons:{pinterest:{url:jQuery(a).data("url"),media:jQuery(a).data("media"),description:jQuery(a).data("description"),
layout:jQuery(a).data("layout")}},enableHover:!1,enableCounter:!1,enableTracking:!1,click:function(a,b){a.openPopup("pinterest")}})});jQuery(".wpurp-stumbleupon").each(function(c,b){var a=jQuery(b);a.sharrre({share:{stumbleupon:!0},buttons:{stumbleupon:{layout:jQuery(a).data("layout")}},enableHover:!1,enableCounter:!1,enableTracking:!1})});jQuery(".wpurp-linkedin").each(function(c,b){var a=jQuery(b);a.sharrre({share:{linkedin:!0},buttons:{linkedin:{counter:jQuery(a).data("layout")}},enableHover:!1,
enableCounter:!1,enableTracking:!1})})});function wpurp_bigoven(){var a=document.createElement("script");a.type="text/javascript";a.src="http://www.bigoven.com/assets/noexpire/js/getrecipe.js?"+(new Date).getTime()/1E5;document.getElementsByTagName("head")[0].appendChild(a)};jQuery(document).ready(function(){jQuery(document).on("click",".wpurp-recipe-favorite",function(c){c.preventDefault();c.stopPropagation();var d=jQuery(this),a=d.find("i");c=d.data("recipe-id");jQuery.post(wpurp_favorite_recipe.ajaxurl,{action:"favorite_recipe",security:wpurp_favorite_recipe.nonce,recipe_id:c},function(b){b=a.data("icon");var e=a.data("icon-alt");a.hasClass(b)?(a.removeClass(b),a.addClass(e)):(a.removeClass(e),a.addClass(b));if(d.next().hasClass("recipe-tooltip-content")){b=d.next().find(".tooltip-shown").first();
var e=d.next().find(".tooltip-alt").first(),c=b.html(),f=e.html();b.html(f);e.html(c)}})})});/*
Copyright 2012 Igor Vaynberg
Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
General Public License version 2 (the "GPL License"). You may choose either license to govern your
use of this software only upon the condition that you accept all of the terms of either the Apache
License or the GPL License.
You may obtain a copy of the Apache License and the GPL License at:
http://www.apache.org/licenses/LICENSE-2.0
http://www.gnu.org/licenses/gpl-2.0.html
Unless required by applicable law or agreed to in writing, software distributed under the Apache License
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the Apache License and the GPL License for the specific language governing
permissions and limitations under the Apache License and the GPL License.
*/
!function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(a){var b,c,d,e;if(!a||a.length<1)return a;for(b="",c=0,d=a.length;d>c;c++)e=a.charAt(c),b+=m[e]||e;return b}function o(a,b){for(var c=0,d=b.length;d>c;c+=1)if(q(a,b[c]))return c;return-1}function p(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function q(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function r(b,c){var d,e,f;if(null===b||b.length<1)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function s(a){return a.outerWidth(!1)-a.width()}function t(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function u(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function v(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function w(a){var c,b=!1;return function(){return b===!1&&(c=a(),b=!0),c}}function x(a,b){var c=v(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){o(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus(),a.is(":visible")&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function D(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=n(a.toUpperCase()).indexOf(n(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page);i.callback(b)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]};a(d?c():c).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g)}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;throw new Error(c+" must be a function or a falsy value")}function K(b){return a.isFunction(b)?b():b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(q(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,h,j,k,i={x:0,y:0},c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z"};j=a(document),g=function(){var a=1;return function(){return a++}}(),j.on("mousemove",function(a){i.x=a.pageX,i.y=a.pageY}),d=N(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,f=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+g()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=w(function(){return c.element.closest("body")}),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss)),this.container.addClass(K(c.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(f),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),u(this.results),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",f,this.bind(this.highlightUnderEvent)),x(80,this.results),this.dropdown.on("scroll-debounced",f,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),t(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",f,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown",function(a){a.stopPropagation()}),a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),k=k||p(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.nextSearchTerm=b},destroy:function(){var a=this.opts.element,c=a.data("select2");this.close(),this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),c!==b&&(c.container.remove(),c.dropdown.remove(),a.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show())},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:q(a.attr("locked"),"locked")||q(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,f,g,h=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,f){var g,i=this.opts.id;g=function(d,e,j){var k,l,m,n,o,p,q,r,s,t;for(d=c.sortResults(d,e,f),k=0,l=d.length;l>k;k+=1)m=d[k],o=m.disabled===!0,n=!o&&i(m)!==b,p=m.children&&m.children.length>0,q=a("<li></li>"),q.addClass("select2-results-dept-"+j),q.addClass("select2-result"),q.addClass(n?"select2-result-selectable":"select2-result-unselectable"),o&&q.addClass("select2-disabled"),p&&q.addClass("select2-result-with-children"),q.addClass(h.opts.formatResultCssClass(m)),r=a(document.createElement("div")),r.addClass("select2-result-label"),t=c.formatResult(m,r,f,h.opts.escapeMarkup),t!==b&&r.html(t),q.append(r),p&&(s=a("<ul></ul>"),s.addClass("select2-result-sub"),g(m.children,s,j+1),q.append(s)),q.data("select2-data",m),e.append(q)},g(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(f=c.id,c.id=function(a){return a[f]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,i,c={results:[],more:!1},e=a.term;i=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(h.optionToData(b)):b.is("optgroup")&&(d=h.optionToData(b),b.children().each2(function(a,b){i(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){i(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id},c.formatResultCssClass=function(a){return a.css}):"query"in c||("ajax"in c?(g=c.element.data("ajax-url"),g&&g.length>0&&(c.ajax.url=g),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(r(b.val(),c.separator)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return q(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");return c},monitorSource:function(){var c,d,a=this.opts.element;a.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),c=this.bind(function(){var c=a.prop("disabled");c===b&&(c=!1),this.enable(!c);var d=a.prop("readonly");d===b&&(d=!1),this.readonly(d),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass)),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass))}),a.on("propertychange.select2",c),this.mutationCallback===b&&(this.mutationCallback=function(a){a.forEach(c)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(this.mutationCallback),this.propertyObserver.observe(a.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){return a===b&&(a=!1),this._readonly===a?!1:(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface(),!0)},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,u,v,w,x,b=this.dropdown,c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),g=a(window),h=g.width(),i=g.height(),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,o=l>=m+f,p=c.top-f>=this.body().scrollTop(),q=b.outerWidth(!1),r=j>=n+q,s=b.hasClass("select2-drop-above");s?(u=!0,!p&&o&&(v=!0,u=!1)):(u=!1,!o&&p&&(v=!0,u=!0)),v&&(b.hide(),c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,q=b.outerWidth(!1),r=j>=n+q,b.show()),this.opts.dropdownAutoWidth?(x=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),q=b.outerWidth(!1)+(x.scrollHeight===x.clientHeight?0:k.width),q>e?e=q:q=e,r=j>=n+q):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body().css("position")&&(t=this.body().offset(),m-=t.top,n-=t.left),r||(n=c.left+e-q),w={left:n,width:e},u?(w.bottom=i-c.top,w.top="auto",this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(w.top=m,w.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),w=a.extend(w,K(this.opts.dropdownCss)),b.css(w)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){var f,b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body()),f=a("#select2-drop-mask"),0==f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body()),f.on("mousedown touchstart click",function(b){var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close({focus:!0}),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),f=e.offset().top+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!0),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=e.offset().top-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled, .select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?o(c.filter(".select2-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.ensureHighlightVisible(),e=d.data("select2-data"),e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).text(e.opts.formatLoadMore(d+1)),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown()}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!q(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+f.formatSelectionTooBig(o)+"</li>"),void 0;if(d.val().length<f.minimumInputLength)return J(f.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+f.formatInputTooShort(d.val(),f.minimumInputLength)+"</li>"):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;
if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+f.formatInputTooLong(d.val(),f.maximumInputLength)+"</li>"):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+f.formatSearching()+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return q(h.id(this),h.id(i))}).length&&g.results.unshift(i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+f.formatNoMatches(d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+h.opts.escapeMarkup(f.formatLoadMore(this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var a=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&a||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.text()&&""===a.val())return a}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),e=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow'><b></b></span>","</a>","<input class='select2-focusser select2-offscreen' type='text'/>","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>"," </div>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e)),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(a){this.opened()&&(this.parent.close.apply(this,arguments),a=a||{focus:!0},this.focusser.removeAttr("disabled"),a.focus&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.removeAttr("disabled"),this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var b,d=this.container,e=this.dropdown;this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=d.find(".select2-choice"),this.focusser=d.find(".select2-focusser"),this.focusser.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id")),this.focusser.attr("tabindex",this.elementTabIndex),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){if(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)return A(a),void 0;switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case c.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.ESC){if(this.opts.openOnEnter===!1&&a.which===c.ENTER)return A(a),void 0;if(a.which==c.DOWN||a.which==c.UP||a.which==c.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==c.DELETE||a.which==c.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),t(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection.focus())})),b.on("mousedown",this.bind(function(b){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(b)})),e.on("mousedown",this.bind(function(){this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder())})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()?(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val():!1},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=q(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return q(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||this.focusser.focus(),q(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),f=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=r(c.val(),b.separator),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return q(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(q(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var d,b=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=d=this.container.find(b);var e=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(){e.search[0].focus(),e.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=d.find(".select2-search-choice-focus"),e=b.prev(".select2-search-choice:not(.select2-locked)"),f=b.next(".select2-search-choice:not(.select2-locked)"),g=z(this.search);if(b.length&&(a.which==c.LEFT||a.which==c.RIGHT||a.which==c.BACKSPACE||a.which==c.DELETE||a.which==c.ENTER)){var h=b;return a.which==c.LEFT&&e.length?h=e:a.which==c.RIGHT?h=f.length?f:null:a.which===c.BACKSPACE?(this.unselect(b.first()),this.search.width(10),h=e.length?e:f):a.which==c.DELETE?(this.unselect(b.first()),this.search.width(10),h=f.length?f:null):a.which==c.ENTER&&(h=null),this.selectChoice(h),A(a),h&&h.length||this.open(),void 0}if((a.which===c.BACKSPACE&&1==this.keydowns||a.which==c.LEFT)&&0==g.offset&&!g.length)return this.selectChoice(d.find(".select2-search-choice:not(.select2-locked)").last()),A(a),void 0;if(this.selectChoice(null),this.opened())switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),void 0;case c.ESC:return this.cancel(a),A(a),void 0}if(a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.BACKSPACE&&a.which!==c.ESC){if(a.which===c.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)&&A(a),a.which===c.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.updateResults(!0),this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){o(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,b){this.triggerSelect(a)&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),b&&b.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2-search-choice'> <div></div> <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith("<div>"+j+"</div>"),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.close(),this.focusSearch()})).dequeue(),A(b))})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){for(;(e=o(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();var f=a.Event("select2-removing");f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented()||(b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}))}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));o(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+g.opts.formatNoMatches(g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-s(this.search)},resizeSearch:function(){var a,b,c,d,e,f=s(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),r(a,this.opts.separator))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){o(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)q(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c>0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.find(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,g,h,i,j,c=Array.prototype.slice.call(arguments,0),k=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],l=["opened","isFocused","container","dropdown"],m=["val","data"],n={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?j=d.element.prop("multiple"):(j=d.multiple||!1,"tags"in d&&(d.multiple=j=!0)),g=j?new f:new e,g.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(o(c[0],k)<0)throw"Unknown method: "+c[0];if(i=b,g=a(this).data("select2"),g===b)return;if(h=c[0],"container"===h?i=g.container:"dropdown"===h?i=g.dropdown:(n[h]&&(h=n[h]),i=g[h].apply(g,c.slice(1))),o(c[0],l)>=0||o(c[0],m)&&1==c.length)return!1}}),i===b?this:i},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(a.text,c.term,e,d),e.join("")},formatSelection:function(a,c,d){return a?d(a.text):b},sortResults:function(a){return a},formatResultCssClass:function(){return b},formatSelectionCssClass:function(){return b},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a.id},matcher:function(a,b){return n(""+b).toUpperCase().indexOf(n(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b}},a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:v,markMatch:E,escapeMarkup:F,stripDiacritics:n},"class":{"abstract":d,single:e,multi:f}}}}(jQuery);jQuery(document).ready(function(){0<jQuery(".wpurp-recipe-add-to-meal-plan").length&&(jQuery(".wpurp-meal-plan-button-date").datepicker({minDate:0}),jQuery(document).on("click",".wpurp-recipe-add-to-meal-plan",function(a){a.preventDefault();a.stopPropagation();jQuery(this).next().toggleClass("tooltip-force-display")}),jQuery(document).on("change",".wpurp-meal-plan-button-course",function(a){a.preventDefault();a.stopPropagation();var b=jQuery(this).parents(".recipe-tooltip-content").prev();if(!b.hasClass("in-meal-plan")){a=
b.data("recipe-id");var d=b.parents(".wpurp-container"),e=0,c=d.find("input.adjust-recipe-servings");0==c.length&&(c=d.find("input.advanced-adjust-recipe-servings"));0!=c.length&&(e=parseInt(c.val()));d=b.next().find(".wpurp-meal-plan-button-date").val();c=b.next().find(".wpurp-meal-plan-button-course option:selected").text();jQuery.post(wpurp_add_to_meal_plan.ajaxurl,{action:"meal_planner_button",security:wpurp_add_to_meal_plan.nonce,recipe_id:a,servings_wanted:e,date:d,course:c},function(a){b.addClass("in-meal-plan");
b.next().removeClass("tooltip-force-display");if(b.next().hasClass("recipe-tooltip-content")){a=b.next().find(".tooltip-shown").first();var c=b.next().find(".tooltip-alt").first(),d=a.html(),e=c.html();a.html(e);c.html(d)}})}}))});jQuery(document).ready(function(){function d(a){var b={action:"recipe_grid_get_recipes",security:wpurp_recipe_grid.nonce,grid:e[a],grid_name:a},c=jQuery("#wpurp-recipe-grid-"+a);c.append('<div id="floatingCirclesG"><div class="f_circleG" id="frotateG_01"></div><div class="f_circleG" id="frotateG_02"></div><div class="f_circleG" id="frotateG_03"></div><div class="f_circleG" id="frotateG_04"></div><div class="f_circleG" id="frotateG_05"></div><div class="f_circleG" id="frotateG_06"></div><div class="f_circleG" id="frotateG_07"></div><div class="f_circleG" id="frotateG_08"></div></div>');
jQuery.post(wpurp_recipe_grid.ajaxurl,b,function(a){c.append(a).find("#floatingCirclesG").remove();jQuery(".recipe-card a").replaceWith(function(){return jQuery(this).contents()});c.trigger("recipeGridChanged")})}jQuery(".wpurp-recipe-grid-filter").select2({allowClear:!0,width:"off",dropdownAutoWidth:!1});var e={};jQuery(".wpurp-recipe-grid-container").each(function(){for(var a=jQuery(this).data("grid-name"),b=window["wpurp_recipe_grid_"+a].recipes,c=window["wpurp_recipe_grid_"+a].template,d=window["wpurp_recipe_grid_"+
a].orderby,k=window["wpurp_recipe_grid_"+a].order,l=window["wpurp_recipe_grid_"+a].limit,m=window["wpurp_recipe_grid_"+a].images_only,g=window["wpurp_recipe_grid_"+a].filters,n=window["wpurp_recipe_grid_"+a].match_all,p=window["wpurp_recipe_grid_"+a].match_parents,h={},f=0,q=g.length;f<q;f++)jQuery.extend(h,g[f]);e[a]={recipes:b,template:c,orderby:d,order:k,limit:l,images_only:m,offset:0,filters:h,match_all:n,match_parents:p}});jQuery(document).on("click",".recipe-card",function(){var a=jQuery(this).data("link");
window.location.href=a});0<jQuery(".recipe-card .socialite").length&&Socialite.load();jQuery(".recipe-card a:not(.wpurp-recipe-favorite, .wpurp-recipe-add-to-shopping-list, .wpurp-recipe-print-button, .wpurp-recipe-grid-link)").replaceWith(function(){return jQuery(this).contents()});jQuery(".wpurp-recipe-grid-filter").on("change",function(){var a=jQuery(this).attr("id").substr(7),b=jQuery(this).val(),c=jQuery(this).data("grid-name");null===b||jQuery.isArray(b)||(b=[b]);e[c].filters[a]=b;jQuery("#wpurp-recipe-grid-"+
c).empty();d(c)})});(function(e,p){"object"===typeof exports?module.exports=p():"function"===typeof define&&define.amd?define(p):e.Qty=p()})(this,function(){function e(a){this.signature=this.baseScalar=this.scalar=null;this.output={};this.denominator=this.numerator=l;if(a.constructor===String){var b=a=a.trim(),c=N.exec(b);if(!c)throw b+": Quantity not recognized";if(""===b.trim())throw"Unit not recognized";this.scalar=c[1]?parseFloat(c[1]):1;for(var b=c[2],d=c[3],f,e,k;c=O.exec(b);){f=parseFloat(c[2]);if(isNaN(f))throw"Unit exponent is not a number";
if(0===f&&!z.test(c[1]))throw"Unit not recognized";e=c[1]+" ";k="";for(var h=0;h<Math.abs(f);h++)k+=e;0<=f?b=b.replace(c[0],k):(d=d?d+k:k,b=b.replace(c[0],""))}for(;c=P.exec(d);){f=parseFloat(c[2]);if(isNaN(f))throw"Unit exponent is not a number";if(0===f&&!z.test(c[1]))throw"Unit not recognized";e=c[1]+" ";k="";for(h=0;h<f;h++)k+=e;d=d.replace(c[0],k,"g")}b&&(this.numerator=D(b.trim()));d&&(this.denominator=D(d.trim()))}else this.scalar=a.scalar,this.numerator=a.numerator&&0!==a.numerator.length?
a.numerator:l,this.denominator=a.denominator&&0!==a.denominator.length?a.denominator:l;if(0<=this.denominator.join("*").indexOf("temp"))throw"Cannot divide with temperatures";if(0<=this.numerator.join("*").indexOf("temp")){if(1<this.numerator.length)throw"Cannot multiply by temperatures";if(!r(this.denominator,l))throw"Cannot divide with temperatures";}this.initValue=a;this.baseScalar||(this.isBase()?(this.baseScalar=this.scalar,this.signature=Q.call(this)):(a=this.toBase(),this.baseScalar=a.scalar,
this.signature=a.signature));if(this.isTemperature()&&0>this.baseScalar)throw"Temperatures must not be less than absolute zero";}function p(){throw"Incompatible units";}function R(a,b){for(var c=[],d=[],f=1,g,k=0;k<a.length;k++)g=a[k],q[g]?f=u(f,q[g]):h[g]&&(f*=h[g].scalar,h[g].numerator&&c.push(h[g].numerator),h[g].denominator&&d.push(h[g].denominator));for(k=0;k<b.length;k++)g=b[k],q[g]?f/=q[g]:h[g]&&(f/=h[g].scalar,h[g].numerator&&d.push(h[g].numerator),h[g].denominator&&c.push(h[g].denominator));
c=c.reduce(function(a,b){return a.concat(b)},[]);d=d.reduce(function(a,b){return a.concat(b)},[]);return new e({scalar:f,numerator:c,denominator:d})}function D(a){var b=E[a];if(b)return b;var c=[];if(!z.test(a))throw"Unit not recognized";for(;b=S.exec(a);)c.push(b.slice(1));c=c.map(function(a){return w[a[0]]?[w[a[0]],x[a[1]]]:[x[a[1]]]});c=c.reduce(function(a,b){return a.concat(b)},[]);c=c.filter(function(a){return a});return E[a]=c}function A(){}function F(a){var b=G.get(a);if(b)return b;b=r(a,l)?
"1":T(U(a)).join("*");G.set(a,b);return b}function U(a){for(var b=[],c,d,f=0;f<a.length;f++)c=a[f],d=a[f+1],q[c]?(b.push(y[c]+y[d]),f++):b.push(y[c]);return b}function T(a){return a.reduce(function(a,c){var d=a[c];d||a.push(d=a[c]=[c,0]);d[1]++;return a},[]).map(function(a){return a[0]+(1<a[1]?a[1]:"")})}function r(a,b){if(b.length!==a.length)return!1;for(var c=0;c<a.length;c++)if(b[c].compareArray&&!b[c].compareArray(a[c])||b[c]!==a[c])return!1;return!0}function H(a,b){var c=b.to(B(a.units()));return new e({scalar:a.scalar+
c.scalar,numerator:a.numerator,denominator:a.denominator})}function B(a){if("tempK"===a)return"degK";if("tempC"===a)return"degC";if("tempF"===a)return"degF";if("tempR"===a)return"degR";throw"Unknown type for temp conversion from: "+a;}function u(){for(var a=1,b=0,c=0;c<arguments.length;c++)var d=arguments[c],b=b+I(d),a=a*d;return 0!==b?Math.round(a*Math.pow(10,b))/Math.pow(10,b):a}function J(a,b){if(0===b)throw"Divide by zero";var c=Math.pow(10,I(b));return u(a,c/(c*b))}function I(a){var b,c;if((c=
V.exec(a))&&c[2])b=c[2].length;else if(c=W.exec(a))b=parseInt(c[2],10);return b||0}function K(a,b){a=a.filter(function(a){return"<1>"!==a});b=b.filter(function(a){return"<1>"!==a});for(var c={},d,f=0;f<a.length;f++)q[a[f]]?(d=[a[f],a[f+1]],f++):d=a[f],d&&"<1>"!==d&&(c[d]?c[d][0]++:c[d]=[1,d]);for(f=0;f<b.length;f++)q[b[f]]?(d=[b[f],b[f+1]],f++):d=b[f],d&&"<1>"!==d&&(c[d]?c[d][0]--:c[d]=[-1,d]);a=[];b=[];for(var e in c)if(c.hasOwnProperty(e))if(d=c[e],0<d[0])for(f=0;f<d[0];f++)a.push(d[1]);else if(0>
d[0])for(f=0;f<-d[0];f++)b.push(d[1]);0===a.length&&(a=l);0===b.length&&(b=l);a=a.reduce(function(a,b){return a.concat(b)},[]);b=b.reduce(function(a,b){return a.concat(b)},[]);return[a,b]}function X(a){return a}var v={"<googol>":[["googol"],1E100,"prefix"],"<kibi>":[["Ki","Kibi","kibi"],Math.pow(2,10),"prefix"],"<mebi>":[["Mi","Mebi","mebi"],Math.pow(2,20),"prefix"],"<gibi>":[["Gi","Gibi","gibi"],Math.pow(2,30),"prefix"],"<tebi>":[["Ti","Tebi","tebi"],Math.pow(2,40),"prefix"],"<pebi>":[["Pi","Pebi",
"pebi"],Math.pow(2,50),"prefix"],"<exi>":[["Ei","Exi","exi"],Math.pow(2,60),"prefix"],"<zebi>":[["Zi","Zebi","zebi"],Math.pow(2,70),"prefix"],"<yebi>":[["Yi","Yebi","yebi"],Math.pow(2,80),"prefix"],"<yotta>":[["Y","Yotta","yotta"],1E24,"prefix"],"<zetta>":[["Z","Zetta","zetta"],1E21,"prefix"],"<exa>":[["E","Exa","exa"],1E18,"prefix"],"<peta>":[["P","Peta","peta"],1E15,"prefix"],"<tera>":[["T","Tera","tera"],1E12,"prefix"],"<giga>":[["G","Giga","giga"],1E9,"prefix"],"<mega>":[["M","Mega","mega"],1E6,
"prefix"],"<kilo>":[["k","kilo"],1E3,"prefix"],"<hecto>":[["h","Hecto","hecto"],100,"prefix"],"<deca>":[["da","Deca","deca","deka"],10,"prefix"],"<deci>":[["d","Deci","deci"],.1,"prefix"],"<centi>":[["c","Centi","centi"],.01,"prefix"],"<milli>":[["m","Milli","milli"],.001,"prefix"],"<micro>":[["u","Micro","micro"],1E-6,"prefix"],"<nano>":[["n","Nano","nano"],1E-9,"prefix"],"<pico>":[["p","Pico","pico"],1E-12,"prefix"],"<femto>":[["f","Femto","femto"],1E-15,"prefix"],"<atto>":[["a","Atto","atto"],
1E-18,"prefix"],"<zepto>":[["z","Zepto","zepto"],1E-21,"prefix"],"<yocto>":[["y","Yocto","yocto"],1E-24,"prefix"],"<1>":[["1","<1>"],1,""],"<meter>":[["m","meter","meters","metre","metres"],1,"length",["<meter>"]],"<inch>":[["in","inch","inches",'"'],.0254,"length",["<meter>"]],"<foot>":[["ft","foot","feet","'"],.3048,"length",["<meter>"]],"<yard>":[["yd","yard","yards"],.9144,"length",["<meter>"]],"<mile>":[["mi","mile","miles"],1609.344,"length",["<meter>"]],"<naut-mile>":[["nmi"],1852,"length",
["<meter>"]],"<league>":[["league","leagues"],4828,"length",["<meter>"]],"<furlong>":[["furlong","furlongs"],201.2,"length",["<meter>"]],"<rod>":[["rd","rod","rods"],5.029,"length",["<meter>"]],"<mil>":[["mil","mils"],2.54E-5,"length",["<meter>"]],"<angstrom>":[["ang","angstrom","angstroms"],1E-10,"length",["<meter>"]],"<fathom>":[["fathom","fathoms"],1.829,"length",["<meter>"]],"<pica>":[["pica","picas"],.004217,"length",["<meter>"]],"<point>":[["pt","point","points"],3.514E-4,"length",["<meter>"]],
"<redshift>":[["z","red-shift"],1.302773E26,"length",["<meter>"]],"<AU>":[["AU","astronomical-unit"],1495979E5,"length",["<meter>"]],"<light-second>":[["ls","light-second"],299792500,"length",["<meter>"]],"<light-minute>":[["lmin","light-minute"],1798755E4,"length",["<meter>"]],"<light-year>":[["ly","light-year"],9460528E9,"length",["<meter>"]],"<parsec>":[["pc","parsec","parsecs"],3085678E10,"length",["<meter>"]],"<kilogram>":[["kg","kilogram","kilograms"],1,"mass",["<kilogram>"]],"<AMU>":[["u",
"AMU","amu"],6.0221415E26,"mass",["<kilogram>"]],"<dalton>":[["Da","Dalton","Daltons","dalton","daltons"],6.0221415E26,"mass",["<kilogram>"]],"<slug>":[["slug","slugs"],14.5939029,"mass",["<kilogram>"]],"<short-ton>":[["tn","ton"],907.18474,"mass",["<kilogram>"]],"<metric-ton>":[["tonne"],1E3,"mass",["<kilogram>"]],"<carat>":[["ct","carat","carats"],2E-4,"mass",["<kilogram>"]],"<pound>":[["lbs","lb","pound","pounds","#"],.45359237,"mass",["<kilogram>"]],"<ounce>":[["oz","ounce","ounces"],.0283495231,
"mass",["<kilogram>"]],"<gram>":[["g","gram","grams","gramme","grammes"],.001,"mass",["<kilogram>"]],"<grain>":[["grain","grains","gr"],6.479891E-5,"mass",["<kilogram>"]],"<dram>":[["dram","drams","dr"],.0017718452,"mass",["<kilogram>"]],"<stone>":[["stone","stones","st"],6.35029318,"mass",["<kilogram>"]],"<hectare>":[["hectare"],1E4,"area",["<meter>","<meter>"]],"<acre>":[["acre","acres"],4046.85642,"area",["<meter>","<meter>"]],"<sqft>":[["sqft"],1,"area",["<feet>","<feet>"]],"<liter>":["l L liter liters litre litres".split(" "),
.001,"volume",["<meter>","<meter>","<meter>"]],"<gallon>":[["gal","gallon","gallons"],.0037854118,"volume",["<meter>","<meter>","<meter>"]],"<quart>":[["qt","quart","quarts"],9.4635295E-4,"volume",["<meter>","<meter>","<meter>"]],"<pint>":[["pt","pint","pints"],4.73176475E-4,"volume",["<meter>","<meter>","<meter>"]],"<cup>":[["cu","cup","cups"],2.36588238E-4,"volume",["<meter>","<meter>","<meter>"]],"<fluid-ounce>":[["floz","fluid-ounce"],2.95735297E-5,"volume",["<meter>","<meter>","<meter>"]],"<tablespoon>":[["tbs",
"tablespoon","tablespoons"],1.47867648E-5,"volume",["<meter>","<meter>","<meter>"]],"<teaspoon>":[["tsp","teaspoon","teaspoons"],4.92892161E-6,"volume",["<meter>","<meter>","<meter>"]],"<kph>":[["kph"],.277777778,"speed",["<meter>"],["<second>"]],"<mph>":[["mph"],.44704,"speed",["<meter>"],["<second>"]],"<knot>":[["kt","kn","kts","knot","knots"],.514444444,"speed",["<meter>"],["<second>"]],"<fps>":[["fps"],.3048,"speed",["<meter>"],["<second>"]],"<gee>":[["gee"],9.80665,"acceleration",["<meter>"],
["<second>","<second>"]],"<kelvin>":[["degK","kelvin"],1,"temperature",["<kelvin>"]],"<celsius>":[["degC","celsius","celsius","centigrade"],1,"temperature",["<kelvin>"]],"<fahrenheit>":[["degF","fahrenheit"],5/9,"temperature",["<kelvin>"]],"<rankine>":[["degR","rankine"],5/9,"temperature",["<kelvin>"]],"<temp-K>":[["tempK"],1,"temperature",["<temp-K>"]],"<temp-C>":[["tempC"],1,"temperature",["<temp-K>"]],"<temp-F>":[["tempF"],5/9,"temperature",["<temp-K>"]],"<temp-R>":[["tempR"],5/9,"temperature",
["<temp-K>"]],"<second>":[["s","sec","second","seconds"],1,"time",["<second>"]],"<minute>":[["min","minute","minutes"],60,"time",["<second>"]],"<hour>":[["h","hr","hrs","hour","hours"],3600,"time",["<second>"]],"<day>":[["d","day","days"],86400,"time",["<second>"]],"<week>":[["wk","week","weeks"],604800,"time",["<second>"]],"<fortnight>":[["fortnight","fortnights"],1209600,"time",["<second>"]],"<year>":[["y","yr","year","years","annum"],31556926,"time",["<second>"]],"<decade>":[["decade","decades"],
315569260,"time",["<second>"]],"<century>":[["century","centuries"],3155692600,"time",["<second>"]],"<pascal>":[["Pa","pascal","Pascal"],1,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<bar>":[["bar","bars"],1E5,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<mmHg>":[["mmHg"],133.322368,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<inHg>":[["inHg"],3386.3881472,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<torr>":[["torr"],133.322368,
"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<atm>":[["atm","ATM","atmosphere","atmospheres"],101325,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<psi>":[["psi"],6894.76,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<cmh2o>":[["cmH2O"],98.0638,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<inh2o>":[["inH2O"],249.082052,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<poise>":[["P","poise"],.1,"viscosity",["<kilogram>"],
["<meter>","<second>"]],"<stokes>":[["St","stokes"],1E-4,"viscosity",["<meter>","<meter>"],["<second>"]],"<mole>":[["mol","mole"],1,"substance",["<mole>"]],"<molar>":[["M","molar"],1E3,"concentration",["<mole>"],["<meter>","<meter>","<meter>"]],"<wtpercent>":[["wt%","wtpercent"],10,"concentration",["<kilogram>"],["<meter>","<meter>","<meter>"]],"<katal>":[["kat","katal","Katal"],1,"activity",["<mole>"],["<second>"]],"<unit>":[["U","enzUnit"],1.6667E-15,"activity",["<mole>"],["<second>"]],"<farad>":[["F",
"farad","Farad"],1,"capacitance",["<farad>"]],"<coulomb>":[["C","coulomb","Coulomb"],1,"charge",["<ampere>","<second>"]],"<ampere>":[["A","Ampere","ampere","amp","amps"],1,"current",["<ampere>"]],"<siemens>":[["S","Siemens","siemens"],1,"conductance",["<second>","<second>","<second>","<ampere>","<ampere>"],["<kilogram>","<meter>","<meter>"]],"<henry>":[["H","Henry","henry"],1,"inductance",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>","<ampere>"]],"<volt>":[["V","Volt","volt",
"volts"],1,"potential",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<second>","<ampere>"]],"<ohm>":[["Ohm","ohm"],1,"resistance",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<second>","<ampere>","<ampere>"]],"<weber>":[["Wb","weber","webers"],1,"magnetism",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>"]],"<tesla>":[["T","tesla","teslas"],1,"magnetism",["<kilogram>"],["<second>","<second>","<ampere>"]],"<gauss>":[["G","gauss"],1E-4,"magnetism",["<kilogram>"],
["<second>","<second>","<ampere>"]],"<maxwell>":[["Mx","maxwell","maxwells"],1E-8,"magnetism",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>"]],"<oersted>":[["Oe","oersted","oersteds"],250/Math.PI,"magnetism",["<ampere>"],["<meter>"]],"<joule>":[["J","joule","Joule","joules"],1,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<erg>":[["erg","ergs"],1E-7,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<btu>":[["BTU","btu","BTUs"],1055.056,
"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<calorie>":[["cal","calorie","calories"],4.184,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<Calorie>":[["Cal","Calorie","Calories"],4184,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<therm-US>":[["th","therm","therms","Therm"],105480400,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<newton>":[["N","Newton","newton"],1,"force",["<kilogram>","<meter>"],["<second>",
"<second>"]],"<dyne>":[["dyn","dyne"],1E-5,"force",["<kilogram>","<meter>"],["<second>","<second>"]],"<pound-force>":[["lbf","pound-force"],4.448222,"force",["<kilogram>","<meter>"],["<second>","<second>"]],"<hertz>":[["Hz","hertz","Hertz"],1,"frequency",["<1>"],["<second>"]],"<radian>":[["rad","radian","radian"],1,"angle",["<radian>"]],"<degree>":[["deg","degree","degrees"],Math.PI/180,"angle",["<radian>"]],"<grad>":[["grad","gradian","grads"],Math.PI/200,"angle",["<radian>"]],"<steradian>":[["sr",
"steradian","steradians"],1,"solid_angle",["<steradian>"]],"<rotation>":[["rotation"],2*Math.PI,"angle",["<radian>"]],"<rpm>":[["rpm"],2*Math.PI/60,"angular_velocity",["<radian>"],["<second>"]],"<byte>":[["B","byte"],1,"memory",["<byte>"]],"<bit>":[["b","bit"],.125,"memory",["<byte>"]],"<dollar>":[["USD","dollar"],1,"currency",["<dollar>"]],"<cents>":[["cents"],.01,"currency",["<dollar>"]],"<candela>":[["cd","candela"],1,"luminosity",["<candela>"]],"<lumen>":[["lm","lumen"],1,"luminous_power",["<candela>",
"<steradian>"]],"<lux>":[["lux"],1,"illuminance",["<candela>","<steradian>"],["<meter>","<meter>"]],"<watt>":[["W","watt","watts"],1,"power",["<kilogram>","<meter>","<meter>"],["<second>","<second>","<second>"]],"<horsepower>":[["hp","horsepower"],745.699872,"power",["<kilogram>","<meter>","<meter>"],["<second>","<second>","<second>"]],"<gray>":[["Gy","gray","grays"],1,"radiation",["<meter>","<meter>"],["<second>","<second>"]],"<roentgen>":[["R","roentgen"],.00933,"radiation",["<meter>","<meter>"],
["<second>","<second>"]],"<sievert>":[["Sv","sievert","sieverts"],1,"radiation",["<meter>","<meter>"],["<second>","<second>"]],"<becquerel>":[["Bq","bequerel","bequerels"],1,"radiation",["<1>"],["<second>"]],"<curie>":[["Ci","curie","curies"],37E9,"radiation",["<1>"],["<second>"]],"<cpm>":[["cpm"],1/60,"rate",["<count>"],["<second>"]],"<dpm>":[["dpm"],1/60,"rate",["<count>"],["<second>"]],"<bpm>":[["bpm"],1/60,"rate",["<count>"],["<second>"]],"<dot>":[["dot","dots"],1,"resolution",["<each>"]],"<pixel>":[["pixel",
"px"],1,"resolution",["<each>"]],"<ppi>":[["ppi"],1,"resolution",["<pixel>"],["<inch>"]],"<dpi>":[["dpi"],1,"typography",["<dot>"],["<inch>"]],"<cell>":[["cells","cell"],1,"counting",["<each>"]],"<each>":[["each"],1,"counting",["<each>"]],"<count>":[["count"],1,"counting",["<each>"]],"<base-pair>":[["bp"],1,"counting",["<each>"]],"<nucleotide>":[["nt"],1,"counting",["<each>"]],"<molecule>":[["molecule","molecules"],1,"counting",["<1>"]],"<dozen>":[["doz","dz","dozen"],12,"prefix_only",["<each>"]],
"<percent>":[["%","percent"],.01,"prefix_only",["<1>"]],"<ppm>":[["ppm"],1E-6,"prefix_only",["<1>"]],"<ppt>":[["ppt"],1E-9,"prefix_only",["<1>"]],"<gross>":[["gr","gross"],144,"prefix_only",["<dozen>","<dozen>"]],"<decibel>":[["dB","decibel","decibels"],1,"logarithmic",["<decibel>"]]},Y="<meter> <kilogram> <second> <mole> <farad> <ampere> <radian> <kelvin> <temp-K> <byte> <dollar> <candela> <each> <steradian> <decibel>".split(" "),l=["<1>"],N=/^([+-]?\d*(?:\.\d+)?(?:[Ee][+-]?\d+)?)\s*([^/]*)(?:\/(.+))?$/,
O=/([^ \*]+?)(?:\^|\*{2})?(-?\d+)/,P=/([^ \*]+?)(?:\^|\*{2})?(\d+)/,C="length time temperature mass current substance luminosity currency memory angle capacitance".split(" "),Z={"-312058":"resistance","-312038":"inductance","-152040":"magnetism","-152038":"magnetism","-152058":"potential","-39":"acceleration","-38":"radiation","-20":"frequency","-19":"speed","-18":"viscosity",0:"unitless",1:"length",2:"area",3:"volume",20:"time",400:"temperature",7942:"power",7959:"pressure",7962:"energy",7979:"viscosity",
7981:"force",7997:"mass_concentration",8E3:"mass",159999:"magnetism",16E4:"current",160020:"charge",312058:"conductance",3199980:"activity",3199997:"molar_concentration",32E5:"substance",63999998:"illuminance",64E6:"luminous_power",128E7:"currency",256E8:"memory",511999999980:"angular_velocity",512E9:"angle",1024E10:"capacitance"},L={};e.parse=function(a){if("string"!==typeof a&&!(a instanceof String))throw"Argument should be a string";try{return new e(a)}catch(b){return null}};e.swiftConverter=function(a,
b){var c=new e(a),d=new e(b);return c.eq(d)?X:c.isTemperature()?function(a){return c.mul(a).to(d).scalar}:function(a){return a*c.baseScalar/d.baseScalar}};var Q=function(){if(this.signature)return this.signature;for(var a=M.call(this),b=0;b<a.length;b++)a[b]*=Math.pow(20,b);return a.reduce(function(a,b){return a+b},0)},M=function(){if(!this.isBase())return M.call(this.toBase());for(var a=Array(C.length),b=0;b<a.length;b++)a[b]=0;for(var c=0;c<this.numerator.length;c++)if(b=v[this.numerator[c]])b=
C.indexOf(b[2]),0<=b&&(a[b]+=1);for(c=0;c<this.denominator.length;c++)if(b=v[this.denominator[c]])b=C.indexOf(b[2]),0<=b&&--a[b];return a};e.prototype={constructor:e,toFloat:function(){if(this.isUnitless())return this.scalar;throw"Can't convert to Float unless unitless. Use Unit#scalar";},isUnitless:function(){return r(this.numerator,l)&&r(this.denominator,l)},isCompatible:function(a){return a&&a.constructor===String?this.isCompatible(new e(a)):a instanceof e?void 0!==a.signature?this.signature===
a.signature:!1:!1},isInverse:function(a){return this.inverse().isCompatible(a)},kind:function(){return Z[this.signature.toString()]},isBase:function(){if(void 0!==this._isBase)return this._isBase;if(this.isDegrees()&&this.numerator[0].match(/<(kelvin|temp-K)>/))return this._isBase=!0;this.numerator.concat(this.denominator).forEach(function(a){"<1>"!==a&&-1===Y.indexOf(a)&&(this._isBase=!1)},this);return!1===this._isBase?this._isBase:this._isBase=!0},toBase:function(){if(this.isBase())return this;
if(this.isTemperature()){var a=this.units();if(a.match(/(deg)[CFRK]/))a=this.baseScalar;else if("tempK"===a)a=this.scalar;else if("tempC"===a)a=this.scalar+273.15;else if("tempF"===a)a=5*(this.scalar+459.67)/9;else if("tempR"===a)a=5*this.scalar/9;else throw"Unknown type for temp conversion from: "+a;return new e({scalar:a,numerator:["<temp-K>"],denominator:l})}a=L[this.units()];a||(a=R(this.numerator,this.denominator),L[this.units()]=a);return a.mul(this.scalar)},units:function(){if(void 0!==this._units)return this._units;
var a=r(this.numerator,l),b=r(this.denominator,l);if(a&&b)return this._units="";var a=F(this.numerator),c=F(this.denominator);return this._units=a+(b?"":"/"+c)},eq:function(a){return 0===this.compareTo(a)},lt:function(a){return-1===this.compareTo(a)},lte:function(a){return this.eq(a)||this.lt(a)},gt:function(a){return 1===this.compareTo(a)},gte:function(a){return this.eq(a)||this.gt(a)},toPrec:function(a){a&&a.constructor===String&&(a=new e(a));"number"===typeof a&&(a=new e(a+" "+this.units()));this.isUnitless()?
a.isUnitless()||p():a=a.to(this.units());if(0===a.scalar)throw"Divide by zero";a=u(Math.round(this.scalar/a.scalar),a.scalar);return new e(a+this.units())},toString:function(a,b){var c;if("number"===typeof a)b=a;else if("string"===typeof a)c=a;else if(a instanceof e)return this.toPrec(a).toString(b);var d;!b&&this.output[c]?d=this.output[c]:c?(d=this.to(c),this.output[c]=d):d=this;return d=((void 0!==b?Math.round(d.scalar*Math.pow(10,b))/Math.pow(10,b):d.scalar)+" "+d.units()).trim()},compareTo:function(a){if(a&&
a.constructor===String)return this.compareTo(new e(a));this.isCompatible(a)||p();if(this.baseScalar<a.baseScalar)return-1;if(this.baseScalar===a.baseScalar)return 0;if(this.baseScalar>a.baseScalar)return 1},same:function(a){return this.scalar===a.scalar&&this.units()===a.units()},inverse:function(){if(this.isTemperature())throw"Cannot divide with temperatures";if(0===this.scalar)throw"Divide by zero";return new e({scalar:1/this.scalar,numerator:this.denominator,denominator:this.numerator})},isDegrees:function(){return(null===
this.signature||400===this.signature)&&1===this.numerator.length&&r(this.denominator,l)&&(this.numerator[0].match(/<temp-[CFRK]>/)||this.numerator[0].match(/<(kelvin|celsius|rankine|fahrenheit)>/))},isTemperature:function(){return this.isDegrees()&&this.numerator[0].match(/<temp-[CFRK]>/)},to:function(a){if(a&&a.constructor!==String)return this.to(a.units());var b=new e(a);if(b.units()===this.units())return this;if(!this.isCompatible(b)){if(this.isInverse(b))return this.inverse().to(a);p()}if(b.isTemperature()){a=
b.units();if("tempK"===a)a=this.baseScalar;else if("tempC"===a)a=this.baseScalar-273.15;else if("tempF"===a)a=9*this.baseScalar/5-459.67;else if("tempR"===a)a=9*this.baseScalar/5;else throw"Unknown type for temp conversion to: "+a;return new e({scalar:a,numerator:b.numerator,denominator:b.denominator})}if(b.isDegrees()){a=this.units();if(a.match(/(deg)[CFRK]/))a=this.baseScalar;else if("tempK"===a)a=this.scalar;else if("tempC"===a)a=this.scalar;else if("tempF"===a)a=5*this.scalar/9;else if("tempR"===
a)a=5*this.scalar/9;else throw"Unknown type for temp conversion from: "+a;a=new e({scalar:a,numerator:["<kelvin>"],denominator:l});var c=b.units();if("degK"===c)a=a.scalar;else if("degC"===c)a=a.scalar;else if("degF"===c)a=9*a.scalar/5;else if("degR"===c)a=9*a.scalar/5;else throw"Unknown type for degree conversion to: "+c;return new e({scalar:a,numerator:b.numerator,denominator:b.denominator})}a=J(this.baseScalar,b.baseScalar);return new e({scalar:a,numerator:b.numerator,denominator:b.denominator})},
add:function(a){a&&a.constructor===String&&(a=new e(a));this.isCompatible(a)||p();if(this.isTemperature()&&a.isTemperature())throw"Cannot add two temperatures";return this.isTemperature()?H(this,a):a.isTemperature()?H(a,this):new e({scalar:this.scalar+a.to(this).scalar,numerator:this.numerator,denominator:this.denominator})},sub:function(a){a&&a.constructor===String&&(a=new e(a));this.isCompatible(a)||p();if(this.isTemperature()&&a.isTemperature()){var b=a;a=this.units();b=b.to(a);a=new e(B(a));return new e({scalar:this.scalar-
b.scalar,numerator:a.numerator,denominator:a.denominator})}if(this.isTemperature())return a=a.to(B(this.units())),new e({scalar:this.scalar-a.scalar,numerator:this.numerator,denominator:this.denominator});if(a.isTemperature())throw"Cannot subtract a temperature from a differential degree unit";return new e({scalar:this.scalar-a.to(this).scalar,numerator:this.numerator,denominator:this.denominator})},mul:function(a){if("number"===typeof a)return new e({scalar:u(this.scalar,a),numerator:this.numerator,
denominator:this.denominator});a&&a.constructor===String&&(a=new e(a));if((this.isTemperature()||a.isTemperature())&&!this.isUnitless()&&!a.isUnitless())throw"Cannot multiply by temperatures";this.isCompatible(a)&&400!==this.signature&&(a=a.to(this));var b=K(this.numerator.concat(a.numerator),this.denominator.concat(a.denominator));return new e({scalar:u(this.scalar,a.scalar),numerator:b[0],denominator:b[1]})},div:function(a){if("number"===typeof a){if(0===a)throw"Divide by zero";return new e({scalar:this.scalar/
a,numerator:this.numerator,denominator:this.denominator})}a&&a.constructor===String&&(a=new e(a));if(0===a.scalar)throw"Divide by zero";if(a.isTemperature())throw"Cannot divide with temperatures";if(this.isTemperature()&&!a.isUnitless())throw"Cannot divide with temperatures";this.isCompatible(a)&&400!==this.signature&&(a=a.to(this));var b=K(this.numerator.concat(a.denominator),this.denominator.concat(a.numerator));return new e({scalar:this.scalar/a.scalar,numerator:b[0],denominator:b[1]})}};var E=
{};A.prototype.get=function(a){1<arguments.length&&(a=Array.apply(null,arguments));return a.reduce(function(b,c,d){if(b)return b=b[c],d===a.length-1?b?b.data:void 0:b},this)};A.prototype.set=function(a,b){2<arguments.length&&(a=Array.prototype.slice.call(arguments,0,-1),b=arguments[arguments.length-1]);return a.reduce(function(c,d,e){var g=c[d];void 0===g&&(g=c[d]={});return e===a.length-1?g.data=b:g},this)};var G=new A,V=/^-?(\d+)(?:\.(\d+))?$/,W=/^-?(\d+)e-?(\d+)$/;e.mul_safe=u;e.div_safe=J;var q=
{},w={},h={},x={},y={},m;for(m in v)if(v.hasOwnProperty(m)){var n=v[m];if("prefix"===n[2]){q[m]=n[1];for(var t=0;t<n[0].length;t++)w[n[0][t]]=m}else for(h[m]={scalar:n[1],numerator:n[3],denominator:n[4]},t=0;t<n[0].length;t++)x[n[0][t]]=m;y[m]=n[0][0]}m=Object.keys(w).sort(function(a,b){return b.length-a.length}).join("|");n=Object.keys(x).sort(function(a,b){return b.length-a.length}).join("|");m="("+m+")*?("+n+")\\b";var S=new RegExp(m,"g"),z=new RegExp("^\\s*("+m+"\\s*\\*?\\s*)+$");return e});var RecipeUnitConversion=RecipeUnitConversion||{};RecipeUnitConversion.getUnitFromAlias=function(a){if(null!==a&&void 0!==a)return a=a.replace(/[\(\).,\s;:=\-+]/gi,""),void 0!==wpurp_unit_conversion.alias_to_unit[a]?wpurp_unit_conversion.alias_to_unit[a]:wpurp_unit_conversion.alias_to_unit[a.toLowerCase()]};RecipeUnitConversion.getUnitType=function(a){return wpurp_unit_conversion.unit_to_type[a]};
RecipeUnitConversion.getUnitSystems=function(a){var c=RecipeUnitConversion.getUnitType(a);if(!c)return[];for(var b=wpurp_unit_conversion.systems,d=[],f=0,e=b.length;f<e;f++)-1!=jQuery.inArray(a,b[f]["units_"+c])&&d.push(f);return d};RecipeUnitConversion.isUniversal=function(a){return-1!=jQuery.inArray(a,wpurp_unit_conversion.universal_units)?!0:!1};RecipeUnitConversion.getAbbreviation=function(a){var c=wpurp_unit_conversion.unit_abbreviations[a];void 0===c&&(c=a);return c};
RecipeUnitConversion.getUserAbbreviation=function(a,c){var b="plural";1==c&&(b="singular");void 0!==wpurp_unit_conversion.user_abbreviations[a]?(b=wpurp_unit_conversion.user_abbreviations[a][b],void 0===b&&(b=a)):b=a;return b};
RecipeUnitConversion.determineIngredientListSystem=function(a){for(var c=[],b=0,d=wpurp_unit_conversion.systems.length;b<d;b++)c[b]=0;a.find(".wpurp-recipe-ingredient").each(function(){for(var a=jQuery(this).find(".wpurp-recipe-ingredient-unit").text(),a=RecipeUnitConversion.getUnitFromAlias(a),a=RecipeUnitConversion.getUnitSystems(a),b=0,d=a.length;b<d;b++)c[a[b]]++});a=c[0];for(var f=0,b=1,d=c.length;b<d;b++)c[b]>a&&(f=b,a=c[b]);return f};
RecipeUnitConversion.convertUnitToSystem=function(a,c,b,d){var f=wpurp_unit_conversion.systems;if("cup"==c){b=parseFloat(f[b].cup_type);var e=(new Qty("1 cup")).to("ml").scalar;.1<Math.abs(b-e)&&(a*=b/e)}b=RecipeUnitConversion.getUnitType(c);var h=new Qty(a+" "+RecipeUnitConversion.getAbbreviation(c)),g=f[d]["units_"+b],k=[];b=0;for(var l=g.length;b<l;b++)try{var m=h.to(RecipeUnitConversion.getAbbreviation(g[b])).scalar;if("cup"==g[b]){var n=parseFloat(f[d].cup_type),e=(new Qty(n+" ml")).to("cup").scalar;
.01<Math.abs(1-e)&&(m*=1/e)}k.push({unit:g[b],amount:m})}catch(p){console.log(p)}if(0===k.length)return{unit:c,amount:a};a=k.sort(RecipeUnitConversion.compareAmounts);c=a[0].amount;d=a[0].unit;b=1;l=a.length;a:for(;b<l;b++)if(999<c||5<c&&("teaspoon"==d||"tablespoon"==d))c=a[b].amount,d=a[b].unit;else break a;return{unit:d,amount:c}};RecipeUnitConversion.compareAmounts=function(a,c){return c.amount-a.amount};
RecipeUnitConversion.formatNumber=function(a,c,b){if(c&&(c=Fraction(a.toString()).snap(),100>c.denominator))return c;if(""==a||0==a)return"";b=void 0==b?parseInt(wpurp_servings.precision):b;for(c=a.toFixed(b);0==parseFloat(c);)if(b++,c=a.toFixed(b),10<b)return"";return 0<b?(a=Array(b+1).join("0"),c.replace(new RegExp("."+a+"$"),"")):c};
RecipeUnitConversion.updateIngredients=function(a,c,b){a.find(".wpurp-recipe-ingredient").each(function(){var a=jQuery(this).find(".wpurp-recipe-ingredient-quantity"),f=jQuery(this).find(".wpurp-recipe-ingredient-unit"),e=a.data("normalized"),h=a.data("fraction"),g=f.data("original"),g=RecipeUnitConversion.getUnitFromAlias(g);if(void 0!==g&&!RecipeUnitConversion.isUniversal(g)&&e){var k=RecipeUnitConversion.getUnitSystems(g),l=RecipeUnitConversion.getUnitSystems("cup");if(-1==jQuery.inArray(b,k)||
"cup"==g&&-1!=jQuery.inArray(c,l))e=RecipeUnitConversion.convertUnitToSystem(e,g,c,b),a.text(RecipeUnitConversion.formatNumber(e.amount,h)),f.text(RecipeUnitConversion.getUserAbbreviation(e.unit,e.amount)),a.data("normalized",e.amount),f.data("original",e.unit),a=jQuery(this).find(".wpurp-recipe-ingredient-name"),RecipeUnitConversion.checkIngredientPlural(a,e.amount)}});a.data("system",b)};
RecipeUnitConversion.recalculate=function(a){var c=jQuery(a).parents(".wpurp-container"),b=c.find(".wpurp-recipe-ingredients"),d=parseInt(b.data("system"));a=parseInt(jQuery(a).val());d!=a&&(RecipeUnitConversion.updateIngredients(b,d,a),RecipePrintButton.update(c))};
RecipeUnitConversion.init=function(){jQuery(".wpurp-recipe-ingredients").each(function(a){a=jQuery(this);var c=RecipeUnitConversion.determineIngredientListSystem(a);a.parents(".wpurp-container").find(".adjust-recipe-unit").val(c);a.parents(".wpurp-container").data("system-original",c);a.data("system",c)})};jQuery(document).ready(function(){void 0!==window.wpurp_unit_conversion&&RecipeUnitConversion.init()});
RecipeUnitConversion.adjustServings=function(a,c,b){a.find(".wpurp-recipe-ingredient").each(function(){var a=jQuery(this).find(".wpurp-recipe-ingredient-quantity"),f=jQuery(this).find(".wpurp-recipe-ingredient-unit"),e=a.data("normalized"),h=a.data("fraction");isFinite(e)?(e=b*e/c,h=RecipeUnitConversion.formatNumber(e,h),a.text(h).data("normalized",e),a=f.data("original"),a=RecipeUnitConversion.getUnitFromAlias(a),f.text(RecipeUnitConversion.getUserAbbreviation(a,e)),f=jQuery(this).find(".wpurp-recipe-ingredient-name"),
RecipeUnitConversion.checkIngredientPlural(f,e)):a.addClass("recipe-ingredient-nan")})};RecipeUnitConversion.checkIngredientPlural=function(a,c){var b=1==c.toFixed(2)?a.data("singular"):a.data("plural");void 0!==b&&(0<a.find("a").length?a.find("a").text(b):a.text(b))};
jQuery(document).on("keyup change",".advanced-adjust-recipe-servings",function(a){a=jQuery(this);var c=a.parents(".wpurp-container").find(".wpurp-recipe-ingredients"),b=parseFloat(a.data("original")),d=a.val();if(isNaN(d)||0>=d)d=1;RecipeUnitConversion.adjustServings(c,b,d);a.parents(".wpurp-container").find(".advanced-adjust-recipe-servings").each(function(){jQuery(this).data("original",d)});RecipePrintButton.update(a.parents(".wpurp-container"))});
jQuery(document).on("blur",".advanced-adjust-recipe-servings",function(a){a=jQuery(this);var c=a.data("original");a.parents(".wpurp-container").find(".advanced-adjust-recipe-servings").each(function(){jQuery(this).val(c)});RecipePrintButton.update(a.parents(".wpurp-container"))});var RecipeUserMenus=RecipeUserMenus||{};RecipeUserMenus.recipes=[];RecipeUserMenus.order=[];RecipeUserMenus.recipeIngredients=[];RecipeUserMenus.nbrRecipes=0;RecipeUserMenus.ajaxGettingIngredients=0;RecipeUserMenus.generalServings=4;RecipeUserMenus.menuId=0;RecipeUserMenus.unitSystem=0;
RecipeUserMenus.init=function(){RecipeUserMenus.initSelect();RecipeUserMenus.unitSystem=parseInt(wpurp_user_menus.default_system);RecipeUserMenus.changeServings(jQuery(".user-menus-servings-general"),!0);"undefined"!==typeof wpurp_user_menu&&(RecipeUserMenus.setSavedValues(wpurp_user_menu),RecipeUserMenus.redrawRecipes(),RecipeUserMenus.updateIngredients());jQuery(".user-menus-group-by").on("click",function(a){a.preventDefault();a=jQuery(this);a.hasClass("user-menus-group-by-selected")||(RecipeUserMenus.groupBy(jQuery(this).data("groupby")),
a.siblings(".user-menus-group-by-selected").removeClass("user-menus-group-by-selected"),a.addClass("user-menus-group-by-selected"))});jQuery(".user-menus-selected-recipes").sortable({opacity:.5,start:function(a,c){jQuery(".user-menus-recipes-delete").slideDown(500)},stop:function(a,c){jQuery(".user-menus-recipes-delete").slideUp(500)},update:function(a,c){RecipeUserMenus.updateRecipeOrder(jQuery(this));RecipeUserMenus.updateCookies()}});jQuery(".user-menus-servings-general").on("keyup change",function(){RecipeUserMenus.changeServings(jQuery(this),
!0)});jQuery(".user-menus-selected-recipes").on("keyup change",".user-menus-servings-recipe",function(){RecipeUserMenus.changeServings(jQuery(this),!1)});jQuery(".user-menus-servings-general").on("blur",function(){var a=jQuery(this),c=a.val();(isNaN(c)||0>=c)&&a.val(1)});jQuery(".user-menus-selected-recipes").on("blur",".user-menus-servings-recipe",function(){var a=jQuery(this),c=a.val();(isNaN(c)||0>=c)&&a.val(1)});jQuery(".wpurp-user-menus").on("click",".delete-recipe-button",function(){jQuery(this).parent(".user-menus-recipe").remove();
RecipeUserMenus.deleteRecipe()});jQuery(".user-menus-ingredients").on("change",".shopping-list-ingredient",function(){var a=jQuery(this);a.is(":checked")?a.closest("tr").addClass("ingredient-checked"):a.closest("tr").removeClass("ingredient-checked")})};RecipeUserMenus.deleteRecipe=function(){--RecipeUserMenus.nbrRecipes;RecipeUserMenus.checkIfEmpty();RecipeUserMenus.updateRecipeOrder(jQuery(".user-menus-selected-recipes"));RecipeUserMenus.updateIngredients();RecipeUserMenus.updateCookies()};
RecipeUserMenus.setSavedValues=function(a){null!==a.recipes&&(RecipeUserMenus.recipes=a.recipes,RecipeUserMenus.order=a.order);""!==a.nbrRecipes&&(RecipeUserMenus.nbrRecipes=parseInt(a.nbrRecipes));""!==a.unitSystem&&(RecipeUserMenus.unitSystem=parseInt(a.unitSystem));""!==a.menuId&&(RecipeUserMenus.menuId=parseInt(a.menuId))};
RecipeUserMenus.deleteMenu=function(){jQuery.post(wpurp_user_menus.ajaxurl,{action:"user_menus_delete",security:wpurp_user_menus.nonce,menuId:RecipeUserMenus.menuId},function(a){window.location.href=a},"html")};
RecipeUserMenus.saveMenu=function(){var a={action:"user_menus_save",security:wpurp_user_menus.nonce,menuId:RecipeUserMenus.menuId,title:jQuery(".user-menus-title").val(),recipes:RecipeUserMenus.recipes,order:RecipeUserMenus.order,nbrRecipes:RecipeUserMenus.nbrRecipes,unitSystem:RecipeUserMenus.unitSystem};jQuery.post(wpurp_user_menus.ajaxurl,a,function(a){0==RecipeUserMenus.menuId&&(window.location.href=a)},"html")};
RecipeUserMenus.printShoppingList=function(){var a=jQuery(".user-menus-title").val();wpurp_user_menus.shoppingListTitle=void 0!=a?'<h2 class="wpurp-shoppinglist-title">'+a+"</h2>":'<h2 class="wpurp-shoppinglist-title">Shopping List</h2>';wpurp_user_menus.recipeList="";wpurp_user_menus.print_recipe_list&&(console.log(wpurp_user_menus.recipes),wpurp_user_menus.recipeList='<table class="wpurp-recipelist">',wpurp_user_menus.recipeList+=wpurp_user_menus.print_recipe_list_header,jQuery(".user-menus-selected-recipes .user-menus-recipe").each(function(){wpurp_user_menus.recipeList+=
"<tr>";wpurp_user_menus.recipeList+="<td>"+jQuery(this).find("a").text()+"</td>";wpurp_user_menus.recipeList+="<td>"+jQuery(this).find("input").val()+"</td>";wpurp_user_menus.recipeList+="</tr>"}),wpurp_user_menus.recipeList+="</table>");wpurp_user_menus.shoppingList='<table class="wpurp-shoppinglist">'+jQuery(".user-menus-ingredients").html()+"</table>";window.open(wpurp_user_menus.addonUrl+"/templates/print-shopping-list.php")};
RecipeUserMenus.printUserMenu=function(){wpurp_user_menus.recipe_ids=[];wpurp_user_menus.recipes=[];wpurp_user_menus.print_servings_original=[];wpurp_user_menus.print_servings_wanted=[];wpurp_user_menus.print_unit_system=RecipeUserMenus.unitSystem;for(var a=0,c=RecipeUserMenus.order.length;a<c;a++){var b=RecipeUserMenus.recipes[RecipeUserMenus.order[a]];wpurp_user_menus.recipe_ids.push(b.id);wpurp_user_menus.print_servings_original.push(b.servings_original);wpurp_user_menus.print_servings_wanted.push(b.servings_wanted)}jQuery.post(wpurp_user_menus.ajaxurl,
{action:"get_recipe_template",security:wpurp_user_menus.nonce,recipe_ids:wpurp_user_menus.recipe_ids},function(a){wpurp_user_menus.recipes=a},"json");a=jQuery(".user-menus-title").val();wpurp_user_menus.shoppingListTitle=void 0!=a?"<h2>"+a+"</h2>":"<h2>Shopping List</h2>";wpurp_user_menus.shoppingList='<table class="wpurp-shoppinglist">'+jQuery(".user-menus-ingredients").html()+"</table>";window.open(wpurp_user_menus.addonUrl+"/templates/print-user-menu.php")};
RecipeUserMenus.updateRecipeOrder=function(a){RecipeUserMenus.order=a.sortable("toArray",{attribute:"data-index"})};RecipeUserMenus.changeServings=function(a,c){var b=a.val();if(isNaN(b)||0>=b)b=1;if(c)RecipeUserMenus.generalServings=b;else{var f=a.parent(".user-menus-recipe").data("index");RecipeUserMenus.recipes[f].servings_wanted=b;RecipeUserMenus.updateIngredientsTable();RecipeUserMenus.updateCookies()}};
RecipeUserMenus.initSelect=function(){jQuery(".user-menus-select").select2({width:"off"}).on("change",function(){RecipeUserMenus.addRecipe(jQuery(this).select2("data"));jQuery(this).select2("val","")})};
RecipeUserMenus.addRecipe=function(a){""!==a.id&&(RecipeUserMenus.recipes.push({id:a.id,name:a.text,link:a.element[0].dataset.link,servings_original:a.element[0].dataset.servings,servings_wanted:RecipeUserMenus.generalServings}),RecipeUserMenus.order.push((RecipeUserMenus.recipes.length-1).toString()),RecipeUserMenus.redrawRecipes(),RecipeUserMenus.updateCookies(),RecipeUserMenus.updateIngredients())};
RecipeUserMenus.redrawRecipes=function(){var a=jQuery(".user-menus-selected-recipes");a.empty();for(var c=RecipeUserMenus.recipes,b=RecipeUserMenus.order,f=RecipeUserMenus.nbrRecipes=0,h=b.length;f<h;f++){var n=c[b[f]];a.append('<div class="user-menus-recipe" data-recipe="'+n.id+'" data-index="'+b[f]+'"><i class="fa fa-trash delete-recipe-button"></i> <a href="'+n.link+'" target="_blank">'+n.name+'</a><input type="number" class="user-menus-servings-recipe" value="'+n.servings_wanted+'"></div>');RecipeUserMenus.nbrRecipes+=
1}RecipeUserMenus.checkIfEmpty()};RecipeUserMenus.updateCookies=function(){0==RecipeUserMenus.menuId&&jQuery.post(wpurp_user_menus.ajaxurl,{action:"update_shopping_list",security:wpurp_user_menus.nonce,recipes:RecipeUserMenus.recipes,order:RecipeUserMenus.order})};RecipeUserMenus.checkIfEmpty=function(){0===RecipeUserMenus.nbrRecipes?jQuery(".user-menus-no-recipes").show():jQuery(".user-menus-no-recipes").hide()};
RecipeUserMenus.groupBy=function(a){jQuery.post(wpurp_user_menus.ajaxurl,{action:"user_menus_groupby",security:wpurp_user_menus.nonce,groupby:a,grid:wpurp_user_menu_grid.slug},function(a){jQuery(".user-menus-select").select2("destroy").off().html(a);RecipeUserMenus.initSelect()})};
RecipeUserMenus.updateIngredients=function(){for(var a=RecipeUserMenus.order,c=RecipeUserMenus.recipes,b=0,f=0,h=a.length;f<h;f++){var n=c[a[f]].id;void 0===RecipeUserMenus.recipeIngredients[n]&&(b++,RecipeUserMenus.recipeIngredients[n]=[],RecipeUserMenus.getIngredients(n))}0===b&&RecipeUserMenus.updateIngredientsTable()};
RecipeUserMenus.getIngredients=function(a){var c={action:"user_menus_get_ingredients",security:wpurp_user_menus.nonce,recipe_id:a};RecipeUserMenus.ajaxGettingIngredients++;jQuery.post(wpurp_user_menus.ajaxurl,c,function(b){RecipeUserMenus.ajaxGettingIngredients--;RecipeUserMenus.recipeIngredients[a]=b;0===RecipeUserMenus.ajaxGettingIngredients&&RecipeUserMenus.updateIngredientsTable()},"json")};
RecipeUserMenus.updateIngredientsTable=function(){var a=jQuery("table.user-menus-ingredients");a.find("tbody").empty();for(var c=RecipeUserMenus.recipeIngredients,b=RecipeUserMenus.order,f=RecipeUserMenus.recipes,h=[],n=[],r=236.6,m=0,w=wpurp_unit_conversion.systems.length;m<w;m++){var k=wpurp_unit_conversion.systems[m];-1!=jQuery.inArray("cup",k.units_volume)&&(r=parseFloat(k.cup_type))}m=0;for(w=b.length;m<w;m++)for(var t=f[b[m]].id,x=f[b[m]].servings_wanted/parseFloat(f[b[m]].servings_original),
p=0,y=c[t].length;p<y;p++){var e=c[t][p],l=wpurp_user_menus.ingredient_notes&&e.notes?e.ingredient+" ("+e.notes+")":e.ingredient,k=e.group,u=e.plural||l;void 0===n[l]&&(n[l]=u);void 0===h[k]&&(h[k]=[]);void 0===h[k][l]&&(h[k][l]=[]);var d=e.amount_normalized*x,g=e.unit,e=RecipeUnitConversion.getUnitFromAlias(g);if(void 0!==e&&"1"==wpurp_user_menus.consolidate_ingredients){g=RecipeUnitConversion.getAbbreviation(e);"cup"==g&&(e=(new Qty("1 cup")).to("ml").scalar,.1<Math.abs(r-e)&&(d*=r/e));var q=new Qty(""+
d+" "+g),d=q.toBase();"m3"==d.units()&&(d=d.to("l"));g=d.units();d=d.scalar}""==g&&(g="wpurp_nounit");void 0===h[k][l][g]&&(h[k][l][g]=0);h[k][l][g]+=parseFloat(d)}c=Object.keys(h);c.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())});m=0;for(w=c.length;m<w;m++)for(p=c[m],k=h[p],p=jQuery('<tr><td colspan="2"><strong>'+p+"</strong></td></tr>"),a.append(p),b=Object.keys(k),b.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())}),p=0,y=b.length;p<y;p++)for(g in e=
b[p],f=k[e],f)if(d=f[g],isFinite(d)){r=jQuery("<tr></tr>");t=RecipeUnitConversion.getUnitFromAlias(g);x="1"==wpurp_user_menus.adjustable_system?[RecipeUserMenus.unitSystem]:wpurp_user_menus.static_systems;u=!1;for(l=0;l<x.length;l++){var v=d,q=g;"wpurp_nounit"==g?q="":void 0===t||"1"!=wpurp_user_menus.consolidate_ingredients&&(RecipeUnitConversion.isUniversal(t)||-1!=jQuery.inArray(x[l],RecipeUnitConversion.getUnitSystems(t)))||(q=RecipeUnitConversion.convertUnitToSystem(d,t,0,x[l]),v=q.amount,q=
RecipeUnitConversion.getUserAbbreviation(q.unit,v));v=RecipeUnitConversion.formatNumber(v,wpurp_user_menus.fractions);"1"!==v&&(u=!0);r.append("<td>"+v+" "+q+"</td>")}d=u?n[e]:e;d=d.charAt(0).toUpperCase()+d.slice(1);u="";"1"==wpurp_user_menus.checkboxes&&(u='<input type="checkbox" class="shopping-list-ingredient"> ');r.prepend("<td>"+u+d+"</td>");a.append(r)}};RecipeUserMenus.changeUnits=function(a){RecipeUserMenus.unitSystem=parseInt(jQuery(a).val());RecipeUserMenus.updateIngredientsTable()};
jQuery(document).ready(function(){0<jQuery(".wpurp-user-menus").length&&RecipeUserMenus.init()});jQuery(document).ready(function(){jQuery(document).on("click",".wpurp-recipe-add-to-shopping-list",function(a){a.preventDefault();a.stopPropagation();var b=jQuery(this);if(!b.hasClass("in-shopping-list")){a=b.data("recipe-id");var d=b.parents(".wpurp-container"),e=0,c=d.find("input.adjust-recipe-servings");0==c.length&&(c=d.find("input.advanced-adjust-recipe-servings"));0!=c.length&&(e=parseInt(c.val()));jQuery.post(wpurp_add_to_shopping_list.ajaxurl,{action:"add_to_shopping_list",security:wpurp_add_to_shopping_list.nonce,
recipe_id:a,servings_wanted:e},function(a){b.addClass("in-shopping-list");if(b.next().hasClass("recipe-tooltip-content")){a=b.next().find(".tooltip-shown").first();var c=b.next().find(".tooltip-alt").first(),d=a.html(),e=c.html();a.html(e);c.html(d)}})}})});jQuery(document).ready(function(){jQuery(".recipe-tooltip.vote-attention").length&&(jQuery(".recipe-tooltip.vote-attention").mouseenter(),jQuery(".vote-attention-message").show(),jQuery(".user-rating-stats").hide(),setTimeout(function(){jQuery(".recipe-tooltip.vote-attention").mouseleave();setTimeout(function(){jQuery(".vote-attention-message").hide();jQuery(".user-rating-stats").show()},500)},5E3));jQuery(".wpurp-container .user-star-rating.user-can-vote i").hover(function(){var a=jQuery(this).parents(".user-star-rating"),
b=a.data("icon-full"),c=a.data("icon-half"),a=a.data("icon-empty");jQuery(this).prevAll().andSelf().removeClass(c).removeClass(a).addClass(b);jQuery(this).nextAll().removeClass(b).removeClass(c).addClass(a)},function(){var a=jQuery(this).parents(".user-star-rating"),b=a.data("icon-full"),c=a.data("icon-half"),a=a.data("icon-empty");jQuery(this).siblings().andSelf().removeClass(b).removeClass(c).removeClass(a).each(function(){jQuery(this).addClass(jQuery(this).data("original-icon"))})});jQuery(".wpurp-container .user-star-rating.user-can-vote i").click(function(){var a=
jQuery(this).data("star-value"),b=jQuery(this).parents(".user-star-rating"),c=b.data("recipe-id");jQuery.post(wpurp_user_ratings.ajax_url,{action:"rate_recipe",security:wpurp_user_ratings.nonce,stars:a,recipe:c},function(c){var e=b.nextAll(".recipe-tooltip-content:first"),f=b.data("icon-full"),g=b.data("icon-half"),h=b.data("icon-empty");e.find(".user-rating-votes").text(c.votes);e.find(".user-rating-rating").text(c.rating);e.find(".user-rating-current-rating").text(a);b.find("i").each(function(a,
b){var d=jQuery(b);d.removeClass(f).removeClass(g).removeClass(h);a<c.stars?d.addClass(f).data("original-icon",f):a==c.stars&&1==c.half_star?d.addClass(g).data("original-icon",g):d.addClass(h).data("original-icon",h)})},"json")})});jQuery(document).ready(function(){function q(a){if(!tinyMCE.activeEditor||tinyMCE.activeEditor.isHidden()){var b=k.val();k.val(b+a)}else tinyMCE.execCommand("mceInsertContent",!1,a)}function f(){1==jQuery(".ingredient-group").length?(jQuery("#recipe-ingredients .ingredient .ingredients_group").val(""),jQuery(".ingredient-groups-disabled").show(),jQuery(".ingredient-groups-enabled").hide()):(jQuery("#recipe-ingredients tr.ingredient").each(function(a,b){var c=jQuery(b).prevAll(".ingredient-group:first").find(".ingredient-group-label").val();
void 0===c&&(c=jQuery(".ingredient-group-first").find(".ingredient-group-label").val());jQuery(b).find(".ingredients_group").val(c)}),jQuery(".ingredient-groups-disabled").hide(),jQuery(".ingredient-groups-enabled").show())}function g(){1==jQuery(".instruction-group").length?(jQuery("#recipe-instructions .instruction .instructions_group").val(""),jQuery(".instruction-groups-disabled").show(),jQuery(".instruction-groups-enabled").hide()):(jQuery("#recipe-instructions tr.instruction").each(function(a,
b){var c=jQuery(b).prevAll(".instruction-group:first").find(".instruction-group-label").val();void 0===c&&(c=jQuery(".instruction-group-first").find(".instruction-group-label").val());jQuery(b).find(".instructions_group").val(c)}),jQuery(".instruction-groups-disabled").hide(),jQuery(".instruction-groups-enabled").show())}function r(){var a=jQuery("#recipe-ingredients tr.ingredient").length,b=jQuery("#recipe-ingredients tr:last"),c=jQuery("#recipe-ingredients tr.ingredient:last"),t=c.clone(!0);t.insertAfter(b).find("input, select").val("").attr("name",
function(c,b){return b.replace(/(\d+)/,a)}).attr("id",function(c,b){return b.replace(/(\d+)/,a)}).parent().find("input.ingredients_name").attr("onfocus",function(c,b){return b.replace(/(\d+)/,a)});c.find("input").attr("placeholder","");t.find("span.ingredients-delete").show();m();jQuery("#recipe-ingredients tr:last .ingredients_amount").focus();f()}function m(){jQuery("#recipe-ingredients .ingredients_notes").unbind("keydown").last().bind("keydown",function(a){9==(a.keyCode||a.which)&&(a.preventDefault(),
r())})}function u(){jQuery("#recipe-ingredients tr.ingredient").each(function(a){jQuery(this).find("input").attr("name",function(b,c){return c.replace(/(\d+)/,a)}).attr("id",function(b,c){return c.replace(/(\d+)/,a)}).parent().find("input.ingredients_name").attr("onfocus",function(b,c){return c.replace(/(\d+)/,a)})})}function v(){var a=jQuery("#recipe-instructions tr.instruction").length,b=jQuery("#recipe-instructions tr.instruction:last").clone(!0);b.insertAfter("#recipe-instructions tr:last").find("textarea").val("").attr("name",
function(c,b){return b.replace(/(\d+)/,a)}).attr("id",function(c,b){return b.replace(/(\d+)/,a)});b.find(".recipe_instructions_remove_image").addClass("wpurp-hide");b.find(".recipe_instructions_add_image").removeClass("wpurp-hide");b.find(".recipe_instructions_image").val("");b.find(".recipe_instructions_thumbnail").attr("src",wpurp_recipe_form.coreUrl+"/img/image_placeholder.png");b.find(".recipe_instructions_image").attr("name",function(c,b){return b.replace(/(\d+)/,a)});b.find(".instructions_group").attr("name",
function(c,b){return b.replace(/(\d+)/,a)}).attr("id",function(c,b){return b.replace(/(\d+)/,a)});b.find("span.instructions-delete").show();n();jQuery("#recipe-instructions tr:last textarea").focus();g()}function n(){jQuery("#recipe-instructions textarea").unbind("keydown").last().bind("keydown",function(a){9==(a.keyCode||a.which)&&0==a.shiftKey&&1==jQuery("#recipe-instructions tr:last").find("textarea").is(":focus")&&(a.preventDefault(),v())})}function w(){jQuery("#recipe-instructions tr.instruction").each(function(a){jQuery(this).find("textarea").attr("name",
function(b,c){return c.replace(/(\d+)/,a)}).attr("id",function(b,c){return c.replace(/(\d+)/,a)});jQuery(this).find(".recipe_instructions_image").attr("name",function(b,c){return c.replace(/(\d+)/,a)});jQuery(this).find(".instructions_group").attr("name",function(b,c){return c.replace(/(\d+)/,a)}).attr("id",function(b,c){return c.replace(/(\d+)/,a)})})}jQuery("#insert-recipe-shortcode").on("click",function(){q("[recipe]")});jQuery("#insert-nutrition-shortcode").on("click",function(){q("[nutrition-label]")});
var k=jQuery("textarea#content");if(0<k.length){var e=k.val(),e=e.replace(/<div class="wpurp-searchable-recipe"[^<]*<\/div>/g,function(a){return""}),e=e.replace(/\[wpurp-searchable-recipe\][^\[]*\[\/wpurp-searchable-recipe\]/g,function(a){return""});k.val(e)}jQuery("#recipe-ingredients tr.ingredient:first").find("span.ingredients-delete").hide();jQuery("#recipe-instructions tr.instruction:first").find("span.instructions-delete").hide();var h=jQuery("select#recipe_rating");if(1==h.length){for(var e=
h.find("option:selected").val(),x='<img src="'+wpurp_recipe_form.coreUrl+'/img/star.png" width="15" height="14" />',p='<img src="'+wpurp_recipe_form.coreUrl+'/img/star_grey.png" width="15" height="14" />',d='<div id="recipe_rating_star_selection">',l=1;5>=l;l++)d+='<span class="star" id="recipe-star-'+l+'" data-star="'+l+'">',d=e>=l?d+x:d+p,d+="</span>";d+="</div>";h.hide().after(d);jQuery(document).on("click","#recipe_rating_star_selection .star",function(){var a=jQuery(this);h.val()==a.data("star")?
(a.siblings().andSelf().html(p),h.val(0)):(a.prevAll().andSelf().html(x),a.nextAll().html(p),h.val(a.data("star")))})}f();jQuery("#ingredients-add-group").on("click",function(a){a.preventDefault();a=jQuery("#recipe-ingredients tr.ingredient-group-stub");var b=jQuery("#recipe-ingredients tr:last");a.clone(!0).insertAfter(b).removeClass("ingredient-group-stub").addClass("ingredient-group");jQuery(".ingredient-groups-disabled").hide();jQuery(".ingredient-groups-enabled").show();f()});var y;jQuery(".ingredient-group-label").on("input",
function(){window.clearTimeout(y);y=window.setTimeout(function(){f()},500)});jQuery(".ingredient-group-delete").on("click",function(){jQuery(this).parents("tr").remove();f()});g();jQuery("#instructions-add-group").on("click",function(a){a.preventDefault();a=jQuery("#recipe-instructions tr.instruction-group-stub");var b=jQuery("#recipe-instructions tr:last");a.clone(!0).insertAfter(b).removeClass("instruction-group-stub").addClass("instruction-group");jQuery(".instruction-groups-disabled").hide();
jQuery(".instruction-groups-enabled").show();g()});var z;jQuery(".instruction-group-label").on("input",function(){window.clearTimeout(z);z=window.setTimeout(function(){g()},500)});jQuery(".instruction-group-delete").on("click",function(){jQuery(this).parents("tr").remove();g()});jQuery("#recipe-ingredients tbody").sortable({opacity:.6,revert:!0,cursor:"move",handle:".sort-handle",update:function(){m();f();u()}});jQuery("#recipe-ingredients").on("keydown",function(a){9==(a.keyCode||a.which)&&jQuery("ul.ac_results").hide()});
jQuery("#recipe-ingredients").on("click",function(){jQuery("ul.ac_results").hide()});jQuery(".ingredients-delete").on("click",function(){jQuery(this).parents("tr").remove();m();u()});jQuery("#ingredients-add").on("click",function(a){a.preventDefault();r()});m();jQuery("#recipe-instructions tbody").sortable({opacity:.6,revert:!0,cursor:"move",handle:".sort-handle",update:function(){n();g();w()}});jQuery(".instructions-delete").on("click",function(){jQuery(this).parents("tr").remove();n();w()});jQuery("#instructions-add").on("click",
function(a){a.preventDefault();v()});n();jQuery(".recipe_thumbnail_add_image").on("click",function(a){a.preventDefault();a=jQuery(this);image=a.siblings(".recipe_thumbnail_image");preview=a.siblings(".recipe_thumbnail");if("function"==typeof wp.media)var b=wp.media({title:"Insert Media",button:{text:"Add featured image"},multiple:!1}).on("select",function(){var a=b.state().get("selection").first().toJSON();jQuery(preview).attr("src",a.url);jQuery(image).val(a.id).trigger("change")}).open();else post_id=
a.attr("rel"),tb_show(a.attr("value"),"wp-admin/media-upload.php?post_id="+post_id+"&type=image&TB_iframe=1"),window.send_to_editor=function(a){img=jQuery("img",a);imgurl=img.attr("src");classes=img.attr("class");id=classes.replace(/(.*?)wp-image-/,"");image.val(id).trigger("change");preview.attr("src",imgurl);tb_remove()}});jQuery(".recipe_thumbnail_remove_image").on("click",function(a){a.preventDefault();a=jQuery(this);a.siblings(".recipe_thumbnail_image").val("").trigger("change");a.siblings(".recipe_thumbnail").attr("src",
wpurp_recipe_form.coreUrl+"/img/image_placeholder.png")});jQuery(".recipe_thumbnail_image").on("change",function(){var a=jQuery(this);""==a.val()?(a.siblings(".recipe_thumbnail_add_image").removeClass("wpurp-hide"),a.siblings(".recipe_thumbnail_remove_image").addClass("wpurp-hide")):(a.siblings(".recipe_thumbnail_remove_image").removeClass("wpurp-hide"),a.siblings(".recipe_thumbnail_add_image").addClass("wpurp-hide"))});jQuery(".recipe_alternate_image_add").on("click",function(a){a.preventDefault();
a=jQuery(this);image=a.siblings("#recipe_alternate_image");preview=a.siblings(".recipe_alternate_image");if("function"==typeof wp.media)var b=wp.media({title:"Insert Media",button:{text:"Add alternate image"},multiple:!1}).on("select",function(){var a=b.state().get("selection").first().toJSON();jQuery(preview).attr("src",a.url);jQuery(image).val(a.id).trigger("change")}).open();else post_id=a.attr("rel"),tb_show(a.attr("value"),"wp-admin/media-upload.php?post_id="+post_id+"&type=image&TB_iframe=1"),
window.send_to_editor=function(a){img=jQuery("img",a);imgurl=img.attr("src");classes=img.attr("class");id=classes.replace(/(.*?)wp-image-/,"");image.val(id).trigger("change");preview.attr("src",imgurl);tb_remove()}});jQuery(".recipe_alternate_image_remove").on("click",function(a){a.preventDefault();a=jQuery(this);a.siblings("#recipe_alternate_image").val("").trigger("change");a.siblings(".recipe_alternate_image").attr("src",wpurp_recipe_form.coreUrl+"/img/image_placeholder.png")});jQuery("#recipe_alternate_image").on("change",
function(){var a=jQuery(this);""==a.val()?(a.siblings(".recipe_alternate_image_add").removeClass("wpurp-hide"),a.siblings(".recipe_alternate_image_remove").addClass("wpurp-hide")):(a.siblings(".recipe_alternate_image_remove").removeClass("wpurp-hide"),a.siblings(".recipe_alternate_image_add").addClass("wpurp-hide"))});jQuery(".recipe_instructions_add_image").on("click",function(a){a.preventDefault();a=jQuery(this);image=a.siblings(".recipe_instructions_image");preview=a.siblings(".recipe_instructions_thumbnail");
if("function"==typeof wp.media)var b=wp.media({title:"Insert Media",button:{text:"Add instruction image"},multiple:!1}).on("select",function(){var a=b.state().get("selection").first().toJSON();jQuery(preview).attr("src",a.url);jQuery(image).val(a.id).trigger("change")}).open();else post_id=a.attr("rel"),tb_show(a.attr("value"),"wp-admin/media-upload.php?post_id="+post_id+"&type=image&TB_iframe=1"),window.send_to_editor=function(a){img=jQuery("img",a);imgurl=img.attr("src");classes=img.attr("class");
id=classes.replace(/(.*?)wp-image-/,"");image.val(id).trigger("change");preview.attr("src",imgurl);tb_remove()}});jQuery(".recipe_instructions_remove_image").on("click",function(a){a.preventDefault();a=jQuery(this);a.siblings(".recipe_instructions_image").val("").trigger("change");a.siblings(".recipe_instructions_thumbnail").attr("src",wpurp_recipe_form.coreUrl+"/img/image_placeholder.png")});jQuery(".recipe_instructions_image").on("change",function(){var a=jQuery(this);""==a.val()?(a.siblings(".recipe_instructions_add_image").removeClass("wpurp-hide"),
a.siblings(".recipe_instructions_remove_image").addClass("wpurp-hide")):(a.siblings(".recipe_instructions_remove_image").removeClass("wpurp-hide"),a.siblings(".recipe_instructions_add_image").addClass("wpurp-hide"))});jQuery("#wpurp-insert-recipe").on("click",function(){var a;a="[ultimate-recipe id="+jQuery("#wpurp-recipe").find("option:selected").val();tinyMCE.activeEditor.execCommand("mceInsertContent",0,a+"]");tinyMCE.activeEditor.windowManager.close()});jQuery(".wpurp-preview-select").on("change",
function(){var a=jQuery(this).siblings(".wpurp-preview-img").children("img").attr("alt");1<a.split("-").length&&(a=a.split("-")[0]+"-");var b=jQuery(this).siblings(".wpurp-preview-img").children("img").attr("src"),a=a+jQuery(this).val()+".jpg",c=b.split("/"),c=c[c.length-1],a=b.replace(c,a);jQuery(this).siblings(".wpurp-preview-img").children("img").attr("src",a)});jQuery(".wpurp-file-upload").on("click",function(a){a.preventDefault();a=jQuery(this);preview=a.siblings("img");fieldname=preview.attr("class");
image=a.siblings("."+fieldname+"_image");if("function"==typeof wp.media)var b=wp.media({title:"Insert Media",button:{text:"Add image"},multiple:!1}).on("select",function(){var a=b.state().get("selection").first().toJSON();jQuery(preview).attr("src",a.url);jQuery(image).val(a.id)}).open();else post_id=a.attr("rel"),tb_show(a.attr("value"),"wp-admin/media-upload.php?post_id="+post_id+"&type=image&TB_iframe=1"),window.send_to_editor=function(a){img=jQuery("img",a);imgurl=img.attr("src");classes=img.attr("class");
id=classes.replace(/(.*?)wp-image-/,"");image.val(id).trigger("change");preview.attr("src",imgurl);tb_remove()};a.addClass("wpurp-hide");a.siblings(".wpurp-file-remove").removeClass("wpurp-hide")});jQuery(".wpurp-file-remove").on("click",function(a){a.preventDefault();a=jQuery(this);preview=a.siblings("img");fieldname=preview.attr("class");a.siblings("."+fieldname+"_image").val("");a.siblings("."+fieldname).attr("src","");a.siblings(".wpurp-file-upload").removeClass("wpurp-hide");a.addClass("wpurp-hide")})});jQuery(document).ready(function(){jQuery("#wpurp_user_submission_form select[multiple]").select2({allowClear:!0,width:"off",dropdownAutoWidth:!1});jQuery(".user-submissions-delete-recipe").on("click",function(){var a=jQuery(this);confirm(wpurp_user_submissions.confirm_message+" "+a.data("title"))&&(a.parent("li").remove(),a={action:"user_submissions_delete_recipe",security:wpurp_user_submissions.nonce,recipe:a.data("id")},jQuery.post(wpurp_user_submissions.ajaxurl,a))})});var RecipeMealPlanner=RecipeMealPlanner||{};RecipeMealPlanner.loader='<div class="wpurp-loader"><div></div><div></div><div></div></div>';RecipeMealPlanner.templates=[];RecipeMealPlanner.ajaxUpdateTimer=null;
RecipeMealPlanner.init=function(){RecipeMealPlanner.initSelect();var e=jQuery(".wpurp-meal-plan"),g=jQuery(".wpurp-meal-plan-calendar-container"),f=jQuery(".wpurp-meal-plan-shopping-list-container"),e=e.hasClass("wpurp-meal-plan-mobile");jQuery(".wpurp-meal-plan-group-by").on("click",function(a){a.preventDefault();a=jQuery(this);a.hasClass("wpurp-meal-plan-group-by-selected")||(RecipeMealPlanner.groupBy(jQuery(this).data("groupby")),a.siblings(".wpurp-meal-plan-group-by-selected").removeClass("wpurp-meal-plan-group-by-selected"),
a.addClass("wpurp-meal-plan-group-by-selected"))});g.on("click",".wpurp-meal-plan-date-change:not(.wpurp-disabled)",function(){var a=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),b=jQuery(RecipeMealPlanner.loader),d=a.find(".wpurp-meal-plan-calendar").data("admin"),h=a.find(".wpurp-meal-plan-calendar").data("meal-plan-id"),c=a.find(".wpurp-meal-plan-calendar").data("start-date"),e=a.find(".wpurp-meal-plan-calendar").data("end-date"),f=a.find(".wpurp-meal-plan-calendar").data("nbr-days");
a.find(".wpurp-meal-plan-date").replaceWith(b);a.find(".wpurp-meal-plan-date-readable").html(" ");b={action:"meal_planner_change_date",security:wpurp_meal_planner.nonce,admin:d,id:h,start_date:c,end_date:e,nbr_days:f,going_back:jQuery(this).hasClass("wpurp-meal-plan-date-prev")};jQuery.post(wpurp_meal_planner.ajaxurl,b,function(b){a.html(b);RecipeMealPlanner.initSortable(a)})});jQuery(".wpurp-meal-plan-recipe-container").sortable({connectWith:".wpurp-meal-plan-recipe-list",placeholder:"wpurp-meal-plan-recipe-placeholder",
stop:function(a,b){jQuery(b.item).parent().hasClass("wpurp-meal-plan-recipe-container")||(jQuery(".wpurp-meal-plan-recipe-container").slideUp(200),RecipeMealPlanner.saveMenu(g))}});RecipeMealPlanner.initSortable(g);if(!e)g.on("hover",".wpurp-meal-plan-course .wpurp-meal-plan-header",function(a){"mouseenter"==a.type?jQuery(this).find(".wpurp-meal-plan-actions").show():jQuery(this).find(".wpurp-meal-plan-actions").hide()});g.on("click",".wpurp-course-move:not(.wpurp-disabled)",function(){var a=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),
b=jQuery(this),d=b.closest(".wpurp-meal-plan-course");b.hasClass("wpurp-course-up")?d.insertBefore(d.prev()):d.insertAfter(d.next());RecipeMealPlanner.checkCourseActions();RecipeMealPlanner.saveMenu(a)});g.on("click",".wpurp-course-edit:not(.wpurp-disabled)",function(){var a=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),b=jQuery(this);b.addClass("wpurp-disabled");var d=b.parents(".wpurp-meal-plan-header").find(".wpurp-meal-plan-course-name");RecipeMealPlanner.getInput(d,d.text(),function(h){b.removeClass("wpurp-disabled");
h&&(d.text(h),RecipeMealPlanner.saveMenu(a))})});g.on("click",".wpurp-course-delete:not(.wpurp-disabled)",function(){var a=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),b=jQuery(this);b.addClass("wpurp-disabled");var d=b.parents(".wpurp-meal-plan-header").find(".wpurp-meal-plan-course-name");RecipeMealPlanner.getConfirm(d,wpurp_meal_planner.textDeleteCourse,function(d){b.removeClass("wpurp-disabled");d&&(b.closest(".wpurp-meal-plan-course").remove(),RecipeMealPlanner.saveMenu(a))})});
g.on("click",".wpurp-meal-plan-add-course",function(a){a.preventDefault();var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container");RecipeMealPlanner.getInput(jQuery(this),"",function(a){if(a){var h=b.find(".wpurp-meal-plan-course-placeholder"),c=h.clone();c.insertBefore(h).addClass("wpurp-meal-plan-course").removeClass("wpurp-meal-plan-course-placeholder").data("course",a).find(".wpurp-meal-plan-course-name").text(a);c.find(".wpurp-meal-plan-recipe-list").sortable({connectWith:".wpurp-meal-plan-recipe-list",
placeholder:"wpurp-meal-plan-recipe-placeholder",stop:function(){RecipeMealPlanner.saveMenu(b)}});RecipeMealPlanner.checkCourseActions();RecipeMealPlanner.saveMenu(b)}})});g.on("click",".wpurp-meal-plan-add-meal-planner",function(a){a.preventDefault();a=jQuery(this).parents(".wpurp-meal-plan-calendar-container");var b=jQuery(this),d=a.find(".wpurp-meal-plan-calendar").data("meal-plan-id");a=new Date;a=("0"+(a.getMonth()+1)).slice(-2)+"/"+("0"+a.getDate()).slice(-2)+"/"+a.getFullYear();RecipeMealPlanner.getDate(b,
a,function(a){if(a){a={action:"meal_planner_add_from_meal_plan",security:wpurp_meal_planner.nonce,id:d,date:a};var c=jQuery(RecipeMealPlanner.loader);b.replaceWith(c);jQuery.post(wpurp_meal_planner.ajaxurl,a,function(a){a=jQuery('<span class="wpurp-meal-plan-text"></span>');a.html(wpurp_meal_planner.textAddToMealPlan);c.replaceWith(a)})}})});g.on("click",".wpurp-meal-plan-recipe",function(){var a=jQuery(this),b=jQuery(this).parents(".wpurp-meal-plan-calendar-container");if(a.hasClass("wpurp-recipe-selected"))b.find(".wpurp-recipe-close").click();
else{RecipeMealPlanner.editingRecipe&&RecipeMealPlanner.editingRecipe.removeClass("wpurp-recipe-selected");RecipeMealPlanner.editingRecipe=a;a.addClass("wpurp-recipe-selected");var d=a.data("recipe"),e=a.data("servings"),a=a.find(".wpurp-meal-plan-recipe-title").text(),c=b.find(".wpurp-meal-plan-selected-recipe-details"),f=b.find(".wpurp-meal-plan-selected-recipe-details-container");b.find(".recipe-selected").hide().find(".recipe-title").text(a);b.find(".recipe-not-selected").hide();b.find(".recipe-details-loader").show();
f.slideUp(200,function(){jQuery(".wpurp-recipe-close:visible").click();c.hide();RecipeMealPlanner.getRecipeTemplate(d,function(a){b.find(".recipe-selected").show();b.find(".recipe-details-loader").hide();f.html(a);f.find(".adjust-recipe-servings, .advanced-adjust-recipe-servings").val(e).trigger("change");c.show();f.slideDown(200)})})}});g.on("click",".wpurp-recipe-close",function(){var a=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),b=a.find(".wpurp-meal-plan-selected-recipe-details"),
d=a.find(".wpurp-meal-plan-selected-recipe-details-container");a.find(".recipe-selected").hide();a.find(".recipe-not-selected").show();a.find(".recipe-details-loader").hide();RecipeMealPlanner.editingRecipe.removeClass("wpurp-recipe-selected");d.slideUp(200,function(){b.hide()})});g.on("click",".wpurp-recipe-delete",function(){var a=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),b=jQuery(this),d=b.parents(".wpurp-meal-plan-header").find(".recipe-selected");RecipeMealPlanner.getConfirm(d,
wpurp_meal_planner.textDeleteRecipe,function(d){d&&(RecipeMealPlanner.editingRecipe.remove(),b.siblings(".wpurp-recipe-close").click(),RecipeMealPlanner.saveMenu(a))})});g.on("keyup change",".wpurp-meal-plan-selected-recipe-details .adjust-recipe-servings, .wpurp-meal-plan-selected-recipe-details .advanced-adjust-recipe-servings",function(a){a=jQuery(this).parents(".wpurp-meal-plan-calendar-container");var b=jQuery(this).val();if(isNaN(b)||0>=b)b=1;RecipeMealPlanner.editingRecipe.data("servings",
b);RecipeMealPlanner.editingRecipe.find(".wpurp-meal-plan-recipe-servings").text("("+b+")");RecipeMealPlanner.saveMenu(a)});g.on("click",".wpurp-meal-plan-shopping-list",function(a){a.preventDefault();var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),d=b.parents(".wpurp-meal-plan").find(".wpurp-meal-plan-shopping-list-container"),e=b.find(".wpurp-meal-plan-calendar").data("meal-plan-id"),c=""+b.find(".wpurp-meal-plan-calendar").data("start-date");a=""+b.find(".wpurp-meal-plan-calendar").data("end-date");
b=b.find(".wpurp-meal-plan-calendar").data("nbr-days");c=new Date(c.substring(0,4)+"-"+c.substring(4,6)+"-"+c.substring(6,8));a?(c=new Date("2000-01-01"),a=new Date(a.substring(0,4)+"-"+a.substring(4,6)+"-"+a.substring(6,8))):(a=new Date(c),a.setDate(a.getDate()+b-1));b=("0"+(c.getMonth()+1)).slice(-2)+"/"+("0"+c.getDate()).slice(-2)+"/"+c.getFullYear();a=("0"+(a.getMonth()+1)).slice(-2)+"/"+("0"+a.getDate()).slice(-2)+"/"+a.getFullYear();RecipeMealPlanner.getDates(jQuery(this),b,a,function(a,b,c){a&&
b&&d.slideUp(200,function(){var f={action:"meal_planner_shopping_list",security:wpurp_meal_planner.nonce,id:e,from:a,to:b,unit_system:c},g=jQuery('<tr><td colspan="2">'+RecipeMealPlanner.loader+"</td></tr>"),p=d.find("tbody"),r=d.find(".wpurp-shopping-list-group-placeholder"),v=d.find(".wpurp-shopping-list-ingredient-placeholder");p.empty().html(g);d.slideDown(400,function(){jQuery.post(wpurp_meal_planner.ajaxurl,f,function(a){a=RecipeMealPlanner.generateShoppingList(a.ingredients,a.unit_system);
a.append(r);a.append(v);p.replaceWith(a);d.find("tbody").sortable({helper:function(a,b){b.children().each(function(){jQuery(this).width(jQuery(this).width())});return b}})},"json")})})})});if(!e)f.on("hover",".wpurp-meal-plan-shopping-list tbody tr",function(a){"mouseenter"==a.type?jQuery(this).find(".wpurp-meal-plan-actions").show():jQuery(this).find(".wpurp-meal-plan-actions").hide()});f.on("click",".wpurp-shopping-list-close",function(){jQuery(this).parents(".wpurp-meal-plan-shopping-list-container").slideUp(200)});
f.on("click",".wpurp-group-edit:not(.wpurp-disabled)",function(){var a=jQuery(this);a.addClass("wpurp-disabled");var b=a.parents(".wpurp-shopping-list-group").find(".wpurp-shopping-list-group-name");RecipeMealPlanner.getInput(b,b.text(),function(d){a.removeClass("wpurp-disabled");d&&b.text(d)})});f.on("click",".wpurp-group-delete:not(.wpurp-disabled)",function(){jQuery(this).closest(".wpurp-shopping-list-group").remove()});f.on("click",".wpurp-ingredient-edit:not(.wpurp-disabled)",function(){var a=
jQuery(this);a.addClass("wpurp-disabled");var b=a.parents(".wpurp-shopping-list-ingredient").find(".wpurp-shopping-list-ingredient-name"),d=a.parents(".wpurp-shopping-list-ingredient").find(".wpurp-shopping-list-ingredient-quantity"),e=a.parents(".wpurp-shopping-list-ingredient").find(".wpurp-shopping-list-ingredient-checkbox");d.hide();e.hide();RecipeMealPlanner.getTwoInput(b,b.text(),d.text(),function(c,f){a.removeClass("wpurp-disabled");if(c||f)b.text(c),d.text(f);d.show();e.show()})});f.on("click",
".wpurp-ingredient-delete:not(.wpurp-disabled)",function(){jQuery(this).closest(".wpurp-shopping-list-ingredient").remove()});f.on("click",".wpurp-meal-plan-add-group",function(a){a.preventDefault();var b=jQuery(this).parents(".wpurp-meal-plan-shopping-list-container");RecipeMealPlanner.getInput(jQuery(this),"",function(a){if(a){var e=b.find(".wpurp-shopping-list-group-placeholder");e.clone().insertBefore(e).addClass("wpurp-shopping-list-group").removeClass("wpurp-shopping-list-group-placeholder").find(".wpurp-shopping-list-group-name").text(a)}})});
f.on("click",".wpurp-meal-plan-add-ingredient",function(a){a.preventDefault();var b=jQuery(this).parents(".wpurp-meal-plan-shopping-list-container");RecipeMealPlanner.getTwoInput(jQuery(this),"","",function(a,e){if(a||e){var c=b.find(".wpurp-shopping-list-ingredient-placeholder").clone();c.insertBefore(jQuery(".wpurp-shopping-list-group-placeholder")).addClass("wpurp-shopping-list-ingredient").removeClass("wpurp-shopping-list-ingredient-placeholder").find(".wpurp-shopping-list-ingredient-name").text(a);
c.find(".wpurp-shopping-list-ingredient-quantity").text(e)}})});f.on("change",".wpurp-shopping-list-ingredient-checkbox",function(a){a=jQuery(this);a.is(":checked")?a.closest("tr").addClass("ingredient-checked"):a.closest("tr").removeClass("ingredient-checked")});f.on("click",".wpurp-meal-plan-shopping-list-save",function(a){a.preventDefault();var b=[],d={name:"",ingredients:[]};jQuery(this).parents(".wpurp-meal-plan-shopping-list-container").find(".wpurp-shopping-list-group, .wpurp-shopping-list-ingredient").each(function(a){var c=
jQuery(this);c.hasClass("wpurp-shopping-list-group")?(0<a&&b.push(d),d={name:c.find(".wpurp-shopping-list-group-name").text(),ingredients:[]}):d.ingredients.push({name:c.find(".wpurp-shopping-list-ingredient-name").text(),quantity:c.find(".wpurp-shopping-list-ingredient-quantity").text()})});b.push(d);jQuery.post(wpurp_meal_planner.ajaxurl,{action:"meal_planner_shopping_list_save",security:wpurp_meal_planner.nonce,shopping_list:b},function(a){window.open(a)})});f.on("click",".wpurp-meal-plan-shopping-list-print",
function(a){a.preventDefault();jQuery(this).parents(".wpurp-meal-plan-shopping-list-container").find(".wpurp-meal-plan-shopping-list").print({globalStyles:!1,stylesheet:wpurp_meal_planner.addonUrl+"/css/print.css",prepend:"<style>"+wpurp_meal_planner.print_shoppinglist_style+"</style>"})})};
RecipeMealPlanner.initSelect=function(){jQuery(".wpurp-meal-plan-add-recipe").select2({width:"off"}).on("change",function(){RecipeMealPlanner.addRecipe(jQuery(this).select2("data"));jQuery(this).select2("val","")})};RecipeMealPlanner.initSortable=function(e){jQuery(".wpurp-meal-plan:not(.wpurp-meal-plan-shortcode)").find(".wpurp-meal-plan-recipe-list").sortable({connectWith:".wpurp-meal-plan-recipe-list",placeholder:"wpurp-meal-plan-recipe-placeholder",stop:function(){RecipeMealPlanner.saveMenu(e)}})};
RecipeMealPlanner.addRecipe=function(e){if(""!==e.id){RecipeMealPlanner.getRecipeTemplate(e.id);var g=e.id,f=e.text,a=e.element[0].dataset.thumb,b=e.element[0].dataset.servings,d=jQuery(".wpurp-meal-plan-recipe-container");d.slideUp(200,function(){d.find(".wpurp-meal-plan-recipe").remove();d.append('<div class="wpurp-meal-plan-recipe" data-recipe="'+g+'" data-servings="'+b+'"><img src="'+a+'"><span class="wpurp-meal-plan-recipe-title">'+f+'</span> <span class="wpurp-meal-plan-recipe-servings">('+
b+")</span></div>");d.slideDown(400)})}};RecipeMealPlanner.getRecipeTemplate=function(e,g){void 0==RecipeMealPlanner.templates[e]?jQuery.post(wpurp_meal_planner.ajaxurl,{action:"get_recipe_template",security:wpurp_meal_planner.nonce,recipe_id:e},function(f){RecipeMealPlanner.templates[e]=f.output;void 0!==g&&g(f.output)},"json"):void 0!==g&&g(RecipeMealPlanner.templates[e])};
RecipeMealPlanner.groupBy=function(e){var g=jQuery(RecipeMealPlanner.loader);jQuery(".wpurp-meal-plan-group-by-container").append(g);jQuery.post(wpurp_meal_planner.ajaxurl,{action:"meal_planner_groupby",security:wpurp_meal_planner.nonce,groupby:e,grid:wpurp_meal_planner_grid.slug},function(e){g.remove();jQuery(".wpurp-meal-plan-add-recipe").select2("destroy").off().html(e);RecipeMealPlanner.initSelect()})};
RecipeMealPlanner.checkCourseActions=function(){var e=jQuery(".wpurp-meal-plan-course");e.each(function(g,f){jQuery(f).find(".wpurp-course-move").removeClass("wpurp-disabled");0==g?jQuery(f).find(".wpurp-course-up").addClass("wpurp-disabled"):g==e.length-1&&jQuery(f).find(".wpurp-course-down").addClass("wpurp-disabled")})};
RecipeMealPlanner.getInput=function(e,g,f){var a=jQuery('<form class="wpurp-meal-plan-form"></form>'),b=jQuery('<input type="text" class="wpurp-meal-plan-input">'),d=jQuery('<button type="submit" class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),h=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>');a.append(b).append(d).append(h);e.hide().after(a);b.val(g);b.focus().select();a.on("submit",function(c){c.preventDefault();c.stopPropagation();c=b.val();
e.show();a.remove();f(c.trim())});h.on("click",function(b){b.preventDefault();b.stopPropagation();e.show();a.remove();f("")})};
RecipeMealPlanner.getTwoInput=function(e,g,f,a){var b=jQuery('<form class="wpurp-meal-plan-form"></form>'),d=jQuery('<input type="text" class="wpurp-meal-plan-input">'),h=jQuery('<input type="text" class="wpurp-meal-plan-input">'),c=jQuery('<button type="submit" class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),k=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>');b.append(d).append(h).append(c).append(k);e.hide().after(b);d.val(g);h.val(f);d.focus().select();
b.on("submit",function(c){c.preventDefault();c.stopPropagation();c=d.val();var f=h.val();e.show();b.remove();a(c.trim(),f.trim())});k.on("click",function(c){c.preventDefault();c.stopPropagation();e.show();b.remove();a("")})};
RecipeMealPlanner.getConfirm=function(e,g,f){var a=jQuery('<form class="wpurp-meal-plan-form"></form>');g=jQuery('<span class="wpurp-meal-plan-form-message">'+g+"</span>");var b=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),d=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>');a.append(g).append(b).append(d);e.hide().after(a);b.on("click",function(b){b.preventDefault();b.stopPropagation();e.show();a.remove();f(!0)});d.on("click",
function(b){b.preventDefault();b.stopPropagation();e.show();a.remove();f(!1)})};
RecipeMealPlanner.getDate=function(e,g,f){var a=jQuery('<form class="wpurp-meal-plan-form"></form>'),b=jQuery('<input type="text" class="wpurp-meal-plan-input wpurp-meal-plan-input-date">'),d=jQuery('<button type="submit" class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),h=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>');a.append(b).append(d).append(h);e.hide().after(a);b.val(g);b.datepicker();a.on("submit",function(c){c.preventDefault();c.stopPropagation();
c=b.val();e.show();a.remove();f(c.trim())});h.on("click",function(b){b.preventDefault();b.stopPropagation();e.show();a.remove();f("")})};
RecipeMealPlanner.getDates=function(e,g,f,a){for(var b=jQuery('<form class="wpurp-meal-plan-form"></form>'),d=jQuery('<input type="text" class="wpurp-meal-plan-input wpurp-meal-plan-input-date">'),h=jQuery('<input type="text" class="wpurp-meal-plan-input wpurp-meal-plan-input-date">'),c=jQuery('<select class="wpurp-meal-plan-input wpurp-meal-plan-input-unit-system"></select>'),k=jQuery('<button type="submit" class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),l=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>'),
m=0,n=wpurp_unit_conversion.systems.length;m<n;m++)c.append(jQuery('<option value="'+m+'"'+(m==wpurp_meal_planner.default_unit_system?" selected":"")+">"+wpurp_unit_conversion.systems[m].name+"</option>"));m=jQuery('<span class="wpurp-meal-plan-input-dates"></span>').append(d).append(" - ").append(h);b.append(m).append(c).append(k).append(l);e.hide().after(b);d.val(g);h.val(f);d.datepicker();h.datepicker();b.on("submit",function(f){f.preventDefault();f.stopPropagation();f=d.val();var g=h.val(),k=
c.val();e.show();b.remove();a(f.trim(),g.trim(),k)});l.on("click",function(c){c.preventDefault();c.stopPropagation();e.show();b.remove();a("","")})};
RecipeMealPlanner.saveMenu=function(e){e=e.find(".wpurp-meal-plan-calendar");var g=e.data("meal-plan-id"),f=e.data("start-date"),a=e.data("nbr-days"),b=[];e.find(".wpurp-meal-plan-course").each(function(a){var c=jQuery(this),d=c.find(".wpurp-meal-plan-course-name").text(),e=[];c.find(".wpurp-meal-plan-recipe-list").each(function(a){var b=[];jQuery(this).find(".wpurp-meal-plan-recipe").each(function(a){var c=jQuery(this),d=c.data("recipe"),c=c.data("servings");b[a]={id:d,servings:c}});e[a]=b});b[a]=
{name:d,days:e}});var d={id:g,start_date:f,nbr_days:a,courses:b};clearTimeout(RecipeMealPlanner.ajaxUpdateTimer);RecipeMealPlanner.ajaxUpdateTimer=setTimeout(function(){RecipeMealPlanner.ajaxSaveMenu(d)},1E3)};RecipeMealPlanner.ajaxSaveMenu=function(e){jQuery.post(wpurp_meal_planner.ajaxurl,{action:"meal_planner_save",security:wpurp_meal_planner.nonce,security_admin:wpurp_meal_planner.nonce_admin,menu:e},function(e){console.log(e)})};
RecipeMealPlanner.generateShoppingList=function(e,g){for(var f=[],a=[],b=236.6,d=0,h=wpurp_unit_conversion.systems.length;d<h;d++){var c=wpurp_unit_conversion.systems[d];-1!=jQuery.inArray("cup",c.units_volume)&&(b=parseFloat(c.cup_type))}d=0;for(h=e.length;d<h;d++){c=e[d];void 0===a[c.name]&&(a[c.name]=c.plural);void 0===f[c.group]&&(f[c.group]=[]);void 0===f[c.group][c.name]&&(f[c.group][c.name]=[]);var k=c.amount,l=c.unit,m=RecipeUnitConversion.getUnitFromAlias(c.unit);if(void 0!==m&&"1"==wpurp_meal_planner.consolidate_ingredients){l=
RecipeUnitConversion.getAbbreviation(m);"cup"==l&&(m=(new Qty("1 cup")).to("ml").scalar,.1<Math.abs(b-m)&&(k*=b/m));var n=new Qty(""+k+" "+l),k=n.toBase();"m3"==k.units()&&(k=k.to("l"));l=k.units();k=k.scalar}""==l&&(l="wpurp_nounit");void 0===f[c.group][c.name][l]&&(f[c.group][c.name][l]=0);f[c.group][c.name][l]+=parseFloat(k)}b=Object.keys(f);b.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())});m=jQuery("<tbody></tbody>");d=0;for(h=b.length;d<h;d++){var c=b[d],y=f[c],c=jQuery('<tr class="wpurp-shopping-list-group"><td colspan="2"><span class="wpurp-shopping-list-group-name">'+
c+'</span><span class="wpurp-meal-plan-actions"><i class="fa fa-pencil wpurp-group-edit"></i><i class="fa fa-trash wpurp-group-delete"></i></span></td></tr>');m.append(c);var p=Object.keys(y);p.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())});for(var r=0,v=p.length;r<v;r++){var c=p[r],z=y[c];for(l in z)if(k=z[l],isFinite(k)){for(var w=jQuery('<tr class="wpurp-shopping-list-ingredient"></tr>'),t=RecipeUnitConversion.getUnitFromAlias(l),x=[g],A=!1,u=0;u<x.length;u++){var q=
k,n=l;"wpurp_nounit"==l?n="":void 0===t||"1"!=wpurp_meal_planner.consolidate_ingredients&&(RecipeUnitConversion.isUniversal(t)||-1!=jQuery.inArray(x[u],RecipeUnitConversion.getUnitSystems(t)))||(n=RecipeUnitConversion.convertUnitToSystem(k,t,0,x[u]),q=n.amount,n=RecipeUnitConversion.getUserAbbreviation(n.unit,q));q=RecipeUnitConversion.formatNumber(q,wpurp_meal_planner.fractions);"1"!==q&&(A=!0);w.append('<td><span class="wpurp-shopping-list-ingredient-quantity">'+q+" "+n+'</span><span class="wpurp-meal-plan-actions"><i class="fa fa-pencil wpurp-ingredient-edit"></i><i class="fa fa-trash wpurp-ingredient-delete"></i></span></td>')}k=
A?a[c]:c;k=k.charAt(0).toUpperCase()+k.slice(1);n="";"1"==wpurp_meal_planner.checkboxes&&(n='<input type="checkbox" class="wpurp-shopping-list-ingredient-checkbox"> ');w.prepend("<td>"+n+'<span class="wpurp-shopping-list-ingredient-name">'+k+"</span></td>");m.append(w)}}}return m};jQuery(document).ready(function(){0<jQuery(".wpurp-meal-plan").length&&RecipeMealPlanner.init()}); | 710.090196 | 32,242 | 0.696592 |
17ab07aa09db9a4a3961c34b700e0de0a68983b3 | 3,536 | asm | Assembly | tools/fasm-win/xxx-sander/fasm-sander.asm | microhobby/gramado | 1d379b404d3fded05cb7793b4092026251e41f3d | [
"BSD-2-Clause"
] | 4 | 2018-10-15T17:35:37.000Z | 2021-01-31T14:25:29.000Z | tools/fasm-win/xxx-sander/fasm-sander.asm | microhobby/gramado | 1d379b404d3fded05cb7793b4092026251e41f3d | [
"BSD-2-Clause"
] | null | null | null | tools/fasm-win/xxx-sander/fasm-sander.asm | microhobby/gramado | 1d379b404d3fded05cb7793b4092026251e41f3d | [
"BSD-2-Clause"
] | null | null | null |
; flat assembler interface for Linux
; Copyright (c) 1999-2018, Tomasz Grysztar.
; All rights reserved.
format ELF executable 3
entry start
segment readable executable
start:
mov [con_handle],1
mov esi,_logo
call display_string
mov ebx,omgevingsvoorbeeld
mov [command_line],ebx
mov ecx,[esp]
mov ebx,[esp+4+ecx*4+4]
mov ebx,omgevingsvoorbeeld
mov [environment],ebx
call get_params
jc information
call init_memory
mov esi,_memory_prefix
call display_string
mov eax,[memory_end]
sub eax,[memory_start]
add eax,[additional_memory_end]
sub eax,[additional_memory]
shr eax,10
call display_number
mov esi,_memory_suffix
call display_string
mov eax,78
mov ebx,buffer
xor ecx,ecx
int 0x80
mov eax,dword [buffer]
mov ecx,1000
mul ecx
mov ebx,eax
mov eax,dword [buffer+4]
div ecx
add eax,ebx
mov [start_time],eax
and [preprocessing_done],0
call preprocessor
or [preprocessing_done],-1
call parser
call assembler
call formatter
call display_user_messages
movzx eax,[current_pass]
inc eax
call display_number
mov esi,_passes_suffix
call display_string
mov eax,78
mov ebx,buffer
xor ecx,ecx
int 0x80
mov eax,dword [buffer]
mov ecx,1000
mul ecx
mov ebx,eax
mov eax,dword [buffer+4]
div ecx
add eax,ebx
sub eax,[start_time]
jnc time_ok
add eax,3600000
time_ok:
xor edx,edx
mov ebx,100
div ebx
or eax,eax
jz display_bytes_count
xor edx,edx
mov ebx,10
div ebx
push edx
call display_number
mov dl,'.'
call display_character
pop eax
call display_number
mov esi,_seconds_suffix
call display_string
display_bytes_count:
mov eax,[written_size]
call display_number
mov esi,_bytes_suffix
call display_string
xor al,al
jmp exit_program
information:
mov esi,_usage
call display_string
mov al,1
jmp exit_program
get_params:
mov esi,stdinput
mov [input_file],esi
mov esi,stdoutput
mov [output_file],esi
mov [symbols_file],0
mov [memory_setting],0
mov [passes_limit],100
mov [definitions_pointer],predefinitions
ret
include 'system.inc'
include '..\version.inc'
_copyright db 'Copyright (c) 1999-2018, Tomasz Grysztar',0xA,0
_logo db 'flat assembler ported for SoS version ',VERSION_STRING,0
_usage db 0xA
db 'usage: fasm <source> [output]',0xA
db 'optional settings:',0xA
db ' -m <limit> set the limit in kilobytes for the available memory',0xA
db ' -p <limit> set the maximum allowed number of passes',0xA
db ' -d <name>=<value> define symbolic variable',0xA
db ' -s <file> dump symbolic information for debugging',0xA
db 0
_memory_prefix db ' (',0
_memory_suffix db ' kilobytes memory)',0xA,0
_passes_suffix db ' passes, ',0
_seconds_suffix db ' seconds, ',0
_bytes_suffix db ' bytes.',0xA,0
include '..\errors.inc'
include '..\symbdump.inc'
include '..\preproce.inc'
include '..\parser.inc'
include '..\exprpars.inc'
include '..\assemble.inc'
include '..\exprcalc.inc'
include '..\formats.inc'
include '..\x86_64.inc'
include '..\avx.inc'
include '..\tables.inc'
include '..\messages.inc'
segment readable writeable
align 4
include '..\variable.inc'
command_line dd ?
memory_setting dd ?
definitions_pointer dd ?
environment dd ?
timestamp dq ?
start_time dd ?
con_handle dd ?
displayed_count dd ?
last_displayed db ?
character db ?
preprocessing_done db ?
predefinitions rb 1000h
buffer rb 1000h
omgevingsvoorbeeld db "",0x00
stdinput db "input.asm",0x00
stdoutput db "output.elf",0x00
defmempnt rb 200000
defmemend:
defmempnt2 rb 200000
defmemend2:
| 19.217391 | 87 | 0.736425 |
e3a8c1a331b8d39feec7ca92383f83addedcf10d | 8,609 | dart | Dart | lib/ui/signin/Kakaologin.dart | Duckprogram/app_flutter | d2facc285231949d5549d18c87a37ec06387d447 | [
"MIT"
] | null | null | null | lib/ui/signin/Kakaologin.dart | Duckprogram/app_flutter | d2facc285231949d5549d18c87a37ec06387d447 | [
"MIT"
] | 8 | 2021-09-26T12:38:45.000Z | 2021-11-14T09:45:25.000Z | lib/ui/signin/Kakaologin.dart | Duckprogram/app_flutter | d2facc285231949d5549d18c87a37ec06387d447 | [
"MIT"
] | null | null | null | import 'package:duckie_app/styles/styles.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:provider/provider.dart';
import '../../data/models/auth.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../../api/auth.dart';
import 'package:kakao_flutter_sdk/all.dart';
import 'package:kakao_flutter_sdk/auth.dart';
import 'package:kakao_flutter_sdk/user.dart';
// import 'forgot.dart';
class KakoaLoginPage extends StatefulWidget {
@override
KakoaLoginPageState createState() => KakoaLoginPageState();
}
class KakoaLoginPageState extends State<KakoaLoginPage> {
bool _isKakaoTalkInstalled = false;
static final storage = FlutterSecureStorage();
@override
initState() {
super.initState();
_initKakaoTalkInstalled();
WidgetsBinding.instance?.addPostFrameCallback((_) {
_asyncMethod();
});
KakaoContext.clientId = 'b4446af28f0cd1ba8c26bad8d3b44d50';
KakaoContext.javascriptClientId = '8f78f01633b4050249b25cc2ccf9395d';
isKakaoTalkInstalled();
}
_asyncMethod() async {
//read 함수를 통하여 key값에 맞는 정보를 불러오게 됩니다. 이때 불러오는 결과의 타입은 String 타입임을 기억해야 합니다.
//(데이터가 없을때는 null을 반환을 합니다.)
// var token = await storage.read(key: "accessToken");
// print("token check");
// 신규 버전이 나오면서 더 이상 storage를 굳이 안써도 될 거 같다.
var jwttoken = await storage.read(key: "accessToken");
var token = await TokenManager.instance.getToken();
//user의 정보가 있다면 바로 자동 로그인 method로 넘어감
await storage.write(key: "accessToken", value: null);
if (token.refreshToken != null && jwttoken != null) {
print("token access " + token.accessToken.toString());
print("token refresh " + token.refreshToken.toString());
print('is it not null?');
await _issueJWTandLogin(token.accessToken.toString());
}
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
child: Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
toolbarHeight: 56,
foregroundColor: gray01,
backgroundColor: Colors.white,
centerTitle: true,
elevation: 0.1,
shape: Border(bottom: BorderSide(color: gray07, width: 1)),
title: Text(
"로그인",
textAlign: TextAlign.center,
style: body2Bold,
),
),
body: SingleChildScrollView(
child: Container(
color: white,
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 24),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 20,
bottom: 20,
),
child: Text(
"어서오세요 덕님!\n더키에 오신걸 환영해요! ",
style: h1,
textAlign: TextAlign.center,
)),
Container(
padding: EdgeInsets.only(bottom: 45),
child: Text(
"다른 곳에선 못했던 이야기\n덕친들과 자유롭게 애기하세요!",
style: body1MediumGray3,
textAlign: TextAlign.center,
)),
Container(
height: 280,
width: 225,
padding: EdgeInsets.only(bottom: 40),
child: Image.asset('assets/login/duckie_character.png')),
Container(
height: 60,
margin: EdgeInsets.only(bottom: 40),
padding: const EdgeInsets.symmetric(
horizontal: 60,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Color(0xfffae100),
),
child: TextButton(
child: Text("카카오톡으로 로그인",
textAlign: TextAlign.center, style: body1BoldBlack),
onPressed: _loginWithKakaoTalk),
),
],
),
)),
));
}
_initKakaoTalkInstalled() async {
final installed = await isKakaoTalkInstalled();
print('kakao Install : ' + installed.toString());
setState(() {
_isKakaoTalkInstalled = installed;
});
}
//먼저 code를 활용하여 백앤드로 보냄 이상이 없는 경우 jwt로 보내기
_issueKakaoAccessToken(String authCode) async {
try {
AccessTokenResponse token =
await AuthApi.instance.issueAccessToken(authCode);
TokenManager.instance.setToken(token);
print("AccessToken : " + token.accessToken);
print("refreshToken : " + token.refreshToken.toString());
try {
// listen 은 전체를 rebuild 한다는 뜻으로 set 함수를 사용하기 위해서 단순하게
// listen 을 false로 하여 진행한다.
var user = await UserApi.instance.me();
print("카카오톡 에서 보내준 유저 정보 user : " + user.toString());
final snackBar =
SnackBar(content: Text(user.properties!['nickname']! + "님 반갑습니다."));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
// if (!(await _registerUserInfoWithKakao(token.accessToken))) {
// print("회원가입 실패");
// final snackBar = SnackBar(content: Text("회원가입 실패"));
// ScaffoldMessenger.of(context).showSnackBar(snackBar);
// return;
// }
await _issueJWTandLogin(token.accessToken);
} on KakaoAuthException catch (e) {
} catch (e) {
print(e);
}
} catch (e) {
await storage.write(key: "accessToken", value: "");
print("error on issuing access token: $e");
}
}
// Future<bool> _registerUserInfoWithKakao(String accessToken) async {
// var signUpBody = {'accessToken': accessToken};
// try {
// var response = await api_userRegisterCheck(
// header: null, path: '/auth/signup', body: signUpBody);
// if (response['code'] == 0 ||
// response['code'] == -9999) //정상 가입 또는 이미 가입한 회원
// return true;
// else
// return false;
// } catch (e) {
// print(e);
// return false;
// }
// }
//로그인 혹은 회원가입이 잘 되어 있다면 jwt 토큰 발행 향후 모든 로그인은 해당 토큰으로 해결
_issueJWTandLogin(String accessToken) async {
try {
print('Jwt Login');
// var fcm_token = await FirebaseMessaging.instance.getToken();
// print(fcm_token);
// var signUpBody = {'fcmToken': fcm_token};
var signUpBody = {'accessToken': accessToken};
var response = await api_userRegisterCheck(
header: null, path: '/auth/signin', body: signUpBody);
// if (response['code'] == 0 ||
// response['code'] == -9999) //정상 가입 또는 이미 가입한 회원
// 추후 정상적으로 로그인이 완료 되었을 경우 유저 정보를 login 진행시 저장하도록 재구성
// final _auth = Provider.of<AuthModel>(context, listen: false);
// _auth.user = await UserApi.instance.me();
print(response);
if (response['data']['access_token'] != null) {
// await storage.write(
// key: "accessToken", value: response['data']['access_token']);
await storage.write(
key: "accessToken",
value:
'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6IjIiLCJzdWIiOiIyIiwiaWF0IjoxNjM2ODk5Njg2LCJleHAiOjE2ODAwOTk2ODZ9.teVXxkIV_NLvnQg0KsFfcNaXPJ2IYkipicZwUju-7Es');
await storage.write(key: "username", value: response['data']['name']);
await storage.write(key: "picture", value: response['data']['picture']);
await storage.write(
key: "refreshToken", value: response['data']['refresh_token']);
// 이상없이 잘 되었다면 main 화면으로 넘어가기
Navigator.pushReplacementNamed(context, '/home');
}
// return true;
// else
// return false;
} catch (e) {
print(e);
}
}
_loginWithKakaoTalk() async {
if (_isKakaoTalkInstalled) {
try {
var code = await AuthCodeClient.instance.requestWithTalk();
print(code);
await _issueKakaoAccessToken(code);
} catch (e) {
print(e);
}
} else {
//카톡이 깔려있지 않으면 웹으로 진행
print("로그인 이상여부 확인 ");
try {
print("응답 여부 확인");
var code = await AuthCodeClient.instance.request();
print( "code 확인" );
print(code);
await _issueKakaoAccessToken(code);
} catch (e) {
print(e);
}
}
}
unlinkTalk() async {
try {
var code = await UserApi.instance.unlink();
print(code.toString());
} catch (e) {
print(e);
}
}
}
| 32.858779 | 165 | 0.585666 |
4bdc246743557f7e9a30af28e55739e036537300 | 7,499 | lua | Lua | rom/modules/main/cc/shell/completion.lua | MCJack123/craftos2-rom | 9fb25d442845b7f2243908a80bdc9c545c4120ff | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 5 | 2021-07-19T23:39:07.000Z | 2022-02-07T00:06:08.000Z | rom/modules/main/cc/shell/completion.lua | MCJack123/craftos2-rom | 9fb25d442845b7f2243908a80bdc9c545c4120ff | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 3 | 2020-12-25T08:51:50.000Z | 2020-12-30T02:13:27.000Z | rom/modules/main/cc/shell/completion.lua | MCJack123/craftos2-rom | 9fb25d442845b7f2243908a80bdc9c545c4120ff | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 7 | 2019-10-15T00:41:35.000Z | 2022-02-07T00:04:23.000Z | --[[- A collection of helper methods for working with shell completion.
Most programs may be completed using the @{build} helper method, rather than
manually switching on the argument index.
Note, the helper functions within this module do not accept an argument index,
and so are not directly usable with the @{shell.setCompletionFunction}. Instead,
wrap them using @{build}, or your own custom function.
@module cc.shell.completion
@since 1.85.0
@see cc.completion For more general helpers, suitable for use with @{_G.read}.
@see shell.setCompletionFunction
@usage Register a completion handler for example.lua which prompts for a
choice of options, followed by a directory, and then multiple files.
local completion = require "cc.shell.completion"
local complete = completion.build(
{ completion.choice, { "get", "put" } },
completion.dir,
{ completion.file, many = true }
)
shell.setCompletionFunction("example.lua", complete)
read(nil, nil, shell.complete, "example ")
]]
local expect = require "cc.expect".expect
local completion = require "cc.completion"
--- Complete the name of a file relative to the current working directory.
--
-- @tparam table shell The shell we're completing in.
-- @tparam string text Current text to complete.
-- @treturn { string... } A list of suffixes of matching files.
local function file(shell, text)
return fs.complete(text, shell.dir(), true, false)
end
--- Complete the name of a directory relative to the current working directory.
--
-- @tparam table shell The shell we're completing in.
-- @tparam string text Current text to complete.
-- @treturn { string... } A list of suffixes of matching directories.
local function dir(shell, text)
return fs.complete(text, shell.dir(), false, true)
end
--- Complete the name of a file or directory relative to the current working
-- directory.
--
-- @tparam table shell The shell we're completing in.
-- @tparam string text Current text to complete.
-- @tparam { string... } previous The shell arguments before this one.
-- @tparam[opt] boolean add_space Whether to add a space after the completed item.
-- @treturn { string... } A list of suffixes of matching files and directories.
local function dirOrFile(shell, text, previous, add_space)
local results = fs.complete(text, shell.dir(), true, true)
if add_space then
for n = 1, #results do
local result = results[n]
if result:sub(-1) ~= "/" then
results[n] = result .. " "
end
end
end
return results
end
local function wrap(func)
return function(shell, text, previous, ...)
return func(text, ...)
end
end
--- Complete the name of a program.
--
-- @tparam table shell The shell we're completing in.
-- @tparam string text Current text to complete.
-- @treturn { string... } A list of suffixes of matching programs.
-- @see shell.completeProgram
local function program(shell, text)
return shell.completeProgram(text)
end
--- Complete arguments of a program.
--
-- @tparam table shell The shell we're completing in.
-- @tparam string text Current text to complete.
-- @tparam { string... } previous The shell arguments before this one.
-- @tparam number starting Which argument index this program and args start at.
-- @treturn { string... } A list of suffixes of matching programs or arguments.
-- @since 1.97.0
local function programWithArgs(shell, text, previous, starting)
if #previous + 1 == starting then
local tCompletionInfo = shell.getCompletionInfo()
if text:sub(-1) ~= "/" and tCompletionInfo[shell.resolveProgram(text)] then
return { " " }
else
local results = shell.completeProgram(text)
for n = 1, #results do
local sResult = results[n]
if sResult:sub(-1) ~= "/" and tCompletionInfo[shell.resolveProgram(text .. sResult)] then
results[n] = sResult .. " "
end
end
return results
end
else
local program = previous[starting]
local resolved = shell.resolveProgram(program)
if not resolved then return end
local tCompletion = shell.getCompletionInfo()[resolved]
if not tCompletion then return end
return tCompletion.fnComplete(shell, #previous - starting + 1, text, { program, table.unpack(previous, starting + 1, #previous) })
end
end
--[[- A helper function for building shell completion arguments.
This accepts a series of single-argument completion functions, and combines
them into a function suitable for use with @{shell.setCompletionFunction}.
@tparam nil|table|function ... Every argument to @{build} represents an argument
to the program you wish to complete. Each argument can be one of three types:
- `nil`: This argument will not be completed.
- A function: This argument will be completed with the given function. It is
called with the @{shell} object, the string to complete and the arguments
before this one.
- A table: This acts as a more powerful version of the function case. The table
must have a function as the first item - this will be called with the shell,
string and preceding arguments as above, but also followed by any additional
items in the table. This provides a more convenient interface to pass
options to your completion functions.
If this table is the last argument, it may also set the `many` key to true,
which states this function should be used to complete any remaining arguments.
]]
local function build(...)
local arguments = table.pack(...)
for i = 1, arguments.n do
local arg = arguments[i]
if arg ~= nil then
expect(i, arg, "table", "function")
if type(arg) == "function" then
arg = { arg }
arguments[i] = arg
end
if type(arg[1]) ~= "function" then
error(("Bad table entry #1 at argument #%d (expected function, got %s)"):format(i, type(arg[1])), 2)
end
if arg.many and i < arguments.n then
error(("Unexpected 'many' field on argument #%d (should only occur on the last argument)"):format(i), 2)
end
end
end
return function(shell, index, text, previous)
local arg = arguments[index]
if not arg then
if index <= arguments.n then return end
arg = arguments[arguments.n]
if not arg or not arg.many then return end
end
return arg[1](shell, text, previous, table.unpack(arg, 2))
end
end
return {
file = file,
dir = dir,
dirOrFile = dirOrFile,
program = program,
programWithArgs = programWithArgs,
-- Re-export various other functions
help = wrap(help.completeTopic), --- Wraps @{help.completeTopic} as a @{build} compatible function.
choice = wrap(completion.choice), --- Wraps @{cc.completion.choice} as a @{build} compatible function.
peripheral = wrap(completion.peripheral), --- Wraps @{cc.completion.peripheral} as a @{build} compatible function.
side = wrap(completion.side), --- Wraps @{cc.completion.side} as a @{build} compatible function.
setting = wrap(completion.setting), --- Wraps @{cc.completion.setting} as a @{build} compatible function.
command = wrap(completion.command), --- Wraps @{cc.completion.command} as a @{build} compatible function.
build = build,
}
| 38.854922 | 138 | 0.67289 |
bf142ac0ec5a08884ffbe222c134c7893e3cda7d | 1,400 | ps1 | PowerShell | lib/Initialize-GHGistObject.ps1 | NickCrew/PSGistManager | a3d8955b75620a84fb9ec28a3cc59ca8299829de | [
"MIT"
] | 1 | 2021-04-06T05:32:11.000Z | 2021-04-06T05:32:11.000Z | lib/Initialize-GHGistObject.ps1 | disco0/PSGistManager | a3d8955b75620a84fb9ec28a3cc59ca8299829de | [
"MIT"
] | null | null | null | lib/Initialize-GHGistObject.ps1 | disco0/PSGistManager | a3d8955b75620a84fb9ec28a3cc59ca8299829de | [
"MIT"
] | 1 | 2021-04-06T05:32:08.000Z | 2021-04-06T05:32:08.000Z | function Initialize-GHGistObject {
<#
.SYNOPSIS
Uses the github API response to create a Gist object
.INPUTS
Raw data response from Github gist API
.OUTPUTS
A Gist object ready for user interaction
.NOTES
This is a public function, but most users should not have cause to use this cmdlet very often
#>
param ($resultData)
$ErrorActionPreference = 'Stop'
$DebugPreference = 'Continue'
$filename = $resultData.Files | Get-Member -Type NoteProperty | Select-Object -ExpandProperty Name
$language = $resultData.Files.$filename.language
if ([String]::IsNullOrEmpty($resultData.Files.$Filename.raw_url)) {
$gistUrl = $resultData.url
Write-Verbose "Using 'url' property: $gistUrl"
} else {
$gistUrl = $resultData.Files.$filename.raw_url
Write-Verbose "Using 'raw_url' property: $gistUrl"
}
$content = $null
try
{
$content = Get-GHContentByUrl -Url $gistUrl
}
catch
{
Write-Error "${PSItem.Exception.Message}"
}
if ([String]::IsNullOrEmpty($content)) {
Write-Error "Content is empty from url: $gistUrl"
}
$gistObj = [Gist]::new(
[string]$e.Id,
$filename,
$language,
$content,
$resultData.html_url,
$rawUrl,
$resultData.public,
$resultData.created_at,
$resultData.updated_at
)
return $gistObj
}
| 25.454545 | 102 | 0.64 |
f85b0d04e7f2c5ea86104220512fd96017cc7f7c | 4,868 | kt | Kotlin | app/src/main/java/com/example/jetpackdemo/ui/fragment/module/cinema/MovieVideoFragment.kt | QingTianI/CatEyeDemo | 94ec7a142072e97282578f65137c5a6460c7d0e7 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/jetpackdemo/ui/fragment/module/cinema/MovieVideoFragment.kt | QingTianI/CatEyeDemo | 94ec7a142072e97282578f65137c5a6460c7d0e7 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/jetpackdemo/ui/fragment/module/cinema/MovieVideoFragment.kt | QingTianI/CatEyeDemo | 94ec7a142072e97282578f65137c5a6460c7d0e7 | [
"Apache-2.0"
] | null | null | null | package com.example.jetpackdemo.ui.fragment.module.cinema
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.lifecycle.MutableLiveData
import cn.jzvd.JzvdStd
import com.example.jetpackdemo.R
import com.example.jetpackdemo.base.BaseFragment
import com.example.jetpackdemo.data.model.bean.VideoPreview
import com.example.jetpackdemo.databinding.FragmentMovieVideoBinding
import com.example.jetpackdemo.ui.adapter.MyViewPager
import com.example.jetpackdemo.util.showErrorMessage
import com.example.jetpackdemo.viewmodel.fragment.MovieVideoViewModel
import me.hgj.jetpackmvvm.ext.parseState
import me.hgj.jetpackmvvm.ext.util.loge
class MovieVideoFragment : BaseFragment<MovieVideoViewModel, FragmentMovieVideoBinding>() {
private val arrayList = ArrayList<Fragment>()
private val title = arrayOf("简介", "评论")
private val jzvdPlayer by lazy { mDatabind.jzvdPlayer }
override fun createObserver() {
/**
* 监听Bundle传递数据变化
* @see
* @see mViewModel.movieId
*/
monitorBundleParamMovieId()
/**
* 监测网络请求数据变化
* @see MutableLiveData<ResultState<VideoPreview>>
*
*/
monitorNetworkVideoPreview()
/**
* 监听Intent传递数据变化
* @see VIDEOPREVIEWBEAN_DATA
* @see mViewModel.videoPreview_Data
*/
monitorBundleParamVideoPreviewData()
}
private fun monitorBundleParamVideoPreviewData() {
//
// if (mViewModel.videoPreview_Data.value != null) {
//
// //初始化 movieId
//
// mViewModel.movieId.value = mViewModel.movieId.value
//
// /**
// * 加载视频
// */
// loadVideoByUrl(mViewModel.videoPreview_Data.value!!.detailUrl)
//
//
// } else {
// mViewModel.movieId.value.toString()
// .loge(javaClass.simpleName + ".bundle.params.VIDEOPREVIEWBEAN_DATA")
//
// }
mViewModel.videoPreview_Data.observe(this) {
if (it != null) {
//初始化 movieId
mViewModel.movieId.value = it.movieId
/**
* 加载视频
*/
loadVideoByUrl(it.detailUrl)
} else {
it.toString().loge(javaClass.simpleName + ".bundle.params.videoPreview_Data")
}
}
}
private fun monitorNetworkVideoPreview() {
mViewModel.videoPreview.observe(this) {
parseState(it, {
setPreviewVideoList(it)
}, {
showErrorMessage(it)
})
}
}
private fun setPreviewVideoList(videoPreview: VideoPreview) {
val data = videoPreview.data[0]
val url = data.url
/**
* 加载视频
*/
loadVideoByUrl(url)
/**
* 初始化Fragment
*/
initFragmentByData(data)
}
private fun initFragmentByData(data: VideoPreview.Data) {
arrayList.clear()
val movieVideoDescFragment = MovieVideoDescFragment.newInstance(data)
val movieVideoCommentFragment = MovieVideoCommentFragment.newInstance()
//将Fragment添加到集合
arrayList.add(movieVideoDescFragment)
arrayList.add(movieVideoCommentFragment)
val viewPagerAdapter = MyViewPager(arrayList, childFragmentManager) //适配器
mDatabind.viewPager.adapter = viewPagerAdapter //给ViewPager添加适配器
mDatabind.tabLayout.setViewPager(mDatabind.viewPager, title)
}
/**
*
* @param url String
*/
//TODO
fun loadVideoByUrl(url: String) {
jzvdPlayer.setUp(url, "", JzvdStd.SCREEN_NORMAL)
jzvdPlayer.startVideo()
}
private fun monitorBundleParamMovieId() {
mViewModel.movieId.observe(this) {
if (it != 0) {
getVideoUrlByMoveId(it)
} else {
it.toString().loge(javaClass.simpleName + ".bundle.params.movieId")
}
}
}
private fun getVideoUrlByMoveId(movieId: Int) {
mViewModel.getPreviewVideoList(movieId, mViewModel.limit, mViewModel.offset)
}
override fun layoutId(): Int {
return R.layout.fragment_movie_video
}
override fun initView(savedInstanceState: Bundle?) {
/**
*
* 接收Bundle参数
*/
receiverBundleParam()
}
private fun receiverBundleParam() {
arguments?.let {
mViewModel.movieId.value = MovieVideoFragmentArgs.fromBundle(it).movieId
mViewModel.videoPreview_Data.value =
MovieVideoFragmentArgs.fromBundle(it).videoPreviewData
}
}
} | 23.516908 | 94 | 0.588537 |
3fb796a186693b4ea5c0341c07a6e80ed29e9fa6 | 281 | asm | Assembly | libsrc/_DEVELOPMENT/input/zx/c/sccz80/in_mouse_kempston_setpos.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/input/zx/c/sccz80/in_mouse_kempston_setpos.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/input/zx/c/sccz80/in_mouse_kempston_setpos.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; void in_mouse_kempston_setpos(uint16_t x, uint16_t y)
SECTION code_input
PUBLIC in_mouse_kempston_setpos
EXTERN asm_in_mouse_kempston_setpos
in_mouse_kempston_setpos:
pop af
pop bc
pop de
push de
push bc
push af
jp asm_in_mouse_kempston_setpos
| 13.380952 | 55 | 0.761566 |
30f0db99df6605f1ba620dc83aafa53f6cbce589 | 1,928 | swift | Swift | Twitter/Twitter/ProfileViewController.swift | swappy208/Twitter | 24f462001e1dd93bc05d7347ea7932fdb85cc82e | [
"Apache-2.0"
] | null | null | null | Twitter/Twitter/ProfileViewController.swift | swappy208/Twitter | 24f462001e1dd93bc05d7347ea7932fdb85cc82e | [
"Apache-2.0"
] | 1 | 2017-02-28T14:04:23.000Z | 2017-03-08T08:27:00.000Z | Twitter/Twitter/ProfileViewController.swift | swappy208/Twitter | 24f462001e1dd93bc05d7347ea7932fdb85cc82e | [
"Apache-2.0"
] | null | null | null |
//
// ProfileViewController.swift
// Twitter
//
// Created by Swapnil Tamrakar on 3/4/17.
// Copyright © 2017 Swapnil Tamrakar. All rights reserved.
//
import UIKit
class ProfileViewController: UIViewController {
@IBOutlet weak var bannerImageView: UIImageView!
@IBOutlet weak var userImageView: UIImageView!
@IBOutlet weak var userWrapperView: UIView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var screenNameLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var tweetsCountLabel: UILabel!
@IBOutlet weak var followingCountLabel: UILabel!
@IBOutlet weak var followersCountLabel: UILabel!
var user: User!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = user.name
if let bannerImageURL = user.bannerImageURL {
bannerImageView.setImageWith(bannerImageURL)
}
userWrapperView.layer.cornerRadius = 5
userWrapperView.clipsToBounds = true
userImageView.setImageWith(user.userImageURL)
userImageView.layer.cornerRadius = 5
userImageView.clipsToBounds = true
nameLabel.text = user.name
screenNameLabel.text = user.screenName
descriptionLabel.text = user.tagLine
tweetsCountLabel.text = user.tweetsString
followingCountLabel.text = user.followingString
followersCountLabel.text = user.followersString
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Compose stuff
let composeVC = segue.destination as! ComposeViewController
composeVC.startingText = "@\(user.screenName)"
}
}
| 31.096774 | 71 | 0.687759 |
53cccf3d22296163f628c9a801497fb2d27fa60e | 481 | java | Java | blank_template/src/main/java/frc/robot/Ports.java | frc6357/RobotCode2020 | 13d2b78c3f54d031060cd825a080e9a6d4bb3745 | [
"MIT"
] | null | null | null | blank_template/src/main/java/frc/robot/Ports.java | frc6357/RobotCode2020 | 13d2b78c3f54d031060cd825a080e9a6d4bb3745 | [
"MIT"
] | null | null | null | blank_template/src/main/java/frc/robot/Ports.java | frc6357/RobotCode2020 | 13d2b78c3f54d031060cd825a080e9a6d4bb3745 | [
"MIT"
] | 1 | 2020-10-27T00:29:29.000Z | 2020-10-27T00:29:29.000Z | /**
* Definitions of all hardware connections and hardware-related
* IDs on the robot. This class should be included in any other
* class which needs to interact with the robot hardware. The
* values here form part of the robot's control system configuration
* specification.
*/
package frc.robot;
public class Ports
{
// ***************************
// I2C device addresses
// ***************************
public static final int i2cColorSensor = 0x52;
} | 28.294118 | 68 | 0.632017 |
fb97561e8fcfb99cebd80abd62e40ed617d29ed2 | 4,118 | java | Java | Wawaji-Server-AppServer/appdemo-server/demo-common/src/main/java/com/netease/mmc/demo/common/mybatis/generator/extend/MysqlCommentGenerator.java | netease-im/Wawaji | 8f6b6d118aad6fa6eb86416eeba70dcc94029727 | [
"MIT"
] | 57 | 2017-12-04T05:54:59.000Z | 2021-03-24T07:43:21.000Z | Quiz-Server-AppServer/appdemo-server/demo-common/src/main/java/com/netease/mmc/demo/common/mybatis/generator/extend/MysqlCommentGenerator.java | netease-im/Quiz | 56a127d2e37369a1521f8969df99e7dba947fd06 | [
"MIT"
] | 9 | 2019-11-13T02:37:21.000Z | 2021-03-22T23:37:16.000Z | Wawaji-Server-AppServer/appdemo-server/demo-common/src/main/java/com/netease/mmc/demo/common/mybatis/generator/extend/MysqlCommentGenerator.java | netease-im/Wawaji | 8f6b6d118aad6fa6eb86416eeba70dcc94029727 | [
"MIT"
] | 46 | 2017-12-04T06:40:14.000Z | 2021-03-24T08:00:18.000Z | package com.netease.mmc.demo.common.mybatis.generator.extend;
import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.java.Field;
import org.mybatis.generator.api.dom.java.InnerClass;
import org.mybatis.generator.api.dom.java.InnerEnum;
import org.mybatis.generator.api.dom.java.JavaElement;
import org.mybatis.generator.api.dom.java.Method;
import org.mybatis.generator.api.dom.java.TopLevelClass;
import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.internal.DefaultCommentGenerator;
import org.mybatis.generator.internal.util.StringUtility;
/**
* MysqlCommentGenerator
*
* @author hzzhanghan
* @date 2016-09-20 18:14
* @since 1.0
*/
public class MysqlCommentGenerator extends DefaultCommentGenerator {
private boolean suppressAllComments = false;
@Override
public void addComment(XmlElement xmlElement) {
}
@Override
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable) {
}
@Override
public void addModelClassComment(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
if (!this.suppressAllComments) {
topLevelClass.addJavaDocLine("/**");
topLevelClass.addJavaDocLine(" * This class corresponds to the database table " + introspectedTable.getFullyQualifiedTable());
String remarks = introspectedTable.getRemarks();
if (StringUtility.stringHasValue(remarks)) {
topLevelClass.addJavaDocLine(" * Database Table Remarks : ");
String[] remarkLines = remarks.split(System.getProperty("line.separator"));
for (String remarkLine : remarkLines) {
topLevelClass.addJavaDocLine(" * " + remarkLine);
}
}
topLevelClass.addJavaDocLine(" */");
}
}
@Override
public void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable) {
}
@Override
public void addFieldComment(Field field, IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
if (!this.suppressAllComments) {
field.addJavaDocLine("/**");
field.addJavaDocLine(" * Database Table : " + introspectedTable.getFullyQualifiedTable() + "; ");
field.addJavaDocLine(" * Database Column : " + introspectedColumn.getActualColumnName() + "; ");
String remarks = introspectedColumn.getRemarks();
if (StringUtility.stringHasValue(remarks)) {
field.addJavaDocLine(" * Database Column Remarks : ");
String[] sb = remarks.split(System.getProperty("line.separator"));
for (String remarkLine : sb) {
field.addJavaDocLine(" * " + remarkLine);
}
}
field.addJavaDocLine(" */");
}
}
@Override
public void addFieldComment(Field field, IntrospectedTable introspectedTable) {
}
@Override
public void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable) {
}
@Override
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete) {
if (!this.suppressAllComments) {
innerClass.addJavaDocLine("/**");
innerClass.addJavaDocLine(
" * This class corresponds to the database table " + introspectedTable.getFullyQualifiedTable());
this.addJavadocTag(innerClass, markAsDoNotDelete);
innerClass.addJavaDocLine(" */");
}
}
@Override
public void addGetterComment(Method method, IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
}
@Override
public void addSetterComment(Method method, IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
}
@Override
protected void addJavadocTag(JavaElement javaElement, boolean markAsDoNotDelete) {
}
}
| 38.12963 | 138 | 0.681156 |
b981a50724959dcc37d56532c6285ccd1dee2003 | 128 | h | C | ross/models/tcp-ip/ip.h | wilseypa/ROSS | c7f94e97238902b37ae01e30224de4ed4909435b | [
"BSD-3-Clause"
] | null | null | null | ross/models/tcp-ip/ip.h | wilseypa/ROSS | c7f94e97238902b37ae01e30224de4ed4909435b | [
"BSD-3-Clause"
] | null | null | null | ross/models/tcp-ip/ip.h | wilseypa/ROSS | c7f94e97238902b37ae01e30224de4ed4909435b | [
"BSD-3-Clause"
] | null | null | null | #ifndef INC_ip_h
#define INC_ip_h
#include <ross.h>
#include "tcp-ip.h"
#include "ip-types.h"
#include "ip-extern.h"
#endif
| 10.666667 | 22 | 0.695313 |
808570ec8c0d9c90fcb9e30092fafac4981d2012 | 591 | java | Java | app/src/main/java/com/google/android/gms/gcm/zzb.java | renyuanceshi/KingKingRE | b15295bec2cee47867b786dbe0841c1a4edaff5e | [
"Unlicense"
] | null | null | null | app/src/main/java/com/google/android/gms/gcm/zzb.java | renyuanceshi/KingKingRE | b15295bec2cee47867b786dbe0841c1a4edaff5e | [
"Unlicense"
] | null | null | null | app/src/main/java/com/google/android/gms/gcm/zzb.java | renyuanceshi/KingKingRE | b15295bec2cee47867b786dbe0841c1a4edaff5e | [
"Unlicense"
] | null | null | null | package com.google.android.gms.gcm;
import android.support.annotation.NonNull;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
final class zzb implements ThreadFactory {
private final AtomicInteger zzbfH = new AtomicInteger(1);
zzb(GcmTaskService gcmTaskService) {
}
public final Thread newThread(@NonNull Runnable runnable) {
Thread thread = new Thread(runnable, new StringBuilder(20).append("gcm-task#").append(this.zzbfH.getAndIncrement()).toString());
thread.setPriority(4);
return thread;
}
}
| 31.105263 | 136 | 0.739425 |
d34d33d1002d457a5ef8d01696aabfeea1470f91 | 6,418 | dart | Dart | organo_india-master/lib/screens/farmers/create_bid_view.dart | abhishekprofcyma/orango_india | 3e39e502020b6cc2b46a0b380546e308b4a81bb3 | [
"BSD-3-Clause"
] | null | null | null | organo_india-master/lib/screens/farmers/create_bid_view.dart | abhishekprofcyma/orango_india | 3e39e502020b6cc2b46a0b380546e308b4a81bb3 | [
"BSD-3-Clause"
] | null | null | null | organo_india-master/lib/screens/farmers/create_bid_view.dart | abhishekprofcyma/orango_india | 3e39e502020b6cc2b46a0b380546e308b4a81bb3 | [
"BSD-3-Clause"
] | null | null | null | import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:organo_india/screens/widgets/custom_app_bar_view.dart';
import 'package:organo_india/screens/widgets/organo_button.dart';
import 'package:organo_india/screens/widgets/organo_edittext.dart';
import '../../constants.dart';
class CreateBidView extends StatefulWidget {
@override
_CreateBidViewState createState() => _CreateBidViewState();
}
class _CreateBidViewState extends State<CreateBidView> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: [
createBid(),
cropInformation(),
SizedBox(height: 16,),
coaInformation(),
SizedBox(height: 16,),
farmerInformation(),
SizedBox(height: 16,),
buttons(),
SizedBox(height: 16,),
],
),
),
);
}
Widget createBid(){
return Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
Row(
children: [
Icon(Icons.arrow_back_ios),
SizedBox(width: 8,),
Text("Create Bid",style: TextStyle(color: Color(0xff2D2B2B),fontSize: 20,fontWeight: FontWeight.bold),)
],
),
Spacer(),
ElevatedButton(
onPressed: () => Navigator.pushNamed(context, '/my_bid'),
child: Text(
"My Bids",
style: Theme.of(context)
.textTheme
.headline6?.copyWith(color: Colors.white),
),
)
],
),
);
}
Widget cropInformation(){
return Container(
margin: const EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 16,vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: Offset(1,1),
spreadRadius: 2
)
]
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
children: [
Row(
children: [
Text("Crop Information",style: TextStyle(decoration: TextDecoration.underline,fontSize: 20),),
],
),
OrganoEditTextView(hint: "Crop Name*",),
OrganoEditTextView(hint: "Grade",),
OrganoEditTextView(hint: "Qty",),
OrganoEditTextView(hint: "Qty (Metric Ton)*",),
OrganoEditTextView(hint: "MSP",),
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SvgPicture.asset("assets/icons/ic_arrow_up.svg"),
SizedBox(height: 16,),
SvgPicture.asset("assets/icons/ic_image_picker.svg"),
SizedBox(height: 16,),
SvgPicture.asset("assets/icons/ic_arrow_down.svg")
],
)
],
),
);
}
Widget coaInformation(){
return Container(
margin: const EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 16,vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: Offset(1,1),
spreadRadius: 2
)
]
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("COA",style: TextStyle(decoration: TextDecoration.underline,fontSize: 20),),
SvgPicture.asset("assets/icons/ic_arrow_up.svg")
],
),
OrganoEditTextView(hint: "Moisture",),
OrganoEditTextView(hint: "Color",),
OrganoEditTextView(hint: "Extraneous Matter",),
OrganoEditTextView(hint: "Broken Percentage",),
OrganoEditTextView(hint: "Purity",),
Row(
children: [
Expanded(child: OrganoEditTextView(hint: "Varity",)),
SvgPicture.asset("assets/icons/ic_plus_circle.svg",height: 20,),
SizedBox(width: 8,),
SvgPicture.asset("assets/icons/ic_close_circle.svg",height: 20,),
],
),
],
),
);
}
Widget farmerInformation(){
return Container(
margin: const EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 16,vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: Offset(1,1),
spreadRadius: 2
)
]
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Farmer Information",style: TextStyle(decoration: TextDecoration.underline,fontSize: 20),),
SvgPicture.asset("assets/icons/ic_arrow_up.svg")
],
),
OrganoEditTextView(hint: "Name",),
OrganoEditTextView(hint: "Address",),
OrganoEditTextView(hint: "Pin code",),
OrganoEditTextView(hint: "State",),
OrganoEditTextView(hint: "District",),
OrganoEditTextView(hint: "Tehsil",),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextButton(onPressed: (){}, child: Text("KYC")),
],
)
],
),
);
}
Widget buttons(){
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
OrganoButtonView(text: "Submit", onclick: (){},isFilled: true,),
OrganoButtonView(text: "Cancel", onclick: (){}),
],
);
}
}
| 31.772277 | 117 | 0.540511 |
53e1382e6b0b2238a9fecca0bfbac23f41bd9139 | 1,075 | asm | Assembly | asm/jp_dos_room_test.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 70 | 2017-02-25T15:06:47.000Z | 2022-03-16T03:05:35.000Z | asm/jp_dos_room_test.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 58 | 2017-03-12T21:34:50.000Z | 2022-01-31T17:22:36.000Z | asm/jp_dos_room_test.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 26 | 2017-03-04T16:35:13.000Z | 2021-11-24T20:52:19.000Z | .nds
.relativeinclude on
.erroronwarning on
.open "ftc/arm9.bin", 02000000h
.org 0x0203E534
push r1, r14
mov r0, 4h
bl 0203BF88h ; Set the top screen to 4 (cross with bat wings).
mov r0, 0h ; Save file 0.
bl 02010C1Ch ; Load a save file.
ldr r1, =020F6E97h
mov r0, 0h
strb r0, [r1] ; unknown value we have to set for it to load. TODO: look into this
ldr r1, =020F72F6h ; Game mode.
strb r0, [r1] ; Must set to 0 in case it's 3 in the save file.
ldr r1, =020F70A8h
mov r0, 07h
strb r0, [r1] ; Sector index, 020F70A8
mov r0, 05h
strb r0, [r1, 1h] ; Room index, 020F70A9
; Next set the x,y position in the room (default is 80,60).
; The reason for the extra 1 subpixel is so the assembler doesn't optimize these ldr statements into mov statements. If it did that then DSVEdit couldn't change the position at runtime.
ldr r0, =80001h
str r0, [r1, 10h] ; X pos, 020F70B8
ldr r0, =60001h
str r0, [r1, 14h] ; Y pos, 020F70BC
mov r0, 0h ; Return 0 so the state manager sets the state to 0 (loading a save).
pop r1, r15
.pool
.close
| 31.617647 | 187 | 0.68093 |
d7ee83487d6bda9decba19822d93132131fee683 | 601 | sql | SQL | coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/RELEASE-SCRIPTS/KC-RELEASE-3_1_SP1-SCRIPT/ORACLE/CONSTRAINTS/FK_VALID_PROTO_ACTION_ACTION.sql | smith750/kc | e411ed1a4f538a600e04f964a2ba347f5695837e | [
"ECL-2.0"
] | null | null | null | coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/RELEASE-SCRIPTS/KC-RELEASE-3_1_SP1-SCRIPT/ORACLE/CONSTRAINTS/FK_VALID_PROTO_ACTION_ACTION.sql | smith750/kc | e411ed1a4f538a600e04f964a2ba347f5695837e | [
"ECL-2.0"
] | null | null | null | coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/RELEASE-SCRIPTS/KC-RELEASE-3_1_SP1-SCRIPT/ORACLE/CONSTRAINTS/FK_VALID_PROTO_ACTION_ACTION.sql | smith750/kc | e411ed1a4f538a600e04f964a2ba347f5695837e | [
"ECL-2.0"
] | null | null | null | ALTER TABLE VALID_PROTO_ACTION_ACTION ADD
( CONSTRAINT FK_VALID_PROTO_ACTION_ACTION_2
FOREIGN KEY(FOLLOWUP_ACTION_CODE)
REFERENCES PROTOCOL_ACTION_TYPE(PROTOCOL_ACTION_TYPE_CODE)
);
ALTER TABLE VALID_PROTO_ACTION_ACTION ADD
( CONSTRAINT FK_VALID_PROTO_ACTION_ACTION
FOREIGN KEY(PROTOCOL_ACTION_TYPE_CODE)
REFERENCES PROTOCOL_ACTION_TYPE(PROTOCOL_ACTION_TYPE_CODE)
);
ALTER TABLE VALID_PROTO_ACTION_ACTION ADD (
CONSTRAINT FK_VALID_PROTO_ACTION_ACTION_3
FOREIGN KEY (COMM_DECISION_MOTION_TYPE_CODE)
REFERENCES COMM_DECISION_MOTION_TYPE (COMM_DECISION_MOTION_TYPE_CODE)
);
| 33.388889 | 74 | 0.851913 |
2a15a638de007b003fcc7effa40323a6d8d53d47 | 3,322 | java | Java | app/src/main/java/com/recyclegrid/app/FriendRequestsActivity.java | recyclegrid/recyclegrid-android | cb46640d8dbd8ba5c575ac2028e60323d5064246 | [
"MIT"
] | null | null | null | app/src/main/java/com/recyclegrid/app/FriendRequestsActivity.java | recyclegrid/recyclegrid-android | cb46640d8dbd8ba5c575ac2028e60323d5064246 | [
"MIT"
] | null | null | null | app/src/main/java/com/recyclegrid/app/FriendRequestsActivity.java | recyclegrid/recyclegrid-android | cb46640d8dbd8ba5c575ac2028e60323d5064246 | [
"MIT"
] | null | null | null | package com.recyclegrid.app;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.recyclegrid.adapters.FriendRequestsListAdapter;
import com.recyclegrid.core.FriendRequestModel;
import com.recyclegrid.database.SQLiteDataContext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FriendRequestsActivity extends AppCompatActivity {
private ListView _friendRequestsList;
private SQLiteDataContext _db;
private RequestQueue _requests;
private Toast _toast;
private Context _context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_friends_requests);
_db = new SQLiteDataContext(this);
_context = this;
_requests = Volley.newRequestQueue(_context);
_toast = new Toast((AppCompatActivity) _context);
_friendRequestsList = findViewById(R.id.list_friend_requests);
String url = getString(R.string.base_api_url) + "/friends/getrequests";
JsonObjectRequest searchUsersRequest = new JsonObjectRequest(url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
List<FriendRequestModel> friends = new ArrayList<>();
JSONArray searchResults = response.optJSONArray("FriendRequests");
if (searchResults != null && searchResults.length() > 0) {
for (int i = 0; i < searchResults.length(); i++) {
try {
friends.add(new FriendRequestModel(searchResults.getJSONObject(i).getLong("Id"),
searchResults.getJSONObject(i).getLong("UserId"),
searchResults.getJSONObject(i).getString("Name"),
searchResults.getJSONObject(i).getString("ProfilePictureUrl")));
} catch (JSONException e) {
e.printStackTrace();
}
}
_friendRequestsList.setAdapter(new FriendRequestsListAdapter(_context, friends));
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
_toast.showError(R.string.error_response_default);
error.printStackTrace();
}
})
{
@Override
public Map<String, String> getHeaders(){
String token = _db.getUserToken("RecycleGrid");
Map<String, String> params = new HashMap<String, String>();
params.put("Authorization", "Bearer " + token);
return params;
}
};
_requests.add(searchUsersRequest);
}
}
| 36.505495 | 117 | 0.630042 |
10e70ff12951b38b6339f569c3cd709d401c8071 | 462 | asm | Assembly | src/firmware-tests/Platform/Buttons/Initialisation/InitialisationChainTest.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | 1 | 2019-12-12T09:07:08.000Z | 2019-12-12T09:07:08.000Z | src/firmware-tests/Platform/Buttons/Initialisation/InitialisationChainTest.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | null | null | null | src/firmware-tests/Platform/Buttons/Initialisation/InitialisationChainTest.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | null | null | null | #include "Platform.inc"
#include "FarCalls.inc"
#include "Buttons.inc"
#include "TestFixture.inc"
#include "../InitialiseAfterButtonsMock.inc"
radix decimal
InitialisationChainTest code
global testArrange
testArrange:
fcall initialiseInitialiseAfterButtonsMock
testAct:
fcall initialiseButtons
testAssert:
banksel calledInitialiseAfterButtons
.assert "calledInitialiseAfterButtons != 0, 'Next initialiser in chain was not called.'"
return
end
| 19.25 | 89 | 0.800866 |
17105283250ccd354667387fd3c600dc174f152f | 1,048 | c | C | include/libmlx/src/ft_set_string.c | W2Codam/FDF | 4dcbaf330b1d81ba1f3453321659cb9967833982 | [
"MIT"
] | null | null | null | include/libmlx/src/ft_set_string.c | W2Codam/FDF | 4dcbaf330b1d81ba1f3453321659cb9967833982 | [
"MIT"
] | null | null | null | include/libmlx/src/ft_set_string.c | W2Codam/FDF | 4dcbaf330b1d81ba1f3453321659cb9967833982 | [
"MIT"
] | null | null | null | /* ************************************************************************** */
/* */
/* :::::::: */
/* ft_set_string.c :+: :+: */
/* +:+ */
/* By: lde-la-h <lde-la-h@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2021/10/27 18:41:55 by lde-la-h #+# #+# */
/* Updated: 2021/10/28 00:09:59 by lde-la-h ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libmlx.h"
void ft_set_string(t_mlx *mlx, t_point pos, int color, char *text)
{
mlx_string_put(mlx->mlx, mlx->win, pos.x, pos.y, color, text);
}
| 55.157895 | 80 | 0.204198 |
497cddb06cf48782762a6ddc3b5ab59c39eda86a | 2,591 | html | HTML | application/admin/view/admin_group/menu_list.html | babyface201008/xinglinhall | 7ba430d8379ca9c9d74d75fdfd0e9b9944fd5780 | [
"Apache-2.0"
] | null | null | null | application/admin/view/admin_group/menu_list.html | babyface201008/xinglinhall | 7ba430d8379ca9c9d74d75fdfd0e9b9944fd5780 | [
"Apache-2.0"
] | null | null | null | application/admin/view/admin_group/menu_list.html | babyface201008/xinglinhall | 7ba430d8379ca9c9d74d75fdfd0e9b9944fd5780 | [
"Apache-2.0"
] | null | null | null |
<input type="text" hidden name="groupid" value="{$group.groupid}" >
<input type="hidden" hidden name="groupname" value="{$group.groupname}" >
<div style='padding:8px; color: red'>
角色名称:{$group.groupname}
</div>
<table class='setmenu-table' cellpadding="5" class='d' style='border:1px solid #ededed;width:100%' >
<tr >
<td>权限列表:</td>
<td></td>
</tr>
{foreach name="$menu" item="v"}
<tr>
<td>
<span><input id="menu{$v.menuid}" {if condition="in_array($v.menuid,$menurole)" } checked {/if} name='menuids[]' type="checkbox" value="{$v.menuid}" ><label for="menu{$v.menuid}" >{$v.menuname}</label></span>
</td>
<td>
<ul class='menu_list_ul' style='list-style:none'>
{if condition="!empty($v['children'])"}
{foreach name="$v['children']" key=key item="val" }
<li><input id="menu{$val.menuid}" name='menuids[]' {if condition="in_array($v.menuid,$menurole)"} checked {/if} value="{$val.menuid}" type="checkbox"><label for="menu{$val.menuid}">{$val.menuname}</label></li>
{/foreach}
{/if}
</ul>
</td>
</tr>
{/foreach}
</table>
<script>
$('.setmenu-table label').css({cursor:'pointer'})//设置label鼠标手指
$('.setmenu-table td').css({padding:'5px',margin:0}); //设置td的内,外边距
//设置li样式
setTimeout(function(){
var wid = $('.setmenu-table').find('td:last').width();
$('.menu_list_ul').find('li').css({
float:'left',
width:Math.floor(wid/4)+'px'
});
},1);
$('.setmenu-table').find('tr:gt(0)').each(function(){
var $t = $(this);
$t.find('ul').css({padding:0,margin:0})//设置ul内,外边距
//设置每行第一个td样式
var tdboss = $t.children('td:eq(0)').css({
borderRight:"1px solid #ededed",
width:'100px',
});
var tdnext = $t.children('td:eq(1)'); //第二个td
var inputBoss = this.getElementsByTagName('input')[0];//第一个td的input
var inputNext = tdnext.find('input');//第二个td里面的input
// changeChecked();//初始化checkbox选中状态
inputNext.each(function(){
this.disabled = !inputBoss.checked;//可选
// this.checked = inputBoss.checked;
});
//父类菜单 单击改变状态 选中/不选中
tdboss.find('span').click(function(){
changeChecked();
});
//改变checkbox选中状态
function changeChecked(){
inputNext.each(function(){
this.disabled = !inputBoss.checked;//可选
this.checked = inputBoss.checked;
});
}
});
</script>
| 32.3875 | 214 | 0.544963 |
bfd9ad91559d63bd5e04391f783a4429aa421d5b | 464 | kt | Kotlin | test_runner/src/main/kotlin/ftl/reports/xml/model/SkippedTestJUnitTestSuite.kt | CristianGM/flank | 53678d9d8831a6ebaf1f23d5bb63ac1b812745d7 | [
"Apache-2.0"
] | 2 | 2021-01-30T19:45:50.000Z | 2021-06-15T14:18:57.000Z | test_runner/src/main/kotlin/ftl/reports/xml/model/SkippedTestJUnitTestSuite.kt | CristianGM/flank | 53678d9d8831a6ebaf1f23d5bb63ac1b812745d7 | [
"Apache-2.0"
] | 119 | 2020-10-04T14:42:50.000Z | 2021-03-01T13:33:56.000Z | test_runner/src/main/kotlin/ftl/reports/xml/model/SkippedTestJUnitTestSuite.kt | pawelpasterz/flank | 899340f8bfea81decbe9c7ee310d9becedef52d3 | [
"Apache-2.0"
] | null | null | null | package ftl.reports.xml.model
import ftl.reports.api.utcDateFormat
import java.util.Date
fun getSkippedJUnitTestSuite(listOfJUnitTestCase: List<JUnitTestCase>) = JUnitTestSuite(
name = "junit-ignored",
tests = listOfJUnitTestCase.size.toString(),
errors = "0",
failures = "0",
skipped = listOfJUnitTestCase.size.toString(),
time = "0.0",
timestamp = utcDateFormat.format(Date()),
testcases = listOfJUnitTestCase.toMutableList()
)
| 29 | 88 | 0.726293 |
b2b2407d4c36f7d2b4d5556ee9ab15297445f03f | 5,121 | py | Python | WCET_stats.py | FTOD/ZExp | f7e2e1ab3ce1964022cb1c5d8c9d0b1ce1ee7b56 | [
"MIT"
] | null | null | null | WCET_stats.py | FTOD/ZExp | f7e2e1ab3ce1964022cb1c5d8c9d0b1ce1ee7b56 | [
"MIT"
] | null | null | null | WCET_stats.py | FTOD/ZExp | f7e2e1ab3ce1964022cb1c5d8c9d0b1ce1ee7b56 | [
"MIT"
] | null | null | null | import parsetools
from benchDesc import benchsDesc
import matplotlib.pyplot as plt
import matplotlib
import getopt, sys
try:
opts, args = getopt.getopt(sys.argv[1:], "h", ["arch="])
except getopt.GetoptError as err:
print(err)
sys.exit(2)
file_postfix = ""
for o,a in opts:
if o == "--arch":
if a == "simple":
file_postfix = file_postfix + "_simple"
elif a == "complex":
file_postfix = file_postfix + "_complex"
else:
print ("ERROR, the architecture must be either simple or complex")
p = parsetools.BoundedEventsCountParser()
res = p.parse_all_files("../log_2020_09/log")
res = benchsDesc.regrouping_parallel_res(res)
bounded_count = res
print("BOUNDED=", bounded_count)
p = parsetools.UnboundedEventsCountParser()
res = p.parse_all_files("../log_2020_09/log")
res = benchsDesc.regrouping_parallel_res(res)
unbounded_count = res
print("UNBOUNDED=", unbounded_count)
p = parsetools.WcetResParser()
res = p.parse_all_files("../log_2020_09/log_xddilp_15"+file_postfix)
res = benchsDesc.regrouping_parallel_res(res)
wcet_xdd = res
#add a single result
print(res)
print(len(res))
p = parsetools.WcetResParser()
res = p.parse_all_files("../log_2020_09/log_hlts_15"+file_postfix)
res = benchsDesc.regrouping_parallel_res(res)
wcet_hlts = res
print(res)
print(len(res))
p = parsetools.WcetResParser()
res = p.parse_all_files("../log_2020_09/log_WCETmax_15"+file_postfix)
res = benchsDesc.regrouping_parallel_res(res)
wcet_max = res
print(res)
print(len(res))
p = parsetools.WcetResParser()
res = p.parse_all_files("../log_2020_09/log_exhaustive_15"+file_postfix)
res = benchsDesc.regrouping_parallel_res(res)
wcet_exhau = res
print(res)
print(len(res))
x = list(range(1,len(res)+1))
print(x)
print("=======================================================")
BIGGER_SIZE = 11
BIGGER_BIGGER_SIZE=15
matplotlib.rc('font', size=BIGGER_SIZE) # controls default text sizes
matplotlib.rc('axes', titlesize=BIGGER_SIZE) # fontsize of the axes title
matplotlib.rc('axes', labelsize=BIGGER_SIZE) # fontsize of the x and y labels
matplotlib.rc('xtick', labelsize=BIGGER_SIZE) # fontsize of the tick labels
matplotlib.rc('ytick', labelsize=BIGGER_SIZE) # fontsize of the tick labels
matplotlib.rc('legend', fontsize=BIGGER_BIGGER_SIZE) # legend fontsize
matplotlib.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title
fig = plt.figure()
#unbound_ratio = [ float(x[1]) / float(x[1]+y[1]) for x,y in zip(unbounded_count,bounded_count)]
unbound_ratio = [( x[0], float(x[1]) / float(x[1]+y[1]) ) for x,y in zip(unbounded_count,bounded_count)]
unbound_ratio.sort(key = lambda i:i[1])
print("***************************")
print(unbound_ratio)
print("***************************")
label_order = [x[0] for x in unbound_ratio]
print(label_order)
unbound_ratio = [x[1] for x in unbound_ratio]
wcet_xdd.sort(key = lambda i: label_order.index(i[0]))
wcet_hlts.sort(key = lambda i: label_order.index(i[0]))
wcet_max.sort(key = lambda i: label_order.index(i[0]))
wcet_exhau.sort(key = lambda i: label_order.index(i[0]))
wcet_xdd = [x[1] for x in wcet_xdd]
wcet_hlts = [x[1] for x in wcet_hlts]
wcet_max = [x[1] for x in wcet_max]
wcet_exhau = [x[1] for x in wcet_exhau]
wcet_xdd = [(y-x)/y for x,y in zip(wcet_xdd,wcet_max)]
wcet_hlts = [(y-x)/y for x,y in zip(wcet_hlts,wcet_max)]
## Rounding, due to imprecision of Etime
wcet_hlts = [ 0.0 if x < 0.0 else x for x in wcet_hlts ]
wcet_exhau = [(y-x)/y for x,y in zip(wcet_exhau,wcet_max)]
print("=======================================================")
print(wcet_xdd)
print(len(res))
print("=======================================================")
print(wcet_exhau)
print(len(res))
print("=======================================================")
print(wcet_hlts)
print(len(res))
ax = fig.add_subplot(111)
width = 0.2
ax.bar([y-width for y in x],wcet_xdd,label='xdd',width=width, color ="1.0" , edgecolor='black')
ax.bar([y for y in x],wcet_exhau,label='exhaustive',width=width, color = "0.7", edgecolor='black')
ax.bar([y+width for y in x],wcet_hlts,label='Etime',width=width, color = "0",edgecolor='black')
#ax.bar([y+0.2 for y in x],wcet_max,label='MAX',width=0.5,color='darkgray')
ax.set_ylabel('WCET / WCET of max partitioning',fontsize=12)
#ax.set_xlabel('benchmark',fontsize=12)
ax.set_xticks(x)
ax.set_xticklabels(label_order,rotation=80)
ax.legend(loc='upper left')
#plt.yscale('log')
plt.ylim(top=0.6)
unbound_ratio = [x for x in unbound_ratio]
ax1 = ax.twinx()
ax1.set_ylabel("percentage on unbounded events")
ax1.plot(x,unbound_ratio,'o-',color='black')
plt.subplots_adjust(bottom=0.17,top=0.70,right=0.965,left=0.042)
plt.yticks(fontsize=15)
"""
plt.tick_params(
axis='x', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
bottom=True, # ticks along the bottom edge are off
top=False, # ticks along the top edge are off
labelbottom=False
) # labels along the bottom edge are off
"""
plt.show()
#ax = df.plot.scatter(x='evt',)
| 31.036364 | 104 | 0.670767 |
2f1d154f391df55604ebd4a0fcc5a1ba091971e1 | 866 | java | Java | src/main/java/com/cenboomh/commons/ojdbc/driver/MysqlToOracleDriver.java | gongycn/ojdbc-mysql2oracle | f274bb1c29a7390687d14525baed2d3a52fa477a | [
"Apache-2.0"
] | 16 | 2021-07-08T05:59:21.000Z | 2022-03-25T08:06:21.000Z | src/main/java/com/cenboomh/commons/ojdbc/driver/MysqlToOracleDriver.java | gongycn/ojdbc-mysql2oracle | f274bb1c29a7390687d14525baed2d3a52fa477a | [
"Apache-2.0"
] | 5 | 2021-07-07T07:26:32.000Z | 2022-02-21T06:12:57.000Z | src/main/java/com/cenboomh/commons/ojdbc/driver/MysqlToOracleDriver.java | gongycn/ojdbc-mysql2oracle | f274bb1c29a7390687d14525baed2d3a52fa477a | [
"Apache-2.0"
] | 4 | 2021-09-28T12:11:00.000Z | 2022-03-25T08:06:16.000Z | package com.cenboomh.commons.ojdbc.driver;
import com.cenboomh.commons.ojdbc.wrapper.ConnectionWrapper;
import oracle.jdbc.driver.OracleDriver;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
/**
* @author wuwen
*/
public class MysqlToOracleDriver extends OracleDriver {
private static Driver instance = new MysqlToOracleDriver();
static {
try {
DriverManager.registerDriver(MysqlToOracleDriver.instance);
} catch (SQLException e) {
throw new IllegalStateException("Could not register MysqlToOracleDriver with DriverManager.", e);
}
}
@Override
public Connection connect(String url, Properties info) throws SQLException {
return ConnectionWrapper.wrap(super.connect(url, info));
}
}
| 26.242424 | 109 | 0.727483 |
2c94577d18ae232a54b3bc77ab471cf1a271853e | 23,293 | swift | Swift | ToDoServer/Sources/Application/Application.swift | Andrew-Lees11/PersistentiOSKituraKit | f2ee8e847289555e88fe9aa8541737fd6011f929 | [
"Apache-2.0"
] | null | null | null | ToDoServer/Sources/Application/Application.swift | Andrew-Lees11/PersistentiOSKituraKit | f2ee8e847289555e88fe9aa8541737fd6011f929 | [
"Apache-2.0"
] | null | null | null | ToDoServer/Sources/Application/Application.swift | Andrew-Lees11/PersistentiOSKituraKit | f2ee8e847289555e88fe9aa8541737fd6011f929 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright IBM Corporation 2017
*
* 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.
*/
import Kitura
import KituraCORS
import Foundation
import KituraContracts
import LoggerAPI
import Configuration
import CloudEnvironment
import Health
import SwiftKuery
import SwiftKueryPostgreSQL
import SwiftKueryMySQL
public let projectPath = ConfigurationManager.BasePath.project.path
public let health = Health()
public var port: Int = 8080
public class Application {
let router = Router()
let cloudEnv = CloudEnv()
let todotable = ToDoTable()
// To switch to a PostgreSQL database uncomment `PostgreSQLConnection` and comment out `MySQLConnection`
// let connection = PostgreSQLConnection(host: "localhost", port: 5432, options: [.databaseName("ToDoDatabase")])
let connection = MySQLConnection(user: "swift", password: "kuery", database: "ToDoDatabase", port: 3306)
// Terminal commands to start both databases can be found at the bottom of this file.
func postInit() throws{
// Capabilities
initializeMetrics(app: self)
let options = Options(allowedOrigin: .all)
let cors = CORS(options: options)
router.all("/*", middleware: cors)
// Endpoints
initializeHealthRoutes(app: self)
// ToDoListBackend Routes
router.post("/", handler: createHandler)
router.get("/", handler: getAllHandler)
router.get("/", handler: getOneHandler)
router.delete("/", handler: deleteAllHandler)
router.delete("/", handler: deleteOneHandler)
router.patch("/", handler: updateHandler)
router.put("/", handler: updatePutHandler)
}
public init() throws {
// Configuration
port = cloudEnv.port
}
public func run() throws{
try postInit()
Kitura.addHTTPServer(onPort: port, with: router)
Kitura.run()
}
/**
The createHandler function tells the server how to handle an HTTP POST request. It receives a ToDo object from the client and adds an unique identify and URL. The values from the ToDo object are then inserted into the mySQL database using SwiftKuery and SwiftKueryMySQL. It will return either, a ToDo object, with the RequestError being nil, or a RequestError, with the ToDo object being nil.
*/
func createHandler(todo: ToDo, completion: @escaping (ToDo?, RequestError?) -> Void ) -> Void {
// Set a local ToDo object to equal the ToDo object received from the client.
var todo = todo
// If the received ToDo objects completed is nil set it to false
todo.completed = todo.completed ?? false
// The getNextId() function finds the next unused id number from the database.
// This is assigned to todo and, since it is an option, it is unwrapped using guard.
todo.id = getNextId()
guard let id = todo.id else {return}
todo.url = "http://localhost:8080/\(id)"
// The server connects to the database. If it fails to connect it returns an .internalServerError
connection.connect() { error in
if error != nil {
print("connection error: \(String(describing: error))")
completion(nil, .internalServerError)
return
}
// The insert query requires non-optional values so we unwrap the todo object.
guard let title = todo.title, let user = todo.user, let order = todo.order, let completed = todo.completed, let url = todo.url else {
print("assigning todo error: \(todo)")
return
}
// an SQL insert query is created to insert the todo values into `todotable`.
let insertQuery = Insert(into: todotable, values: [id, title, user, order, completed, url])
// The insert query is executed and any errors are handled
connection.execute(query: insertQuery) { queryResult in
if let queryError = queryResult.asError {
// Something went wrong.
print("insert query error: \(queryError)")
completion(nil, .internalServerError)
return
}
// If there were no errors, the todo has been successfully inserted into the database
// and we return the todo object to indicate success
completion(todo, nil)
}
}
}
/**
The getAllHandler function tells the server how to handle an HTTP GET request when you receive no parameters. It connects to the database, executes a SQL select query to get the todotable from the database and then fills a temporary ToDoStore with all the ToDos. If it has been successful, this function returns this array of ToDos with the requestError being nil. If there has been an error it will return the RequestError and nil for the ToDo array.
*/
func getAllHandler(completion: @escaping ([ToDo]?, RequestError?) -> Void ) -> Void {
// Connect to the database. If this fails return an internalServerError.
connection.connect() { error in
if error != nil {
print("connection error: \(String(describing: error))")
completion(nil, .internalServerError)
return
}
else {
// An SQL select query is created to read everything from the `todotable`.
let selectQuery = Select(from :todotable)
// The select query is executed and the returned results are processed.
connection.execute(query: selectQuery) { queryResult in
// If the queryResult is a result set, iterate through the returned rows.
if let resultSet = queryResult.asResultSet {
// Create a local array of ToDo objects.
var tempToDoStore = [ToDo]()
for row in resultSet.rows {
// The rowToDo function parses a row from the database and returns either a ToDo object or nil is the parsing fails.
guard let currentToDo = self.rowToDo(row: row) else{
completion(nil, .internalServerError)
return
}
// Add the ToDo object to you ToDoStore.
tempToDoStore.append(currentToDo)
}
// If there were no errors, return the ToDoStore containing all the ToDos from the database.
completion(tempToDoStore, nil)
}
else if let queryError = queryResult.asError {
// If the queryResult is an error return .internalServerError
print("select query error: \(queryError)")
completion(nil, .internalServerError)
return
}
}
}
}
}
/**
The getOneHandler function tells the server how to handle an HTTP GET request when you receive an id as a parameter. It creates and executes an SQL select query for the received id to lookup if that id is present in the database. If it has been successful, this function returns the ToDo with the received id and nil for the requestError. If there has been an error it will return the RequestError and nil for the ToDo. If the id is not in the database, it will return nil for the ToDo and .notFound for the Request error.
*/
func getOneHandler(id: Int, completion: @escaping (ToDo?, RequestError?) -> Void ) -> Void {
// Connect to the database. If this fails return an internalServerError.
connection.connect() { error in
if error != nil {
print("connection error: \(String(describing: error))")
return
}
else {
// An SQL select query is created and executed to return the row from the `todotable` where todotable.toDo_id == id.
let selectQuery = Select(from :todotable).where(todotable.toDo_id == id)
connection.execute(query: selectQuery) { queryResult in
// If the ToDo with that id is in the database you will receive on row containing that ToDo. Otherwise the sever response with .notFound.
var foundToDo: ToDo? = nil
if let resultSet = queryResult.asResultSet {
for row in resultSet.rows {
// If the ToDo exists, the foundToDo parses the returned row to a ToDo object.
foundToDo = self.rowToDo(row: row)
}
if foundToDo == nil {
completion(nil, .notFound)
return
}
// If the ToDo is fund it is returned by the server.
completion(foundToDo,nil)
}
else if let queryError = queryResult.asError {
// If the queryResult is an error return .internalServerError
print("select query error: \(queryError)")
completion(nil, .internalServerError)
return
}
}
}
}
}
/**
The deleteAllHandler function tells the server how to handle an HTTP DELETE request when you receive no parameters. It creates and executes an SQL delete query for all values in the `todotable`. If it has been successful, this function returns nil for the requestError. If there has been an error it will return the RequestError.
*/
func deleteAllHandler(completion: @escaping (RequestError?) -> Void ) -> Void {
// Connect to the database. If this fails return an internalServerError.
connection.connect() { error in
if error != nil {
print("connection error: \(String(describing: error))")
completion(.internalServerError)
return
}
else {
// An SQL delete query is created and executed to delete everything from the `todotable`.
let deleteQuery = Delete(from :todotable)
connection.execute(query: deleteQuery) { queryResult in
if let queryError = queryResult.asError {
// If the queryResult is an error return .internalServerError
print("delete query error: \(queryError)")
completion(.internalServerError)
return
}
// If there were no errors, return nil.
completion(nil)
}
}
}
}
/**
The deleteOneHandler function tells the server how to handle an HTTP DELETE request when you receive a ToDo id as the parameter. It creates and executes an SQL delete query for the received id in the `todotable`. If it has been successful, this function returns nil for the requestError. If there has been an error it will return the RequestError.
*/
func deleteOneHandler(id: Int, completion: @escaping (RequestError?) -> Void ) -> Void {
// Connect to the database. If this fails return an internalServerError.
connection.connect() { error in
if error != nil {
print("connection error: \(String(describing: error))")
return
}
else {
// An SQL delete query is created and executed to delete the row from the `todotable` where id equals the received id.
let deleteQuery = Delete(from :todotable).where(todotable.toDo_id == id)
connection.execute(query: deleteQuery) { queryResult in
if let queryError = queryResult.asError {
// If the queryResult is an error return .internalServerError
print("delete one query error: \(queryError)")
completion(.internalServerError)
return
}
// If there were no errors, return nil.
completion(nil)
}
}
}
}
/**
The updateHandler function tells the server how to handle an HTTP PATCH request. It takes a ToDo id as the parameter and a ToDo object which will replace your existing ToDo values. It creates and executes an SQL Select query to get the current values for the ToDo. A new ToDo is then created by replacing the old ToDo values with any of the new ToDo values which are not nil. This updated ToDo is then sent back to the database using an SQL update query which replaces the old row with your new row (Similar to an HTTP PUT request). If this is successful, the server responds with the updated ToDo that was stored in the database and nil for the request error. If it was not successful it responds with the Request error and nil for the ToDo.
*/
func updateHandler(id: Int, new: ToDo, completion: @escaping (ToDo?, RequestError?) -> Void ) -> Void {
var current: ToDo?
// Connect to the database. If this fails return an internalServerError.
connection.connect() { error in
if error != nil {
print("connection error: \(String(describing: error))")
completion(nil, .internalServerError)
return
}
else {
// An SQL select query is created and executed to return the row from the `todotable` where todotable.toDo_id == id.
let selectQuery = Select(from :todotable).where(todotable.toDo_id == id)
connection.execute(query: selectQuery) { queryResult in
// Parse the returned row into a ToDo object
if let resultSet = queryResult.asResultSet {
for row in resultSet.rows {
current = self.rowToDo(row: row)
}
}
else if let queryError = queryResult.asError {
// If the queryResult is an error return .internalServerError
print("update select query error: \(queryError)")
completion(nil, .internalServerError)
return
}
// For each value in ToDo, If the new value is nil use the old value, otherwise replace the old value with the new value and unwrap the optional.
guard var current = current else {return}
current.title = new.title ?? current.title
guard let title = current.title else {return}
current.user = new.user ?? current.user
guard let user = current.user else {return}
current.order = new.order ?? current.order
guard let order = current.order else {return}
current.completed = new.completed ?? current.completed
guard let completed = current.completed else {return}
// Create and execute an update query with the new value to replace the old values with the new values.
let updateQuery = Update(self.todotable, set: [(self.todotable.toDo_title, title),(self.todotable.toDo_user, user),(self.todotable.toDo_order, order),(self.todotable.toDo_completed, completed)]).where(self.todotable.toDo_id == id)
self.connection.execute(query: updateQuery) { queryResult in
if let queryError = queryResult.asError {
// If the queryResult is an error return .internalServerError
print("delete one query error: \(queryError)")
completion(nil, .internalServerError)
return
}
// If there were no errors, return the updated ToDo object.
completion(current, nil)
}
}
}
}
}
/**
The updatePutHandler function tells the server how to handle an HTTP PUT request. It takes a ToDo id as the parameter and a ToDo object which will replace your existing ToDo. A new ToDo is then created with the given id using the received values. This new ToDo is then sent to the database using an SQL update query which replaces the old row with the new row. If this is successful, the server responds with the new ToDo that was stored in the database and nil for the request error. If it was not successful it responds with the Request error and nil for the ToDo.
*/
func updatePutHandler(id: Int, new: ToDo, completion: @escaping (ToDo?, RequestError?) -> Void ) -> Void {
// Connect to the database. If this fails return an internalServerError.
connection.connect() { error in
if error != nil {
print("connection error: \(String(describing: error))")
completion(nil, .internalServerError)
return
}
else {
// Create a new ToDo object from the received ToDo object with the given id.
var current = ToDo(title: nil, user: nil, order: nil, completed: nil)
current.id = id
current.title = new.title
guard let title = current.title else {return}
current.user = new.user
guard let user = current.user else {return}
current.order = new.order
guard let order = current.order else {return}
current.completed = new.completed
guard let completed = current.completed else {return}
current.url = "http://localhost:8080/\(id)"
// Create an execute the update query to replace the old ToDo with the new ToDo.
let updateQuery = Update(self.todotable, set: [(self.todotable.toDo_title, title),(self.todotable.toDo_user, user),(self.todotable.toDo_order, order),(self.todotable.toDo_completed, completed)]).where(self.todotable.toDo_id == id)
self.connection.execute(query: updateQuery) { queryResult in
if let queryError = queryResult.asError {
// If the queryResult is an error return .internalServerError
print("delete one query error: \(queryError)")
completion(nil, .internalServerError)
return
}
// If there were no errors, return the new ToDo object.
completion(current, nil)
}
}
}
}
/**
id is used as the primary key for the database and therefore, must be unique. When the server receives a ToDo it assigns an id and this function getNextId is used to find the next available id to assign. It does this by using a SQL select query to get the max id in the database and then returning the number 1 larger than that.
*/
private func getNextId() -> Int {
var nextId = 0
connection.connect() { error in
if error != nil {
print("get id connection error")
return
}
let maxIdQuery = Select(max(todotable.toDo_id) ,from: todotable)
connection.execute(query: maxIdQuery) { queryResult in
if let resultSet = queryResult.asResultSet {
for row in resultSet.rows {
guard let id = row[0] else{return}
guard let id32 = id as? Int32 else{return}
let idInt = Int(id32)
nextId = idInt + 1
}
}
}
}
return nextId
}
/**
The function rowToDo takes in a row from the todotable and parses it to returns a ToDo object.
*/
private func rowToDo(row: Array<Any?>) -> ToDo? {
// mySQL and PostgreSQL store store Ints as Int 32 and so these must be cast to Int.
guard let id = row[0], let id32 = id as? Int32 else{return nil}
let idInt = Int(id32)
guard let title = row[1], let titleString = title as? String else {return nil}
guard let user = row[2], let userString = user as? String else {return nil}
guard let order = row[3], let orderInt32 = order as? Int32 else {return nil}
let orderInt = Int(orderInt32)
// mySQL stores Bool as an Int8 that is either 0 or 1. PostgreSQL stores Bool as a Bool. To work with both databases we try and cast the Bool value to an Int8 and convert to a Bool. If this fails we assume it is being stored as a Bool and cast as Bool.
guard let completed = row[4] else {return nil}
var completedBool = true
if let completedInt = completed as? Int8 {
if completedInt == 0 {
completedBool = false
}
} else {
guard let completed = completed as? Bool else {return nil}
completedBool = completed
}
guard let url = row[5], let urlString = url as? String else {return nil}
// Once we have retrieved the ToDo values and unwrapped them we create and return our ToDo object.
return ToDo(id: idInt, title: titleString, user: userString, order: orderInt, completed: completedBool, url: urlString)
}
}
//Terminal commands to start mySQL toDoDatabase
//
//mysql_upgrade -uroot || echo "No need to upgrade"
//mysql -uroot -e "CREATE USER 'swift'@'localhost' IDENTIFIED BY 'kuery';"
//mysql -uroot -e "CREATE DATABASE IF NOT EXISTS ToDoDatabase;"
//mysql -uroot -e "GRANT ALL ON ToDoDatabase.* TO 'swift'@'localhost';"
//mysql -uroot
//use ToDoDatabase
//CREATE TABLE toDoTable (
// toDo_id INT NOT NULL,
// toDo_title VARCHAR(50),
// toDo_user VARCHAR(50),
// toDo_order INT,
// toDo_completed BOOLEAN,
// toDo_url VARCHAR(50),
// PRIMARY KEY ( toDo_id )
//);
//Terminal commands to start postgre toDoDatabase
//
//createdb ToDoDatabase
//psql ToDoDatabase
//
//CREATE TABLE toDoTable (
// toDo_id integer primary key,
// toDo_title varchar(50) NOT NULL,
// toDo_user varchar(50) NOT NULL,
// toDo_order integer NOT NULL,
// toDo_completed boolean NOT NULL,
// toDo_url varchar(50) NOT NULL
//);
| 53.302059 | 747 | 0.596059 |
fac36ca990fb09c87f3ef1b892c90aecc60b22bb | 807 | swift | Swift | Sources/MD5.swift | liujunliuhong/Crypto-Swift | 0875e990c4df10680dc53927341d8a24269e7111 | [
"MIT"
] | null | null | null | Sources/MD5.swift | liujunliuhong/Crypto-Swift | 0875e990c4df10680dc53927341d8a24269e7111 | [
"MIT"
] | null | null | null | Sources/MD5.swift | liujunliuhong/Crypto-Swift | 0875e990c4df10680dc53927341d8a24269e7111 | [
"MIT"
] | null | null | null | //
// MD5.swift
// SwiftTool
//
// Created by liujun on 2021/5/28.
// Copyright © 2021 yinhe. All rights reserved.
//
import Foundation
import CommonCrypto
extension Crypto {
public struct MD5 { }
}
extension Crypto.MD5 {
/// MD5
public static func md5(string: String, upper: Bool) -> String {
let ccharArray = string.cString(using: String.Encoding.utf8)
var uint8Array = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
CC_MD5(ccharArray, CC_LONG(ccharArray!.count - 1), &uint8Array)
if upper {
let result = uint8Array.reduce("") { $0 + String(format: "%02X", $1) }
return result
} else {
let result = uint8Array.reduce("") { $0 + String(format: "%02x", $1) }
return result
}
}
}
| 26.032258 | 82 | 0.594796 |
753e4e15fe387ff13dedc1478904bf692568ecd7 | 4,151 | cs | C# | src/Orchard.Web/Modules/Orchard.Layouts/Recipes/Executors/CustomElementsStep.cs | yangbingqi155/Nagrace | 70848088d2bae79fa11773688c0947ee773d76e6 | [
"BSD-3-Clause"
] | 2,670 | 2015-03-31T19:56:42.000Z | 2022-03-30T13:43:29.000Z | src/Orchard.Web/Modules/Orchard.Layouts/Recipes/Executors/CustomElementsStep.cs | yangbingqi155/Nagrace | 70848088d2bae79fa11773688c0947ee773d76e6 | [
"BSD-3-Clause"
] | 8,046 | 2015-04-09T07:57:40.000Z | 2022-03-31T18:07:42.000Z | src/Orchard.Web/Modules/Orchard.Layouts/Recipes/Executors/CustomElementsStep.cs | yangbingqi155/Nagrace | 70848088d2bae79fa11773688c0947ee773d76e6 | [
"BSD-3-Clause"
] | 1,804 | 2015-04-13T22:21:43.000Z | 2022-03-02T15:06:55.000Z | using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.Data;
using Orchard.Layouts.Models;
using Orchard.Logging;
using Orchard.Recipes.Models;
using Orchard.Recipes.Services;
using Orchard.Layouts.Services;
using Orchard.Layouts.Helpers;
using Orchard.ContentManagement;
using Orchard.Layouts.Framework.Drivers;
namespace Orchard.Layouts.Recipes.Executors {
public class CustomElementsStep : RecipeExecutionStep {
private readonly IRepository<ElementBlueprint> _repository;
private readonly IElementManager _elementManager;
private readonly IOrchardServices _orchardServices;
public CustomElementsStep(
IRepository<ElementBlueprint> repository,
IElementManager elementManager,
IOrchardServices orchardServices,
RecipeExecutionLogger logger) : base(logger) {
_repository = repository;
_elementManager = elementManager;
_orchardServices = orchardServices;
}
public override string Name {
get { return "CustomElements"; }
}
public override IEnumerable<string> Names {
get { return new[] { Name, "LayoutElements" }; }
}
public override void Execute(RecipeExecutionContext context)
{
var blueprintEntries = context.RecipeStep.Step.Elements().Select(xmlBlueprint => {
var typeName = xmlBlueprint.Attribute("ElementTypeName").Value;
Logger.Information("Importing custom element '{0}'.", typeName);
try {
var blueprint = GetOrCreateElement(typeName);
blueprint.BaseElementTypeName = xmlBlueprint.Attribute("BaseElementTypeName").Value;
blueprint.ElementDisplayName = xmlBlueprint.Attribute("ElementDisplayName").Value;
blueprint.ElementDescription = xmlBlueprint.Attribute("ElementDescription").Value;
blueprint.ElementCategory = xmlBlueprint.Attribute("ElementCategory").Value;
blueprint.BaseElementState = xmlBlueprint.Element("BaseElementState").Value;
var describeContext = DescribeElementsContext.Empty;
var descriptor = _elementManager.GetElementDescriptorByTypeName(describeContext, blueprint.BaseElementTypeName);
var baseElement = _elementManager.ActivateElement(descriptor);
baseElement.Data = ElementDataHelper.Deserialize(blueprint.BaseElementState);
baseElement.ExportableData = ElementDataHelper.Deserialize(xmlBlueprint.Attribute("BaseExportableData").Value);
return new { Blueprint = blueprint, BaseElement = baseElement };
}
catch (Exception ex) {
Logger.Error(ex, "Error while importing custom element '{0}'.", typeName);
throw;
}
}).ToList();
var baseElements = blueprintEntries.Select(e => e.BaseElement).ToList();
var importContentSession = new ImportContentSession(_orchardServices.ContentManager);
var importLayoutContext = new ImportLayoutContext {
Session = new ImportContentSessionWrapper(importContentSession)
};
_elementManager.Importing(baseElements, importLayoutContext);
_elementManager.Imported(baseElements, importLayoutContext);
_elementManager.ImportCompleted(baseElements, importLayoutContext);
foreach (var blueprintEntry in blueprintEntries)
blueprintEntry.Blueprint.BaseElementState = blueprintEntry.BaseElement.Data.Serialize();
}
private ElementBlueprint GetOrCreateElement(string typeName) {
var element = _repository.Get(x => x.ElementTypeName == typeName);
if (element == null) {
element = new ElementBlueprint {
ElementTypeName = typeName
};
_repository.Create(element);
}
return element;
}
}
}
| 41.929293 | 132 | 0.649241 |
25de5aaa4c5a835c230ab59168dbeb077b2b46a0 | 245 | dart | Dart | doc/2/controllers/realtime/count/snippets/count.dart | rafay-tariq/sdk-dart | 978154b6f9095a0a51ed359e50c23bb12ccc379d | [
"MIT"
] | 17 | 2020-05-29T17:41:05.000Z | 2022-02-24T09:51:39.000Z | doc/2/controllers/realtime/count/snippets/count.dart | rafay-tariq/sdk-dart | 978154b6f9095a0a51ed359e50c23bb12ccc379d | [
"MIT"
] | 49 | 2020-05-18T14:12:17.000Z | 2021-11-29T14:36:05.000Z | doc/2/controllers/realtime/count/snippets/count.dart | rafay-tariq/sdk-dart | 978154b6f9095a0a51ed359e50c23bb12ccc379d | [
"MIT"
] | 4 | 2020-10-15T13:24:45.000Z | 2022-01-20T13:26:55.000Z | final roomId = await kuzzle
.realtime
.subscribe(
'nyc-open-data',
'yellow-taxi',
{
'exists': 'name',
},
(notification) {
print(notification);
});
final result = await kuzzle
.realtime
.count(roomId); | 16.333333 | 27 | 0.571429 |
fbcbbd42b8be824214397d723d4d3bf4caed7039 | 3,704 | java | Java | Assignment4/src/QuickSortSubOptimal.java | embasa/cs146 | 4f4794f91c9ced01a26cbce71af925cf6c3515b6 | [
"MIT"
] | null | null | null | Assignment4/src/QuickSortSubOptimal.java | embasa/cs146 | 4f4794f91c9ced01a26cbce71af925cf6c3515b6 | [
"MIT"
] | null | null | null | Assignment4/src/QuickSortSubOptimal.java | embasa/cs146 | 4f4794f91c9ced01a26cbce71af925cf6c3515b6 | [
"MIT"
] | null | null | null | import javax.swing.text.Utilities;
/**
* Created by bruno on 7/12/15.
*/
public class QuickSortSubOptimal extends MySort {
final int CUTOFF = 20;// a value gives improved performances.
public < AnyType extends Comparable< ? super AnyType > > void sort( AnyType[] a ) {
moves = 0;
comparisons = 0;
time = System.currentTimeMillis(); quickSort( a, 0, a.length - 1 ); time = System.currentTimeMillis() - time;
}
/**
* returns the median but also sorts the references so to have sentinel
* values for both i and j.
*
* @param a array of comparables
* @param left left most index
* @param right right most index
* @param <AnyType>
* @return
*/
private < AnyType extends Comparable< ? super AnyType > > AnyType median3( AnyType[] a, int left, int right ) {
int center = ( left + right ) / 2;
if ( a[ center ].compareTo( a[ left ] ) < 0 ) {
swapReferences( a, left, center );
}
if ( a[ right ].compareTo( a[ left ] ) < 0 ) {
swapReferences( a, left, right );
}
if ( a[ right ].compareTo( a[ center ] ) < 0 ) {
swapReferences( a, center, right );
}
swapReferences( a, center, right - 1 );
return a[ right - 1 ];
}
/**
* Recursive call that implements median of 3
* @param a the array of Comparable elements
* @param left furthest left index, included
* @param right furthest right index, included
* @param <AnyType> any arbitrary datatype that implements Comparable
*/
private < AnyType extends Comparable< ? super AnyType > > void quickSort( AnyType[] a, int left, int right ) {
if ( left + CUTOFF <= right ) {
swapReferences(a,left,right);
AnyType pivot = a[right];
int i = left, j = right-1 ;
for (; ; ) {
while ( (i<right) && compare( a[ i ], pivot ) <= 0 ) { i++;}
while ( (j>left) && compare( a[ j ], pivot ) >= 0 ) {j--;}
if ( i < j ) {
swapReferences( a, i, j );
} else {
break;
}
}
swapReferences( a, i, right );
quickSort( a, left, i - 1 );// smaller elements
quickSort( a, i + 1, right );// bigger elements
} else {
insertionSort( a, left, right );
}
}
/**
* This array swaps 2 elements and increments the moves counter
* @param a array of comparables * @param i left index
* @param j right index
* @param <AnyType> comparable type
*/
private < AnyType extends Comparable< ? super AnyType > > void swapReferences( AnyType[] a, int i, int j ) {
moves+=2;
AnyType temp = a[ i ];
a[ i ] = a[ j ];
a[ j ] = temp;
}
/**
* insertion sort for all subarrays of size 10 or less,
* according to textbook this reduces number of comparisons
* by about 14%.
*
* @param a
* @param left furthest left index
* @param right the last usable index on the far right
* @param <AnyType>
*/
public < AnyType extends Comparable< ? super AnyType > > void insertionSort( AnyType[] a, int left, int right ) {
int j;
for ( int p = left + 1; p <= right; p++ ) {
AnyType tmp = a[ p ];
for ( j = p; j > left && compare( tmp, a[ j - 1 ] ) < 0; j-- ) {
a[ j ] = a[ j - 1 ];
moves++;
}
if ( a[ j ] != tmp ) {
a[ j ] = tmp;
moves++;
}
}
}
}
| 32.208696 | 117 | 0.507289 |
4a680d5a187aaa4304fed7015ef28bbcaf474f66 | 502 | cs | C# | OpenTracker.Models/Locations/ILocationDictionary.cs | Baertierchen/OpenTracker | 56ca32bea62141989e7130c2d06ca988eb4353d4 | [
"MIT"
] | 37 | 2020-05-08T22:32:01.000Z | 2022-02-14T00:23:29.000Z | OpenTracker.Models/Locations/ILocationDictionary.cs | Baertierchen/OpenTracker | 56ca32bea62141989e7130c2d06ca988eb4353d4 | [
"MIT"
] | 67 | 2020-05-09T04:10:06.000Z | 2022-03-25T17:45:59.000Z | OpenTracker.Models/Locations/ILocationDictionary.cs | Baertierchen/OpenTracker | 56ca32bea62141989e7130c2d06ca988eb4353d4 | [
"MIT"
] | 7 | 2020-09-04T23:45:12.000Z | 2021-12-07T10:11:00.000Z | using System.Collections.Generic;
using OpenTracker.Models.Reset;
using OpenTracker.Models.SaveLoad;
namespace OpenTracker.Models.Locations
{
/// <summary>
/// This interface contains the <see cref="IDictionary{TKey,TValue}"/> of <see cref="ILocation"/> objects indexed
/// by <see cref="LocationID"/>.
/// </summary>
public interface ILocationDictionary : IDictionary<LocationID, ILocation>, IResettable,
ISaveable<IDictionary<LocationID, LocationSaveData>>
{
}
} | 33.466667 | 117 | 0.715139 |
a19b778e264ccc7265990eacc53c31583d714caf | 1,137 | h | C | brain.h | codextension/neuralnetwork | ea3e59c32908a578f0e4cae53b7ae658306922da | [
"Apache-2.0"
] | null | null | null | brain.h | codextension/neuralnetwork | ea3e59c32908a578f0e4cae53b7ae658306922da | [
"Apache-2.0"
] | null | null | null | brain.h | codextension/neuralnetwork | ea3e59c32908a578f0e4cae53b7ae658306922da | [
"Apache-2.0"
] | null | null | null | //
// Created by elie on 12.03.18.
//
#ifndef NEURALNETWORK_BRAIN_H
#define NEURALNETWORK_BRAIN_H
#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <sstream>
#include <random>
#include "neuron.h"
#include "synapse.h"
#include <typeinfo>
#include "data_holder.h"
using namespace std;
namespace cx {
class brain {
private:
void create_synapses();
public:
vector<float> expected_output_values;
map<int, vector<neuron>> layers;
map<int, vector<synapse>> synapses;
brain(int in_size, int out_size, const vector<int> & hidden_layers_data, bool with_bias);
void load(const data_holder &test_data_holder);
data_holder unload();
map<string, double> actualWeights();
void update_value(const string &neuron_id, double val);
vector<synapse> find_by_neuron_id(const string &neuron_id, bool incoming, int layer_nb);
neuron find_by_id(const string &neuron_id);
void update_synapse(const string &synapseid, int layer_nb, const double &weight);
};
}
#endif //NEURALNETWORK_BRAIN_H
| 21.865385 | 97 | 0.688654 |
5ada8a65396b709e5d3d3c4f858236dafd6b518d | 5,143 | rs | Rust | src/gitlab/repository.rs | cnwangjie/yag | 02c52ce57ec8e577be898670492c0e176925bb6f | [
"MIT"
] | 2 | 2020-12-12T13:59:14.000Z | 2021-03-16T13:10:24.000Z | src/gitlab/repository.rs | cnwangjie/yag | 02c52ce57ec8e577be898670492c0e176925bb6f | [
"MIT"
] | null | null | null | src/gitlab/repository.rs | cnwangjie/yag | 02c52ce57ec8e577be898670492c0e176925bb6f | [
"MIT"
] | null | null | null | use super::client::GitLabClient;
use super::structs::User;
use super::structs::{GitLabResponse, MergeRequest};
use crate::repository::Repository;
use crate::structs::{PaginationResult, PullRequest};
use crate::{profile::load_profile, repository::ListPullRequestOpt};
use anyhow::*;
use async_trait::async_trait;
use git_url_parse::GitUrl;
use log::debug;
use reqwest::Method;
use serde_json::json;
pub struct GitLabRepository {
client: GitLabClient,
project_id: u64,
}
impl GitLabRepository {
pub async fn init(host: &str, remote_url: &GitUrl) -> Result<Self> {
let profile = load_profile().await?;
let token = profile
.get_gitlab_token_by_host(host)
.expect(&format!("unknown remote host: {}", host));
let client = GitLabClient::build(host, &token)?;
let project_id = client.get_project_id(remote_url.fullname.as_ref()).await?;
Ok(GitLabRepository { client, project_id })
}
}
#[async_trait]
impl Repository for GitLabRepository {
async fn get_pull_request(&self, id: usize) -> Result<PullRequest> {
let res = self
.client
.call(
Method::GET,
&format!("/api/v4/projects/{}/merge_requests/{}", self.project_id, id),
)
.send()
.await?;
let text = res.text().await?;
debug!("{:#?}", text);
serde_json::from_str::<GitLabResponse<MergeRequest>>(&text)?
.map(|data| Ok(PullRequest::from(data.to_owned())))
}
async fn list_pull_requests(
&self,
opt: ListPullRequestOpt,
) -> Result<PaginationResult<PullRequest>> {
let mut req = self
.client
.call(
Method::GET,
&format!("/api/v4/projects/{}/merge_requests", self.project_id),
)
.query(&[("state", "opened"), ("per_page", "10")])
.query(&[("page", opt.get_page())]);
if let Some(username) = opt.author {
let user = self.get_user_by_username(&username).await?;
req = req.query(&[("author_id", user.id)]);
}
if opt.me {
req = req.query(&[("scope", "created-by-me")]);
}
let res = req.send().await?;
debug!("{:#?}", res);
let total = res
.headers()
.get("x-total")
.map(|v| v.to_str().ok())
.flatten()
.map(|v| v.parse::<u64>().ok())
.flatten()
.ok_or(anyhow!("fail to get total"))?;
let text = res.text().await?;
debug!("{:#?}", text);
let result =
serde_json::from_str::<GitLabResponse<Vec<MergeRequest>>>(&text)?.map(|mr| {
Ok(mr
.iter()
.map(|mr| mr.to_owned())
.map(PullRequest::from)
.collect())
})?;
Ok(PaginationResult::new(result, total))
}
async fn create_pull_request(
&self,
source_branch: &str,
target_branch: &str,
title: &str,
) -> Result<PullRequest> {
let res = self
.client
.call(
Method::POST,
&format!("/api/v4/projects/{}/merge_requests", self.project_id),
)
.header("Content-Type", "application/json")
.body(
json!({
"source_branch": source_branch,
"target_branch": target_branch,
"title": title,
})
.to_string(),
)
.send()
.await?;
let text = res.text().await?;
debug!("{:#?}", text);
serde_json::from_str::<GitLabResponse<MergeRequest>>(&text)?
.map(|data| Ok(PullRequest::from(data.to_owned())))
}
async fn close_pull_request(&self, id: usize) -> Result<PullRequest> {
let res = self
.client
.call(
Method::PUT,
&format!("/api/v4/projects/{}/merge_requests/{}", self.project_id, id),
)
.header("Content-Type", "application/json")
.body(
json!({
"state_event": "close",
})
.to_string(),
)
.send()
.await?;
let text = res.text().await?;
debug!("{:#?}", text);
serde_json::from_str::<GitLabResponse<MergeRequest>>(&text)?
.map(|data| Ok(PullRequest::from(data.to_owned())))
}
}
impl GitLabRepository {
async fn get_user_by_username(&self, username: &str) -> Result<User> {
let res = self
.client
.call(Method::GET, &format!("/api/users"))
.query(&[("username", username)])
.send()
.await?;
let text = res.text().await?;
serde_json::from_str::<GitLabResponse<Vec<User>>>(&text)?.map(|data| {
data.first()
.cloned()
.ok_or(anyhow!("unexpected empty response"))
})
}
}
| 29.221591 | 88 | 0.499514 |
de7de099670c1992a97fce2f1cc6b13d37bc2d06 | 1,979 | swift | Swift | starter_kits/Swift/Halite-III/Halite-III/hlt/Player.swift | johnnykwwang/Halite-III | dd16463f1f13d652e7172e82687136f2217bb427 | [
"MIT"
] | 2 | 2018-11-15T14:04:26.000Z | 2018-11-19T01:54:01.000Z | starter_kits/Swift/Halite-III/Halite-III/hlt/Player.swift | johnnykwwang/Halite-III | dd16463f1f13d652e7172e82687136f2217bb427 | [
"MIT"
] | 5 | 2021-02-08T20:26:47.000Z | 2022-02-26T04:28:33.000Z | starter_kits/Swift/Halite-III/Halite-III/hlt/Player.swift | johnnykwwang/Halite-III | dd16463f1f13d652e7172e82687136f2217bb427 | [
"MIT"
] | 1 | 2018-11-22T14:58:12.000Z | 2018-11-22T14:58:12.000Z | //
// Player.swift
// Halite-III
//
// Created by Chris Downie on 10/24/18.
// Copyright © 2018 Chris Downie. All rights reserved.
//
import Foundation
struct Player {
typealias ID = Int
let id: ID
let shipyard: Shipyard
let haliteAmount: Int
let ships: [Ship]
let dropoffs: [Dropoff]
// MARK: Initialization
init(id: ID, shipyard: Shipyard, haliteAmount: Int = 0, ships: [Ship] = [], dropoffs: [Dropoff] = []) {
self.id = id
self.shipyard = shipyard
self.haliteAmount = haliteAmount
self.ships = ships
self.dropoffs = dropoffs
}
// MARK: Ships
/// Returns the ship object associated with the ship id provided as an argument.
///
/// - Parameter ship: The ship ID to query for.
/// - Returns: The ship object associated with the ship ID provided as an argument.
func get(ship id: Ship.ID) -> Ship? {
return ships.first(where: { ship in
ship.id == id
})
}
/// Returns a list of all ship objects.
///
/// - Returns: All ship objects.
func getShips() -> [Ship] {
return ships
}
/// Checks if you have a ship with this id.
///
/// - Parameter ship: The ship ID to query for.
/// - Returns: True if you have a ship with this id.
func has(ship id: Ship.ID) -> Bool {
return ships.contains { $0.id == id }
}
// MARK: Dropoffs
/// Returns the dropoff object associated with the dropoff id provided as an argument.
///
/// - Parameter dropoff: The dropoff ID to query for
/// - Returns: The dropoff object associated with the dropoff id provided as an argument.
func get(dropoff id: Dropoff.ID) -> Dropoff? {
return dropoffs.first(where: { $0.id == id })
}
/// Returns a list of all dropoff objects.
///
/// - Returns: All dropoff objects.
func getDropoffs() -> [Dropoff] {
return dropoffs
}
}
| 27.486111 | 107 | 0.587165 |
b8a6c4908907422eacf6f0c87995098832ad5501 | 970 | ps1 | PowerShell | Examples/Resources/xClusterPreferredOwner/1-AddPreferredOwner.ps1 | flouwers/xFailOverCluster | 066ee9259bb126890619a080cad5c54e5bf6baa9 | [
"MIT"
] | null | null | null | Examples/Resources/xClusterPreferredOwner/1-AddPreferredOwner.ps1 | flouwers/xFailOverCluster | 066ee9259bb126890619a080cad5c54e5bf6baa9 | [
"MIT"
] | null | null | null | Examples/Resources/xClusterPreferredOwner/1-AddPreferredOwner.ps1 | flouwers/xFailOverCluster | 066ee9259bb126890619a080cad5c54e5bf6baa9 | [
"MIT"
] | null | null | null | <#
.EXAMPLE
This example shows how to add two preferred owners to a failover cluster
group and cluster resources in the failover cluster.
This example assumes the failover cluster is already present.
#>
Configuration Example
{
Import-DscResource -ModuleName xFailOverCluster
Node localhost
{
xClusterPreferredOwner 'AddOwnersForClusterGroup1'
{
Ensure = 'Present'
ClusterName = 'TESTCLU1'
ClusterGroup = 'Cluster Group 1'
Nodes = @('Node1', 'Node2')
ClusterResources = @('Resource1', 'Resource2')
}
xClusterPreferredOwner 'AddOwnersForClusterGroup2'
{
Ensure = 'Present'
ClusterName = 'TESTCLU1'
ClusterGroup = 'Cluster Group 2'
Nodes = @('Node1', 'Node2')
ClusterResources = @('Resource3', 'Resource4')
}
}
}
| 28.529412 | 76 | 0.561856 |
4a7c5f06a5b7568cefaf1587c6426bc0b84858b3 | 889 | html | HTML | manuscript/page-379/body.html | marvindanig/change-signals | 25a82e3ba6fe2b5d09ce237bc87c5c4bc14ce184 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | manuscript/page-379/body.html | marvindanig/change-signals | 25a82e3ba6fe2b5d09ce237bc87c5c4bc14ce184 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | manuscript/page-379/body.html | marvindanig/change-signals | 25a82e3ba6fe2b5d09ce237bc87c5c4bc14ce184 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | <div class="leaf flex"><div class="inner justify"><p class="no-indent ">butler mousing around behind your chair all the time. Even Dan agreed to that. And how he did eat! And how they all ate! Each one of them sent back for “that other half chicken, Mary, and a few more of the excellentissimo potatoes.”</p><p>“How do you know her name is Mary?” asked Gerald.</p><p>“All waitresses are named Mary,” answered Ned gravely. “Sometimes they try to make you believe that their names are Gwendolyn or Hortense, but that’s just a fake.”</p><p>“Bet you this one isn’t named Mary,” said Dan.</p><p>“Bet you she is! Wait until she comes back.”</p><p>And when fresh supplies had been served, and a new plate of steaming hot biscuits had been passed, Ned said: “These gentlemen don’t believe that your name is Mary. It is, isn’t it?”</p><p>“Yes,” answered the waitress with a smile.</p></div> </div> | 889 | 889 | 0.730034 |
c25c1fde040410be5115db92cefb29cf7e0a000d | 747 | go | Go | oauth2/zoho/zoho.go | edspc/go-libs | b64a157eedb06323b8059ec9406b2356e487b804 | [
"MIT"
] | null | null | null | oauth2/zoho/zoho.go | edspc/go-libs | b64a157eedb06323b8059ec9406b2356e487b804 | [
"MIT"
] | null | null | null | oauth2/zoho/zoho.go | edspc/go-libs | b64a157eedb06323b8059ec9406b2356e487b804 | [
"MIT"
] | null | null | null | package zoho
import (
"context"
"golang.org/x/oauth2"
)
type Datacenter string
const (
GlobalDatacenter Datacenter = "com"
EUDatacenter Datacenter = "eu"
)
type Config struct {
*oauth2.Config
}
func GetEndpoint(dc Datacenter) oauth2.Endpoint {
return oauth2.Endpoint{
AuthURL: "https://accounts.zoho." + string(dc) + "/oauth/v2/auth",
TokenURL: "https://accounts.zoho." + string(dc) + "/oauth/v2/token",
AuthStyle: oauth2.AuthStyleInParams,
}
}
func (c *Config) GetAuthUrl(state string) string {
return c.AuthCodeURL(state, oauth2.AccessTypeOnline)
}
func (c *Config) GetToken(code string) *oauth2.Token {
cxt := context.Background()
tok, err := c.Exchange(cxt, code)
if err != nil {
panic(err)
}
return tok
}
| 18.219512 | 71 | 0.692102 |
483e33e9edcf825a08d9c02434112460e561cd28 | 731 | swift | Swift | 3ds FBI Link/VKMTableView.swift | smartperson/3DS-FBI-Link | 2015873c0252df282819b7e7eb90b44619527725 | [
"MIT"
] | 111 | 2017-01-31T21:03:57.000Z | 2022-03-22T05:52:23.000Z | 3ds FBI Link/VKMTableView.swift | smartperson/3DS-FBI-Link | 2015873c0252df282819b7e7eb90b44619527725 | [
"MIT"
] | 5 | 2017-02-07T14:48:16.000Z | 2022-02-15T03:58:59.000Z | 3ds FBI Link/VKMTableView.swift | smartperson/3DS-FBI-Link | 2015873c0252df282819b7e7eb90b44619527725 | [
"MIT"
] | 20 | 2017-02-04T22:57:58.000Z | 2022-01-28T10:43:08.000Z | //
// VKMTableView.swift
// 3ds FBI Link
//
// Created by Varun Mehta on 1/24/17.
// Copyright © 2017 Varun Mehta. All rights reserved.
//
import Foundation
import Cocoa
@objc(VKMTableView)
class VKMTableView: NSTableView {
@IBOutlet weak var relatedArrayController:NSArrayController?
override func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
let action = item.action!
if (action == #selector(delete)) {
if (self.selectedRow >= 0) {return true}
else {return false}
} else {
return super.validateUserInterfaceItem(item)
}
}
func delete(_ sender: Any?) {
relatedArrayController?.remove(self)
}
}
| 25.206897 | 91 | 0.645691 |
e8cb21e8c688610403312b2f766c7f2363772041 | 9,974 | sql | SQL | database/scripts/mssql/archive/SQLServerDefaultData.sql | DoDGOSS/omp-marketplace | 4e1b48f31ec13b5462009cd391e9c7511ef8d2bc | [
"Apache-2.0"
] | 8 | 2015-10-28T21:31:26.000Z | 2019-10-22T09:49:23.000Z | database/scripts/mssql/archive/SQLServerDefaultData.sql | DoDGOSS/omp-marketplace | 4e1b48f31ec13b5462009cd391e9c7511ef8d2bc | [
"Apache-2.0"
] | 5 | 2015-10-09T16:51:19.000Z | 2020-02-15T03:02:51.000Z | database/scripts/mssql/archive/SQLServerDefaultData.sql | DoDGOSS/omp-marketplace | 4e1b48f31ec13b5462009cd391e9c7511ef8d2bc | [
"Apache-2.0"
] | 13 | 2016-12-17T22:36:19.000Z | 2021-11-23T21:57:43.000Z | -- *********************************************************************
-- Update Database Script
-- *********************************************************************
-- Change Log: changelog_master.groovy
-- Ran at: 10/29/15 10:19 AM
-- Against: sa@jdbc:jtds:sqlserver://127.0.0.1:1433/omp
-- Liquibase version: 2.0.5
-- *********************************************************************
-- Changeset default_data.groovy::defaultData-2::marketplace::(Checksum: 3:c20b878f50adbc51bcc950947b69af41)
UPDATE [dbo].[category] SET [description] = 'Example Category A' WHERE title = 'Category A'
GO
INSERT INTO category (title, description, version, uuid, created_date, edited_date)
SELECT DISTINCT 'Category A', 'Example Category A', 0,
'bc476b16-b39d-4154-abcd-a32f0e77ef72', GetDate(),
GetDate()
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM category
WHERE title = 'Category A'
)
GO
UPDATE [dbo].[category] SET [description] = 'Example Category B' WHERE title = 'Category B'
GO
INSERT INTO category (title, description, version, uuid, created_date, edited_date)
SELECT DISTINCT 'Category B', 'Example Category B', 0,
'99052d44-feec-421d-96fb-b787489a0dd2', GetDate(),
GetDate()
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM category
WHERE title = 'Category B'
)
GO
UPDATE [dbo].[category] SET [description] = 'Example Category C' WHERE title = 'Category C'
GO
INSERT INTO category (title, description, version, uuid, created_date, edited_date)
SELECT DISTINCT 'Category C', 'Example Category C', 0,
'184b902e-9622-49b1-99bb-5eeed78090a5', GetDate(),
GetDate()
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM category
WHERE title = 'Category C'
)
GO
UPDATE [dbo].[category] SET [description] = 'Analytics based on geographic data' WHERE title = 'Geospatial'
GO
INSERT INTO category (title, description, version, uuid, created_date, edited_date)
SELECT DISTINCT 'Geospatial', 'Analytics based on geographic data', 0,
'a4881581-1b6c-4013-9bf7-3aa7c6ffa695', GetDate(),
GetDate()
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM category
WHERE title = 'Geospatial'
)
GO
UPDATE [dbo].[category] SET [description] = 'Data set retrieval' WHERE title = 'Query'
GO
INSERT INTO category (title, description, version, uuid, created_date, edited_date)
SELECT DISTINCT 'Query', 'Data set retrieval', 0,
'494f798a-9199-4d54-96fb-26cc307db56d', GetDate(),
GetDate()
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM category
WHERE title = 'Query'
)
GO
UPDATE [dbo].[category] SET [description] = 'Data set summarization' WHERE title = 'Reporting'
GO
INSERT INTO category (title, description, version, uuid, created_date, edited_date)
SELECT DISTINCT 'Reporting', 'Data set summarization', 0,
'167a2251-6ed4-4f37-a849-ad8cfb891b23', GetDate(),
GetDate()
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM category
WHERE title = 'Reporting'
)
GO
UPDATE [dbo].[category] SET [description] = 'Amaltics based on temporal data' WHERE title = 'Temporal'
GO
INSERT INTO category (title, description, version, uuid, created_date, edited_date)
SELECT DISTINCT 'Temporal', 'Amaltics based on temporal data', 0,
'6c56b16d-e644-4cda-92f4-6a0e3264e9b9', GetDate(),
GetDate()
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM category
WHERE title = 'Temporal'
)
GO
INSERT INTO [dbo].[DATABASECHANGELOG] ([AUTHOR], [COMMENTS], [DATEEXECUTED], [DESCRIPTION], [EXECTYPE], [FILENAME], [ID], [LIQUIBASE], [MD5SUM], [ORDEREXECUTED]) VALUES ('marketplace', '', GETDATE(), 'Update Data, Custom SQL, Update Data, Custom SQL, Update Data, Custom SQL, Update Data, Custom SQL, Update Data, Custom SQL, Update Data, Custom SQL, Update Data, Custom SQL', 'EXECUTED', 'default_data.groovy', 'defaultData-2', '2.0.5', '3:c20b878f50adbc51bcc950947b69af41', 169)
GO
-- Changeset default_data.groovy::defaultData-5::marketplace::(Checksum: 3:ff5a0b94e61583c8b47eb4ab08b6e551)
INSERT INTO score_card_item (question, description, image, version, created_date, edited_date, show_on_listing)
SELECT DISTINCT 'Is Enterprise Management System (EMS) part of the support structure?', 'In order to satisfy this criterion, the application must be supported with Tier 1 support so that users can access help for any arising issues.', '/marketplace/themes/common/images/scorecard/ScorecardIcons_EMS_lrg.png', 0,
GetDate(), GetDate(), 1
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM score_card_item
WHERE question = 'Is Enterprise Management System (EMS) part of the support structure?'
)
GO
INSERT INTO score_card_item (question, description, image, version, created_date, edited_date, show_on_listing)
SELECT DISTINCT 'Is the application hosted within the infrastructure of the cloud?', 'In order to satisfy this criterion, the application must be running within the cloud structure. If an application is made up of multiple parts, all parts must be running within the cloud.', '/marketplace/themes/common/images/scorecard/ScorecardIcons_CloudHost_lrg.png', 0,
GetDate(), GetDate(), 1
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM score_card_item
WHERE question = 'Is the application hosted within the infrastructure of the cloud?'
)
GO
INSERT INTO score_card_item (question, description, image, version, created_date, edited_date, show_on_listing)
SELECT DISTINCT 'Does the application elastically scale?', 'In order to satisfy this criterion, the application must be able to dynamically handle how many users are trying to access it. For instance, if a low number of users are accessing the App Component a small number of resources are used; if a large number of users are accessing the App Component, the App Component scales to take advantage of additional resources in the cloud.', '/marketplace/themes/common/images/scorecard/ScorecardIcons_Scale_lrg.png', 0,
GetDate(), GetDate(), 1
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM score_card_item
WHERE question = 'Does the application elastically scale?'
)
GO
INSERT INTO score_card_item (question, description, image, version, created_date, edited_date, show_on_listing)
SELECT DISTINCT 'Does this system operate without license constraints?', 'In order to satisfy this criterion, the system should operate without constraining the user to interact with it.', '/marketplace/themes/common/images/scorecard/ScorecardIcons_LicenseFree_lrg.png', 0,
GetDate(), GetDate(), 1
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM score_card_item
WHERE question = 'Does this system operate without license constraints?'
)
GO
INSERT INTO score_card_item (question, description, image, version, created_date, edited_date, show_on_listing)
SELECT DISTINCT 'Is the application data utilizing cloud storage?', 'In order to satisfy this criterion, the application''s data must be within cloud storage. If an application utilizes multiple data resources, all parts must utilize cloud storage.', '/marketplace/themes/common/images/scorecard/ScorecardIcons_CloudStorage_lrg.png', 0,
GetDate(), GetDate(), 1
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM score_card_item
WHERE question = 'Is the application data utilizing cloud storage?'
)
GO
INSERT INTO score_card_item (question, description, image, version, created_date, edited_date, show_on_listing)
SELECT DISTINCT 'Is the application accessible through a web browser?', 'In order to satisfy this criterion, the application must be accessible via an URL/URI that can be launched by a web browser.', '/marketplace/themes/common/images/scorecard/ScorecardIcons_Browser_lrg.png', 0,
GetDate(), GetDate(), 1
FROM application_configuration
WHERE NOT EXISTS (SELECT id FROM score_card_item
WHERE question = 'Is the application accessible through a web browser?'
)
GO
INSERT INTO [dbo].[DATABASECHANGELOG] ([AUTHOR], [COMMENTS], [DATEEXECUTED], [DESCRIPTION], [EXECTYPE], [FILENAME], [ID], [LIQUIBASE], [MD5SUM], [ORDEREXECUTED]) VALUES ('marketplace', '', GETDATE(), 'Custom SQL (x6)', 'EXECUTED', 'default_data.groovy', 'defaultData-5', '2.0.5', '3:ff5a0b94e61583c8b47eb4ab08b6e551', 170)
GO
| 61.190184 | 537 | 0.621516 |
86a6ea5e6450339e57c495820635b15a7e223806 | 13,296 | rs | Rust | src/rotation.rs | NNemec/cgmath | ec5261d15bc7cabd590e2b20cda4fd4c1020affb | [
"Apache-2.0"
] | null | null | null | src/rotation.rs | NNemec/cgmath | ec5261d15bc7cabd590e2b20cda4fd4c1020affb | [
"Apache-2.0"
] | null | null | null | src/rotation.rs | NNemec/cgmath | ec5261d15bc7cabd590e2b20cda4fd4c1020affb | [
"Apache-2.0"
] | null | null | null | // Copyright 2014 The CGMath Developers. For a full listing of the authors,
// refer to the Cargo.toml file at the top-level directory of this distribution.
//
// 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.
use std::fmt;
use std::iter;
use std::ops::*;
use structure::*;
use angle::Rad;
use approx;
use euler::Euler;
use matrix::{Matrix2, Matrix3};
use num::BaseFloat;
use point::{Point2, Point3};
use quaternion::Quaternion;
use vector::{Vector2, Vector3};
/// A trait for a generic rotation. A rotation is a transformation that
/// creates a circular motion, and preserves at least one point in the space.
pub trait Rotation<P: EuclideanSpace>: Sized + Copy + One
where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
Self: approx::AbsDiffEq<Epsilon = P::Scalar>,
Self: approx::RelativeEq<Epsilon = P::Scalar>,
Self: approx::UlpsEq<Epsilon = P::Scalar>,
P::Scalar: BaseFloat,
Self: iter::Product<Self>,
{
/// Create a rotation to a given direction with an 'up' vector.
fn look_at(dir: P::Diff, up: P::Diff) -> Self;
/// Create a shortest rotation to transform vector 'a' into 'b'.
/// Both given vectors are assumed to have unit length.
fn between_vectors(a: P::Diff, b: P::Diff) -> Self;
/// Rotate a vector using this rotation.
fn rotate_vector(&self, vec: P::Diff) -> P::Diff;
/// Rotate a point using this rotation, by converting it to its
/// representation as a vector.
#[inline]
fn rotate_point(&self, point: P) -> P {
P::from_vec(self.rotate_vector(point.to_vec()))
}
/// Create a new rotation which "un-does" this rotation. That is,
/// `r * r.invert()` is the identity.
fn invert(&self) -> Self;
}
/// A two-dimensional rotation.
pub trait Rotation2<S: BaseFloat>
: Rotation<Point2<S>> + Into<Matrix2<S>> + Into<Basis2<S>> {
/// Create a rotation by a given angle. Thus is a redundant case of both
/// from_axis_angle() and from_euler() for 2D space.
fn from_angle<A: Into<Rad<S>>>(theta: A) -> Self;
}
/// A three-dimensional rotation.
pub trait Rotation3<S: BaseFloat>
: Rotation<Point3<S>> + Into<Matrix3<S>> + Into<Basis3<S>> + Into<Quaternion<S>> + From<Euler<Rad<S>>>
{
/// Create a rotation using an angle around a given axis.
///
/// The specified axis **must be normalized**, or it represents an invalid rotation.
fn from_axis_angle<A: Into<Rad<S>>>(axis: Vector3<S>, angle: A) -> Self;
/// Create a rotation from an angle around the `x` axis (pitch).
#[inline]
fn from_angle_x<A: Into<Rad<S>>>(theta: A) -> Self {
Rotation3::from_axis_angle(Vector3::unit_x(), theta)
}
/// Create a rotation from an angle around the `y` axis (yaw).
#[inline]
fn from_angle_y<A: Into<Rad<S>>>(theta: A) -> Self {
Rotation3::from_axis_angle(Vector3::unit_y(), theta)
}
/// Create a rotation from an angle around the `z` axis (roll).
#[inline]
fn from_angle_z<A: Into<Rad<S>>>(theta: A) -> Self {
Rotation3::from_axis_angle(Vector3::unit_z(), theta)
}
}
/// A two-dimensional rotation matrix.
///
/// The matrix is guaranteed to be orthogonal, so some operations can be
/// implemented more efficiently than the implementations for `math::Matrix2`. To
/// enforce orthogonality at the type level the operations have been restricted
/// to a subset of those implemented on `Matrix2`.
///
/// ## Example
///
/// Suppose we want to rotate a vector that lies in the x-y plane by some
/// angle. We can accomplish this quite easily with a two-dimensional rotation
/// matrix:
///
/// ```no_run
/// use cgmath::Rad;
/// use cgmath::Vector2;
/// use cgmath::{Matrix, Matrix2};
/// use cgmath::{Rotation, Rotation2, Basis2};
/// use cgmath::UlpsEq;
/// use std::f64;
///
/// // For simplicity, we will rotate the unit x vector to the unit y vector --
/// // so the angle is 90 degrees, or π/2.
/// let unit_x: Vector2<f64> = Vector2::unit_x();
/// let rot: Basis2<f64> = Rotation2::from_angle(Rad(0.5f64 * f64::consts::PI));
///
/// // Rotate the vector using the two-dimensional rotation matrix:
/// let unit_y = rot.rotate_vector(unit_x);
///
/// // Since sin(π/2) may not be exactly zero due to rounding errors, we can
/// // use approx's assert_ulps_eq!() feature to show that it is close enough.
/// // assert_ulps_eq!(&unit_y, &Vector2::unit_y()); // TODO: Figure out how to use this
///
/// // This is exactly equivalent to using the raw matrix itself:
/// let unit_y2: Matrix2<_> = rot.into();
/// let unit_y2 = unit_y2 * unit_x;
/// assert_eq!(unit_y2, unit_y);
///
/// // Note that we can also concatenate rotations:
/// let rot_half: Basis2<f64> = Rotation2::from_angle(Rad(0.25f64 * f64::consts::PI));
/// let unit_y3 = (rot_half * rot_half).rotate_vector(unit_x);
/// // assert_ulps_eq!(&unit_y3, &unit_y2); // TODO: Figure out how to use this
/// ```
#[derive(PartialEq, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Basis2<S> {
mat: Matrix2<S>,
}
impl<S: BaseFloat> AsRef<Matrix2<S>> for Basis2<S> {
#[inline]
fn as_ref(&self) -> &Matrix2<S> {
&self.mat
}
}
impl<S: BaseFloat> From<Basis2<S>> for Matrix2<S> {
#[inline]
fn from(b: Basis2<S>) -> Matrix2<S> {
b.mat
}
}
impl<S: BaseFloat> iter::Product<Basis2<S>> for Basis2<S> {
#[inline]
fn product<I: Iterator<Item = Basis2<S>>>(iter: I) -> Basis2<S> {
iter.fold(Basis2::one(), Mul::mul)
}
}
impl<'a, S: 'a + BaseFloat> iter::Product<&'a Basis2<S>> for Basis2<S> {
#[inline]
fn product<I: Iterator<Item = &'a Basis2<S>>>(iter: I) -> Basis2<S> {
iter.fold(Basis2::one(), Mul::mul)
}
}
impl<S: BaseFloat> Rotation<Point2<S>> for Basis2<S> {
#[inline]
fn look_at(dir: Vector2<S>, up: Vector2<S>) -> Basis2<S> {
Basis2 {
mat: Matrix2::look_at(dir, up),
}
}
#[inline]
fn between_vectors(a: Vector2<S>, b: Vector2<S>) -> Basis2<S> {
Rotation2::from_angle(Rad::acos(a.dot(b)))
}
#[inline]
fn rotate_vector(&self, vec: Vector2<S>) -> Vector2<S> {
self.mat * vec
}
// TODO: we know the matrix is orthogonal, so this could be re-written
// to be faster
#[inline]
fn invert(&self) -> Basis2<S> {
Basis2 {
mat: self.mat.invert().unwrap(),
}
}
}
impl<S: BaseFloat> One for Basis2<S> {
#[inline]
fn one() -> Basis2<S> {
Basis2 {
mat: Matrix2::one(),
}
}
}
impl_operator!(<S: BaseFloat> Mul<Basis2<S> > for Basis2<S> {
fn mul(lhs, rhs) -> Basis2<S> { Basis2 { mat: lhs.mat * rhs.mat } }
});
impl<S: BaseFloat> approx::AbsDiffEq for Basis2<S> {
type Epsilon = S::Epsilon;
#[inline]
fn default_epsilon() -> S::Epsilon {
S::default_epsilon()
}
#[inline]
fn abs_diff_eq(&self, other: &Self, epsilon: S::Epsilon) -> bool {
Matrix2::abs_diff_eq(&self.mat, &other.mat, epsilon)
}
}
impl<S: BaseFloat> approx::RelativeEq for Basis2<S> {
#[inline]
fn default_max_relative() -> S::Epsilon {
S::default_max_relative()
}
#[inline]
fn relative_eq(&self, other: &Self, epsilon: S::Epsilon, max_relative: S::Epsilon) -> bool {
Matrix2::relative_eq(&self.mat, &other.mat, epsilon, max_relative)
}
}
impl<S: BaseFloat> approx::UlpsEq for Basis2<S> {
#[inline]
fn default_max_ulps() -> u32 {
S::default_max_ulps()
}
#[inline]
fn ulps_eq(&self, other: &Self, epsilon: S::Epsilon, max_ulps: u32) -> bool {
Matrix2::ulps_eq(&self.mat, &other.mat, epsilon, max_ulps)
}
}
impl<S: BaseFloat> Rotation2<S> for Basis2<S> {
fn from_angle<A: Into<Rad<S>>>(theta: A) -> Basis2<S> {
Basis2 {
mat: Matrix2::from_angle(theta),
}
}
}
impl<S: fmt::Debug> fmt::Debug for Basis2<S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "Basis2 "));
<[[S; 2]; 2] as fmt::Debug>::fmt(self.mat.as_ref(), f)
}
}
/// A three-dimensional rotation matrix.
///
/// The matrix is guaranteed to be orthogonal, so some operations, specifically
/// inversion, can be implemented more efficiently than the implementations for
/// `math::Matrix3`. To ensure orthogonality is maintained, the operations have
/// been restricted to a subset of those implemented on `Matrix3`.
#[derive(PartialEq, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Basis3<S> {
mat: Matrix3<S>,
}
impl<S: BaseFloat> Basis3<S> {
/// Create a new rotation matrix from a quaternion.
#[inline]
pub fn from_quaternion(quaternion: &Quaternion<S>) -> Basis3<S> {
Basis3 {
mat: quaternion.clone().into(),
}
}
}
impl<S> AsRef<Matrix3<S>> for Basis3<S> {
#[inline]
fn as_ref(&self) -> &Matrix3<S> {
&self.mat
}
}
impl<S: BaseFloat> From<Basis3<S>> for Matrix3<S> {
#[inline]
fn from(b: Basis3<S>) -> Matrix3<S> {
b.mat
}
}
impl<S: BaseFloat> From<Basis3<S>> for Quaternion<S> {
#[inline]
fn from(b: Basis3<S>) -> Quaternion<S> {
b.mat.into()
}
}
impl<S: BaseFloat> iter::Product<Basis3<S>> for Basis3<S> {
#[inline]
fn product<I: Iterator<Item = Basis3<S>>>(iter: I) -> Basis3<S> {
iter.fold(Basis3::one(), Mul::mul)
}
}
impl<'a, S: 'a + BaseFloat> iter::Product<&'a Basis3<S>> for Basis3<S> {
#[inline]
fn product<I: Iterator<Item = &'a Basis3<S>>>(iter: I) -> Basis3<S> {
iter.fold(Basis3::one(), Mul::mul)
}
}
impl<S: BaseFloat> Rotation<Point3<S>> for Basis3<S> {
#[inline]
fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S> {
Basis3 {
mat: Matrix3::look_at(dir, up),
}
}
#[inline]
fn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Basis3<S> {
let q: Quaternion<S> = Rotation::between_vectors(a, b);
q.into()
}
#[inline]
fn rotate_vector(&self, vec: Vector3<S>) -> Vector3<S> {
self.mat * vec
}
// TODO: we know the matrix is orthogonal, so this could be re-written
// to be faster
#[inline]
fn invert(&self) -> Basis3<S> {
Basis3 {
mat: self.mat.invert().unwrap(),
}
}
}
impl<S: BaseFloat> One for Basis3<S> {
#[inline]
fn one() -> Basis3<S> {
Basis3 {
mat: Matrix3::one(),
}
}
}
impl_operator!(<S: BaseFloat> Mul<Basis3<S> > for Basis3<S> {
fn mul(lhs, rhs) -> Basis3<S> { Basis3 { mat: lhs.mat * rhs.mat } }
});
impl<S: BaseFloat> approx::AbsDiffEq for Basis3<S> {
type Epsilon = S::Epsilon;
#[inline]
fn default_epsilon() -> S::Epsilon {
S::default_epsilon()
}
#[inline]
fn abs_diff_eq(&self, other: &Self, epsilon: S::Epsilon) -> bool {
Matrix3::abs_diff_eq(&self.mat, &other.mat, epsilon)
}
}
impl<S: BaseFloat> approx::RelativeEq for Basis3<S> {
#[inline]
fn default_max_relative() -> S::Epsilon {
S::default_max_relative()
}
#[inline]
fn relative_eq(&self, other: &Self, epsilon: S::Epsilon, max_relative: S::Epsilon) -> bool {
Matrix3::relative_eq(&self.mat, &other.mat, epsilon, max_relative)
}
}
impl<S: BaseFloat> approx::UlpsEq for Basis3<S> {
#[inline]
fn default_max_ulps() -> u32 {
S::default_max_ulps()
}
#[inline]
fn ulps_eq(&self, other: &Self, epsilon: S::Epsilon, max_ulps: u32) -> bool {
Matrix3::ulps_eq(&self.mat, &other.mat, epsilon, max_ulps)
}
}
impl<S: BaseFloat> Rotation3<S> for Basis3<S> {
fn from_axis_angle<A: Into<Rad<S>>>(axis: Vector3<S>, angle: A) -> Basis3<S> {
Basis3 {
mat: Matrix3::from_axis_angle(axis, angle),
}
}
fn from_angle_x<A: Into<Rad<S>>>(theta: A) -> Basis3<S> {
Basis3 {
mat: Matrix3::from_angle_x(theta),
}
}
fn from_angle_y<A: Into<Rad<S>>>(theta: A) -> Basis3<S> {
Basis3 {
mat: Matrix3::from_angle_y(theta),
}
}
fn from_angle_z<A: Into<Rad<S>>>(theta: A) -> Basis3<S> {
Basis3 {
mat: Matrix3::from_angle_z(theta),
}
}
}
impl<A: Angle> From<Euler<A>> for Basis3<A::Unitless>
where
A: Into<Rad<<A as Angle>::Unitless>>,
{
/// Create a three-dimensional rotation matrix from a set of euler angles.
fn from(src: Euler<A>) -> Basis3<A::Unitless> {
Basis3 {
mat: Matrix3::from(src),
}
}
}
impl<S: fmt::Debug> fmt::Debug for Basis3<S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "Basis3 "));
<[[S; 3]; 3] as fmt::Debug>::fmt(self.mat.as_ref(), f)
}
}
| 29.415929 | 106 | 0.606874 |
6425870a02a73c4e73ad94e8594b8a558faad94d | 1,152 | lua | Lua | Sanghost.lua | Jictyvoo/Sanghost | 235d2c7ef0329e66e9e45f10b7a7e7428134016a | [
"MIT"
] | null | null | null | Sanghost.lua | Jictyvoo/Sanghost | 235d2c7ef0329e66e9e45f10b7a7e7428134016a | [
"MIT"
] | null | null | null | Sanghost.lua | Jictyvoo/Sanghost | 235d2c7ef0329e66e9e45f10b7a7e7428134016a | [
"MIT"
] | null | null | null | local Sanghost = {}
Sanghost.__index = Sanghost
function Sanghost:new()
local this = {
objects = {}
}
return setmetatable(this, Sanghost)
end
function Sanghost:cloneObject(object, alreadyCloned, newObject)
local newObject = newObject or {}
for key, value in pairs(object) do
local toSave = value
if type(value) == "table" then
if alreadyCloned[value] then
toSave = alreadyCloned[value]
else
alreadyCloned[value] = {}
toSave = self:cloneObject(value, alreadyCloned, alreadyCloned[value])
end
end
newObject[key] = toSave
end
return setmetatable(newObject, getmetatable(object))
end
function Sanghost:save(object, objectName)
assert(type(object) == "table", "Object needs to be a table")
assert(objectName, "Object Name required to save")
self.objects[objectName] = self:cloneObject(object, {})
end
function Sanghost:load(objectName)
local object = self.objects[objectName]
if object then
return self:cloneObject(object, {})
end
return nil
end
return Sanghost
| 25.6 | 85 | 0.643229 |
29065e34305832a5b2a7ac79893585823816eff4 | 1,392 | swift | Swift | Examples/iOS/ViewController.swift | EyreFree/EFSafeArray | 323cc1233e0e60bb348ebc01f7a70ef729029a09 | [
"MIT"
] | 12 | 2017-08-03T11:23:30.000Z | 2018-09-19T06:59:26.000Z | Examples/iOS/ViewController.swift | EyreFree/EFSafeArray | 323cc1233e0e60bb348ebc01f7a70ef729029a09 | [
"MIT"
] | null | null | null | Examples/iOS/ViewController.swift | EyreFree/EFSafeArray | 323cc1233e0e60bb348ebc01f7a70ef729029a09 | [
"MIT"
] | 1 | 2019-05-24T05:31:14.000Z | 2019-05-24T05:31:14.000Z | //
// ViewController.swift
// EFSafeArray
//
// Created by EyreFree on 07/28/2017.
// Copyright (c) 2017 EyreFree. All rights reserved.
//
import UIKit
import EFSafeArray
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
var list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
// Get Index
let xxx = list[0] // xxx: Int = 1
let zzz = list[0~] // zzz: Int? = 1
let yyy = list[10~] // yyy: Int? = nil
// Set Index
list[0] = 0 // list = [0, 2, 3, 4, 5, 6, 7, 8, 9, 0]
list[0~] = 1 // list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
list[10~] = 10 // list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
// Get Bounds
let iiii = list[(0...5)~] // iiii: ArraySlice<Int>? = [1, 2, 3, 4, 5, 6]
let oooo = list[(-1...12)~] // oooo: ArraySlice<Int>? = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
// Set Bounds
list[(0...5)~] = [1] // list = [1, 7, 8, 9, 0]
list[(-1...12)~] = [2, 3, 4, 5] // list = [2, 3, 4, 5]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| 32.372093 | 98 | 0.458333 |
fb5fc450f719c56ebe5c954521d55e3433a5d851 | 2,729 | java | Java | phenol-io/src/main/java/org/monarchinitiative/phenol/io/owl/SynonymMapper.java | aeyates/phenol | 5a22be36ef32c7cf35b277afff0843d214524abe | [
"BSD-3-Clause"
] | null | null | null | phenol-io/src/main/java/org/monarchinitiative/phenol/io/owl/SynonymMapper.java | aeyates/phenol | 5a22be36ef32c7cf35b277afff0843d214524abe | [
"BSD-3-Clause"
] | null | null | null | phenol-io/src/main/java/org/monarchinitiative/phenol/io/owl/SynonymMapper.java | aeyates/phenol | 5a22be36ef32c7cf35b277afff0843d214524abe | [
"BSD-3-Clause"
] | null | null | null | package org.monarchinitiative.phenol.io.owl;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.geneontology.obographs.model.meta.SynonymPropertyValue;
import org.geneontology.obographs.model.meta.SynonymPropertyValue.PREDS;
import org.monarchinitiative.phenol.ontology.data.TermId;
import org.monarchinitiative.phenol.ontology.data.TermSynonym;
import org.monarchinitiative.phenol.ontology.data.TermSynonymScope;
import org.monarchinitiative.phenol.ontology.data.TermXref;
import com.google.common.collect.Lists;
/**
* Map the representation of Synonym
*
* @author <a href="mailto:HyeongSikKim@lbl.gov">HyeongSik Kim</a>
*/
class SynonymMapper {
/** @return list of synoynms (can be an empty list but cannot be null). */
static List<TermSynonym> mapSynonyms(List<SynonymPropertyValue> spvs) {
if (spvs == null) return ImmutableList.of();
List<TermSynonym> termSynonymList = Lists.newArrayList();
for (SynonymPropertyValue spv : spvs) {
// Map the scope of Synonym
TermSynonymScope scope = null;
String pred = spv.getPred();
if (pred.equals(PREDS.hasExactSynonym.toString())) {
scope = TermSynonymScope.EXACT;
} else if (pred.equals(PREDS.hasBroadSynonym.toString())) {
scope = TermSynonymScope.BROAD;
} else if (pred.equals(PREDS.hasNarrowSynonym.toString())) {
scope = TermSynonymScope.NARROW;
} else if (pred.equals(PREDS.hasRelatedSynonym.toString())) {
scope = TermSynonymScope.RELATED;
}
// Map the synonym's type name.
String synonymTypeName = String.join(", ", spv.getTypes());
// Map the synonym's cross-references.
List<String> xrefs = spv.getXrefs();
List<TermXref> termXrefs = mapXref(xrefs);
TermSynonym its = new TermSynonym(spv.getVal(), scope, synonymTypeName, termXrefs);
termSynonymList.add(its);
}
return termSynonymList;
}
/**
* We try to map the cross references to Curies, e.g., ORCID:0000-0000-0000-0123.
* If a cross-reference is not in CURIE for, we just ignore it. For now we
* use an empty string for the Description field of the cross-reference.
* @param xrefs list of cross references as Strings
* @return list of cross references as {@link TermXref} objects. Can be empty but not null.
*/
private static List<TermXref> mapXref(List<String> xrefs) {
List<TermXref> termXrefs = Lists.newArrayList();
for (String xref : xrefs) {
try {
TermId xrefTermId = TermId.constructWithPrefix(xref);
TermXref trf = new TermXref(xrefTermId,"");
termXrefs.add(trf);
} catch (Exception e) {
// ignore
}
}
return termXrefs;
}
}
| 34.1125 | 93 | 0.697325 |
c50ec787547271f58e3cab1615e18eca1034ce79 | 2,349 | sql | SQL | migration/ccd-to-am-migration-main.sql | hmcts/am-lib | 5851a157a443e9b7887dbcf4b3d749e66fcad15f | [
"MIT"
] | null | null | null | migration/ccd-to-am-migration-main.sql | hmcts/am-lib | 5851a157a443e9b7887dbcf4b3d749e66fcad15f | [
"MIT"
] | 568 | 2019-01-29T10:46:39.000Z | 2021-05-14T05:21:13.000Z | migration/ccd-to-am-migration-main.sql | hmcts/am-lib | 5851a157a443e9b7887dbcf4b3d749e66fcad15f | [
"MIT"
] | 3 | 2019-02-04T15:53:20.000Z | 2021-04-10T22:38:45.000Z |
BEGIN;
CREATE TEMP TABLE stage
(
case_data_id VARCHAR, case_type_id VARCHAR,
user_id VARCHAR, case_role VARCHAR
);
ALTER TABLE access_management DROP CONSTRAINT access_management_resources_fkey;
ALTER TABLE access_management DROP CONSTRAINT relationship_fkey;
\COPY stage FROM 'am-migration.csv' DELIMITER ',' CSV HEADER;
SELECT COUNT(*) AS "columns to migrate" FROM stage;
SELECT COUNT(*) AS "pre-migration access_management count" FROM access_management;
INSERT INTO access_management (resource_id, accessor_type, accessor_id,
"attribute", permissions, service_name, resource_name,
resource_type, relationship)
SELECT s.case_data_id AS resource_id, 'USER' AS accessor_type,
s.user_id AS accessor_id, ra."attribute" AS "attribute",
dp.permissions AS permissions, re.service_name AS service_name,
s.case_type_id AS resource_name, re.resource_type AS resource_type,
s.case_role AS relationship
FROM stage AS s, resource_attributes AS ra,
default_permissions_for_roles AS dp, resources AS re
WHERE ra.resource_name = s.case_type_id
AND dp.resource_name = s.case_type_id
AND re.resource_name = s.case_type_id
AND s.case_role IN (SELECT role_name FROM roles)
EXCEPT
SELECT resource_id, accessor_type, accessor_id, "attribute",
permissions, service_name, resource_name, resource_type,
relationship
FROM access_management;
ALTER TABLE access_management ADD CONSTRAINT access_management_resources_fkey
FOREIGN KEY (service_name, resource_type, resource_name)
REFERENCES resources(service_name, resource_type, resource_name);
ALTER TABLE access_management ADD CONSTRAINT relationship_fkey
FOREIGN KEY (relationship)
REFERENCES roles(role_name);
COMMIT;
SELECT COUNT(*) AS "post-migration access_management count" FROM access_management;
WITH errors AS
(
SELECT * FROM stage
EXCEPT
SELECT resource_id AS case_data_id, resource_name AS case_type_id,
accessor_id AS user_id, relationship AS case_role
FROM access_management
)
SELECT COUNT(*) AS "migration errors" FROM errors;
SELECT * FROM stage
EXCEPT
SELECT resource_id AS case_data_id, resource_name AS case_type_id,
accessor_id AS user_id, relationship AS case_role
FROM access_management
LIMIT 100;
COMMIT;
| 34.544118 | 83 | 0.764155 |
163f44b361b323dde6fb0db9f4b3226079024465 | 1,043 | ts | TypeScript | src/common/interceptors/auth.interceptor.ts | jlucasgaspar/btech-backend | 69ec4bc5c86f156c2649122e8fbf6e38ba570cfa | [
"MIT"
] | null | null | null | src/common/interceptors/auth.interceptor.ts | jlucasgaspar/btech-backend | 69ec4bc5c86f156c2649122e8fbf6e38ba570cfa | [
"MIT"
] | null | null | null | src/common/interceptors/auth.interceptor.ts | jlucasgaspar/btech-backend | 69ec4bc5c86f156c2649122e8fbf6e38ba570cfa | [
"MIT"
] | null | null | null | import { CallHandler, ExecutionContext, Injectable, NestInterceptor, UnauthorizedException } from '@nestjs/common';
import { decodeJwtToken } from '../utils/decodeJwtToken';
import { Request } from 'express';
@Injectable()
export class AuthInterceptor implements NestInterceptor {
async intercept(context: ExecutionContext, next: CallHandler<any>) {
const request = context.switchToHttp().getRequest<Request>();
if (
request.url.includes('login') ||
request.url.includes('signup') ||
request.url.includes('forgot-password') ||
request.url.includes('change-password')
) {
return next.handle();
}
const { authorization } = request.headers;
if (!authorization) {
throw new UnauthorizedException('Provide an authorization token in headers.');
}
if (authorization.trim() === 'Bearer') {
throw new UnauthorizedException('Provide a JWT token.');
}
const token = authorization.replace('Bearer ', '');
decodeJwtToken(token);
return next.handle();
}
} | 29.8 | 115 | 0.678811 |
49a89aba8d7c6b2fcc5536778d9e7bf81fcd45db | 541 | html | HTML | apps/api-registry/src/main/resources/io/fabric8/api/registry/index.html | jimmidyson/quickstarts | 17856d77ac1374ff6f4b017c03f10a3bae6208af | [
"Apache-2.0"
] | null | null | null | apps/api-registry/src/main/resources/io/fabric8/api/registry/index.html | jimmidyson/quickstarts | 17856d77ac1374ff6f4b017c03f10a3bae6208af | [
"Apache-2.0"
] | null | null | null | apps/api-registry/src/main/resources/io/fabric8/api/registry/index.html | jimmidyson/quickstarts | 17856d77ac1374ff6f4b017c03f10a3bae6208af | [
"Apache-2.0"
] | null | null | null | <html>
<head>
<title>API Registry</title>
</head>
<body>
<h1>API Registry</h1>
<p>REST APIs available:</p>
<ul>
<li>
<a href="endpoints/pods">endpoints/pods</a> view all the APIs available on the pods
</li>
<li>
<a href="endpoints/services">endpoints/services</a> view all the APIs available on the services
</li>
<li>
<a href="_ping">_ping</a> a ping to check its up and running
</li>
<li>
<a href="cxf/servicesList">cxf/servicesList</a> to list all the available CXF services
</li>
</ul>
</body>
</html> | 21.64 | 99 | 0.64695 |
fb80b1d5b921fd9c66ca7957a99a8e53848a6418 | 86 | java | Java | oposter/src/main/java/org/orienteer/oposter/ok/package-info.java | OrienteerBAP/OPoster | 639d3b0b328b79bea366bceecc81200fac592487 | [
"Apache-2.0"
] | 21 | 2020-12-29T21:19:11.000Z | 2022-01-23T16:12:45.000Z | oposter/src/main/java/org/orienteer/oposter/ok/package-info.java | OrienteerBAP/OPoster | 639d3b0b328b79bea366bceecc81200fac592487 | [
"Apache-2.0"
] | 14 | 2021-01-04T18:32:41.000Z | 2021-02-04T06:28:14.000Z | oposter/src/main/java/org/orienteer/oposter/ok/package-info.java | OrienteerBAP/OPoster | 639d3b0b328b79bea366bceecc81200fac592487 | [
"Apache-2.0"
] | 2 | 2021-02-24T23:49:01.000Z | 2021-04-08T02:55:57.000Z | /**
* Package for Odnoklassniki support classes
*/
package org.orienteer.oposter.ok; | 21.5 | 44 | 0.755814 |
e8af8da02d4794a86bf8f8711e0f84a10eceb4ae | 1,130 | hh | C++ | RAVL2/Core/Base/Resource.hh | isuhao/ravl2 | 317e0ae1cb51e320b877c3bad6a362447b5e52ec | [
"BSD-Source-Code"
] | null | null | null | RAVL2/Core/Base/Resource.hh | isuhao/ravl2 | 317e0ae1cb51e320b877c3bad6a362447b5e52ec | [
"BSD-Source-Code"
] | null | null | null | RAVL2/Core/Base/Resource.hh | isuhao/ravl2 | 317e0ae1cb51e320b877c3bad6a362447b5e52ec | [
"BSD-Source-Code"
] | null | null | null | // This file is part of RAVL, Recognition And Vision Library
// Copyright (C) 2003, OmniPerception Ltd.
// This code may be redistributed under the terms of the GNU Lesser
// General Public License (LGPL). See the lgpl.licence file for details or
// see http://www.gnu.org/copyleft/lesser.html
// file-header-ends-here
#ifndef RAVL_RESOURCE_HEADER
#define RAVL_RESOURCE_HEADER 1
//! rcsid="$Id: Resource.hh 5240 2005-12-06 17:16:50Z plugger $"
//! lib=RavlCore
//! docentry="Ravl.API.Core.Resource"
//! userlevel=Normal
//! file="Ravl/Core/Base/Resource.hh"
#include "Ravl/String.hh"
namespace RavlN {
//!userlevel=Normal
bool SetResourceRoot(const StringC &name);
//: Access root of resource directory.
const StringC &ResourceRoot();
//: Access root of resource directory.
StringC Resource(const char *module,const char *name);
//: Get location of resource.
//!userlevel=Advanced
typedef StringC (*ResourceLookupFuncT)(const char *module,const char *name);
bool SetResourceLookupFunc(ResourceLookupFuncT resourceLookup);
//: Replace method for doing resource lookups.
}
#endif
| 26.904762 | 78 | 0.726549 |
64e82482a65da6ae84f1ee09aff81779c4c357fb | 1,074 | java | Java | ew.levr.ontology/src/main/java/com/eduworks/cruncher/ontology/CruncherOntologySetUriPrefix.java | Eduworks/ew | a7954aa8e9a79f1a8330c9b45a71cad8a0da11df | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2018-07-23T23:09:27.000Z | 2019-03-23T03:20:35.000Z | ew.levr.ontology/src/main/java/com/eduworks/cruncher/ontology/CruncherOntologySetUriPrefix.java | Eduworks/ew | a7954aa8e9a79f1a8330c9b45a71cad8a0da11df | [
"ECL-2.0",
"Apache-2.0"
] | 37 | 2017-02-16T21:09:05.000Z | 2021-06-25T15:43:30.000Z | ew.levr.ontology/src/main/java/com/eduworks/cruncher/ontology/CruncherOntologySetUriPrefix.java | Eduworks/ew | a7954aa8e9a79f1a8330c9b45a71cad8a0da11df | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2016-09-22T06:21:31.000Z | 2017-01-27T21:01:53.000Z | package com.eduworks.cruncher.ontology;
import com.eduworks.ontology.Ontology;
import com.eduworks.resolver.Context;
import com.eduworks.resolver.Cruncher;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.InputStream;
import java.util.Map;
public class CruncherOntologySetUriPrefix extends Cruncher
{
@Override
public Object resolve(Context c, Map<String, String[]> parameters, Map<String, InputStream> dataStreams) throws JSONException
{
String uri = decodeValue(optAsString("uri", "", c, parameters, dataStreams));
Ontology.setDefaultURI(uri);
return uri;
}
@Override
public String getDescription()
{
return "adds an import statement to the ontology specified by ontologyId to import the ontology specified with importId";
}
@Override
public String getReturn()
{
return "Object";
}
@Override
public String getAttribution()
{
return ATTRIB_NONE;
}
@Override
public JSONObject getParameters() throws JSONException
{
return jo("ontologyId", "String", "directory", "String", "importId", "String");
}
}
| 21.48 | 126 | 0.75419 |
c1bfa99233f0b16551a100aef11c6424443fa1e1 | 581 | asm | Assembly | nexys3.asm | QuorumComp/hc800-lowlevel | 86a57cab38853df601de79f5ecef58ec1253ed7e | [
"MIT"
] | 1 | 2021-02-05T07:44:50.000Z | 2021-02-05T07:44:50.000Z | nexys3.asm | QuorumComp/hc800-lowlevel | 86a57cab38853df601de79f5ecef58ec1253ed7e | [
"MIT"
] | null | null | null | nexys3.asm | QuorumComp/hc800-lowlevel | 86a57cab38853df601de79f5ecef58ec1253ed7e | [
"MIT"
] | null | null | null | INCLUDE "nexys3.i"
; -- Check if buttons are pressed
; --
; -- Inputs:
; -- t - button mask
; --
; -- Outputs:
; -- f - "z" condition if all buttons in mask are down
SECTION "CheckButtons",CODE
CheckButtons:
push bc-hl
ld d,t
ld b,IO_NEXYS3_BASE
ld c,IO_NEXYS3_BUTTONS
lio t,(bc)
and t,d
cmp d
pop bc-hl
j (hl)
; -- Set hex segments
; --
; -- Inputs:
; -- ft - value to set
SECTION "SetHexSegments",CODE
SetHexSegments:
pusha
ld b,IO_NEXYS3_BASE
ld c,IO_NEXYS3_HEX_LOWER
lio (bc),t
add c,1
exg f,t
lio (bc),t
popa
j (hl)
| 12.911111 | 56 | 0.604131 |
4732530eb1cfee3706a22cd2b85453ab51b58860 | 441 | dart | Dart | alternative/user/user/lib/bean/bannerbean.dart | nikisKuchbhi/Project-Tradewell | fe2e0befed6754d84084a44a3befb1d83ee29a0b | [
"MIT"
] | null | null | null | alternative/user/user/lib/bean/bannerbean.dart | nikisKuchbhi/Project-Tradewell | fe2e0befed6754d84084a44a3befb1d83ee29a0b | [
"MIT"
] | null | null | null | alternative/user/user/lib/bean/bannerbean.dart | nikisKuchbhi/Project-Tradewell | fe2e0befed6754d84084a44a3befb1d83ee29a0b | [
"MIT"
] | 2 | 2021-10-02T01:37:43.000Z | 2021-10-02T11:10:14.000Z | class BannerDetails {
dynamic banner_id;
dynamic banner_image;
dynamic vendor_id;
BannerDetails(this.banner_id, this.banner_image, this.vendor_id);
factory BannerDetails.fromJson(dynamic json) {
return BannerDetails(json['banner_id'], json['banner_image'], json['vendor_id']);
}
@override
String toString() {
return 'BannerDetails{banner_id: $banner_id, banner_image: $banner_image, vendor_id: $vendor_id}';
}
}
| 25.941176 | 102 | 0.736961 |
1f2385bd2ff1795697dbcba1777483d6de9a9b94 | 19,269 | cpp | C++ | src/AirPlaySlideshow.cpp | jdgordy/slideshow-apple-tv-bb10 | 968e0f0c07dad3a6f91804d69b470a5eb095aa24 | [
"Apache-2.0"
] | null | null | null | src/AirPlaySlideshow.cpp | jdgordy/slideshow-apple-tv-bb10 | 968e0f0c07dad3a6f91804d69b470a5eb095aa24 | [
"Apache-2.0"
] | null | null | null | src/AirPlaySlideshow.cpp | jdgordy/slideshow-apple-tv-bb10 | 968e0f0c07dad3a6f91804d69b470a5eb095aa24 | [
"Apache-2.0"
] | null | null | null | #include "AirPlaySlideshow.hpp"
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/ArrayDataModel>
#include <bb/cascades/LocaleHandler>
#include <bb/data/JsonDataAccess>
#include <bb/system/InvokeTargetReply>
#include <QtCore/QDir>
#include <QtCore/QUuid>
#include <iostream>
#include "BonjourBrowser.hpp"
#include "BonjourResolver.hpp"
#include "AirPlayDevice.hpp"
#include "DevicePropertiesViewer.hpp"
#include "SlideshowViewer.hpp"
// Declare namespaces
using namespace bb::cascades;
using namespace bb::system;
using namespace bb::data;
using namespace std;
// Constants
static const QString g_strAirPlayServiceType = "_airplay._tcp";
static const QString g_strDefaultConnectionTimeout = "20000";
static const QString g_strDefaultEnableScaleImages = "false";
static const QString g_strDefaultScreenSize = "720p";
static const QString g_strDefaultImageQuality = "high";
// Helper function to map from URL file extension to MIME type
static QString findMimeType(const QUrl& url)
{
QString type;
// Retrieve filename
QFileInfo fileInfo(url.path());
QString suffix = fileInfo.suffix();
if( suffix == "jpeg" || suffix == "jpg" )
{
type = "image/jpeg";
}
else if( suffix == "png" )
{
type = "image/png";
}
else if( suffix == "gif" )
{
type = "image/gif";
}
else
{
type = "application/unknown";
}
return type;
}
// Validate from set of supported image types
static bool validateMimeType(const QString& type)
{
if( (type == "image/jpeg") || (type == "image/jpg") || (type == "image/png") || (type == "image/gif") )
{
return true;
}
else
{
return false;
}
}
// Constructor
AirPlaySlideshow::AirPlaySlideshow(bb::cascades::Application *app) :
QObject(app),
m_pRecordListModel(new ArrayDataModel(this)),
m_pFileListModel(new ArrayDataModel(this)),
m_pDevice(NULL),
m_pDevicePropertiesViewer(new DevicePropertiesViewer(this)),
m_pSlideshowViewer(new SlideshowViewer(this)),
m_pInvokeManager(new InvokeManager(this)),
m_transition(0),
m_pBrowser(new BonjourBrowser(this)),
m_pResolver(new BonjourResolver(this)),
m_pTranslator(new QTranslator(this)),
m_pLocaleHandler(new LocaleHandler(this))
{
// We set up the application Organization and name, this is used by QSettings
// when saving values to the persistent store.
QCoreApplication::setOrganizationName("JamesGordy");
QCoreApplication::setApplicationName("AirPlaySlideshow");
// Set default parameters
QSettings settings;
if( settings.value("ConnectionTimeout").isNull() )
{
settings.setValue("ConnectionTimeout", g_strDefaultConnectionTimeout);
}
if( settings.value("EnableScaleImages").isNull() )
{
settings.setValue("EnableScaleImages", g_strDefaultEnableScaleImages);
}
if( settings.value("ScreenSize").isNull() )
{
settings.setValue("ScreenSize", g_strDefaultScreenSize);
}
if( settings.value("ImageQuality").isNull() )
{
settings.setValue("ImageQuality", g_strDefaultImageQuality);
}
// Connect the invocation manager signals
bool bResult = QObject::connect(m_pInvokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&)), this, SLOT(handleInvoke(const bb::system::InvokeRequest&)));
Q_ASSERT(bResult);
// Connect the browser instance for replies and errors
bResult = QObject::connect(m_pBrowser, SIGNAL(browserRecordsChanged(const QList<BonjourRecord>&)), this, SLOT(handleBrowserRecordsChanged(const QList<BonjourRecord>&)));
Q_ASSERT(bResult);
bResult = QObject::connect(m_pBrowser, SIGNAL(error(DNSServiceErrorType)), this, SLOT(handleError(DNSServiceErrorType)));
Q_ASSERT(bResult);
// Connect the resolver instance for replies and errors
bResult = QObject::connect(m_pResolver, SIGNAL(recordResolved(const QString&, const QHostInfo&, int, const QVariantMap&)), this, SLOT(handleRecordResolved(const QString&, const QHostInfo&, int, const QVariantMap&)));
Q_ASSERT(bResult);
bResult = QObject::connect(m_pResolver, SIGNAL(error(DNSServiceErrorType)), this, SLOT(handleError(DNSServiceErrorType)));
Q_ASSERT(bResult);
// Connect us to receive system language change events
bResult = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(handleSystemLanguageChanged()));
Q_ASSERT(bResult);
// Initial load
handleSystemLanguageChanged();
// Start browsing for services
m_pBrowser->browseForServiceType(g_strAirPlayServiceType);
// create scene document from main.qml asset
// set parent to created document to ensure it exists for the whole application lifetime
QmlDocument* qml = QmlDocument::create("asset:///main.qml").parent(this);
if( !qml->hasErrors() )
{
// Register us
qml->setContextProperty("mainApp", this);
// create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
// set created root object as a scene
app->setScene(root);
}
}
// Destructor
AirPlaySlideshow::~AirPlaySlideshow()
{
}
// Set or retrieve configuration parameter
void AirPlaySlideshow::setParameter(const QString& parameter, const QString& value)
{
// Persist the parameter
QSettings settings;
settings.setValue(parameter, QVariant(value));
}
// Set or retrieve configuration parameter
QString AirPlaySlideshow::getParameter(const QString& parameter, const QString& defaultValue)
{
QSettings settings;
// First check if the parameter exists
if( settings.value(parameter).isNull() )
{
return defaultValue;
}
// Retrieve the parameter from the persistent store
QString result = settings.value(parameter).toString();
return result;
}
// Set device and trigger resolution
void AirPlaySlideshow::setDevice(const QVariantList& indexPath)
{
// Clear old device
if( m_pDevice )
{
// Release device instance
m_pDevice->deleteLater();
m_pDevice = NULL;
// Emit device changed signal
emit deviceChanged();
}
// Check if we have a valid index
if( !indexPath.isEmpty() )
{
// Retrieve the record fields
const QVariantMap entry = m_pRecordListModel->data(indexPath).toMap();
QString name = entry.value("name").value<QString>();
QString serviceType = entry.value("serviceType").value<QString>();
QString domain = entry.value("domain").value<QString>();
// Begin record resolution
BonjourRecord record(name, serviceType, domain);
m_pResolver->resolveRecord(record);
}
}
// Add item(s) to slideshow file list
void AirPlaySlideshow::addFileList(const QStringList& fileList)
{
// Iterate over the list of files
foreach( const QString& fileName, fileList )
{
// Retrieve information about the file
QFileInfo fileInfo(fileName);
QString name = fileInfo.fileName();
QUrl url = QUrl("file://" + fileName);
QString type = findMimeType(url);
// Create a unique UUID for the file
QUuid uuid = QUuid::createUuid();
QString assetID = uuid.toString().remove(QChar('{')).remove(QChar('}'));
// Create a QVariantMap to describe the file
QVariantMap entry;
entry["name"] = name;
entry["url"] = url;
entry["thumbnailUrl"] = url;
entry["location"] = url.path();
entry["type"] = type;
entry["assetID"] = assetID;
// Add the file entry
addFileEntry(entry);
}
}
// Remove one or more items from slideshow file list
void AirPlaySlideshow::removeFiles(const QVariantList& selectionList)
{
// Check if selection list is a single item or multiple items
if( selectionList.at(0).canConvert<QVariantList>() )
{
// Loop through all selected items
for( int i = selectionList.count() - 1; i >= 0; i-- )
{
// Get the index path of position i in the selection list.
QVariantList indexPath = selectionList.at(i).toList();
// Remove the entry
removeFile(indexPath);
}
}
else
{
// Remove the entry
removeFile(selectionList);
}
}
// Set password
void AirPlaySlideshow::setPassword(const QString& password)
{
m_password = password;
}
// Set slideshow transition
void AirPlaySlideshow::setTransition(int transition)
{
m_transition = transition;
}
// View current device record
void AirPlaySlideshow::viewDevice(const QVariantList& indexPath)
{
// Check if we have a valid index
BonjourRecord record;
if( !indexPath.isEmpty() )
{
// Retrieve the record fields
const QVariantMap entry = m_pRecordListModel->data(indexPath).toMap();
QString name = entry.value("name").value<QString>();
QString serviceType = entry.value("serviceType").value<QString>();
QString domain = entry.value("domain").value<QString>();
// Populate the device record
record = BonjourRecord(name, serviceType, domain);
}
// View the supplied device details
m_pDevicePropertiesViewer->setDeviceRecord(record);
}
// Start slideshow
void AirPlaySlideshow::configureSlideshow()
{
// Set the device and password
m_pSlideshowViewer->setDevice(m_pDevice, m_password);
// Copy the file list
QVariantList fileList;
for( int i = 0; i < m_pFileListModel->size(); i++ )
{
QVariantMap entry = m_pFileListModel->value(i).toMap();
fileList.append(entry);
}
// Retrieve image scaling settings
QSettings settings;
bool scaleImages = settings.value("EnableScaleImages").toBool();
QString screenSize = settings.value("ScreenSize").toString();
QString imageQuality = settings.value("ImageQuality").toString();
// Map screen size
int screenWidth, screenHeight;
if( screenSize == "1080p" )
{
screenWidth = 1920;
screenHeight = 1080;
}
else
{
screenWidth = 1280;
screenHeight = 720;
}
// Map image quality
int quality;
if( imageQuality == "low" )
{
quality = 25;
}
else if( imageQuality == "medium" )
{
quality = 50;
}
else
{
quality = 75;
}
// Set the slideshow properties
m_pSlideshowViewer->setSlideshowProperties(fileList, m_transition, screenWidth, screenHeight, quality, scaleImages);
}
// Handler for browser replies
void AirPlaySlideshow::handleBrowserRecordsChanged(const QList<BonjourRecord>& recordList)
{
// Clear the data model
m_pRecordListModel->clear();
// Iterate over the list of records
foreach( const BonjourRecord& record, recordList )
{
// Copy the record data into a model entry
QVariantMap entry;
entry["name"] = record.name();
entry["serviceType"] = record.serviceType();
entry["domain"] = record.domain();
// Add the entry to the model
m_pRecordListModel->append(entry);
}
// Emit change signal
emit recordListModelChanged();
}
// Handler for resolver replies
void AirPlaySlideshow::handleRecordResolved(const QString& fullName, const QHostInfo& hostInfo, int port, const QVariantMap& txtRecord)
{
// Create and set device
m_pDevice = new AirPlayDevice(fullName, hostInfo, port, txtRecord, this);
emit deviceChanged();
}
// Handler for browser / resolver errors
void AirPlaySlideshow::handleError(DNSServiceErrorType err)
{
// Log error
cout << "AirPlaySlideshow - Received error: " << err << endl;
}
// Handler for invocation messages
void AirPlaySlideshow::handleInvoke(const InvokeRequest& request)
{
// Retrieve information from the request
QString requestAction = request.action();
QString requestType = request.mimeType();
QUrl requestUrl = request.uri();
QByteArray requestData = request.data();
// Check MIME type
if( (requestType == "filelist/media") || (requestType == "filelist/mixed") || (requestType == "filelist/image") )
{
// Parse JSON data
JsonDataAccess dataAccess;
QVariant jsonData = dataAccess.loadFromBuffer(requestData);
QVariantList fileDescriptionList = jsonData.value<QVariantList>();
// Loop through list of supplied files
foreach( const QVariant& fileDescriptionItem, fileDescriptionList )
{
// Extract the file description as a QVariantMap
QVariantMap fileDescription = fileDescriptionItem.value<QVariantMap>();
// Retrieve the URL and extract information from it
QUrl url;
QString name;
if( fileDescription.contains("uri") )
{
url = fileDescription.value("uri").toUrl();
QFileInfo fileInfo(url.path());
name = fileInfo.fileName();
}
// Retrieve or divine MIME type
QString type;
if( fileDescription.contains("type") )
{
type = fileDescription.value("type").toString();
}
else
{
type = findMimeType(url);
}
// Validate the file's MIME type before adding it to the list
if( validateMimeType(type) )
{
// Retrieve metadata and process for thumbnail
QUrl thumbnailUrl = url;
if( fileDescription.contains("metadata") )
{
QByteArray metadataArray = fileDescription.value("metadata").toByteArray();
jsonData = dataAccess.loadFromBuffer(metadataArray);
QVariantMap metadata = jsonData.value<QVariantMap>();
if( metadata.contains("thumb") )
{
// Retrieve URL and test for extra "file://" protocol
QString temp = metadata.value("thumb").toString();
if( temp.startsWith("file://file://") )
{
temp = temp.mid(7);
}
thumbnailUrl = QUrl(temp);
}
}
// Create a unique UUID for the file
QUuid uuid = QUuid::createUuid();
QString assetID = uuid.toString().remove(QChar('{')).remove(QChar('}'));
// Create a QVariantMap to describe the file
QVariantMap entry;
entry["name"] = name;
entry["url"] = url;
entry["thumbnailUrl"] = thumbnailUrl;
entry["location"] = url.path();
entry["type"] = type;
entry["assetID"] = assetID;
// Add the file entry
addFileEntry(entry);
}
}
}
else if( validateMimeType(requestType) )
{
// Extract the file name from the URL
QFileInfo fileInfo(requestUrl.path());
QString name = fileInfo.fileName();
// Create a unique UUID for the file
QUuid uuid = QUuid::createUuid();
QString assetID = uuid.toString().remove(QChar('{')).remove(QChar('}'));
// Create a QVariantMap to describe the file
QVariantMap entry;
entry["name"] = name;
entry["url"] = requestUrl;
entry["thumbnailUrl"] = requestUrl;
entry["location"] = requestUrl.path();
entry["type"] = requestType;
entry["assetID"] = assetID;
// Add the file entry
addFileEntry(entry);
}
}
// Handler for system language change event
void AirPlaySlideshow::handleSystemLanguageChanged()
{
// Remove existing translation files
QCoreApplication::instance()->removeTranslator(m_pTranslator);
// Initiate, load and install the application translation files
QString locale_string = QLocale().name();
QString file_name = QString("AirPlaySlideshow_%1").arg(locale_string);
if( m_pTranslator->load(file_name, "app/native/qm") )
{
QCoreApplication::instance()->installTranslator(m_pTranslator);
}
}
// Add item to file list, checking for duplicates
void AirPlaySlideshow::addFileEntry(const QVariantMap& entry)
{
// Search for matching file URL
bool bFound = false;
for( int i = 0; i < m_pFileListModel->size(); i++ )
{
QVariantMap testEntry = m_pFileListModel->value(i).toMap();
if( testEntry.value("url").toString() == entry.value("url").toString() )
{
bFound = true;
break;
}
}
// If no match found, add the entry to the data model
if( bFound == false )
{
m_pFileListModel->append(entry);
// Emit change signal
emit fileListModelChanged();
}
}
// Remove item from file list
void AirPlaySlideshow::removeFile(const QVariantList& indexPath)
{
// Retrieve the entry and its index
const QVariantMap entry = m_pFileListModel->data(indexPath).toMap();
int index = m_pFileListModel->indexOf(entry);
// Remove the entry
m_pFileListModel->removeAt(index);
// Emit change signal
emit fileListModelChanged();
}
// Launch file viewer for preview
void AirPlaySlideshow::viewFile(const QVariantList& indexPath)
{
// Check if we have a valid index
if( !indexPath.isEmpty() )
{
// Retrieve the entry and relevant fields
const QVariantMap entry = m_pFileListModel->data(indexPath).toMap();
QUrl url = entry.value("url").toUrl();
QString type = entry.value("type").toString();
// Create an invocation request
InvokeRequest request;
request.setTarget("sys.pictures.card.previewer");
request.setAction("bb.action.VIEW");
request.setUri(url);
request.setMimeType(type);
// Send the invocation request
InvokeTargetReply* pReply = m_pInvokeManager->invoke(request);
pReply->deleteLater();
}
}
// Property accessor methods
DataModel* AirPlaySlideshow::recordListModel() const
{
return m_pRecordListModel;
}
// Property accessor methods
DataModel* AirPlaySlideshow::fileListModel() const
{
return m_pFileListModel;
}
// Property accessor methods
AirPlayDevice* AirPlaySlideshow::device() const
{
return m_pDevice;
}
// Property accessor methods
DevicePropertiesViewer* AirPlaySlideshow::devicePropertiesViewer() const
{
return m_pDevicePropertiesViewer;
}
// Property accessor methods
SlideshowViewer* AirPlaySlideshow::slideshowViewer() const
{
return m_pSlideshowViewer;
}
| 31.902318 | 221 | 0.62873 |
400c2c3f8f33ccb28c2dc5910e1e0d85e6269da8 | 4,719 | py | Python | rest/apis.py | k-wojcik/kylin_client_tool | 0fe827d1c8a86e3da61c85c48f78ce03c9260f3c | [
"Apache-2.0"
] | null | null | null | rest/apis.py | k-wojcik/kylin_client_tool | 0fe827d1c8a86e3da61c85c48f78ce03c9260f3c | [
"Apache-2.0"
] | null | null | null | rest/apis.py | k-wojcik/kylin_client_tool | 0fe827d1c8a86e3da61c85c48f78ce03c9260f3c | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
__author__ = 'Huang, Hua'
import json
import sys
import requests
from requests.auth import HTTPBasicAuth
from settings import settings
class KylinRestApi:
cooikes = None
def __init__(self):
self.host = settings.KYLIN_REST_HOST
self.port = settings.KYLIN_REST_PORT
self.user = settings.KYLIN_USER
self.password = settings.KYLIN_PASSWORD
self.rest_path_prefix = settings.KYLIN_REST_PATH_PREFIX
self.timeout = settings.KYLIN_REST_TIMEOUT or 30
if not KylinRestApi.cooikes:
KylinRestApi.cooikes = KylinRestApi.login(self)
if not KylinRestApi.cooikes:
print "can't set cookies, exiting..."
sys.exit(1)
@staticmethod
def login(kylin_rest_api):
if kylin_rest_api.user and kylin_rest_api.password:
# auth and get back cookies
headers = {}
headers['content-type'] = 'application/json'
headers['Connection'] = 'close'
session = requests.session()
try:
req_response = session.post(kylin_rest_api.get_api_url('user/authentication', ''), \
auth=HTTPBasicAuth(kylin_rest_api.user, kylin_rest_api.password), timeout=kylin_rest_api.timeout)
finally:
session.close()
return req_response.cookies
return None
@staticmethod
def is_response_ok(response):
return str(response.status_code) == '200'
def get_api_url(self, uri, query_string):
return self.host + ':' + str(self.port) + self.rest_path_prefix \
+ '/' + uri + '?' + query_string
def http_get(self, uri, query_string, headers=None):
api_url = self.get_api_url(uri, query_string)
headers = headers if headers and type(headers) == dict else {}
headers['content-type'] = 'application/json'
headers['Connection'] = 'close'
session = requests.session()
try:
req_response = session.get(api_url, headers=headers, cookies=KylinRestApi.cooikes, timeout=self.timeout)
finally:
session.close()
return req_response
def http_post(self, uri, query_string, headers=None, payload=None):
api_url = self.get_api_url(uri, query_string)
headers = headers if headers and type(headers) == dict else {}
headers['content-type'] = 'application/json'
headers['Connection'] = 'close'
session = requests.session()
try:
if payload:
data = payload if type(payload) == str else json.dumps(payload)
req_response = session.post(api_url, data=data, headers=headers, cookies=KylinRestApi.cooikes)
else:
req_response = session.post(api_url, headers=headers, cookies=KylinRestApi.cooikes)
finally:
session.close()
return req_response
def http_put(self, uri, query_string, headers=None, payload=None):
api_url = self.get_api_url(uri, query_string)
headers = headers if headers and type(headers) == dict else {}
headers['content-type'] = 'application/json'
headers['Connection'] = 'close'
session = requests.session()
try:
if payload:
data = payload if type(payload) == str else json.dumps(payload)
req_response = session.put(api_url, data=data, headers=headers, cookies=KylinRestApi.cooikes, timeout=self.timeout, verify=False)
else:
req_response = session.put(api_url, headers=headers, cookies=KylinRestApi.cooikes, timeout=self.timeout, verify=False)
finally:
session.close()
return req_response
def http_delete(self, uri, query_string, headers=None, payload=None):
api_url = self.get_api_url(uri, query_string)
headers = headers if headers and type(headers) == dict else {}
headers['content-type'] = 'application/json'
headers['Connection'] = 'close'
# print payload
session = requests.session()
try:
if payload:
data = payload if type(payload) == str else json.dumps(payload)
req_response = session.delete(api_url, data=data, headers=headers, cookies=KylinRestApi.cooikes, timeout=self.timeout)
else:
req_response = session.delete(api_url, headers=headers, cookies=KylinRestApi.cooikes, timeout=self.timeout)
finally:
session.close()
# print str(req_response.json())
return req_response
| 36.3 | 150 | 0.613054 |
b6eb403bc86fb54755b3ed372b5d18968bf9c3f3 | 986 | dart | Dart | lib/pages/initial/initial_page.dart | nonoyona/tuttut-correct-admin | ef7dfe051bf864878b77d59e2f7fa29d81e3e3e8 | [
"MIT"
] | null | null | null | lib/pages/initial/initial_page.dart | nonoyona/tuttut-correct-admin | ef7dfe051bf864878b77d59e2f7fa29d81e3e3e8 | [
"MIT"
] | 11 | 2020-06-13T21:42:46.000Z | 2020-06-20T16:04:42.000Z | lib/pages/initial/initial_page.dart | nonoyona/tuttut-correct-admin | ef7dfe051bf864878b77d59e2f7fa29d81e3e3e8 | [
"MIT"
] | null | null | null | import 'package:correct/logic/services/auth_service.dart';
import 'package:correct/pages/group_overview/group_overview_page.dart';
import 'package:correct/pages/initial/initial_logic.dart';
import 'package:correct/pages/signin/signin_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class InitialPage extends StatelessWidget {
const InitialPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<InitialLogic>(
create: (context) => InitialLogic(),
child: Consumer<InitialLogic>(
builder: (context, logic, child) {
if (logic.redirect == "/home") {
return GroupOverviewPage();
} else if (logic.redirect == "/signin") {
return SignInPage();
}
return Scaffold(
body: Center(
child: Text("redirecting..."),
),
);
},
),
);
}
}
| 29.878788 | 71 | 0.629817 |
681f732837446359a28e1873d2a05b0087763388 | 503 | kt | Kotlin | app/src/main/java/com/ranhaveshush/mdb/vo/MoviesCategory.kt | ranhaveshush/mdb | bb6941ea83aa2ee629defece08771cb94c96d779 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/ranhaveshush/mdb/vo/MoviesCategory.kt | ranhaveshush/mdb | bb6941ea83aa2ee629defece08771cb94c96d779 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/ranhaveshush/mdb/vo/MoviesCategory.kt | ranhaveshush/mdb | bb6941ea83aa2ee629defece08771cb94c96d779 | [
"Apache-2.0"
] | null | null | null | package com.ranhaveshush.mdb.vo
import androidx.lifecycle.LiveData
import androidx.navigation.NavDirections
import androidx.paging.PagedList
/**
* The movie category [value object][ValueObject].
*
* Aggregates the movie category title, live movies list
* and the navigation directions to the category screen.
*/
data class MoviesCategory(
val title: String,
val getLiveMoviesList: () -> LiveData<PagedList<MovieItem>>,
val getDirectionsToCategory: () -> NavDirections
) : ValueObject
| 27.944444 | 64 | 0.765408 |
33c0875ae405dd74edecedd448356d7c10e12a60 | 947 | dart | Dart | example/lib/pages/home_page.dart | Sannada/Breezy | 4c85805ac57553bf95995e176e834837a54e6c3c | [
"BSD-3-Clause"
] | null | null | null | example/lib/pages/home_page.dart | Sannada/Breezy | 4c85805ac57553bf95995e176e834837a54e6c3c | [
"BSD-3-Clause"
] | 2 | 2019-03-28T16:44:16.000Z | 2019-05-23T20:33:06.000Z | example/lib/pages/home_page.dart | Sannada/Breezy | 4c85805ac57553bf95995e176e834837a54e6c3c | [
"BSD-3-Clause"
] | 1 | 2019-03-28T16:13:34.000Z | 2019-03-28T16:13:34.000Z | import 'package:flutter/material.dart';
import '../fragments/map_fragment.dart';
class HomePage extends StatefulWidget {
final String startPoint = '';
final String startPointLat = '';
final String startPointLng = '';
final String endPoint = '';
final String endPointLat = '';
final String endPointLng = '';
final String budget = '';
final String numberOfGuests = '';
final bool isChangeText = true;
@override
State<StatefulWidget> createState() {
return new HomePageState();
}
}
class HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: MapFragment(
widget.startPoint,
widget.startPointLat,
widget.startPointLng,
widget.endPoint,
widget.endPointLat,
widget.endPointLng,
widget.numberOfGuests,
widget.budget,
widget.isChangeText
),
);
}
}
| 24.282051 | 45 | 0.650475 |
96a8ed905b9626c6e855bdb87a79960b9b163ca1 | 5,439 | cpp | C++ | arc/074d.cpp | anekawamasayuki/atcoder_solutions | 2f5dce7d7cc150162262a1798e009b95c187fa14 | [
"MIT"
] | 1 | 2017-12-19T08:09:33.000Z | 2017-12-19T08:09:33.000Z | arc/074d.cpp | anekawamasayuki/atcoder_solutions | 2f5dce7d7cc150162262a1798e009b95c187fa14 | [
"MIT"
] | null | null | null | arc/074d.cpp | anekawamasayuki/atcoder_solutions | 2f5dce7d7cc150162262a1798e009b95c187fa14 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
// #include "ane.cpp"
const int INF = 1e9;
const long long INFLL = 1e18;
const int NMAX = 105;
const int MMAX = 105;
const int KMAX = 1005;
const int MOD = 1e9 + 7;
using namespace std;
// comment to disable debug functions
// #define DEBUG
// frequently used macros
#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif
#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif
// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> pl;
typedef pair<ll, ll> pll;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;
// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};
// frequently used structs
struct edge{
int to,cap,rev;
};
// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
va_list arg;
va_start(arg, format);
vprintf(format, arg);
va_end(arg);
}
#endif
// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{ \
printf("%s: ", #v); \
for (int i = 0; i < (c); ++i) \
{ \
cout << (v)[i] << " "; \
} \
cout << endl; \
} while(0)
#else
#define DUMPV(v,c)
#endif
// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
ll mid;
while(_end - _begin > 1LL) {
mid = (_begin + _end) / 2LL;
if(f(mid)) {
debug("BSearch: f(%d) == true\n", mid);
_end = mid;
}
else
{
debug("BSearch: f(%d) == false\n", mid);
_begin = mid;
}
}
return _end;
}
int N,M,K,A,B,C,D,E;
char dat[NMAX][MMAX] = {};
std::vector<edge> G[NMAX + MMAX];
p S, T;
const int S_id = 201;
const int T_id = 202;
std::vector<p> L;
bool used[NMAX + MMAX] = {};
ll ans = 0;
inline void add_edge(int i, int j){
G[i].push_back(edge{j, 1, (int)G[j].size()});
G[j].push_back(edge{i, 1, (int)G[i].size()-1});
}
int dfs(int v, int t, int c){
debug("dfs(%d, %d, %d)\n", v, t, c);
if(v == t) return c;
used[v] = true;
for(auto&& e : G[v]) {
if (!used[e.to] && e.cap > 0)
{
int d = dfs(e.to, t, min(c, e.cap));
if(!d) continue;
e.cap -= d;
G[e.to][e.rev].cap += d;
return d;
}
}
return 0;
}
int max_flow(int s, int t){
int flow = 0;
while(1) {
Fill(used, false);
int f = dfs(s, t, INF);
if(!f) return flow;
flow += f;
debug("flow += 1\n");
}
}
void solve(){
// main algorithm
if (S.first == T.first || S.second == T.second)
{
ans = -1LL;
return;
}
// for (int i = 0; i < L.size(); ++i)
// {
// if (L[i].first == S.first || L[i].second == S.second)
// add_edge(i, S_id);
// if (L[i].first == T.first || L[i].second == T.second)
// add_edge(i, T_id);
// for (int j = i + 1; j < L.size(); ++j)
// if (L[i].first == L[j].first || L[i].second == L[j].second)
// add_edge(i, j);
// }
G[S_id].push_back(edge{S.first, INF, (int)G[S.first].size()});
G[S.first].push_back(edge{S_id, 0, (int)G[S_id].size() - 1});
G[S_id].push_back(edge{S.second + N, INF, (int)G[S.second + N].size()});
G[S.second + N].push_back(edge{S_id, 0, (int)G[S_id].size() - 1});
G[T_id].push_back(edge{T.first, 0, (int)G[T.first].size()});
G[T.first].push_back(edge{T_id, INF, (int)G[T_id].size() - 1});
G[T_id].push_back(edge{T.second + N, 0, (int)G[T.second + N].size()});
G[T.second + N].push_back(edge{T_id, INF, (int)G[T_id].size() - 1});
for(auto&& p : L) {
G[p.first].push_back(edge{p.second + N, 1, (int)G[p.second + N].size()});
G[p.second + N].push_back(edge{p.first, 1, (int)G[p.first].size() - 1});
}
ans = max_flow(S_id, T_id);
}
void debug(){
// output debug information
cout << "G:\n";
for(int i = 1; i <= N + M; ++i)
for(auto&& e : G[i]) {
debug("%d -> %d : %d, rev: %d\n", i, e.to, e.cap, e.rev);
}
cout << "S:\n";
for(auto&& e : G[S_id]) {
debug("%d -> %d : %d, rev: %d\n", S_id, e.to, e.cap, e.rev);
}
cout << "T:\n";
for(auto&& e : G[T_id]) {
debug("%d -> %d : %d, rev: %d\n", T_id, e.to, e.cap, e.rev);
}
}
void answer(){
// output answer
printf("%lld\n", ans);
}
int main(int argc, char const *argv[])
{
// operate inputs
// Fill(dp, -1);
scanf("%d%d", &N,&M);
for (int i = 1; i <= N; ++i)
{
for (int j = 1; j <= M ; ++j)
{
scanf(" %c", &dat[i][j]);
switch(dat[i][j]){
case 'S':
S = p(i, j);
break;
case 'T':
T = p(i, j);
break;
case 'o':
L.push_back(p(i, j));
break;
case '.':
break;
default:
cerr << "input error\n";
exit(1);
break;
}
}
}
solve();
#ifdef DEBUG
debug();
#endif
answer();
return 0;
} | 22.382716 | 77 | 0.520132 |
d10153658bbca4cd241440f8b644929478a08e5a | 3,853 | ps1 | PowerShell | NewTesting/Get-PANSessions.ps1 | sjborbajr/PaloAltoNetworksScripts | f2d03737721bc90247c26a0a96572596e0113f4f | [
"Apache-2.0",
"0BSD"
] | null | null | null | NewTesting/Get-PANSessions.ps1 | sjborbajr/PaloAltoNetworksScripts | f2d03737721bc90247c26a0a96572596e0113f4f | [
"Apache-2.0",
"0BSD"
] | null | null | null | NewTesting/Get-PANSessions.ps1 | sjborbajr/PaloAltoNetworksScripts | f2d03737721bc90247c26a0a96572596e0113f4f | [
"Apache-2.0",
"0BSD"
] | 1 | 2020-01-07T12:21:13.000Z | 2020-01-07T12:21:13.000Z | Function Get-PANSessions {
<#
.SYNOPSIS
This will querry the active session table based on the filter provided
.DESCRIPTION
This will querry the active session table based on the filter provided
.PARAMETER Filter
The Filter to apply to the query
.PARAMETER Addresses
This is a set of addresses to run the command on, The firewalls must have the same master key for this to work
.PARAMETER Key
This is a key to just use
.PARAMETER Credential
This is a user account to just use
.PARAMETER Tag
This is the shortname to use to reference auth information and addresses
.PARAMETER Path
Path to the file that has the tag data
.EXAMPLE
The example below gets session that have been active for more than an hour
PS C:\> Get-PANSessions -Tag 'EdgeFirewalls' -Filter '<min-age>3600</min-age><type>flow</type><state>active</state><min-kb>1</min-kb>' | Out-GridView
.NOTES
Author: Steve Borba https://github.com/sjborbajr/PAN-Power
Last Edit: 2019-04-05
Version 1.0 - initial release
Version 1.0.1 - Updating descriptions and formatting
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory=$False)] [string] $Filter,
[Parameter(Mandatory=$False)] [string] $Tag,
[Parameter(Mandatory=$False)] [string] $Path = '',
[Parameter(Mandatory=$False)] [string[]] $Addresses,
[Parameter(Mandatory=$False)] [string] $Key,
[Parameter(Mandatory=$False)] [System.Management.Automation.PSCredential] $Credential
)
#Get Data from panrc based on tag, an empty tag is "ok" and returns data
$TagData = Get-PANRCTagData -Tag $Tag -Path $Path
#If addresses were not passed, use addresses from panrc
If ($Addresses -eq '' -or $null -eq $Addresses) {
If ($TagData.Addresses) {
$Addresses = $TagData.Addresses
} else {
"No Addresses Found"
Return
}
}
#Use other authentication (credential/key), if passed
if ($Credential) {
$Auth = 'user='+$Credential.UserName+'password='+$Credential.GetNetworkCredential().password
} Else {
If ($Key.Length -gt 0) {
$Auth = "key=$Key"
} else {
If ($TagData.Auth) {
$Auth = $TagData.Auth
} else {
"No Authentication Information Found"
return
}
}
}
#Make Sure the filter has the outer XML tags
If ($Filter.Length -gt 1 -and -not ($Filter -imatch '<filter>')) {
$Filter = '<filter>'+$Filter+'</filter>'
}
#Grab the sessions from all the firewalls
$Sessions = @()
ForEach ($Address in $Addresses) {
$Response = Invoke-RestMethod ("https://"+$Address+"/api/?type=op&cmd=<show><session><all>$Filter</all></session></show>&"+$TagData.Auth)
if ( $Response.response.status -eq 'success' ) {
$Sessions = $Sessions + $Response.response.result.entry
#Had a firewall return exactly 2048 results, so I found I need to chop up into smaller results to get all the data
#if ($Sessions.count -eq 2048) { $Overloaded = $true }
#If ($Large) {
# <nat>source|destination|both|none</nat>
# <protocol>6|17</protocol>
# <ssl-decrypt>yes|no</ssl-decrypt>
#}
} else {
$Response.response
Return
}
}
#A firewall queeried sometimes includes sessions built during query, filtering if time is less than a minute and filter set min age greater than a minute
if ((0+([xml]$Filter).filter.'min-age') -gt 60) {
$i = 0
While ($i -lt $Sessions.Count){
$delta = ''
$delta = New-TimeSpan -Start ([datetime]::parseexact(($Sessions[$i].'start-time').Substring(4,20).replace(" "," "),'MMM d HH:mm:ss yyyy', $null)) -End (Get-Date)
if ( $delta.TotalMinutes -ge 1 ) {$Sessions[$i]}
$i++
}
} else {
$Sessions
}
}
| 33.504348 | 169 | 0.629639 |
c7f4159e3973d00025f6757b43b6f9d9c65b2552 | 2,750 | java | Java | modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201409/cm/ThirdPartyRedirectAdExpandingDirection.java | david-gorisse/googleads-java-lib | 03b8c7e83bc5a361e374d345afdd93290d143c34 | [
"Apache-2.0"
] | null | null | null | modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201409/cm/ThirdPartyRedirectAdExpandingDirection.java | david-gorisse/googleads-java-lib | 03b8c7e83bc5a361e374d345afdd93290d143c34 | [
"Apache-2.0"
] | null | null | null | modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201409/cm/ThirdPartyRedirectAdExpandingDirection.java | david-gorisse/googleads-java-lib | 03b8c7e83bc5a361e374d345afdd93290d143c34 | [
"Apache-2.0"
] | null | null | null |
package com.google.api.ads.adwords.jaxws.v201409.cm;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ThirdPartyRedirectAd.ExpandingDirection.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="ThirdPartyRedirectAd.ExpandingDirection">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="UNKNOWN"/>
* <enumeration value="EXPANDING_UP"/>
* <enumeration value="EXPANDING_DOWN"/>
* <enumeration value="EXPANDING_LEFT"/>
* <enumeration value="EXPANDING_RIGHT"/>
* <enumeration value="EXPANDING_UPLEFT"/>
* <enumeration value="EXPANDING_UPRIGHT"/>
* <enumeration value="EXPANDING_DOWNLEFT"/>
* <enumeration value="EXPANDING_DOWNRIGHT"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "ThirdPartyRedirectAd.ExpandingDirection")
@XmlEnum
public enum ThirdPartyRedirectAdExpandingDirection {
/**
*
* Whether the ad can be expanded is unknown.
* <span class="constraint Rejected">Used for return value only. An enumeration could not be processed, typically due to incompatibility with your WSDL version.</span>
*
*
*/
UNKNOWN,
/**
*
* The ad is allowed to expand upward.
*
*
*/
EXPANDING_UP,
/**
*
* The ad is allowed to expand downward.
*
*
*/
EXPANDING_DOWN,
/**
*
* The ad is allowed to expand leftward.
*
*
*/
EXPANDING_LEFT,
/**
*
* The ad is allowed to expand rightward.
*
*
*/
EXPANDING_RIGHT,
/**
*
* The ad is allowed to expand toward the up-left corner.
*
*
*/
EXPANDING_UPLEFT,
/**
*
* The ad is allowed to expand toward the up-right corner.
*
*
*/
EXPANDING_UPRIGHT,
/**
*
* The ad is allowed to expand toward the down-left corner.
*
*
*/
EXPANDING_DOWNLEFT,
/**
*
* The ad is allowed to expand toward the down-right corner.
*
*
*/
EXPANDING_DOWNRIGHT;
public String value() {
return name();
}
public static ThirdPartyRedirectAdExpandingDirection fromValue(String v) {
return valueOf(v);
}
}
| 23.504274 | 187 | 0.537091 |
964d36748c7aa891852002b1d058ff8703df8c23 | 255 | php | PHP | application/views/Contoh1.php | Millatinaa/pustaka-booking-3a | ec98a6838c33a0da8c955ad9930a6b842eea4d15 | [
"MIT"
] | null | null | null | application/views/Contoh1.php | Millatinaa/pustaka-booking-3a | ec98a6838c33a0da8c955ad9930a6b842eea4d15 | [
"MIT"
] | null | null | null | application/views/Contoh1.php | Millatinaa/pustaka-booking-3a | ec98a6838c33a0da8c955ad9930a6b842eea4d15 | [
"MIT"
] | null | null | null | <?php
class Contoh1 extends CI_Controller
{
public funtion index()
{
echo "<h1>Perkenalkan</h1>";
echo"Nama saya Millatina Rosyada
Saya tingal di bumi lestari
dan hobby saya makan sambil nonton live tiktok";
}
} | 23.181818 | 56 | 0.635294 |
5b6cf1c0717c4eb71f128b9d0fb7fd1d3ab0df93 | 429 | cpp | C++ | book/cpp_templates/tmplbook/basics/cref.cpp | houruixiang/day_day_learning | 208f70a4f0a85dd99191087835903d279452fd54 | [
"MIT"
] | null | null | null | book/cpp_templates/tmplbook/basics/cref.cpp | houruixiang/day_day_learning | 208f70a4f0a85dd99191087835903d279452fd54 | [
"MIT"
] | null | null | null | book/cpp_templates/tmplbook/basics/cref.cpp | houruixiang/day_day_learning | 208f70a4f0a85dd99191087835903d279452fd54 | [
"MIT"
] | null | null | null | #include <functional> // for std::cref()
#include <string>
#include <iostream>
void printString(std::string const& s)
{
std::cout << s << '\n';
}
template<typename T>
void printT (T arg)
{
printString(arg); // might convert arg back to std::string
}
int main()
{
std::string s = "hello";
printT(s); // print s passed by value
printT(std::cref(s)); // print s passed ``as if by reference''
}
| 19.5 | 67 | 0.601399 |
f09168e13abfd5d74eb05fde701f4b36a2a964e5 | 292 | js | JavaScript | app/components/P/messages.js | giorgio1985/ReactBoilerplate | 2c6b95353225813cefa1ee507f97e238e53eb009 | [
"MIT"
] | null | null | null | app/components/P/messages.js | giorgio1985/ReactBoilerplate | 2c6b95353225813cefa1ee507f97e238e53eb009 | [
"MIT"
] | 4 | 2020-07-17T16:31:06.000Z | 2022-03-27T02:57:49.000Z | app/components/P/messages.js | giorgio1985/ReactBoilerplate | 2c6b95353225813cefa1ee507f97e238e53eb009 | [
"MIT"
] | null | null | null | /*
* P Messages
*
* This contains all the text for the P component.
import { defineMessages } from 'react-intl';
export const scope = 'app.components.P';
export default defineMessages({
header: {
id: `${scope}.header`,
defaultMessage: 'This is the P component!',
},
});
*/ | 17.176471 | 50 | 0.64726 |
d29bb8319e3788417ce27b087bcf199b4f3cb8c7 | 539 | php | PHP | app/lib/exception/PlatException.php | L-zhicong/BlogApi | 7ae99188e9af3837b7df1418fd748bf366994a5c | [
"Apache-2.0"
] | null | null | null | app/lib/exception/PlatException.php | L-zhicong/BlogApi | 7ae99188e9af3837b7df1418fd748bf366994a5c | [
"Apache-2.0"
] | 1 | 2022-03-09T02:47:50.000Z | 2022-03-09T02:47:50.000Z | app/lib/exception/PlatException.php | L-zhicong/BlogApi | 7ae99188e9af3837b7df1418fd748bf366994a5c | [
"Apache-2.0"
] | null | null | null | <?php
namespace app\lib\exception;
/**
* 平台错误
*/
class PlatException extends BaseException
{
public $code = 403;
public $errorCode = 10001;
public function __construct($message='平台错误',$code = 0, \Throwable $previous = null)
{
if (is_array($message)) {
$errInfo = $message;
$message = $errInfo[1] ?? '未知错误';
if ($this->code === 0) {
$code = $errInfo[0] ?? $this->code;
}
}
parent::__construct($message, $code, $previous);
}
} | 20.730769 | 87 | 0.521336 |
049dc75ecb95ad77a70f78e0cb07af417ae49d35 | 452 | java | Java | modules/base/remote-servers-api/src/main/java/com/intellij/remoteServer/configuration/RemoteServerListener.java | halotroop2288/consulo | fbb477f3c1d9dedd7a9f78cbfb50060a946bd69f | [
"Apache-2.0"
] | 634 | 2015-01-01T19:14:25.000Z | 2022-03-22T11:42:50.000Z | modules/base/remote-servers-api/src/main/java/com/intellij/remoteServer/configuration/RemoteServerListener.java | halotroop2288/consulo | fbb477f3c1d9dedd7a9f78cbfb50060a946bd69f | [
"Apache-2.0"
] | 410 | 2015-01-19T09:57:51.000Z | 2022-03-22T16:24:59.000Z | modules/base/remote-servers-api/src/main/java/com/intellij/remoteServer/configuration/RemoteServerListener.java | halotroop2288/consulo | fbb477f3c1d9dedd7a9f78cbfb50060a946bd69f | [
"Apache-2.0"
] | 50 | 2015-03-10T04:14:49.000Z | 2022-03-22T07:08:45.000Z | package com.intellij.remoteServer.configuration;
import com.intellij.util.messages.Topic;
import javax.annotation.Nonnull;
import java.util.EventListener;
/**
* @author nik
*/
public interface RemoteServerListener extends EventListener {
Topic<RemoteServerListener> TOPIC = Topic.create("remote servers", RemoteServerListener.class);
void serverAdded(@Nonnull RemoteServer<?> server);
void serverRemoved(@Nonnull RemoteServer<?> server);
}
| 26.588235 | 97 | 0.789823 |
0db43a6b0153f9ec898984990f247d0d4b0e3a63 | 869 | sql | SQL | taobao-user/scripts/sql/common.sql | KierenEinar/taobao | 2c34dc4e7af9838b5620d2bc9396109eee599578 | [
"MIT"
] | null | null | null | taobao-user/scripts/sql/common.sql | KierenEinar/taobao | 2c34dc4e7af9838b5620d2bc9396109eee599578 | [
"MIT"
] | null | null | null | taobao-user/scripts/sql/common.sql | KierenEinar/taobao | 2c34dc4e7af9838b5620d2bc9396109eee599578 | [
"MIT"
] | null | null | null | CREATE TABLE `users` (
`id` bigint(20) NOT NULL,
`first_name` varchar(32) DEFAULT NULL,
`last_name` varchar(32) DEFAULT NULL,
`member_id` bigint(20) NOT NULL,
`credit_id` bigint(20) NOT NULL,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT NULL,
`gender` enum('男','女') DEFAULT '男',
`user_id` bigint(20) NOT NULL,
`phone` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `phone` (`phone`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
drop table if EXISTS user_receive_config ;
create table `user_receive_config` (
id bigint not null primary key
user_id bigint(20) not null,
receiver_name varchar(64) not null,
receiver_phone varchar(128) not null,
receiver_detail varchar (256) not null,
create_time datetime not null default now(),
update_time datetime,
key(`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| 31.035714 | 51 | 0.731876 |