code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
|---|---|---|---|---|---|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
/*
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.Rest.ClientRuntime.E2E.Tests")]
[assembly: AssemblyTrademark("")]
*/
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4e9aeb40-026f-4ba1-a2db-c8e252305157")]
|
JasonYang-MSFT/azure-sdk-for-net
|
src/SdkCommon/ClientRuntime/Test/ClientRuntime.E2E.Tests/Properties/AssemblyInfo.cs
|
C#
|
mit
| 856
|
#!/usr/bin/env python
# Copyright (c) 2002-2003 ActiveState Corp.
# Author: Trent Mick (TrentM@ActiveState.com)
"""Test suite for which.py."""
import sys
import os
import re
import tempfile
import unittest
import testsupport
#XXX:TODO
# - def test_registry_success(self): ...App Paths setting
# - def test_registry_noexist(self):
# - test all the other options
# - test on linux
# - test the module API
class WhichTestCase(unittest.TestCase):
def setUp(self):
"""Create a temp directory with a couple test "commands".
The temp dir can be added to the PATH, etc, for testing purposes.
"""
# Find the which.py to call.
whichPy = os.path.join(os.path.dirname(__file__),
os.pardir, "which.py")
self.which = sys.executable + " " + whichPy
# Setup the test environment.
self.tmpdir = tempfile.mktemp()
os.makedirs(self.tmpdir)
if sys.platform.startswith("win"):
self.testapps = ['whichtestapp1.exe',
'whichtestapp2.exe',
'whichtestapp3.wta']
else:
self.testapps = ['whichtestapp1', 'whichtestapp2']
for app in self.testapps:
path = os.path.join(self.tmpdir, app)
f = open(path, 'wb')
f.write('\n'.encode('ascii'))
f.close()
os.chmod(path, 0o755)
def tearDown(self):
testsupport.rmtree(self.tmpdir)
def test_opt_h(self):
output, error, retval = testsupport.run(self.which+' --h')
token = 'Usage:'.encode('ascii')
self.failUnless(output.find(token) != -1,
"'%s' was not found in 'which -h' output: '%s' "\
% (token, output))
self.failUnless(retval == 0,
"'which -h' did not return 0: retval=%d" % retval)
def test_opt_help(self):
output, error, retval = testsupport.run(self.which+' --help')
token = 'Usage:'.encode('ascii')
self.failUnless(output.find(token) != -1,
"'%s' was not found in 'which --help' output: '%s' "\
% (token, output))
self.failUnless(retval == 0,
"'which --help' did not return 0: retval=%d" % retval)
def test_opt_version(self):
output, error, retval = testsupport.run(self.which+' --version')
versionRe = re.compile("^which \d+\.\d+\.\d+$".encode('ascii'))
versionMatch = versionRe.search(output.strip())
self.failUnless(versionMatch,
"Version, '%s', from 'which --version' does not "\
"match pattern, '%s'."\
% (output.strip(), versionRe.pattern))
self.failUnless(retval == 0,
"'which --version' did not return 0: retval=%d"\
% retval)
def test_no_args(self):
output, error, retval = testsupport.run(self.which)
self.failUnless(retval == -1,
"'which' with no args should return -1: retval=%d"\
% retval)
def test_one_failure(self):
output, error, retval = testsupport.run(
self.which+' whichtestapp1')
self.failUnless(retval == 1,
"One failure did not return 1: retval=%d" % retval)
def test_two_failures(self):
output, error, retval = testsupport.run(
self.which+' whichtestapp1 whichtestapp2')
self.failUnless(retval == 2,
"Two failures did not return 2: retval=%d" % retval)
def _match(self, path1, path2):
#print "_match: %r =?= %r" % (path1, path2)
if sys.platform.startswith('win'):
path1 = os.path.normpath(os.path.normcase(path1))
path2 = os.path.normpath(os.path.normcase(path2))
path1 = os.path.splitext(path1)[0]
path2 = os.path.splitext(path2)[0]
return path1 == path2
else:
return os.path.samefile(path1, path2)
def test_one_success(self):
os.environ["PATH"] += os.pathsep + self.tmpdir
output, error, retval = testsupport.run(self.which+' -q whichtestapp1')
expectedOutput = os.path.join(self.tmpdir, "whichtestapp1")
self.failUnless(self._match(output.strip(), expectedOutput),
"Output, %r, and expected output, %r, do not match."\
% (output.strip(), expectedOutput))
self.failUnless(retval == 0,
"'which ...' should have returned 0: retval=%d" % retval)
def test_two_successes(self):
os.environ["PATH"] += os.pathsep + self.tmpdir
apps = ['whichtestapp1', 'whichtestapp2']
output, error, retval = testsupport.run(
self.which + ' -q ' + ' '.join(apps))
lines = output.strip().split("\n".encode('ascii'))
for app, line in zip(apps, lines):
expected = os.path.join(self.tmpdir, app)
self.failUnless(self._match(line, expected),
"Output, %r, and expected output, %r, do not match."\
% (line, expected))
self.failUnless(retval == 0,
"'which ...' should have returned 0: retval=%d" % retval)
if sys.platform.startswith("win"):
def test_PATHEXT_failure(self):
os.environ["PATH"] += os.pathsep + self.tmpdir
output, error, retval = testsupport.run(self.which+' whichtestapp3')
self.failUnless(retval == 1,
"'which ...' should have returned 1: retval=%d" % retval)
def test_PATHEXT_success(self):
os.environ["PATH"] += os.pathsep + self.tmpdir
os.environ["PATHEXT"] += os.pathsep + '.wta'
output, error, retval = testsupport.run(self.which+' whichtestapp3')
expectedOutput = os.path.join(self.tmpdir, "whichtestapp3")
self.failUnless(self._match(output.strip(), expectedOutput),
"Output, %r, and expected output, %r, do not match."\
% (output.strip(), expectedOutput))
self.failUnless(retval == 0,
"'which ...' should have returned 0: retval=%d" % retval)
def test_exts(self):
os.environ["PATH"] += os.pathsep + self.tmpdir
output, error, retval = testsupport.run(self.which+' -e .wta whichtestapp3')
expectedOutput = os.path.join(self.tmpdir, "whichtestapp3")
self.failUnless(self._match(output.strip(), expectedOutput),
"Output, %r, and expected output, %r, do not match."\
% (output.strip(), expectedOutput))
self.failUnless(retval == 0,
"'which ...' should have returned 0: retval=%d" % retval)
def suite():
"""Return a unittest.TestSuite to be used by test.py."""
return unittest.makeSuite(WhichTestCase)
if __name__ == "__main__":
unittest.main()
|
fsys/which
|
test/test_which.py
|
Python
|
mit
| 6,969
|
// tslint:disable:no-empty
import { Component, Input, OnInit } from '@angular/core';
/**
* Foo doc
*/
@Component({
selector: '[foo]',
template: '<button (click)="forTemplateOnly()">{{buttonTxt}}</button>',
exportAs: 'foo'
})
export class FooComponent implements OnInit {
@Input() buttonTxt;
constructor() {}
/**
* Only used in a template
*
* @internal
*/
forTemplateOnly() {
console.log('I was clicked!');
}
ngOnInit() {}
// tslint:disable-next-line:prefer-function-over-method
private _dontSerialize() {}
}
|
valor-software/ng2-handsontable
|
scripts/docs/api-doc-test-cases/component-with-internal-methods.ts
|
TypeScript
|
mit
| 553
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>zorns-lemma: 47 s 🏆</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.11.2 / zorns-lemma - 9.0.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
zorns-lemma
<small>
9.0.0
<span class="label label-success">47 s 🏆</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-03-07 13:08:44 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-07 13:08:44 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
coq 8.11.2 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.07.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.07.1 Official release 4.07.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "miloradovsky@gmail.com"
homepage: "https://github.com/coq-community/topology"
dev-repo: "git+https://github.com/coq-community/topology.git"
bug-reports: "https://github.com/coq-community/topology/issues"
license: "LGPL-2.1-or-later"
synopsis: "This library develops some basic set theory in Coq"
description: """
This Coq library develops some basic set theory.
The main purpose the author had in writing it
was as support for the Topology library.
"""
build: ["dune" "build" "-p" name "-j" jobs]
depends: [
"dune" {>= "2.5"}
"coq" {(>= "8.10" & < "8.15~") | (= "dev")}
]
tags: [
"category:Mathematics/Logic/Set theory"
"keyword:set theory"
"keyword:cardinals"
"keyword:ordinals"
"keyword:finite"
"keyword:countable"
"keyword:quotients"
"keyword:well-orders"
"keyword:Zorn's lemma"
"logpath:ZornsLemma"
]
authors: [
"Daniel Schepler"
]
url {
src: "https://github.com/coq-community/topology/archive/v9.0.0.tar.gz"
checksum: "sha512=35cdea3c4c1ca3792777c0864e5cdacd5f6dc1b8eebbb3a1d52a1f5e0fba21f7943a5186472eabba23a93ca6a37f8caecef3647e1fde3d09aae45f7e27c2f0ec"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-zorns-lemma.9.0.0 coq.8.11.2</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-zorns-lemma.9.0.0 coq.8.11.2</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>13 m 3 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-zorns-lemma.9.0.0 coq.8.11.2</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>47 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 1 M</p>
<ul>
<li>148 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/WellOrders.vo</code></li>
<li>109 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Filters.vo</code></li>
<li>95 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/FiniteTypes.vo</code></li>
<li>90 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/FiniteIntersections.vo</code></li>
<li>81 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Cardinals.vo</code></li>
<li>63 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/ZornsLemma.vo</code></li>
<li>63 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/CountableTypes.vo</code></li>
<li>62 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/InverseImage.vo</code></li>
<li>54 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Quotients.vo</code></li>
<li>50 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/CSB.vo</code></li>
<li>47 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/IndexedFamilies.vo</code></li>
<li>42 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Ordinals.vo</code></li>
<li>37 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Families.vo</code></li>
<li>37 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/FunctionProperties.vo</code></li>
<li>36 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/InfiniteTypes.vo</code></li>
<li>33 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/DirectedSets.vo</code></li>
<li>31 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Classical_Wf.vo</code></li>
<li>31 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/EnsemblesUtf8.vo</code></li>
<li>26 K <code>../ocaml-base-compiler.4.07.1/doc/coq-zorns-lemma/LICENSE</code></li>
<li>26 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Image.vo</code></li>
<li>25 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/FiniteTypes.v</code></li>
<li>25 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/DependentTypeChoice.vo</code></li>
<li>24 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/DecidableDec.vo</code></li>
<li>18 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Powerset_facts.vo</code></li>
<li>16 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/WellOrders.v</code></li>
<li>14 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Cardinals.v</code></li>
<li>12 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/ImageImplicit.vo</code></li>
<li>12 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Filters.v</code></li>
<li>11 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Ordinals.v</code></li>
<li>11 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/ZornsLemma.v</code></li>
<li>9 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/FiniteIntersections.v</code></li>
<li>8 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/InverseImage.v</code></li>
<li>8 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Quotients.v</code></li>
<li>8 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/CountableTypes.v</code></li>
<li>6 K <code>../ocaml-base-compiler.4.07.1/doc/coq-zorns-lemma/README.md</code></li>
<li>6 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/IndexedFamilies.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/EnsemblesSpec.vo</code></li>
<li>4 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/CSB.v</code></li>
<li>4 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/InfiniteTypes.v</code></li>
<li>4 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Classical_Wf.v</code></li>
<li>3 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Families.v</code></li>
<li>3 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Relation_Definitions_Implicit.vo</code></li>
<li>3 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/FunctionProperties.v</code></li>
<li>3 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Proj1SigInjective.vo</code></li>
<li>3 K <code>../ocaml-base-compiler.4.07.1/lib/coq-zorns-lemma/dune-package</code></li>
<li>3 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/DirectedSets.v</code></li>
<li>3 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/EnsemblesImplicit.vo</code></li>
<li>3 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/EnsemblesTactics.vo</code></li>
<li>2 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/EnsemblesUtf8.v</code></li>
<li>2 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Powerset_facts.v</code></li>
<li>2 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/FiniteImplicit.vo</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/EnsemblesSpec.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq-zorns-lemma/opam</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Relation_Definitions_Implicit.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/DecidableDec.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/DependentTypeChoice.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Image.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/EnsemblesImplicit.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/EnsemblesTactics.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/ImageImplicit.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/Proj1SigInjective.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/ZornsLemma/FiniteImplicit.v</code></li>
<li>0 K <code>../ocaml-base-compiler.4.07.1/lib/coq-zorns-lemma/META</code></li>
</ul>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-zorns-lemma.9.0.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
|
coq-bench/coq-bench.github.io
|
clean/Linux-x86_64-4.07.1-2.0.6/released/8.11.2/zorns-lemma/9.0.0.html
|
HTML
|
mit
| 14,256
|
package br.com.digituz.mailer.controller;
import br.com.digituz.mailer.model.Email;
import br.com.digituz.mailer.model.Message;
import br.com.digituz.mailer.service.EmailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author daniel
*/
@RestController
@RequestMapping("/api")
public class EmailController {
private static final Logger logger = LoggerFactory.getLogger(EmailController.class);
@Autowired
private EmailService sendEmailService;
@PostMapping("/email")
@ResponseStatus(value = HttpStatus.OK)
public Message sendEmails(@RequestBody EmailTO email) {
this.sendEmailService.sendEmails(email.toEmail());
return new Message("Information successfully received.");
}
@GetMapping("/email")
public List<Email> getEmails() {
logger.info("Emails listed");
return this.sendEmailService.emailsAll();
}
}
|
Digituz/mailer
|
src/main/java/br/com/digituz/mailer/controller/EmailController.java
|
Java
|
mit
| 1,350
|
require 'spec_helper'
describe Worochi::Helper do
describe '.is_s3_path?', :aws do
it 'recognizes an S3 path' do
expect(Worochi::Helper.is_s3_path?('s3:test/path')).to be_true
end
it 'rejects other paths' do
expect(Worochi::Helper.is_s3_path?('test/path')).to be_false
expect(Worochi::Helper.is_s3_path?('s3/test/path')).to be_false
expect(Worochi::Helper.is_s3_path?('http://a.com/path')).to be_false
end
end
describe '.s3_url', :aws do
it 'returns the right S3 URL' do
Worochi::Config.s3_bucket = 'rspec-test'
uri = Worochi::Helper.s3_url('s3:test/path')
expect(uri.path).to eq('/test/path')
expect(uri.host).to include('rspec-test')
end
it 'parses bucket names' do
uri = Worochi::Helper.s3_url('s3:bucket-name:test/path')
expect(uri.path).to eq('/test/path')
expect(uri.host).to include('bucket-name')
end
it 'rejects invalid URLs' do
expect{Worochi::Helper.s3_url('a/b')}.to raise_error(Worochi::Error)
end
end
end
|
Pixelapse/worochi
|
spec/worochi/helper_spec.rb
|
Ruby
|
mit
| 1,045
|
# frozen_string_literal: true
require 'spec_helper'
describe RubyRabbitmqJanus::Janus::Responses::Admin, type: :responses,
name: :admin do
let(:response) { described_class.new(message) }
describe '#libnice_debug' do
context 'with no libnice_debug' do
let(:message) { {} }
it { expect { response.libnice_debug }.to raise_error(RubyRabbitmqJanus::Errors::Janus::Responses::Admin::LibniceDebug) }
end
context 'with libnice_debug' do
let(:message) { { 'libnice_debug' => true } }
it { expect(response.libnice_debug).to be_kind_of(TrueClass) }
end
end
end
|
dazzl-tv/ruby-rabbitmq-janus
|
spec/ruby_rabbitmq_janus/janus/responses/admin_libnice_debug_spec.rb
|
Ruby
|
mit
| 656
|
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"testing"
"github.com/darwinfroese/gowt/mux"
)
const expectedOutput string = "Hello World"
var srv *httptest.Server
func TestMain(m *testing.M) {
setup()
code := m.Run()
shutdown()
os.Exit(code)
}
func setup() {
m := mux.NewMux()
m.RegisterRoute("/hello", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, expectedOutput) })
srv = httptest.NewServer(m)
}
func shutdown() {
srv.Close()
}
func TestRoute(t *testing.T) {
t.Log("Testing Routes")
res, err := http.Get(srv.URL + "/hello")
if err != nil {
t.Errorf(" FAILED - %s", err.Error())
}
msg, err := ioutil.ReadAll(res.Body)
res.Body.Close()
if err != nil {
t.Errorf(" FAILED - %s", err.Error())
}
if string(msg) != expectedOutput {
t.Errorf(" FAILED - Expected \"%s\" but got \"%s\"", expectedOutput, msg)
}
}
|
darwinfroese/gowt
|
tests/mux/main_test.go
|
GO
|
mit
| 897
|
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Свойство float в CSS</title>
<link rel="profile" href="http://gmpg.org/xfn/11"/>
<link rel="shortcut icon" href="http://anton.shevchuk.name/favicon.ico"/>
<link rel="stylesheet" href="css/styles.css"/>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/code.js"></script>
<style>
article {
border: #999 1px solid;
margin: 0 4px 4px;
padding: 10px;
}
article h2 {
border: #999 1px solid;
background: #fff;
}
article div, article p, article span {
background: #ccffcc;
font-size: 16px;
}
</style>
</head>
<body>
<div id="content" class="wrapper box">
<menu label="Try...">
<a href="html.example.html" title="go prev" class="button alignleft" rel="prev">← Prev </a>
<a href="index.html" title="back to Index" class="button alignleft" rel="index">Index §</a>
<a href="css.priority.html" title="go next" class="button alignright" rel="next">Next →</a>
</menu>
<header>
<h1>Пример работы свойства float</h1>
<h2>Смотрим... →</h2>
</header>
<article>
<h2 style="float:right;">style="float:right;"</h2>
<div style="height:100px;">
<div style="height:100px;">block element</div>
</div>
</article>
<article>
<h2 style="float:right;">style="float:right;"</h2>
<div style="height:100px;clear:both;">
<div style="height:100px;clear:both;">block element</div>
</div>
</article>
<article>
<h2 style="float:right">style="float:right;"</h2>
<p><p>block element</p></p>
<p>Duis in vestibulum sem. Cras euismod tincidunt dui, et scelerisque tellus condimentum vel.
Maecenas et urna sit amet risus fermentum rhoncus nec porttitor ligula. Maecenas sit amet
turpis enim, ut iaculis est. Duis feugiat, lacus id placerat porttitor, lorem augue gravida
nisi, eu porta eros risus et lectus. Maecenas vestibulum nunc vel ipsum tincidunt sit amet
blandit sapien bibendum. Proin vel vulputate nisl. Duis tempor imperdiet placerat. Pellentesque
faucibus consequat magna, et bibendum nisl egestas non. Pellentesque sit amet mattis augue.
Aenean at diam tincidunt purus sollicitudin gravida non in nisi. Fusce bibendum, magna in
adipiscing mattis, sem risus fringilla mi, nec gravida lectus lectus at nibh. Suspendisse
adipiscing elementum laoreet. Suspendisse sem erat, varius quis aliquet vitae, dapibus sed
nibh. Nullam iaculis sem at mauris faucibus in vestibulum libero pretium. Aliquam eu turpis
libero. Fusce et ultrices lectus.</p>
</article>
<article>
<h2 style="float:right">style="float:right;"</h2>
<span><span>inline element</span></span><br/>
<span>Duis in vestibulum sem. Cras euismod tincidunt dui, et scelerisque tellus condimentum vel.
Maecenas et urna sit amet risus fermentum rhoncus nec porttitor ligula. Maecenas sit amet
turpis enim, ut iaculis est. Duis feugiat, lacus id placerat porttitor, lorem augue gravida
nisi, eu porta eros risus et lectus. Maecenas vestibulum nunc vel ipsum tincidunt sit amet
blandit sapien bibendum. Proin vel vulputate nisl. Duis tempor imperdiet placerat. Pellentesque
faucibus consequat magna, et bibendum nisl egestas non. Pellentesque sit amet mattis augue.
Aenean at diam tincidunt purus sollicitudin gravida non in nisi. Fusce bibendum, magna in
adipiscing mattis, sem risus fringilla mi, nec gravida lectus lectus at nibh. Suspendisse
adipiscing elementum laoreet. Suspendisse sem erat, varius quis aliquet vitae, dapibus sed
nibh. Nullam iaculis sem at mauris faucibus in vestibulum libero pretium. Aliquam eu turpis
libero. Fusce et ultrices lectus.</span>
</article>
<footer>
©copyright 2012-2017 Anton Shevchuk — <a href="http://anton.shevchuk.name/jquery-book/">jQuery Book</a>
</footer>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1669896-15', 'auto');
ga('send', 'pageview');
</script>
</div>
</body>
</html>
|
AntonShevchuk/jquery-for-beginners
|
css.float.html
|
HTML
|
mit
| 5,153
|
#!/usr/bin/env ruby
#
# setup.rb
#
# Copyright (c) 2000-2005 Minero Aoki
#
# This program is free software.
# You can distribute/modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
#
unless Enumerable.method_defined?(:map) # Ruby 1.4.6
module Enumerable
alias map collect
end
end
unless File.respond_to?(:read) # Ruby 1.6
def File.read(fname)
open(fname) {|f|
return f.read
}
end
end
unless Errno.const_defined?(:ENOTEMPTY) # Windows?
module Errno
class ENOTEMPTY
# We do not raise this exception, implementation is not needed.
end
end
end
def File.binread(fname)
open(fname, 'rb') {|f|
return f.read
}
end
# for corrupted Windows' stat(2)
def File.dir?(path)
File.directory?((path[-1,1] == '/') ? path : path + '/')
end
class ConfigTable
include Enumerable
def initialize(rbconfig)
@rbconfig = rbconfig
@items = []
@table = {}
# options
@install_prefix = nil
@config_opt = nil
@verbose = true
@no_harm = false
@libsrc_pattern = '*.rb'
end
attr_accessor :install_prefix
attr_accessor :config_opt
attr_writer :verbose
def verbose?
@verbose
end
attr_writer :no_harm
def no_harm?
@no_harm
end
attr_accessor :libsrc_pattern
def [](key)
lookup(key).resolve(self)
end
def []=(key, val)
lookup(key).set val
end
def names
@items.map {|i| i.name }
end
def each(&block)
@items.each(&block)
end
def key?(name)
@table.key?(name)
end
def lookup(name)
@table[name] or setup_rb_error "no such config item: #{name}"
end
def add(item)
@items.push item
@table[item.name] = item
end
def remove(name)
item = lookup(name)
@items.delete_if {|i| i.name == name }
@table.delete_if {|name, i| i.name == name }
item
end
def load_script(path, inst = nil)
if File.file?(path)
MetaConfigEnvironment.new(self, inst).instance_eval File.read(path), path
end
end
def savefile
'.config'
end
def load_savefile
begin
File.foreach(savefile()) do |line|
k, v = *line.split(/=/, 2)
self[k] = v.strip
end
rescue Errno::ENOENT
setup_rb_error $!.message + "\n#{File.basename($0)} config first"
end
end
def save
@items.each {|i| i.value }
File.open(savefile(), 'w') {|f|
@items.each do |i|
f.printf "%s=%s\n", i.name, i.value if i.value? and i.value
end
}
end
def load_standard_entries
standard_entries(@rbconfig).each do |ent|
add ent
end
end
def standard_entries(rbconfig)
c = rbconfig
rubypath = c['bindir'] + '/' + c['ruby_install_name']
major = c['MAJOR'].to_i
minor = c['MINOR'].to_i
teeny = c['TEENY'].to_i
version = "#{major}.#{minor}"
# ruby ver. >= 1.4.4?
newpath_p = ((major >= 2) or
((major == 1) and
((minor >= 5) or
((minor == 4) and (teeny >= 4)))))
if c['rubylibdir']
# V > 1.6.3
libruby = "#{c['prefix']}/lib/ruby"
librubyver = c['rubylibdir']
librubyverarch = c['archdir']
siteruby = c['sitedir']
siterubyver = c['sitelibdir']
siterubyverarch = c['sitearchdir']
elsif newpath_p
# 1.4.4 <= V <= 1.6.3
libruby = "#{c['prefix']}/lib/ruby"
librubyver = "#{c['prefix']}/lib/ruby/#{version}"
librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
siteruby = c['sitedir']
siterubyver = "$siteruby/#{version}"
siterubyverarch = "$siterubyver/#{c['arch']}"
else
# V < 1.4.4
libruby = "#{c['prefix']}/lib/ruby"
librubyver = "#{c['prefix']}/lib/ruby/#{version}"
librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby"
siterubyver = siteruby
siterubyverarch = "$siterubyver/#{c['arch']}"
end
parameterize = lambda {|path|
path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')
}
if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
else
makeprog = 'make'
end
[
ExecItem.new('installdirs', 'std/site/home',
'std: install under libruby; site: install under site_ruby; home: install under $HOME')\
{|val, table|
case val
when 'std'
table['rbdir'] = '$librubyver'
table['sodir'] = '$librubyverarch'
when 'site'
table['rbdir'] = '$siterubyver'
table['sodir'] = '$siterubyverarch'
when 'home'
setup_rb_error '$HOME was not set' unless ENV['HOME']
table['prefix'] = ENV['HOME']
table['rbdir'] = '$libdir/ruby'
table['sodir'] = '$libdir/ruby'
end
},
PathItem.new('prefix', 'path', c['prefix'],
'path prefix of target environment'),
PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
'the directory for commands'),
PathItem.new('libdir', 'path', parameterize.call(c['libdir']),
'the directory for libraries'),
PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
'the directory for shared data'),
PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
'the directory for man pages'),
PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
'the directory for system configuration files'),
PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']),
'the directory for local state data'),
PathItem.new('libruby', 'path', libruby,
'the directory for ruby libraries'),
PathItem.new('librubyver', 'path', librubyver,
'the directory for standard ruby libraries'),
PathItem.new('librubyverarch', 'path', librubyverarch,
'the directory for standard ruby extensions'),
PathItem.new('siteruby', 'path', siteruby,
'the directory for version-independent aux ruby libraries'),
PathItem.new('siterubyver', 'path', siterubyver,
'the directory for aux ruby libraries'),
PathItem.new('siterubyverarch', 'path', siterubyverarch,
'the directory for aux ruby binaries'),
PathItem.new('rbdir', 'path', '$siterubyver',
'the directory for ruby scripts'),
PathItem.new('sodir', 'path', '$siterubyverarch',
'the directory for ruby extentions'),
PathItem.new('rubypath', 'path', rubypath,
'the path to set to #! line'),
ProgramItem.new('rubyprog', 'name', rubypath,
'the ruby program using for installation'),
ProgramItem.new('makeprog', 'name', makeprog,
'the make program to compile ruby extentions'),
SelectItem.new('shebang', 'all/ruby/never', 'ruby',
'shebang line (#!) editing mode'),
BoolItem.new('without-ext', 'yes/no', 'no',
'does not compile/install ruby extentions')
]
end
private :standard_entries
def load_multipackage_entries
multipackage_entries().each do |ent|
add ent
end
end
def multipackage_entries
[
PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
'package names that you want to install'),
PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
'package names that you do not want to install')
]
end
private :multipackage_entries
ALIASES = {
'std-ruby' => 'librubyver',
'stdruby' => 'librubyver',
'rubylibdir' => 'librubyver',
'archdir' => 'librubyverarch',
'site-ruby-common' => 'siteruby', # For backward compatibility
'site-ruby' => 'siterubyver', # For backward compatibility
'bin-dir' => 'bindir',
'bin-dir' => 'bindir',
'rb-dir' => 'rbdir',
'so-dir' => 'sodir',
'data-dir' => 'datadir',
'ruby-path' => 'rubypath',
'ruby-prog' => 'rubyprog',
'ruby' => 'rubyprog',
'make-prog' => 'makeprog',
'make' => 'makeprog'
}
def fixup
ALIASES.each do |ali, name|
@table[ali] = @table[name]
end
@items.freeze
@table.freeze
@options_re = /\A--(#{@table.keys.join('|')})(?:=(.*))?\z/
end
def parse_opt(opt)
m = @options_re.match(opt) or setup_rb_error "config: unknown option #{opt}"
m.to_a[1,2]
end
def dllext
@rbconfig['DLEXT']
end
def value_config?(name)
lookup(name).value?
end
class Item
def initialize(name, template, default, desc)
@name = name.freeze
@template = template
@value = default
@default = default
@description = desc
end
attr_reader :name
attr_reader :description
attr_accessor :default
alias help_default default
def help_opt
"--#{@name}=#{@template}"
end
def value?
true
end
def value
@value
end
def resolve(table)
@value.gsub(%r<\$([^/]+)>) { table[$1] }
end
def set(val)
@value = check(val)
end
private
def check(val)
setup_rb_error "config: --#{name} requires argument" unless val
val
end
end
class BoolItem < Item
def config_type
'bool'
end
def help_opt
"--#{@name}"
end
private
def check(val)
return 'yes' unless val
unless /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i =~ val
setup_rb_error "config: --#{@name} accepts only yes/no for argument"
end
(/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no'
end
end
class PathItem < Item
def config_type
'path'
end
private
def check(path)
setup_rb_error "config: --#{@name} requires argument" unless path
path[0,1] == '$' ? path : File.expand_path(path)
end
end
class ProgramItem < Item
def config_type
'program'
end
end
class SelectItem < Item
def initialize(name, selection, default, desc)
super
@ok = selection.split('/')
end
def config_type
'select'
end
private
def check(val)
unless @ok.include?(val.strip)
setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
end
val.strip
end
end
class ExecItem < Item
def initialize(name, selection, desc, &block)
super name, selection, nil, desc
@ok = selection.split('/')
@action = block
end
def config_type
'exec'
end
def value?
false
end
def resolve(table)
setup_rb_error "$#{name()} wrongly used as option value"
end
undef set
def evaluate(val, table)
v = val.strip.downcase
unless @ok.include?(v)
setup_rb_error "invalid option --#{@name}=#{val} (use #{@template})"
end
@action.call v, table
end
end
class PackageSelectionItem < Item
def initialize(name, template, default, help_default, desc)
super name, template, default, desc
@help_default = help_default
end
attr_reader :help_default
def config_type
'package'
end
private
def check(val)
unless File.dir?("packages/#{val}")
setup_rb_error "config: no such package: #{val}"
end
val
end
end
class MetaConfigEnvironment
def intiailize(config, installer)
@config = config
@installer = installer
end
def config_names
@config.names
end
def config?(name)
@config.key?(name)
end
def bool_config?(name)
@config.lookup(name).config_type == 'bool'
end
def path_config?(name)
@config.lookup(name).config_type == 'path'
end
def value_config?(name)
@config.lookup(name).config_type != 'exec'
end
def add_config(item)
@config.add item
end
def add_bool_config(name, default, desc)
@config.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
end
def add_path_config(name, default, desc)
@config.add PathItem.new(name, 'path', default, desc)
end
def set_config_default(name, default)
@config.lookup(name).default = default
end
def remove_config(name)
@config.remove(name)
end
# For only multipackage
def packages
raise '[setup.rb fatal] multi-package metaconfig API packages() called for single-package; contact application package vendor' unless @installer
@installer.packages
end
# For only multipackage
def declare_packages(list)
raise '[setup.rb fatal] multi-package metaconfig API declare_packages() called for single-package; contact application package vendor' unless @installer
@installer.packages = list
end
end
end # class ConfigTable
# This module requires: #verbose?, #no_harm?
module FileOperations
def mkdir_p(dirname, prefix = nil)
dirname = prefix + File.expand_path(dirname) if prefix
$stderr.puts "mkdir -p #{dirname}" if verbose?
return if no_harm?
# Does not check '/', it's too abnormal.
dirs = File.expand_path(dirname).split(%r<(?=/)>)
if /\A[a-z]:\z/i =~ dirs[0]
disk = dirs.shift
dirs[0] = disk + dirs[0]
end
dirs.each_index do |idx|
path = dirs[0..idx].join('')
Dir.mkdir path unless File.dir?(path)
end
end
def rm_f(path)
$stderr.puts "rm -f #{path}" if verbose?
return if no_harm?
force_remove_file path
end
def rm_rf(path)
$stderr.puts "rm -rf #{path}" if verbose?
return if no_harm?
remove_tree path
end
def remove_tree(path)
if File.symlink?(path)
remove_file path
elsif File.dir?(path)
remove_tree0 path
else
force_remove_file path
end
end
def remove_tree0(path)
Dir.foreach(path) do |ent|
next if ent == '.'
next if ent == '..'
entpath = "#{path}/#{ent}"
if File.symlink?(entpath)
remove_file entpath
elsif File.dir?(entpath)
remove_tree0 entpath
else
force_remove_file entpath
end
end
begin
Dir.rmdir path
rescue Errno::ENOTEMPTY
# directory may not be empty
end
end
def move_file(src, dest)
force_remove_file dest
begin
File.rename src, dest
rescue
File.open(dest, 'wb') {|f|
f.write File.binread(src)
}
File.chmod File.stat(src).mode, dest
File.unlink src
end
end
def force_remove_file(path)
begin
remove_file path
rescue
end
end
def remove_file(path)
File.chmod 0777, path
File.unlink path
end
def install(from, dest, mode, prefix = nil)
$stderr.puts "install #{from} #{dest}" if verbose?
return if no_harm?
realdest = prefix ? prefix + File.expand_path(dest) : dest
realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
str = File.binread(from)
if diff?(str, realdest)
verbose_off {
rm_f realdest if File.exist?(realdest)
}
File.open(realdest, 'wb') {|f|
f.write str
}
File.chmod mode, realdest
File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
if prefix
f.puts realdest.sub(prefix, '')
else
f.puts realdest
end
}
end
end
def diff?(new_content, path)
return true unless File.exist?(path)
new_content != File.binread(path)
end
def command(*args)
$stderr.puts args.join(' ') if verbose?
system(*args) or raise RuntimeError,
"system(#{args.map{|a| a.inspect }.join(' ')}) failed"
end
def ruby(*args)
command config('rubyprog'), *args
end
def make(task = nil)
command(*[config('makeprog'), task].compact)
end
def extdir?(dir)
File.exist?("#{dir}/MANIFEST") or File.exist?("#{dir}/extconf.rb")
end
def files_of(dir)
Dir.open(dir) {|d|
return d.select {|ent| File.file?("#{dir}/#{ent}") }
}
end
DIR_REJECT = %w( . .. CVS SCCS RCS CVS.adm .svn )
def directories_of(dir)
Dir.open(dir) {|d|
return d.select {|ent| File.dir?("#{dir}/#{ent}") } - DIR_REJECT
}
end
end
# This module requires: #srcdir_root, #objdir_root, #relpath
module HookScriptAPI
def get_config(key)
@config[key]
end
alias config get_config
# obsolete: use metaconfig to change configuration
def set_config(key, val)
@config[key] = val
end
#
# srcdir/objdir (works only in the package directory)
#
def curr_srcdir
"#{srcdir_root()}/#{relpath()}"
end
def curr_objdir
"#{objdir_root()}/#{relpath()}"
end
def srcfile(path)
"#{curr_srcdir()}/#{path}"
end
def srcexist?(path)
File.exist?(srcfile(path))
end
def srcdirectory?(path)
File.dir?(srcfile(path))
end
def srcfile?(path)
File.file?(srcfile(path))
end
def srcentries(path = '.')
Dir.open("#{curr_srcdir()}/#{path}") {|d|
return d.to_a - %w(. ..)
}
end
def srcfiles(path = '.')
srcentries(path).select {|fname|
File.file?(File.join(curr_srcdir(), path, fname))
}
end
def srcdirectories(path = '.')
srcentries(path).select {|fname|
File.dir?(File.join(curr_srcdir(), path, fname))
}
end
end
class ToplevelInstaller
Version = '3.4.0'
Copyright = 'Copyright (c) 2000-2005 Minero Aoki'
TASKS = [
[ 'all', 'do config, setup, then install' ],
[ 'config', 'saves your configurations' ],
[ 'show', 'shows current configuration' ],
[ 'setup', 'compiles ruby extentions and others' ],
[ 'install', 'installs files' ],
[ 'test', 'run all tests in test/' ],
[ 'clean', "does `make clean' for each extention" ],
[ 'distclean',"does `make distclean' for each extention" ]
]
def ToplevelInstaller.invoke
config = ConfigTable.new(load_rbconfig())
config.load_standard_entries
config.load_multipackage_entries if multipackage?
config.fixup
klass = (multipackage?() ? ToplevelInstallerMulti : ToplevelInstaller)
klass.new(File.dirname($0), config).invoke
end
def ToplevelInstaller.multipackage?
File.dir?(File.dirname($0) + '/packages')
end
def ToplevelInstaller.load_rbconfig
if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
ARGV.delete(arg)
load File.expand_path(arg.split(/=/, 2)[1])
$".push 'rbconfig.rb'
else
require 'rbconfig'
end
::Config::CONFIG
end
def initialize(ardir_root, config)
@ardir = File.expand_path(ardir_root)
@config = config
# cache
@valid_task_re = nil
end
def config(key)
@config[key]
end
def inspect
"#<#{self.class} #{__id__()}>"
end
def invoke
run_metaconfigs
case task = parsearg_global()
when nil, 'all'
parsearg_config
init_installers
exec_config
exec_setup
exec_install
else
case task
when 'config', 'test'
;
when 'clean', 'distclean'
@config.load_savefile if File.exist?(@config.savefile)
else
@config.load_savefile
end
__send__ "parsearg_#{task}"
init_installers
__send__ "exec_#{task}"
end
end
def run_metaconfigs
@config.load_script "#{@ardir}/metaconfig"
end
def init_installers
@installer = Installer.new(@config, @ardir, File.expand_path('.'))
end
#
# Hook Script API bases
#
def srcdir_root
@ardir
end
def objdir_root
'.'
end
def relpath
'.'
end
#
# Option Parsing
#
def parsearg_global
while arg = ARGV.shift
case arg
when /\A\w+\z/
setup_rb_error "invalid task: #{arg}" unless valid_task?(arg)
return arg
when '-q', '--quiet'
@config.verbose = false
when '--verbose'
@config.verbose = true
when '--help'
print_usage $stdout
exit 0
when '--version'
puts "#{File.basename($0)} version #{Version}"
exit 0
when '--copyright'
puts Copyright
exit 0
else
setup_rb_error "unknown global option '#{arg}'"
end
end
nil
end
def valid_task?(t)
valid_task_re() =~ t
end
def valid_task_re
@valid_task_re ||= /\A(?:#{TASKS.map {|task,desc| task }.join('|')})\z/
end
def parsearg_no_options
unless ARGV.empty?
setup_rb_error "#{task}: unknown options: #{ARGV.join(' ')}"
end
end
alias parsearg_show parsearg_no_options
alias parsearg_setup parsearg_no_options
alias parsearg_test parsearg_no_options
alias parsearg_clean parsearg_no_options
alias parsearg_distclean parsearg_no_options
def parsearg_config
evalopt = []
set = []
@config.config_opt = []
while i = ARGV.shift
if /\A--?\z/ =~ i
@config.config_opt = ARGV.dup
break
end
name, value = *@config.parse_opt(i)
if @config.value_config?(name)
@config[name] = value
else
evalopt.push [name, value]
end
set.push name
end
evalopt.each do |name, value|
@config.lookup(name).evaluate value, @config
end
# Check if configuration is valid
set.each do |n|
@config[n] if @config.value_config?(n)
end
end
def parsearg_install
@config.no_harm = false
@config.install_prefix = ''
while a = ARGV.shift
case a
when '--no-harm'
@config.no_harm = true
when /\A--prefix=/
path = a.split(/=/, 2)[1]
path = File.expand_path(path) unless path[0,1] == '/'
@config.install_prefix = path
else
setup_rb_error "install: unknown option #{a}"
end
end
end
def print_usage(out)
out.puts 'Typical Installation Procedure:'
out.puts " $ ruby #{File.basename $0} config"
out.puts " $ ruby #{File.basename $0} setup"
out.puts " # ruby #{File.basename $0} install (may require root privilege)"
out.puts
out.puts 'Detailed Usage:'
out.puts " ruby #{File.basename $0} <global option>"
out.puts " ruby #{File.basename $0} [<global options>] <task> [<task options>]"
fmt = " %-24s %s\n"
out.puts
out.puts 'Global options:'
out.printf fmt, '-q,--quiet', 'suppress message outputs'
out.printf fmt, ' --verbose', 'output messages verbosely'
out.printf fmt, ' --help', 'print this message'
out.printf fmt, ' --version', 'print version and quit'
out.printf fmt, ' --copyright', 'print copyright and quit'
out.puts
out.puts 'Tasks:'
TASKS.each do |name, desc|
out.printf fmt, name, desc
end
fmt = " %-24s %s [%s]\n"
out.puts
out.puts 'Options for CONFIG or ALL:'
@config.each do |item|
out.printf fmt, item.help_opt, item.description, item.help_default
end
out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's"
out.puts
out.puts 'Options for INSTALL:'
out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
out.printf fmt, '--prefix=path', 'install path prefix', ''
out.puts
end
#
# Task Handlers
#
def exec_config
@installer.exec_config
@config.save # must be final
end
def exec_setup
@installer.exec_setup
end
def exec_install
@installer.exec_install
end
def exec_test
@installer.exec_test
end
def exec_show
@config.each do |i|
printf "%-20s %s\n", i.name, i.value if i.value?
end
end
def exec_clean
@installer.exec_clean
end
def exec_distclean
@installer.exec_distclean
end
end # class ToplevelInstaller
class ToplevelInstallerMulti < ToplevelInstaller
include FileOperations
def initialize(ardir_root, config)
super
@packages = directories_of("#{@ardir}/packages")
raise 'no package exists' if @packages.empty?
@root_installer = Installer.new(@config, @ardir, File.expand_path('.'))
end
def run_metaconfigs
@config.load_script "#{@ardir}/metaconfig", self
@packages.each do |name|
@config.load_script "#{@ardir}/packages/#{name}/metaconfig"
end
end
attr_reader :packages
def packages=(list)
raise 'package list is empty' if list.empty?
list.each do |name|
raise "directory packages/#{name} does not exist"\
unless File.dir?("#{@ardir}/packages/#{name}")
end
@packages = list
end
def init_installers
@installers = {}
@packages.each do |pack|
@installers[pack] = Installer.new(@config,
"#{@ardir}/packages/#{pack}",
"packages/#{pack}")
end
with = extract_selection(config('with'))
without = extract_selection(config('without'))
@selected = @installers.keys.select {|name|
(with.empty? or with.include?(name)) \
and not without.include?(name)
}
end
def extract_selection(list)
a = list.split(/,/)
a.each do |name|
setup_rb_error "no such package: #{name}" unless @installers.key?(name)
end
a
end
def print_usage(f)
super
f.puts 'Inluded packages:'
f.puts ' ' + @packages.sort.join(' ')
f.puts
end
#
# Task Handlers
#
def exec_config
run_hook 'pre-config'
each_selected_installers {|inst| inst.exec_config }
run_hook 'post-config'
@config.save # must be final
end
def exec_setup
run_hook 'pre-setup'
each_selected_installers {|inst| inst.exec_setup }
run_hook 'post-setup'
end
def exec_install
run_hook 'pre-install'
each_selected_installers {|inst| inst.exec_install }
run_hook 'post-install'
end
def exec_test
run_hook 'pre-test'
each_selected_installers {|inst| inst.exec_test }
run_hook 'post-test'
end
def exec_clean
rm_f @config.savefile
run_hook 'pre-clean'
each_selected_installers {|inst| inst.exec_clean }
run_hook 'post-clean'
end
def exec_distclean
rm_f @config.savefile
run_hook 'pre-distclean'
each_selected_installers {|inst| inst.exec_distclean }
run_hook 'post-distclean'
end
#
# lib
#
def each_selected_installers
Dir.mkdir 'packages' unless File.dir?('packages')
@selected.each do |pack|
$stderr.puts "Processing the package `#{pack}' ..." if verbose?
Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
Dir.chdir "packages/#{pack}"
yield @installers[pack]
Dir.chdir '../..'
end
end
def run_hook(id)
@root_installer.run_hook id
end
# module FileOperations requires this
def verbose?
@config.verbose?
end
# module FileOperations requires this
def no_harm?
@config.no_harm?
end
end # class ToplevelInstallerMulti
class Installer
FILETYPES = %w( bin lib ext data conf man )
include FileOperations
include HookScriptAPI
def initialize(config, srcroot, objroot)
@config = config
@srcdir = File.expand_path(srcroot)
@objdir = File.expand_path(objroot)
@currdir = '.'
end
def inspect
"#<#{self.class} #{File.basename(@srcdir)}>"
end
#
# Hook Script API base methods
#
def srcdir_root
@srcdir
end
def objdir_root
@objdir
end
def relpath
@currdir
end
#
# Config Access
#
# module FileOperations requires this
def verbose?
@config.verbose?
end
# module FileOperations requires this
def no_harm?
@config.no_harm?
end
def verbose_off
begin
save, @config.verbose = @config.verbose?, false
yield
ensure
@config.verbose = save
end
end
#
# TASK config
#
def exec_config
exec_task_traverse 'config'
end
def config_dir_bin(rel)
end
def config_dir_lib(rel)
end
def config_dir_man(rel)
end
def config_dir_ext(rel)
extconf if extdir?(curr_srcdir())
end
def extconf
ruby "#{curr_srcdir()}/extconf.rb", *@config.config_opt
end
def config_dir_data(rel)
end
def config_dir_conf(rel)
end
#
# TASK setup
#
def exec_setup
exec_task_traverse 'setup'
end
def setup_dir_bin(rel)
files_of(curr_srcdir()).each do |fname|
adjust_shebang "#{curr_srcdir()}/#{fname}"
end
end
def adjust_shebang(path)
return if no_harm?
tmpfile = File.basename(path) + '.tmp'
begin
File.open(path, 'rb') {|r|
first = r.gets
return unless File.basename(first.sub(/\A\#!/, '').split[0].to_s) == 'ruby'
$stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
File.open(tmpfile, 'wb') {|w|
w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
w.write r.read
}
}
move_file tmpfile, File.basename(path)
ensure
File.unlink tmpfile if File.exist?(tmpfile)
end
end
def setup_dir_lib(rel)
end
def setup_dir_man(rel)
end
def setup_dir_ext(rel)
make if extdir?(curr_srcdir())
end
def setup_dir_data(rel)
end
def setup_dir_conf(rel)
end
#
# TASK install
#
def exec_install
rm_f 'InstalledFiles'
exec_task_traverse 'install'
end
def install_dir_bin(rel)
install_files targetfiles(), "#{config('bindir')}/#{rel}", 0755
end
def install_dir_lib(rel)
install_files rubyscripts(), "#{config('rbdir')}/#{rel}", 0644
end
def install_dir_ext(rel)
return unless extdir?(curr_srcdir())
install_files rubyextentions('.'),
"#{config('sodir')}/#{File.dirname(rel)}",
0555
end
def install_dir_data(rel)
install_files targetfiles(), "#{config('datadir')}/#{rel}", 0644
end
def install_dir_conf(rel)
# FIXME: should not remove current config files
# (rename previous file to .old/.org)
install_files targetfiles(), "#{config('sysconfdir')}/#{rel}", 0644
end
def install_dir_man(rel)
install_files targetfiles(), "#{config('mandir')}/#{rel}", 0644
end
def install_files(list, dest, mode)
mkdir_p dest, @config.install_prefix
list.each do |fname|
install fname, dest, mode, @config.install_prefix
end
end
def rubyscripts
glob_select(@config.libsrc_pattern, targetfiles())
end
def rubyextentions(dir)
ents = glob_select("*.#{@config.dllext}", targetfiles())
if ents.empty?
setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first"
end
ents
end
def targetfiles
mapdir(existfiles() - hookfiles())
end
def mapdir(ents)
ents.map {|ent|
if File.exist?(ent)
then ent # objdir
else "#{curr_srcdir()}/#{ent}" # srcdir
end
}
end
# picked up many entries from cvs-1.11.1/src/ignore.c
JUNK_FILES = %w(
core RCSLOG tags TAGS .make.state
.nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
*~ *.old *.bak *.BAK *.orig *.rej _$* *$
*.org *.in .*
)
def existfiles
glob_reject(JUNK_FILES, (files_of(curr_srcdir()) | files_of('.')))
end
def hookfiles
%w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt|
%w( config setup install clean ).map {|t| sprintf(fmt, t) }
}.flatten
end
def glob_select(pat, ents)
re = globs2re([pat])
ents.select {|ent| re =~ ent }
end
def glob_reject(pats, ents)
re = globs2re(pats)
ents.reject {|ent| re =~ ent }
end
GLOB2REGEX = {
'.' => '\.',
'$' => '\$',
'#' => '\#',
'*' => '.*'
}
def globs2re(pats)
/\A(?:#{
pats.map {|pat| pat.gsub(/[\.\$\#\*]/) {|ch| GLOB2REGEX[ch] } }.join('|')
})\z/
end
#
# TASK test
#
TESTDIR = 'test'
def exec_test
unless File.directory?(TESTDIR)
$stderr.puts 'no test in this package' if verbose?
return
end
$stderr.puts 'Running tests...' if verbose?
require 'test/unit'
runner = Test::Unit::AutoRunner.new(true)
runner.to_run << TESTDIR
runner.run
end
#
# TASK clean
#
def exec_clean
exec_task_traverse 'clean'
rm_f @config.savefile
rm_f 'InstalledFiles'
end
def clean_dir_bin(rel)
end
def clean_dir_lib(rel)
end
def clean_dir_ext(rel)
return unless extdir?(curr_srcdir())
make 'clean' if File.file?('Makefile')
end
def clean_dir_data(rel)
end
def clean_dir_conf(rel)
end
#
# TASK distclean
#
def exec_distclean
exec_task_traverse 'distclean'
rm_f @config.savefile
rm_f 'InstalledFiles'
end
def distclean_dir_bin(rel)
end
def distclean_dir_lib(rel)
end
def distclean_dir_ext(rel)
return unless extdir?(curr_srcdir())
make 'distclean' if File.file?('Makefile')
end
def distclean_dir_data(rel)
end
def distclean_dir_conf(rel)
end
#
# lib
#
def exec_task_traverse(task)
run_hook "pre-#{task}"
FILETYPES.each do |type|
if config('without-ext') == 'yes' and type == 'ext'
$stderr.puts 'skipping ext/* by user option' if verbose?
next
end
traverse task, type, "#{task}_dir_#{type}"
end
run_hook "post-#{task}"
end
def traverse(task, rel, mid)
dive_into(rel) {
run_hook "pre-#{task}"
__send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '')
directories_of(curr_srcdir()).each do |d|
traverse task, "#{rel}/#{d}", mid
end
run_hook "post-#{task}"
}
end
def dive_into(rel)
return unless File.dir?("#{@srcdir}/#{rel}")
dir = File.basename(rel)
Dir.mkdir dir unless File.dir?(dir)
prevdir = Dir.pwd
Dir.chdir dir
$stderr.puts '---> ' + rel if verbose?
@currdir = rel
yield
Dir.chdir prevdir
$stderr.puts '<--- ' + rel if verbose?
@currdir = File.dirname(rel)
end
def run_hook(id)
path = [ "#{curr_srcdir()}/#{id}",
"#{curr_srcdir()}/#{id}.rb" ].detect {|cand| File.file?(cand) }
return unless path
begin
instance_eval File.read(path), path, 1
rescue
raise if $DEBUG
setup_rb_error "hook #{path} failed:\n" + $!.message
end
end
end # class Installer
class SetupError < StandardError; end
def setup_rb_error(msg)
raise SetupError, msg
end
if $0 == __FILE__
begin
ToplevelInstaller.invoke
rescue SetupError
raise if $DEBUG
$stderr.puts $!.message
$stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
exit 1
end
end
|
rsms/rhp
|
install.rb
|
Ruby
|
mit
| 34,762
|
package main
import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"regexp"
"strconv"
"strings"
"github.com/dghubble/go-twitter/twitter"
"github.com/dghubble/oauth1"
)
var (
twitterUsername string
twitterConsumerKey string
twitterConsumerSecret string
twitterAuthToken string
twitterAuthSecret string
twitterAPIClient *twitter.Client
twitterUploadClient *http.Client
tweetURLPattern = regexp.MustCompile("^https?://twitter.com/\\w+/status/(?P<tweet_id>\\d+)$")
)
type twitterPlugin struct{}
func (p twitterPlugin) EnvVariables() []EnvVariable {
return []EnvVariable{
{
Name: "TWITTER_USERNAME",
Variable: &twitterUsername,
},
{
Name: "TWITTER_CONSUMER_KEY",
Variable: &twitterConsumerKey,
},
{
Name: "TWITTER_CONSUMER_SECRET",
Variable: &twitterConsumerSecret,
},
{
Name: "TWITTER_ACCESS_TOKEN",
Variable: &twitterAuthToken,
},
{
Name: "TWITTER_ACCESS_TOKEN_SECRET",
Variable: &twitterAuthSecret,
},
}
}
func (p twitterPlugin) Name() string {
return "twitter"
}
func NewTwitterPlugin() WorkerPlugin {
return twitterPlugin{}
}
func (p twitterPlugin) Start(ch chan<- error) {
defer close(ch)
config := oauth1.NewConfig(twitterConsumerKey, twitterConsumerSecret)
token := oauth1.NewToken(twitterAuthToken, twitterAuthSecret)
httpClient := config.Client(oauth1.NoContext, token)
twitterUploadClient = httpClient
twitterAPIClient = twitter.NewClient(httpClient)
handleOfflineActivity(ch)
stream, err := twitterAPIClient.Streams.User(&twitter.StreamUserParams{
With: "user",
StallWarnings: twitter.Bool(true),
})
if err != nil {
ch <- err
return
}
demux := twitter.NewSwitchDemux()
demux.Tweet = func(tweet *twitter.Tweet) {
handleTweet(tweet, ch, true)
}
demux.DM = func(dm *twitter.DirectMessage) {
handleDM(dm, ch)
}
demux.StreamLimit = handleStreamLimit
demux.StreamDisconnect = handleStreamDisconnect
demux.Warning = handleWarning
demux.Other = handleOther
demux.HandleChan(stream.Messages)
}
func logMessage(msg interface{}, desc string) {
if msgJSON, err := json.MarshalIndent(msg, "", " "); err == nil {
log.Printf("Received %s: %s\n", desc, string(msgJSON[:]))
} else {
logMessageStruct(msg, desc)
}
}
func logMessageStruct(msg interface{}, desc string) {
log.Printf("Received %s: %+v\n", desc, msg)
}
func lookupTweet(tweetID int64) (*twitter.Tweet, error) {
params := twitter.StatusShowParams{
TweetMode: "extended",
}
tweet, resp, err := twitterAPIClient.Statuses.Show(tweetID, ¶ms)
if err != nil {
return nil, fmt.Errorf("status lookup error: %s", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("status lookup HTTP status code: %d", resp.StatusCode)
}
if tweet == nil {
return nil, errors.New("number of returned tweets is 0")
}
return tweet, nil
}
func lookupTweetText(tweetID int64) (string, error) {
tweet, err := lookupTweet(tweetID)
if err != nil {
return "", err
}
return extractText(tweet), nil
}
func extractText(tweet *twitter.Tweet) string {
var text string
if tweet.FullText == "" {
text = tweet.Text
} else {
text = tweet.FullText
}
if i := tweet.DisplayTextRange; i.End() > 0 {
return string([]rune(text)[i.Start():i.End()])
}
return text
}
func handleTweet(tweet *twitter.Tweet, ch chan<- error, followQuoteRetweet bool) (*twitter.Tweet, error) {
switch {
case tweet.User.ScreenName == twitterUsername:
return nil, errors.New("cannot mock my own tweet")
case tweet.RetweetedStatus != nil:
return nil, errors.New("cannot mock a retweet")
}
logMessageStruct(tweet, "Tweet")
mentions := []string{"@" + tweet.User.ScreenName}
text := extractText(tweet)
var err error
if tweet.InReplyToStatusIDStr == "" ||
!strings.Contains(text, "@"+twitterUsername) {
// remove twitter username mention
if strings.HasPrefix(text, "@"+twitterUsername+" ") {
text = text[len(twitterUsername)+2:]
}
if followQuoteRetweet && tweet.QuotedStatus != nil {
// quote retweets should mock the retweeted person if followQuoteRetweet is true
text = extractText(tweet.QuotedStatus)
mentions = append(mentions, "@"+tweet.QuotedStatus.User.ScreenName)
}
} else {
// mock the text the user replied to
text, err = lookupTweetText(tweet.InReplyToStatusID)
if err != nil {
ch <- err
return nil, err
}
if tweet.InReplyToScreenName != twitterUsername {
mentions = append(mentions, "@"+tweet.InReplyToScreenName)
}
}
log.Println("tweet text:", text)
finalTweets := finalizeTweet(mentions, text)
if DEBUG {
for _, finalTweet := range finalTweets {
log.Println("tweeting:", finalTweet)
}
return nil, errors.New("cannot send a tweet in DEBUG mode")
} else {
mediaID, mediaIDStr, cached, err := uploadImage()
if err != nil {
err = fmt.Errorf("upload image error: %s", err)
ch <- err
return nil, err
}
if !cached {
if err = uploadMetadata(mediaIDStr, text); err != nil {
// we can continue from a metadata upload error
// because it is not essential
ch <- fmt.Errorf("metadata upload error: %s", err)
}
}
params := twitter.StatusUpdateParams{
InReplyToStatusID: tweet.ID,
TrimUser: twitter.Bool(true),
MediaIds: []int64{mediaID},
}
var res *twitter.Tweet
for i, finalTweet := range finalTweets {
sentTweet, resp, err := twitterAPIClient.Statuses.Update(finalTweet, ¶ms)
if err != nil {
err = fmt.Errorf("status update error: %s", err)
ch <- err
return nil, err
}
resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
err = fmt.Errorf("response tweet status code: %d", resp.StatusCode)
ch <- err
return nil, err
}
params.InReplyToStatusID = sentTweet.ID
if i == 0 {
res = sentTweet
}
}
return res, nil
}
}
func extractTweetFromDM(dm *twitter.DirectMessage) (*twitter.Tweet, error) {
// Is this a link to a tweet?
if dm.Entities != nil {
for _, urlEntity := range dm.Entities.Urls {
if r := tweetURLPattern.FindStringSubmatch(urlEntity.ExpandedURL); r != nil {
if tweetID, err := strconv.ParseInt(r[1], 10, 64); err == nil {
// we don't need to check for errors at this point since it cannot be any other kind of message
return lookupTweet(tweetID)
} else {
panic(fmt.Errorf("tweetURLPattern regexp matched a tweet %s with an unparseable tweet ID %d", urlEntity.ExpandedURL, r[1]))
}
}
}
}
// is this a tweet ID?
if tweetID, err := strconv.ParseInt(dm.Text, 10, 64); err == nil {
if tweet, err := lookupTweet(tweetID); err == nil {
return tweet, nil
}
}
return nil, errors.New("no tweet found in dm")
}
func sendDM(text string, userID int64) (*twitter.DirectMessage, error) {
log.Printf("sending a dm to userID %d: %s\n", userID, text)
dm, resp, err := twitterAPIClient.DirectMessages.New(&twitter.DirectMessageNewParams{
UserID: userID,
Text: text,
})
if err != nil {
return nil, fmt.Errorf("new dm error: %s", err)
}
resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("new dm response status code : %d", resp.StatusCode)
}
return dm, nil
}
func handleDM(dm *twitter.DirectMessage, ch chan<- error) {
logMessageStruct(dm, "DM")
if dm.RecipientScreenName != twitterUsername {
// don't react these events
return
}
if tweet, err := extractTweetFromDM(dm); err != nil {
if dm.SenderScreenName != twitterUsername {
// no tweet found, just mock the user dm'ing the bot
responseText := transformTwitterText(dm.Text)
if DEBUG {
log.Println("dm'ing back:", responseText)
} else {
_, err := sendDM(responseText, dm.SenderID)
if err != nil {
ch <- err
return
}
}
} else {
log.Println("DM'd self with invalid message", dm.Text)
}
} else {
if tweet, err := handleTweet(tweet, ch, false); err != nil {
ch <- fmt.Errorf("error handling tweet from dm: %s", err)
_, err := sendDM(transformTwitterText("An error occurred. Please try again"), dm.SenderID)
if err != nil {
ch <- err
return
}
} else {
_, err := sendDM(fmt.Sprintf("https://twitter.com/%s/status/%s", twitterUsername, tweet.IDStr), dm.SenderID)
if err != nil {
ch <- err
return
}
}
}
}
func handleStreamLimit(sl *twitter.StreamLimit) {
logMessage(sl, "stream limit message")
}
func handleStreamDisconnect(sd *twitter.StreamDisconnect) {
logMessage(sd, "stream disconnect message")
}
func handleWarning(w *twitter.StallWarning) {
logMessage(w, "stall warning")
}
func handleOther(message interface{}) {
logMessage(message, `"other" message type`)
}
|
rjchee/spongemock
|
cmd/worker/twitter.go
|
GO
|
mit
| 8,721
|
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/ads/googleads/v1/common/tag_snippet.proto
package common
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
wrappers "github.com/golang/protobuf/ptypes/wrappers"
enums "google.golang.org/genproto/googleapis/ads/googleads/v1/enums"
_ "google.golang.org/genproto/googleapis/api/annotations"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// The site tag and event snippet pair for a TrackingCodeType.
type TagSnippet struct {
// The type of the generated tag snippets for tracking conversions.
Type enums.TrackingCodeTypeEnum_TrackingCodeType `protobuf:"varint,1,opt,name=type,proto3,enum=google.ads.googleads.v1.enums.TrackingCodeTypeEnum_TrackingCodeType" json:"type,omitempty"`
// The format of the web page where the tracking tag and snippet will be
// installed, e.g. HTML.
PageFormat enums.TrackingCodePageFormatEnum_TrackingCodePageFormat `protobuf:"varint,2,opt,name=page_format,json=pageFormat,proto3,enum=google.ads.googleads.v1.enums.TrackingCodePageFormatEnum_TrackingCodePageFormat" json:"page_format,omitempty"`
// The site tag that adds visitors to your basic remarketing lists and sets
// new cookies on your domain.
GlobalSiteTag *wrappers.StringValue `protobuf:"bytes,3,opt,name=global_site_tag,json=globalSiteTag,proto3" json:"global_site_tag,omitempty"`
// The event snippet that works with the site tag to track actions that
// should be counted as conversions.
EventSnippet *wrappers.StringValue `protobuf:"bytes,4,opt,name=event_snippet,json=eventSnippet,proto3" json:"event_snippet,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TagSnippet) Reset() { *m = TagSnippet{} }
func (m *TagSnippet) String() string { return proto.CompactTextString(m) }
func (*TagSnippet) ProtoMessage() {}
func (*TagSnippet) Descriptor() ([]byte, []int) {
return fileDescriptor_24cd5966e9dfdab2, []int{0}
}
func (m *TagSnippet) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TagSnippet.Unmarshal(m, b)
}
func (m *TagSnippet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TagSnippet.Marshal(b, m, deterministic)
}
func (m *TagSnippet) XXX_Merge(src proto.Message) {
xxx_messageInfo_TagSnippet.Merge(m, src)
}
func (m *TagSnippet) XXX_Size() int {
return xxx_messageInfo_TagSnippet.Size(m)
}
func (m *TagSnippet) XXX_DiscardUnknown() {
xxx_messageInfo_TagSnippet.DiscardUnknown(m)
}
var xxx_messageInfo_TagSnippet proto.InternalMessageInfo
func (m *TagSnippet) GetType() enums.TrackingCodeTypeEnum_TrackingCodeType {
if m != nil {
return m.Type
}
return enums.TrackingCodeTypeEnum_UNSPECIFIED
}
func (m *TagSnippet) GetPageFormat() enums.TrackingCodePageFormatEnum_TrackingCodePageFormat {
if m != nil {
return m.PageFormat
}
return enums.TrackingCodePageFormatEnum_UNSPECIFIED
}
func (m *TagSnippet) GetGlobalSiteTag() *wrappers.StringValue {
if m != nil {
return m.GlobalSiteTag
}
return nil
}
func (m *TagSnippet) GetEventSnippet() *wrappers.StringValue {
if m != nil {
return m.EventSnippet
}
return nil
}
func init() {
proto.RegisterType((*TagSnippet)(nil), "google.ads.googleads.v1.common.TagSnippet")
}
func init() {
proto.RegisterFile("google/ads/googleads/v1/common/tag_snippet.proto", fileDescriptor_24cd5966e9dfdab2)
}
var fileDescriptor_24cd5966e9dfdab2 = []byte{
// 421 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4f, 0x6b, 0xdb, 0x30,
0x14, 0xc7, 0x6e, 0xd9, 0x41, 0x5d, 0x57, 0xf0, 0x29, 0x94, 0x52, 0x4a, 0x4e, 0x3d, 0x49, 0x73,
0x07, 0x3b, 0x68, 0xec, 0xe0, 0x36, 0x5b, 0xaf, 0x21, 0x09, 0x61, 0x8c, 0x80, 0x79, 0x89, 0x5f,
0x85, 0x98, 0x2d, 0x69, 0x96, 0x92, 0xd1, 0xaf, 0xb3, 0xe3, 0x3e, 0xca, 0x3e, 0xc6, 0x8e, 0xfd,
0x14, 0xc3, 0x92, 0xec, 0x0e, 0x4a, 0x46, 0x7b, 0xf2, 0xcf, 0x7a, 0xbf, 0x3f, 0xef, 0x49, 0x8f,
0xbc, 0x15, 0x5a, 0x8b, 0x1a, 0x19, 0x54, 0x96, 0x05, 0xd8, 0xa1, 0x5d, 0xce, 0x36, 0xba, 0x69,
0xb4, 0x62, 0x0e, 0x44, 0x69, 0x95, 0x34, 0x06, 0x1d, 0x35, 0xad, 0x76, 0x3a, 0x3b, 0x0f, 0x34,
0x0a, 0x95, 0xa5, 0x83, 0x82, 0xee, 0x72, 0x1a, 0x14, 0xa7, 0x1f, 0xf7, 0x39, 0xa2, 0xda, 0x36,
0x96, 0xb9, 0x16, 0x36, 0xdf, 0xa4, 0x12, 0xe5, 0x46, 0x57, 0x58, 0x1a, 0x10, 0x58, 0xde, 0xe9,
0xb6, 0x81, 0x68, 0x7f, 0xfa, 0xfe, 0x25, 0x72, 0x77, 0x6f, 0x30, 0xea, 0xce, 0x7a, 0x9d, 0x91,
0x0c, 0x94, 0xd2, 0x0e, 0x9c, 0xd4, 0xca, 0xc6, 0x6a, 0x6c, 0x9a, 0xf9, 0xbf, 0xf5, 0xf6, 0x8e,
0xfd, 0x68, 0xc1, 0x18, 0x6c, 0x63, 0x7d, 0xfc, 0x27, 0x25, 0x64, 0x01, 0x62, 0x1e, 0x26, 0xcd,
0xbe, 0x90, 0xc3, 0xce, 0x7a, 0x94, 0x5c, 0x24, 0x97, 0x6f, 0xae, 0x26, 0x74, 0xdf, 0xc8, 0xbe,
0x27, 0xba, 0x88, 0x3d, 0xdd, 0xe8, 0x0a, 0x17, 0xf7, 0x06, 0x3f, 0xa9, 0x6d, 0xf3, 0xe4, 0x70,
0xe6, 0x1d, 0xb3, 0xef, 0xe4, 0xe8, 0x9f, 0x99, 0x47, 0xa9, 0x0f, 0x98, 0xbe, 0x20, 0x60, 0x0a,
0x02, 0x3f, 0x7b, 0xf1, 0x93, 0x98, 0xc7, 0xd2, 0x8c, 0x98, 0x01, 0x67, 0x13, 0x72, 0x22, 0x6a,
0xbd, 0x86, 0xba, 0xb4, 0xd2, 0x61, 0xe9, 0x40, 0x8c, 0x0e, 0x2e, 0x92, 0xcb, 0xa3, 0xab, 0xb3,
0x3e, 0xb6, 0xbf, 0x15, 0x3a, 0x77, 0xad, 0x54, 0x62, 0x09, 0xf5, 0x16, 0x67, 0xc7, 0x41, 0x34,
0x97, 0x0e, 0x17, 0x20, 0xb2, 0x82, 0x1c, 0xe3, 0x0e, 0x95, 0xeb, 0xb7, 0x61, 0x74, 0xf8, 0x0c,
0x8f, 0xd7, 0x5e, 0x12, 0x6f, 0xf5, 0xfa, 0x21, 0x21, 0xe3, 0x8d, 0x6e, 0xe8, 0xff, 0x17, 0xe8,
0xfa, 0xe4, 0xf1, 0x21, 0xa6, 0x9d, 0xe9, 0x34, 0xf9, 0x3a, 0x89, 0x12, 0xa1, 0x6b, 0x50, 0x82,
0xea, 0x56, 0x30, 0x81, 0xca, 0x47, 0xf6, 0x4b, 0x62, 0xa4, 0xdd, 0xb7, 0xc4, 0x1f, 0xc2, 0xe7,
0x67, 0x7a, 0x70, 0x5b, 0x14, 0xbf, 0xd2, 0xf3, 0xdb, 0x60, 0x56, 0x54, 0x96, 0x06, 0xd8, 0xa1,
0x65, 0x4e, 0x6f, 0x3c, 0xed, 0x77, 0x4f, 0x58, 0x15, 0x95, 0x5d, 0x0d, 0x84, 0xd5, 0x32, 0x5f,
0x05, 0xc2, 0x43, 0x3a, 0x0e, 0xa7, 0x9c, 0x17, 0x95, 0xe5, 0x7c, 0xa0, 0x70, 0xbe, 0xcc, 0x39,
0x0f, 0xa4, 0xf5, 0x2b, 0xdf, 0xdd, 0xbb, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x5f, 0xe8,
0x51, 0x61, 0x03, 0x00, 0x00,
}
|
pushbullet/engineer
|
vendor/google.golang.org/genproto/googleapis/ads/googleads/v1/common/tag_snippet.pb.go
|
GO
|
mit
| 6,534
|
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{shared/master-loja}">
<head>
<title>Detalhes do Produto</title>
<link th:href="@{/css/detalhesProduto-loja.css}"
rel="stylesheet" type="text/css"
href="../../static/css/detalhesProduto-loja.css" />
</head>
<body>
<div layout:fragment="conteudo">
<div class="container">
<div class="col-xs-12 col-md-6 col-lg-6">
<div class="miniaturas col-sm-2 col-md-2 col-lg-2">
<a href="#" class="thumbnail" th:each="imagem : ${produto.imagens}">
<img class="img-responsive" th:src="@{${imagem.urlImagem}}"
th:alt="${imagem.descricao}" />
</a>
</div>
<div class="col-sm-6 col-md-10 col-lg-10">
<img class="img-responsive" th:src="@{${produto.urlImagemPrincipal}}" alt=""/>
</div>
</div>
<div class="col-xs-7 col-md-6 col-lg-6">
<div class="container-borda">
<p class="p-titulo" th:text="${produto.nome}">
Nome do produto
</p>
<p class="p-descricao" th:text="${produto.descricao}">
Descrição
</p>
<p class="p-preco" th:text="${#numbers.formatCurrency(produto.valor)}">
valor do produto
</p>
</div>
</div>
<div class="col-xs-5 col-md-6 col-lg-6" th:if="${produto.estaDisponivel}">
<form method="POST" action="/loja/add-item">
<input type="hidden" th:value="${produto.id}" name="id"/>
<div class="form-group">
<label>Quantidade</label>
<input type="number" min="1" max="10" name="qtde" class="form-control" value="1" />
</div>
<div class="container-opcoes">
<div class="row">
<p>Tamanho</p>
<select class="form-control" name="tamanho">
<option value="" selected>Selecione o Tamanho</option>
<option th:each="e : ${produto.estoque}" th:value="${e.tamanho}" th:text="${e.tamanho}"></option>
</select>
</div>
<div class="row linha-btn">
<input id="btnComprar" type="submit" class="btn btn-primary" value="Comprar" />
</div>
</div>
</form>
<div class="row">
<div id="parcelamento" class="pull-right">
<p>Parcelamento</p>
<img src="/imagens/bandeiras-parcelamento.gif" alt="Bandeiras de cartões de crédito aceitas" />
<table class="table table-striped table-responsive">
<tr th:each="p, i : ${parcelas}">
<td th:text="${i.count + ' x ' + #numbers.formatCurrency(p) + ' sem juros'}"></td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-xs-5 col-md-6 col-lg-6" th:if="${!produto.estaDisponivel}">
<div class="alert alert-warning">
<p>Estoque indisponível</p>
</div>
</div>
</div>
</div>
</body>
</html>
|
Maltasga/pi4-while-true
|
kkcommerce/bin/src/main/resources/templates/loja/detalhesProduto.html
|
HTML
|
mit
| 4,063
|
'use strict';
require('../../../TestHelper');
/* global bootstrapDiagram, inject */
var modelingModule = require('../../../../lib/features/modeling'),
bendpointsModule = require('../../../../lib/features/bendpoints'),
rulesModule = require('./rules'),
interactionModule = require('../../../../lib/features/interaction-events'),
canvasEvent = require('../../../util/MockEvents').createCanvasEvent;
describe('features/bendpoints', function() {
beforeEach(bootstrapDiagram({ modules: [ modelingModule, bendpointsModule, interactionModule, rulesModule ] }));
beforeEach(inject(function(dragging) {
dragging.setOptions({ manual: true });
}));
var rootShape, shape1, shape2, shape3, connection, connection2;
beforeEach(inject(function(elementFactory, canvas) {
rootShape = elementFactory.createRoot({
id: 'root'
});
canvas.setRootElement(rootShape);
shape1 = elementFactory.createShape({
id: 'shape1',
type: 'A',
x: 100, y: 100, width: 300, height: 300
});
canvas.addShape(shape1, rootShape);
shape2 = elementFactory.createShape({
id: 'shape2',
type: 'A',
x: 500, y: 100, width: 100, height: 100
});
canvas.addShape(shape2, rootShape);
shape3 = elementFactory.createShape({
id: 'shape3',
type: 'B',
x: 500, y: 400, width: 100, height: 100
});
canvas.addShape(shape3, rootShape);
connection = elementFactory.createConnection({
id: 'connection',
waypoints: [ { x: 250, y: 250 }, { x: 550, y: 250 }, { x: 550, y: 150 } ],
source: shape1,
target: shape2
});
canvas.addConnection(connection, rootShape);
connection2 = elementFactory.createConnection({
id: 'connection2',
waypoints: [ { x: 250, y: 250 }, { x: 550, y: 450 } ],
source: shape1,
target: shape2
});
canvas.addConnection(connection2, rootShape);
}));
describe('activation', function() {
it('should show on hover', inject(function(eventBus, canvas, elementRegistry) {
// given
var layer = canvas.getLayer('overlays');
// when
eventBus.fire('element.hover', { element: connection, gfx: elementRegistry.getGraphics(connection) });
// then
// 3 visible + 1 invisible bendpoint are shown
expect(layer.node.querySelectorAll('.djs-bendpoint').length).to.equal(4);
expect(layer.node.querySelectorAll('.djs-segment-dragger').length).to.equal(2);
}));
it('should show on select', inject(function(selection, canvas, elementRegistry) {
// given
var layer = canvas.getLayer('overlays');
// when
selection.select(connection);
// then
// 3 visible + 1 invisible bendpoint are shown
expect(layer.node.querySelectorAll('.djs-bendpoint').length).to.equal(4);
expect(layer.node.querySelectorAll('.djs-segment-dragger').length).to.equal(2);
}));
it('should activate bendpoint move', inject(function(dragging, eventBus, elementRegistry, bendpoints) {
// when
eventBus.fire('element.hover', { element: connection, gfx: elementRegistry.getGraphics(connection) });
eventBus.fire('element.mousemove', {
element: connection,
originalEvent: canvasEvent({ x: 500, y: 250 })
});
eventBus.fire('element.mousedown', {
element: connection,
originalEvent: canvasEvent({ x: 500, y: 250 })
});
var draggingContext = dragging.active();
// then
expect(draggingContext).to.exist;
expect(draggingContext.prefix).to.eql('bendpoint.move');
}));
it('should activate parallel move', inject(function(dragging, eventBus, elementRegistry, bendpoints) {
// precondition
var intersectionStart = connection.waypoints[0].x,
intersectionEnd = connection.waypoints[1].x,
intersectionMid = intersectionEnd - (intersectionEnd - intersectionStart) / 2;
// when
eventBus.fire('element.hover', { element: connection, gfx: elementRegistry.getGraphics(connection) });
eventBus.fire('element.mousemove', {
element: connection,
originalEvent: canvasEvent({ x: intersectionMid, y: 250 })
});
eventBus.fire('element.mousedown', {
element: connection,
originalEvent: canvasEvent({ x: intersectionMid, y: 250 })
});
var draggingContext = dragging.active();
// then
expect(draggingContext).to.exist;
expect(draggingContext.prefix).to.eql('connectionSegment.move');
}));
});
});
|
camunda-internal/bpmn-quiz
|
node_modules/diagram-js/test/spec/features/bendpoints/BendpointsSpec.js
|
JavaScript
|
mit
| 4,569
|
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import Landing from './../Landing'
import * as UserActions from './../actions/User'
function mapStateToProps(state) {
return {
user: state.userStore.user
}
}
const mapDispatchToProps = (dispatch) => {
return bindActionCreators(UserActions, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(Landing)
|
Briseus/Kape
|
src/containers/Landing.js
|
JavaScript
|
mit
| 425
|
# Made by Christian Oliveros on 04/10/2017 for MMKF15
# Imports Used
import decimal as d
try:
from .constants import VL, EPSILON, STEP_MAX
except SystemError as e:
from constants import VL, EPSILON, STEP_MAX
class Vector3(object):
"""Class that represents a Vector with 3 coordinates"""
def __init__(self, x=0.0, y=0.0, z=0.0):
super(Vector3, self).__init__()
self.x = d.Decimal(x)
self.y = d.Decimal(y)
self.z = d.Decimal(z)
"""Class Representation"""
def __repr__(self):
return "Vector3(x=%r,y=%r,z=%r)" % (self.x, self.y, self.z)
"""Class String Representation"""
def __str__(self):
return "(%s, %s, %s)" % (str(self.x), str(self.y), str(self.z))
"""Copy this vector in new instance"""
def copy(self):
return Vector3(self.x, self.y, self.z)
"""Get Square Magnitude of vector"""
def sqrMagnitude(self):
dec2 = d.Decimal(2.0)
return self.x**dec2 + self.y**dec2 + self.z**dec2
"""Get Magnitude of vector"""
def magnitude(self):
return self.sqrMagnitude().sqrt()
"""Unary minus"""
def __neg__(self):
return self * -1
"""Unary addition"""
def __pos__(self):
return self
"""Absolute Value, Equivalent to Magnitude"""
def __abs__(self):
return self.magnitude()
"""In place addition"""
def __iadd__(self, other):
if not isinstance(other, Vector3):
raise TypeError("Expected Vector3 but got '%s'" % str(type(other).__name__))
self.x += other.x
self.y += other.y
self.z += other.z
return self
"""Addition"""
def __add__(self, other):
v = Vector3()
v += other
v += self
return v
"""Reverse Addition"""
def __radd__(self, other):
return self + other
"""In place Scalar Multiplication"""
def __imul__(self, other):
rhs = d.Decimal(other)
self.x *= rhs
self.y *= rhs
self.z *= rhs
return self
"""Scalar Multiplication"""
def __mul__(self, other):
v = self.copy()
v *= other
return v
"""Reverse Addition"""
def __rmul__(self, other):
return self * other
"""In place Substraction"""
def __isub__(self, other):
if not isinstance(other, Vector3):
msg = "Expected Vector3 but got '%s'" % str(type(other).__name__)
raise TypeError(msg)
self += (other * -1)
return self
"""Substraction"""
def __sub__(self, other):
v = self.copy()
v -= other
return v
"""Normalize this vector"""
def normalize(self):
length = self.magnitude()
if length < EPSILON:
self *= 0
return
self *= d.Decimal(1) / length
"""Return this vector normalized"""
def normalized(self):
v = self.copy()
v.normalize()
return v
# Set constant start position
def _setConstants():
try:
from .constants import __name__ as constants_module_name
from .constants import START_POSITION_HEIGHT_OFFSET
except SystemError as e:
from constants import __name__ as constants_module_name
from constants import START_POSITION_HEIGHT_OFFSET
import sys
module = sys.modules[constants_module_name]
setattr(module, 'START_POSITION', Vector3(0, 0, VL - START_POSITION_HEIGHT_OFFSET))
_setConstants()
"""
Generates Lineary Interpolated points from p0 to p1 with steps of size maxStep or less.
If step lesser than EPSILON then no step is done
"""
def interpolatePoints(p0, p1, maxStep=STEP_MAX):
direction = p1 - p0
length_sqr = direction.sqrMagnitude()
if length_sqr < EPSILON**2:
yield p0
return
dist = d.Decimal(0)
one = d.Decimal(1)
segments = int(length_sqr.sqrt() / maxStep)
if segments <= 1:
yield p0
yield p1
return
step = one / d.Decimal(segments)
while True:
yield p0 + (direction * dist)
dist += step
if dist > one:
break
if __name__ == '__main__':
print("Init test")
v = Vector3()
print(v)
v2 = Vector3(1,2,3.3)
print(v2)
print("Square Magnitude test")
print(v.sqrMagnitude())
print(v2.sqrMagnitude())
print("Magnitude test")
print(v.magnitude())
print(v2.magnitude())
print("In place Addition Tests")
try:
v += 1
except Exception as e:
print(e.args)
try:
v3 = Vector3(1,1,1)
v3 += v2
print(v3)
except Exception as e:
print(e.args)
print("Addition Tests")
try:
a = v + 1
except Exception as e:
print(e.args)
try:
v3 = Vector3(1,1,1)
a = v3 + v2
print(a)
except Exception as e:
print(e.args)
print("In place Scalar Multiplication Tests")
try:
v *= Vector3()
except Exception as e:
print(e.args)
try:
v3 = Vector3(1,1,1)
v3 *= 2
print(v3)
except Exception as e:
print(e.args)
print("Scalar Multiplication Tests")
try:
a = v * Vector3()
except Exception as e:
print(e.args)
try:
v3 = Vector3(1,1,1)
a = v3 * 4
print(a)
print("v3=%s" % str(v3))
except Exception as e:
print(e.args)
print("Unary minus test")
v3 = Vector3(1,2,3)
print("v=%s" % str(v3))
print("-v=%s" % str(-v3))
print("Substraction test")
v2 = Vector3(1,0,1)
v3 = Vector3(1,1,0)
print("v2=%s" % str(v2))
print("v3=%s" % str(v3))
print("v3-v2=%s" % str(v3 - v2))
print("v3=%s" % str(v3))
v3 -= v2
print("(v3-=v2)=%s" % str(v3))
print("Normalization Tests")
v3 = Vector3(1,1,1)
print(v3.normalized())
print(v3)
v3.normalize()
print(v3)
v3 = Vector3(0,0,0)
v3.normalize()
print(v3)
print("Interpolation Tests")
p0 = Vector3(0, 0, 0)
p1 = Vector3(1, 1, 1)
a = [v for v in interpolatePoints(p0, p1)]
print("Too long to print but it is here, uncomment if want you to see")
#print(a)
print("Interpolation test for points too close")
print([v for v in interpolatePoints(p0, Vector3(0, EPSILON / d.Decimal(2), 0))])
print("Interpolation test for points really close")
print([v for v in interpolatePoints(p0, Vector3(0, EPSILON, 0))])
print("Interpolation test for points almost really close")
print([v for v in interpolatePoints(p0, Vector3(0, EPSILON * d.Decimal(2), 0))])
|
maniatic0/rasppi-printer
|
Utilities/vector.py
|
Python
|
mit
| 5,714
|
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE FlexibleInstances #-}
module RockPaperScissors
( game
, WinCounts(..)
, Order(..)
, Replay(..)
) where
import Data.Maybe
import Data.Monoid
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.IO as TLIO
import qualified Data.Vector as V
import Path
import System.IO
import AIChallenger.Types
data RPS = RPS
game :: RPS
game = RPS
data WinCounts = WinCounts Int Int
deriving (Show, Eq)
data Order = R | P | S
deriving (Show, Eq)
data Replay = Replay (V.Vector (WinCounts, Order, Order))
deriving (Show, Eq)
instance Monoid Replay where
mempty = Replay mempty
mappend (Replay a) (Replay b) = Replay (mappend a b)
instance Monoid WinCounts where
mempty = WinCounts 0 0
mappend (WinCounts a1 b1) (WinCounts a2 b2) = WinCounts (a1 + a2) (b1 + b2)
instance Game RPS where
type GameState RPS = (WinCounts, Replay)
type GameOrder RPS = Order
type GameReplay RPS = Replay
gameAvailableMaps _ = return (V.singleton (MapName "default"))
gameInitialState _ _ = return (mempty, mempty)
gameParseOrder _ "R" = Just R
gameParseOrder _ "P" = Just P
gameParseOrder _ "S" = Just S
gameParseOrder _ _ = Nothing
gameAdvance rawOrders (oldScore, oldReplay) =
case validateOrders rawOrders of
Left faults ->
let winners =
V.filter
(not . (`V.elem` (fmap fst faults)))
(fmap PlayerId [1, 2])
in Left (GameResult winners (Disqualification faults) oldReplay)
Right orders@(o1, o2) ->
let newScore = oldScore <> scoreRound orders
in Right (newScore, oldReplay <> Replay [(newScore, o1, o2)])
gameTimeout (WinCounts x y, replay) =
let winners = case compare x y of
EQ -> [PlayerId 1, PlayerId 2]
GT -> [PlayerId 1]
LT -> [PlayerId 2]
in GameResult winners TurnLimit replay
gameExtractReplay _ (_state, replay) = replay
gameSaveReplay _ path (Replay turns) = do
let filepath = toFilePath path
formatTurn (WinCounts c1 c2, o1, o2) =
TL.pack (unwords [show c1, show c2, show o1, show o2])
withFile filepath WriteMode $ \h ->
mapM_ (TLIO.hPutStrLn h . formatTurn) turns
gameSendWorld _ _pid _state _sendLine = return ()
validateOrders :: V.Vector (PlayerId, V.Vector Order)
-> Either Faults (Order, Order)
validateOrders rawOrders =
if V.null faults
then
let [a, b] = foldMap (V.take 1 . snd) rawOrders
in Right (a, b)
else Left faults
where
faults = V.fromList (mapMaybe go (V.toList rawOrders))
go (p, []) = Just (p, (pure (Fault "no moves")))
go (_, [_]) = Nothing
go (p, _) = Just (p, (pure (Fault "multiple moves")))
scoreRound :: (Order, Order) -> WinCounts
scoreRound (R, P) = WinCounts 0 1
scoreRound (R, S) = WinCounts 1 0
scoreRound (P, S) = WinCounts 0 1
scoreRound (P, R) = WinCounts 1 0
scoreRound (S, R) = WinCounts 0 1
scoreRound (S, P) = WinCounts 1 0
scoreRound _ = WinCounts 0 0
|
ethercrow/ai-challenger
|
game-rps/RockPaperScissors.hs
|
Haskell
|
mit
| 3,261
|
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
Ember.MODEL_FACTORY_INJECTIONS = true;
var App = Ember.Application.extend({
modulePrefix: 'tvdb', // TODO: loaded via config
Resolver: Resolver
});
loadInitializers(App, 'tvdb');
export default App;
|
bolotyuh/ember-symfony-starterkit
|
web/ember/foo/app/app.js
|
JavaScript
|
mit
| 302
|
YUI.add('dataschema-array', function (Y, NAME) {
/**
* Provides a DataSchema implementation which can be used to work with data
* stored in arrays.
*
* @module dataschema
* @submodule dataschema-array
*/
/**
Provides a DataSchema implementation which can be used to work with data
stored in arrays.
See the `apply` method below for usage.
@class DataSchema.Array
@extends DataSchema.Base
@static
**/
var LANG = Y.Lang,
SchemaArray = {
////////////////////////////////////////////////////////////////////////
//
// DataSchema.Array static methods
//
////////////////////////////////////////////////////////////////////////
/**
Applies a schema to an array of data, returning a normalized object
with results in the `results` property. The `meta` property of the
response object is present for consistency, but is assigned an empty
object. If the input data is absent or not an array, an `error`
property will be added.
The input array is expected to contain objects, arrays, or strings.
If _schema_ is not specified or _schema.resultFields_ is not an array,
`response.results` will be assigned the input array unchanged.
When a _schema_ is specified, the following will occur:
If the input array contains strings, they will be copied as-is into the
`response.results` array.
If the input array contains arrays, `response.results` will contain an
array of objects with key:value pairs assuming the fields in
_schema.resultFields_ are ordered in accordance with the data array
values.
If the input array contains objects, the identified
_schema.resultFields_ will be used to extract a value from those
objects for the output result.
_schema.resultFields_ field identifiers are objects with the following properties:
* `key` : <strong>(required)</strong> The locator name (String)
* `parser`: A function or the name of a function on `Y.Parsers` used
to convert the input value into a normalized type. Parser
functions are passed the value as input and are expected to
return a value.
If no value parsing is needed, you can use strings as identifiers
instead of objects (see example below).
@example
// Process array of arrays
var schema = { resultFields: [ 'fruit', 'color' ] },
data = [
[ 'Banana', 'yellow' ],
[ 'Orange', 'orange' ],
[ 'Eggplant', 'purple' ]
];
var response = Y.DataSchema.Array.apply(schema, data);
// response.results[0] is { fruit: "Banana", color: "yellow" }
// Process array of objects
data = [
{ fruit: 'Banana', color: 'yellow', price: '1.96' },
{ fruit: 'Orange', color: 'orange', price: '2.04' },
{ fruit: 'Eggplant', color: 'purple', price: '4.31' }
];
response = Y.DataSchema.Array.apply(schema, data);
// response.results[0] is { fruit: "Banana", color: "yellow" }
// Use parsers
schema.resultFields = [
{
key: 'fruit',
parser: function (val) { return val.toUpperCase(); }
},
{
key: 'price',
parser: 'number' // Uses Y.Parsers.number
}
];
response = Y.DataSchema.Array.apply(schema, data);
// Note price was converted from a numeric string to a number
// response.results[0] looks like { fruit: "BANANA", price: 1.96 }
@method apply
@param {Object} [schema] Schema to apply. Supported configuration
properties are:
@param {Array} [schema.resultFields] Field identifiers to
locate/assign values in the response records. See above for
details.
@param {Array} data Array data.
@return {Object} An Object with properties `results` and `meta`
@static
**/
apply: function(schema, data) {
var data_in = data,
data_out = {results:[],meta:{}};
if(LANG.isArray(data_in)) {
if(schema && LANG.isArray(schema.resultFields)) {
// Parse results data
data_out = SchemaArray._parseResults.call(this, schema.resultFields, data_in, data_out);
}
else {
data_out.results = data_in;
}
}
else {
data_out.error = new Error("Array schema parse failure");
}
return data_out;
},
/**
* Schema-parsed list of results from full data
*
* @method _parseResults
* @param fields {Array} Schema to parse against.
* @param array_in {Array} Array to parse.
* @param data_out {Object} In-progress parsed data to update.
* @return {Object} Parsed data object.
* @static
* @protected
*/
_parseResults: function(fields, array_in, data_out) {
var results = [],
result, item, type, field, key, value, i, j;
for(i=array_in.length-1; i>-1; i--) {
result = {};
item = array_in[i];
type = (LANG.isObject(item) && !LANG.isFunction(item)) ? 2 : (LANG.isArray(item)) ? 1 : (LANG.isString(item)) ? 0 : -1;
if(type > 0) {
for(j=fields.length-1; j>-1; j--) {
field = fields[j];
key = (!LANG.isUndefined(field.key)) ? field.key : field;
value = (!LANG.isUndefined(item[key])) ? item[key] : item[j];
result[key] = Y.DataSchema.Base.parse.call(this, value, field);
}
}
else if(type === 0) {
result = item;
}
else {
//TODO: null or {}?
result = null;
}
results[i] = result;
}
data_out.results = results;
return data_out;
}
};
Y.DataSchema.Array = Y.mix(SchemaArray, Y.DataSchema.Base);
}, '3.10.3', {"requires": ["dataschema-base"]});
|
braz/mojito-helloworld
|
node_modules/mojito/node_modules/yui/dataschema-array/dataschema-array.js
|
JavaScript
|
mit
| 6,625
|
#define CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <WinSock2.h>
#include <time.h>
#include "anet.h"
#include "tsdb.h"
// INCR <METRIC> NOW 1\r\n
// INCR <METRIC> <TS> 1\r\n
// RANGE <METRIC> <TSFROM> <TSTO>\r\n
/* Global variables */
struct tsdbServer server;
struct tsdbCommand commandTable[] = {
{"echo", echoCommand},
{"rand", randCommand}
};
void* lookupCommand(sds name) {
int i;
for(i = 0; i < server.numCommands; i++) {
if(strcmp(name, commandTable[i].name) == 0) {
return &commandTable[i];
}
}
return NULL;
}
void randCommand(struct tsdbClient* client) {
addReplyDouble(client, rand());
}
void echoCommand(struct tsdbClient* client) {
addReplyString(client, client->input);
}
void addReplyString(struct tsdbClient* client, sds s) {
anetWrite(client->clientfd, s, sdslen(s));
}
void addReplyDouble(struct tsdbClient* client, double d) {
char buf[50];
int l;
l = sprintf_s(buf, 50, "%.2f", d);
anetWrite(client->clientfd, buf, l);
}
void initServerConfig() {
srand((unsigned int)(time(NULL)));
server.port = TSDB_SERVER_PORT;
server.addr = "127.0.0.1";
server.numCommands = sizeof(commandTable) / sizeof(struct tsdbCommand);
}
struct tsdbClient* createClient(int fd) {
struct tsdbClient* client = (struct tsdbClient*)malloc(sizeof(struct tsdbClient));
client->clientfd = fd;
client->argc = 0;
client->argv = (sds*)malloc(sizeof(sds) * TSDB_MAX_ARG_COUNT);
client->input = sdsempty();
return client;
}
void freeClient(struct tsdbClient* client) {
if(client == NULL) {
return;
}
if(client->argv != NULL) {
free(client->argv);
}
if(client->input != NULL) {
sdsfree(client->input);
}
free(client);
}
int main(int argc, char** argv) {
// We need an array of metrics
initServerConfig();
server.socketfd = anetTcpServer(server.port, server.addr);
printf("listening on port 1339\n");
printf("listening for clients..\n");
for(;;) {
int fd;
int nread;
struct tsdbClient* client;
struct tsdbCommand* cmd;
fd = anetTcpAccept(server.socketfd);
client = createClient(fd);
printf("client accepted: %d\n", server.socketfd);
for(;;) {
// read command from client
do {
char buf[TSDB_IOBUF_LEN];
nread = recv((SOCKET)fd, buf, TSDB_IOBUF_LEN, 0);
client->input = sdscatlen(client->input, buf, nread);
if(strchr(buf, '\r') != NULL) {
client->input = sdsnewlen(client->input, sdslen(client->input)-2); // exclude \r\n
break;
}
} while(nread > 0);
// handle quit commands
if(strcmp(client->input, "quit") == 0) {
break;
}
// parse command
client->argc = sdssplit(client->input, ' ', client->argv);
// invoke command
cmd = lookupCommand(client->argv[0]);
if(cmd != NULL) {
printf("got command %s\n", cmd->name);
cmd->proc(client);
} else {
addReplyString(client, sdsnew("error: unknown command"));
}
// reset raw input
client->input = sdsempty();
}
anetClose(client->clientfd);
freeClient(client);
}
_CrtDumpMemoryLeaks();
return 0;
}
|
alexandernyquist/tsdb
|
tsdb/tsdb.c
|
C
|
mit
| 3,075
|
//
// EJErrorTip.h
// EJDemo
//
// Created by iOnRoad on 15/9/29.
// Copyright © 2015年 iOnRoad. All rights reserved.
//
#import "EJErrorView.h"
@interface EJDefaultErrorView : EJErrorView
@end
|
iOnRoad/EJHttpClient
|
EJHttpClientDemo/EJHttpClientDemo/EJDefaultErrorView.h
|
C
|
mit
| 203
|
using Reactive.Bindings;
namespace LiveLinq.Tests
{
public class SelectObservableCollectionViewModel
{
public SelectObservableCollectionViewModel(string name)
{
Name = new ReactiveProperty<string>(name);
}
public ReactiveProperty<string> Name { get; private set; }
}
}
|
ApocalypticOctopus/Apocalyptic.Utilities.Net
|
LiveLinq.Tests/SelectObservableCollectionViewModel.cs
|
C#
|
mit
| 327
|
// This file was auto-generated based on version 1.0.0 of the canonical data.
using System;
using System.Collections.Generic;
using Xunit;
public class GoCountingTests
{
[Fact]
public void Black_corner_territory_on_5x5_board()
{
var coordinate = (0, 1);
var board =
" B \n" +
" B B \n" +
"B W B\n" +
" W W \n" +
" W ";
var sut = new GoCounting(board);
var actual = sut.Territory(coordinate);
var expected = (Owner.Black, new[] { (0, 0), (0, 1), (1, 0) });
Assert.Equal(expected.Item1, actual.Item1);
Assert.Equal(expected.Item2, actual.Item2);
}
[Fact(Skip = "Remove to run test")]
public void White_center_territory_on_5x5_board()
{
var coordinate = (2, 3);
var board =
" B \n" +
" B B \n" +
"B W B\n" +
" W W \n" +
" W ";
var sut = new GoCounting(board);
var actual = sut.Territory(coordinate);
var expected = (Owner.White, new[] { (2, 3) });
Assert.Equal(expected.Item1, actual.Item1);
Assert.Equal(expected.Item2, actual.Item2);
}
[Fact(Skip = "Remove to run test")]
public void Open_corner_territory_on_5x5_board()
{
var coordinate = (1, 4);
var board =
" B \n" +
" B B \n" +
"B W B\n" +
" W W \n" +
" W ";
var sut = new GoCounting(board);
var actual = sut.Territory(coordinate);
var expected = (Owner.None, new[] { (0, 3), (0, 4), (1, 4) });
Assert.Equal(expected.Item1, actual.Item1);
Assert.Equal(expected.Item2, actual.Item2);
}
[Fact(Skip = "Remove to run test")]
public void A_stone_and_not_a_territory_on_5x5_board()
{
var coordinate = (1, 1);
var board =
" B \n" +
" B B \n" +
"B W B\n" +
" W W \n" +
" W ";
var sut = new GoCounting(board);
var actual = sut.Territory(coordinate);
var expected = (Owner.None, Array.Empty<(int, int)>());
Assert.Equal(expected.Item1, actual.Item1);
Assert.Equal(expected.Item2, actual.Item2);
}
[Fact(Skip = "Remove to run test")]
public void Invalid_because_x_is_too_low_for_5x5_board()
{
var coordinate = (-1, 1);
var board =
" B \n" +
" B B \n" +
"B W B\n" +
" W W \n" +
" W ";
var sut = new GoCounting(board);
Assert.Throws<ArgumentException>(() => sut.Territory(coordinate));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_because_x_is_too_high_for_5x5_board()
{
var coordinate = (5, 1);
var board =
" B \n" +
" B B \n" +
"B W B\n" +
" W W \n" +
" W ";
var sut = new GoCounting(board);
Assert.Throws<ArgumentException>(() => sut.Territory(coordinate));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_because_y_is_too_low_for_5x5_board()
{
var coordinate = (1, -1);
var board =
" B \n" +
" B B \n" +
"B W B\n" +
" W W \n" +
" W ";
var sut = new GoCounting(board);
Assert.Throws<ArgumentException>(() => sut.Territory(coordinate));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_because_y_is_too_high_for_5x5_board()
{
var coordinate = (1, 5);
var board =
" B \n" +
" B B \n" +
"B W B\n" +
" W W \n" +
" W ";
var sut = new GoCounting(board);
Assert.Throws<ArgumentException>(() => sut.Territory(coordinate));
}
[Fact(Skip = "Remove to run test")]
public void One_territory_is_the_whole_board()
{
var board = " ";
var sut = new GoCounting(board);
var actual = sut.Territories();
var expected = new Dictionary<Owner, (int, int)[]>
{
[Owner.Black] = Array.Empty<(int, int)>(),
[Owner.White] = Array.Empty<(int, int)>(),
[Owner.None] = new[] { (0, 0) }
};
Assert.Equal(expected.Keys, actual.Keys);
Assert.Equal(expected[Owner.Black], actual[Owner.Black]);
Assert.Equal(expected[Owner.White], actual[Owner.White]);
Assert.Equal(expected[Owner.None], actual[Owner.None]);
}
[Fact(Skip = "Remove to run test")]
public void Two_territory_rectangular_board()
{
var board =
" BW \n" +
" BW ";
var sut = new GoCounting(board);
var actual = sut.Territories();
var expected = new Dictionary<Owner, (int, int)[]>
{
[Owner.Black] = new[] { (0, 0), (0, 1) },
[Owner.White] = new[] { (3, 0), (3, 1) },
[Owner.None] = Array.Empty<(int, int)>()
};
Assert.Equal(expected.Keys, actual.Keys);
Assert.Equal(expected[Owner.Black], actual[Owner.Black]);
Assert.Equal(expected[Owner.White], actual[Owner.White]);
Assert.Equal(expected[Owner.None], actual[Owner.None]);
}
[Fact(Skip = "Remove to run test")]
public void Two_region_rectangular_board()
{
var board = " B ";
var sut = new GoCounting(board);
var actual = sut.Territories();
var expected = new Dictionary<Owner, (int, int)[]>
{
[Owner.Black] = new[] { (0, 0), (2, 0) },
[Owner.White] = Array.Empty<(int, int)>(),
[Owner.None] = Array.Empty<(int, int)>()
};
Assert.Equal(expected.Keys, actual.Keys);
Assert.Equal(expected[Owner.Black], actual[Owner.Black]);
Assert.Equal(expected[Owner.White], actual[Owner.White]);
Assert.Equal(expected[Owner.None], actual[Owner.None]);
}
}
|
robkeim/xcsharp
|
exercises/go-counting/GoCountingTests.cs
|
C#
|
mit
| 6,023
|
#!/bin/sh
# CYBERWATCH SAS - 2017
#
# Security fix for USN-2191-1
#
# Security announcement date: 2014-05-01 00:00:00 UTC
# Script generation date: 2017-01-01 21:03:47 UTC
#
# Operating System: Ubuntu 12.04 LTS
# Architecture: i386
#
# Vulnerable packages fix on version:
# - icedtea-6-jre-cacao:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre-headless:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre-lib:6b31-1.13.3-1ubuntu1~0.12.04.2
# - icedtea-6-jre-jamvm:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre-zero:6b31-1.13.3-1ubuntu1~0.12.04.2
# - icedtea-6-jre-jamvm:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre-headless:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre-zero:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre-lib:6b31-1.13.3-1ubuntu1~0.12.04.2
#
# Last versions recommanded by security team:
# - icedtea-6-jre-cacao:6b40-1.13.12-0ubuntu0.12.04.2
# - openjdk-6-jre-headless:6b40-1.13.12-0ubuntu0.12.04.2
# - openjdk-6-jre:6b40-1.13.12-0ubuntu0.12.04.2
# - openjdk-6-jre-lib:6b40-1.13.12-0ubuntu0.12.04.2
# - icedtea-6-jre-jamvm:6b40-1.13.12-0ubuntu0.12.04.2
# - openjdk-6-jre-zero:6b31-1.13.3-1ubuntu1~0.12.04.2
# - icedtea-6-jre-jamvm:6b40-1.13.12-0ubuntu0.12.04.2
# - openjdk-6-jre:6b40-1.13.12-0ubuntu0.12.04.2
# - openjdk-6-jre-headless:6b40-1.13.12-0ubuntu0.12.04.2
# - openjdk-6-jre-zero:6b31-1.13.3-1ubuntu1~0.12.04.2
# - openjdk-6-jre-lib:6b40-1.13.12-0ubuntu0.12.04.2
#
# CVE List:
# - CVE-2014-0429
# - CVE-2014-0446
# - CVE-2014-0451
# - CVE-2014-0452
# - CVE-2014-0456
# - CVE-2014-0457
# - CVE-2014-0458
# - CVE-2014-0461
# - CVE-2014-0462
# - CVE-2014-2397
# - CVE-2014-2405
# - CVE-2014-2412
# - CVE-2014-2414
# - CVE-2014-2421
# - CVE-2014-2423
# - CVE-2014-2427
# - CVE-2014-0453
# - CVE-2014-0460
# - CVE-2014-0459
# - CVE-2014-1876
# - CVE-2014-2398
# - CVE-2014-2403
#
# More details:
# - https://www.cyberwatch.fr/vulnerabilites
#
# Licence: Released under The MIT License (MIT), See LICENSE FILE
sudo apt-get install --only-upgrade icedtea-6-jre-cacao=6b40-1.13.12-0ubuntu0.12.04.2 -y
sudo apt-get install --only-upgrade openjdk-6-jre-headless=6b40-1.13.12-0ubuntu0.12.04.2 -y
sudo apt-get install --only-upgrade openjdk-6-jre=6b40-1.13.12-0ubuntu0.12.04.2 -y
sudo apt-get install --only-upgrade openjdk-6-jre-lib=6b40-1.13.12-0ubuntu0.12.04.2 -y
sudo apt-get install --only-upgrade icedtea-6-jre-jamvm=6b40-1.13.12-0ubuntu0.12.04.2 -y
sudo apt-get install --only-upgrade openjdk-6-jre-zero=6b31-1.13.3-1ubuntu1~0.12.04.2 -y
sudo apt-get install --only-upgrade icedtea-6-jre-jamvm=6b40-1.13.12-0ubuntu0.12.04.2 -y
sudo apt-get install --only-upgrade openjdk-6-jre=6b40-1.13.12-0ubuntu0.12.04.2 -y
sudo apt-get install --only-upgrade openjdk-6-jre-headless=6b40-1.13.12-0ubuntu0.12.04.2 -y
sudo apt-get install --only-upgrade openjdk-6-jre-zero=6b31-1.13.3-1ubuntu1~0.12.04.2 -y
sudo apt-get install --only-upgrade openjdk-6-jre-lib=6b40-1.13.12-0ubuntu0.12.04.2 -y
|
Cyberwatch/cbw-security-fixes
|
Ubuntu_12.04_LTS/i386/2014/USN-2191-1.sh
|
Shell
|
mit
| 3,101
|
#!/bin/bash
sudo cp bm_util /usr/bin/bm_util
if [[ $? -ne 0 ]]; then
echo -e "Couldn't copy bm_util to /usr/bin/. Installation failed."
exit 1
fi
cp bm_bash ~/.bm_bash
if [[ $? -ne 0 ]]; then
echo -e "Couldn't copy bm_bash to ~/.bm_bash. Installation failed."
exit 1
fi
grep --quiet "^source ~/.bm_bash" ~/.bashrc;
if [[ $? -ne 0 ]]; then
echo -e "\nsource ~/.bm_bash" >> ~/.bashrc
fi
echo Installation Successful.
echo Please restart the terminal or do "source ~/.bashrc"
|
shrsv/bm
|
install.sh
|
Shell
|
mit
| 499
|
---
title: CodeShip Pro Introduction Guide Part 1
tags:
- docker
- jet
- codeship pro
- introduction
- getting started
- tutorial
- getting started jet
categories:
- Quickstart
- Docker
- Guide
redirect_from:
- /docker-guide/getting-started/
- /pro/getting-started/getting-started/
---
* include a table of contents
{:toc}
{% csnote info %}
In addition to this guide, we've also got [quickstart repos and sample apps]({% link _pro/quickstart/quickstart-examples.md %}) available to make starting out with CodeShip Pro faster and easier.
{% endcsnote %}
The source for the tutorial is available on GitHub at [codeship/ci-guide](https://github.com/codeship/ci-guide/) and you can clone it via
```shell
git clone git@github.com:codeship/ci-guide.git
```
## Getting started with CodeShip Pro (Part 1)
This guide shows you how to use CodeShip Pro to build, test, and deploy your applications. CodeShip Pro uses Docker to define your CI/CD environment and run your build pipeline. We chose Docker because it’s a well-known and documented standard, but your application itself does not need to be “fully Dockerized” to make use of CodeShip Pro’s benefits. As long as you can build containers for your application, CodeShip Pro will let you run a flexible, powerful CI/CD pipeline.
## Setting up continuous integration with CodeShip Pro
### Prerequisites
CodeShip requires that you set up a CodeShip Account and connect to a Source Content Management (SCM). See
Setting up a new CodeShip account guide for more information.
### Installing Jet
CodeShip Pro uses a complimentary command-line tool called Jet to help you encrypt your secrets, as well as to debug and troubleshoot locally for a much faster feedback cycle.
The first thing you want to do is [install the Jet CLI]({% link _pro/jet-cli/installation.md %}) on your local machine. For Mac users, you can do this through [Homebrew](https://brew.sh/) and Linux users can curl the Jet CLI binary directly.
Once Jet is installed, type `jet version` to print the version number on screen. Next, type `jet help` to bring up the help options. Jet is very powerful - from running CI to encrypting your credentials, so take some time to play around with what you see when you run `jet help`.

### Creating a simple application with Ruby Script
Now that we have Jet installed, we're going to take a few minutes and build a simple little "app". This isn't a real app, we're just going to write a little Ruby script and a Dockerfile to use as case studies. We'll expand on them later on.
First, create a file called `check.rb`. In that file we're just going to print our Postgres and Redis versions. If you're wondering how we're printing versions of tools we haven't set up - we'll get there.
In `check.rb`, just write and save the following code:
```ruby
require "redis"
require "pg"
def exit_if_not(expected, current)
puts "Expected: #{expected}"
puts "Current: #{current}"
exit(1) if expected != current
end
puts "Redis"
redis = Redis.new(host: "redis")
puts "REDIS VERSION: #{redis.info["redis_version"]}"
sleep 4
postgres_username = "postgres"
postgres_password = ""
test = PG.connect("postgres", 5432, "", "", "postgres", postgres_username, postgres_password)
puts test.exec("SELECT version();").first["version"]
```
### Creating a Dockerfile for your application and environment
Next we're going to create a Dockerfile. Since CodeShip Pro uses Docker as a standardized domain language, you'll need at least a minimal Dockerfile to get going. If you're already building your application with Docker, this will require very little (if any) adjustment - and if you're not using Docker, creating a basic container to run your application should work just fine.
If you're not familiar with Dockerfiles, and you want to spend a little bit of time getting up to speed on Docker, we highly recommend using these resources as a jumping-off point.
- [Docker's Getting Started Guide](https://docs.docker.com/docker-for-mac/)
- [Docker Documentation](https://docs.docker.com/)
- [The Docker Ecosystem](https://blog.codeship.com/understanding-the-docker-ecosystem/)
Once you're ready to get going, create an empty `Dockerfile` and paste this code into it:
```dockerfile
# base on latest ruby base image
FROM ruby:2.5.0
# install dependencies
RUN apt-get update && apt-get install -y build-essential libpq-dev nodejs apt-utils
# declare /app as working directory of image
WORKDIR /app
# copy over Gemfile and Gemfile.lock to image's working directory, then run `bundle install`
COPY Gemfile Gemfile.lock ./
RUN bundle install --jobs 20 --retry 5
# copy all remaining files/folders in project directory to the container
COPY . /app
```
As you can see here, we're pulling the Ruby base image, creating some directories, installing some gems, and then adding our code. That last bit is important because now when we launch our Docker container, the `check.rb` script we wrote earlier will be inside it and ready to run.
We have also referenced a `Gemfile` that you should go ahead and create as well:
```ruby
# Gemfile
source 'https://rubygems.org'
ruby '2.5.0'
gem 'redis'
gem 'pg'
```
Once saved, run the following Docker command to generate the corresponding `Gemfile.lock`:
```bash
docker run -it --rm -v $(pwd):/app -w /app ruby:2.5.0 bundle lock
```
### Defining your services needed for continuous integration
So, now we have a script, we have a Docker container that includes this script... now what?
Well, we want to orchestrate our app (which means build the Dockerfile we just created), as well as build containers for Postgres and Redis. Remember, the script we wrote prints version numbers for Postgres and Redis, so we're going to need those services to be able to run it.
On CodeShip Pro, you define the services you want to build by creating a `codeship-services.yml` file. This is a simple file that lives in your repo and tells CodeShip what infrastructure and services to use. If you're familiar with Docker Compose, we lean heavily on the syntax and options of a standard Compose file. If you're not familiar with Docker Compose, [you can learn a bit more about it here](https://docs.docker.com/compose/).
One big difference between a standard Compose file and a `codeship-services.yml` file is that a Compose file is typically built to run your application, whereas your `codeship-services.yml` file will also define services you need just for CI/CD as well (such as deployment containers).
So, once you've created a file named `codeship-services.yml` go ahead and add the following code to it:
```yaml
demo:
build:
image: myapp
dockerfile: Dockerfile
depends_on:
- redis
- postgres
redis:
image: healthcheck/redis:alpine
postgres:
image: healthcheck/postgres:alpine
```
The first thing this file does is define our *demo* service. It *builds* the Dockerfile and names it *myapp*. The `depends_on` section tells it what services are required for *demo* to run. In this case both *redis* and *postgres*.
Since we reference *redis* and *postgres*, we need to define them as separate services as well. For each, we provide an image - we could build one using separate Dockerfiles but instead we're going to download existing repos from a Docker registry. This is [Docker Hub](https://hub.docker.com/) by default but it can be *any* registry you specify.
One important thing to know is that any time you build a service, such as *demo*, it will automatically spin up containers for every dependent service. So if we build *demo*, we end up with three containers: one for the primary service, one for Redis and one for Postgres.
Also note that in this configuration example we are using the [healthcheck]({% link _pro/builds-and-configuration/services.md %}#healthcheck) version of our Redis and Postgres images to avoid startup timing issues.

### Defining steps to run in the continuous integration workflow
Next up, we define what steps run in your CI/CD workflow. This is done through another simple .yml file that lives in your repo - `codeship-steps.yml`. This file is nothing but a list of the commands you want to pass to the containers you defined earlier in your `codeship-services.yml` file.
With CodeShip Pro, your containers are the CI/CD environment, meaning every command you run - tests, deployments, scripts - all run _inside_ of the containers you build. This means you have full control of your CI/CD environment because anything you need to do, whether it's use a particular version or orchestrate your production infrastructure, is as simple as defining a container that can accept the commands you need to run.
As one example, if you need to deploy to Heroku then you just need to build a container with the Heroku Toolbelt and then run Heroku deployment commands in your `codeship-steps.yml` file!
Let's take a look at how this works. Go ahead and create this file and add the following code:
```yaml
- name: ruby
service: demo
command: bundle exec ruby check.rb
```
Let's take a look at what's happening. First, there's just one step, and it has a name: *ruby*. This is the name attached to the step in the log output.
The step then launches one of the services defined in your `codeship-services.yml` file - in this case, it's launching the *demo* service. Now, if you remember, because we launched the *demo* service it's also going to launch the two linked services: *redis* and *postgres*.
Next we call a command inside our new *demo* container. We tell it to run the `check.rb` script we created and added to our Dockerfile earlier.

As you'll recall, that script prints the version of *redis* and *postgres* - which it will do by checking the version of the services we launched via the declared dependencies on our original *demo* service.
### Testing and debugging your pipeline locally with Jet
Now - let's see how all of this ties together. Open up a terminal and go to the directory with the files we created.
The first thing we'll do is run `jet validate`. This will instruct `jet` to verify that our files our correct. Once this passes and we know our files our configured without issue, we will run `jet steps`.
This will tell the Jet CLI tool to build the services in your `codeship-services.yml` file and then run the steps in your `codeship-steps.yml` file.
If everything is working, you should see something like this:

And if you scroll through your logs, you should see the versions for *redis* and *postgres* printed just as `check.rb` instructs it to.
### Updating the version in codeship-services.yml
Now we'll take a look at one of the cool benefits of doing all of your CI/CD process with these simple files in your repo.
Open up `codeship-services.yml` and find the line where you define your *redis* service. Change `image: healthcheck/redis:alpine` to `image: redis:3.2.11`.
### Running your new build pipeline locally with Jet
Now switch back to your terminal and run: `jet steps` again.
Looking at the same logs as before, you'll see that now your *redis* service is launching an entirely new version! Changing your CI infrastructure is as simple as changing a few characters in a single file on your repo. This can be done branch by branch, build by build - making upgrading, testing and iteration as easy and risk-free as possible.
## Next: Adding tests
Now that we've covered the basics of how CodeShip Pro uses Jet CLI, `codeship-services.yml`, `codeship-steps.yml` and containers to create a flexible, powerful CI/CD process, we'll move on to explore some more robust examples. Up next, [running your tests.]({% link _pro/quickstart/getting-started-part-two.md %})
|
codeship/documentation
|
_pro/quickstart/getting-started.md
|
Markdown
|
mit
| 12,068
|
import { hash as calculateHash } from '@collectable/core';
import { getHash } from '../internals/primitives';
import { HashMapStructure } from '../internals/HashMap';
import { NOTHING } from '../internals/nodes';
export function has<K, V> (key: K, map: HashMapStructure<K, V>): boolean;
export function has<K, V> (key: K, map: HashMapStructure<K, V>): boolean {
const hash = calculateHash(key);
return getHash(NOTHING, hash, key, map) !== NOTHING;
}
|
frptools/collectable
|
packages/map/src/functions/has.ts
|
TypeScript
|
mit
| 454
|
/*
Licensed under MIT license
(c) 2017 Reeleezee BV
*/
package misc
import (
"crypto/rand"
"fmt"
)
func MaxString(data interface{}, length int) string {
if data != nil {
data := data.(string)
if len(data) > length {
return data[:length]
}
return data
}
return ""
}
// NO REAL UUID!
// Consider a better library:
// https://github.com/satori/go.uuid
// https://github.com/pborman/uuid
func PseudoUuidV4() (uuid string) {
b := make([]byte, 16)
_, err := rand.Read(b)
if err != nil {
panic(err)
}
b[6] = (b[6] & 0x0f) | 0x40 // Version 4
b[8] = (b[8] & 0xbf) | 0x80 // Variant is 10
uuid = fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
return
}
|
reeleezee/reeleezee-api-go
|
misc/string.go
|
GO
|
mit
| 696
|
module.exports = (function () {
var moduleName = 'cut-media-queries';
var lolArrayDiff = function(array1, array2) {
var diff1 = array1.filter(function(elem){
return array2.indexOf(elem) === -1;
});
var diff2 = array2.filter(function(elem){
return array1.indexOf(elem) === -1;
});
return diff1.concat(diff2);
}
return {
/**
* Option's name as it should be used in config.
*/
name: moduleName,
/**
* List of syntaxes that this options supports.
* This depends on Gonzales PE possibilities.
* Currently the following work fine: css, less, sass, scss.
*/
syntax: ['css'],
/**
* List patterns for option's acceptable value.
* You can play with following:
* - boolean: [true, false]
* - string: /^panda$/
* - number: true
*/
accepts: {
string: /.*/
},
/**
* If `accepts` is not enough for you, replace it with custom `setValue`
* function.
*
* @param {Object} value Value that a user sets in configuration
* @return {Object} Value that you would like to use in `process` method
*
* setValue: function(value) {
* // Do something with initial value.
* var final = value * 4;
*
* // Return final value you will use in `process` method.
* return final;
* },
*/
/**
* Fun part.
* Do something with AST.
* For example, replace all comments with flipping tables.
*
* @param {String} nodeType Type of current node
* @param {Array} node Node's content
*/
process: function (nodeType, node) {
if (nodeType === 'stylesheet') {
var length = node.length;
var options = this.getValue(moduleName).split(',');
while (length--) {
if (node[length][0] == 'atruler') {
var removeNode = false;
//Gather media query info
node[length].forEach(function (innerNode) {
if (removeNode == true) return;
if (innerNode[0] == 'atrulerq') {
var queries = [];
innerNode.forEach(function (query) {
if (query[0] == 'braces') {
var ident = query.filter(function (elem) {
return elem[0] == 'ident';
});
var dimensions = query.filter(function (elem) {
return elem[0] == 'dimension';
});
if (ident.length != 0) {
queries.push(ident[0][1] + ":" + dimensions[0][1][1] + dimensions[0][2][1]);
}
}
});
if (lolArrayDiff(queries, options).length == 0) {
removeNode = true;
}
}
});
if (removeNode) {
node.splice(length, 1);
}
}
}
}
}
};
})();
|
iVariable/csscomb-cut-media-queries
|
options/cut-media-queries.js
|
JavaScript
|
mit
| 2,636
|
<?php
/**
* Copyright (c) 2017 - 2019 - Bas Milius <bas@mili.us>
*
* This file is part of the Cappuccino package.
*
* For the full copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Cappuccino\Loader;
use Cappuccino\Error\LoaderError;
use Cappuccino\Source;
use function get_class;
use function implode;
use function sprintf;
/**
* Class ChainLoader
*
* @author Bas Milius <bas@mili.us>
* @package Cappuccino\Loader
* @since 1.0.0
*/
final class ChainLoader implements LoaderInterface
{
/**
* @var bool[]
*/
private $hasSourceCache = [];
/**
* @var LoaderInterface[]
*/
private $loaders = [];
/**
* ChainLoader constructor.
*
* @param array $loaders
*
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public function __construct(array $loaders = [])
{
foreach ($loaders as $loader)
$this->addLoader($loader);
}
/**
* Adds a new loader.
*
* @param LoaderInterface $loader
*
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public function addLoader(LoaderInterface $loader): void
{
$this->loaders[] = $loader;
$this->hasSourceCache = [];
}
/**
* Gets all loaders attached to this chain.
*
* @return LoaderInterface[]
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public function getLoaders(): array
{
return $this->loaders;
}
/**
* {@inheritdoc}
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public function getSourceContext(string $name): Source
{
$exceptions = [];
foreach ($this->loaders as $loader)
{
if (!$loader->exists($name))
continue;
try
{
return $loader->getSourceContext($name);
}
catch (LoaderError $e)
{
$exceptions[] = $e->getMessage();
}
}
throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . implode(', ', $exceptions) . ')' : ''));
}
/**
* {@inheritdoc}
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public function exists(string $name): bool
{
if (isset($this->hasSourceCache[$name]))
return $this->hasSourceCache[$name];
foreach ($this->loaders as $loader)
if ($loader->exists($name))
return $this->hasSourceCache[$name] = true;
return $this->hasSourceCache[$name] = false;
}
/**
* {@inheritdoc}
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public function getCacheKey(string $name): string
{
$exceptions = [];
foreach ($this->loaders as $loader)
{
if (!$loader->exists($name))
continue;
try
{
return $loader->getCacheKey($name);
}
catch (LoaderError $e)
{
$exceptions[] = get_class($loader) . ': ' . $e->getMessage();
}
}
throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . implode(', ', $exceptions) . ')' : ''));
}
/**
* {@inheritdoc}
* @author Bas Milius <bas@mili.us>
* @since 1.0.0
*/
public function isFresh(string $name, int $time): bool
{
$exceptions = [];
foreach ($this->loaders as $loader)
{
if (!$loader->exists($name))
continue;
try
{
return $loader->isFresh($name, $time);
}
catch (LoaderError $e)
{
$exceptions[] = get_class($loader) . ': ' . $e->getMessage();
}
}
throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . implode(', ', $exceptions) . ')' : ''));
}
}
|
basmilius/Cappuccino
|
src/Cappuccino/Loader/ChainLoader.php
|
PHP
|
mit
| 3,459
|
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>
import os
import ycm_core
from sys import platform as _platform
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++0x',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c++',
'-I./',
'-I../common/',
]
# Xcode for std stuff on OS X
if _platform == "darwin":
flags.append('-isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1')
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
if os.path.exists( compilation_database_folder ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )
def FlagsForFile( filename, **kwargs ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile( filename )
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
return {
'flags': final_flags,
'do_cache': True
}
|
astrellon/cotsb
|
server/.ycm_extra_conf.py
|
Python
|
mit
| 5,739
|
using System;
using System.Collections.Generic;
using System.Linq;
using SMLimitless.Interfaces;
using SMLimitless.Physics;
namespace SMLimitless.Extensions
{
/// <summary>
/// Contains extension methods for types implementing the <see
/// cref="IPositionable2" /> interface.
/// </summary>
public static class PositionableExtensions
{
/// <summary>
/// Returns a rectangle that can contain all the given positionables in
/// an enumerable.
/// </summary>
/// <param name="positionables">The enumerable containing the positionables.</param>
/// <returns></returns>
public static BoundingRectangle GetBoundsOfPositionables(this IEnumerable<IPositionable2> positionables)
{
if (!positionables.Any()) { return BoundingRectangle.NaN; }
// so there's really no elegant initial value for result, except the
// bounds of First()...
var first = positionables.First();
BoundingRectangle result = new BoundingRectangle(first.Position, first.Size + first.Position);
foreach (var positionable in positionables.Skip(1)) // ...so we need to treat it specially
{
BoundingRectangle bounds = new BoundingRectangle(positionable.Position, positionable.Size + positionable.Position);
if (bounds.Left < result.Left)
{
result.Width += (bounds.X + result.X);
result.X = bounds.X;
}
else if (bounds.Right > result.Right)
{
result.Width = (bounds.X + bounds.Width);
}
if (bounds.Top < result.Top)
{
result.Height = (bounds.Y + result.Y);
result.Y = bounds.Y;
}
else if (bounds.Bottom > result.Bottom)
{
result.Height = (bounds.Y + bounds.Height);
}
}
return result;
}
}
}
|
smldev/smlimitless
|
MonoGame/SMLimitless/SMLimitless/Extensions/PositionableExtensions.cs
|
C#
|
mit
| 1,698
|
package com.group.cms.core.dao;
import java.io.Serializable;
import java.util.List;
public interface BaseDao<T, ID extends Serializable> {
/**
* insert
* @param entity
* @return 插入的行数
*/
int insert(T entity);
/**
* update
* @param entity
* @return 修改的行数
*/
int update(T entity);
/**
* delete
* @param id
* @return 删除的行数
*/
int delete(ID id);
/**
*
* @param name
* @param operator
* @param value
* @return
*/
int deleteBy(String name, String operator, String value);
/**
* select
* @param id
* @return
*/
T select(ID id);
/**
*
* @param name
* @param operator
* @param value
* @return
*/
List<T> findBy(String name, String operator, String value);
}
|
iyujian/cms
|
cms-core/src/main/java/com/group/cms/core/dao/BaseDao.java
|
Java
|
mit
| 762
|
package xyz.gsora.toot;
import MastodonTypes.Status;
import android.app.IntentService;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import retrofit2.Response;
import xyz.gsora.toot.Mastodon.Mastodon;
import java.util.ArrayList;
import java.util.Random;
import static xyz.gsora.toot.Timeline.TIMELINE_MAIN;
/**
* An {@link IntentService} subclass for handling asynchronous toot sending.
* <p>
*/
@SuppressWarnings("WeakerAccess")
public class PostStatus extends IntentService {
public static final String STATUS = "xyz.gsora.toot.extra.status";
public static final String REPLYID = "xyz.gsora.toot.extra.replyid";
public static final String MEDIAIDS = "xyz.gsora.toot.extra.mediaids";
public static final String SENSITIVE = "xyz.gsora.toot.extra.sensitive";
public static final String SPOILERTEXT = "xyz.gsora.toot.extra.spoilertext";
public static final String VISIBILITY = "xyz.gsora.toot.extra.visibility";
private static final String TAG = PostStatus.class.getSimpleName();
private Realm realm;
private NotificationManager nM;
private int notificationId;
public PostStatus() {
super("PostStatus");
}
@Override
protected void onHandleIntent(Intent intent) {
Mastodon m = Mastodon.getInstance();
realm = Realm.getInstance(new RealmConfiguration.Builder().name(TIMELINE_MAIN).build());
nM = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Random r = new Random();
notificationId = r.nextInt();
if (intent != null) {
final String status = intent.getStringExtra(STATUS);
final String replyid = intent.getStringExtra(REPLYID);
final ArrayList<String> mediaids = intent.getStringArrayListExtra(MEDIAIDS);
final Boolean sensitive = intent.getBooleanExtra(SENSITIVE, false);
final String spoilertext = intent.getStringExtra(SPOILERTEXT);
final Integer visibility = intent.getIntExtra(VISIBILITY, 0);
Mastodon.StatusVisibility trueVisibility = Mastodon.StatusVisibility.PUBLIC;
switch (visibility) {
case 0:
trueVisibility = Mastodon.StatusVisibility.PUBLIC;
break;
case 1:
trueVisibility = Mastodon.StatusVisibility.DIRECT;
break;
case 2:
trueVisibility = Mastodon.StatusVisibility.UNLISTED;
break;
case 3:
trueVisibility = Mastodon.StatusVisibility.PRIVATE;
break;
}
// create a new "toot sending" notification
NotificationCompat.Builder mBuilder = buildNotification(
"Sending toot",
null,
true
);
nM.notify(notificationId, mBuilder.build());
Observable<Response<Status>> post = m.postPublicStatus(status, replyid, mediaids, sensitive, spoilertext, trueVisibility);
post
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(
this::postSuccessful,
this::postError
);
}
}
private void postSuccessful(Response<Status> response) {
Log.d(TAG, "postSuccessful: post ok!");
// toot sent, remove notification
nM.cancel(notificationId);
}
private void postError(Throwable error) {
Log.d(TAG, "postError: post error! --> " + error.toString());
// cancel "sending" notification id
nM.cancel(notificationId);
// create a new "error" informative notification
NotificationCompat.Builder mBuilder = buildNotification(
"Failed to send toot",
"We had some problems sending your toot, check your internet connection, or maybe the Mastodon instance you're using could be down.",
false
);
nM.notify(notificationId + 1, mBuilder.build());
}
/**
* Builds a {@link NotificationCompat.Builder} with some predefined properties
*
* @param title notification title
* @param text notification body, can be null
* @param hasUndefinedProgress declare if the notification have to contain an undefined progressbar
* @return a {@link NotificationCompat.Builder} with the properties passed as parameter.
*/
private NotificationCompat.Builder buildNotification(String title, String text, Boolean hasUndefinedProgress) {
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
mBuilder.setContentTitle(title);
NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle();
if (text != null) {
style.bigText(text);
}
mBuilder.setStyle(style);
mBuilder.setSmallIcon(R.drawable.ic_reply_white_24dp);
if (hasUndefinedProgress) {
mBuilder.setProgress(0, 0, true);
}
return mBuilder;
}
}
|
gsora/TootApp
|
app/src/main/java/xyz/gsora/toot/PostStatus.java
|
Java
|
mit
| 5,531
|
// Dependencies
const {types} = require('focus').component;
// Components
const ContextualActions = require('../action-contextual').component;
const CheckBox = require('../../common/input/checkbox').component;
// Mixins
const translationMixin = require('../../common/i18n').mixin;
const referenceMixin = require('../../common/mixin/reference-property');
const definitionMixin = require('../../common/mixin/definition');
const builtInComponentsMixin = require('../mixin/built-in-components');
const lineMixin = {
/**
* React component name.
*/
displayName: 'ListLine',
/**
* Mixin dependancies.
*/
mixins: [translationMixin, definitionMixin, referenceMixin, builtInComponentsMixin],
/**
* Get default props
* @return {object} default props
*/
getDefaultProps(){
return {
isSelection: true,
operationList: []
};
},
/**
* line property validation.
* @type {Object}
*/
propTypes: {
data: types('object'),
isSelected: types('bool'),
isSelection: types('bool'),
onLineClick: types('func'),
onSelection: types('func'),
operationList: types('array')
},
/**
* State initialization.
* @return {object} initial state
*/
getInitialState() {
return {
isSelected: this.props.isSelected || false
};
},
/**
* Component will receive props
* @param {object} nextProps new component's props
*/
componentWillReceiveProps({isSelected}) {
if (isSelected !== undefined) {
this.setState({isSelected});
}
},
/**
* Get the line value.
* @return {object} the line value
*/
getValue() {
const {data: item, isSelected} = this.props;
return {item, isSelected};
},
/**
* Selection Click handler.
*/
_handleSelectionClick() {
const isSelected = !this.state.isSelected;
const {data, onSelection} = this.props;
this.setState({isSelected});
if(onSelection){
onSelection(data, isSelected);
}
},
/**
* Line Click handler.
*/
_handleLineClick() {
const {data, onLineClick} = this.props;
if(onLineClick){
onLineClick(data);
}
},
/**
* Render the left box for selection
* @return {XML} the rendered selection box
*/
_renderSelectionBox() {
const {isSelection} = this.props;
const {isSelected} = this.state;
if (isSelection) {
const selectionClass = isSelected ? 'selected' : 'no-selection';
//const image = this.state.isSelected? undefined : <img src={this.state.lineItem[this.props.iconfield]}/>
return (
<div className={`sl-selection ${selectionClass}`}>
<CheckBox onChange={this._handleSelectionClick} value={isSelected}/>
</div>
);
}
return null;
},
/**
* render content for a line.
* @return {XML} the rendered line content
*/
_renderLineContent() {
const {data} = this.props;
const {title, body} = data;
if (this.renderLineContent) {
return this.renderLineContent(data);
} else {
return (
<div>
<div>{title}</div>
<div>{body}</div>
</div>
);
}
},
/**
* Render actions which can be applied on the line
* @return {XML} the rendered actions
*/
_renderActions() {
const props = {operationParam: this.props.data, ...this.props};
if (0 < props.operationList.length) {
return (
<div className='sl-actions'>
<ContextualActions {...props}/>
</div>
);
}
},
/**
* Render line in list.
* @return {XML} the rendered line
*/
render() {
if(this.renderLine){
return this.renderLine();
} else {
return (
<li data-focus='sl-line'>
{this._renderSelectionBox()}
<div className='sl-content' onClick={this._handleLineClick}>
{this._renderLineContent()}
</div>
{this._renderActions()}
</li>
);
}
}
};
module.exports = {mixin: lineMixin};
|
JRLK/focus-components
|
src/list/selection/line.js
|
JavaScript
|
mit
| 4,528
|
//
// PLKYoutubeServiceTest.h
// PluckDemo
//
// Created by Zach Waugh on 2/16/13.
// Copyright (c) 2013 Zach Waugh. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@interface PLKYoutubeServiceTest : SenTestCase
- (void)testIsSupportedURL;
- (void)testItemFromDictionary;
#if TEST_LIVE
- (void)testLiveItemForURL;
#endif
@end
|
zachwaugh/pluck
|
PluckTests/PLKYoutubeServiceTest.h
|
C
|
mit
| 351
|
package net.loomchild.maligna.filter.aligner.align;
import static net.loomchild.maligna.util.TestUtil.assertAlignmentEquals;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.loomchild.maligna.coretypes.Alignment;
import org.junit.Test;
/**
* Represents {@link AlignAlgorithmMock} unit test.
* @author loomchild
*/
public class AlignAlgorithmMockTest {
/**
* Checks if aligning empty lists returns empty list.
*/
@Test
public void alignEmpty() {
AlignAlgorithm aligner = new AlignAlgorithmMock(2);
List<String> segmentList = Collections.emptyList();
List<Alignment> alignmentList = aligner.align(segmentList, segmentList);
assertEquals(0, alignmentList.size());
}
/**
* Checks whether mock aligner works as described.
*/
@Test
public void align() {
AlignAlgorithm aligner = new AlignAlgorithmMock(2);
String[][] sourceArray = new String[][]{
new String[]{"a", "b"}, new String[]{"c","d"},
new String[]{"e", "f"}
};
String[][] targetArray = new String[][]{
new String[]{"1", "2"}, new String[]{"3"}, new String[]{}
};
assert sourceArray.length == targetArray.length;
int alignmentCount = sourceArray.length;
List<String> sourceList = combine(sourceArray);
List<String> targetList = combine(targetArray);
List<Alignment> alignmentList = aligner.align(sourceList, targetList);
assertEquals(alignmentCount, alignmentList.size());
for (int i = 0; i < alignmentCount; ++i) {
assertAlignmentEquals(sourceArray[i], targetArray[i],
alignmentList.get(i));
}
}
/**
* Creates a list of strings containing all strings from input
* two dimensional array.
* @param array array
* @return list
*/
private List<String> combine(String[][] array) {
List<String> list = new ArrayList<String>();
for (String[] group : array) {
for (String element : group) {
list.add(element);
}
}
return list;
}
}
|
loomchild/maligna
|
maligna/src/test/java/net/loomchild/maligna/filter/aligner/align/AlignAlgorithmMockTest.java
|
Java
|
mit
| 1,986
|
#include <xpcc/architecture.hpp>
#include <xpcc/communication.hpp>
#include <xpcc/communication/backend/tipc/tipc.hpp>
#include <xpcc/debug/logger.hpp>
// set new log level
#undef XPCC_LOG_LEVEL
#define XPCC_LOG_LEVEL xpcc::log::DEBUG
#include "component_receiver/receiver.hpp"
#include "component_sender/sender.hpp"
#include "communication/postman.hpp"
#include "communication/identifier.hpp"
xpcc::TipcConnector connector;
// create an instance of the generated postman
Postman postman;
xpcc::Dispatcher dispatcher(&connector, &postman);
namespace component
{
Sender sender(robot::component::SENDER, &dispatcher);
Receiver receiver(robot::component::RECEIVER, &dispatcher);
}
int
main(void)
{
connector.addReceiverId(robot::component::SENDER);
connector.addReceiverId(robot::component::RECEIVER);
XPCC_LOG_INFO << "Welcome to the communication test!" << xpcc::endl;
while (1)
{
// deliver received messages
dispatcher.update();
component::receiver.update();
component::sender.update();
xpcc::delay_us(100);
}
}
|
jrahlf/3D-Non-Contact-Laser-Profilometer
|
xpcc/examples/linux/communication/basic/main.cpp
|
C++
|
mit
| 1,053
|
#ifndef STANDARD_ERROR_H
#define STANDARD_ERROR_H
/* calc_standard_error(double[], uint32_t)
* calculate standard error of data.
* arg1: data
* arg2: number of elemet in data */
double calc_standard_error(double data[], uint32_t element_num);
/* calc_dispersion(double[], uint32_t)
* calcuate dispersion of data.
* arg1: data
* arg2: number of elemet in data */
double calc_dispersion(double data[], uint32_t element_num);
/* calc_average(double[], uint32_t)
* calcuate average of data.
* arg1: data
* arg2: number of elemet in data */
double calc_average(double data[], uint32_t element_num);
#endif /* STANDARD_ERROR_H */
|
mkaminaga/programparts
|
learn_c/lib/standard_error.h
|
C
|
mit
| 659
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_06) on Sat Dec 12 16:17:56 CET 2009 -->
<TITLE>
Decamelizer (Mockito API)
</TITLE>
<META NAME="date" CONTENT="2009-12-12">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Decamelizer (Mockito API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Decamelizer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/mockito/internal/util/CreationValidator.html" title="class in org.mockito.internal.util"><B>PREV CLASS</B></A>
<A HREF="../../../../org/mockito/internal/util/ListUtil.html" title="class in org.mockito.internal.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/mockito/internal/util/Decamelizer.html" target="_top"><B>FRAMES</B></A>
<A HREF="Decamelizer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.mockito.internal.util</FONT>
<BR>
Class Decamelizer</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.mockito.internal.util.Decamelizer</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Decamelizer</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/mockito/internal/util/Decamelizer.html#Decamelizer()">Decamelizer</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mockito/internal/util/Decamelizer.html#decamelizeMatcher(java.lang.String)">decamelizeMatcher</A></B>(java.lang.String className)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Decamelizer()"><!-- --></A><H3>
Decamelizer</H3>
<PRE>
public <B>Decamelizer</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="decamelizeMatcher(java.lang.String)"><!-- --></A><H3>
decamelizeMatcher</H3>
<PRE>
public static java.lang.String <B>decamelizeMatcher</B>(java.lang.String className)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Decamelizer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/mockito/internal/util/CreationValidator.html" title="class in org.mockito.internal.util"><B>PREV CLASS</B></A>
<A HREF="../../../../org/mockito/internal/util/ListUtil.html" title="class in org.mockito.internal.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/mockito/internal/util/Decamelizer.html" target="_top"><B>FRAMES</B></A>
<A HREF="Decamelizer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
|
tobyclemson/msci-project
|
vendor/mockito-1.8.2/doc/org/mockito/internal/util/Decamelizer.html
|
HTML
|
mit
| 10,177
|
class AddUserIdToFriends < ActiveRecord::Migration
def change
add_column :friends, :user_id, :integer
end
end
|
suntorytime/project_mate2
|
db/migrate/20160422230113_add_user_id_to_friends.rb
|
Ruby
|
mit
| 118
|
'use strict';
var assert = require('assert');
var extraStep = require('../../../lib/tasks/extra-step');
var MockUI = require('../../helpers/mock-ui');
describe('Extra Step', function() {
var ui;
var dummySteps = [
{ command: 'echo "command number 1"' },
{ command: 'echo "command number 2"' },
{ command: 'echo "command number 3"' }
];
var dummyCommands = [
'echo "command number 1"',
'echo "command number 2"',
'echo "command number 3"'
];
var failingStep = [ { command: 'exit 1', fail: true } ];
var nonFailingStep = [ { command: 'exit 1', fail: false } ];
var singleFailingStep = [ nonFailingStep[0], failingStep[0], nonFailingStep[0] ];
var dummyOptions = {
foo: 'bar',
truthy: true,
falsy: false,
someOption: 'i am a string',
num: 24
};
var dummyStepsWithOptions = [
{
command: 'echo "command number 4"',
includeOptions: ['foo', 'falsy', 'num']
},
{
command: 'echo "command number 5"',
includeOptions: ['truthy', 'someOption', 'nonExistent']
}
];
var dummyCommandsWithOptions = [
"echo \"command number 4\" --foo bar --num 24",
"echo \"command number 5\" --truthy --some-option 'i am a string'",
];
beforeEach(function() {
ui = new MockUI;
});
it('Runs an array of commands passed to it', function() {
return extraStep(dummySteps, dummyOptions, ui).then(function(result) {
assert.deepEqual(result, dummyCommands, 'Correct commands were run.');
}, function(error) {
assert.ok(false, 'An error occurred');
});
});
it('The proper commands are built and run', function() {
return extraStep(dummyStepsWithOptions, dummyOptions, ui).then(function(result) {
assert.deepEqual(result, dummyCommandsWithOptions, 'Correct commands were built and run.');
}, function(error) {
assert.ok(false, 'An error occurred');
});
});
it('Fail-safe command, with non 0 exit code, returns rejected promise', function() {
return extraStep(failingStep, null, ui).then(function(result) {
assert.ok(false, 'steps should have failed.');
}, function(err) {
assert.ok(true, 'steps failed as expected.');
});
});
it('Fail-friendly command, with non 0 exit code, returns resolved promise', function() {
return extraStep(nonFailingStep, null, ui).then(function(result) {
assert.ok(true, 'steps kept running after failed command, as expected.');
}, function(err) {
assert.ok(false, 'Steps did not continue running as expected');
});
});
});
|
AReallyGoodName/ember-cli-s3-sync-index-last-no-cache
|
tests/unit/tasks/extra-step-test.js
|
JavaScript
|
mit
| 2,577
|
/* --------------------------------
Primary style
-------------------------------- */
*, *::after, *::before {
box-sizing: border-box;
}
html {
font-size: 62.5%;
}
body {
font-size: 1.6rem;
font-family: "PT Sans", sans-serif;
color: #585c5e;
background-color: #f5f5f5;
}
a {
color: #f82f53;
text-decoration: none;
}
img {
max-width: 100%;
}
/* --------------------------------
Patterns - reusable parts of our design
-------------------------------- */
.sb1-btn {
display: inline-block;
padding: 1.4em 2em;
border-radius: 50em;
background-color: #fff;
box-shadow: 0 1px 20px rgba(238, 187, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
color: #69aa6f;
font-size: 1.3rem;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
-webkit-transition: box-shadow 0.2s;
-moz-transition: box-shadow 0.2s;
transition: box-shadow 0.2s;
}
.no-touch .sb1-btn:hover {
box-shadow: 0 1px 30px rgba(238, 187, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.sb1-img-replace {
/* replace text with image */
color: transparent;
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
}
/* --------------------------------
Intro page
-------------------------------- */
.sb1-intro-block {
position: relative;
z-index: 7;
height: 100vh;
width: 100%;
background-color: #f5f5f5;
/* used to vertical align its content */
display: table;
-webkit-transition: -webkit-transform 0.5s;
-moz-transition: -moz-transform 0.5s;
transition: transform 0.5s;
-webkit-transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
-moz-transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
}
.sb1-intro-block::after {
/* arrow icon visible when .sb1-intro-block slides out */
content: '';
position: absolute;
left: 50%;
top: 50%;
bottom: auto;
right: auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
-o-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
top: 98%;
height: 24px;
width: 24px;
background: url(../img/sb1-arrow-back.svg) no-repeat center center;
z-index: 7;
opacity: 0;
-webkit-transition: opacity 0.2s;
-moz-transition: opacity 0.2s;
transition: opacity 0.2s;
}
.sb1-intro-block .content-wrapper {
/* vertical align the .sb1-intro-block content */
display: table-cell;
vertical-align: middle;
text-align: center;
}
.sb1-intro-block h1 {
width: 90%;
margin: 0 auto .6em;
font-size: 2.4rem;
color: #f5f5f5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.sb1-intro-block.projects-visible {
/* translate the .sb1-intro-block element to reveal the projects slider */
-webkit-transform: translateY(-90%);
-moz-transform: translateY(-90%);
-ms-transform: translateY(-90%);
-o-transform: translateY(-90%);
transform: translateY(-90%);
box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6);
cursor: pointer;
}
.sb1-intro-block.projects-visible:after {
/* show arrow icon */
opacity: 1;
}
@media only screen and (min-width: 900px) {
.sb1-intro-block::after {
top: 99%;
}
.sb1-intro-block h1 {
font-size: 4.4rem;
font-weight: 300;
}
.sb1-intro-block.projects-visible {
-webkit-transform: translateY(-95%);
-moz-transform: translateY(-95%);
-ms-transform: translateY(-95%);
-o-transform: translateY(-95%);
transform: translateY(-95%);
}
}
/* --------------------------------
Projects Slider
-------------------------------- */
.sb1-projects-wrapper {
position: fixed;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100vh;
visibility: hidden;
background-color: #69aa6f;
-webkit-transition: visibility 0s 0.5s;
-moz-transition: visibility 0s 0.5s;
transition: visibility 0s 0.5s;
}
.sb1-projects-wrapper::before {
/* never visible - this is used in jQuery to check the current MQ */
content: 'mobile';
display: none;
}
.sb1-projects-wrapper.projects-visible {
visibility: visible;
-webkit-transition: visibility 0s 0s;
-moz-transition: visibility 0s 0s;
transition: visibility 0s 0s;
}
@media only screen and (min-width: 900px) {
.sb1-projects-wrapper::before {
/* never visible - this is used in jQuery to check the current MQ */
content: 'desktop';
}
}
.sb1-slider {
padding-top: 10vh;
height: 100%;
overflow-y: auto;
}
.projects-visible .sb1-slider {
/* smooth scrolling on iOS */
-webkit-overflow-scrolling: touch;
}
.sb1-slider li {
margin: 4%;
opacity: 0;
border-radius: .25em;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
-webkit-transition: opacity 0s 0.5s;
-moz-transition: opacity 0s 0.5s;
transition: opacity 0s 0.5s;
/* Force hardware acceleration */
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
-o-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.sb1-slider li.slides-in {
-webkit-transition: opacity 0s 0s;
-moz-transition: opacity 0s 0s;
transition: opacity 0s 0s;
opacity: 1;
-webkit-animation: sb1-translate 0.5s;
-moz-animation: sb1-translate 0.5s;
animation: sb1-translate 0.5s;
}
.sb1-slider a {
display: block;
height: 100%;
width: 100%;
}
.sb1-slider img {
display: block;
border-radius: .25em .25em 0 0;
width: 100%;
}
.sb1-slider .project-info {
padding: 1em 1.6em;
background-color: #f5f5f5;
border-radius: 0 0 .25em .25em;
}
.sb1-slider h2 {
font-size: 2.5rem;
font-weight: bold;
line-height: 1.2;
}
.sb1-slider p {
font-size: 1.4rem;
opacity: .6;
padding: .4em 0;
/* truncate text with ellipsis if too long */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.sb1-slider h2, .sb1-slider p {
line-height: 1.2;
color: #585c5e;
}
@media only screen and (min-width: 900px) {
.sb1-slider {
padding: 0;
overflow: hidden;
-webkit-transition: -webkit-transform 0.5s;
-moz-transition: -moz-transform 0.5s;
transition: transform 0.5s;
/* Force hardware acceleration */
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
-o-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.sb1-slider::after {
clear: both;
content: "";
display: table;
}
.sb1-slider li {
position: relative;
float: left;
width: 26vw;
margin: 0 0 0 2vw;
top: 50vh;
-webkit-transform: translateX(400%) translateY(-50%) rotate(-10deg);
-moz-transform: translateX(400%) translateY(-50%) rotate(-10deg);
-ms-transform: translateX(400%) translateY(-50%) rotate(-10deg);
-o-transform: translateX(400%) translateY(-50%) rotate(-10deg);
transform: translateX(400%) translateY(-50%) rotate(-10deg);
-webkit-transition: opacity 0s 0.3s, -webkit-transform 0s 0.3s;
-moz-transition: opacity 0s 0.3s, -moz-transform 0s 0.3s;
transition: opacity 0s 0.3s, transform 0s 0.3s;
}
.sb1-slider li:first-of-type {
margin-left: 9vw;
}
.sb1-slider li.slides-in {
/* this class is used to trigger the entrance animation */
-webkit-animation: none;
-moz-animation: none;
animation: none;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
.sb1-slider li.slides-in:first-of-type {
/* change transition duration/delay for the entrance animation */
-webkit-transition: -webkit-transform 0.55s 0s;
-moz-transition: -moz-transform 0.55s 0s;
transition: transform 0.55s 0s;
}
.sb1-slider li.slides-in:nth-of-type(2) {
-webkit-transition: -webkit-transform 0.53s 0.05s;
-moz-transition: -moz-transform 0.53s 0.05s;
transition: transform 0.53s 0.05s;
}
.sb1-slider li.slides-in:nth-of-type(3) {
-webkit-transition: -webkit-transform 0.5s 0.1s;
-moz-transition: -moz-transform 0.5s 0.1s;
transition: transform 0.5s 0.1s;
}
.sb1-slider li.slides-in:nth-of-type(4) {
-webkit-transition: -webkit-transform 0.48s 0.15s;
-moz-transition: -moz-transform 0.48s 0.15s;
transition: transform 0.48s 0.15s;
}
.sb1-slider.next li.current {
/* next slide animation */
-webkit-animation: sb1-slide-1 0.5s;
-moz-animation: sb1-slide-1 0.5s;
animation: sb1-slide-1 0.5s;
}
.sb1-slider.next li.current + li {
-webkit-animation: sb1-slide-2 0.5s;
-moz-animation: sb1-slide-2 0.5s;
animation: sb1-slide-2 0.5s;
}
.sb1-slider.next li.current + li + li {
-webkit-animation: sb1-slide-3 0.5s;
-moz-animation: sb1-slide-3 0.5s;
animation: sb1-slide-3 0.5s;
}
.sb1-slider.next li.current + li + li + li + li {
-webkit-animation: sb1-slide-4 0.5s;
-moz-animation: sb1-slide-4 0.5s;
animation: sb1-slide-4 0.5s;
}
.sb1-slider.next li.current + li + li + li + li + li {
-webkit-animation: sb1-slide-5 0.5s;
-moz-animation: sb1-slide-5 0.5s;
animation: sb1-slide-5 0.5s;
}
.sb1-slider.next li.current + li + li + li + li + li ~ li {
-webkit-animation: sb1-slide-6 0.5s;
-moz-animation: sb1-slide-6 0.5s;
animation: sb1-slide-6 0.5s;
}
.sb1-slider.prev li {
/* previous slide animation */
-webkit-animation: sb1-slide-7 0.5s;
-moz-animation: sb1-slide-7 0.5s;
animation: sb1-slide-7 0.5s;
}
.sb1-slider.prev li.previous {
/* previous slide animation - the previous class is used to target the slide which was visible right before the current one */
-webkit-animation: sb1-slide-1 0.5s;
-moz-animation: sb1-slide-1 0.5s;
animation: sb1-slide-1 0.5s;
}
.sb1-slider.prev li.previous + li {
-webkit-animation: sb1-slide-2 0.5s;
-moz-animation: sb1-slide-2 0.5s;
animation: sb1-slide-2 0.5s;
}
.sb1-slider.prev li.previous + li + li {
-webkit-animation: sb1-slide-3 0.5s;
-moz-animation: sb1-slide-3 0.5s;
animation: sb1-slide-3 0.5s;
}
.sb1-slider.prev li.current + li {
-webkit-animation: sb1-slide-4 0.5s;
-moz-animation: sb1-slide-4 0.5s;
animation: sb1-slide-4 0.5s;
}
.sb1-slider.prev li.current + li + li {
-webkit-animation: sb1-slide-5 0.5s;
-moz-animation: sb1-slide-5 0.5s;
animation: sb1-slide-5 0.5s;
}
.sb1-slider.prev li.current, .sb1-slider.prev li.current + li + li ~ li {
-webkit-animation: none;
-moz-animation: none;
animation: none;
}
}
@-webkit-keyframes sb1-slide-1 {
0%, 100% {
-webkit-transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(-85%);
}
}
@-moz-keyframes sb1-slide-1 {
0%, 100% {
-moz-transform: translateY(-50%);
}
50% {
-moz-transform: translateY(-50%) translateX(-85%);
}
}
@keyframes sb1-slide-1 {
0%, 100% {
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(-85%);
-moz-transform: translateY(-50%) translateX(-85%);
-ms-transform: translateY(-50%) translateX(-85%);
-o-transform: translateY(-50%) translateX(-85%);
transform: translateY(-50%) translateX(-85%);
}
}
@-webkit-keyframes sb1-slide-2 {
0%, 100% {
-webkit-transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(-55%);
}
}
@-moz-keyframes sb1-slide-2 {
0%, 100% {
-moz-transform: translateY(-50%);
}
50% {
-moz-transform: translateY(-50%) translateX(-55%);
}
}
@keyframes sb1-slide-2 {
0%, 100% {
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(-55%);
-moz-transform: translateY(-50%) translateX(-55%);
-ms-transform: translateY(-50%) translateX(-55%);
-o-transform: translateY(-50%) translateX(-55%);
transform: translateY(-50%) translateX(-55%);
}
}
@-webkit-keyframes sb1-slide-3 {
0%, 100% {
-webkit-transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(-23%);
}
}
@-moz-keyframes sb1-slide-3 {
0%, 100% {
-moz-transform: translateY(-50%);
}
50% {
-moz-transform: translateY(-50%) translateX(-23%);
}
}
@keyframes sb1-slide-3 {
0%, 100% {
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(-23%);
-moz-transform: translateY(-50%) translateX(-23%);
-ms-transform: translateY(-50%) translateX(-23%);
-o-transform: translateY(-50%) translateX(-23%);
transform: translateY(-50%) translateX(-23%);
}
}
@-webkit-keyframes sb1-slide-4 {
0%, 100% {
-webkit-transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(23%);
}
}
@-moz-keyframes sb1-slide-4 {
0%, 100% {
-moz-transform: translateY(-50%);
}
50% {
-moz-transform: translateY(-50%) translateX(23%);
}
}
@keyframes sb1-slide-4 {
0%, 100% {
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(23%);
-moz-transform: translateY(-50%) translateX(23%);
-ms-transform: translateY(-50%) translateX(23%);
-o-transform: translateY(-50%) translateX(23%);
transform: translateY(-50%) translateX(23%);
}
}
@-webkit-keyframes sb1-slide-5 {
0%, 100% {
-webkit-transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(55%);
}
}
@-moz-keyframes sb1-slide-5 {
0%, 100% {
-moz-transform: translateY(-50%);
}
50% {
-moz-transform: translateY(-50%) translateX(55%);
}
}
@keyframes sb1-slide-5 {
0%, 100% {
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(55%);
-moz-transform: translateY(-50%) translateX(55%);
-ms-transform: translateY(-50%) translateX(55%);
-o-transform: translateY(-50%) translateX(55%);
transform: translateY(-50%) translateX(55%);
}
}
@-webkit-keyframes sb1-slide-6 {
0%, 100% {
-webkit-transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(65%);
}
}
@-moz-keyframes sb1-slide-6 {
0%, 100% {
-moz-transform: translateY(-50%);
}
50% {
-moz-transform: translateY(-50%) translateX(65%);
}
}
@keyframes sb1-slide-6 {
0%, 100% {
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(65%);
-moz-transform: translateY(-50%) translateX(65%);
-ms-transform: translateY(-50%) translateX(65%);
-o-transform: translateY(-50%) translateX(65%);
transform: translateY(-50%) translateX(65%);
}
}
@-webkit-keyframes sb1-slide-7 {
0%, 100% {
-webkit-transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(-95%);
}
}
@-moz-keyframes sb1-slide-7 {
0%, 100% {
-moz-transform: translateY(-50%);
}
50% {
-moz-transform: translateY(-50%) translateX(-95%);
}
}
@keyframes sb1-slide-7 {
0%, 100% {
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
50% {
-webkit-transform: translateY(-50%) translateX(-95%);
-moz-transform: translateY(-50%) translateX(-95%);
-ms-transform: translateY(-50%) translateX(-95%);
-o-transform: translateY(-50%) translateX(-95%);
transform: translateY(-50%) translateX(-95%);
}
}
/* --------------------------------
Project slider navigation
-------------------------------- */
.sb1-slider-navigation {
display: none;
}
.sb1-slider-navigation a {
position: absolute;
top: 50%;
bottom: auto;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
left: 0;
height: 60px;
width: 4%;
background: url(../img/sb1-arrow.svg) no-repeat center center;
-webkit-transition: opacity 0.2s 0s, visibility 0s 0s;
-moz-transition: opacity 0.2s 0s, visibility 0s 0s;
transition: opacity 0.2s 0s, visibility 0s 0s;
}
.sb1-slider-navigation a.next {
right: 0;
left: auto;
}
.sb1-slider-navigation a.prev {
-webkit-transform: translateY(-50%) rotate(180deg);
-moz-transform: translateY(-50%) rotate(180deg);
-ms-transform: translateY(-50%) rotate(180deg);
-o-transform: translateY(-50%) rotate(180deg);
transform: translateY(-50%) rotate(180deg);
}
.sb1-slider-navigation a.inactive {
visibility: hidden;
opacity: 0;
-webkit-transition: opacity 0.2s 0s, visibility 0s 0.2s;
-moz-transition: opacity 0.2s 0s, visibility 0s 0.2s;
transition: opacity 0.2s 0s, visibility 0s 0.2s;
}
@media only screen and (min-width: 900px) {
.sb1-slider-navigation {
display: block;
}
}
/* --------------------------------
Project content panel
-------------------------------- */
.sb1-project-content {
position: fixed;
z-index: 7;
top: 0;
left: 0;
width: 100%;
height: 100%;
visibility: hidden;
background-color: #ebebeb;
/* Force Hardware Acceleration */
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
-o-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(100%);
-o-transform: translateY(100%);
transform: translateY(100%);
-webkit-transition: -webkit-transform 0.4s 0s, visibility 0s 0.4s;
-moz-transition: -moz-transform 0.4s 0s, visibility 0s 0.4s;
transition: transform 0.4s 0s, visibility 0s 0.4s;
-webkit-transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
-moz-transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
}
.sb1-project-content > div {
height: 100%;
overflow-y: auto;
padding: 4em 2em;
}
.sb1-project-content > div > * {
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
.sb1-project-content.is-visible {
visibility: visible;
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0);
-webkit-transition: -webkit-transform 0.4s 0s, visibility 0s 0s;
-moz-transition: -moz-transform 0.4s 0s, visibility 0s 0s;
transition: transform 0.4s 0s, visibility 0s 0s;
-webkit-transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
-moz-transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
transition-timing-function: cubic-bezier(0.67, 0.15, 0.83, 0.83);
}
.sb1-project-content.is-visible > div {
/* smooth scrolling on iOS */
-webkit-overflow-scrolling: touch;
}
.sb1-project-content h2 {
font-size: 2.4rem;
color: #69aa6f;
font-weight: bold;
}
.sb1-project-content em {
display: block;
font-size: 1.8rem;
font-style: italic;
margin: 1em auto;
}
.sb1-project-content p {
margin-bottom: 1em;
font-size: 1.4rem;
color: #6f757c;
}
.sb1-project-content em, .sb1-project-content p {
line-height: 1.6;
}
.sb1-project-content .close {
display: block;
height: 32px;
width: 32px;
position: absolute;
top: 50vh;
right: 10px;
background: url(../img/sb1-close-dark.svg) no-repeat center center;
}
@media only screen and (min-width: 900px) {
.sb1-project-content h2 {
font-size: 6rem;
}
.sb1-project-content em {
font-size: 2.4rem;
}
.sb1-project-content p {
font-size: 1.8rem;
}
.sb1-project-content .close {
top: 70px;
right: 7%;
}
}
/* --------------------------------
Keyframes
-------------------------------- */
@-webkit-keyframes sb1-translate {
0% {
opacity: 0;
-webkit-transform: translateY(100px);
}
100% {
-webkit-transform: translateY(0);
opacity: 1;
}
}
@-moz-keyframes sb1-translate {
0% {
opacity: 0;
-moz-transform: translateY(100px);
}
100% {
-moz-transform: translateY(0);
opacity: 1;
}
}
@keyframes sb1-translate {
0% {
opacity: 0;
-webkit-transform: translateY(100px);
-moz-transform: translateY(100px);
-ms-transform: translateY(100px);
-o-transform: translateY(100px);
transform: translateY(100px);
}
100% {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0);
opacity: 1;
}
}
|
chriswork/abc
|
css/sb1-style.css
|
CSS
|
mit
| 21,543
|
# -*- coding: utf-8 -*-
#
# py-uwerr documentation build configuration file, created by
# sphinx-quickstart on Sat Nov 24 19:07:07 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'py-uwerr'
copyright = u'2012, Dirk Hesse'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'py-uwerrdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'py-uwerr.tex', u'py-uwerr Documentation',
u'Dirk Hesse', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'py-uwerr', u'py-uwerr Documentation',
[u'Dirk Hesse'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'py-uwerr', u'py-uwerr Documentation',
u'Dirk Hesse', 'py-uwerr', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
|
dhesse/py-uwerr
|
doc/conf.py
|
Python
|
mit
| 7,830
|
<!DOCTYPE html>
<html class="theme-next mist use-motion" lang="en">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />
<meta name="keywords" content="Physical_Computing," />
<link rel="alternate" href="/atom.xml" title="Tong Li" type="application/atom+xml" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />
<meta name="description" content="MechanismReferences online: Things to take care1 how to align the gears Solution:On the one side, use laser cutter to cut a black frame to fasten gears. On the other side, add parts needed, use a">
<meta name="keywords" content="Physical_Computing">
<meta property="og:type" content="article">
<meta property="og:title" content="pcomp final">
<meta property="og:url" content="https://tornoteli.github.io/Physical-Computing/pcomp-final/index.html">
<meta property="og:site_name" content="Tong Li">
<meta property="og:description" content="MechanismReferences online: Things to take care1 how to align the gears Solution:On the one side, use laser cutter to cut a black frame to fasten gears. On the other side, add parts needed, use a">
<meta property="og:locale" content="en">
<meta property="og:image" content="https://78.media.tumblr.com/77677b955b45a69d21434a4a420435f0/tumblr_p0gebbrHbn1ucjvi0o2_1280.png">
<meta property="og:image" content="https://78.media.tumblr.com/c0aff6dc97cfd662ddf0fe2e34adf970/tumblr_p0gebbrHbn1ucjvi0o3_1280.png">
<meta property="og:image" content="https://78.media.tumblr.com/3809566670b22d25b793841e3af90b41/tumblr_p0gg9qrDqw1ucjvi0o1_1280.png">
<meta property="og:image" content="https://78.media.tumblr.com/e9fe134e37f94cd0b49e7c04db6169a7/tumblr_p0gdshhrs11ucjvi0o3_1280.jpg">
<meta property="og:image" content="https://78.media.tumblr.com/018bca8f7638cf5fe6908bc357ad29bc/tumblr_p0gdshhrs11ucjvi0o4_1280.jpg">
<meta property="og:image" content="https://78.media.tumblr.com/e2e11b31864f5acbe878160b49bcd5e3/tumblr_p0ge72dLS51ucjvi0o1_1280.jpg">
<meta property="og:image" content="https://78.media.tumblr.com/f5a8a26fbe8312782f30cddb555bfb8b/tumblr_p0gebbrHbn1ucjvi0o1_250.png">
<meta property="og:image" content="https://78.media.tumblr.com/b749f88d2a3de8b0887384d0017a78a7/tumblr_p0gg899M7a1ucjvi0o1_1280.jpg">
<meta property="og:image" content="https://78.media.tumblr.com/03d2f0ae46df04b1522a8a362af1f650/tumblr_p0gdshhrs11ucjvi0o5_400.jpg">
<meta property="og:image" content="https://78.media.tumblr.com/d3d919fe9a86341539268bbbdd0789e6/tumblr_p0gfy6EBJ71ucjvi0o1_1280.jpg">
<meta property="og:updated_time" content="2017-12-04T21:32:09.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="pcomp final">
<meta name="twitter:description" content="MechanismReferences online: Things to take care1 how to align the gears Solution:On the one side, use laser cutter to cut a black frame to fasten gears. On the other side, add parts needed, use a">
<meta name="twitter:image" content="https://78.media.tumblr.com/77677b955b45a69d21434a4a420435f0/tumblr_p0gebbrHbn1ucjvi0o2_1280.png">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Mist',
version: '5.1.2',
sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn"}},
duoshuo: {
userId: '0',
author: 'Author'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="https://tornoteli.github.io/Physical-Computing/pcomp-final/"/>
<title>pcomp final | Tong Li</title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="en">
<div class="container sidebar-position-left page-post-detail">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">Tong Li</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle"></p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
Home
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br />
Categories
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section">
<i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
Tags
</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about/" rel="section">
<i class="menu-item-icon fa fa-fw fa-user"></i> <br />
About
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
Archives
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<div id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="https://tornoteli.github.io/Physical-Computing/pcomp-final/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="Tong Li">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Tong Li">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">pcomp final</h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2017-12-04T16:30:53-05:00">
12-04-2017
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/Physical-Computing/" itemprop="url" rel="index">
<span itemprop="name">Physical_Computing</span>
</a>
</span>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/Physical-Computing/pcomp-final/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="Physical-Computing/pcomp-final/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="Mechanism"><a href="#Mechanism" class="headerlink" title="Mechanism"></a>Mechanism</h2><p>References online:</p>
<p><img src="https://78.media.tumblr.com/77677b955b45a69d21434a4a420435f0/tumblr_p0gebbrHbn1ucjvi0o2_1280.png" alt="0"></p>
<p><img src="https://78.media.tumblr.com/c0aff6dc97cfd662ddf0fe2e34adf970/tumblr_p0gebbrHbn1ucjvi0o3_1280.png" alt="0"></p>
<p><img src="https://78.media.tumblr.com/3809566670b22d25b793841e3af90b41/tumblr_p0gg9qrDqw1ucjvi0o1_1280.png" alt="0"></p>
<h3 id="Things-to-take-care"><a href="#Things-to-take-care" class="headerlink" title="Things to take care"></a>Things to take care</h3><h4 id="1-how-to-align-the-gears"><a href="#1-how-to-align-the-gears" class="headerlink" title="1 how to align the gears"></a>1 how to align the gears</h4><p><img src="https://78.media.tumblr.com/e9fe134e37f94cd0b49e7c04db6169a7/tumblr_p0gdshhrs11ucjvi0o3_1280.jpg" alt="0"></p>
<p>Solution:On the one side, use laser cutter to cut a black frame to fasten gears. </p>
<p><img src="https://78.media.tumblr.com/018bca8f7638cf5fe6908bc357ad29bc/tumblr_p0gdshhrs11ucjvi0o4_1280.jpg" alt="0"></p>
<p>On the other side, add parts needed, use a washers to stop it from falling, and use screws to fasten it.</p>
<p><img src="https://78.media.tumblr.com/e2e11b31864f5acbe878160b49bcd5e3/tumblr_p0ge72dLS51ucjvi0o1_1280.jpg" alt="0"></p>
<p>2 how to connect linkages and gears</p>
<p>maybe add this part to gears. GLue it?</p>
<p><img src="https://78.media.tumblr.com/f5a8a26fbe8312782f30cddb555bfb8b/tumblr_p0gebbrHbn1ucjvi0o1_250.png" alt="0"></p>
<p>3 gear directions should be different</p>
<p><img src="https://78.media.tumblr.com/b749f88d2a3de8b0887384d0017a78a7/tumblr_p0gg899M7a1ucjvi0o1_1280.jpg" alt="0"></p>
<p>solution: use four gears in a row.</p>
<p><img src="https://78.media.tumblr.com/03d2f0ae46df04b1522a8a362af1f650/tumblr_p0gdshhrs11ucjvi0o5_400.jpg" alt="0"></p>
<p>4 frame and linkages don’t hit each other</p>
<p><img src="https://78.media.tumblr.com/d3d919fe9a86341539268bbbdd0789e6/tumblr_p0gfy6EBJ71ucjvi0o1_1280.jpg" alt=""></p>
</div>
<footer class="post-footer">
<div class="post-tags">
<a href="/tags/Physical-Computing/" rel="tag"># Physical_Computing</a>
</div>
<div class="post-nav">
<div class="post-nav-next post-nav-item">
<a href="/Physical-Computing/pcomp09/" rel="next" title="pcomp09 Final Project - BOM and diagram">
<i class="fa fa-chevron-left"></i> pcomp09 Final Project - BOM and diagram
</a>
</div>
<span class="post-nav-divider"></span>
<div class="post-nav-prev post-nav-item">
<a href="/Physical-Computing/pcomp13/" rel="prev" title="pcomp13">
pcomp13 <i class="fa fa-chevron-right"></i>
</a>
</div>
</div>
</footer>
</div>
</article>
<div class="post-spread">
</div>
</div>
</div>
<div class="comments" id="comments">
<div id="disqus_thread">
<noscript>
Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
</div>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<ul class="sidebar-nav motion-element">
<li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
Table of Contents
</li>
<li class="sidebar-nav-overview" data-target="site-overview">
Overview
</li>
</ul>
<section class="site-overview sidebar-panel">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<p class="site-author-name" itemprop="name">Tong Li</p>
<p class="site-description motion-element" itemprop="description">tornote's blog</p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">35</span>
<span class="site-state-item-name">posts</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/index.html">
<span class="site-state-item-count">8</span>
<span class="site-state-item-name">categories</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/index.html">
<span class="site-state-item-count">8</span>
<span class="site-state-item-name">tags</span>
</a>
</div>
</nav>
<div class="feed-link motion-element">
<a href="/atom.xml" rel="alternate">
<i class="fa fa-rss"></i>
RSS
</a>
</div>
<div class="links-of-author motion-element">
<span class="links-of-author-item">
<a href="https://github.com/tornoteli" target="_blank" title="GitHub">
<i class="fa fa-fw fa-github"></i>
GitHub
</a>
</span>
<span class="links-of-author-item">
<a href="mailto:tornoteli@gmail.com" target="_blank" title="E-Mail">
<i class="fa fa-fw fa-envelope"></i>
E-Mail
</a>
</span>
<span class="links-of-author-item">
<a href="https://twitter.com/tornote_li" target="_blank" title="Twitter">
<i class="fa fa-fw fa-twitter"></i>
Twitter
</a>
</span>
<span class="links-of-author-item">
<a href="https://www.facebook.com/tornoteli" target="_blank" title="FB Page">
<i class="fa fa-fw fa-facebook"></i>
FB Page
</a>
</span>
</div>
</section>
<!--noindex-->
<section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
<div class="post-toc">
<div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Mechanism"><span class="nav-number">1.</span> <span class="nav-text">Mechanism</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Things-to-take-care"><span class="nav-number">1.1.</span> <span class="nav-text">Things to take care</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-how-to-align-the-gears"><span class="nav-number">1.1.1.</span> <span class="nav-text">1 how to align the gears</span></a></li></ol></li></ol></li></ol></div>
</div>
</section>
<!--/noindex-->
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright" >
©
<span itemprop="copyrightYear">2018</span>
<span class="with-love">
<i class="fa fa-heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">Tong Li</span>
</div>
<div class="powered-by">Powered by <a class="theme-link" href="https://hexo.io">Hexo</a></div>
<span class="post-meta-divider">|</span>
<div class="theme-info">Theme — <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.2</div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>
<script id="dsq-count-scr" src="https://tornote-com.disqus.com/count.js" async></script>
<script type="text/javascript">
var disqus_config = function () {
this.page.url = 'https://tornoteli.github.io/Physical-Computing/pcomp-final/';
this.page.identifier = 'Physical-Computing/pcomp-final/';
this.page.title = 'pcomp final';
};
var d = document, s = d.createElement('script');
s.src = 'https://tornote-com.disqus.com/embed.js';
s.setAttribute('data-timestamp', '' + +new Date());
(d.head || d.body).appendChild(s);
</script>
</body>
</html>
|
tornoteli/tornoteli.github.io
|
Physical-Computing/pcomp-final/index.html
|
HTML
|
mit
| 21,434
|
/*Owner & Copyrights: Vance King Saxbe. A.*//*Copyright (c) <2014> Author Vance King Saxbe. A, and contributors Power Dominion Enterprise, Precieux Consulting and other contributors. Modelled, Architected and designed by Vance King Saxbe. A. with the geeks from GoldSax Consulting and GoldSax Technologies email @vsaxbe@yahoo.com. Development teams from Power Dominion Enterprise, Precieux Consulting. Project sponsored by GoldSax Foundation, GoldSax Group and executed by GoldSax Manager.*/
$quote = file_get_contents('http://finance.google.co.uk/finance/info?client=ig&q=NYSE:WEC');
$avgp = "36.25";
$high = "36.72";
$low = "36.24";
$json = str_replace("\n", "", $quote);
$data = substr($json, 4, strlen($json) -5);
$json_output = json_decode($data, true);
echo "&L=".$json_output['l']."&N=WEC&";
$temp = file_get_contents("WECTEMP.txt", "r");
if ($json_output['l'] != $temp ) {
if ( $json_output['l'] > $temp ) {
if ( ($json_output['l'] > ($avgp + $high)/2) && ($json_output['l'] < $high)) { echo "&sign=au" ; }
if ( ($json_output['l'] < ($avgp + $low)/2) && ($json_output['l'] > $low)) { echo "&sign=ad" ; }
if ( $json_output['l'] < ($low - (($avgp - $low)/2)) ) { echo "&sign=as" ; }
if ( $json_output['l'] > ($high + (($high - $avgp)/2)) ) { echo "&sign=al" ; }
if ( ($json_output['l'] < ($high + (($high - $avgp)/2))) && ($json_output['l'] > $high)) { echo "&sign=auu" ; }
if ( ($json_output['l'] > ($low - (($avgp - $low)/2))) && ($json_output['l'] < $low)) { echo "&sign=add" ; }
//else { echo "&sign=a" ; }
}
if ( $json_output['l'] < $temp ) {
if ( ($json_output['l'] > ($avgp + $high)/2) && ($json_output['l'] < $high)) { echo "&sign=bu" ; }
if ( ($json_output['l'] < ($avgp + $low)/2) && ($json_output['l'] > $low)) { echo "&sign=bd" ; }
if ( $json_output['l'] < ($low - (($avgp - $low)/2)) ) { echo "&sign=bs" ; }
if ( $json_output['l'] > ($high + (($high - $avgp)/2)) ) { echo "&sign=bl" ; }
if ( ($json_output['l'] < ($high + (($high - $avgp)/2))) && ($json_output['l'] > $high)) { echo "&sign=buu" ; }
if ( ($json_output['l'] > ($low - (($avgp - $low)/2))) && ($json_output['l'] < $low)) { echo "&sign=bdd" ; }
// else { echo "&sign=b" ; }
}
$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filename= 'WEC.txt';
$file = fopen($filename, "a+" );
fwrite( $file, $json_output['l'].":".$time."\r\n" );
fclose( $file );
if (($json_output['l'] > $high ) && ($temp<= $high ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($json_output['l'] - $low) * (200000/$json_output['l']);
$filedash = fopen("alert.txt", "a+");
$wrote = fputs($filedash, "WEC:". "breaking:PHIGH:"."Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $high ) && ($temp>= $high ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("alert.txt", "a+");
$wrote = fputs($filedash, "WEC:". "retracing:PHIGH:"."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $low ) && ($temp>= $low ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $json_output['l']) * (200000/$json_output['l']);
$time = date('h:i:s',$new_time);
$filedash = fopen("alert.txt", "a+");
$wrote = fputs($filedash, "WEC:". "breaking:PLOW:"."short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] > $low ) && ($temp<= $low ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("alert.txt", "a+");
$wrote = fputs($filedash, "WEC:". "retracing:PLOW:"."\r\n");
fclose( $filedash );
}
if (($json_output['l'] > $avgp ) && ($temp<= $avgp ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($json_output['l'] - $low) * (200000/$json_output['l']);
$time = date('h:i:s',$new_time);
$filedash = fopen("alert.txt", "a+");
$wrote = fputs($filedash, "WEC:". "sliding up:PAVG:"."Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $avgp ) && ($temp>= $avgp ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $json_output['l']) * (200000/$json_output['l']);
$time = date('h:i:s',$new_time);
$filedash = fopen("alert.txt", "a+");
$wrote = fputs($filedash, "WEC:". "Sliding down:PAVG:"."Short Cost:".$risk."\r\n");
fclose( $filedash );
}
}
$filedash = fopen("WECTEMP.txt", "w");
$wrote = fputs($filedash, $json_output['l']);
fclose( $filedash );
//echo "&chg=".$json_output['cp']."&";
?>
/*email to provide support at vancekingsaxbe@powerdominionenterprise.com, businessaffairs@powerdominionenterprise.com, For donations please write to fundraising@powerdominionenterprise.com*/
|
VanceKingSaxbeA/NYSE-Engine
|
App/WEC.php
|
PHP
|
mit
| 5,298
|
// ==========================================================================
// SeqAn - The Library for Sequence Analysis
// ==========================================================================
// Copyright (c) 2006-2012, Knut Reinert, FU Berlin
// All rights reserved.
//
// 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.
// * Neither the name of Knut Reinert or the FU Berlin nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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 KNUT REINERT OR THE FU BERLIN 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.
//
// ==========================================================================
// Author: Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>
// ==========================================================================
#include <cstdio>
#include <seqan/basic/basic_debug.h>
#include <seqan/basic/basic_metaprogramming.h>
#include "test_basic_metaprogramming_logic.h"
#include "test_basic_metaprogramming_control.h"
#include "test_basic_metaprogramming_math.h"
#include "test_basic_metaprogramming_type.h"
#include "test_basic_metaprogramming_enable_if.h"
SEQAN_BEGIN_TESTSUITE(test_basic_metaprogramming)
{
// -----------------------------------------------------------------------
// Metaprogramming Logic
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_bool_type);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_eval);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_or);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_or_c);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_and);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_and_c);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_if);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_if_c);
// -----------------------------------------------------------------------
// Metaprogramming Control Structures
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_control_loop_reverse);
SEQAN_CALL_TEST(test_basic_metaprogramming_control_loop);
SEQAN_CALL_TEST(test_basic_metaprogramming_control_switch);
SEQAN_CALL_TEST(test_basic_metaprogramming_control_if);
// -----------------------------------------------------------------------
// Metaprogramming Math
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_math_log2);
SEQAN_CALL_TEST(test_basic_metaprogramming_math_log2_floor);
SEQAN_CALL_TEST(test_basic_metaprogramming_math_log2_power);
// -----------------------------------------------------------------------
// Metaprogramming Type Queries / Modification
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_type_same_type);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_make_signed);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_make_unsigned);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_remove_reference);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_remove_const);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_is_const);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_class_identifier);
// -----------------------------------------------------------------------
// Metaprogramming Conditional Enabling
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_enable_if_disable_if);
SEQAN_CALL_TEST(test_basic_metaprogramming_enable_if2_disable_if2);
}
SEQAN_END_TESTSUITE
// ==========================================================================
// SeqAn - The Library for Sequence Analysis
// ==========================================================================
// Copyright (c) 2006-2012, Knut Reinert, FU Berlin
// All rights reserved.
//
// 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.
// * Neither the name of Knut Reinert or the FU Berlin nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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 KNUT REINERT OR THE FU BERLIN 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.
//
// ==========================================================================
// Author: Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>
// ==========================================================================
#include <cstdio>
#include <seqan/basic/basic_debug.h>
#include <seqan/basic/basic_metaprogramming.h>
#include "test_basic_metaprogramming_logic.h"
#include "test_basic_metaprogramming_control.h"
#include "test_basic_metaprogramming_math.h"
#include "test_basic_metaprogramming_type.h"
#include "test_basic_metaprogramming_enable_if.h"
SEQAN_BEGIN_TESTSUITE(test_basic_metaprogramming)
{
// -----------------------------------------------------------------------
// Metaprogramming Logic
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_bool_type);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_eval);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_or);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_or_c);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_and);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_and_c);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_if);
SEQAN_CALL_TEST(test_basic_metaprogramming_logic_if_c);
// -----------------------------------------------------------------------
// Metaprogramming Control Structures
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_control_loop_reverse);
SEQAN_CALL_TEST(test_basic_metaprogramming_control_loop);
SEQAN_CALL_TEST(test_basic_metaprogramming_control_switch);
SEQAN_CALL_TEST(test_basic_metaprogramming_control_if);
// -----------------------------------------------------------------------
// Metaprogramming Math
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_math_log2);
SEQAN_CALL_TEST(test_basic_metaprogramming_math_log2_floor);
SEQAN_CALL_TEST(test_basic_metaprogramming_math_log2_power);
// -----------------------------------------------------------------------
// Metaprogramming Type Queries / Modification
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_type_same_type);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_make_signed);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_make_unsigned);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_remove_reference);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_remove_const);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_is_const);
SEQAN_CALL_TEST(test_basic_metaprogramming_type_class_identifier);
// -----------------------------------------------------------------------
// Metaprogramming Conditional Enabling
// -----------------------------------------------------------------------
SEQAN_CALL_TEST(test_basic_metaprogramming_enable_if_disable_if);
SEQAN_CALL_TEST(test_basic_metaprogramming_enable_if2_disable_if2);
}
SEQAN_END_TESTSUITE
|
bkahlert/seqan-research
|
raw/pmbs12/pmsb13-data-20120615/sources/wtg1fr816tg4hs6w/5/core/tests/basic/test_basic_metaprogramming.cpp
|
C++
|
mit
| 10,082
|
package model.neighbors;
import java.util.List;
import model.patches.Patch;
import model.gridrules.GridRules;
public abstract class Neighbors {
//will contain methods to construct neighbor list and check neighbors, etc.
//extended by different type of neighbor functions?
//or perhaps different neighbor functions will all be in this class?
public abstract List<Patch> getCardinalNeighbors(Patch[][] grid, int x,
int y, GridRules rules);
public abstract List<Patch> getDiagonalNeighbors(Patch[][] grid, int x, int y,
GridRules rules);
public abstract List<Patch> getAllNeighbors(Patch[][] grid, int x, int y,
GridRules rules);
public void topRight(Patch[][]grid, int x, int y, GridRules rules,
List<Patch> neighbors){
if(x == grid[0].length-1 || y == 0){
rules.handleEdges(grid, x+1, y-1, neighbors);
} else{
neighbors.add(grid[y-1][x+1]);
}
}
public void topLeft(Patch[][]grid, int x, int y, GridRules rules,
List<Patch> neighbors){
if(x == 0 || y == 0){
rules.handleEdges(grid, x-1, y-1, neighbors);
} else{
neighbors.add(grid[y-1][x-1]);
}
}
public void Right(Patch[][] grid, int x, int y, GridRules rules,
List<Patch> neighbors){
if(x== grid[0].length-1){
rules.handleEdges(grid, x+1, y, neighbors);
} else{
neighbors.add(grid[y][x+1]);
}
}
public void Left(Patch[][] grid, int x, int y, GridRules rules,
List<Patch> neighbors){
if(x==0){
rules.handleEdges(grid, x-1, y, neighbors);
} else{
neighbors.add(grid[y][x-1]);
}
}
public void bottomRight(Patch[][] grid, int x, int y, GridRules rules,
List<Patch> neighbors){
if(x==grid[0].length -1|| y == grid.length-1){
rules.handleEdges(grid, x+1, y+1, neighbors);
}else{
neighbors.add(grid[y+1][x+1]);
}
}
public void bottomLeft(Patch[][] grid, int x, int y, GridRules rules,
List<Patch> neighbors){
if(x==0 || y == grid.length-1){
rules.handleEdges(grid, x-1, y+1, neighbors);
}else{
neighbors.add(grid[y+1][x-1]);
}
}
public void Up(Patch[][] grid, int x, int y, GridRules rules,
List<Patch> neighbors){
if(y==0){
rules.handleEdges(grid, x, y-1, neighbors);
} else{
neighbors.add(grid[y-1][x]);
}
}
public void Down(Patch[][] grid, int x, int y, GridRules rules,
List<Patch> neighbors){
if(y==grid.length-1){
rules.handleEdges(grid, x, y+1, neighbors);
} else{
neighbors.add(grid[y+1][x]);
}
}
}
|
jananzhu/cellsociety
|
src/model/neighbors/Neighbors.java
|
Java
|
mit
| 3,084
|
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>16 documentation</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
<link rel="stylesheet" href="../styles/style.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top visible-xs">
<a href="../" class="navbar-brand">16 documentation</a>
<button type="button" class="btn btn-default btn-menu fa fa-bars" id="btn-menu"></button>
</div>
<div class="xs-menu menu" id="mobile-menu">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search">
</div>
<nav>
<ul class="list">
<li class="title">
<a href="../index.html">16 documentation</a>
</li>
<li class="divider"></li>
<li class="chapter">
<a data-type="chapter-link" href="../index.html"><span class="fa fa-home"></span>Getting started</a>
<ul class="links">
<li class="link">
<a
href="../overview.html"
href="../overview.html"
>
<span class="fa fa-th"></span>Overview
</a>
</li>
<li class="link">
<a href="../index.html" ><span class="fa fa-file-text-o"></span>README</a>
</li>
<li class="link">
<a href="./license.html"
>
<span class="fa fa-file-text-o"></span>LICENSE
</a>
</li>
</ul>
</li>
<li class="chapter">
<a data-type="chapter-link" href="../modules.html" >
<div class="menu-toggler linked" data-toggle="collapse"
data-target="#xs-modules-links"
>
<span class="fa fa-archive"></span>
<span class="link-name">Modules</span>
<span class="fa fa-angle-down"></span>
</div>
</a>
<ul class="links collapse "
id="xs-modules-links"
>
<li class="link">
<a href="../modules/AnalyticsModule.html" >AnalyticsModule</a>
</li>
<li class="link">
<a href="../modules/CoreModule.html" >CoreModule</a>
</li>
<li class="link">
<a href="../modules/MultilingualModule.html" >MultilingualModule</a>
</li>
<li class="link">
<a href="../modules/PuzzleModule.html" >PuzzleModule</a>
</li>
<li class="link">
<a href="../modules/SampleModule.html" >SampleModule</a>
</li>
<li class="link">
<a href="../modules/SharedModule.html" >SharedModule</a>
</li>
<li class="link">
<a href="../modules/WebModule.html" >WebModule</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#xs-components-links"
>
<span class="fa fa-cogs"></span>
<span>Components</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="xs-components-links"
>
<li class="link">
<a href="../components/AboutComponent.html" >AboutComponent</a>
</li>
<li class="link">
<a href="../components/AppComponent.html" >AppComponent</a>
</li>
<li class="link">
<a href="../components/FooterComponent.html" >FooterComponent</a>
</li>
<li class="link">
<a href="../components/HomeComponent.html" >HomeComponent</a>
</li>
<li class="link">
<a href="../components/LangSwitcherComponent.html" >LangSwitcherComponent</a>
</li>
<li class="link">
<a href="../components/NavbarComponent.html" >NavbarComponent</a>
</li>
<li class="link">
<a href="../components/PuzzleComponent.html" >PuzzleComponent</a>
</li>
<li class="link">
<a href="../components/ToolbarComponent.html" >ToolbarComponent</a>
</li>
<li class="link">
<a href="../components/ToolbarComponent.html" >ToolbarComponent</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#xs-directives-links"
>
<span class="fa fa-code"></span>
<span>Directives</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="xs-directives-links"
>
<li class="link">
<a href="../directives/PlatformDirective.html" >PlatformDirective</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#xs-classes-links"
>
<span class="fa fa-file-code-o"></span>
<span>Classes</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="xs-classes-links"
>
<li class="link">
<a href="../classes/Analytics.html" >Analytics</a>
</li>
<li class="link">
<a href="../classes/BaseComponent.html" >BaseComponent</a>
</li>
<li class="link">
<a href="../classes/BaseService.html" >BaseService</a>
</li>
<li class="link">
<a href="../classes/Board.html" >Board</a>
</li>
<li class="link">
<a href="../classes/ChangeAction.html" >ChangeAction</a>
</li>
<li class="link">
<a href="../classes/Config.html" >Config</a>
</li>
<li class="link">
<a href="../classes/ConfigMock.html" >ConfigMock</a>
</li>
<li class="link">
<a href="../classes/ConfigMockMultilang.html" >ConfigMockMultilang</a>
</li>
<li class="link">
<a href="../classes/ConfigRecord.html" >ConfigRecord</a>
</li>
<li class="link">
<a href="../classes/DesktopConfig.html" >DesktopConfig</a>
</li>
<li class="link">
<a href="../classes/ElectronEventService.html" >ElectronEventService</a>
</li>
<li class="link">
<a href="../classes/LangChangedAction.html" >LangChangedAction</a>
</li>
<li class="link">
<a href="../classes/LangUnsupportedAction.html" >LangUnsupportedAction</a>
</li>
<li class="link">
<a href="../classes/LogTarget.html" >LogTarget</a>
</li>
<li class="link">
<a href="../classes/LogTargetBase.html" >LogTargetBase</a>
</li>
<li class="link">
<a href="../classes/LogTargetOptions.html" >LogTargetOptions</a>
</li>
<li class="link">
<a href="../classes/MockPopStateEvent.html" >MockPopStateEvent</a>
</li>
<li class="link">
<a href="../classes/PuzzleConfig.html" >PuzzleConfig</a>
</li>
<li class="link">
<a href="../classes/Row.html" >Row</a>
</li>
<li class="link">
<a href="../classes/Square.html" >Square</a>
</li>
<li class="link">
<a href="../classes/TranslateLoaderMock.html" >TranslateLoaderMock</a>
</li>
<li class="link">
<a href="../classes/TranslateMock.html" >TranslateMock</a>
</li>
<li class="link">
<a href="../classes/Utils.html" >Utils</a>
</li>
<li class="link">
<a href="../classes/WindowMock.html" >WindowMock</a>
</li>
<li class="link">
<a href="../classes/WindowMockFrench.html" >WindowMockFrench</a>
</li>
<li class="link">
<a href="../classes/WindowMockNoLanguage.html" >WindowMockNoLanguage</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#xs-injectables-links"
>
<span class="fa fa-long-arrow-down"></span>
<span>Injectables</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="xs-injectables-links"
>
<li class="link">
<a href="../injectables/ActionsService.html" >ActionsService</a>
</li>
<li class="link">
<a href="../injectables/AnalyticsService.html" >AnalyticsService</a>
</li>
<li class="link">
<a href="../injectables/AppService.html" >AppService</a>
</li>
<li class="link">
<a href="../injectables/BoardService.html" >BoardService</a>
</li>
<li class="link">
<a href="../injectables/ConsoleService.html" >ConsoleService</a>
</li>
<li class="link">
<a href="../injectables/ConsoleTarget.html" >ConsoleTarget</a>
</li>
<li class="link">
<a href="../injectables/LocalStorageService.html" >LocalStorageService</a>
</li>
<li class="link">
<a href="../injectables/LogService.html" >LogService</a>
</li>
<li class="link">
<a href="../injectables/MockLocationStrategy.html" >MockLocationStrategy</a>
</li>
<li class="link">
<a href="../injectables/MultilingualEffects.html" >MultilingualEffects</a>
</li>
<li class="link">
<a href="../injectables/MultilingualService.html" >MultilingualService</a>
</li>
<li class="link">
<a href="../injectables/NameListService.html" >NameListService</a>
</li>
<li class="link">
<a href="../injectables/PuzzleStateService.html" >PuzzleStateService</a>
</li>
<li class="link">
<a href="../injectables/RouterExtensions.html" >RouterExtensions</a>
</li>
<li class="link">
<a href="../injectables/RouterExtensionsMock.html" >RouterExtensionsMock</a>
</li>
<li class="link">
<a href="../injectables/SampleEffects.html" >SampleEffects</a>
</li>
<li class="link">
<a href="../injectables/StateService.html" data-type="entity-link" class="active" >StateService</a>
</li>
<li class="link">
<a href="../injectables/StorageService.html" >StorageService</a>
</li>
<li class="link">
<a href="../injectables/WindowService.html" >WindowService</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#xs-interfaces-links"
>
<span class="fa fa-info"></span>
<span>Interfaces</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="xs-interfaces-links"
>
<li class="link">
<a href="../interfaces/ActionsServiceInterface.html" >ActionsServiceInterface</a>
</li>
<li class="link">
<a href="../interfaces/DatabaseServiceInterface.html" >DatabaseServiceInterface</a>
</li>
<li class="link">
<a href="../interfaces/EnvConfig.html" >EnvConfig</a>
</li>
<li class="link">
<a href="../interfaces/ExtendedNavigationExtras.html" >ExtendedNavigationExtras</a>
</li>
<li class="link">
<a href="../interfaces/IAnalytics.html" >IAnalytics</a>
</li>
<li class="link">
<a href="../interfaces/IAnalyticsProperties.html" >IAnalyticsProperties</a>
</li>
<li class="link">
<a href="../interfaces/IAppState.html" >IAppState</a>
</li>
<li class="link">
<a href="../interfaces/IConsole.html" >IConsole</a>
</li>
<li class="link">
<a href="../interfaces/ICoreModuleOptions.html" >ICoreModuleOptions</a>
</li>
<li class="link">
<a href="../interfaces/IEvent.html" >IEvent</a>
</li>
<li class="link">
<a href="../interfaces/ILang.html" >ILang</a>
</li>
<li class="link">
<a href="../interfaces/IMultilingualActions.html" >IMultilingualActions</a>
</li>
<li class="link">
<a href="../interfaces/IMultilingualState.html" >IMultilingualState</a>
</li>
<li class="link">
<a href="../interfaces/IPlatforms.html" >IPlatforms</a>
</li>
<li class="link">
<a href="../interfaces/IRouterExtensions.html" >IRouterExtensions</a>
</li>
<li class="link">
<a href="../interfaces/ISampleState.html" >ISampleState</a>
</li>
<li class="link">
<a href="../interfaces/IStorage.html" >IStorage</a>
</li>
<li class="link">
<a href="../interfaces/IWindow.html" >IWindow</a>
</li>
<li class="link">
<a href="../interfaces/LogEvent.html" >LogEvent</a>
</li>
<li class="link">
<a href="../interfaces/ModelInterface.html" >ModelInterface</a>
</li>
<li class="link">
<a href="../interfaces/StateServiceInterface.html" >StateServiceInterface</a>
</li>
<li class="link">
<a href="../interfaces/TestApi.html" >TestApi</a>
</li>
<li class="link">
<a href="../interfaces/ToolbarInterface.html" >ToolbarInterface</a>
</li>
<li class="link">
<a href="../interfaces/ToolbarOptionsInterface.html" >ToolbarOptionsInterface</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#xs-miscellaneous-links"
>
<span class="fa fa-cubes"></span>
<span>Miscellaneous</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="xs-miscellaneous-links"
>
<li class="link">
<a href="../miscellaneous/enumerations.html" data-type="entity-link" >Enums</a>
</li>
<li class="link">
<a href="../miscellaneous/functions.html" data-type="entity-link" >Functions</a>
</li>
<li class="link">
<a href="../miscellaneous/typealiases.html" data-type="entity-link" >Type aliases</a>
</li>
<li class="link">
<a href="../miscellaneous/variables.html" data-type="entity-link" >Variables</a>
</li>
</ul>
</li>
<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>
<li class="divider"></li>
<li class="copyright">
Documentation generated using <a href="https://compodoc.github.io/website/" target="_blank">
<img src="..//images/compodoc-vectorise.svg" class="img-responsive">
</a>
</li>
</ul>
</nav>
</div>
<div class="container-fluid main">
<div class="row main">
<div class="hidden-xs menu">
<nav>
<ul class="list">
<li class="title">
<a href="../index.html">16 documentation</a>
</li>
<li class="divider"></li>
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search">
</div>
<li class="chapter">
<a data-type="chapter-link" href="../index.html"><span class="fa fa-home"></span>Getting started</a>
<ul class="links">
<li class="link">
<a
href="../overview.html"
href="../overview.html"
>
<span class="fa fa-th"></span>Overview
</a>
</li>
<li class="link">
<a href="../index.html" ><span class="fa fa-file-text-o"></span>README</a>
</li>
<li class="link">
<a href="./license.html"
>
<span class="fa fa-file-text-o"></span>LICENSE
</a>
</li>
</ul>
</li>
<li class="chapter">
<a data-type="chapter-link" href="../modules.html" >
<div class="menu-toggler linked" data-toggle="collapse"
data-target="#modules-links"
>
<span class="fa fa-archive"></span>
<span class="link-name">Modules</span>
<span class="fa fa-angle-down"></span>
</div>
</a>
<ul class="links collapse "
id="modules-links"
>
<li class="link">
<a href="../modules/AnalyticsModule.html" >AnalyticsModule</a>
</li>
<li class="link">
<a href="../modules/CoreModule.html" >CoreModule</a>
</li>
<li class="link">
<a href="../modules/MultilingualModule.html" >MultilingualModule</a>
</li>
<li class="link">
<a href="../modules/PuzzleModule.html" >PuzzleModule</a>
</li>
<li class="link">
<a href="../modules/SampleModule.html" >SampleModule</a>
</li>
<li class="link">
<a href="../modules/SharedModule.html" >SharedModule</a>
</li>
<li class="link">
<a href="../modules/WebModule.html" >WebModule</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#components-links"
>
<span class="fa fa-cogs"></span>
<span>Components</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="components-links"
>
<li class="link">
<a href="../components/AboutComponent.html" >AboutComponent</a>
</li>
<li class="link">
<a href="../components/AppComponent.html" >AppComponent</a>
</li>
<li class="link">
<a href="../components/FooterComponent.html" >FooterComponent</a>
</li>
<li class="link">
<a href="../components/HomeComponent.html" >HomeComponent</a>
</li>
<li class="link">
<a href="../components/LangSwitcherComponent.html" >LangSwitcherComponent</a>
</li>
<li class="link">
<a href="../components/NavbarComponent.html" >NavbarComponent</a>
</li>
<li class="link">
<a href="../components/PuzzleComponent.html" >PuzzleComponent</a>
</li>
<li class="link">
<a href="../components/ToolbarComponent.html" >ToolbarComponent</a>
</li>
<li class="link">
<a href="../components/ToolbarComponent.html" >ToolbarComponent</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#directives-links"
>
<span class="fa fa-code"></span>
<span>Directives</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="directives-links"
>
<li class="link">
<a href="../directives/PlatformDirective.html" >PlatformDirective</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#classes-links"
>
<span class="fa fa-file-code-o"></span>
<span>Classes</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="classes-links"
>
<li class="link">
<a href="../classes/Analytics.html" >Analytics</a>
</li>
<li class="link">
<a href="../classes/BaseComponent.html" >BaseComponent</a>
</li>
<li class="link">
<a href="../classes/BaseService.html" >BaseService</a>
</li>
<li class="link">
<a href="../classes/Board.html" >Board</a>
</li>
<li class="link">
<a href="../classes/ChangeAction.html" >ChangeAction</a>
</li>
<li class="link">
<a href="../classes/Config.html" >Config</a>
</li>
<li class="link">
<a href="../classes/ConfigMock.html" >ConfigMock</a>
</li>
<li class="link">
<a href="../classes/ConfigMockMultilang.html" >ConfigMockMultilang</a>
</li>
<li class="link">
<a href="../classes/ConfigRecord.html" >ConfigRecord</a>
</li>
<li class="link">
<a href="../classes/DesktopConfig.html" >DesktopConfig</a>
</li>
<li class="link">
<a href="../classes/ElectronEventService.html" >ElectronEventService</a>
</li>
<li class="link">
<a href="../classes/LangChangedAction.html" >LangChangedAction</a>
</li>
<li class="link">
<a href="../classes/LangUnsupportedAction.html" >LangUnsupportedAction</a>
</li>
<li class="link">
<a href="../classes/LogTarget.html" >LogTarget</a>
</li>
<li class="link">
<a href="../classes/LogTargetBase.html" >LogTargetBase</a>
</li>
<li class="link">
<a href="../classes/LogTargetOptions.html" >LogTargetOptions</a>
</li>
<li class="link">
<a href="../classes/MockPopStateEvent.html" >MockPopStateEvent</a>
</li>
<li class="link">
<a href="../classes/PuzzleConfig.html" >PuzzleConfig</a>
</li>
<li class="link">
<a href="../classes/Row.html" >Row</a>
</li>
<li class="link">
<a href="../classes/Square.html" >Square</a>
</li>
<li class="link">
<a href="../classes/TranslateLoaderMock.html" >TranslateLoaderMock</a>
</li>
<li class="link">
<a href="../classes/TranslateMock.html" >TranslateMock</a>
</li>
<li class="link">
<a href="../classes/Utils.html" >Utils</a>
</li>
<li class="link">
<a href="../classes/WindowMock.html" >WindowMock</a>
</li>
<li class="link">
<a href="../classes/WindowMockFrench.html" >WindowMockFrench</a>
</li>
<li class="link">
<a href="../classes/WindowMockNoLanguage.html" >WindowMockNoLanguage</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#injectables-links"
>
<span class="fa fa-long-arrow-down"></span>
<span>Injectables</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="injectables-links"
>
<li class="link">
<a href="../injectables/ActionsService.html" >ActionsService</a>
</li>
<li class="link">
<a href="../injectables/AnalyticsService.html" >AnalyticsService</a>
</li>
<li class="link">
<a href="../injectables/AppService.html" >AppService</a>
</li>
<li class="link">
<a href="../injectables/BoardService.html" >BoardService</a>
</li>
<li class="link">
<a href="../injectables/ConsoleService.html" >ConsoleService</a>
</li>
<li class="link">
<a href="../injectables/ConsoleTarget.html" >ConsoleTarget</a>
</li>
<li class="link">
<a href="../injectables/LocalStorageService.html" >LocalStorageService</a>
</li>
<li class="link">
<a href="../injectables/LogService.html" >LogService</a>
</li>
<li class="link">
<a href="../injectables/MockLocationStrategy.html" >MockLocationStrategy</a>
</li>
<li class="link">
<a href="../injectables/MultilingualEffects.html" >MultilingualEffects</a>
</li>
<li class="link">
<a href="../injectables/MultilingualService.html" >MultilingualService</a>
</li>
<li class="link">
<a href="../injectables/NameListService.html" >NameListService</a>
</li>
<li class="link">
<a href="../injectables/PuzzleStateService.html" >PuzzleStateService</a>
</li>
<li class="link">
<a href="../injectables/RouterExtensions.html" >RouterExtensions</a>
</li>
<li class="link">
<a href="../injectables/RouterExtensionsMock.html" >RouterExtensionsMock</a>
</li>
<li class="link">
<a href="../injectables/SampleEffects.html" >SampleEffects</a>
</li>
<li class="link">
<a href="../injectables/StateService.html" data-type="entity-link" class="active" >StateService</a>
</li>
<li class="link">
<a href="../injectables/StorageService.html" >StorageService</a>
</li>
<li class="link">
<a href="../injectables/WindowService.html" >WindowService</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#interfaces-links"
>
<span class="fa fa-info"></span>
<span>Interfaces</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="interfaces-links"
>
<li class="link">
<a href="../interfaces/ActionsServiceInterface.html" >ActionsServiceInterface</a>
</li>
<li class="link">
<a href="../interfaces/DatabaseServiceInterface.html" >DatabaseServiceInterface</a>
</li>
<li class="link">
<a href="../interfaces/EnvConfig.html" >EnvConfig</a>
</li>
<li class="link">
<a href="../interfaces/ExtendedNavigationExtras.html" >ExtendedNavigationExtras</a>
</li>
<li class="link">
<a href="../interfaces/IAnalytics.html" >IAnalytics</a>
</li>
<li class="link">
<a href="../interfaces/IAnalyticsProperties.html" >IAnalyticsProperties</a>
</li>
<li class="link">
<a href="../interfaces/IAppState.html" >IAppState</a>
</li>
<li class="link">
<a href="../interfaces/IConsole.html" >IConsole</a>
</li>
<li class="link">
<a href="../interfaces/ICoreModuleOptions.html" >ICoreModuleOptions</a>
</li>
<li class="link">
<a href="../interfaces/IEvent.html" >IEvent</a>
</li>
<li class="link">
<a href="../interfaces/ILang.html" >ILang</a>
</li>
<li class="link">
<a href="../interfaces/IMultilingualActions.html" >IMultilingualActions</a>
</li>
<li class="link">
<a href="../interfaces/IMultilingualState.html" >IMultilingualState</a>
</li>
<li class="link">
<a href="../interfaces/IPlatforms.html" >IPlatforms</a>
</li>
<li class="link">
<a href="../interfaces/IRouterExtensions.html" >IRouterExtensions</a>
</li>
<li class="link">
<a href="../interfaces/ISampleState.html" >ISampleState</a>
</li>
<li class="link">
<a href="../interfaces/IStorage.html" >IStorage</a>
</li>
<li class="link">
<a href="../interfaces/IWindow.html" >IWindow</a>
</li>
<li class="link">
<a href="../interfaces/LogEvent.html" >LogEvent</a>
</li>
<li class="link">
<a href="../interfaces/ModelInterface.html" >ModelInterface</a>
</li>
<li class="link">
<a href="../interfaces/StateServiceInterface.html" >StateServiceInterface</a>
</li>
<li class="link">
<a href="../interfaces/TestApi.html" >TestApi</a>
</li>
<li class="link">
<a href="../interfaces/ToolbarInterface.html" >ToolbarInterface</a>
</li>
<li class="link">
<a href="../interfaces/ToolbarOptionsInterface.html" >ToolbarOptionsInterface</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple menu-toggler" data-toggle="collapse"
data-target="#miscellaneous-links"
>
<span class="fa fa-cubes"></span>
<span>Miscellaneous</span>
<span class="fa fa-angle-down"></span>
</div>
<ul class="links collapse "
id="miscellaneous-links"
>
<li class="link">
<a href="../miscellaneous/enumerations.html" data-type="entity-link" >Enums</a>
</li>
<li class="link">
<a href="../miscellaneous/functions.html" data-type="entity-link" >Functions</a>
</li>
<li class="link">
<a href="../miscellaneous/typealiases.html" data-type="entity-link" >Type aliases</a>
</li>
<li class="link">
<a href="../miscellaneous/variables.html" data-type="entity-link" >Variables</a>
</li>
</ul>
</li>
<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>
<li class="divider"></li>
<li class="copyright">
Documentation generated using <a href="https://compodoc.github.io/website/" target="_blank">
<img src="..//images/compodoc-vectorise.svg" class="img-responsive">
</a>
</li>
</ul>
</nav>
</div>
<div class="content injectable">
<div class="content-data">
<ol class="breadcrumb">
<li>Injectables</li>
<li>StateService</li>
</ol>
<ul class="nav nav-tabs" role="tablist">
<li class="active">
<a href="#info" id="info-tab" role="tab" data-toggle="tab" data-link="info">Info</a>
</li>
<li>
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="info">
<p class="comment">
<h3>File</h3>
</p>
<p class="comment">
<code>src/client/app/modules/puzzle/services/state/state.service.ts</code>
</p>
<section>
<h3 id="index">Index</h3>
<table class="table table-sm table-bordered index-table">
<tbody>
<tr>
<td class="col-md-4">
<h6><b>Properties</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<span class="modifier">Private</span> <a href="#_stateEvent">_stateEvent</a>
</li>
<li>
<span class="modifier">Private</span> <a href="#_stateEventObserver">_stateEventObserver</a>
</li>
<li>
<span class="modifier">Public</span> <a href="#databaseService">databaseService</a>
</li>
<li>
<a href="#stateEvent">stateEvent</a>
</li>
<li>
<a href="#stateEventChange$">stateEventChange$</a>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="constructor">Constructor</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<code>constructor(databaseService: <a href="../injectables/StorageService.html">LocalStorageService</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="15" class="link-to-prism">src/client/app/modules/puzzle/services/state/state.service.ts:15</a></div>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="inputs">
Properties
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="_stateEvent"></a>
<b><span class="modifier">Private</span> _stateEvent</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon fa fa-lock"></span><code>_stateEvent: <code><a href="../TestApis/t.html" target="_self" >string</a></code>
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="../TestApis/t.html" target="_self" >string</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="14" class="link-to-prism">src/client/app/modules/puzzle/services/state/state.service.ts:14</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="_stateEventObserver"></a>
<b><span class="modifier">Private</span> _stateEventObserver</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon fa fa-lock"></span><code>_stateEventObserver: <code><a href="../TestApis/t.html" target="_self" >Observer<string></a></code>
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="../TestApis/t.html" target="_self" >Observer<string></a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="15" class="link-to-prism">src/client/app/modules/puzzle/services/state/state.service.ts:15</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="databaseService"></a>
<b><span class="modifier">Public</span> databaseService</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon fa fa-"></span><code>databaseService: <code><a href="../injectables/StorageService.html" target="_self" >LocalStorageService</a></code>
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="../injectables/StorageService.html" target="_self" >LocalStorageService</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="17" class="link-to-prism">src/client/app/modules/puzzle/services/state/state.service.ts:17</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="stateEvent"></a>
<b> stateEvent</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>stateEvent: <code><a href="../TestApis/t.html" target="_self" >string</a></code>
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="../TestApis/t.html" target="_self" >string</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="27" class="link-to-prism">src/client/app/modules/puzzle/services/state/state.service.ts:27</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="stateEventChange$"></a>
<b> stateEventChange$</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>stateEventChange$: <code><a href="../TestApis/t.html" target="_self" >Observable<string></a></code>
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="../TestApis/t.html" target="_self" >Observable<string></a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="12" class="link-to-prism">src/client/app/modules/puzzle/services/state/state.service.ts:12</a></div>
</td>
</tr>
</tbody>
</table>
</section>
</div>
<div class="tab-pane fade tab-source-code" id="source">
<pre class="line-numbers"><code class="language-typescript">import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observer} from 'rxjs/Observer';
import 'rxjs/add/operator/share';
import {LocalStorageService} from './../database/local-storage.service';
import {StateServiceInterface} from './state-service.interface';
@Injectable()
export class StateService implements StateServiceInterface {
stateEventChange$: Observable<string>;
private _stateEvent: string;
private _stateEventObserver: Observer<string>;
constructor(public databaseService: LocalStorageService) {
this._stateEvent = 'init';
this.stateEventChange$ = new Observable<string>(
(observer:any) => this._stateEventObserver = observer
).share();
}
get stateEvent(): string {
return this._stateEvent;
}
set stateEvent(value: string) {
if (this.stateEvent !== value) {
this.stateEvent = value;
if (this._stateEventObserver) {
this._stateEventObserver.next(value);
}
}
}
}
</code></pre>
</div>
</div>
</div><div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
<script src="../js/libs/bootstrap-native.js"></script>
<script src="../js/libs/es6-shim.min.js"></script>
<script src="../js/libs/EventDispatcher.js"></script>
<script src="../js/libs/promise.min.js"></script>
<script src="../js/libs/zepto.min.js"></script>
<script src="../js/compodoc.js"></script>
<script>var COMPODOC_CURRENT_PAGE_DEPTH = 1;</script>
<script src="../js/search/search.js"></script>
<script src="../js/search/lunr.min.js"></script>
<script src="../js/search/search-lunr.js"></script>
<script src="../js/tabs.js"></script>
<script src="../js/menu.js"></script>
<script src="../js/libs/prism.js"></script>
<script src="../js/sourceCode.js"></script>
<script src="../js/search/search_index.js"></script>
</body>
</html>
|
bradyhouse/16
|
docs/injectables/StateService.html
|
HTML
|
mit
| 65,527
|
// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package datafusion provides access to the Cloud Data Fusion API.
//
// For product documentation, see: https://cloud.google.com/data-fusion/docs
//
// Creating a client
//
// Usage example:
//
// import "google.golang.org/api/datafusion/v1beta1"
// ...
// ctx := context.Background()
// datafusionService, err := datafusion.NewService(ctx)
//
// In this example, Google Application Default Credentials are used for authentication.
//
// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
//
// Other authentication options
//
// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
//
// datafusionService, err := datafusion.NewService(ctx, option.WithAPIKey("AIza..."))
//
// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
//
// config := &oauth2.Config{...}
// // ...
// token, err := config.Exchange(ctx, ...)
// datafusionService, err := datafusion.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
//
// See https://godoc.org/google.golang.org/api/option/ for details on options.
package datafusion // import "google.golang.org/api/datafusion/v1beta1"
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
googleapi "google.golang.org/api/googleapi"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
htransport "google.golang.org/api/transport/http"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
const apiId = "datafusion:v1beta1"
const apiName = "datafusion"
const apiVersion = "v1beta1"
const basePath = "https://datafusion.googleapis.com/"
// OAuth2 scopes used by this API.
const (
// View and manage your data across Google Cloud Platform services
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
)
// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
scopesOption := option.WithScopes(
"https://www.googleapis.com/auth/cloud-platform",
)
// NOTE: prepend, so we don't override user-specified scopes.
opts = append([]option.ClientOption{scopesOption}, opts...)
client, endpoint, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
}
s, err := New(client)
if err != nil {
return nil, err
}
if endpoint != "" {
s.BasePath = endpoint
}
return s, nil
}
// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Projects = NewProjectsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Projects *ProjectsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewProjectsService(s *Service) *ProjectsService {
rs := &ProjectsService{s: s}
rs.Locations = NewProjectsLocationsService(s)
return rs
}
type ProjectsService struct {
s *Service
Locations *ProjectsLocationsService
}
func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
rs := &ProjectsLocationsService{s: s}
rs.Instances = NewProjectsLocationsInstancesService(s)
rs.Operations = NewProjectsLocationsOperationsService(s)
return rs
}
type ProjectsLocationsService struct {
s *Service
Instances *ProjectsLocationsInstancesService
Operations *ProjectsLocationsOperationsService
}
func NewProjectsLocationsInstancesService(s *Service) *ProjectsLocationsInstancesService {
rs := &ProjectsLocationsInstancesService{s: s}
return rs
}
type ProjectsLocationsInstancesService struct {
s *Service
}
func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
rs := &ProjectsLocationsOperationsService{s: s}
return rs
}
type ProjectsLocationsOperationsService struct {
s *Service
}
// AuditConfig: Specifies the audit configuration for a service.
// The configuration determines which permission types are logged, and
// what
// identities, if any, are exempted from logging.
// An AuditConfig must have one or more AuditLogConfigs.
//
// If there are AuditConfigs for both `allServices` and a specific
// service,
// the union of the two AuditConfigs is used for that service: the
// log_types
// specified in each AuditConfig are enabled, and the exempted_members
// in each
// AuditLogConfig are exempted.
//
// Example Policy with multiple AuditConfigs:
//
// {
// "audit_configs": [
// {
// "service": "allServices"
// "audit_log_configs": [
// {
// "log_type": "DATA_READ",
// "exempted_members": [
// "user:foo@gmail.com"
// ]
// },
// {
// "log_type": "DATA_WRITE",
// },
// {
// "log_type": "ADMIN_READ",
// }
// ]
// },
// {
// "service": "fooservice.googleapis.com"
// "audit_log_configs": [
// {
// "log_type": "DATA_READ",
// },
// {
// "log_type": "DATA_WRITE",
// "exempted_members": [
// "user:bar@gmail.com"
// ]
// }
// ]
// }
// ]
// }
//
// For fooservice, this policy enables DATA_READ, DATA_WRITE and
// ADMIN_READ
// logging. It also exempts foo@gmail.com from DATA_READ logging,
// and
// bar@gmail.com from DATA_WRITE logging.
type AuditConfig struct {
// AuditLogConfigs: The configuration for logging of each type of
// permission.
AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
ExemptedMembers []string `json:"exemptedMembers,omitempty"`
// Service: Specifies a service that will be enabled for audit
// logging.
// For example, `storage.googleapis.com`,
// `cloudsql.googleapis.com`.
// `allServices` is a special value that covers all services.
Service string `json:"service,omitempty"`
// ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AuditLogConfigs") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *AuditConfig) MarshalJSON() ([]byte, error) {
type NoMethod AuditConfig
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// AuditLogConfig: Provides the configuration for logging a type of
// permissions.
// Example:
//
// {
// "audit_log_configs": [
// {
// "log_type": "DATA_READ",
// "exempted_members": [
// "user:foo@gmail.com"
// ]
// },
// {
// "log_type": "DATA_WRITE",
// }
// ]
// }
//
// This enables 'DATA_READ' and 'DATA_WRITE' logging, while
// exempting
// foo@gmail.com from DATA_READ logging.
type AuditLogConfig struct {
// ExemptedMembers: Specifies the identities that do not cause logging
// for this type of
// permission.
// Follows the same format of Binding.members.
ExemptedMembers []string `json:"exemptedMembers,omitempty"`
// LogType: The log type that this config enables.
//
// Possible values:
// "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
// "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
// "DATA_WRITE" - Data writes. Example: CloudSQL Users create
// "DATA_READ" - Data reads. Example: CloudSQL Users list
LogType string `json:"logType,omitempty"`
// ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ExemptedMembers") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
type NoMethod AuditLogConfig
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// AuthorizationLoggingOptions: Authorization-related information used
// by Cloud Audit Logging.
type AuthorizationLoggingOptions struct {
// PermissionType: The type of the permission that was checked.
//
// Possible values:
// "PERMISSION_TYPE_UNSPECIFIED" - Default. Should not be used.
// "ADMIN_READ" - A read of admin (meta) data.
// "ADMIN_WRITE" - A write of admin (meta) data.
// "DATA_READ" - A read of standard data.
// "DATA_WRITE" - A write of standard data.
PermissionType string `json:"permissionType,omitempty"`
// ForceSendFields is a list of field names (e.g. "PermissionType") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "PermissionType") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *AuthorizationLoggingOptions) MarshalJSON() ([]byte, error) {
type NoMethod AuthorizationLoggingOptions
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Binding: Associates `members` with a `role`.
type Binding struct {
// Condition: The condition that is associated with this binding.
// NOTE: An unsatisfied condition will not allow user access via
// current
// binding. Different bindings, including their conditions, are
// examined
// independently.
Condition *Expr `json:"condition,omitempty"`
// Members: Specifies the identities requesting access for a Cloud
// Platform resource.
// `members` can have the following values:
//
// * `allUsers`: A special identifier that represents anyone who is
// on the internet; with or without a Google account.
//
// * `allAuthenticatedUsers`: A special identifier that represents
// anyone
// who is authenticated with a Google account or a service
// account.
//
// * `user:{emailid}`: An email address that represents a specific
// Google
// account. For example, `alice@gmail.com` .
//
//
// * `serviceAccount:{emailid}`: An email address that represents a
// service
// account. For example,
// `my-other-app@appspot.gserviceaccount.com`.
//
// * `group:{emailid}`: An email address that represents a Google
// group.
// For example, `admins@example.com`.
//
//
// * `domain:{domain}`: The G Suite domain (primary) that represents all
// the
// users of that domain. For example, `google.com` or
// `example.com`.
//
//
Members []string `json:"members,omitempty"`
// Role: Role that is assigned to `members`.
// For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
Role string `json:"role,omitempty"`
// ForceSendFields is a list of field names (e.g. "Condition") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Condition") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Binding) MarshalJSON() ([]byte, error) {
type NoMethod Binding
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CancelOperationRequest: The request message for
// Operations.CancelOperation.
type CancelOperationRequest struct {
}
// CloudAuditOptions: Write a Cloud Audit log
type CloudAuditOptions struct {
// AuthorizationLoggingOptions: Information used by the Cloud Audit
// Logging pipeline.
AuthorizationLoggingOptions *AuthorizationLoggingOptions `json:"authorizationLoggingOptions,omitempty"`
// LogName: The log_name to populate in the Cloud Audit Record.
//
// Possible values:
// "UNSPECIFIED_LOG_NAME" - Default. Should not be used.
// "ADMIN_ACTIVITY" - Corresponds to
// "cloudaudit.googleapis.com/activity"
// "DATA_ACCESS" - Corresponds to
// "cloudaudit.googleapis.com/data_access"
LogName string `json:"logName,omitempty"`
// ForceSendFields is a list of field names (e.g.
// "AuthorizationLoggingOptions") to unconditionally include in API
// requests. By default, fields with empty values are omitted from API
// requests. However, any non-pointer, non-interface field appearing in
// ForceSendFields will be sent to the server regardless of whether the
// field is empty or not. This may be used to include empty fields in
// Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g.
// "AuthorizationLoggingOptions") to include in API requests with the
// JSON null value. By default, fields with empty values are omitted
// from API requests. However, any field with an empty value appearing
// in NullFields will be sent to the server as null. It is an error if a
// field in this list has a non-empty value. This may be used to include
// null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *CloudAuditOptions) MarshalJSON() ([]byte, error) {
type NoMethod CloudAuditOptions
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Condition: A condition to be met.
type Condition struct {
// Iam: Trusted attributes supplied by the IAM system.
//
// Possible values:
// "NO_ATTR" - Default non-attribute.
// "AUTHORITY" - Either principal or (if present) authority selector.
// "ATTRIBUTION" - The principal (even if an authority selector is
// present), which
// must only be used for attribution, not authorization.
// "SECURITY_REALM" - Any of the security realms in the IAMContext
// (go/security-realms).
// When used with IN, the condition indicates "any of the request's
// realms
// match one of the given values; with NOT_IN, "none of the realms
// match
// any of the given values". Note that a value can be:
// - 'self' (i.e., allow connections from clients that are in the same
// security realm)
// - a realm (e.g., 'campus-abc')
// - a realm group (e.g., 'realms-for-borg-cell-xx', see:
// go/realm-groups)
// A match is determined by a realm group
// membership check performed by a RealmAclRep object
// (go/realm-acl-howto).
// It is not permitted to grant access based on the *absence* of a
// realm, so
// realm conditions can only be used in a "positive" context (e.g.,
// ALLOW/IN
// or DENY/NOT_IN).
// "APPROVER" - An approver (distinct from the requester) that has
// authorized this
// request.
// When used with IN, the condition indicates that one of the
// approvers
// associated with the request matches the specified principal, or is
// a
// member of the specified group. Approvers can only grant
// additional
// access, and are thus only used in a strictly positive context
// (e.g. ALLOW/IN or DENY/NOT_IN).
// "JUSTIFICATION_TYPE" - What types of justifications have been
// supplied with this request.
// String values should match enum names from
// tech.iam.JustificationType,
// e.g. "MANUAL_STRING". It is not permitted to grant access based
// on
// the *absence* of a justification, so justification conditions can
// only
// be used in a "positive" context (e.g., ALLOW/IN or
// DENY/NOT_IN).
//
// Multiple justifications, e.g., a Buganizer ID and a
// manually-entered
// reason, are normal and supported.
// "CREDENTIALS_TYPE" - What type of credentials have been supplied
// with this request.
// String values should match enum names
// from
// security_loas_l2.CredentialsType - currently, only
// CREDS_TYPE_EMERGENCY
// is supported.
// It is not permitted to grant access based on the *absence* of
// a
// credentials type, so the conditions can only be used in a
// "positive"
// context (e.g., ALLOW/IN or DENY/NOT_IN).
Iam string `json:"iam,omitempty"`
// Op: An operator to apply the subject with.
//
// Possible values:
// "NO_OP" - Default no-op.
// "EQUALS" - DEPRECATED. Use IN instead.
// "NOT_EQUALS" - DEPRECATED. Use NOT_IN instead.
// "IN" - The condition is true if the subject (or any element of it
// if it is
// a set) matches any of the supplied values.
// "NOT_IN" - The condition is true if the subject (or every element
// of it if it is
// a set) matches none of the supplied values.
// "DISCHARGED" - Subject is discharged
Op string `json:"op,omitempty"`
// Svc: Trusted attributes discharged by the service.
Svc string `json:"svc,omitempty"`
// Sys: Trusted attributes supplied by any service that owns resources
// and uses
// the IAM system for access control.
//
// Possible values:
// "NO_ATTR" - Default non-attribute type
// "REGION" - Region of the resource
// "SERVICE" - Service name
// "NAME" - Resource name
// "IP" - IP address of the caller
Sys string `json:"sys,omitempty"`
// Values: The objects of the condition.
Values []string `json:"values,omitempty"`
// ForceSendFields is a list of field names (e.g. "Iam") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Iam") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Condition) MarshalJSON() ([]byte, error) {
type NoMethod Condition
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CounterOptions: Increment a streamz counter with the specified metric
// and field names.
//
// Metric names should start with a '/', generally be
// lowercase-only,
// and end in "_count". Field names should not contain an initial
// slash.
// The actual exported metric names will have "/iam/policy"
// prepended.
//
// Field names correspond to IAM request parameters and field values
// are
// their respective values.
//
// Supported field names:
// - "authority", which is "[token]" if IAMContext.token is present,
// otherwise the value of IAMContext.authority_selector if present,
// and
// otherwise a representation of IAMContext.principal; or
// - "iam_principal", a representation of IAMContext.principal even
// if a
// token or authority selector is present; or
// - "" (empty string), resulting in a counter with no
// fields.
//
// Examples:
// counter { metric: "/debug_access_count" field: "iam_principal" }
// ==> increment counter /iam/policy/backend_debug_access_count
// {iam_principal=[value of
// IAMContext.principal]}
//
// At this time we do not support multiple field names (though this may
// be
// supported in the future).
type CounterOptions struct {
// Field: The field value to attribute.
Field string `json:"field,omitempty"`
// Metric: The metric to update.
Metric string `json:"metric,omitempty"`
// ForceSendFields is a list of field names (e.g. "Field") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Field") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *CounterOptions) MarshalJSON() ([]byte, error) {
type NoMethod CounterOptions
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DataAccessOptions: Write a Data Access (Gin) log
type DataAccessOptions struct {
// LogMode: Whether Gin logging should happen in a fail-closed manner at
// the caller.
// This is relevant only in the LocalIAM implementation, for now.
//
// Possible values:
// "LOG_MODE_UNSPECIFIED" - Client is not required to write a partial
// Gin log immediately after
// the authorization check. If client chooses to write one and it
// fails,
// client may either fail open (allow the operation to continue) or
// fail closed (handle as a DENY outcome).
// "LOG_FAIL_CLOSED" - The application's operation in the context of
// which this authorization
// check is being made may only be performed if it is successfully
// logged
// to Gin. For instance, the authorization library may satisfy
// this
// obligation by emitting a partial log entry at authorization check
// time
// and only returning ALLOW to the application if it succeeds.
//
// If a matching Rule has this directive, but the client has not
// indicated
// that it will honor such requirements, then the IAM check will result
// in
// authorization failure by setting CheckPolicyResponse.success=false.
LogMode string `json:"logMode,omitempty"`
// ForceSendFields is a list of field names (e.g. "LogMode") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "LogMode") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DataAccessOptions) MarshalJSON() ([]byte, error) {
type NoMethod DataAccessOptions
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Empty: A generic empty message that you can re-use to avoid defining
// duplicated
// empty messages in your APIs. A typical example is to use it as the
// request
// or the response type of an API method. For instance:
//
// service Foo {
// rpc Bar(google.protobuf.Empty) returns
// (google.protobuf.Empty);
// }
//
// The JSON representation for `Empty` is empty JSON object `{}`.
type Empty struct {
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
}
// Expr: Represents an expression text. Example:
//
// title: "User account presence"
// description: "Determines whether the request has a user account"
// expression: "size(request.user) > 0"
type Expr struct {
// Description: An optional description of the expression. This is a
// longer text which
// describes the expression, e.g. when hovered over it in a UI.
Description string `json:"description,omitempty"`
// Expression: Textual representation of an expression in
// Common Expression Language syntax.
//
// The application context of the containing message determines
// which
// well-known feature set of CEL is supported.
Expression string `json:"expression,omitempty"`
// Location: An optional string indicating the location of the
// expression for error
// reporting, e.g. a file name and a position in the file.
Location string `json:"location,omitempty"`
// Title: An optional title for the expression, i.e. a short string
// describing
// its purpose. This can be used e.g. in UIs which allow to enter
// the
// expression.
Title string `json:"title,omitempty"`
// ForceSendFields is a list of field names (e.g. "Description") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Description") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Expr) MarshalJSON() ([]byte, error) {
type NoMethod Expr
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Instance: Represents a Data Fusion instance.
type Instance struct {
// CreateTime: Output only. The time the instance was created.
CreateTime string `json:"createTime,omitempty"`
// Description: An optional description of this instance.
Description string `json:"description,omitempty"`
// DisplayName: Display name for an instance.
DisplayName string `json:"displayName,omitempty"`
// EnableStackdriverLogging: Option to enable Stackdriver Logging.
EnableStackdriverLogging bool `json:"enableStackdriverLogging,omitempty"`
// EnableStackdriverMonitoring: Option to enable Stackdriver Monitoring.
EnableStackdriverMonitoring bool `json:"enableStackdriverMonitoring,omitempty"`
// Labels: The resource labels for instance to use to annotate any
// related underlying
// resources such as GCE VMs. The character '=' is not allowed to be
// used
// within the labels.
Labels map[string]string `json:"labels,omitempty"`
// Name: Output only. The name of this instance is in the form
// of
// projects/{project}/locations/{location}/instances/{instance}.
Name string `json:"name,omitempty"`
// NetworkConfig: Network configuration options. These are required when
// a private Data
// Fusion instance is to be created.
NetworkConfig *NetworkConfig `json:"networkConfig,omitempty"`
// Options: Map of additional options used to configure the behavior
// of
// Data Fusion instance.
Options map[string]string `json:"options,omitempty"`
// PrivateInstance: Specifies whether the Data Fusion instance should be
// private. If set to
// true, all Data Fusion nodes will have private IP addresses and will
// not be
// able to access the public internet.
PrivateInstance bool `json:"privateInstance,omitempty"`
// ServiceAccount: Output only. Service account which will be used to
// access resources in
// the customer project."
ServiceAccount string `json:"serviceAccount,omitempty"`
// ServiceEndpoint: Output only. Endpoint on which the Data Fusion UI
// and REST APIs are
// accessible.
ServiceEndpoint string `json:"serviceEndpoint,omitempty"`
// State: Output only. The current state of this Data Fusion instance.
//
// Possible values:
// "STATE_UNSPECIFIED" - Instance does not have a state yet
// "CREATING" - Instance is being created
// "RUNNING" - Instance is running and ready for requests
// "FAILED" - Instance creation failed
// "DELETING" - Instance is being deleted
// "UPGRADING" - Instance is being upgraded
// "RESTARTING" - Instance is being restarted
// "UPDATING" - Instance is being updated
State string `json:"state,omitempty"`
// StateMessage: Output only. Additional information about the current
// state of this Data
// Fusion instance if available.
StateMessage string `json:"stateMessage,omitempty"`
// Type: Required. Instance type.
//
// Possible values:
// "TYPE_UNSPECIFIED" - No type specified. The instance creation will
// fail.
// "BASIC" - Basic Data Fusion instance. In Basic type, the user will
// be able to
// create data pipelines using point and click UI. However, there
// are
// certain limitations, such as fewer number of concurrent pipelines,
// no
// support for streaming pipelines, etc.
// "ENTERPRISE" - Enterprise Data Fusion instance. In Enterprise type,
// the user will have
// more features available, such as support for streaming pipelines,
// higher
// number of concurrent pipelines, etc.
Type string `json:"type,omitempty"`
// UpdateTime: Output only. The time the instance was last updated.
UpdateTime string `json:"updateTime,omitempty"`
// Version: Output only. Current version of the Data Fusion.
Version string `json:"version,omitempty"`
// Zone: Name of the zone in which the Data Fusion instance will be
// created.
Zone string `json:"zone,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "CreateTime") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CreateTime") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Instance) MarshalJSON() ([]byte, error) {
type NoMethod Instance
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListInstancesResponse: Response message for the list instance
// request.
type ListInstancesResponse struct {
// Instances: Represents a list of Data Fusion instances.
Instances []*Instance `json:"instances,omitempty"`
// NextPageToken: Token to retrieve the next page of results or empty if
// there are no more
// results in the list.
NextPageToken string `json:"nextPageToken,omitempty"`
// Unreachable: Locations that could not be reached.
Unreachable []string `json:"unreachable,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Instances") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Instances") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListInstancesResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListInstancesResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListLocationsResponse: The response message for
// Locations.ListLocations.
type ListLocationsResponse struct {
// Locations: A list of locations that matches the specified filter in
// the request.
Locations []*Location `json:"locations,omitempty"`
// NextPageToken: The standard List next-page token.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Locations") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Locations") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListLocationsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListOperationsResponse: The response message for
// Operations.ListOperations.
type ListOperationsResponse struct {
// NextPageToken: The standard List next-page token.
NextPageToken string `json:"nextPageToken,omitempty"`
// Operations: A list of operations that matches the specified filter in
// the request.
Operations []*Operation `json:"operations,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "NextPageToken") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "NextPageToken") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListOperationsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Location: A resource that represents Google Cloud Platform location.
type Location struct {
// DisplayName: The friendly name for this location, typically a nearby
// city name.
// For example, "Tokyo".
DisplayName string `json:"displayName,omitempty"`
// Labels: Cross-service attributes for the location. For example
//
// {"cloud.googleapis.com/region": "us-east1"}
Labels map[string]string `json:"labels,omitempty"`
// LocationId: The canonical id for this location. For example:
// "us-east1".
LocationId string `json:"locationId,omitempty"`
// Metadata: Service-specific metadata. For example the available
// capacity at the given
// location.
Metadata googleapi.RawMessage `json:"metadata,omitempty"`
// Name: Resource name for the location, which may vary between
// implementations.
// For example: "projects/example-project/locations/us-east1"
Name string `json:"name,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "DisplayName") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DisplayName") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Location) MarshalJSON() ([]byte, error) {
type NoMethod Location
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// LogConfig: Specifies what kind of log the caller must write
type LogConfig struct {
// CloudAudit: Cloud audit options.
CloudAudit *CloudAuditOptions `json:"cloudAudit,omitempty"`
// Counter: Counter options.
Counter *CounterOptions `json:"counter,omitempty"`
// DataAccess: Data access options.
DataAccess *DataAccessOptions `json:"dataAccess,omitempty"`
// ForceSendFields is a list of field names (e.g. "CloudAudit") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CloudAudit") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LogConfig) MarshalJSON() ([]byte, error) {
type NoMethod LogConfig
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// NetworkConfig: Network configuration for a Data Fusion instance.
// These configurations
// are used for peering with the customer network. Configurations are
// optional
// when a public Data Fusion instance is to be created. However,
// providing
// these configurations allows several benefits, such as reduced network
// latency
// while accessing the customer resources from managed Data Fusion
// instance
// nodes, as well as access to the customer on-prem resources.
type NetworkConfig struct {
// IpAllocation: The IP range in CIDR notation to use for the managed
// Data Fusion instance
// nodes. This range must not overlap with any other ranges used in the
// Data
// Fusion instance network.
IpAllocation string `json:"ipAllocation,omitempty"`
// Network: Name of the network in the customer project with which the
// Tenant Project
// will be peered for executing pipelines.
Network string `json:"network,omitempty"`
// ForceSendFields is a list of field names (e.g. "IpAllocation") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "IpAllocation") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *NetworkConfig) MarshalJSON() ([]byte, error) {
type NoMethod NetworkConfig
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Operation: This resource represents a long-running operation that is
// the result of a
// network API call.
type Operation struct {
// Done: If the value is `false`, it means the operation is still in
// progress.
// If `true`, the operation is completed, and either `error` or
// `response` is
// available.
Done bool `json:"done,omitempty"`
// Error: The error result of the operation in case of failure or
// cancellation.
Error *Status `json:"error,omitempty"`
// Metadata: Service-specific metadata associated with the operation.
// It typically
// contains progress information and common metadata such as create
// time.
// Some services might not provide such metadata. Any method that
// returns a
// long-running operation should document the metadata type, if any.
Metadata googleapi.RawMessage `json:"metadata,omitempty"`
// Name: The server-assigned name, which is only unique within the same
// service that
// originally returns it. If you use the default HTTP mapping,
// the
// `name` should be a resource name ending with
// `operations/{unique_id}`.
Name string `json:"name,omitempty"`
// Response: The normal response of the operation in case of success.
// If the original
// method returns no data on success, such as `Delete`, the response
// is
// `google.protobuf.Empty`. If the original method is
// standard
// `Get`/`Create`/`Update`, the response should be the resource. For
// other
// methods, the response should have the type `XxxResponse`, where
// `Xxx`
// is the original method name. For example, if the original method
// name
// is `TakeSnapshot()`, the inferred response type
// is
// `TakeSnapshotResponse`.
Response googleapi.RawMessage `json:"response,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Done") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Done") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Operation) MarshalJSON() ([]byte, error) {
type NoMethod Operation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// OperationMetadata: Represents the metadata of a long-running
// operation.
type OperationMetadata struct {
// ApiVersion: API version used to start the operation.
ApiVersion string `json:"apiVersion,omitempty"`
// CreateTime: The time the operation was created.
CreateTime string `json:"createTime,omitempty"`
// EndTime: The time the operation finished running.
EndTime string `json:"endTime,omitempty"`
// RequestedCancellation: Identifies whether the user has requested
// cancellation
// of the operation. Operations that have successfully been
// cancelled
// have Operation.error value with a google.rpc.Status.code of
// 1,
// corresponding to `Code.CANCELLED`.
RequestedCancellation bool `json:"requestedCancellation,omitempty"`
// StatusDetail: Human-readable status of the operation if any.
StatusDetail string `json:"statusDetail,omitempty"`
// Target: Server-defined resource path for the target of the operation.
Target string `json:"target,omitempty"`
// Verb: Name of the verb executed by the operation.
Verb string `json:"verb,omitempty"`
// ForceSendFields is a list of field names (e.g. "ApiVersion") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ApiVersion") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *OperationMetadata) MarshalJSON() ([]byte, error) {
type NoMethod OperationMetadata
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Policy: Defines an Identity and Access Management (IAM) policy. It is
// used to
// specify access control policies for Cloud Platform resources.
//
//
// A `Policy` consists of a list of `bindings`. A `binding` binds a list
// of
// `members` to a `role`, where the members can be user accounts, Google
// groups,
// Google domains, and service accounts. A `role` is a named list of
// permissions
// defined by IAM.
//
// **JSON Example**
//
// {
// "bindings": [
// {
// "role": "roles/owner",
// "members": [
// "user:mike@example.com",
// "group:admins@example.com",
// "domain:google.com",
//
// "serviceAccount:my-other-app@appspot.gserviceaccount.com"
// ]
// },
// {
// "role": "roles/viewer",
// "members": ["user:sean@example.com"]
// }
// ]
// }
//
// **YAML Example**
//
// bindings:
// - members:
// - user:mike@example.com
// - group:admins@example.com
// - domain:google.com
// - serviceAccount:my-other-app@appspot.gserviceaccount.com
// role: roles/owner
// - members:
// - user:sean@example.com
// role: roles/viewer
//
//
// For a description of IAM and its features, see the
// [IAM developer's guide](https://cloud.google.com/iam/docs).
type Policy struct {
// AuditConfigs: Specifies cloud audit logging configuration for this
// policy.
AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
// Bindings: Associates a list of `members` to a `role`.
// `bindings` with no members will result in an error.
Bindings []*Binding `json:"bindings,omitempty"`
// Etag: `etag` is used for optimistic concurrency control as a way to
// help
// prevent simultaneous updates of a policy from overwriting each
// other.
// It is strongly suggested that systems make use of the `etag` in
// the
// read-modify-write cycle to perform policy updates in order to avoid
// race
// conditions: An `etag` is returned in the response to `getIamPolicy`,
// and
// systems are expected to put that etag in the request to
// `setIamPolicy` to
// ensure that their change will be applied to the same version of the
// policy.
//
// If no `etag` is provided in the call to `setIamPolicy`, then the
// existing
// policy is overwritten blindly.
Etag string `json:"etag,omitempty"`
IamOwned bool `json:"iamOwned,omitempty"`
// Rules: If more than one rule is specified, the rules are applied in
// the following
// manner:
// - All matching LOG rules are always applied.
// - If any DENY/DENY_WITH_LOG rule matches, permission is denied.
// Logging will be applied if one or more matching rule requires
// logging.
// - Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is
// granted.
// Logging will be applied if one or more matching rule requires
// logging.
// - Otherwise, if no rule applies, permission is denied.
Rules []*Rule `json:"rules,omitempty"`
// Version: Deprecated.
Version int64 `json:"version,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "AuditConfigs") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AuditConfigs") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Policy) MarshalJSON() ([]byte, error) {
type NoMethod Policy
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// RestartInstanceRequest: Request message for restarting a Data Fusion
// instance.
type RestartInstanceRequest struct {
}
// Rule: A rule to be applied in a Policy.
type Rule struct {
// Action: Required
//
// Possible values:
// "NO_ACTION" - Default no action.
// "ALLOW" - Matching 'Entries' grant access.
// "ALLOW_WITH_LOG" - Matching 'Entries' grant access and the caller
// promises to log
// the request per the returned log_configs.
// "DENY" - Matching 'Entries' deny access.
// "DENY_WITH_LOG" - Matching 'Entries' deny access and the caller
// promises to log
// the request per the returned log_configs.
// "LOG" - Matching 'Entries' tell IAM.Check callers to generate logs.
Action string `json:"action,omitempty"`
// Conditions: Additional restrictions that must be met. All conditions
// must pass for the
// rule to match.
Conditions []*Condition `json:"conditions,omitempty"`
// Description: Human-readable description of the rule.
Description string `json:"description,omitempty"`
// In: If one or more 'in' clauses are specified, the rule matches
// if
// the PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries.
In []string `json:"in,omitempty"`
// LogConfig: The config returned to callers of tech.iam.IAM.CheckPolicy
// for any entries
// that match the LOG action.
LogConfig []*LogConfig `json:"logConfig,omitempty"`
// NotIn: If one or more 'not_in' clauses are specified, the rule
// matches
// if the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries.
// The format for in and not_in entries can be found at in the Local
// IAM
// documentation (see go/local-iam#features).
NotIn []string `json:"notIn,omitempty"`
// Permissions: A permission is a string of form '<service>.<resource
// type>.<verb>'
// (e.g., 'storage.buckets.list'). A value of '*' matches all
// permissions,
// and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.
Permissions []string `json:"permissions,omitempty"`
// ForceSendFields is a list of field names (e.g. "Action") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Action") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Rule) MarshalJSON() ([]byte, error) {
type NoMethod Rule
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// SetIamPolicyRequest: Request message for `SetIamPolicy` method.
type SetIamPolicyRequest struct {
// Policy: REQUIRED: The complete policy to be applied to the
// `resource`. The size of
// the policy is limited to a few 10s of KB. An empty policy is a
// valid policy but certain Cloud Platform services (such as
// Projects)
// might reject them.
Policy *Policy `json:"policy,omitempty"`
// UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
// policy to modify. Only
// the fields in the mask will be modified. If no mask is provided,
// the
// following default mask is used:
// paths: "bindings, etag"
// This field is only used by Cloud IAM.
UpdateMask string `json:"updateMask,omitempty"`
// ForceSendFields is a list of field names (e.g. "Policy") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Policy") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
type NoMethod SetIamPolicyRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Status: The `Status` type defines a logical error model that is
// suitable for
// different programming environments, including REST APIs and RPC APIs.
// It is
// used by [gRPC](https://github.com/grpc). Each `Status` message
// contains
// three pieces of data: error code, error message, and error
// details.
//
// You can find out more about this error model and how to work with it
// in the
// [API Design Guide](https://cloud.google.com/apis/design/errors).
type Status struct {
// Code: The status code, which should be an enum value of
// google.rpc.Code.
Code int64 `json:"code,omitempty"`
// Details: A list of messages that carry the error details. There is a
// common set of
// message types for APIs to use.
Details []googleapi.RawMessage `json:"details,omitempty"`
// Message: A developer-facing error message, which should be in
// English. Any
// user-facing error message should be localized and sent in
// the
// google.rpc.Status.details field, or localized by the client.
Message string `json:"message,omitempty"`
// ForceSendFields is a list of field names (e.g. "Code") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Code") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Status) MarshalJSON() ([]byte, error) {
type NoMethod Status
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// TestIamPermissionsRequest: Request message for `TestIamPermissions`
// method.
type TestIamPermissionsRequest struct {
// Permissions: The set of permissions to check for the `resource`.
// Permissions with
// wildcards (such as '*' or 'storage.*') are not allowed. For
// more
// information see
// [IAM
// Overview](https://cloud.google.com/iam/docs/overview#permissions).
Permissions []string `json:"permissions,omitempty"`
// ForceSendFields is a list of field names (e.g. "Permissions") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Permissions") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
type NoMethod TestIamPermissionsRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// TestIamPermissionsResponse: Response message for `TestIamPermissions`
// method.
type TestIamPermissionsResponse struct {
// Permissions: A subset of `TestPermissionsRequest.permissions` that
// the caller is
// allowed.
Permissions []string `json:"permissions,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Permissions") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Permissions") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
type NoMethod TestIamPermissionsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// UpgradeInstanceRequest: Request message for upgrading a Data Fusion
// instance.
// To change the instance properties, instance update should be used.
type UpgradeInstanceRequest struct {
}
// method id "datafusion.projects.locations.get":
type ProjectsLocationsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets information about a location.
func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.get" call.
// Exactly one of *Location or error will be non-nil. Any non-2xx status
// code is an error. Response headers are in either
// *Location.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Location{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets information about a location.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}",
// "httpMethod": "GET",
// "id": "datafusion.projects.locations.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Resource name for the location.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}",
// "response": {
// "$ref": "Location"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.list":
type ProjectsLocationsListCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists information about the supported locations for this
// service.
func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Filter sets the optional parameter "filter": The standard list
// filter.
func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
c.urlParams_.Set("filter", filter)
return c
}
// PageSize sets the optional parameter "pageSize": The standard list
// page size.
func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The standard list
// page token.
func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}/locations")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.list" call.
// Exactly one of *ListLocationsResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *ListLocationsResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ListLocationsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists information about the supported locations for this service.",
// "flatPath": "v1beta1/projects/{projectsId}/locations",
// "httpMethod": "GET",
// "id": "datafusion.projects.locations.list",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "filter": {
// "description": "The standard list filter.",
// "location": "query",
// "type": "string"
// },
// "name": {
// "description": "The resource that owns the locations collection, if applicable.",
// "location": "path",
// "pattern": "^projects/[^/]+$",
// "required": true,
// "type": "string"
// },
// "pageSize": {
// "description": "The standard list page size.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The standard list page token.",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}/locations",
// "response": {
// "$ref": "ListLocationsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "datafusion.projects.locations.instances.create":
type ProjectsLocationsInstancesCreateCall struct {
s *Service
parent string
instance *Instance
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Creates a new Data Fusion instance in the specified project
// and location.
func (r *ProjectsLocationsInstancesService) Create(parent string, instance *Instance) *ProjectsLocationsInstancesCreateCall {
c := &ProjectsLocationsInstancesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
c.instance = instance
return c
}
// InstanceId sets the optional parameter "instanceId": The name of the
// instance to create.
func (c *ProjectsLocationsInstancesCreateCall) InstanceId(instanceId string) *ProjectsLocationsInstancesCreateCall {
c.urlParams_.Set("instanceId", instanceId)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesCreateCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesCreateCall) Context(ctx context.Context) *ProjectsLocationsInstancesCreateCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.instance)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/instances")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.create" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsInstancesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Creates a new Data Fusion instance in the specified project and location.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances",
// "httpMethod": "POST",
// "id": "datafusion.projects.locations.instances.create",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "instanceId": {
// "description": "The name of the instance to create.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "The instance's project and location in the format\nprojects/{project}/locations/{location}.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+parent}/instances",
// "request": {
// "$ref": "Instance"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.instances.delete":
type ProjectsLocationsInstancesDeleteCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes a single Date Fusion instance.
func (r *ProjectsLocationsInstancesService) Delete(name string) *ProjectsLocationsInstancesDeleteCall {
c := &ProjectsLocationsInstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesDeleteCall) Context(ctx context.Context) *ProjectsLocationsInstancesDeleteCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("DELETE", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.delete" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsInstancesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Deletes a single Date Fusion instance.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}",
// "httpMethod": "DELETE",
// "id": "datafusion.projects.locations.instances.delete",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "The instance resource name in the format\nprojects/{project}/locations/{location}/instances/{instance}",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.instances.get":
type ProjectsLocationsInstancesGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets details of a single Data Fusion instance.
func (r *ProjectsLocationsInstancesService) Get(name string) *ProjectsLocationsInstancesGetCall {
c := &ProjectsLocationsInstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ProjectsLocationsInstancesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesGetCall) Context(ctx context.Context) *ProjectsLocationsInstancesGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.get" call.
// Exactly one of *Instance or error will be non-nil. Any non-2xx status
// code is an error. Response headers are in either
// *Instance.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsInstancesGetCall) Do(opts ...googleapi.CallOption) (*Instance, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Instance{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets details of a single Data Fusion instance.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}",
// "httpMethod": "GET",
// "id": "datafusion.projects.locations.instances.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "The instance resource name in the format\nprojects/{project}/locations/{location}/instances/{instance}.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}",
// "response": {
// "$ref": "Instance"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.instances.getIamPolicy":
type ProjectsLocationsInstancesGetIamPolicyCall struct {
s *Service
resource string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// GetIamPolicy: Gets the access control policy for a resource.
// Returns an empty policy if the resource exists and does not have a
// policy
// set.
func (r *ProjectsLocationsInstancesService) GetIamPolicy(resource string) *ProjectsLocationsInstancesGetIamPolicyCall {
c := &ProjectsLocationsInstancesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.resource = resource
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesGetIamPolicyCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ProjectsLocationsInstancesGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesGetIamPolicyCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsInstancesGetIamPolicyCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesGetIamPolicyCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:getIamPolicy")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.getIamPolicy" call.
// Exactly one of *Policy or error will be non-nil. Any non-2xx status
// code is an error. Response headers are in either
// *Policy.ServerResponse.Header or (if a response was returned at all)
// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified
// was returned.
func (c *ProjectsLocationsInstancesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Policy{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:getIamPolicy",
// "httpMethod": "GET",
// "id": "datafusion.projects.locations.instances.getIamPolicy",
// "parameterOrder": [
// "resource"
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+resource}:getIamPolicy",
// "response": {
// "$ref": "Policy"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.instances.list":
type ProjectsLocationsInstancesListCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists Data Fusion instances in the specified project and
// location.
func (r *ProjectsLocationsInstancesService) List(parent string) *ProjectsLocationsInstancesListCall {
c := &ProjectsLocationsInstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// Filter sets the optional parameter "filter": List filter.
func (c *ProjectsLocationsInstancesListCall) Filter(filter string) *ProjectsLocationsInstancesListCall {
c.urlParams_.Set("filter", filter)
return c
}
// OrderBy sets the optional parameter "orderBy": Sort results.
// Supported values are "name", "name desc", or "" (unsorted).
func (c *ProjectsLocationsInstancesListCall) OrderBy(orderBy string) *ProjectsLocationsInstancesListCall {
c.urlParams_.Set("orderBy", orderBy)
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number
// of items to return.
func (c *ProjectsLocationsInstancesListCall) PageSize(pageSize int64) *ProjectsLocationsInstancesListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The
// next_page_token value to use if there are additional
// results to retrieve for this list request.
func (c *ProjectsLocationsInstancesListCall) PageToken(pageToken string) *ProjectsLocationsInstancesListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ProjectsLocationsInstancesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesListCall) Context(ctx context.Context) *ProjectsLocationsInstancesListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/instances")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.list" call.
// Exactly one of *ListInstancesResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *ListInstancesResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ProjectsLocationsInstancesListCall) Do(opts ...googleapi.CallOption) (*ListInstancesResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ListInstancesResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists Data Fusion instances in the specified project and location.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances",
// "httpMethod": "GET",
// "id": "datafusion.projects.locations.instances.list",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "filter": {
// "description": "List filter.",
// "location": "query",
// "type": "string"
// },
// "orderBy": {
// "description": "Sort results. Supported values are \"name\", \"name desc\", or \"\" (unsorted).",
// "location": "query",
// "type": "string"
// },
// "pageSize": {
// "description": "The maximum number of items to return.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The next_page_token value to use if there are additional\nresults to retrieve for this list request.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "The project and location for which to retrieve instance information\nin the format projects/{project}/locations/{location}. If the location is\nspecified as '-' (wildcard), then all regions available to the project\nare queried, and the results are aggregated.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+parent}/instances",
// "response": {
// "$ref": "ListInstancesResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsLocationsInstancesListCall) Pages(ctx context.Context, f func(*ListInstancesResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "datafusion.projects.locations.instances.patch":
type ProjectsLocationsInstancesPatchCall struct {
s *Service
name string
instance *Instance
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Patch: Updates a single Data Fusion instance.
func (r *ProjectsLocationsInstancesService) Patch(name string, instance *Instance) *ProjectsLocationsInstancesPatchCall {
c := &ProjectsLocationsInstancesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.instance = instance
return c
}
// UpdateMask sets the optional parameter "updateMask": Field mask is
// used to specify the fields that the update will overwrite
// in an instance resource. The fields specified in the update_mask
// are
// relative to the resource, not the full request.
// A field will be overwritten if it is in the mask.
// If the user does not provide a mask, all the supported fields (labels
// and
// options currently) will be overwritten.
func (c *ProjectsLocationsInstancesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsInstancesPatchCall {
c.urlParams_.Set("updateMask", updateMask)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesPatchCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesPatchCall) Context(ctx context.Context) *ProjectsLocationsInstancesPatchCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesPatchCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.instance)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("PATCH", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.patch" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsInstancesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Updates a single Data Fusion instance.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}",
// "httpMethod": "PATCH",
// "id": "datafusion.projects.locations.instances.patch",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Output only. The name of this instance is in the form of\nprojects/{project}/locations/{location}/instances/{instance}.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
// "required": true,
// "type": "string"
// },
// "updateMask": {
// "description": "Field mask is used to specify the fields that the update will overwrite\nin an instance resource. The fields specified in the update_mask are\nrelative to the resource, not the full request.\nA field will be overwritten if it is in the mask.\nIf the user does not provide a mask, all the supported fields (labels and\noptions currently) will be overwritten.",
// "format": "google-fieldmask",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}",
// "request": {
// "$ref": "Instance"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.instances.restart":
type ProjectsLocationsInstancesRestartCall struct {
s *Service
name string
restartinstancerequest *RestartInstanceRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Restart: Restart a single Data Fusion instance.
// At the end of an operation instance is fully restarted.
func (r *ProjectsLocationsInstancesService) Restart(name string, restartinstancerequest *RestartInstanceRequest) *ProjectsLocationsInstancesRestartCall {
c := &ProjectsLocationsInstancesRestartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.restartinstancerequest = restartinstancerequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesRestartCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesRestartCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesRestartCall) Context(ctx context.Context) *ProjectsLocationsInstancesRestartCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesRestartCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesRestartCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.restartinstancerequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:restart")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.restart" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsInstancesRestartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Restart a single Data Fusion instance.\nAt the end of an operation instance is fully restarted.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:restart",
// "httpMethod": "POST",
// "id": "datafusion.projects.locations.instances.restart",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Name of the Data Fusion instance which need to be restarted in the form of\nprojects/{project}/locations/{location}/instances/{instance}",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}:restart",
// "request": {
// "$ref": "RestartInstanceRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.instances.setIamPolicy":
type ProjectsLocationsInstancesSetIamPolicyCall struct {
s *Service
resource string
setiampolicyrequest *SetIamPolicyRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// SetIamPolicy: Sets the access control policy on the specified
// resource. Replaces any
// existing policy.
func (r *ProjectsLocationsInstancesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsInstancesSetIamPolicyCall {
c := &ProjectsLocationsInstancesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.resource = resource
c.setiampolicyrequest = setiampolicyrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesSetIamPolicyCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsInstancesSetIamPolicyCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesSetIamPolicyCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:setIamPolicy")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.setIamPolicy" call.
// Exactly one of *Policy or error will be non-nil. Any non-2xx status
// code is an error. Response headers are in either
// *Policy.ServerResponse.Header or (if a response was returned at all)
// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified
// was returned.
func (c *ProjectsLocationsInstancesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Policy{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:setIamPolicy",
// "httpMethod": "POST",
// "id": "datafusion.projects.locations.instances.setIamPolicy",
// "parameterOrder": [
// "resource"
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+resource}:setIamPolicy",
// "request": {
// "$ref": "SetIamPolicyRequest"
// },
// "response": {
// "$ref": "Policy"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.instances.testIamPermissions":
type ProjectsLocationsInstancesTestIamPermissionsCall struct {
s *Service
resource string
testiampermissionsrequest *TestIamPermissionsRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// TestIamPermissions: Returns permissions that a caller has on the
// specified resource.
// If the resource does not exist, this will return an empty set
// of
// permissions, not a NOT_FOUND error.
//
// Note: This operation is designed to be used for building
// permission-aware
// UIs and command-line tools, not for authorization checking. This
// operation
// may "fail open" without warning.
func (r *ProjectsLocationsInstancesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsInstancesTestIamPermissionsCall {
c := &ProjectsLocationsInstancesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.resource = resource
c.testiampermissionsrequest = testiampermissionsrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesTestIamPermissionsCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsInstancesTestIamPermissionsCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesTestIamPermissionsCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:testIamPermissions")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.testIamPermissions" call.
// Exactly one of *TestIamPermissionsResponse or error will be non-nil.
// Any non-2xx status code is an error. Response headers are in either
// *TestIamPermissionsResponse.ServerResponse.Header or (if a response
// was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ProjectsLocationsInstancesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &TestIamPermissionsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:testIamPermissions",
// "httpMethod": "POST",
// "id": "datafusion.projects.locations.instances.testIamPermissions",
// "parameterOrder": [
// "resource"
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+resource}:testIamPermissions",
// "request": {
// "$ref": "TestIamPermissionsRequest"
// },
// "response": {
// "$ref": "TestIamPermissionsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.instances.upgrade":
type ProjectsLocationsInstancesUpgradeCall struct {
s *Service
name string
upgradeinstancerequest *UpgradeInstanceRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Upgrade: Upgrade a single Data Fusion instance.
// At the end of an operation instance is fully upgraded.
func (r *ProjectsLocationsInstancesService) Upgrade(name string, upgradeinstancerequest *UpgradeInstanceRequest) *ProjectsLocationsInstancesUpgradeCall {
c := &ProjectsLocationsInstancesUpgradeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.upgradeinstancerequest = upgradeinstancerequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsInstancesUpgradeCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesUpgradeCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsInstancesUpgradeCall) Context(ctx context.Context) *ProjectsLocationsInstancesUpgradeCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsInstancesUpgradeCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsInstancesUpgradeCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.upgradeinstancerequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:upgrade")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.instances.upgrade" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsInstancesUpgradeCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Upgrade a single Data Fusion instance.\nAt the end of an operation instance is fully upgraded.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:upgrade",
// "httpMethod": "POST",
// "id": "datafusion.projects.locations.instances.upgrade",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Name of the Data Fusion instance which need to be upgraded in the form of\nprojects/{project}/locations/{location}/instances/{instance}\nInstance will be upgraded with the latest stable version of the Data\nFusion.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}:upgrade",
// "request": {
// "$ref": "UpgradeInstanceRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.operations.cancel":
type ProjectsLocationsOperationsCancelCall struct {
s *Service
name string
canceloperationrequest *CancelOperationRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Cancel: Starts asynchronous cancellation on a long-running operation.
// The server
// makes a best effort to cancel the operation, but success is
// not
// guaranteed. If the server doesn't support this method, it
// returns
// `google.rpc.Code.UNIMPLEMENTED`. Clients can
// use
// Operations.GetOperation or
// other methods to check whether the cancellation succeeded or whether
// the
// operation completed despite cancellation. On successful
// cancellation,
// the operation is not deleted; instead, it becomes an operation
// with
// an Operation.error value with a google.rpc.Status.code of
// 1,
// corresponding to `Code.CANCELLED`.
func (r *ProjectsLocationsOperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *ProjectsLocationsOperationsCancelCall {
c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.canceloperationrequest = canceloperationrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:cancel")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.operations.cancel" call.
// Exactly one of *Empty or error will be non-nil. Any non-2xx status
// code is an error. Response headers are in either
// *Empty.ServerResponse.Header or (if a response was returned at all)
// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified
// was returned.
func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Empty{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}:cancel",
// "httpMethod": "POST",
// "id": "datafusion.projects.locations.operations.cancel",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "The name of the operation resource to be cancelled.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}:cancel",
// "request": {
// "$ref": "CancelOperationRequest"
// },
// "response": {
// "$ref": "Empty"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.operations.delete":
type ProjectsLocationsOperationsDeleteCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes a long-running operation. This method indicates that
// the client is
// no longer interested in the operation result. It does not cancel
// the
// operation. If the server doesn't support this method, it
// returns
// `google.rpc.Code.UNIMPLEMENTED`.
func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("DELETE", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.operations.delete" call.
// Exactly one of *Empty or error will be non-nil. Any non-2xx status
// code is an error. Response headers are in either
// *Empty.ServerResponse.Header or (if a response was returned at all)
// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified
// was returned.
func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Empty{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
// "httpMethod": "DELETE",
// "id": "datafusion.projects.locations.operations.delete",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "The name of the operation resource to be deleted.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}",
// "response": {
// "$ref": "Empty"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.operations.get":
type ProjectsLocationsOperationsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets the latest state of a long-running operation. Clients can
// use this
// method to poll the operation result at intervals as recommended by
// the API
// service.
func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.operations.get" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
// "httpMethod": "GET",
// "id": "datafusion.projects.locations.operations.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "The name of the operation resource.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "datafusion.projects.locations.operations.list":
type ProjectsLocationsOperationsListCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists operations that match the specified filter in the
// request. If the
// server doesn't support this method, it returns
// `UNIMPLEMENTED`.
//
// NOTE: the `name` binding allows API services to override the
// binding
// to use different resource name schemes, such as `users/*/operations`.
// To
// override the binding, API services can add a binding such
// as
// "/v1/{name=users/*}/operations" to their service configuration.
// For backwards compatibility, the default name includes the
// operations
// collection id, however overriding users must ensure the name
// binding
// is the parent resource, without the operations collection id.
func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Filter sets the optional parameter "filter": The standard list
// filter.
func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("filter", filter)
return c
}
// PageSize sets the optional parameter "pageSize": The standard list
// page size.
func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The standard list
// page token.
func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190924")
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}/operations")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "datafusion.projects.locations.operations.list" call.
// Exactly one of *ListOperationsResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *ListOperationsResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ListOperationsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
// "flatPath": "v1beta1/projects/{projectsId}/locations/{locationsId}/operations",
// "httpMethod": "GET",
// "id": "datafusion.projects.locations.operations.list",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "filter": {
// "description": "The standard list filter.",
// "location": "query",
// "type": "string"
// },
// "name": {
// "description": "The name of the operation's parent resource.",
// "location": "path",
// "pattern": "^projects/[^/]+/locations/[^/]+$",
// "required": true,
// "type": "string"
// },
// "pageSize": {
// "description": "The standard list page size.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The standard list page token.",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1beta1/{+name}/operations",
// "response": {
// "$ref": "ListOperationsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
|
pushbullet/engineer
|
vendor/google.golang.org/api/datafusion/v1beta1/datafusion-gen.go
|
GO
|
mit
| 150,488
|
/* eslint-disable comma-style, operator-linebreak, space-unary-ops, no-multi-spaces, key-spacing, indent */
'use strict'
const analyzeHoldem = require('./lib/holdem')
/**
* Analyzes a given PokerHand which has been parsed by the HandHistory Parser hhp.
* Relative player positions are calculated, i.e. cutoff, button, etc.
* Players are included in order of action on flop.
*
* The analyzed hand then can be visualized by [hhv](https://github.com/thlorenz/hhv).
*
* For an example of an analyzed hand please view [json output of an analyzed
* hand](https://github.com/thlorenz/hhv/blob/master/test/fixtures/holdem/actiononall.json).
*
* @name analyze
* @function
* @param {object} hand hand history as parsed by [hhp](https://github.com/thlorenz/hhp)
* @return {object} the analyzed hand
*/
exports = module.exports = function analyze(hand) {
if (!hand.info) throw new Error('Hand is missing info')
if (hand.info.pokertype === 'holdem') return analyzeHoldem(hand)
}
exports.script = require('./lib/script')
exports.storyboard = require('./lib/storyboard')
exports.summary = require('./lib/summary')
exports.strategicPositions = require('./lib/strategic-positions').list
function wasActive(x) {
return x.preflop[0] && x.preflop[0].type !== 'fold'
}
/**
* Filters all players who didn't act in the hand or just folded.
*
* @name filterInactives
* @function
* @param {Array.<Object>} players all players in the hand
* @return {Array.<Object>} all players that were active in the hand
*/
exports.filterInactives = function filterInactives(players) {
if (players == null) return []
return players.filter(wasActive)
}
|
thlorenz/hha
|
hha.js
|
JavaScript
|
mit
| 1,658
|
# win32-samples
|
tim-weis/win32-samples
|
README.md
|
Markdown
|
mit
| 15
|
import { h, render, rerender, Component } from '../../src/preact';
let { expect } = chai;
/*eslint-env browser, mocha */
/*global sinon, chai*/
/** @jsx h */
describe('render()', () => {
let scratch;
before( () => {
scratch = document.createElement('div');
(document.body || document.documentElement).appendChild(scratch);
});
beforeEach( () => {
scratch.innerHTML = '';
});
after( () => {
scratch.parentNode.removeChild(scratch);
scratch = null;
});
it('should create empty nodes (<* />)', () => {
render(<div />, scratch);
expect(scratch.childNodes)
.to.have.length(1)
.and.to.have.deep.property('0.nodeName', 'DIV');
scratch.innerHTML = '';
render(<span />, scratch);
expect(scratch.childNodes)
.to.have.length(1)
.and.to.have.deep.property('0.nodeName', 'SPAN');
scratch.innerHTML = '';
render(<foo />, scratch);
render(<x-bar />, scratch);
expect(scratch.childNodes).to.have.length(2);
expect(scratch.childNodes[0]).to.have.property('nodeName', 'FOO');
expect(scratch.childNodes[1]).to.have.property('nodeName', 'X-BAR');
});
it('should nest empty nodes', () => {
render((
<div>
<span />
<foo />
<x-bar />
</div>
), scratch);
expect(scratch.childNodes)
.to.have.length(1)
.and.to.have.deep.property('0.nodeName', 'DIV');
let c = scratch.childNodes[0].childNodes;
expect(c).to.have.length(3);
expect(c).to.have.deep.property('0.nodeName', 'SPAN');
expect(c).to.have.deep.property('1.nodeName', 'FOO');
expect(c).to.have.deep.property('2.nodeName', 'X-BAR');
});
it('should apply string attributes', () => {
render(<div foo="bar" data-foo="databar" />, scratch);
let div = scratch.childNodes[0];
expect(div).to.have.deep.property('attributes.length', 2);
expect(div).to.have.deep.property('attributes[0].name', 'foo');
expect(div).to.have.deep.property('attributes[0].value', 'bar');
expect(div).to.have.deep.property('attributes[1].name', 'data-foo');
expect(div).to.have.deep.property('attributes[1].value', 'databar');
});
it('should apply class as String', () => {
render(<div class="foo" />, scratch);
expect(scratch.childNodes[0]).to.have.property('className', 'foo');
});
it('should alias className to class', () => {
render(<div className="bar" />, scratch);
expect(scratch.childNodes[0]).to.have.property('className', 'bar');
});
it('should apply style as String', () => {
render(<div style="top:5px; position:relative;" />, scratch);
expect(scratch.childNodes[0]).to.have.deep.property('style.cssText')
.that.matches(/top\s*:\s*5px\s*/)
.and.matches(/position\s*:\s*relative\s*/);
});
it('should only register on* functions as handlers', () => {
let click = () => {},
onclick = () => {};
let proto = document.createElement('div').constructor.prototype;
sinon.spy(proto, 'addEventListener');
render(<div click={ click } onClick={ onclick } />, scratch);
expect(scratch.childNodes[0]).to.have.deep.property('attributes.length', 0);
expect(proto.addEventListener).to.have.been.calledOnce
.and.to.have.been.calledWithExactly('click', sinon.match.func);
proto.addEventListener.restore();
});
it('should serialize style objects', () => {
render(<div style={{
color: 'rgb(255, 255, 255)',
background: 'rgb(255, 100, 0)',
backgroundPosition: '0 0',
'background-size': 'cover',
padding: 5,
top: 100,
left: '100%'
}} />, scratch);
let { style } = scratch.childNodes[0];
expect(style).to.have.property('color', 'rgb(255, 255, 255)');
expect(style).to.have.property('background').that.contains('rgb(255, 100, 0)');
expect(style).to.have.property('backgroundPosition').that.matches(/0(px)? 0(px)?/);
expect(style).to.have.property('backgroundSize', 'cover');
expect(style).to.have.property('padding', '5px');
expect(style).to.have.property('top', '100px');
expect(style).to.have.property('left', '100%');
});
it('should serialize class/className', () => {
render(<div class={{
no1: false,
no2: 0,
no3: null,
no4: undefined,
no5: '',
yes1: true,
yes2: 1,
yes3: {},
yes4: [],
yes5: ' '
}} />, scratch);
let { className } = scratch.childNodes[0];
expect(className).to.be.a.string;
expect(className.split(' '))
.to.include.members(['yes1', 'yes2', 'yes3', 'yes4', 'yes5'])
.and.not.include.members(['no1', 'no2', 'no3', 'no4', 'no5']);
});
it('should reconcile mutated DOM attributes', () => {
let check = p => render(<input type="checkbox" checked={p} />, scratch, scratch.lastChild),
value = () => scratch.lastChild.checked,
setValue = p => scratch.lastChild.checked = p;
check(true);
expect(value()).to.equal(true);
check(false);
expect(value()).to.equal(false);
check(true);
expect(value()).to.equal(true);
setValue(true);
check(false);
expect(value()).to.equal(false);
setValue(false);
check(true);
expect(value()).to.equal(true);
});
it('should render components', () => {
class C1 extends Component {
render() {
return <div>C1</div>;
}
}
sinon.spy(C1.prototype, 'render');
render(<C1 />, scratch);
expect(C1.prototype.render)
.to.have.been.calledOnce
.and.to.have.been.calledWithMatch({}, {})
.and.to.have.returned(sinon.match({ nodeName:'div' }));
expect(scratch.innerHTML).to.equal('<div>C1</div>');
});
it('should render components with props', () => {
const PROPS = { foo:'bar', onBaz:()=>{} };
let constructorProps;
class C2 extends Component {
constructor(props) {
super(props);
constructorProps = props;
}
render(props) {
return <div {...props} />;
}
}
sinon.spy(C2.prototype, 'render');
render(<C2 {...PROPS} />, scratch);
expect(constructorProps).to.deep.equal(PROPS);
expect(C2.prototype.render)
.to.have.been.calledOnce
.and.to.have.been.calledWithMatch(PROPS, {})
.and.to.have.returned(sinon.match({
nodeName: 'div',
attributes: PROPS
}));
expect(scratch.innerHTML).to.equal('<div foo="bar"></div>');
});
it('should render functional components', () => {
const PROPS = { foo:'bar', onBaz:()=>{} };
const C3 = sinon.spy( props => <div {...props} /> );
render(<C3 {...PROPS} />, scratch);
expect(C3)
.to.have.been.calledOnce
.and.to.have.been.calledWithExactly(PROPS)
.and.to.have.returned(sinon.match({
nodeName: 'div',
attributes: PROPS
}));
expect(scratch.innerHTML).to.equal('<div foo="bar"></div>');
});
it('should render nested functional components', () => {
const PROPS = { foo:'bar', onBaz:()=>{} };
const Outer = sinon.spy(
props => <Inner {...props} />
);
const Inner = sinon.spy(
props => <div {...props}>inner</div>
);
render(<Outer {...PROPS} />, scratch);
expect(Outer)
.to.have.been.calledOnce
.and.to.have.been.calledWithExactly(PROPS)
.and.to.have.returned(sinon.match({
nodeName: Inner,
attributes: PROPS
}));
expect(Inner)
.to.have.been.calledOnce
.and.to.have.been.calledWithExactly(PROPS)
.and.to.have.returned(sinon.match({
nodeName: 'div',
attributes: PROPS,
children: ['inner']
}));
expect(scratch.innerHTML).to.equal('<div foo="bar">inner</div>');
});
it('should re-render nested functional components', () => {
let doRender = null;
class Outer extends Component {
componentDidMount() {
let i = 1;
doRender = () => this.setState({ i: ++i });
}
componentWillUnmount() {}
render(props, { i }) {
return <Inner i={i} {...props} />;
}
}
sinon.spy(Outer.prototype, 'render');
sinon.spy(Outer.prototype, 'componentWillUnmount');
let j = 0;
const Inner = sinon.spy(
props => <div j={ ++j } {...props}>inner</div>
);
render(<Outer foo="bar" />, scratch);
// update & flush
doRender();
rerender();
expect(Outer.prototype.componentWillUnmount)
.not.to.have.been.called;
expect(Inner).to.have.been.calledTwice;
expect(Inner.secondCall)
.to.have.been.calledWithExactly({ foo:'bar', i:2 })
.and.to.have.returned(sinon.match({
attributes: {
j: 2,
i: 2,
foo: 'bar'
}
}));
expect(scratch.innerHTML).to.equal('<div j="2" foo="bar" i="2">inner</div>');
// update & flush
doRender();
rerender();
expect(Inner).to.have.been.calledThrice;
expect(Inner.thirdCall)
.to.have.been.calledWithExactly({ foo:'bar', i:3 })
.and.to.have.returned(sinon.match({
attributes: {
j: 3,
i: 3,
foo: 'bar'
}
}));
expect(scratch.innerHTML).to.equal('<div j="3" foo="bar" i="3">inner</div>');
});
it('should re-render nested components', () => {
let doRender = null;
class Outer extends Component {
componentDidMount() {
let i = 1;
doRender = () => this.setState({ i: ++i });
}
componentWillUnmount() {}
render(props, { i }) {
return <Inner i={i} {...props} />;
}
}
sinon.spy(Outer.prototype, 'render');
sinon.spy(Outer.prototype, 'componentDidMount');
sinon.spy(Outer.prototype, 'componentWillUnmount');
let j = 0;
class Inner extends Component {
constructor(...args) {
super();
this._constructor(...args);
}
_constructor() {}
componentDidMount() {}
componentWillUnmount() {}
render(props) {
return <div j={ ++j } {...props}>inner</div>;
}
}
sinon.spy(Inner.prototype, '_constructor');
sinon.spy(Inner.prototype, 'render');
sinon.spy(Inner.prototype, 'componentDidMount');
sinon.spy(Inner.prototype, 'componentWillUnmount');
render(<Outer foo="bar" />, scratch);
expect(Outer.prototype.componentDidMount).to.have.been.calledOnce;
// update & flush
doRender();
rerender();
expect(Outer.prototype.componentWillUnmount).not.to.have.been.called;
expect(Inner.prototype._constructor).to.have.been.calledOnce;
expect(Inner.prototype.componentWillUnmount).not.to.have.been.called;
expect(Inner.prototype.componentDidMount).to.have.been.calledOnce;
expect(Inner.prototype.render).to.have.been.calledTwice;
expect(Inner.prototype.render.secondCall)
.to.have.been.calledWith({ foo:'bar', i:2 })
.and.to.have.returned(sinon.match({
attributes: {
j: 2,
i: 2,
foo: 'bar'
}
}));
expect(scratch.innerHTML).to.equal('<div j="2" foo="bar" i="2">inner</div>');
// update & flush
doRender();
rerender();
expect(Inner.prototype.componentWillUnmount).not.to.have.been.called;
expect(Inner.prototype.componentDidMount).to.have.been.calledOnce;
expect(Inner.prototype.render).to.have.been.calledThrice;
expect(Inner.prototype.render.thirdCall)
.to.have.been.calledWith({ foo:'bar', i:3 })
.and.to.have.returned(sinon.match({
attributes: {
j: 3,
i: 3,
foo: 'bar'
}
}));
expect(scratch.innerHTML).to.equal('<div j="3" foo="bar" i="3">inner</div>');
});
});
|
okmttdhr/preact-fork
|
test/browser/render.js
|
JavaScript
|
mit
| 10,825
|
/*
* Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "core/rendering/InlineBox.h"
#include "core/rendering/InlineFlowBox.h"
#include "core/rendering/PaintInfo.h"
#include "core/rendering/RenderBlockFlow.h"
#include "core/rendering/RootInlineBox.h"
#include "platform/Partitions.h"
#include "platform/fonts/FontMetrics.h"
#ifndef NDEBUG
#include <stdio.h>
#endif
using namespace std;
namespace WebCore {
struct SameSizeAsInlineBox {
virtual ~SameSizeAsInlineBox() { }
void* a[4];
FloatPoint b;
float c;
uint32_t d : 32;
#ifndef NDEBUG
bool f;
#endif
};
COMPILE_ASSERT(sizeof(InlineBox) == sizeof(SameSizeAsInlineBox), InlineBox_size_guard);
#ifndef NDEBUG
InlineBox::~InlineBox()
{
if (!m_hasBadParent && m_parent)
m_parent->setHasBadChildList();
}
#endif
void InlineBox::remove()
{
if (parent())
parent()->removeChild(this);
}
void* InlineBox::operator new(size_t sz)
{
return partitionAlloc(Partitions::getRenderingPartition(), sz);
}
void InlineBox::operator delete(void* ptr)
{
partitionFree(ptr);
}
#ifndef NDEBUG
const char* InlineBox::boxName() const
{
return "InlineBox";
}
void InlineBox::showTreeForThis() const
{
if (m_renderer)
m_renderer->showTreeForThis();
}
void InlineBox::showLineTreeForThis() const
{
if (m_renderer)
m_renderer->containingBlock()->showLineTreeAndMark(this, "*");
}
void InlineBox::showLineTreeAndMark(const InlineBox* markedBox1, const char* markedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const RenderObject* obj, int depth) const
{
int printedCharacters = 0;
if (this == markedBox1)
printedCharacters += fprintf(stderr, "%s", markedLabel1);
if (this == markedBox2)
printedCharacters += fprintf(stderr, "%s", markedLabel2);
if (renderer() == obj)
printedCharacters += fprintf(stderr, "*");
for (; printedCharacters < depth * 2; printedCharacters++)
fputc(' ', stderr);
showBox(printedCharacters);
}
void InlineBox::showBox(int printedCharacters) const
{
printedCharacters += fprintf(stderr, "%s\t%p", boxName(), this);
for (; printedCharacters < showTreeCharacterOffset; printedCharacters++)
fputc(' ', stderr);
fprintf(stderr, "\t%s %p\n", renderer() ? renderer()->renderName() : "No Renderer", renderer());
}
#endif
float InlineBox::logicalHeight() const
{
if (hasVirtualLogicalHeight())
return virtualLogicalHeight();
if (renderer()->isText())
return m_bitfields.isText() ? renderer()->style(isFirstLineStyle())->fontMetrics().height() : 0;
if (renderer()->isBox() && parent())
return isHorizontal() ? toRenderBox(m_renderer)->height() : toRenderBox(m_renderer)->width();
ASSERT(isInlineFlowBox());
RenderBoxModelObject* flowObject = boxModelObject();
const FontMetrics& fontMetrics = renderer()->style(isFirstLineStyle())->fontMetrics();
float result = fontMetrics.height();
if (parent())
result += flowObject->borderAndPaddingLogicalHeight();
return result;
}
int InlineBox::baselinePosition(FontBaseline baselineType) const
{
return boxModelObject()->baselinePosition(baselineType, m_bitfields.firstLine(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine);
}
LayoutUnit InlineBox::lineHeight() const
{
return boxModelObject()->lineHeight(m_bitfields.firstLine(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine);
}
int InlineBox::caretMinOffset() const
{
return m_renderer->caretMinOffset();
}
int InlineBox::caretMaxOffset() const
{
return m_renderer->caretMaxOffset();
}
void InlineBox::dirtyLineBoxes()
{
markDirty();
for (InlineFlowBox* curr = parent(); curr && !curr->isDirty(); curr = curr->parent())
curr->markDirty();
}
void InlineBox::deleteLine()
{
if (!m_bitfields.extracted() && m_renderer->isBox())
toRenderBox(m_renderer)->setInlineBoxWrapper(0);
destroy();
}
void InlineBox::extractLine()
{
m_bitfields.setExtracted(true);
if (m_renderer->isBox())
toRenderBox(m_renderer)->setInlineBoxWrapper(0);
}
void InlineBox::attachLine()
{
m_bitfields.setExtracted(false);
if (m_renderer->isBox())
toRenderBox(m_renderer)->setInlineBoxWrapper(this);
}
void InlineBox::adjustPosition(float dx, float dy)
{
m_topLeft.move(dx, dy);
if (m_renderer->isReplaced())
toRenderBox(m_renderer)->move(dx, dy);
}
void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
{
if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection))
return;
LayoutPoint childPoint = paintOffset;
if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
childPoint = renderer()->containingBlock()->flipForWritingModeForChild(toRenderBox(renderer()), childPoint);
RenderBlock::paintAsInlineBlock(renderer(), paintInfo, childPoint);
}
bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
{
// Hit test all phases of replaced elements atomically, as though the replaced element established its
// own stacking context. (See Appendix E.2, section 6.4 on inline block/table elements in the CSS2.1
// specification.)
LayoutPoint childPoint = accumulatedOffset;
if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
childPoint = renderer()->containingBlock()->flipForWritingModeForChild(toRenderBox(renderer()), childPoint);
return renderer()->hitTest(request, result, locationInContainer, childPoint);
}
const RootInlineBox* InlineBox::root() const
{
if (m_parent)
return m_parent->root();
ASSERT(isRootInlineBox());
return static_cast<const RootInlineBox*>(this);
}
RootInlineBox* InlineBox::root()
{
if (m_parent)
return m_parent->root();
ASSERT(isRootInlineBox());
return static_cast<RootInlineBox*>(this);
}
bool InlineBox::nextOnLineExists() const
{
if (!m_bitfields.determinedIfNextOnLineExists()) {
m_bitfields.setDeterminedIfNextOnLineExists(true);
if (!parent())
m_bitfields.setNextOnLineExists(false);
else if (nextOnLine())
m_bitfields.setNextOnLineExists(true);
else
m_bitfields.setNextOnLineExists(parent()->nextOnLineExists());
}
return m_bitfields.nextOnLineExists();
}
InlineBox* InlineBox::nextLeafChild() const
{
InlineBox* leaf = 0;
for (InlineBox* box = nextOnLine(); box && !leaf; box = box->nextOnLine())
leaf = box->isLeaf() ? box : toInlineFlowBox(box)->firstLeafChild();
if (!leaf && parent())
leaf = parent()->nextLeafChild();
return leaf;
}
InlineBox* InlineBox::prevLeafChild() const
{
InlineBox* leaf = 0;
for (InlineBox* box = prevOnLine(); box && !leaf; box = box->prevOnLine())
leaf = box->isLeaf() ? box : toInlineFlowBox(box)->lastLeafChild();
if (!leaf && parent())
leaf = parent()->prevLeafChild();
return leaf;
}
InlineBox* InlineBox::nextLeafChildIgnoringLineBreak() const
{
InlineBox* leaf = nextLeafChild();
if (leaf && leaf->isLineBreak())
return 0;
return leaf;
}
InlineBox* InlineBox::prevLeafChildIgnoringLineBreak() const
{
InlineBox* leaf = prevLeafChild();
if (leaf && leaf->isLineBreak())
return 0;
return leaf;
}
RenderObject::SelectionState InlineBox::selectionState()
{
return renderer()->selectionState();
}
bool InlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const
{
// Non-replaced elements can always accommodate an ellipsis.
if (!m_renderer || !m_renderer->isReplaced())
return true;
IntRect boxRect(left(), 0, m_logicalWidth, 10);
IntRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, ellipsisWidth, 10);
return !(boxRect.intersects(ellipsisRect));
}
float InlineBox::placeEllipsisBox(bool, float, float, float, float& truncatedWidth, bool&)
{
// Use -1 to mean "we didn't set the position."
truncatedWidth += logicalWidth();
return -1;
}
void InlineBox::clearKnownToHaveNoOverflow()
{
m_bitfields.setKnownToHaveNoOverflow(false);
if (parent() && parent()->knownToHaveNoOverflow())
parent()->clearKnownToHaveNoOverflow();
}
FloatPoint InlineBox::locationIncludingFlipping()
{
if (!renderer()->style()->isFlippedBlocksWritingMode())
return FloatPoint(x(), y());
RenderBlockFlow* block = root()->block();
if (block->style()->isHorizontalWritingMode())
return FloatPoint(x(), block->height() - height() - y());
else
return FloatPoint(block->width() - width() - x(), y());
}
void InlineBox::flipForWritingMode(FloatRect& rect)
{
if (!renderer()->style()->isFlippedBlocksWritingMode())
return;
root()->block()->flipForWritingMode(rect);
}
FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point)
{
if (!renderer()->style()->isFlippedBlocksWritingMode())
return point;
return root()->block()->flipForWritingMode(point);
}
void InlineBox::flipForWritingMode(LayoutRect& rect)
{
if (!renderer()->style()->isFlippedBlocksWritingMode())
return;
root()->block()->flipForWritingMode(rect);
}
LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point)
{
if (!renderer()->style()->isFlippedBlocksWritingMode())
return point;
return root()->block()->flipForWritingMode(point);
}
} // namespace WebCore
#ifndef NDEBUG
void showTree(const WebCore::InlineBox* b)
{
if (b)
b->showTreeForThis();
}
void showLineTree(const WebCore::InlineBox* b)
{
if (b)
b->showLineTreeForThis();
}
#endif
|
lordmos/blink
|
Source/core/rendering/InlineBox.cpp
|
C++
|
mit
| 10,882
|
<?php
/* OyatelCdrBundle:Default:index.html.twig */
class __TwigTemplate_fce6b668448a5b90084f0988441f2b64 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "
";
}
public function getTemplateName()
{
return "OyatelCdrBundle:Default:index.html.twig";
}
public function getDebugInfo()
{
return array ( 17 => 1,);
}
}
|
mehulsbhatt/cdr
|
app/cache/prod/twig/fc/e6/b668448a5b90084f0988441f2b64.php
|
PHP
|
mit
| 625
|
using System;
using System.Globalization;
#if UNIVERSAL
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml;
#else
using System.Windows;
using System.Windows.Data;
#endif
namespace Newport
{
public abstract class BaseConverter : DependencyObject, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return OnConvert(value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return OnConvertBack(value);
}
public object Convert(object value, Type targetType, object parameter, string culture)
{
return OnConvert(value);
}
public object ConvertBack(object value, Type targetType, object parameter, string culture)
{
return OnConvertBack(value);
}
protected abstract object OnConvert(object value);
protected abstract object OnConvertBack(object value);
}
}
|
z1c0/Newport
|
Newport/Converters/BaseConverter.cs
|
C#
|
mit
| 954
|
package dynamics.item;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public interface IMetaItem {
IIcon getIcon();
String getUnlocalizedName(ItemStack stack);
boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase player);
boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ);
ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player);
void registerIcons(IIconRegister iconRegister);
void addRecipe();
void addToCreativeList(Item item, int meta, List<ItemStack> result);
boolean hasEffect(int renderPass);
}
|
awesommist/DynamicLib
|
src/main/java/dynamics/item/IMetaItem.java
|
Java
|
mit
| 947
|
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
private:
ListNode* reverseList(ListNode* head) {
ListNode * reverse = NULL;
ListNode * node = head;
while (node) {
head = node->next;
node->next = reverse;
reverse = node;
node = head;
}
return reverse;
}
public:
void reorderList(ListNode* head) {
if (head == NULL || head->next == NULL) return;
ListNode* slow = head;
ListNode* fast = head;
ListNode* tmp = NULL;
while (fast->next != NULL && fast->next->next != NULL) {
fast = fast->next->next;
slow = slow->next;
}
fast = slow->next;
slow->next = NULL;
fast = reverseList(fast);
while (fast != NULL) {
slow = head->next;
head->next = fast;
fast = fast->next;
head->next->next = slow;
head = slow;
}
return;
}
};
|
hawkphantomnet/leetcode
|
ReorderList/Solution.cpp
|
C++
|
mit
| 1,125
|
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include "game/ui/general/loadingscreen.h"
#include "framework/configfile.h"
#include "framework/data.h"
#include "framework/framework.h"
#include "framework/renderer.h"
#include "game/state/gamestate.h"
#include "game/ui/battle/battleview.h"
#include "game/ui/city/cityview.h"
#include <algorithm>
#include <cmath>
namespace OpenApoc
{
ConfigOptionBool asyncLoading("Game", "ASyncLoading",
"Load in background while displaying animated loading screen", true);
LoadingScreen::LoadingScreen(std::future<void> task, std::function<sp<Stage>()> nextScreenFn,
sp<Image> background, int scaleDivisor, bool showRotatingImage)
: Stage(), loadingTask(std::move(task)), nextScreenFn(std::move(nextScreenFn)),
backgroundimage(background), showRotatingImage(showRotatingImage), scaleDivisor(scaleDivisor)
{
}
void LoadingScreen::begin()
{
// FIXME: This is now useless, as it doesn't actually load anything interesting here
if (showRotatingImage)
{
loadingimage = fw().data->loadImage("ui/loading.png");
}
if (!backgroundimage)
{
backgroundimage = fw().data->loadImage("ui/logo.png");
}
fw().displaySetIcon();
loadingimageangle = 0;
if (asyncLoading.get() == false)
{
loadingTask.wait();
}
}
void LoadingScreen::pause() {}
void LoadingScreen::resume() {}
void LoadingScreen::finish() {}
void LoadingScreen::eventOccurred(Event *e) { std::ignore = e; }
void LoadingScreen::update()
{
loadingimageangle += (float)(M_PI + 0.05f);
if (loadingimageangle >= (float)(M_PI * 2.0f))
loadingimageangle -= (float)(M_PI * 2.0f);
auto status = this->loadingTask.wait_for(std::chrono::seconds(0));
if (asyncLoading.get() == false)
{
LogAssert(status == std::future_status::ready);
}
switch (status)
{
case std::future_status::ready:
{
fw().stageQueueCommand({StageCmd::Command::REPLACE, nextScreenFn()});
return;
}
default:
// Not yet finished
return;
}
}
void LoadingScreen::render()
{
int logow = fw().displayGetWidth() / scaleDivisor;
int logoh = fw().displayGetHeight() / scaleDivisor;
float logoscw = logow / static_cast<float>(backgroundimage->size.x);
float logosch = logoh / static_cast<float>(backgroundimage->size.y);
float logosc = std::min(logoscw, logosch);
Vec2<float> logoPosition{fw().displayGetWidth() / 2 - (backgroundimage->size.x * logosc / 2),
fw().displayGetHeight() / 2 - (backgroundimage->size.y * logosc / 2)};
Vec2<float> logoSize{backgroundimage->size.x * logosc, backgroundimage->size.y * logosc};
fw().renderer->drawScaled(backgroundimage, logoPosition, logoSize);
if (loadingimage)
{
fw().renderer->drawRotated(
loadingimage, Vec2<float>{24, 24},
Vec2<float>{fw().displayGetWidth() - 50, fw().displayGetHeight() - 50},
loadingimageangle);
}
}
bool LoadingScreen::isTransition() { return false; }
}; // namespace OpenApoc
|
steveschnepp/OpenApoc
|
game/ui/general/loadingscreen.cpp
|
C++
|
mit
| 2,976
|
<?php
namespace System;
class Controller
{
const DEFINITIONS = null;
const VIEWS = null;
}
|
headcruser/blog
|
src/lib/Controller.php
|
PHP
|
mit
| 101
|
package com.suelake.habbo.moderation;
import java.util.Date;
import com.blunk.util.TimeHelper;
import com.suelake.habbo.communication.SerializableObject;
import com.suelake.habbo.communication.ServerMessage;
import com.suelake.habbo.spaces.Space;
import com.suelake.habbo.users.User;
/**
* CallForHelp represents a 'cry for help' submitted by a logged in User. Moderating Users are supposed to handle this CallForHelp and inform the calling User how to deal with the reported issue.
*
* @author Nillus
*/
public class CallForHelp implements SerializableObject
{
/**
* The database ID of this CallForHelp.
*/
public final int ID;
/**
* The User object of the calling user.
*/
private User m_sender;
/**
* The Space object representing
*/
private Space m_space;
/**
* The java.util.Date representing the moment this CallForHelp was sent.
*/
public final Date timeStamp;
/**
* The message (eg, 'The Hotel is on fire') sent by the calling User.
*/
public String text;
public CallForHelp(int callID)
{
this.ID = callID;
this.timeStamp = TimeHelper.getDateTime();
}
public void setSender(User usr)
{
m_sender = usr;
}
public User getSender()
{
return m_sender;
}
public void setSpace(Space space)
{
m_space = space;
}
public Space getSpace()
{
return m_space;
}
@Override
public void serialize(ServerMessage msg)
{
if (this.getSender() != null)
{
msg.appendNewArgument("User: " + this.getSender().name + " @ " + TimeHelper.formatDateTime(this.timeStamp));
msg.appendNewArgument(ModerationCenter.craftChatlogUrl(this.ID));
if (this.getSpace() != null)
{
msg.appendKV2Argument("id", Integer.toString(this.getSpace().ID));
msg.appendKV2Argument("name", "Space: \"" + this.getSpace().name + "\" (id: " + this.getSpace().ID + ", owner: " + this.getSpace().owner + ")");
msg.appendKV2Argument("type", (this.getSpace().isUserFlat()) ? "private" : "public");
msg.appendKV2Argument("port", "30000");
}
msg.appendKV2Argument("text", this.text);
}
}
}
|
Chnkr/Suelake
|
src/com/suelake/habbo/moderation/CallForHelp.java
|
Java
|
mit
| 2,056
|
<table width="90%" border="0"><tr><td><script>function openfile(url) {fullwin = window.open(url, "fulltext", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");}</script><div class="layoutclass_pic"><div class="layoutclass_first_pic"><table class="ztable"><tr><th class="ztd1"><b>成語 </b></th><td class="ztd2">伸眉吐氣</td></tr>
<tr><th class="ztd1"><b>注音 </b></th><td class="ztd2">ㄕㄣ ㄇㄟ<sup class="subfont">ˊ</sup> ㄊㄨ<sup class="subfont">ˇ</sup> ㄑ|<sup class="subfont">ˋ</sup></td></tr>
<tr><th class="ztd1"><b>漢語拼音 </b></th><td class="ztd2"><font class="english_word">shēn méi tǔ qì</font></td></tr>
<tr><th class="ztd1"><b>釋義 </b></th><td class="ztd2"> 義參「<a href="/cgi-bin/cydic/gsweb.cgi?o=dcydic&schfmt=text&gourl=%3De0%26sec%3Dsec1%26op%3Dsid%3D%22CW0000000956%22.%26v%3D-1" class="clink" target=_blank>揚眉吐氣</a>」。見「<a href="/cgi-bin/cydic/gsweb.cgi?o=dcydic&schfmt=text&gourl=%3De0%26sec%3Dsec1%26op%3Dsid%3D%22CW0000000956%22.%26v%3D-1" class="clink" target=_blank>揚眉吐氣</a>」條。</font></td></tr>
<tr><th class="ztd1"><b><style>.tableoutfmt2 .std1{width:3%;}</style></b></th><td class="ztd2"><table class="fmt16_table"><tr><td width=150 style="text-align:left;" class="fmt16_td1" ><b>參考詞語︰</b></td><td width=150 style="text-align:left;" class="fmt16_td2" ><a href="/cgi-bin/cydic/gsweb.cgi?o=dcydic&schfmt=text&gourl=%3De0%26sec%3Dsec1%26op%3Dsid%3D%22CW0000000956%22.%26v%3D-1" class="clink" target=_blank>揚眉吐氣</a></td></tr><tr><td width=150 style="text-align:left;" class="fmt16_td1" ><b>注音︰</b></td><td width=150 style="text-align:left;" class="fmt16_td2" >|ㄤ<sup class="subfont">ˊ</sup> ㄇㄟ<sup class="subfont">ˊ</sup> ㄊㄨ<sup class="subfont">ˇ</sup> ㄑ|<sup class="subfont">ˋ</sup></td></tr><tr><td width=150 style="text-align:left;" class="fmt16_td1" ><b>漢語拼音︰</b></td><td width=150 style="text-align:left;" class="fmt16_td2" ><font class="english_word">yáng méi tǔ qì</font></td></tr></table><br><br></td></tr>
</td></tr></table></div> <!-- layoutclass_first_pic --><div class="layoutclass_second_pic"></div> <!-- layoutclass_second_pic --></div> <!-- layoutclass_pic --></td></tr></table>
|
BuzzAcademy/idioms-moe-unformatted-data
|
all-data/2000-2999/2182-34.html
|
HTML
|
mit
| 2,311
|
@echo off
setlocal
set "SUFFIX_NAME=%~1"
for %%i in (CONTOOLS_ROOT) do (
if not defined %%i (
echo.%~nx0: error: `%%i` variable is not defined.
exit /b 255
) >&2
)
rem use stdout/stderr redirection with logging
call "%%CONTOOLS_ROOT%%\wmi\get_wmic_local_datetime.bat"
set "PROJECT_LOG_FILE_NAME_SUFFIX=%RETURN_VALUE:~0,4%'%RETURN_VALUE:~4,2%'%RETURN_VALUE:~6,2%_%RETURN_VALUE:~8,2%'%RETURN_VALUE:~10,2%'%RETURN_VALUE:~12,2%''%RETURN_VALUE:~15,3%"
set "PROJECT_LOG_DIR=%PROJECT_LOG_ROOT%\%PROJECT_LOG_FILE_NAME_SUFFIX%.%SUFFIX_NAME%"
set "PROJECT_LOG_FILE=%PROJECT_LOG_DIR%\%PROJECT_LOG_FILE_NAME_SUFFIX%.%SUFFIX_NAME%.log"
if not exist "%PROJECT_LOG_DIR%" ( mkdir "%PROJECT_LOG_DIR%" || exit /b )
(
endlocal
set "PROJECT_LOG_FILE_NAME_SUFFIX=%PROJECT_LOG_FILE_NAME_SUFFIX%"
set "PROJECT_LOG_DIR=%PROJECT_LOG_DIR%"
set "PROJECT_LOG_FILE=%PROJECT_LOG_FILE%"
exit /b 0
)
|
andry81/contools
|
Scripts/Tools/build/init_project_log.bat
|
Batchfile
|
mit
| 926
|
//
// WoIBMForecastDay.h
// IBMWeatherSensor
//
// Created by boland on 8/20/14.
// Copyright (c) 2014 mallocmedia. All rights reserved.
//
#import "WoIBMModel.h"
@interface WoIBMForecastDay : WoIBMModel
@property (nonatomic, copy) NSString *forecastDescription;
@property (nonatomic, copy) NSString *icon_url;
@property (nonatomic, copy) NSString *title;
@end
|
boland25/woibm
|
IBMWeatherSensor/Models/Features/WoIBMForecastDay.h
|
C
|
mit
| 369
|
//namespace Instinct.Collections.RoutedCommand
//{
// /// <summary>
// /// RoutedCommand
// /// </summary>
// public class RoutedCommand : ICommand
// {
// private byte _commandId;
// private string _name;
// private System.Type _ownerType;
// private System.Collections.Specialized.BitVector32 _privateVector = new System.Collections.Specialized.BitVector32();
// #region Class Types
// /// <summary>
// /// PrivateFlags
// /// </summary>
// private enum PrivateVectorIndex : byte
// {
// /// <summary>
// /// IsBlockedByRM
// /// </summary>
// IsBlockedByRM = 1
// }
// #endregion Class Types
// /// <summary>
// /// Initializes a new instance of the <see cref="RoutedCommand"/> class.
// /// </summary>
// public RoutedCommand()
// {
// _name = string.Empty;
// _ownerType = null;
// }
// /// <summary>
// /// Initializes a new instance of the <see cref="RoutedCommand"/> class.
// /// </summary>
// /// <param name="name">The name.</param>
// /// <param name="ownerType">Type of the owner.</param>
// public RoutedCommand(string name, System.Type ownerType)
// {
// if ((name == null) || (name.Length == 0))
// {
// throw new ArgumentNullException("name");
// }
// if (ownerType == null)
// {
// throw new ArgumentNullException("ownerType");
// }
// _name = name;
// _ownerType = ownerType;
// }
// /// <summary>
// /// Initializes a new instance of the <see cref="RoutedCommand"/> class.
// /// </summary>
// /// <param name="name">The name.</param>
// /// <param name="ownerType">Type of the owner.</param>
// /// <param name="commandId">The command id.</param>
// internal RoutedCommand(string name, System.Type ownerType, byte commandId)
// : this(name, ownerType)
// {
// _commandId = commandId;
// }
// /// <summary>
// /// Occurs when [can execute changed].
// /// </summary>
// public event System.EventHandler CanExecuteChanged
// {
// add { CommandManager.RequerySuggested += value; }
// remove { CommandManager.RequerySuggested -= value; }
// }
// /// <summary>
// /// Determines whether this instance can execute the specified parameter.
// /// </summary>
// /// <param name="parameter">The parameter.</param>
// /// <param name="target">The target.</param>
// /// <returns>
// /// <c>true</c> if this instance can execute the specified parameter; otherwise, <c>false</c>.
// /// </returns>
// public bool CanExecute(object parameter, IInputElement target)
// {
// bool flag;
// return CriticalCanExecute(parameter, target, false, out flag);
// }
// private bool CanExecuteImpl(object parameter, IInputElement target, bool trusted, out bool continueRouting)
// {
// if ((target != null) && !this.IsBlockedByRM)
// {
// CanExecuteRoutedEventArgs args = new CanExecuteRoutedEventArgs(this, parameter);
// args.RoutedEvent = CommandManager.PreviewCanExecuteEvent;
// this.CriticalCanExecuteWrapper(parameter, target, trusted, args);
// if (!args.Handled)
// {
// args.RoutedEvent = CommandManager.CanExecuteEvent;
// this.CriticalCanExecuteWrapper(parameter, target, trusted, args);
// }
// continueRouting = args.ContinueRouting;
// return args.CanExecute;
// }
// continueRouting = false;
// return false;
// }
// internal bool CriticalCanExecute(object parameter, IInputElement target, bool trusted, out bool continueRouting)
// {
// if ((target != null) && !InputElement.IsValid(target))
// {
// throw new InvalidOperationException(TR.Get("Invalid_IInputElement", new object[] { target.GetType() }));
// }
// if (target == null)
// {
// target = FilterInputElement(Keyboard.FocusedElement);
// }
// return CanExecuteImpl(parameter, target, trusted, out continueRouting);
// }
// private void CriticalCanExecuteWrapper(object parameter, IInputElement target, bool trusted, CanExecuteRoutedEventArgs args)
// {
// DependencyObject o = (DependencyObject)target;
// if (InputElement.IsUIElement(o))
// {
// ((UIElement)o).RaiseEvent(args, trusted);
// }
// else if (InputElement.IsContentElement(o))
// {
// ((ContentElement)o).RaiseEvent(args, trusted);
// }
// else if (InputElement.IsUIElement3D(o))
// {
// ((UIElement3D)o).RaiseEvent(args, trusted);
// }
// }
// public void Execute(object parameter, IInputElement target)
// {
// if ((target != null) && !InputElement.IsValid(target))
// {
// throw new InvalidOperationException(TR.Get("Invalid_IInputElement", new object[] { target.GetType() }));
// }
// if (target == null)
// {
// target = FilterInputElement(Keyboard.FocusedElement);
// }
// this.ExecuteImpl(parameter, target, false);
// }
// internal bool ExecuteCore(object parameter, IInputElement target, bool userInitiated)
// {
// if (target == null)
// {
// target = FilterInputElement(Keyboard.FocusedElement);
// }
// return this.ExecuteImpl(parameter, target, userInitiated);
// }
// private bool ExecuteImpl(object parameter, IInputElement target, bool userInitiated)
// {
// if ((target == null) || this.IsBlockedByRM)
// {
// return false;
// }
// UIElement element2 = target as UIElement;
// ContentElement element = null;
// UIElement3D elementd = null;
// ExecutedRoutedEventArgs args = new ExecutedRoutedEventArgs(this, parameter);
// args.RoutedEvent = CommandManager.PreviewExecutedEvent;
// if (element2 != null)
// {
// element2.RaiseEvent(args, userInitiated);
// }
// else
// {
// element = target as ContentElement;
// if (element != null)
// {
// element.RaiseEvent(args, userInitiated);
// }
// else
// {
// elementd = target as UIElement3D;
// if (elementd != null)
// {
// elementd.RaiseEvent(args, userInitiated);
// }
// }
// }
// if (!args.Handled)
// {
// args.RoutedEvent = CommandManager.ExecutedEvent;
// if (element2 != null)
// {
// element2.RaiseEvent(args, userInitiated);
// }
// else if (element != null)
// {
// element.RaiseEvent(args, userInitiated);
// }
// else if (elementd != null)
// {
// elementd.RaiseEvent(args, userInitiated);
// }
// }
// return args.Handled;
// }
// private static IInputElement FilterInputElement(IInputElement elem)
// {
// if ((elem != null) && InputElement.IsValid(elem))
// {
// return elem;
// }
// return null;
// }
// bool ICommand.CanExecute(object parameter)
// {
// bool flag;
// return CanExecuteImpl(parameter, FilterInputElement(Keyboard.FocusedElement), false, out flag);
// }
// void ICommand.Execute(object parameter)
// {
// this.Execute(parameter, FilterInputElement(Keyboard.FocusedElement));
// }
// /// <summary>
// /// Gets the command id.
// /// </summary>
// /// <value>The command id.</value>
// internal byte CommandId
// {
// get { return _commandId; }
// }
// /// <summary>
// /// Gets or sets a value indicating whether this instance is blocked by RM.
// /// </summary>
// /// <value>
// /// <c>true</c> if this instance is blocked by RM; otherwise, <c>false</c>.
// /// </value>
// internal bool IsBlockedByRM
// {
// get { return _privateVector[(int)PrivateVectorIndex.IsBlockedByRM]; }
// set { _privateVector[(int)PrivateVectorIndex.IsBlockedByRM] = value; }
// }
// /// <summary>
// /// Gets the name.
// /// </summary>
// /// <value>The name.</value>
// public string Name
// {
// get { return _name; }
// }
// /// <summary>
// /// Gets the type of the owner.
// /// </summary>
// /// <value>The type of the owner.</value>
// public System.Type OwnerType
// {
// get { return _ownerType; }
// }
// }
//}
|
Grimace1975/bclcontrib
|
Core/System.CoreEx_/System.Core.Routing/Collections.1/RoutedCommand/RoutedCommand.cs
|
C#
|
mit
| 10,006
|
package config
const (
OutputFormatText = "text"
OutputFormatJSON = "json"
OutputTargetStdout = "stdout"
OutputTargetFile = "file"
)
type Output struct {
Format string `yaml:"format"`
Target string `yaml:"target"`
FileName string `yaml:"file_name"`
}
|
chapsuk/frissgo
|
config/output.go
|
GO
|
mit
| 267
|
version https://git-lfs.github.com/spec/v1
oid sha256:f7df841464cae1b61b2fb488b6174926c0e0251ceddf1dd360b031ab9fb83c3c
size 4289
|
yogeshsaroya/new-cdnjs
|
ajax/libs/angular.js/1.2.6/angular-sanitize.min.js
|
JavaScript
|
mit
| 129
|
package entities;
import javax.persistence.*;
import java.util.Set;
@Entity
@Table(name="store_locations")
public class StoreLocation {
private Long id;
private String locationName;
private Set<Sale> sales;
public StoreLocation() {
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name="location_name")
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
@OneToMany(mappedBy = "storeLocation")
public Set<Sale> getSales() {
return sales;
}
public void setSales(Set<Sale> sales) {
this.sales = sales;
}
}
|
yangra/SoftUni
|
Java-DB-Fundamentals/DatabasesFrameworks-Hibernate&SpringData/07.HibernateCodeFirst/SalesDatabase/src/main/java/entities/StoreLocation.java
|
Java
|
mit
| 834
|
<?php
use DBA\AnswerSession;
use DBA\JoinFilter;
use DBA\MediaObject;
use DBA\MediaType;
use DBA\OrderFilter;
use DBA\Query;
use DBA\QueryFilter;
use DBA\QueryResultTuple;
use DBA\RandOrderFilter;
use DBA\ResultTuple;
/**
*
* @author Sein
*
* Bunch of useful static functions.
*/
class Util {
/**
* Calculates variable. Used in Templates.
* @param $in mixed calculation to be done
* @return mixed
*/
public static function calculate($in) {
return $in;
}
public static function checkFolders() {
$tempDir = STORAGE_PATH . TMP_FOLDER;
if (!file_exists($tempDir)) {
mkdir($tempDir);
}
$queryDir = STORAGE_PATH . QUERIES_FOLDER;
if (!file_exists($queryDir)) {
mkdir($queryDir);
}
$mediaDir = STORAGE_PATH . MEDIA_FOLDER;
if (!file_exists($mediaDir)) {
mkdir($mediaDir);
}
}
public static function getValidityForMicroworker($microworkerId) {
global $FACTORIES;
$qF = new QueryFilter(AnswerSession::MICROWORKER_ID, $microworkerId, "=");
$answerSessions = $FACTORIES::getAnswerSessionFactory()->filter(array($FACTORIES::FILTER => $qF));
foreach ($answerSessions as $answerSession) {
if ($answerSession->getIsOpen() == 0) {
return $answerSession->getCurrentValidity();
}
}
return -1;
}
/**
* Get either a Gravatar URL or complete image tag for a specified email address.
*
* @param string $email The email address
* @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ]
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
* @param bool $img True to return a complete IMG tag False for just the URL
* @param array $atts Optional, additional key/value attributes to include in the IMG tag
* @return String containing either just a URL or a complete image tag
* @source https://gravatar.com/site/implement/images/php/
*/
public static function getGravatarUrl($email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array()) {
$url = 'https://www.gravatar.com/avatar/';
$url .= md5(strtolower(trim($email)));
$url .= "?s=$s&d=$d&r=$r";
if ($img) {
$url = '<img src="' . $url . '"';
foreach ($atts as $key => $val) {
$url .= ' ' . $key . '="' . $val . '"';
}
$url .= ' />';
}
return $url;
}
/**
* The progress of a query is updated, and if it changed it writes the new progress value to the DB
* @param $queryId int
* @param $force bool force the query to be calculated and updated
*/
public static function checkQueryUpdate($queryId, $force = false) {
global $FACTORIES;
$query = $FACTORIES::getQueryFactory()->get($queryId);
if ($query->getIsClosed() == 1) {
return; // query is already finished
}
$qF = new QueryFilter(QueryResultTuple::QUERY_ID, $queryId, "=", $FACTORIES::getQueryResultTupleFactory());
$jF = new JoinFilter($FACTORIES::getQueryResultTupleFactory(), ResultTuple::RESULT_TUPLE_ID, QueryResultTuple::RESULT_TUPLE_ID);
$joined = $FACTORIES::getResultTupleFactory()->filter(array($FACTORIES::FILTER => $qF, $FACTORIES::JOIN => $jF));
$fullyEvaluated = true;
$all = 0;
$finishedCount = 0;
for ($i = 0; $i < sizeof($joined[$FACTORIES::getResultTupleFactory()->getModelName()]); $i++) {
/** @var $resultTuple ResultTuple */
$resultTuple = $joined[$FACTORIES::getResultTupleFactory()->getModelName()][$i];
if ($resultTuple->getIsFinal() == 0) {
$fullyEvaluated = false;
}
else {
$finishedCount++;
}
$all++;
}
$updated = $force;
$progress = floor($finishedCount / $all * 100);
if ($force) {
$query->setProgress($progress);
}
if ($fullyEvaluated) {
// all tuples of this query are final and therefore we can close the query
$query->setIsClosed(1);
$query->setProgress(100);
$updated = true;
}
else if ($progress != $query->getProgress()) {
$updated = true;
$query->setProgress($progress);
}
if ($updated) {
$FACTORIES::getQueryFactory()->update($query);
}
}
/**
* @param $resultTuples ResultTuple[]
* @param $queryResultTuples QueryResultTuple[]
* @param $excludingTuples int[]
* @return ResultTuple
*/
public static function getTupleWeightedWithRankAndSigma($resultTuples, $queryResultTuples, $excludingTuples) {
//global $DEBUG;
if (sizeof($resultTuples) == 0) {
return null;
}
$exclude = array();
foreach ($excludingTuples as $excludingTuple) {
$exclude[$excludingTuple] = true;
}
$highestRank = 0;
foreach ($queryResultTuples as $queryResultTuple) {
if ($queryResultTuple->getRank() > $highestRank) {
$highestRank = $queryResultTuple->getRank();
}
}
$totalCount = 0;
//$DEBUG[] = "Getting tuple from " . sizeof($resultTuples) . " tuples, excluding " . sizeof($excludingTuples) . " ones..";
for ($i = 0; $i < sizeof($resultTuples); $i++) {
if (isset($exclude[$resultTuples[$i]->getId()])) {
continue; // exclude the already answered tuples
}
$add = 1;
if ($resultTuples[$i]->getSigma() == -1) {
$add += 2; // TODO: elaborate this value, or make it dependant from highest rank
}
$totalCount += $add + sqrt($highestRank - $queryResultTuples[$i]->getRank());
}
if ($totalCount <= 0) {
return null;
}
$random = random_int(0, $totalCount - 1);
$currentCount = 0;
for ($i = 0; $i < sizeof($resultTuples); $i++) {
if (isset($exclude[$resultTuples[$i]->getId()])) {
continue; // exclude the already answered tuples
}
$add = 1;
if ($resultTuples[$i]->getSigma() == -1) {
$add += 2; // TODO: elaborate this value, or make it dependant from highest rank
}
$currentCount += $add + sqrt($highestRank - $queryResultTuples[$i]->getRank());
if ($currentCount > $random) {
return $resultTuples[$i];
}
}
return null;
}
/**
* @param $resultSet1 ResultTuple
* @param $resultSet2 ResultTuple
* @param $randomOrder bool
*/
public static function prepare3CompareQuestion($resultSet1, $resultSet2, $randomOrder = true) {
global $FACTORIES, $OBJECTS;
$mediaObject1 = $FACTORIES::getMediaObjectFactory()->get($resultSet1->getObjectId1());
if (mt_rand(0, 1) == 0 || $randomOrder == false) {
$mediaObject2 = $FACTORIES::getMediaObjectFactory()->get($resultSet1->getObjectId2());
$mediaObject3 = $FACTORIES::getMediaObjectFactory()->get($resultSet2->getObjectId2());
}
else {
$mediaObject2 = $FACTORIES::getMediaObjectFactory()->get($resultSet2->getObjectId2());
$mediaObject3 = $FACTORIES::getMediaObjectFactory()->get($resultSet1->getObjectId2());
}
$value1 = new DataSet();
$value2 = new DataSet();
$value3 = new DataSet();
$value1->addValue('objData', array("serve.php?id=" . $mediaObject1->getChecksum()));
$value2->addValue('objData', array("serve.php?id=" . $mediaObject2->getChecksum()));
$value3->addValue('objData', array("serve.php?id=" . $mediaObject3->getChecksum()));
$mediaType1 = $FACTORIES::getMediaTypeFactory()->get($mediaObject1->getMediaTypeId());
$mediaType2 = $FACTORIES::getMediaTypeFactory()->get($mediaObject2->getMediaTypeId());
$mediaType3 = $FACTORIES::getMediaTypeFactory()->get($mediaObject3->getMediaTypeId());
$value1->addValue('template', $mediaType1->getTemplate());
$value2->addValue('template', $mediaType2->getTemplate());
$value3->addValue('template', $mediaType3->getTemplate());
$OBJECTS['object1'] = $mediaObject1;
$OBJECTS['object2'] = $mediaObject2;
$OBJECTS['object3'] = $mediaObject3;
$OBJECTS['value1'] = $value1;
$OBJECTS['value2'] = $value2;
$OBJECTS['value3'] = $value3;
}
/**
* @param $mediaObject1 MediaObject
* @param $mediaObject2 MediaObject
* @param $randomOrder bool
*/
public static function prepare2CompareQuestion($mediaObject1, $mediaObject2, $randomOrder = true) {
global $FACTORIES, $OBJECTS;
$value1 = new DataSet();
$value2 = new DataSet();
if (random_int(0, 1) > 0 && $randomOrder) {
$m = $mediaObject2;
$mediaObject2 = $mediaObject1;
$mediaObject1 = $m;
}
$value1->addValue('objData', array(new DataSet(array("data" => "serve.php/" . $mediaObject1->getChecksum(), "source" => $mediaObject1->getSource()))));
$value2->addValue('objData', array(new DataSet(array("data" => "serve.php/" . $mediaObject2->getChecksum(), "source" => $mediaObject2->getSource()))));
$mediaType1 = $FACTORIES::getMediaTypeFactory()->get($mediaObject1->getMediaTypeId());
$mediaType2 = $FACTORIES::getMediaTypeFactory()->get($mediaObject2->getMediaTypeId());
$value1->addValue('template', $mediaType1->getTemplate());
$value2->addValue('template', $mediaType2->getTemplate());
$OBJECTS['object1'] = $mediaObject1;
$OBJECTS['object2'] = $mediaObject2;
$OBJECTS['value1'] = $value1;
$OBJECTS['value2'] = $value2;
}
/**
* @param $playerId int
* @return string null if player was not found
*/
public static function getPlayerNameById($playerId) {
global $FACTORIES;
return $FACTORIES::getPlayerFactory()->get($playerId)->getPlayerName();
}
/**
* @param $queries Query[]
* @return Query
*/
public static function getQueryWeightedWithPriority($queries) {
if (sizeof($queries) == 0) {
return null;
}
$totalPriority = 0;
foreach ($queries as $query) {
$totalPriority += $query->getPriority() + 1;
}
$random = random_int(0, $totalPriority - 1);
$currentPriority = 0;
foreach ($queries as $query) {
$currentPriority += $query->getPriority() + 1;
if ($currentPriority > $random) {
return $query;
}
}
return $queries[sizeof($queries) - 1];
}
/**
* Converts a given string to hex code.
*
* @param string $string
* string to convert
* @return string converted string into hex
*/
public static function strToHex($string) {
return implode(unpack("H*", $string));
}
public static function getExtension($file) {
$basename = explode(".", basename($file));
return strtolower($basename[sizeof($basename) - 1]);
}
/**
* get the result tuple which consists of the two given media objects
* @param $object1 MediaObject
* @param $object2 MediaObject
* @return ResultTuple
*/
public static function getResultTuple($object1, $object2) {
global $FACTORIES;
$qF1 = new QueryFilter(ResultTuple::OBJECT_ID1, $object1->getId(), "=");
$qF2 = new QueryFilter(ResultTuple::OBJECT_ID2, $object2->getId(), "=");
return $FACTORIES::getResultTupleFactory()->filter(array($FACTORIES::FILTER => array($qF1, $qF2)), true);
}
/**
* Get a media object for the given checksum
* @param $checksum string
* @return MediaObject
*/
public static function getMediaObject($checksum) {
global $FACTORIES;
$qF = new QueryFilter(MediaObject::CHECKSUM, $checksum, "=");
return $FACTORIES::getMediaObjectFactory()->filter(array($FACTORIES::FILTER => $qF), true);
}
/**
* Get the media type for a given file. Type is determined by file extension. If the media type does not exist yet, it will be created.
* @param $file string
* @return MediaType
*/
public static function getMediaType($file) {
global $FACTORIES;
$extension = Util::getExtension($file);
$qF = new QueryFilter(MediaType::EXTENSION, $extension, "=");
$mediaType = $FACTORIES::getMediaTypeFactory()->filter(array($FACTORIES::FILTER => $qF), true);
if ($mediaType == null) {
// create this new media type
$mediaType = new MediaType(0, $extension, $extension, null);
$mediaType = $FACTORIES::getMediaTypeFactory()->save($mediaType);
}
return $mediaType;
}
/**
* @param $mediaObjectId int
* @return string
*/
public static function getMediaTypeNameForObject($mediaObjectId) {
global $FACTORIES;
$qF = new QueryFilter(MediaObject::MEDIA_OBJECT_ID, $mediaObjectId, "=");
$jF = new JoinFilter($FACTORIES::getMediaTypeFactory(), MediaObject::MEDIA_TYPE_ID, MediaType::MEDIA_TYPE_ID);
$joined = $FACTORIES::getMediaObjectFactory()->filter(array($FACTORIES::FILTER => $qF, $FACTORIES::JOIN => $jF));
if (sizeof($joined['MediaType']) == 0) {
return "unknown";
}
/** @var MediaType $mediaType */
$mediaType = $joined['MediaType'][0];
return $mediaType->getTypeName();
}
/**
* This filesize is able to determine the file size of a given file, also if it's bigger than 4GB which causes
* some problems with the built-in filesize() function of PHP.
* @param $file string Filepath you want to get the size from
* @return int -1 if the file doesn't exist, else filesize
*/
public static function filesize($file) {
if (!file_exists($file)) {
return -1;
}
$fp = fopen($file, "rb");
$pos = 0;
$size = 1073741824;
fseek($fp, 0, SEEK_SET);
while ($size > 1) {
fseek($fp, $size, SEEK_CUR);
if (fgetc($fp) === false) {
fseek($fp, -$size, SEEK_CUR);
$size = (int)($size / 2);
}
else {
fseek($fp, -1, SEEK_CUR);
$pos += $size;
}
}
while (fgetc($fp) !== false) {
$pos++;
}
return $pos;
}
/**
* gives a security question
* @return SessionQuestion
*/
public static function getSecurityQuestion() {
global $FACTORIES;
$question = null;
$qF1 = new QueryFilter(ResultTuple::SIGMA, SECURITY_QUESTION_THRESHOLD, "<=");
$qF2 = new QueryFilter(ResultTuple::SIGMA, 0, ">=");
$oF = new RandOrderFilter(10);
$resultTuples = $FACTORIES::getResultTupleFactory()->filter(array($FACTORIES::FILTER => array($qF1, $qF2), $FACTORIES::ORDER => $oF));
$questionType = SessionQuestion::TYPE_UNDEFINED;
if (sizeof($resultTuples) >= 2 && mt_rand(0, 1) > 0) {
$matching = array();
for ($i = 0; $i < sizeof($resultTuples); $i++) {
for ($j = $i + 1; $j < sizeof($resultTuples); $j++) {
if ($resultTuples[$i]->getObjectId1() == $resultTuples[$j]->getObjectId1() && $resultTuples[$i]->getObjectId1() != $resultTuples[$j]->getObjectId1()) {
$matching = array($resultTuples[$i], $resultTuples[$j]);
$i = sizeof($resultTuples);
break;
}
}
}
if (sizeof($matching) > 0) {
// three compare
$questionType = SessionQuestion::TYPE_COMPARE_TRIPLE;
$mediaObject1 = $FACTORIES::getMediaObjectFactory()->get($matching[0]->getObjectId1());
$mediaObject2 = $FACTORIES::getMediaObjectFactory()->get($matching[0]->getObjectId2());
$mediaObject3 = $FACTORIES::getMediaObjectFactory()->get($matching[1]->getObjectId2());
$question = new SessionQuestion($questionType, array($mediaObject1, $mediaObject2, $mediaObject3), $matching);
}
}
if (sizeof($resultTuples) > 0 && $questionType == SessionQuestion::TYPE_UNDEFINED) {
// two compare
$questionType = SessionQuestion::TYPE_COMPARE_TWO;
$mediaObject1 = $FACTORIES::getMediaObjectFactory()->get($resultTuples[0]->getObjectId1());
$mediaObject2 = $FACTORIES::getMediaObjectFactory()->get($resultTuples[0]->getObjectId2());
$question = new SessionQuestion($questionType, array($mediaObject1, $mediaObject2), array($resultTuples[0]));
}
return $question;
}
/**
* Resizes the given image if it's too big
* @param $path string
*/
public static function resizeImage($path) {
$size = getimagesize($path);
if ($size[0] <= IMAGE_MAX_WIDTH && $size[1] <= IMAGE_MAX_HEIGHT) {
return; // we don't need to do a resize here
}
$ratio = $size[0] / $size[1]; // width/height
if ($ratio > 1) {
$width = IMAGE_MAX_WIDTH;
$height = IMAGE_MAX_HEIGHT / $ratio;
}
else {
$width = IMAGE_MAX_WIDTH * $ratio;
$height = IMAGE_MAX_HEIGHT;
}
$src = imagecreatefromstring(file_get_contents($path));
$dst = imagecreatetruecolor($width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
imagedestroy($src);
imagejpeg($dst, $path);
imagedestroy($dst);
}
/**
* Tries to determine the IP of the client.
* @return string 0.0.0.0 or the client IP
*/
public static function getIP() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
if (!$ip) {
return "0.0.0.0";
}
return $ip;
}
/**
* Returns the username from the given userId
* @param $id int ID for the user
* @return string username or unknown-id
*/
public static function getUsernameById($id) {
global $FACTORIES;
$user = $FACTORIES::getUserFactory()->get($id);
if ($user === null) {
return "Unknown-$id";
}
return $user->getUsername();
}
public static function getUserAgentHeader() {
return json_encode(getallheaders());
}
/**
* Cut a string to a certain number of letters. If the string is too long, instead replaces the last three letters with ...
* @param $string String you want to short
* @param $length Number of Elements you want the string to have
* @return string Formatted string
*/
public static function shortenstring($string, $length) {
// shorten string that would be too long
$return = "<span title='$string'>";
if (strlen($string) > $length) {
$return .= substr($string, 0, $length - 3) . "...";
}
else {
$return .= $string;
}
$return .= "</span>";
return $return;
}
/**
* Formats the number with 1000s separators
* @param $num int|string
* @return string
*/
static function number($num = "") {
$value = "$num";
if (strlen($value) == 0) {
return "0";
}
$string = $value[0];
for ($x = 1; $x < strlen($value); $x++) {
if ((strlen($value) - $x) % 3 == 0) {
$string .= "'";
}
$string .= $value[$x];
}
return $string;
}
/**
* This sends a given email with text and subject to the address.
*
* @param string $address
* email address of the receiver
* @param string $subject
* subject of the email
* @param string $text
* html content of the email
* @return true on success, false on failure
*/
public static function sendMail($address, $subject, $text) {
$header = "Content-type: text/html; charset=utf8\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "From: " . DEFAULT_EMAIL_FROM . " <" . NO_REPLY_EMAIL . ">\r\n";
if (!mail($address, $subject, $text, $header)) {
return false;
}
return true;
}
/**
* Generates a random string with mixedalphanumeric chars
*
* @param int $length
* length of random string to generate
* @return string random string
*/
public static function randomString($length) {
$charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$result = "";
for ($x = 0; $x < $length; $x++) {
$result .= $charset[mt_rand(0, strlen($charset) - 1)];
}
return $result;
}
/**
* Refreshes the page with the current url, also includes the query string.
*/
public static function refresh() {
global $_SERVER;
$url = $_SERVER['PHP_SELF'];
if (strlen($_SERVER['QUERY_STRING']) > 0) {
$url .= "?" . $_SERVER['QUERY_STRING'];
}
header("Location: $url");
die();
}
/**
* @param int $queryId
* @param int $lastId
* @return SessionQuestion
*/
public static function getNextPruneQuestion($queryId = 0, $lastId = 0) {
global $FACTORIES;
$qF = new QueryFilter(ResultTuple::IS_FINAL, "0", "=");
$oF = new OrderFilter(ResultTuple::RESULT_TUPLE_ID, "ASC LIMIT 1");
$options = array($FACTORIES::FILTER => array($qF), $FACTORIES::ORDER => $oF);
if ($queryId > 0) {
$options[$FACTORIES::JOIN] = new JoinFilter($FACTORIES::getQueryResultTupleFactory(), ResultTuple::RESULT_TUPLE_ID, QueryResultTuple::RESULT_TUPLE_ID);
$options[$FACTORIES::FILTER][] = new QueryFilter(QueryResultTuple::QUERY_ID, $queryId, "=", $FACTORIES::getQueryResultTupleFactory());
}
if ($lastId > 0) {
$options[$FACTORIES::FILTER][] = new QueryFilter(ResultTuple::RESULT_TUPLE_ID, $lastId, ">", $FACTORIES::getResultTupleFactory());
}
$resultTuple = $FACTORIES::getResultTupleFactory()->filter($options);
if ($resultTuple == null || (sizeof($options[$FACTORIES::FILTER]) > 0 && sizeof($resultTuple['ResultTuple']) == 0)) {
return null;
}
if (sizeof($options[$FACTORIES::FILTER]) > 0) {
$resultTuple = $resultTuple['ResultTuple'][0];
}
return new SessionQuestion(
SessionQuestion::TYPE_COMPARE_TWO,
array($FACTORIES::getMediaObjectFactory()->get($resultTuple->getObjectId1()), $FACTORIES::getMediaObjectFactory()->get($resultTuple->getObjectId2())),
array($resultTuple)
);
}
/**
* @param $queryId int
* @param $lastId int
* @return int
*/
public static function getPruneLeft($queryId, $lastId) {
global $FACTORIES;
$qF1 = new QueryFilter(ResultTuple::IS_FINAL, "0", "=");
$oF = new OrderFilter(ResultTuple::RESULT_TUPLE_ID, "ASC");
$jF = new JoinFilter($FACTORIES::getQueryResultTupleFactory(), ResultTuple::RESULT_TUPLE_ID, QueryResultTuple::RESULT_TUPLE_ID);
$qF2 = new QueryFilter(QueryResultTuple::QUERY_ID, $queryId, "=", $FACTORIES::getQueryResultTupleFactory());
$qF3 = new QueryFilter(ResultTuple::RESULT_TUPLE_ID, $lastId, ">", $FACTORIES::getResultTupleFactory());
$joined = $FACTORIES::getResultTupleFactory()->filter(array($FACTORIES::FILTER => array($qF1, $qF2, $qF3), $FACTORIES::JOIN => $jF, $FACTORIES::ORDER => $oF));
return sizeof($joined[$FACTORIES::getResultTupleFactory()->getModelName()]);
}
/**
* @param $query Query
* @return int[]
*/
public static function getQueryEvaluationProgress($query) {
global $FACTORIES;
$oF = new OrderFilter(ResultTuple::RESULT_TUPLE_ID, "ASC");
$jF = new JoinFilter($FACTORIES::getQueryResultTupleFactory(), ResultTuple::RESULT_TUPLE_ID, QueryResultTuple::RESULT_TUPLE_ID);
$qF = new QueryFilter(QueryResultTuple::QUERY_ID, $query->getId(), "=", $FACTORIES::getQueryResultTupleFactory());
$joined = $FACTORIES::getResultTupleFactory()->filter(array($FACTORIES::FILTER => $qF, $FACTORIES::JOIN => $jF, $FACTORIES::ORDER => $oF));
$progress = array(0, 0, 0);
/** @var $resultTuples ResultTuple[] */
$resultTuples = $joined[$FACTORIES::getResultTupleFactory()->getModelName()];
foreach ($resultTuples as $resultTuple) {
$progress[0]++; // total
if ($resultTuple->getIsFinal() == 1) {
$progress[1]++; // finished
}
else if ($resultTuple->getSigma() >= 0) {
$progress[2]++; // partial
}
}
return $progress;
}
/**
* @param $answerSession AnswerSession
*/
public static function saveGame($answerSession) {
// TODO: save game
}
/**
* Gets the userinfo from an oauth token from google
* @param $accessToken
* @return string
*/
public static function getUserinfo($accessToken) {
return file_get_contents("https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=" . $accessToken);
}
}
|
s3inlc/cineast-evaluator
|
inc/Util.class.php
|
PHP
|
mit
| 24,052
|
const React = require('react')
const Layout = require('./src/components/layout').default
// Logs when the client route changes
exports.onRouteUpdate = ({ location, prevLocation }) => {
const body = document.querySelector('body')
body.setAttribute('data-current-page', location.pathname)
body.setAttribute('data-previous-page', prevLocation ? prevLocation.pathname : '/')
}
// Wraps every page in a component
exports.wrapPageElement = ({ element, props }) => <Layout {...props}>{element}</Layout>
|
yowainwright/yowainwright.github.io
|
gatsby-browser.js
|
JavaScript
|
mit
| 504
|
/* Copyright (c) 2007 Christopher J. W. Lloyd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "KGContext.h"
@class KGSurface;
@interface KGBitmapContext : KGContext {
KGSurface *_surface;
}
-initWithSurface:(KGSurface *)surface flipped:(BOOL)flipped;
-initWithBytes:(void *)bytes width:(size_t)width height:(size_t)height bitsPerComponent:(size_t)bitsPerComponent bytesPerRow:(size_t)bytesPerRow colorSpace:(KGColorSpace *)colorSpace bitmapInfo:(CGBitmapInfo)bitmapInfo flipped:(BOOL)flipped;
-(NSData *)pixelData;
-(void *)pixelBytes;
-(size_t)width;
-(size_t)height;
-(size_t)bitsPerComponent;
-(size_t)bytesPerRow;
-(KGColorSpace *)colorSpace;
-(CGBitmapInfo)bitmapInfo;
-(size_t)bitsPerPixel;
-(CGImageAlphaInfo)alphaInfo;
-(KGImage *)createImage;
@end
|
wenq1/cocotron
|
CoreGraphics/KGBitmapContext.h
|
C
|
mit
| 1,755
|
.ace--berry-nice .ace_gutter {
background: rgba(40,44,54,1);
color: rgb(131,136,145)
}
.ace--berry-nice .ace_print-margin {
width: 1px;
background: #e8e8e8
}
.ace--berry-nice {
background-color: rgba(40,44,54,1);
color: rgba(222,227,236,1)
}
.ace--berry-nice .ace_cursor {
color: rgba(248,248,240,1)
}
.ace--berry-nice .ace_marker-layer .ace_selection {
background: rgba(62,66,76,1)
}
.ace--berry-nice.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px rgba(40,44,54,1);
border-radius: 2px
}
.ace--berry-nice .ace_marker-layer .ace_step {
background: rgb(198, 219, 174)
}
.ace--berry-nice .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgba(59,58,50,1)
}
.ace--berry-nice .ace_marker-layer .ace_active-line {
background: rgba(59,63,72,1)
}
.ace--berry-nice .ace_gutter-active-line {
background-color: rgba(59,63,72,1)
}
.ace--berry-nice .ace_marker-layer .ace_selected-word {
border: 1px solid rgba(62,66,76,1)
}
.ace--berry-nice .ace_fold {
background-color: rgba(192,226,221,1);
border-color: rgba(222,227,236,1)
}
.ace--berry-nice .ace_entity.ace_name.ace_tag,
.ace--berry-nice .ace_keyword,
.ace--berry-nice .ace_keyword.ace_other.ace_unit,
.ace--berry-nice .ace_storage.ace_type {
color: rgba(38,155,166,1)
}
.ace--berry-nice .ace_constant.ace_character,
.ace--berry-nice .ace_constant.ace_language,
.ace--berry-nice .ace_constant.ace_other,
.ace--berry-nice .ace_entity.ace_other.ace_attribute-name,
.ace--berry-nice .ace_storage,
.ace--berry-nice .ace_support.ace_constant,
.ace--berry-nice .ace_support.ace_function {
color: rgba(216,69,111,1)
}
.ace--berry-nice .ace_constant.ace_numeric {
color: rgba(255,255,255,1)
}
.ace--berry-nice .ace_entity.ace_name.ace_function,
.ace--berry-nice .ace_string,
.ace--berry-nice .ace_support.ace_constant.ace_property-value {
color: rgba(192,226,221,1)
}
.ace--berry-nice .ace_support.ace_class,
.ace--berry-nice .ace_support.ace_type {
font-style: italic;
color: rgba(216,69,111,1)
}
.ace--berry-nice .ace_invalid,
.ace--berry-nice .ace_invalid.ace_deprecated {
color: rgba(248,248,240,1);
background-color: rgba(0,168,198,1)
}
.ace--berry-nice .ace_comment {
color: rgba(107,113,130,1)
}
.ace--berry-nice .ace_variable {
color: rgba(247,221,228,1)
}
.ace--berry-nice .ace_variable.ace_parameter {
font-style: italic;
color: rgba(116,198,198,1)
}
|
Colorsublime/colorsublime.github.io
|
ace/lib/ace/theme/BerryNice.css
|
CSS
|
mit
| 2,418
|
package org.zalando.nakadi.client.java.model
import org.slf4j.LoggerFactory
import org.zalando.nakadi.client.Deserializer
import org.zalando.nakadi.client.Serializer
import org.zalando.nakadi.client.java.enumerator._
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.core.JsonFactory
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.core.`type`.TypeReference
import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.JsonDeserializer
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.PropertyNamingStrategy
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.databind.deser.DeserializationProblemHandler
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion
import com.fasterxml.jackson.databind.JavaType
object JavaJacksonJsonMarshaller {
val logger = LoggerFactory.getLogger(this.getClass)
// All TypeReferences
def problemTR: TypeReference[Problem] =
new TypeReference[Problem] {}
def metricsTR: TypeReference[Metrics] =
new TypeReference[Metrics] {}
def partitionTR: TypeReference[Partition] =
new TypeReference[Partition] {}
def cursorTR: TypeReference[Cursor] =
new TypeReference[Cursor] {}
def eventTypeSchemaTR: TypeReference[EventTypeSchema] =
new TypeReference[EventTypeSchema] {}
def eventTypeCategoryTR: TypeReference[EventTypeCategory] =
new TypeReference[EventTypeCategory] {}
def partitionResolutionStrategyTR: TypeReference[PartitionStrategy] =
new TypeReference[PartitionStrategy] {}
def eventEnrichmentStrategyTR: TypeReference[EventEnrichmentStrategy] =
new TypeReference[EventEnrichmentStrategy] {}
def dataChangeEventQualifierTR: TypeReference[DataChangeEventQualifier] =
new TypeReference[DataChangeEventQualifier] {}
def eventTypeStatisticsTR: TypeReference[EventTypeStatistics] =
new TypeReference[EventTypeStatistics] {}
def eventTypeTR: TypeReference[EventType] =
new TypeReference[EventType] {}
def eventTR: TypeReference[Event] =
new TypeReference[Event] {}
def eventStreamBatchTR: TypeReference[EventStreamBatch[_]] =
new TypeReference[EventStreamBatch[_]] {}
def eventMetadataTR: TypeReference[EventMetadata] =
new TypeReference[EventMetadata] {}
def businessEventTR: TypeReference[BusinessEvent] =
new TypeReference[BusinessEvent] {}
def batchItemResponseTR: TypeReference[BatchItemResponse] =
new TypeReference[BatchItemResponse] {}
def dataChangeEventTR: TypeReference[DataChangeEvent[Any]] =
new TypeReference[DataChangeEvent[Any]] {}
//Lists
def listOfPartitionStrategyTR: TypeReference[java.util.List[PartitionStrategy]] =
new TypeReference[java.util.List[PartitionStrategy]] {}
def listOfEventEnrichmentStrategyTR: TypeReference[java.util.List[EventEnrichmentStrategy]] =
new TypeReference[java.util.List[EventEnrichmentStrategy]] {}
def listOfEventTypeTR: TypeReference[java.util.List[EventType]] =
new TypeReference[java.util.List[EventType]] {}
def listOfPartitionTR: TypeReference[java.util.List[Partition]] =
new TypeReference[java.util.List[Partition]] {}
def listOfDataChangeEventTR: TypeReference[java.util.List[DataChangeEvent[Any]]] =
new TypeReference[java.util.List[DataChangeEvent[Any]]] {}
def optionalDeserializer[T](expectedType: TypeReference[T]): Deserializer[Option[T]] =
new Deserializer[Option[T]] {
def from(from: String): Option[T] = {
defaultObjectMapper.readValue[Option[T]](from, expectedType)
}
}
def serializer[T]: Serializer[T] = new Serializer[T] {
def to(from: T): String =
defaultObjectMapper.writeValueAsString(from)
}
def deserializer[T](expectedType: TypeReference[T]): Deserializer[T] =
new Deserializer[T] {
def from(from: String): T = {
defaultObjectMapper.readValue[T](from, expectedType)
}
}
def deserializer[T](expectedType: JavaType): Deserializer[T] =
new Deserializer[T] {
def from(from: String): T = {
defaultObjectMapper.readValue[T](from, expectedType)
}
}
lazy val defaultObjectMapper: ObjectMapper = new ObjectMapper() //
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
.addHandler(new DeserializationProblemHandler() {
override def handleUnknownProperty(ctxt: DeserializationContext,
jp: JsonParser,
deserializer: JsonDeserializer[_],
beanOrClass: AnyRef,
propertyName: String): Boolean = {
logger.warn(
s"unknown property occurred in JSON representation: [beanOrClass=$beanOrClass, property=$propertyName]")
true
}
})
}
|
zalando/nakadi-klients
|
client/src/main/scala/org/zalando/nakadi/client/java/model/JavaJacksonJsonMarshaller.scala
|
Scala
|
mit
| 5,200
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (c) 2011, ETH Zurich.
% All rights reserved.
%
% This file is distributed under the terms in the attached LICENSE file.
% If you do not find this file, copies can be found by writing to:
% ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,11pt,twoside]{report}
\usepackage{bftn}
\usepackage{calc}
\usepackage{verbatim}
\usepackage{xspace}
\usepackage{pifont}
\usepackage{textcomp}
\usepackage{amsmath}
\title{Message Notifications}
\author{Barrelfish project}
% \date{\today} % Uncomment (if needed) - date is automatic
\tnnumber{9}
\tnkey{Notifications}
\begin{document}
\maketitle % Uncomment for final draft
\begin{versionhistory}
\vhEntry{1.0}{16.06.2010}{RI}{Initial version}
\end{versionhistory}
% \intro{Abstract} % Insert abstract here
% \intro{Acknowledgements} % Uncomment (if needed) for acknowledgements
% \tableofcontents % Uncomment (if needed) for final draft
% \listoffigures % Uncomment (if needed) for final draft
% \listoftables % Uncomment (if needed) for final draft
\chapter{Overview}
\section{Introduction}
Inter-core messaging on Barrelfish (UMP) is currently based on shared
memory circular buffers and a polling mechanism which is designed to
work efficiently given the cache-coherence protocols of a typical NUMA
multiprocessor system. Communication latency can vary by many orders
of magnitude depending on how frequently the receiving process polls
each channel. This document describes the design and implementation of
a new kernel notification primitive for Barrelfish.
The reason I believe we need an IDC notification path can be seen in
most of the traces I took of Tim's IDC and THC test program (see
email of 21/5/10).
screenshot goes here
If you look on core 0 you see 3 domains polling for incoming URPC
messages. Each polls for a while and then yields, and with 3 domains
it takes up to 10000 cycles to notice a message, and obviously the
current mechanism will scale with the number of domains on the
destination core. (always >= 2!). This could be reduced by moving
polling into the kernel, but if any domain is running we have no way
to pre-empt it until the next timer interrupt (about 18 million
cycles!).
\subsection{Polling and cache coherence}
Sending a message involves the sender modifying a single cache line
which (in the expected case) the receiver is actively polling. The
cache line starts in shared (S) mode in the cache of both sender and
receiver cores. When the sender writes to the cache line this causes a
transition to the owned (O) state and an invalidation of the copy in
the receiver's cache. On most of our NUMA systems, be they
Hypertransport, QPI or shared bus, this is effectively a system-wide
broadcast. Newer AMD Istanbul processors have a directory-based cache
coherency protocol which avoids the broadcast. The receiver then
pulls the modified cache line from the sender's cache resulting in the
cache line being in both caches in the shared (S) state.
\subsection{Message Latency}
When sender and receiver threads are the only things running on each
core this can be extremely low latency (~600 cycles). When the
destination core is shared by multiple threads, or even multiple
domains, the message latency is determined by kernel- and user-mode
scheduling policies and is typically a function of the kernel clock
interrupt rate and the number of domains (and channels) in the system.
Even in simple cases the message latency will usually increase to at
least one timer tick (at least 1ms, probably 10ms - i.e.~millions of
cycles!)
Several Barrelfish papers have talked about sechemes where receiver
domains initially poll for messages, but eventually back off to a more
heavyweight blocking mechanism. In the current tree this involves
domains eventually ``handing off'' the polling of message channels to
their local monitor process via a (blocking) local IPC. The monitor
polls URPC channels for \emph{all} blocked domains an when it finds a
message it sends an IPC to the receiver process causing it to wake.
Since all these cache lines will be ``hot'' in the cache, this is not
as expensive as it might appear, but still does not allow for
preemption of a running thread before the next clock interrupt. It
also potentially captures kernel scheduling policy.
\subsection{Scalability}
Barrelfish does not currently multiplex URPC channels in any way, so
it is common to see $O(N)$ and even $O(N^2)$ URPC channels between
services which run on each core (e.g.~monitors), or between the
dispatchers of a domain which ``spans'' multiple cores. Though the
memory consumption is not a huge problem (a URPC channel is a handful
of cache lines), the number of channels can grow rapidly and this will
have an effect on polling costs and message latency.
Domains do not have any efficient way to identify the (probably) small
set of URPC channels which currently have pending messages. In Nemesis
this was achieved by each domain having a ``hint FIFO'' which
contained a list of channels with \emph{new} incoming messages
(identifying new messages required an explicit \emph{acknowlegement
count} in each channel). However, when a domain was activated it
could efficiently dispatch new messages, and if the FIFO overflowed
then the domain resorted to polling all channels.
In a many-core environment, a single hint FIFO would potentitally be
an expensive bottleneck due to shared-write cache lines accessed by
many cores. Having a FIFO for each potential sending core requires
$O(N)$ space, but would avoid contention.
\subsection{Primitives}
Ideally we need primitives which allow fast URPC-style messaging when
a receiver is known to be polling, but which also allow us to control
sending timely notifications to a remote kernel, domain and thread.
\chapter{Design}
In the global kernel data page have an array of pointers to per-core
notification (PCN) pages. (by the way, why is struct global still
declared in kputchar.h! :-) Each per-core notification page is divided
into cacheline-sized slots. (i.e. 1 page has 64 slots of 64-bytes)
There is one slot for each sending core. Each slot is treated as a
shared FIFO with some agreed number of entries. Each entry can
contain a short channel ID or zero. Each kernel keeps private arrays
of head pointers and tail pointers (need only 1 byte per entry x
num cpus).
On the sending side I have a new system call:
sys$\_$notify(dest$\_$core, dest$\_$chanid);
This looks up the PCN page of the destination core in the kernel globals page.
It then indexes into the PCN page using its own core id to locate the pairwise notification FIFO.
It looks up the FIFO head pointer using the dest$\_$core id.
It then looks at that entry of the FIFO... if it is non-zero then the fifo is full.
If the entry is zero then it writes the dest$\_$chanid and increments the private head pointer.
On the receiving side, the destination core keeps a private index into
each of its incoming fifos. These tells it which entry it needs to
look at next. It could therefore poll each of the FIFOs waiting for a
non-zero channelID value...
The mechanism so far results in a single FIFO cacheline toggling
between Shared and Modified state on both sender and receiver. I
timed 10000 invocations of the above sys$\_$notify() call (with the
receiver core in a tight polling loop) with a cost of 350 cycles per
notification (for a shared L3) and 450 cycles cross-package. Note
that the extra cache traffic of this design is probably not optimal,
but it's in the noise compared to our current IDC costs when we have
$>$1 domain on a core (i.e. always!)
Obviously a tight polling loop on the receiver is not ideal... we
aren't always polling, and in any event this would scale as O(N
cores).
One solution is for sys$\_$notify() to send an IPI to dest$\_$core
whenever the FIFO goes non-empty, or at the request of the receiver
(e.g. if it wrote a special 'request IPI' value into the next empty
slot, rather than zero).
Given the number of CPUs in our current ccNUMA machines, we could
easily afford to use a separate interrupt vector for each sending
core. This would identify to the destination core which FIFO to look
at, with no polling overhead. We could use a single IPI vector, but
this would need some hierarchical shared datastructure to efficiently
identify which fifos to poll. (the PCN entry for src$\_$core ==
dest$\_$core is unused and could be treated as 512 flag-bits c/f Simons
RCK code)
Sending the IPI within sys$\_$notify() would take a few hundred extra
cycles (but may overlap with the cache coherence messages?) Taking
the IRQ and acking it on the receiver is probably between 500 and 1000
cycles depending on which ring the destination core is executing in.
(I tried Richard's HLT in Ring0 with interrupts disabled trick and it
does not work any more!).
One interesting trick might be to deliver notifications to a
hyperthread so that interrupt latency and polling costs were
interleaved with normal processing...and only interrupt the
'application hyperthread' if a reschedule is necessary.
In all of the above cases, I would imagine that notifications would
not necessarily cause the running domain to be pre-empted. However a
scheduler activation for incoming IDC would be possible.
Given that true polling URPC *could* cost only a few hundred cycles if
both domains are in a tight loop, this notification mechanism is not
something I would imagine using on each message. Instead I would
suggest having a 'PUSH' flag you can pass on urpc$\_$send(), or a
b->push() method on the flounder binding so the programmer can decide
to expedite message delivery a suitable points.
\chapter{Implementation}
I just finished doing a more complete version of the UMP Notification
mechanism. It now uses a UmpNotify capability which you get by
retyping your Dispatcher cap. The monitor's UMP binding mechanism
already propagates a notification cap between client and server. I
hand edited the bench.if stubs to allocate the caps and invoke the
notification when doing a message send.
The cap$\_$invoke handler puts the receivers's DCB pointer into the
destination core's incoming notification FIFO and sends an IPI with a
vector identifying the sender core (allowing demux without polling).
The receiving core has an notification IPI handler which drains the
notification fifo and does a cswitch to the most recently notified
domain. The domain will get an activation and poll its URPC channels
(eventually).
After thinking a bit more about the costs of notification, it seems
that 2800 cycles is quite a lot to pay in the default path to send a
notification. Quite a bit of this is the high cost of cap$\_$invoke on
x86$\_$64 (2K cycles) compared to the hacky syscall I was using last week
(~800), but in general we don't want to pay much for notification
unless it's necessary.
I added code in the domain dispatch path to publish the identity of
the currently running DCB, and ideally the time at which it will next
be preempted. The notification kernel code on the sender side can
therefore tell if it's worth sending an IPI and return immediately if
the domain is already running. This leads to the behaviour below
where, just before T=70000 core 1 sends a message to core 2, notices
it isn't the currently running domain and so sends a notification IPI.
The monitor on core2 is preempted and the receiver domain gets to run.
Activation code takes about 2000 cycles but the message gets there
pretty quickly.
This allows me to increase MAX$\_$POLLS$\_$PER$\_$TIMESLICE to 1000
without excessive penalty, which in turn allows the client and server
to remain in the polling loop and notice messages before they yield to
other domains. Net result is that the common case RPC cost is about
4x faster. The worst case is hopefully bounded by the cost of
(cap$\_$invoke + notifiy IPI + domain activation + ump$\_$poll)... about
4000 cycles. I ought to check this by running some ``while(1)''
domains on each core... but I'm fairly (naively?) optimistic.
\section{Performance}
\chapter{Testing and Debugging}
\end{document}
|
modeswitch/barrelfish
|
doc/009-notifications/Notify.tex
|
TeX
|
mit
| 12,323
|
<?php
session_start();
include "../connection.php";
$error = false;
if (isset($_SESSION['auth']) && $_SESSION['auth'] != false) {
header('Location: index.php');
} else {
$_SESSION['auth'] = false;
}
if (isset($_POST['username']) && isset($_POST['password'])) {
// print_r($_POST);
$username = $_POST['username'];
$password = $_POST['password'];
$query = mysqli_query($conn, "SELECT * FROM `user` WHERE `username`= '" . $username . "'") or die($conn);
if (mysqli_num_rows($query) > 0) {
$query = mysqli_query($conn, "SELECT * FROM `user` WHERE `username` = '" . $username . "' AND `password` = '" . $password . "'");
if (mysqli_num_rows($query) > 0) {
$_SESSION['auth'] = $username;
header('Location: index.php');
} else {
$error = 'Mật khẩu không chính xác';
}
} else {
$error = 'Tài khoản không chính xác';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta charset="utf-8"/>
<title>Login Page - Ace Admin</title>
<meta name="description" content="User login page"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css"/>
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css"/>
<!-- text fonts -->
<link rel="stylesheet" href="assets/css/fonts.googleapis.com.css"/>
<!-- ace styles -->
<link rel="stylesheet" href="assets/css/ace.min.css"/>
<!--[if lte IE 9]>
<link rel="stylesheet" href="assets/css/ace-part2.min.css"/>
<![endif]-->
<link rel="stylesheet" href="assets/css/ace-rtl.min.css"/>
<!--[if lte IE 9]>
<link rel="stylesheet" href="assets/css/ace-ie.min.css"/>
<![endif]-->
<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->
<!--[if lte IE 8]>
<script src="assets/js/html5shiv.min.js"></script>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body class="login-layout">
<div class="main-container">
<div class="main-content">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="login-container">
<?php
if ($error != false) {
?>
<div class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Cảnh báo</strong> <?php echo $error ?>
</div>
<?php } ?>
<div class="center">
<h1>
<i class="ace-icon fa fa-leaf green"></i>
<span class="red">Ace</span>
<span class="white" id="id-text2">Application</span>
</h1>
<h4 class="blue" id="id-company-text">© Company Name</h4>
</div>
<div class="space-6"></div>
<div class="position-relative">
<div id="login-box" class="login-box visible widget-box no-border">
<div class="widget-body">
<div class="widget-main">
<h4 class="header blue lighter bigger">
<i class="ace-icon fa fa-coffee green"></i>
Please Enter Your Information
</h4>
<div class="space-6"></div>
<form action="" method="post">
<fieldset>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="text" class="form-control" name="username"
placeholder="Username"/>
<i class="ace-icon fa fa-user"></i>
</span>
</label>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="password" class="form-control" name="password"
placeholder="Password"/>
<i class="ace-icon fa fa-lock"></i>
</span>
</label>
</form>
<div class="space"></div>
<div class="clearfix">
<label class="inline">
<input type="checkbox" class="ace"/>
<span class="lbl"> Remember Me</span>
</label>
<button type="submit" class="width-35 pull-right btn btn-sm btn-primary">
<i class="ace-icon fa fa-key"></i>
<span class="bigger-110">Login</span>
</button>
</div>
<div class="space-4"></div>
</fieldset>
</form>
<div class="social-or-login center">
<span class="bigger-110">Or Login Using</span>
</div>
<div class="space-6"></div>
<div class="social-login center">
<a class="btn btn-primary">
<i class="ace-icon fa fa-facebook"></i>
</a>
<a class="btn btn-info">
<i class="ace-icon fa fa-twitter"></i>
</a>
<a class="btn btn-danger">
<i class="ace-icon fa fa-google-plus"></i>
</a>
</div>
</div><!-- /.widget-main -->
<div class="toolbar clearfix">
<div>
<a href="#" data-target="#forgot-box" class="forgot-password-link">
<i class="ace-icon fa fa-arrow-left"></i>
I forgot my password
</a>
</div>
<div>
<a href="#" data-target="#signup-box" class="user-signup-link">
I want to register
<i class="ace-icon fa fa-arrow-right"></i>
</a>
</div>
</div>
</div><!-- /.widget-body -->
</div><!-- /.login-box -->
<div id="forgot-box" class="forgot-box widget-box no-border">
<div class="widget-body">
<div class="widget-main">
<h4 class="header red lighter bigger">
<i class="ace-icon fa fa-key"></i>
Retrieve Password
</h4>
<div class="space-6"></div>
<p>
Enter your email and to receive instructions
</p>
<form>
<fieldset>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="email" class="form-control"
placeholder="Email"/>
<i class="ace-icon fa fa-envelope"></i>
</span>
</label>
<div class="clearfix">
<button type="button" class="width-35 pull-right btn btn-sm btn-danger">
<i class="ace-icon fa fa-lightbulb-o"></i>
<span class="bigger-110">Send Me!</span>
</button>
</div>
</fieldset>
</form>
</div><!-- /.widget-main -->
<div class="toolbar center">
<a href="#" data-target="#login-box" class="back-to-login-link">
Back to login
<i class="ace-icon fa fa-arrow-right"></i>
</a>
</div>
</div><!-- /.widget-body -->
</div><!-- /.forgot-box -->
<div id="signup-box" class="signup-box widget-box no-border">
<div class="widget-body">
<div class="widget-main">
<h4 class="header green lighter bigger">
<i class="ace-icon fa fa-users blue"></i>
New User Registration
</h4>
<div class="space-6"></div>
<p> Enter your details to begin: </p>
<form>
<fieldset>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="email" class="form-control"
placeholder="Email"/>
<i class="ace-icon fa fa-envelope"></i>
</span>
</label>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="text" class="form-control" name="username"
placeholder="Username"/>
<i class="ace-icon fa fa-user"></i>
</span>
</label>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="password" class="form-control" name="password"
placeholder="Password"/>
<i class="ace-icon fa fa-lock"></i>
</span>
</label>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="password" class="form-control"
placeholder="Repeat password"/>
<i class="ace-icon fa fa-retweet"></i>
</span>
</label>
<label class="block">
<input type="checkbox" class="ace"/>
<span class="lbl">
I accept the
<a href="#">User Agreement</a>
</span>
</label>
<div class="space-24"></div>
<div class="clearfix">
<button type="reset" class="width-30 pull-left btn btn-sm">
<i class="ace-icon fa fa-refresh"></i>
<span class="bigger-110">Reset</span>
</button>
<button type="button"
class="width-65 pull-right btn btn-sm btn-success">
<span class="bigger-110">Register</span>
<i class="ace-icon fa fa-arrow-right icon-on-right"></i>
</button>
</div>
</fieldset>
</form>
</div>
<div class="toolbar center">
<a href="#" data-target="#login-box" class="back-to-login-link">
<i class="ace-icon fa fa-arrow-left"></i>
Back to login
</a>
</div>
</div><!-- /.widget-body -->
</div><!-- /.signup-box -->
</div><!-- /.position-relative -->
<div class="navbar-fixed-top align-right">
<br/>
<a id="btn-login-dark" href="#">Dark</a>
<span class="blue">/</span>
<a id="btn-login-blur" href="#">Blur</a>
<span class="blue">/</span>
<a id="btn-login-light" href="#">Light</a>
</div>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.main-content -->
</div><!-- /.main-container -->
<!-- basic scripts -->
<!--[if !IE]> -->
<script src="assets/js/jquery-2.1.4.min.js"></script>
<!-- <![endif]-->
<!--[if IE]>
<script src="assets/js/jquery-1.11.3.min.js"></script>
<![endif]-->
<script type="text/javascript">
if ('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
</script>
<!-- inline scripts related to this page -->
<script type="text/javascript">
jQuery(function ($) {
$(document).on('click', '.toolbar a[data-target]', function (e) {
e.preventDefault();
var target = $(this).data('target');
$('.widget-box.visible').removeClass('visible');//hide others
$(target).addClass('visible');//show target
});
});
//you don't need this, just used for changing background
jQuery(function ($) {
$('#btn-login-dark').on('click', function (e) {
$('body').attr('class', 'login-layout');
$('#id-text2').attr('class', 'white');
$('#id-company-text').attr('class', 'blue');
e.preventDefault();
});
$('#btn-login-light').on('click', function (e) {
$('body').attr('class', 'login-layout light-login');
$('#id-text2').attr('class', 'grey');
$('#id-company-text').attr('class', 'blue');
e.preventDefault();
});
$('#btn-login-blur').on('click', function (e) {
$('body').attr('class', 'login-layout blur-login');
$('#id-text2').attr('class', 'white');
$('#id-company-text').attr('class', 'light-blue');
e.preventDefault();
});
});
</script>
</body>
</html>
|
navatech-trainning/fashion-shopping
|
admin/login.php
|
PHP
|
mit
| 17,076
|
// Copyright (c) Sandeep Mistry. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "BLEConstantCharacteristic.h"
BLEConstantCharacteristic::BLEConstantCharacteristic(const char* uuid, const unsigned char value[], unsigned char length) :
BLEFixedLengthCharacteristic(uuid, BLERead, (unsigned char)0)
{
this->_valueLength = this->_valueSize = length;
this->_value = (unsigned char*)value;
}
BLEConstantCharacteristic::BLEConstantCharacteristic(const char* uuid, const char* value) :
BLEFixedLengthCharacteristic(uuid, BLERead, (unsigned char)0)
{
this->_valueLength = this->_valueSize = strlen(value);
this->_value = (unsigned char*)value;
}
BLEConstantCharacteristic::~BLEConstantCharacteristic() {
this->_value = NULL; // null so super destructor doesn't try to free
}
bool BLEConstantCharacteristic::setValue(const unsigned char /*value*/[], unsigned char /*length*/) {
return false;
}
bool BLEConstantCharacteristic::setValue(const char* /*value*/) {
return false;
}
|
sandeepmistry/arduino-BLEPeripheral
|
src/BLEConstantCharacteristic.cpp
|
C++
|
mit
| 1,075
|
'''
Example which moves objects around in a 2D world.
This example requires matplotlib. The ros package doesnt have this as a
rosdep though, since nothing else needs it. Just do a system install
of matplotlib.
'''
import roslib; roslib.load_manifest('hierarchical_interactive_planning')
import numpy as np
from scipy import linalg
import hierarchical_interactive_planning as hip
######################################################################################################################
# World
######################################################################################################################
class MoveStuffWorld:
def __init__(self, obs_map, objects, eps=1.0):
'''
Args:
objects (dict): Mapping from string object names to numpy arrays of their positions.
'''
self.obs_map = obs_map
self.objects = objects
self.eps = eps
def execute(self, op_instance):
op_name = op_instance.operator_name
if op_name == 'MoveTo':
x_des = op_instance.target.args[0].val
self.objects['robot'].position = x_des
else:
raise ValueError('Unknown operator: %s' % str(operator.name))
def entails(self, f):
if isinstance(f, hip.ConjunctionOfFluents):
return np.all([self.entails(fluent) for fluent in f.fluents])
if f.pred == RobotAtLoc:
x_robot = self.objects['robot'].position
x_des = f.args[0].val
if linalg.norm(x_robot - x_des) < self.eps:
return True
else:
return False
else:
raise ValueError('Unknown predicate: %s' % str(f.pred))
def contradicts(self, f):
return False
def plan_path(self, x_start, x_end, n_graph_points=1000, graph_conn_dist=1.0):
'''Plan a collision free path from x_start to x_end.
Returns:
path (list of np.array): Path (or None if no path found).
'''
# build a random graph
x_min, x_max, y_min, y_max = self.obs_map.extent()
points = np.zeros((n_graph_points, 2))
points[:,0] = np.random.uniform(x_min, x_max, n_graph_points)
points[:,1] = np.random.uniform(y_min, y_max, n_graph_points)
def action_generator(state):
for neighbor in range(len(points)):
d = linalg.norm(points[state] - points[neighbor])
if d < conn_dist:
yield neighbor, neighbor, d # action, next_state, cost
p = a_star.a_star(
start,
lambda s: s == goal,
action_generator,
lambda s: linalg.norm(points[goal] - points[s])
)
class Robot:
def __init__(self, position):
self.position = position
class Box:
def __init__(self, center, r):
self.center = np.array(center)
self.r = r
######################################################################################################################
# Predicates
######################################################################################################################
RobotAtLoc = hip.Predicate('RobotAtLoc', ['loc'])
RobotLocFree = hip.Predicate('RobotLocFree', ['robot', 'loc'])
######################################################################################################################
# Suggesters
######################################################################################################################
def robot_path_suggester(world, current_state, goal):
for f in goal.fluents:
if f.pred == RobotAtLoc:
x_des = f.args[0].val
yield []
######################################################################################################################
# Operators
######################################################################################################################
loc = hip.Variable('loc')
path = hip.Variable('path')
MoveTo = hip.Operator(
'MoveTo',
target = RobotAtLoc((loc,)),
suggesters = {path:robot_path_suggester},
preconditions = [],
side_effects = hip.ConjunctionOfFluents([]),
primitive = False,
)
operators = [MoveTo]
######################################################################################################################
# Main
######################################################################################################################
def draw_objects(objects):
for obj_name, obj in objects.items():
if isinstance(obj, Box):
plt.plot([obj.center[0]], [obj.center[1]], 'x')
vertices = []
r = obj.r
for offset in [(r, r), (r, -r), (-r, -r), (-r, r)]:
vertices.append(obj.center + np.array(offset))
vertices = np.array(vertices)
plt.fill(vertices[:,0], vertices[:,1], 'm')
elif isinstance(obj, Robot):
plt.plot([obj.position[0]], [obj.position[1]], 'go', markersize=40)
class ObstacleMap:
def __init__(self, obs_array, res):
'''2D obstacle map class.
Args:
obs_array (np.array of np.bool): Occupancy array.
res (float): Size (height and width) of each cell in the occupancy array.
'''
self.obs_array = obs_array
self.res = res
def pos_to_ind(self, p):
'''Return array index for cell that contains x,y position.
'''
ii, jj = np.array(p) / self.res
return int(ii), int(jj)
def ind_to_pos(self, ind):
'''Return x,y position of center point of cell specified by index.
'''
return np.array(ind) * self.res + 0.5 * self.res
def is_occupied(self, p):
ii, jj = self.pos_to_ind(p)
return self.obs_array[ii,jj]
def any_occupied(self, x0, x1, y0, y1):
'''Return true if any cells within the bounding box are occupied.
'''
i0, j0 = self.pos_to_ind((x0, y0))
i1, j1 = self.pos_to_ind((x1, y1))
i0 = max(0, i0)
i1 = max(0, i1)
j0 = max(0, j0)
j1 = max(0, j1)
return self.obs_array[i0:i1,j0:j1].any()
def points(self):
points = []
for ii in range(self.obs_array.shape[0]):
for jj in range(self.obs_array.shape[1]):
p = self.ind_to_pos((ii, jj))
points.append(p)
return np.array(points)
def occupied_points(self):
points = []
for ii in range(self.obs_array.shape[0]):
for jj in range(self.obs_array.shape[1]):
p = self.ind_to_pos((ii, jj))
if self.is_occupied(p):
points.append(p)
return np.array(points)
def extent(self):
x_min, y_min = self.ind_to_pos((0, 0))
s = self.obs_array.shape
x_max, y_max = self.ind_to_pos((s[0]-1, s[1]-1))
return x_min, y_min, x_max, y_max
if __name__ == '__main__':
import sys
from matplotlib import pyplot as plt
# load world map
res = 1.0
obs_arr = plt.imread(sys.argv[1])[::-1,:].T
obs_arr = obs_arr < obs_arr.max() / 2.0
obs_map = ObstacleMap(obs_arr, res)
objects = {
'robot': Robot(np.array((50., 50.))),
'box1': Box((5., 5.), 4.),
}
start_state = hip.ConjunctionOfFluents([])
world = MoveStuffWorld(obs_map, objects)
goal_symbol = hip.Symbol(np.array((10., 10.)))
goal = hip.ConjunctionOfFluents([RobotAtLoc((goal_symbol,))])
# run HPN to generate plan
tree = hip.HPlanTree()
hip.hpn(operators, start_state, goal, world, tree=tree)
fig = plt.figure()
points_occ = obs_map.occupied_points()
plt.plot(points_occ[:,0], points_occ[:,-1], 'bo')
if 0:
w = 5
occ = []
free = []
for x, y in obs_map.points():
if obs_map.any_occupied(x-w, x+w, y-w, y+w):
occ.append((x, y))
else:
free.append((x, y))
occ = np.array(occ)
free = np.array(free)
plt.plot(occ[:,0], occ[:,1], 'r.')
plt.plot(free[:,0], free[:,1], 'g.')
draw_objects(objects)
x_min, x_max, y_min, y_max = obs_map.extent()
plt.xlim(x_min, x_max)
plt.ylim(y_min, y_max)
plt.show()
|
jonbinney/python-planning
|
python_task_planning/examples/move_stuff/move_stuff.py
|
Python
|
mit
| 8,400
|
//
// PriceNetwork.h
// Market
//
// Created by ZhangBob on 4/28/16.
// Copyright © 2016 vvusu. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void(^PriceNetworkBlock)(BOOL isSuccess, id response);
@interface PriceNetwork : NSObject
#pragma mark - 主站新闻请求
+ (void)getStockNewsWithParamter:(NSDictionary *)paramters block:(PriceNetworkBlock)block;
+ (void)getMoreStockNewsWihtParamter:(NSDictionary *)paramters block:(PriceNetworkBlock)block;
@end
|
wallstreetcn/LNStock
|
Example/LNMarket/LNMarket/Classes/PriceNetwork/PriceNetwork.h
|
C
|
mit
| 489
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<link href="/open/select2/select2.min.css" rel="stylesheet" />
</head>
<body>
<select style="width:50%;" id="lot-tagSelect" multiple>
<optgroup label="SQL">
<option>MySql</option>
<option>Sqlite</option>
<option>SQLServer</option>
</optgroup>
<optgroup label="Other">
<option>C#</option>
<option>EF</option>
<option>MVC</option>
<option>Dapper</option>
<option>Ado.Net</option>
</optgroup>
</select>
<button id="btn">获取选中项的值</button>
<script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script src="/open/select2/select2.min.js"></script>
<script type="text/javascript">
$('#lot-tagSelect').select2({
tags: true,
tokenSeparators: [',', ' ']
});
$('#btn').click(function () {
var ids = $.map($('#lot-tagSelect').select2("data"), function (row) {
return row.text;
});
alert(ids.join(','));
});
</script>
</body>
</html>
|
dunitian/LoTCodeBase
|
LoTUI/Manager/Demo/select2.html
|
HTML
|
mit
| 1,279
|
#ifndef __tcode_transport_tcp_pipeline_builder_h__
#define __tcode_transport_tcp_pipeline_builder_h__
#include <system_error>
#include <common/rc_ptr.hpp>
namespace tcode { namespace transport {
class event_loop;
namespace tcp {
class pipeline;
class pipeline_builder
: public tcode::ref_counted< pipeline_builder >
{
public:
pipeline_builder( void ){}
virtual ~pipeline_builder( void ){}
virtual event_loop& channel_loop( void ) = 0;
virtual bool build( pipeline& p ){
return false;
}
private:
};
}}}
#endif
|
aoziczero/tcode
|
old/transport/tcp/pipeline_builder.hpp
|
C++
|
mit
| 526
|
using System;
using UsgsClient.Common;
namespace UsgsClient.Quakes
{
public class QuakesUriBuilder : IQuakesUriBuilder
{
private readonly IConfig _config;
public QuakesUriBuilder(IConfig config)
{
this._config = config;
}
public Uri ForDetail(
string quakeId)
{
var usgsUri = $"{_config.FeedUri}/detail/{quakeId}.geojson";;
return new Uri(usgsUri);
}
public Uri ForSummary(
Magnitude magnitude,
Timeframe timeframe)
{
var usgsUri = $"{_config.FeedUri}/summary/{{magnitude}}_{{timeframe}}.geojson";;
return new Uri(usgsUri
.Replace("{magnitude}", MagnitudeTokenFormatter.Format(magnitude))
.Replace("{timeframe}", TimeframeTokenFormatter.Format(timeframe)));
}
}
}
|
overridethis/usgsclient
|
UsgsClient/Quakes/QuakesUriBuilder.cs
|
C#
|
mit
| 907
|
package hudson.plugins.keepSlaveOffline;
import org.kohsuke.stapler.DataBoundConstructor;
import hudson.Extension;
import hudson.model.Node;
import hudson.model.Queue.FlyweightTask;
import hudson.model.Queue.Task;
import hudson.model.queue.CauseOfBlockage;
import hudson.slaves.NodeProperty;
import hudson.slaves.NodePropertyDescriptor;
public class OfflineKeeper extends NodeProperty<Node>{
private String reason;
@DataBoundConstructor
public OfflineKeeper(String reason){
this.reason=reason;
}
public String getReason(){
return reason;
}
@Extension // this marker indicates Hudson that this is an implementation of an extension point.
public static final class NodePropertyDescriptorImpl extends NodePropertyDescriptor {
public static final NodePropertyDescriptorImpl DESCRIPTOR = new NodePropertyDescriptorImpl();
public NodePropertyDescriptorImpl(){
super(OfflineKeeper.class);
}
/**
* This human readable name is used in the configuration screen.
*/
public String getDisplayName() {
return "Keep this slave offline after Hudson restart";
}
}
}
|
jenkinsci/keep-slave-offline
|
src/main/java/hudson/plugins/keepSlaveOffline/OfflineKeeper.java
|
Java
|
mit
| 1,221
|
package com.example.alexeyglushkov.wordteacher.quizletlistmodules.setlistmodule.view;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.alexeyglushkov.quizletservice.entities.QuizletSet;
import com.example.alexeyglushkov.wordteacher.R;
import com.example.alexeyglushkov.wordteacher.listmodule.view.BaseListAdaptor;
import com.example.alexeyglushkov.wordteacher.listmodule.view.SimpleListFragment;
/**
* Created by alexeyglushkov on 07.08.16.
*/
public class QuizletSetListFragment extends SimpleListFragment<QuizletSet> {
//// Creation, initialization, restoration
public static QuizletSetListFragment create() {
QuizletSetListFragment fragment = new QuizletSetListFragment();
fragment.initialize();
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_quizlet_cards, container, false);
}
//// Creation Methods
@Override
protected BaseListAdaptor createAdapter() {
return createSetAdapter();
}
private QuizletSetAdapter createSetAdapter() {
QuizletSetAdapter adapter = new QuizletSetAdapter(new QuizletSetAdapter.Listener() {
@Override
public void onSetClicked(View view, QuizletSet set) {
QuizletSetListFragment.this.getPresenter().onRowClicked(set);
}
@Override
public void onMenuClicked(View view, QuizletSet set) {
QuizletSetListFragment.this.getPresenter().onRowMenuClicked(set, view);
}
});
return adapter;
}
}
|
soniccat/android-taskmanager
|
app_wordteacher_old/src/main/java/com/example/alexeyglushkov/wordteacher/quizletlistmodules/setlistmodule/view/QuizletSetListFragment.java
|
Java
|
mit
| 1,783
|
@extends('app')
@section('header-text') Log into your account @endsection
@section('header-subtext') Enter in your account information below @endsection
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Login</div>
<div class="panel-body">
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form class="form-horizontal" role="form" method="POST" action="{{ route('users.auth.doLogin') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
@if ($message = \Session::pull('message'))
<div class="form-group">
<div class="col-md-push-4 col-md-6">
<p class="text-success">{{ $message }}</p>
</div>
</div>
@endif
@if ( config('services.github.client_id') )
<div class="form-group">
<div class="col-md-push-4 col-md-6">
<a href="{{ route('users.auth.oauth', ['driver' => 'github']) }}" class="btn btn-block btn-social btn-github">
<i class="fa fa-github"></i> Sign in with GitHub
</a>
</div>
</div>
@endif
<div class="form-group">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope-o fa-fw"></i></span>
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock fa-fw"></i></span>
<input type="password" class="form-control" name="password">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember"> Remember Me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary" style="margin-right: 15px;">
Login
</button>
<a href="{{ route('users.auth.recover') }}">Forgot Your Password?</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
|
FujiMakoto/Pixel
|
resources/views/users/auth/login.blade.php
|
PHP
|
mit
| 3,349
|
import { handleActions } from 'redux-actions';
import { Map, OrderedMap } from 'immutable';
import initialState from '../store/initialState';
const App = handleActions({
WINDOW_LOADED: (state) => ({
...state,
windowLoaded: true
}),
CLOSE_LEGAL_HINT: (state) => ({
...state,
showLegalHint: false
}),
CONFIGURE_FIREBASE: (state, action) => ({
...state,
fireRef: action.payload
}),
SAVE_UID: (state, action) => ({
...state,
uid: action.payload
}),
SAVE_NAME: (state, action) => ({
...state,
userName: action.payload
}),
SAVE_USER_REF: (state, action) => ({
...state,
userRef: action.payload
}),
CONNECTED_TO_CHAT: (state) => ({
...state,
records: state.records.set('system:connected_to_chat', {
msg: '歡迎加入聊天室!',
user: 'system',
send_time: Date.now(),
user_color: '#ffc106'
})
}),
SET_MSG_TO_LIST: (state, action) => ({
...state,
records: OrderedMap(action.payload).map(record => ({ ...record, inActive: true }))
}),
ADD_MSG_TO_LIST: (state, action) => ({
...state,
records: state.records.set(action.payload.key, action.payload.value)
}),
REMOVE_MSG_FROM_LIST: (state, action) => ({
...state,
records: state.records.delete(action.payload)
}),
SET_WILL_SCROLL: (state, action) => ({
...state,
willScroll: action.payload
}),
SWITCH_MONITOR: (state, action) => ({
...state,
monitor: action.payload
}),
SET_PRESENCE: (state, action) => ({
...state,
presence: Map(action.payload)
}),
COUNTER_CHANGED: (state, action) => ({
...state,
onlineCounter: state.onlineCounter.update(
state.presence.get(action.payload.key), 1,
v => v - 1
).update(
action.payload.value.toString(), 0,
v => v + 1
),
presence: state.presence.set(action.payload.key, action.payload.value)
}),
COUNTER_ADDED: (state, action) => ({
...state,
onlineCounter: state.onlineCounter.update(
action.payload.value.toString(), 0,
v => v + 1
),
presence: state.presence.set(action.payload.key, action.payload.value)
}),
COUNTER_REMOVED: (state, action) => ({
...state,
onlineCounter: state.onlineCounter.update(
action.payload.value.toString(), 1,
v => v - 1
),
presence: state.presence.delete(action.payload.key)
}),
SET_PLAYER: (state, action) => ({
...state,
player: action.payload
}),
TOGGLE_SHOW_CHAT: (state) => ({
...state,
showChat: !state.showChat
}),
CONTROL_UP: state => ({
...state,
control: 'up'
}),
CONTROL_DOWN: state => ({
...state,
control: 'down'
}),
CONTROL_LEFT: state => ({
...state,
control: 'left',
controlStop: false
}),
CONTROL_RIGHT: state => ({
...state,
control: 'right',
controlStop: false
}),
CONTROL_STOP: state => ({
...state,
control: 'stop'
}),
CONTROL_PAUSE: state => ({
...state,
control: state.pause ? 'pause' : 'play'
}),
CONTROL_SET_PAUSE: state => ({
...state,
control: 'pause'
}),
CONTROL_SET_PLAY: state => ({
...state,
control: 'play'
}),
STOP_CONTROL: state => ({
...state,
controlStop: true
}),
CONTROL_INTERACT: state => ({
...state,
control: 'interact'
}),
ON_ERROR: (state, action) => ({
...state,
players: state.players.update(
action.payload.toString(),
r => r.set("error", true)
)
}),
ON_LOAD: (state, action) => ({
...state,
players: state.players.update(
action.payload.toString(),
r => r.set("error", false)
)
}),
UPDATE_FRAMES: (state, action) => ({
...state,
players: state.players.update(
action.payload.monitor.toString(),
r => r.update("frames", frames => frames.push(action.payload.src).takeLast(10))
)
}),
TOGGLE_LOADING: (state) => ({
...state,
loading: !state.loading
}),
PAUSE: (state) => ({
...state,
pause: !state.pause
}),
RELOAD: state => ({
...state,
reload: Math.floor(Math.random() * 10000).toString(),
lastReload: state.reload
})
}, initialState);
export default App;
|
NTU-ArtFest22/Monitor-web
|
src/Reducers/index.js
|
JavaScript
|
mit
| 4,611
|
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactcss = require('reactcss');
var _reactcss2 = _interopRequireDefault(_reactcss);
var SliderPointer = (function (_ReactCSS$Component) {
_inherits(SliderPointer, _ReactCSS$Component);
function SliderPointer() {
_classCallCheck(this, SliderPointer);
_get(Object.getPrototypeOf(SliderPointer.prototype), 'constructor', this).apply(this, arguments);
}
_createClass(SliderPointer, [{
key: 'classes',
value: function classes() {
return {
'default': {
picker: {
width: '14px',
height: '14px',
borderRadius: '6px',
transform: 'translate(-7px, -1px)',
backgroundColor: 'rgb(248, 248, 248)',
boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.37)'
}
}
};
}
}, {
key: 'render',
value: function render() {
return _react2['default'].createElement('div', { style: this.styles().picker });
}
}]);
return SliderPointer;
})(_reactcss2['default'].Component);
module.exports = SliderPointer;
|
9o/react-color
|
lib/components/slider/SliderPointer.js
|
JavaScript
|
mit
| 3,128
|
'use strict';
// Declare app level module which depends on views, and components
angular.module('collegeScorecard', [
'ngRoute',
'ui.bootstrap',
'nemLogging',
'uiGmapgoogle-maps',
'collegeScorecard.common',
'collegeScorecard.footer',
'collegeScorecard.home',
'collegeScorecard.schools',
'collegeScorecard.compare',
'collegeScorecard.details',
'collegeScorecard.selectedSchoolsDirective',
'collegeScorecard.scorecardDataService',
'collegeScorecard.schoolsListService',
'collegeScorecard.schoolDataTranslationService'
]).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/home'});
}]);
|
brianyamasaki/collegeScorecard
|
app/app.js
|
JavaScript
|
mit
| 658
|
package com.cg.registration.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
/**
* Servlet implementation class Registration
*/
public class RegistrationServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private Connection conn=null;
private DataSource ds=null;
public void init() throws ServletException {
ServletContext context = getServletContext();
ds=(DataSource)context.getAttribute("appds");
try {
conn=ds.getConnection();
} catch (SQLException e) {
e.printStackTrace();
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try{
String name=request.getParameter("name");
//String address=request.getParameter("address");
//String phone=request.getParameter("phone");
String username=request.getParameter("username");
String password=request.getParameter("password");
//System.out.println(name+address+phone+username+password);
PrintWriter out = response.getWriter();
PreparedStatement ps = conn.prepareStatement("insert into EMS values(?,?,?)");
ps.setString(1, name);
ps.setString(2, username);
ps.setString(3, password);
if(ps.executeUpdate()==1){
response.sendRedirect("login.jsp");
}else{
out.println("User Not registered");
request.getRequestDispatcher("/index2.jsp")
.include(request, response);
}
ps.close();
} catch(Exception e) {
e.printStackTrace();
}
}
}
|
brijeshsmita/commons-spring
|
EMSPhase3JSP/src/com/cg/registration/servlet/RegistrationServlet.java
|
Java
|
mit
| 2,047
|
// © Copyright 2013 Paul Thomas <paul@stackfull.com>. All Rights Reserved.
// sf-virtual-repeat directive
// ===========================
// Like `ng-repeat` with reduced rendering and binding
//
(function(){
'use strict';
// (part of the sf.virtualScroll module).
var mod = angular.module('sf.virtualScroll');
var DONT_WORK_AS_VIEWPORTS = ['TABLE', 'TBODY', 'THEAD', 'TR', 'TFOOT'];
var DONT_WORK_AS_CONTENT = ['TABLE', 'TBODY', 'THEAD', 'TR', 'TFOOT'];
var DONT_SET_DISPLAY_BLOCK = ['TABLE', 'TBODY', 'THEAD', 'TR', 'TFOOT'];
// Utility to clip to range
function clip(value, min, max){
if( angular.isArray(value) ){
return angular.forEach(value, function(v){
return clip(v, min, max);
});
}
return Math.max(min, Math.min(value, max));
}
mod.directive('sfVirtualRepeat', ['$log', '$rootElement', function($log, $rootElement){
return {
require: '?ngModel',
transclude: 'element',
priority: 1000,
terminal: true,
compile: sfVirtualRepeatCompile
};
// Turn the expression supplied to the directive:
//
// a in b
//
// into `{ value: "a", collection: "b" }`
function parseRepeatExpression(expression){
var match = expression.match(/^\s*([\$\w]+)\s+in\s+([\S\s]*)$/);
if (! match) {
throw new Error("Expected sfVirtualRepeat in form of '_item_ in _collection_' but got '" +
expression + "'.");
}
return {
value: match[1],
collection: match[2]
};
}
// Utility to filter out elements by tag name
function isTagNameInList(element, list){
var t, tag = element.tagName.toUpperCase();
for( t = 0; t < list.length; t++ ){
if( list[t] === tag ){
return true;
}
}
return false;
}
// Utility to find the viewport/content elements given the start element:
function findViewportAndContent(startElement){
/*jshint eqeqeq:false, curly:false */
var root = $rootElement[0];
var e, n;
// Somewhere between the grandparent and the root node
for( e = startElement.parent().parent()[0]; e !== root; e = e.parentNode ){
// is an element
if( e.nodeType != 1 ) break;
// that isn't in the blacklist (tables etc.),
if( isTagNameInList(e, DONT_WORK_AS_VIEWPORTS) ) continue;
// has a single child element (the content),
if( e.childElementCount != 1 ) continue;
// which is not in the blacklist
if( isTagNameInList(e.firstElementChild, DONT_WORK_AS_CONTENT) ) continue;
// and no text.
for( n = e.firstChild; n; n = n.nextSibling ){
if( n.nodeType == 3 && /\S/g.test(n.textContent) ){
break;
}
}
if( n == null ){
// That element should work as a viewport.
return {
viewport: angular.element(e),
content: angular.element(e.firstElementChild)
};
}
}
throw new Error("No suitable viewport element");
}
// Apply explicit height and overflow styles to the viewport element.
//
// If the viewport has a max-height (inherited or otherwise), set max-height.
// Otherwise, set height from the current computed value or use
// window.innerHeight as a fallback
//
function setViewportCss(viewport){
var viewportCss = {'overflow': 'auto'},
style = window.getComputedStyle ?
window.getComputedStyle(viewport[0]) :
viewport[0].currentStyle,
maxHeight = style && style.getPropertyValue('max-height'),
height = style && style.getPropertyValue('height');
if( maxHeight && maxHeight !== '0px' ){
viewportCss.maxHeight = maxHeight;
}else if( height && height !== '0px' ){
viewportCss.height = height;
}else{
viewportCss.height = window.innerHeight;
}
viewport.css(viewportCss);
}
// Apply explicit styles to the content element to prevent pesky padding
// or borders messing with our calculations:
function setContentCss(content){
var contentCss = {
margin: 0,
padding: 0,
border: 0,
'box-sizing': 'border-box'
};
content.css(contentCss);
}
// TODO: compute outerHeight (padding + border unless box-sizing is border)
function computeRowHeight(element){
var style = window.getComputedStyle ? window.getComputedStyle(element)
: element.currentStyle,
maxHeight = style && style.getPropertyValue('max-height'),
height = style && style.getPropertyValue('height');
if( height && height !== '0px' && height !== 'auto' ){
$log.debug('Row height is "%s" from css height', height);
}else if( maxHeight && maxHeight !== '0px' && maxHeight !== 'none' ){
height = maxHeight;
$log.debug('Row height is "%s" from css max-height', height);
}else if( element.clientHeight ){
height = element.clientHeight+'px';
$log.debug('Row height is "%s" from client height', height);
}else{
throw new Error("Unable to compute height of row");
}
angular.element(element).css('height', height);
return parseInt(height, 10);
}
// The compile gathers information about the declaration. There's not much
// else we could do in the compile step as we need a viewport parent that
// is exculsively ours - this is only available at link time.
function sfVirtualRepeatCompile(element, attr, linker) {
var ident = parseRepeatExpression(attr.sfVirtualRepeat);
return {
post: sfVirtualRepeatPostLink
};
// ----
// Set up the initial value for our watch expression (which is just the
// start and length of the active rows and the collection length) and
// adds a listener to handle child scopes based on the active rows.
function sfVirtualRepeatPostLink(scope, iterStartElement, attrs){
var rendered = [];
var rowHeight = 0;
var scrolledToBottom = false;
var stickyEnabled = "sticky" in attrs;
var dom = findViewportAndContent(iterStartElement);
// The list structure is controlled by a few simple (visible) variables:
var state = 'ngModel' in attrs ? scope.$eval(attrs.ngModel) : {};
// - The index of the first active element
state.firstActive = 0;
// - The index of the first visible element
state.firstVisible = 0;
// - The number of elements visible in the viewport.
state.visible = 0;
// - The number of active elements
state.active = 0;
// - The total number of elements
state.total = 0;
// - The point at which we add new elements
state.lowWater = state.lowWater || 100;
// - The point at which we remove old elements
state.highWater = state.highWater || 300;
// - Keep the scroll event from constantly firing
state.threshold = state.threshold || 1;
var lastFixPos = 0;
// TODO: now watch the water marks
setContentCss(dom.content);
setViewportCss(dom.viewport);
// When the user scrolls, we move the `state.firstActive`
dom.viewport.bind('scroll', sfVirtualRepeatOnScroll);
// The watch on the collection is just a watch on the length of the
// collection. We don't care if the content changes.
scope.$watch(sfVirtualRepeatWatchExpression, sfVirtualRepeatListener, true);
// and that's the link done! All the action is in the handlers...
return;
// ----
// Apply explicit styles to the item element
function setElementCss (element) {
var elementCss = {
// no margin or it'll screw up the height calculations.
margin: '0'
};
if( !isTagNameInList(element[0], DONT_SET_DISPLAY_BLOCK) ){
// display: block if it's safe to do so
elementCss.display = 'block';
}
if( rowHeight ){
elementCss.height = rowHeight+'px';
}
element.css(elementCss);
}
function makeNewScope (idx, colExpr, containerScope) {
var childScope = containerScope.$new(),
collection = containerScope.$eval(colExpr);
childScope[ident.value] = collection[idx];
childScope.$index = idx;
childScope.$first = (idx === 0);
childScope.$last = (idx === (collection.length - 1));
childScope.$middle = !(childScope.$first || childScope.$last);
childScope.$watch(function updateChildScopeItem(){
collection = containerScope.$eval(colExpr);
childScope[ident.value] = collection[idx];
});
return childScope;
}
function addElements (start, end, colExpr, containerScope, insPoint) {
var frag = document.createDocumentFragment();
var newElements = [], element, idx, childScope;
for( idx = start; idx !== end; idx ++ ){
childScope = makeNewScope(idx, colExpr, containerScope);
element = linker(childScope, angular.noop);
setElementCss(element);
newElements.push(element);
frag.appendChild(element[0]);
}
insPoint.after(frag);
return newElements;
}
function recomputeActive() {
// We want to set the start to the low water mark unless the current
// start is already between the low and high water marks.
var start = clip(state.firstActive, state.firstVisible - state.lowWater, state.firstVisible - state.highWater);
// Similarly for the end
var end = clip(state.firstActive + state.active,
state.firstVisible + state.visible + state.lowWater,
state.firstVisible + state.visible + state.highWater );
state.firstActive = clip(start, 0, state.total - state.visible - state.lowWater);
state.active = Math.min(end, state.total) - state.firstActive;
}
function sfVirtualRepeatOnScroll(evt){
if( !rowHeight ){
return;
}
var diff = Math.abs(evt.target.scrollTop - lastFixPos);
if(diff > (state.threshold * rowHeight)){
// Enter the angular world for the state change to take effect.
scope.$apply(function(){
state.firstVisible = Math.floor(evt.target.scrollTop / rowHeight);
state.visible = Math.ceil(dom.viewport[0].clientHeight / rowHeight);
$log.debug('scroll to row %o', state.firstVisible);
var sticky = evt.target.scrollTop + evt.target.clientHeight >= evt.target.scrollHeight;
recomputeActive();
$log.debug(' state is now %o', state);
$log.debug(' sticky = %o', sticky);
});
lastFixPos = evt.target.scrollTop;
}
}
function sfVirtualRepeatWatchExpression(scope){
var coll = scope.$eval(ident.collection);
if( coll && coll.length !== state.total ){
state.total = coll.length;
recomputeActive();
}
return {
start: state.firstActive,
active: state.active,
len: coll ? coll.length : 0
};
}
function destroyActiveElements (action, count) {
var dead, ii, remover = Array.prototype[action];
for( ii = 0; ii < count; ii++ ){
dead = remover.call(rendered);
dead.scope().$destroy();
dead.remove();
}
}
// When the watch expression for the repeat changes, we may need to add
// and remove scopes and elements
function sfVirtualRepeatListener(newValue, oldValue, scope){
var oldEnd = oldValue.start + oldValue.active,
newElements;
if( newValue === oldValue ){
$log.debug('initial listen');
newElements = addElements(newValue.start, oldEnd, ident.collection, scope, iterStartElement);
rendered = newElements;
if( rendered.length ){
rowHeight = computeRowHeight(newElements[0][0]);
}
}else{
var newEnd = newValue.start + newValue.active;
var forward = newValue.start >= oldValue.start;
var delta = forward ? newValue.start - oldValue.start
: oldValue.start - newValue.start;
var endDelta = newEnd >= oldEnd ? newEnd - oldEnd : oldEnd - newEnd;
var contiguous = delta < (forward ? oldValue.active : newValue.active);
$log.debug('change by %o,%o rows %s', delta, endDelta, forward ? 'forward' : 'backward');
if( !contiguous ){
$log.debug('non-contiguous change');
destroyActiveElements('pop', rendered.length);
rendered = addElements(newValue.start, newEnd, ident.collection, scope, iterStartElement);
}else{
if( forward ){
$log.debug('need to remove from the top');
destroyActiveElements('shift', delta);
}else if( delta ){
$log.debug('need to add at the top');
newElements = addElements(
newValue.start,
oldValue.start,
ident.collection, scope, iterStartElement);
rendered = newElements.concat(rendered);
}
if( newEnd < oldEnd ){
$log.debug('need to remove from the bottom');
destroyActiveElements('pop', oldEnd - newEnd);
}else if( endDelta ){
var lastElement = rendered[rendered.length-1];
$log.debug('need to add to the bottom');
newElements = addElements(
oldEnd,
newEnd,
ident.collection, scope, lastElement);
rendered = rendered.concat(newElements);
}
}
if( !rowHeight && rendered.length ){
rowHeight = computeRowHeight(rendered[0][0]);
}
dom.content.css({'padding-top': newValue.start * rowHeight + 'px'});
}
dom.content.css({'height': newValue.len * rowHeight + 'px'});
if( scrolledToBottom && stickyEnabled ){
dom.viewport[0].scrollTop = dom.viewport[0].clientHeight + dom.viewport[0].scrollHeight;
}
}
}
}
}]);
}());
|
looker/angular-virtual-scroll
|
src/virtual-repeat.js
|
JavaScript
|
mit
| 14,764
|
# Try to find HIDAPI library
# Once done will define:
#
# HIDAPI_FOUND
# HIDAPI_INCLUDE_DIRS
# HIDAPI_LIBRARIES
#
# Can specify root search dir:
#
# HIDAPI_ROOT_DIR
if (HIDAPI_INCLUDE_DIRS)
set (HIDAPI_FIND_QUIETLY TRUE)
endif ()
if (NOT HDIAPI_INCLUDE_DIRS)
find_path (HIDAPI_INCLUDE_DIRS NAMES hidapi.h PATH SUFFIXES hidapi HINTS ${HIDAPI_ROOT_DIR})
set (HIDAPI_INCLUDE_DIRS ${HIDAPI_INCLUDE_DIRS}/hidapi CACHE PATH "HIDAPI include directory")
endif ()
find_library (HIDAPI_LIBRARIES NAMES hidapi HINTS ${HIDAPI_ROOT_DIR})
if (HIDAPI_INCLUDE_DIRS AND HIDAPI_LIBRARIES)
set (HIDAPI_FOUND TRUE)
endif ()
if (HIDAPI_FOUND)
if (NOT HIDAPI_FIND_QUIETLY)
message (STATUS "Found HIDAPI: ${HIDAPI_LIBRARIES}")
endif ()
else ()
if (HIDAPI_FIND_REQUIRED)
message (FATAL_ERROR "Could NOT find HIDAPI")
else ()
message (STATUS "Could NOT find HIDAPI")
endif ()
endif ()
mark_as_advanced (HIDAPI_INCLUDE_DIRS HIDAPI_LIBRARIES)
|
user-none/sixaxispairer
|
CMakeModules/FindHIDAPI.cmake
|
CMake
|
mit
| 982
|
require('../helpers');
const assert = require('assert');
const ironium = require('../../src');
const Promise = require('bluebird');
describe('processing', ()=> {
const errorCallbackQueue = ironium.queue('error-callback');
const errorPromiseQueue = ironium.queue('error-promise');
const errorGeneratorQueue = ironium.queue('error-generator');
function untilSuccessful(done) {
ironium.runOnce((error)=> {
if (error)
setTimeout(()=> untilSuccessful(done));
else
done();
});
}
describe('with callback error', ()=> {
// First two runs should fail, runs ends at 3
let runs = 0;
before(()=> {
errorCallbackQueue.eachJob((job, callback)=> {
runs++;
if (runs > 2)
callback();
else
callback(new Error('fail'));
});
});
before(()=> errorCallbackQueue.queueJob('job'));
before(untilSuccessful);
it('should repeat until processed', ()=> {
assert.equal(runs, 3);
});
});
describe('with rejected promise', ()=> {
// First two runs should fail, runs ends at 3
let runs = 0;
before(()=> {
errorPromiseQueue.eachJob(()=> {
runs++;
if (runs > 2)
return Promise.resolve();
else
return Promise.reject(new Error('fail'));
});
});
before(()=> errorPromiseQueue.queueJob('job'));
before(untilSuccessful);
it('should repeat until processed', ()=> {
assert.equal(runs, 3);
});
});
describe('with generator error', ()=> {
// First two runs should fail, runs ends at 3
let runs = 0;
before(()=> {
errorGeneratorQueue.eachJob(function*() {
runs++;
switch (runs) {
case 1: {
throw new Error('fail');
}
case 2: {
yield Promise.reject(Error('fail'));
break;
}
}
});
});
before(()=> errorGeneratorQueue.queueJob('job'));
before(untilSuccessful);
it('should repeat until processed', ()=> {
assert.equal(runs, 3);
});
});
});
|
djanowski/ironium
|
test/queues/error_test.js
|
JavaScript
|
mit
| 2,127
|
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def mainRoute():
return render_template('hello.html')
@app.route('/jujitsu')
def jujitsu():
return render_template('jujitsu.html')
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0', port=8080)
|
CrazyDiamond567/docker-cloud-test
|
unh698.py
|
Python
|
mit
| 302
|
/**
* Created by Andrei on 10/14/2014.
*/
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.net.InetAddress;
public class ThreadPoolApp {
public static void main (String[] args) {
if (args.length < 2)
ThreadPoolApp.error();
try {
int numberOfJobs = Integer.parseInt(args[0]);
int numberOfThreads = Integer.parseInt(args[1]);
if ((numberOfJobs < 1) || (numberOfThreads < 1))
ThreadPoolApp.error();
ExecutorService pool = Executors.newFixedThreadPool(numberOfThreads);
Job[] jobs = new Job[numberOfJobs];
for (int i = 0; i < numberOfJobs; i++) {
if (i == 0) {
jobs[0] = new Job(0){
public void run() {
//Undertake required work, here we will emulate it by sleeping for a period
System.out.println("Job: " + jobNumber + " is being processed by thread: "
+ Thread.currentThread().getName());
try {
Thread.sleep((int)(1000));
System.out.println("Hello World!");
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
//get current date time with Date()
Date date = new Date();
System.out.println(dateFormat.format(date));
//get current date time with Calendar()
Calendar cal = Calendar.getInstance();
System.out.println(dateFormat.format(cal.getTime()));
} catch (InterruptedException e) {
//no cathing as example should not experience interruptions
}
System.out.println("Job: " + jobNumber + " is ending in thread: "
+ Thread.currentThread().getName());
}
};
pool.execute(jobs[0]);
}
if (i == 1) {
jobs[1] = new Job(1){
public void run() {
//Undertake required work, here we will emulate it by sleeping for a period
System.out.println("Job: " + jobNumber + " is being processed by thread: "
+ Thread.currentThread().getName());
try {
Thread.sleep((int)(1000));
try {
java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost();
System.out.println("Hostname of local machine: " + localMachine.getHostName());
} catch (Exception ex) {
//comment
}
} catch (InterruptedException e) {
//no cathing as example should not experience interruptions
}
System.out.println("Job: " + jobNumber + " is ending in thread: "
+ Thread.currentThread().getName());
}
};
pool.execute(jobs[1]);
}
if ( i > 1) {
jobs[i] = new Job(i);
pool.execute(jobs[i]);
}
//pool.execute(jobs[i]); //executes the given command at some future time
}
pool.shutdown(); //Shutdown: previously submitted tasks are executed,
//but no new tasks will be accepted.
System.out.println(" Last line " + Thread.currentThread().getName());
} catch (NumberFormatException e) {
ThreadPoolApp.error();
}
}
private static void error() {
System.out.println("ThreadPoolApp must be run with two positive valued" +
" integer arguments. The first detaling the number of jobs" +
" the second the number of processing threads in the pool");
System.exit(0); //exit the program
}
}
|
abrabete/threadpool_example
|
IntelliJ/src/ThreadPoolApp.java
|
Java
|
mit
| 4,608
|
.shape-1 {
text-shadow: rgb(30, 26, 35) 1px 1px,
rgb(31, 27, 36) 2px 2px,
rgb(32, 27, 37) 3px 3px,
rgb(32, 28, 38) 4px 4px,
rgb(33, 29, 38) 5px 5px,
rgb(34, 29, 39) 6px 6px,
rgb(34, 30, 40) 7px 7px,
rgb(35, 30, 41) 8px 8px,
rgb(36, 31, 42) 9px 9px,
rgb(36, 32, 42) 10px 10px,
rgb(37, 32, 43) 11px 11px,
rgb(38, 33, 44) 12px 12px,
rgb(38, 33, 45) 13px 13px,
rgb(39, 34, 46) 14px 14px,
rgb(40, 35, 46) 15px 15px,
rgb(40, 35, 47) 16px 16px,
rgb(41, 36, 48) 17px 17px,
rgb(42, 36, 49) 18px 18px,
rgb(42, 37, 49) 19px 19px,
rgb(43, 38, 50) 20px 20px,
rgb(44, 38, 51) 21px 21px,
rgb(44, 39, 52) 22px 22px,
rgb(45, 39, 53) 23px 23px,
rgb(46, 40, 53) 24px 24px,
rgb(46, 41, 54) 25px 25px,
rgb(47, 41, 55) 26px 26px,
rgb(48, 42, 56) 27px 27px,
rgb(48, 42, 57) 28px 28px,
rgb(49, 43, 57) 29px 29px,
rgb(50, 44, 58) 30px 30px,
rgb(50, 44, 59) 31px 31px,
rgb(51, 45, 60) 32px 32px,
rgb(52, 46, 61) 33px 33px;
height: 100%;
width: 100%;
font-size: 42px;
text-align: center;
}
.shape-2 {
text-shadow: rgb(30, 42, 53) 1px 1px,
rgb(31, 43, 54) 2px 2px,
rgb(32, 44, 55) 3px 3px,
rgb(32, 45, 56) 4px 4px,
rgb(33, 46, 58) 5px 5px,
rgb(34, 47, 59) 6px 6px,
rgb(34, 48, 60) 7px 7px,
rgb(35, 49, 61) 8px 8px,
rgb(36, 50, 62) 9px 9px,
rgb(36, 51, 64) 10px 10px,
rgb(37, 52, 65) 11px 11px,
rgb(38, 53, 66) 12px 12px,
rgb(38, 54, 67) 13px 13px,
rgb(39, 55, 68) 14px 14px,
rgb(40, 56, 70) 15px 15px,
rgb(40, 57, 71) 16px 16px,
rgb(41, 57, 72) 17px 17px,
rgb(42, 58, 73) 18px 18px,
rgb(42, 59, 75) 19px 19px,
rgb(43, 60, 76) 20px 20px,
rgb(44, 61, 77) 21px 21px,
rgb(44, 62, 78) 22px 22px,
rgb(45, 63, 79) 23px 23px,
rgb(46, 64, 81) 24px 24px,
rgb(46, 65, 82) 25px 25px,
rgb(47, 66, 83) 26px 26px,
rgb(48, 67, 84) 27px 27px,
rgb(48, 68, 85) 28px 28px,
rgb(49, 69, 87) 29px 29px,
rgb(50, 70, 88) 30px 30px,
rgb(50, 71, 89) 31px 31px,
rgb(51, 72, 90) 32px 32px,
rgb(52, 73, 92) 33px 33px;
height: 100%;
width: 100%;
font-size: 42px;
text-align: center;
}
.shape-3 {
text-shadow: rgb(53, 59, 69) 1px 1px,
rgb(54, 60, 71) 2px 2px,
rgb(55, 62, 72) 3px 3px,
rgb(56, 63, 74) 4px 4px,
rgb(58, 64, 75) 5px 5px,
rgb(59, 66, 77) 6px 6px,
rgb(60, 67, 79) 7px 7px,
rgb(61, 68, 80) 8px 8px,
rgb(62, 70, 82) 9px 9px,
rgb(64, 71, 83) 10px 10px,
rgb(65, 72, 85) 11px 11px,
rgb(66, 74, 86) 12px 12px,
rgb(67, 75, 88) 13px 13px,
rgb(68, 76, 90) 14px 14px,
rgb(70, 78, 91) 15px 15px,
rgb(71, 79, 93) 16px 16px,
rgb(72, 80, 94) 17px 17px,
rgb(73, 82, 96) 18px 18px,
rgb(75, 83, 97) 19px 19px,
rgb(76, 84, 99) 20px 20px,
rgb(77, 86, 101) 21px 21px,
rgb(78, 87, 102) 22px 22px,
rgb(79, 88, 104) 23px 23px,
rgb(81, 90, 105) 24px 24px,
rgb(82, 91, 107) 25px 25px,
rgb(83, 92, 108) 26px 26px,
rgb(84, 94, 110) 27px 27px,
rgb(85, 95, 112) 28px 28px,
rgb(87, 96, 113) 29px 29px,
rgb(88, 98, 115) 30px 30px,
rgb(89, 99, 116) 31px 31px,
rgb(90, 100, 118) 32px 32px,
rgb(92, 102, 120) 33px 33px;
height: 100%;
width: 100%;
font-size: 42px;
text-align: center;
}
.shape-4 {
text-shadow: rgb(145, 131, 122) 1px 1px,
rgb(148, 134, 125) 2px 2px,
rgb(151, 137, 128) 3px 3px,
rgb(154, 140, 130) 4px 4px,
rgb(158, 143, 133) 5px 5px,
rgb(161, 146, 136) 6px 6px,
rgb(164, 149, 139) 7px 7px,
rgb(167, 152, 141) 8px 8px,
rgb(171, 155, 144) 9px 9px,
rgb(174, 158, 147) 10px 10px,
rgb(177, 161, 150) 11px 11px,
rgb(180, 164, 152) 12px 12px,
rgb(184, 167, 155) 13px 13px,
rgb(187, 170, 158) 14px 14px,
rgb(190, 173, 160) 15px 15px,
rgb(193, 176, 163) 16px 16px,
rgb(197, 179, 166) 17px 17px,
rgb(200, 182, 169) 18px 18px,
rgb(203, 185, 171) 19px 19px,
rgb(206, 188, 174) 20px 20px,
rgb(210, 191, 177) 21px 21px,
rgb(213, 194, 180) 22px 22px,
rgb(216, 197, 182) 23px 23px,
rgb(219, 200, 185) 24px 24px,
rgb(223, 203, 188) 25px 25px,
rgb(226, 206, 190) 26px 26px,
rgb(229, 209, 193) 27px 27px,
rgb(232, 212, 196) 28px 28px,
rgb(236, 215, 199) 29px 29px,
rgb(239, 218, 201) 30px 30px,
rgb(242, 221, 204) 31px 31px,
rgb(245, 224, 207) 32px 32px,
rgb(249, 227, 210) 33px 33px;
height: 100%;
width: 100%;
font-size: 42px;
text-align: center;
}
.shape-5 {
text-shadow: rgb(35, 35, 35) 1px 1px,
rgb(36, 36, 36) 2px 2px,
rgb(37, 37, 37) 3px 3px,
rgb(38, 38, 38) 4px 4px,
rgb(38, 38, 38) 5px 5px,
rgb(39, 39, 39) 6px 6px,
rgb(40, 40, 40) 7px 7px,
rgb(41, 41, 41) 8px 8px,
rgb(42, 42, 42) 9px 9px,
rgb(42, 42, 42) 10px 10px,
rgb(43, 43, 43) 11px 11px,
rgb(44, 44, 44) 12px 12px,
rgb(45, 45, 45) 13px 13px,
rgb(46, 46, 46) 14px 14px,
rgb(46, 46, 46) 15px 15px,
rgb(47, 47, 47) 16px 16px,
rgb(48, 48, 48) 17px 17px,
rgb(49, 49, 49) 18px 18px,
rgb(49, 49, 49) 19px 19px,
rgb(50, 50, 50) 20px 20px,
rgb(51, 51, 51) 21px 21px,
rgb(52, 52, 52) 22px 22px,
rgb(53, 53, 53) 23px 23px,
rgb(53, 53, 53) 24px 24px,
rgb(54, 54, 54) 25px 25px,
rgb(55, 55, 55) 26px 26px,
rgb(56, 56, 56) 27px 27px,
rgb(57, 57, 57) 28px 28px,
rgb(57, 57, 57) 29px 29px,
rgb(58, 58, 58) 30px 30px,
rgb(59, 59, 59) 31px 31px,
rgb(60, 60, 60) 32px 32px,
rgb(61, 61, 61) 33px 33px;
height: 100%;
width: 100%;
font-size: 42px;
text-align: center;
}
.shape-6 {
text-shadow: rgb(136, 73, 63) 1px 1px,
rgb(139, 75, 64) 2px 2px,
rgb(142, 76, 66) 3px 3px,
rgb(145, 78, 67) 4px 4px,
rgb(148, 80, 68) 5px 5px,
rgb(151, 81, 70) 6px 6px,
rgb(154, 83, 71) 7px 7px,
rgb(157, 85, 73) 8px 8px,
rgb(160, 86, 74) 9px 9px,
rgb(163, 88, 75) 10px 10px,
rgb(166, 90, 77) 11px 11px,
rgb(169, 91, 78) 12px 12px,
rgb(172, 93, 80) 13px 13px,
rgb(175, 94, 81) 14px 14px,
rgb(178, 96, 82) 15px 15px,
rgb(181, 98, 84) 16px 16px,
rgb(185, 99, 85) 17px 17px,
rgb(188, 101, 87) 18px 18px,
rgb(191, 103, 88) 19px 19px,
rgb(194, 104, 89) 20px 20px,
rgb(197, 106, 91) 21px 21px,
rgb(200, 108, 92) 22px 22px,
rgb(203, 109, 94) 23px 23px,
rgb(206, 111, 95) 24px 24px,
rgb(209, 112, 96) 25px 25px,
rgb(212, 114, 98) 26px 26px,
rgb(215, 116, 99) 27px 27px,
rgb(218, 117, 101) 28px 28px,
rgb(221, 119, 102) 29px 29px,
rgb(224, 121, 103) 30px 30px,
rgb(227, 122, 105) 31px 31px,
rgb(230, 124, 106) 32px 32px,
rgb(234, 126, 108) 33px 33px;
height: 100%;
width: 100%;
font-size: 42px;
text-align: center;
}
.shape-register {
text-shadow: rgb(150, 150, 150) 1px 1px,
rgb(150, 150, 150) 2px 2px,
rgb(150, 150, 150) 3px 3px,
rgb(150, 150, 150) 4px 4px,
rgb(150, 150, 150) 5px 5px,
rgb(150, 150, 150) 6px 6px,
rgb(150, 150, 150) 7px 7px,
rgb(150, 150, 150) 8px 8px,
rgb(150, 150, 150) 9px 9px,
rgb(150, 150, 150) 10px 10px,
rgb(150, 150, 150) 11px 11px,
rgb(150, 150, 150) 12px 12px,
rgb(155, 155, 155) 13px 13px,
rgb(161, 161, 161) 14px 14px,
rgb(167, 167, 167) 15px 15px,
rgb(173, 173, 173) 16px 16px,
rgb(179, 179, 179) 17px 17px,
rgb(185, 185, 185) 18px 18px,
rgb(190, 190, 190) 19px 19px,
rgb(196, 196, 196) 20px 20px,
rgb(202, 202, 202) 21px 21px,
rgb(208, 208, 208) 22px 22px,
rgb(214, 214, 214) 23px 23px,
rgb(220, 220, 220) 24px 24px,
rgb(225, 225, 225) 25px 25px,
rgb(231, 231, 231) 26px 26px,
rgb(237, 237, 237) 27px 27px,
rgb(243, 243, 243) 28px 28px,
rgb(249, 249, 249) 29px 29px,
rgb(255, 255, 255) 30px 30px;
height: 100%;
width: 100%;
font-size: 65px;
text-align: center;
}
.row {
margin: 0 auto;
position: relative;
z-index: 1;
text-align: center;
}
.row span {
position: relative;
display: inline-block;
text-align: center;
margin: 30px 10px;
}
.gate {
display: inline-block;
width: 215px;
padding: 10px 0 10px 15px;
font-weight: 400;
color: #377D6A;
background: #efefef;
border: 0;
border-radius: 3px;
outline: 0;
text-indent: 65px;
transition: all .3s ease-in-out;
}
.gate textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"]{
height: 42px;
padding: 15px;
}
.gate::-webkit-input-placeholder {
color: #efefef;
text-indent: 0;
font-weight: 300;
}
.gate + label {
height: 42px;
display: inline-block;
position: absolute;
top: 0;
left: 0;
padding: 10px 15px;
text-shadow: 0 1px 0 rgba(19, 74, 70, 0.4);
background: #7AB893;
transition: all .4s ease-in-out;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
transform-origin: left bottom;
z-index: 99;
}
.gate + label:before, .gate + label:after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border-radius: 3px;
background: #377D6A;
transform-origin: left bottom;
transition: all .4s ease-in-out;
pointer-events: none;
z-index: -1;
}
.gate + label:before {
background: rgba(3, 36, 41, 0.2);
z-index: -2;
right: 20%;
}
span:nth-child(2) .gate {
text-indent: 85px;
}
span:nth-child(2) .gate:focus,
span:nth-child(2) .gate:active {
text-indent: 0;
}
.gate:focus,
.gate:active {
color: #377D6A;
text-indent: 0;
background: #fff;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.gate:focus::-webkit-input-placeholder,
.gate:active::-webkit-input-placeholder {
color: #aaa;
}
.gate:focus + label,
.gate:active + label {
transform: rotate(-66deg);
border-radius: 3px;
}
.gate:focus + label:before,
.gate:active + label:before {
transform: rotate(10deg);
}
.reg{
font-size: 18px;
}
.daleyBtns{
animation-delay: 1s;
-webkit-animation-delay: 1s;
}
/* General
==================================*/
h1 {
color: #fff;
text-shadow: 0px 2px 3px #666;
font-size: 42px;
font-weight: bolder;
}
.loginPic{
height: 70%;
}
.center{
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: center;
-moz-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-box-align: center;
-moz-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.backBtn {
position: relative;
}
/* Utilities
==================================*/
.title-bordered {
border-top: solid 2px #bbb;
padding-top: 30px;
}
p {
color: #555;
margin: 0 0 25px;
}
.scroll {
height: 100%;
}
/* Menu
==================================*/
.menu .bar.bar-header.expanded {
transition: all .5s ease-in-out;
}
.menu-open .bar.bar-header.expanded {
background-color: #222;
}
.menu h2 {
bottom: 0;
font-size: 18px;
left: 16px;
position: absolute;
}
.menu .avatar {
height: 88px;
width: 88px;
}
.menu.menu-left * {
font-weight: bold;
}
.menu-open .ion-navicon {
transform: rotate(-360deg);
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.menu-open .ion-navicon:before {
content: "\f2ca";
}
/* Login
==================================*/
.app-icon {
background-color: #fff;
background: url('../img/user.jpg') center;
background-size: cover;
border-radius: 50%;
height: 125px;
margin: 0 auto;
width: 125px;
}
.social-login {
position: fixed;
bottom: 0;
}
/* Input style
================================*/
.item-md-label input{
background-color: rgba(48, 105, 208, 0.6);
}
.item-md-label input.used~.input-label, .item-md-label input:focus~.input-label{
opacity: 1;
}
|
Mount-39/Behind-You
|
www/css/style.css
|
CSS
|
mit
| 12,533
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>18 --> 19</title>
<link href="./../../assets/style.css" rel="stylesheet">
</head>
<body>
<h2>You have to be fast</h2>
<a href="./a0e6245c7a5b31b28668da003f6e62b1c04cf44143de9d52d2ef3c286fcc6883.html">Teleport</a>
<hr>
<a href="./../../about.md">About</a> (Spoilers! )
<script src="./../../assets/md5.js"></script>
<script>
window.currentLevel = 7;
</script>
<script src="./../../assets/script.js"></script>
</body>
</html>
|
simonmysun/praxis
|
TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/aa7e162e6c7ae7efeef0b3843408a36429038e0b2e5543ae36886141a9c4af70.html
|
HTML
|
mit
| 550
|
#ifndef WF_INPUT_DEVICE_HPP
#define WF_INPUT_DEVICE_HPP
#include <wayfire/nonstd/wlroots.hpp>
namespace wf
{
class input_device_t
{
public:
/**
* General comment
* @return The represented wlr_input_device
*/
wlr_input_device *get_wlr_handle();
/**
* @param enabled Whether the compositor should handle input events from
* the device
* @return true if the device state was successfully changed
*/
bool set_enabled(bool enabled = true);
/**
* @return true if the compositor should receive events from the device
*/
bool is_enabled();
protected:
wlr_input_device *handle;
input_device_t(wlr_input_device *handle);
};
}
#endif /* end of include guard: WF_INPUT_DEVICE_HPP */
|
ammen99/wayfire
|
src/api/wayfire/input-device.hpp
|
C++
|
mit
| 758
|
<!DOCTYPE html>
<html ng-app="app">
<head lang="en">
<meta charset="UTF-8">
<script src="angular.min.js"></script>
<script src="controllerlist.js"></script>
<title></title>
</head>
<body>
<div ng-controller="expanderCtrl">
<expander title='title' text='text'></expander>
</div>
</body>
</html>
|
crystalwm/Angular_demo
|
AngularjsTutorial_cn/angular1_examples/指令/显示或者隐藏/index.html
|
HTML
|
mit
| 315
|
<!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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for io.js v1.0.4: v8::Private Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for io.js v1.0.4
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1_private.html">Private</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-static-methods">Static Public Member Functions</a> |
<a href="classv8_1_1_private-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">v8::Private Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <<a class="el" href="v8_8h_source.html">v8.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for v8::Private:</div>
<div class="dyncontent">
<div class="center">
<img src="classv8_1_1_private.png" usemap="#v8::Private_map" alt=""/>
<map id="v8::Private_map" name="v8::Private_map">
<area href="classv8_1_1_data.html" alt="v8::Data" shape="rect" coords="0,0,72,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a346820b1e830262d7f4f31e5c5ac7304"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a346820b1e830262d7f4f31e5c5ac7304"></a>
<a class="el" href="classv8_1_1_local.html">Local</a>< <a class="el" href="classv8_1_1_value.html">Value</a> > </td><td class="memItemRight" valign="bottom"><b>Name</b> () const </td></tr>
<tr class="separator:a346820b1e830262d7f4f31e5c5ac7304"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ae43aa9516121ed7a24cf5bba1654b653"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae43aa9516121ed7a24cf5bba1654b653"></a>
static <a class="el" href="classv8_1_1_local.html">Local</a>< <a class="el" href="classv8_1_1_private.html">Private</a> > </td><td class="memItemRight" valign="bottom"><b>New</b> (<a class="el" href="classv8_1_1_isolate.html">Isolate</a> *isolate, <a class="el" href="classv8_1_1_local.html">Local</a>< <a class="el" href="classv8_1_1_string.html">String</a> > name=<a class="el" href="classv8_1_1_local.html">Local</a>< <a class="el" href="classv8_1_1_string.html">String</a> >())</td></tr>
<tr class="separator:ae43aa9516121ed7a24cf5bba1654b653"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0ab8628387166b8a8abc6e9b6f40ad55"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0ab8628387166b8a8abc6e9b6f40ad55"></a>
static <a class="el" href="classv8_1_1_local.html">Local</a>< <a class="el" href="classv8_1_1_private.html">Private</a> > </td><td class="memItemRight" valign="bottom"><b>ForApi</b> (<a class="el" href="classv8_1_1_isolate.html">Isolate</a> *isolate, <a class="el" href="classv8_1_1_local.html">Local</a>< <a class="el" href="classv8_1_1_string.html">String</a> > name)</td></tr>
<tr class="separator:a0ab8628387166b8a8abc6e9b6f40ad55"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A private symbol</p>
<p>This is an experimental feature. Use at your own risk. </p>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li>deps/v8/include/<a class="el" href="v8_8h_source.html">v8.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 11 2015 23:49:17 for V8 API Reference Guide for io.js v1.0.4 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
|
v8-dox/v8-dox.github.io
|
297cadb/html/classv8_1_1_private.html
|
HTML
|
mit
| 7,570
|
<!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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v0.9.3: deps/v8/include/v8stdint.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v0.9.3
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_94a36784afa54c0b50996002372b429e.html">deps</a></li><li class="navelem"><a class="el" href="dir_7edecdc49f3d0e5b35ff20670f3bf33e.html">v8</a></li><li class="navelem"><a class="el" href="dir_3debe4bd29323c1699f247c91661804b.html">include</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v8stdint.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Copyright 2012 the V8 project authors. All rights reserved.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Redistribution and use in source and binary forms, with or without</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// modification, are permitted provided that the following conditions are</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// met:</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">//</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">// * Redistributions of source code must retain the above copyright</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">// notice, this list of conditions and the following disclaimer.</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">// * Redistributions in binary form must reproduce the above</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">// copyright notice, this list of conditions and the following</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">// disclaimer in the documentation and/or other materials provided</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">// with the distribution.</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">// * Neither the name of Google Inc. nor the names of its</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">// contributors may be used to endorse or promote products derived</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">// from this software without specific prior written permission.</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">//</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment">// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment">// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment">// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment">// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment">// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment">// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment">// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment">// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment">// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment">// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="comment">// Load definitions of standard types.</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#ifndef V8STDINT_H_</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#define V8STDINT_H_</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#include <stddef.h></span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#include <stdio.h></span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#if defined(_WIN32) && !defined(__MINGW32__)</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">char</span> int8_t;</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> uint8_t;</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="keyword">typedef</span> <span class="keywordtype">short</span> int16_t; <span class="comment">// NOLINT</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> uint16_t; <span class="comment">// NOLINT</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="keyword">typedef</span> <span class="keywordtype">int</span> int32_t;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> uint32_t;</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="keyword">typedef</span> __int64 int64_t;</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> __int64 uint64_t;</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="comment">// intptr_t and friends are defined in crtdefs.h through stdio.h.</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="preprocessor">#else</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <span class="preprocessor">#include <stdint.h></span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> </div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="preprocessor">#endif // V8STDINT_H_</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 11 2015 23:48:54 for V8 API Reference Guide for node.js v0.9.3 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
|
v8-dox/v8-dox.github.io
|
abf37c1/html/v8stdint_8h_source.html
|
HTML
|
mit
| 12,704
|
gcc -std=c99 -Ofast -Wall -Werror -pedantic -o pci_maker.exe pci_maker.c strxtoi.c
|
korun/dcs-system
|
pci/compile.sh
|
Shell
|
mit
| 83
|