hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
98 values
lang
stringclasses
21 values
max_stars_repo_path
stringlengths
3
945
max_stars_repo_name
stringlengths
4
118
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
368k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
945
max_issues_repo_name
stringlengths
4
118
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
945
max_forks_repo_name
stringlengths
4
135
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
1.05M
avg_line_length
float64
1
1.03M
max_line_length
int64
2
1.03M
alphanum_fraction
float64
0
1
e2daf77df1f75d5141d89bd65cb19f9294a828d8
3,259
py
Python
graph_db/types.py
josegomezr/graph_db
1ef286c9afdd4fd18559cccee9456dbc72ba7a8d
[ "Apache-2.0" ]
4
2015-11-19T01:22:19.000Z
2020-09-05T03:03:24.000Z
graph_db/types.py
josegomezr/graph_db
1ef286c9afdd4fd18559cccee9456dbc72ba7a8d
[ "Apache-2.0" ]
1
2016-03-10T01:11:03.000Z
2016-03-10T01:11:03.000Z
graph_db/types.py
josegomezr/graph_db
1ef286c9afdd4fd18559cccee9456dbc72ba7a8d
[ "Apache-2.0" ]
1
2016-03-08T00:03:18.000Z
2016-03-08T00:03:18.000Z
class BaseDBDriver(): """ This will stub the most basic methods that a GraphDB driver must have. """ _connected = False _settings = {} def __init__(self, dbapi): self.dbapi = dbapi def _debug(self, *args): if self.debug: print ("[GraphDB #%x]:" % id(self), *args) def _debugOut(self, *args): self._debug("OUT --> ", *args) def _debugIn(self, *args): self._debug("IN <-- ", *args) def connect(self): """ Performs connection to the database service. connect() -> self """ raise NotImplementedError('Not Implemented Yet') def query(self, sql): """ Performs a query to the database. query( sql ) -> dict """ raise NotImplementedError('Not Implemented Yet') def disconnect(self): """ Performs disconnection and garbage collection for the driver. connect() -> self """ raise NotImplementedError('Not Implemented Yet') class BaseEdgeDriver(object): """ Base driver for managing Edges. This will provide CRUD & search operations to be extended by drivers. """ def __init__(self, driver): self.driver = driver def create(self, eType, origin, destiny, data = {}): """ create(eType, origin, destiny [, data]) -> dict Creates an edge from *origin* to *destiny* """ raise NotImplementedError('Not Implemented Yet') def update(self, eType, criteria = {}, data = {}): """ update(eType [, criteria [, data]]) -> dict Update edges mathing a given criteria """ raise NotImplementedError('Not Implemented Yet') def delete(self, eType, criteria = {}): """ delete(eType [, criteria]) -> dict Delete edges mathing a given criteria """ raise NotImplementedError('Not Implemented Yet') def find(self, eType, criteria = {}): """ find(eType [, criteria]) -> list Find an edge for a given criteria. """ raise NotImplementedError('Not Implemented Yet') class BaseVertexDriver(object): """ Base driver for managing Vertexes. This will provide CRUD & search operations to be extended by drivers. """ def __init__(self, driver): self.driver = driver def create(self, vType, data = {}): """ create(vType, [, data]) -> dict Create a Vertex """ raise NotImplementedError('Not Implemented Yet') def update(self, vType, criteria = {}, data = {}): """ update(vType, criteria, data) -> dict Update a Vertex given a criteria """ raise NotImplementedError('Not Implemented Yet') def delete(self, vType, criteria = {}): """ delete(vType, criteria) -> dict Delete a Vertex given a criteria """ raise NotImplementedError('Not Implemented Yet') def find(self, vType, criteria = None): """ find(vType [, criteria]) -> list Look for vertexes matching criteria. """ raise NotImplementedError('Not Implemented Yet')
25.865079
74
0.562136
46b7fbdd1a3de1bb05f491238af4d135d617ecb1
3,913
py
Python
attribution/authorship_pipeline/data_loading/PathMinerDataset.py
yangzhou6666/authorship-detection
f28701dea256da70eb8ba216c2572e1975c99b54
[ "MIT" ]
14
2020-10-26T06:05:55.000Z
2022-03-08T08:32:17.000Z
attribution/authorship_pipeline/data_loading/PathMinerDataset.py
yangzhou6666/authorship-detection
f28701dea256da70eb8ba216c2572e1975c99b54
[ "MIT" ]
10
2020-02-29T16:55:20.000Z
2021-11-06T10:40:32.000Z
attribution/authorship_pipeline/data_loading/PathMinerDataset.py
yangzhou6666/authorship-detection
f28701dea256da70eb8ba216c2572e1975c99b54
[ "MIT" ]
4
2021-07-28T12:27:46.000Z
2021-10-04T18:12:33.000Z
from typing import Union, Tuple, List import numpy as np import torch import torch.nn.functional as F from torch.utils.data import Dataset from data_loading.PathMinerLoader import PathMinerLoader from data_loading.PathMinerSnapshotLoader import PathMinerSnapshotLoader from data_loading.UtilityEntities import PathContexts, path_contexts_from_index class PathMinerDataset(Dataset): """ Transforms data, loaded from AstMiner's output, to format suitable for model training. """ def __init__(self, path_contexts: Union[PathContexts, Tuple[List, List]], labels: np.ndarray, mode='nn', should_pad: bool = True): self._mode = mode self._size = labels.size self._labels = torch.LongTensor(labels) # For training PbNN if mode == 'nn': self._contexts = path_contexts self._should_pad = should_pad if should_pad: self._pad_length = 500 # For training PbRF/JCaliskan else: self._tokens, self._paths = path_contexts @classmethod def from_loader(cls, loader: PathMinerLoader, indices: np.ndarray = None, should_pad: bool = True): """ Prepares a dataset suitable for PbNN training. """ contexts, labels = (path_contexts_from_index(loader.path_contexts(), indices), loader.labels()[indices]) \ if indices is not None \ else (loader.path_contexts(), loader.labels()) return cls(contexts, labels, 'nn', should_pad) @classmethod def from_rf_loader(cls, loader: PathMinerSnapshotLoader, indices: np.ndarray = None): """ Prepares a dataset suitable for PbRF/JCaliskan training. """ tokens = loader._tokens_by_author if indices is None else loader._tokens_by_author[indices] paths = loader._paths_by_author if indices is None else loader._paths_by_author[indices] labels = loader.labels() if indices is None else loader.labels()[indices] return cls((tokens, paths), labels, 'rf') def __len__(self): return self._size def __getitem__(self, index): """ For PbNN pads tensors with zeros and picks random path-contexts if their number exceeds padding length. """ if self._mode == 'nn': cur_len = len(self._contexts.starts[index]) starts = torch.LongTensor(self._contexts.starts[index]) paths = torch.LongTensor(self._contexts.paths[index]) ends = torch.LongTensor(self._contexts.ends[index]) if self._should_pad: if cur_len < self._pad_length: return { 'starts': F.pad(starts, [0, self._pad_length - cur_len], mode='constant', value=0), 'paths': F.pad(paths, [0, self._pad_length - cur_len], mode='constant', value=0), 'ends': F.pad(ends, [0, self._pad_length - cur_len], mode='constant', value=0), 'labels': self._labels[index] } else: inds = np.random.permutation(cur_len)[:self._pad_length] return { 'starts': starts[inds], 'paths': paths[inds], 'ends': ends[inds], 'labels': self._labels[index] } else: return { 'starts': starts, 'paths': paths, 'ends': ends, 'labels': self._labels[index] } else: return { 'starts': self._tokens[index], 'paths': self._paths[index], 'ends': self._paths[index], 'labels': self._labels[index] } def labels(self) -> np.ndarray: return self._labels.numpy()
40.340206
134
0.577562
3899eb38f956bef36ae9cc71c15b20f2c04d6d4e
1,206
php
PHP
resources/lang/en/emails.php
jeremykenedy/jeremykenedy.com
3db6bc93f41c3f79230aac793d56d67e3fb735d8
[ "MIT" ]
2
2020-04-30T18:29:33.000Z
2021-08-16T07:44:10.000Z
resources/lang/en/emails.php
jeremykenedy/jeremykenedy.com
3db6bc93f41c3f79230aac793d56d67e3fb735d8
[ "MIT" ]
null
null
null
resources/lang/en/emails.php
jeremykenedy/jeremykenedy.com
3db6bc93f41c3f79230aac793d56d67e3fb735d8
[ "MIT" ]
2
2019-08-08T04:02:27.000Z
2020-04-30T18:29:40.000Z
<?php return [ /* |-------------------------------------------------------------------------- | Lara(b)log Emails language lines |-------------------------------------------------------------------------- | */ 'contact' => [ 'intro' => 'You have received a new message from your blog contact form.', 'details' => 'Contact Details:', 'labels' => [ 'firstname' => 'Firstname:', 'lastname' => 'Lastname:', 'phone' => 'Phone:', 'email' => 'Email:', 'message' => 'Message:', ], ], /* |-------------------------------------------------------------------------- | Portfolio Emails language lines |-------------------------------------------------------------------------- | */ 'homecontact' => [ 'intro' => 'You have received a new message from your portfolio website contact form.', 'details' => 'Contact Details:', 'labels' => [ 'name' => 'Name:', 'phone' => 'Phone:', 'subject' => 'Subject:', 'message' => 'Message:', ], ], ];
28.714286
99
0.306799
b076765b64dbb0f3a42e016d5a8c9588944e4176
9,296
py
Python
src/QueueTest.py
fuzziqersoftware/sharedstructures
23471fc24484b472e4b2399d7c64c1071d12c641
[ "MIT" ]
21
2016-11-30T06:40:04.000Z
2022-03-23T13:16:53.000Z
src/QueueTest.py
fuzziqersoftware/sharedstructures
23471fc24484b472e4b2399d7c64c1071d12c641
[ "MIT" ]
null
null
null
src/QueueTest.py
fuzziqersoftware/sharedstructures
23471fc24484b472e4b2399d7c64c1071d12c641
[ "MIT" ]
3
2018-02-21T12:25:08.000Z
2021-12-16T06:14:05.000Z
import os import subprocess import sys import time import sharedstructures POOL_NAME_PREFIX = "QueueTest-py-pool-" ALLOCATOR_TYPES = ('simple', 'logarithmic') def get_current_process_lsof(): return subprocess.check_output(['lsof', '-p', str(os.getpid())]) def q_push(q, front, item, raw=False): if front: q.push_front(item, raw=raw) else: q.push_back(item, raw=raw) def q_pop(q, front, raw=False): if front: return q.pop_front(raw=raw) else: return q.pop_back(raw=raw) def run_basic_test(allocator_type): print('-- [%s] basic' % allocator_type) before_lsof_count = len(get_current_process_lsof().splitlines()) q = sharedstructures.Queue(POOL_NAME_PREFIX + allocator_type, allocator_type) assert len(q) == 0 assert q.bytes() == 0 def test_queue(q, reverse): print('-- [%s] %s queue operation' % (allocator_type, "reverse" if reverse else "forward")) q_push(q, reverse, b"v1") assert 1 == len(q) q_push(q, reverse, "val2") assert 2 == len(q) q_push(q, reverse, 47) assert 3 == len(q) q_push(q, reverse, None) assert 4 == len(q) q_push(q, reverse, (None, False, True, 37, 2.0, ['lol', 'hax'], {1: 2})) assert 5 == len(q) assert b"v1" == q_pop(q, not reverse) assert 4 == len(q) assert "val2" == q_pop(q, not reverse) assert 3 == len(q) assert 47 == q_pop(q, not reverse) assert 2 == len(q) assert None == q_pop(q, not reverse) assert 1 == len(q) assert (None, False, True, 37, 2.0, ['lol', 'hax'], {1: 2}) == q_pop(q, not reverse) assert 0 == len(q) assert q.bytes() == 0 try: q_pop(q, not reverse) assert False except IndexError: pass test_queue(q, False) test_queue(q, True) def test_stack(q, front): print("-- [%s] %s stack operation" % (allocator_type, "front" if front else "back")) q_push(q, front, b"v1") assert 1 == len(q) q_push(q, front, "val2") assert 2 == len(q) q_push(q, front, 47) assert 3 == len(q) q_push(q, front, None) assert 4 == len(q) q_push(q, front, (None, False, True, 37, 2.0, ['lol', 'hax'], {1: 2})) assert 5 == len(q) assert (None, False, True, 37, 2.0, ['lol', 'hax'], {1: 2}) == q_pop(q, front) assert 4 == len(q) assert None == q_pop(q, front) assert 3 == len(q) assert 47 == q_pop(q, front) assert 2 == len(q) assert "val2" == q_pop(q, front) assert 1 == len(q) assert b"v1" == q_pop(q, front) assert 0 == len(q) assert q.bytes() == 0 try: q_pop(q, front) assert False except IndexError: pass test_stack(q, False) test_stack(q, True) del q # this should unmap the shared memory pool and close the fd sharedstructures.delete_pool(POOL_NAME_PREFIX + allocator_type) # make sure we didn't leak an fd assert before_lsof_count == len(get_current_process_lsof().splitlines()) def run_raw_test(allocator_type): print('-- [%s] basic' % allocator_type) before_lsof_count = len(get_current_process_lsof().splitlines()) q = sharedstructures.Queue(POOL_NAME_PREFIX + allocator_type, allocator_type) assert len(q) == 0 assert q.bytes() == 0 def test_queue(q, reverse): print('-- [%s] %s queue operation' % (allocator_type, "reverse" if reverse else "forward")) try: q_push(q, reverse, None, raw=True) assert False except TypeError: pass assert 0 == len(q) q_push(q, reverse, b"v1", raw=True) assert 1 == len(q) q_push(q, reverse, b"v2", raw=True) assert 2 == len(q) q_push(q, reverse, b"v3", raw=True) assert 3 == len(q) assert b"v1" == q_pop(q, not reverse, raw=True) assert 2 == len(q) assert b"v2" == q_pop(q, not reverse, raw=True) assert 1 == len(q) assert b"v3" == q_pop(q, not reverse, raw=True) assert 0 == len(q) assert q.bytes() == 0 try: q_pop(q, not reverse, raw=True) assert False except IndexError: pass test_queue(q, False) test_queue(q, True) def test_stack(q, front): print("-- [%s] %s stack operation" % (allocator_type, "front" if front else "back")) try: q_push(q, front, None, raw=True) assert False except TypeError: pass assert 0 == len(q) q_push(q, front, b"v1", raw=True) assert 1 == len(q) q_push(q, front, b"v2", raw=True) assert 2 == len(q) q_push(q, front, b"v3", raw=True) assert 3 == len(q) assert b"v3" == q_pop(q, front, raw=True) assert 2 == len(q) assert b"v2" == q_pop(q, front, raw=True) assert 1 == len(q) assert b"v1" == q_pop(q, front, raw=True) assert 0 == len(q) assert q.bytes() == 0 try: q_pop(q, front, raw=True) assert False except IndexError: pass test_stack(q, False) test_stack(q, True) del q # this should unmap the shared memory pool and close the fd sharedstructures.delete_pool(POOL_NAME_PREFIX + allocator_type) # make sure we didn't leak an fd assert before_lsof_count == len(get_current_process_lsof().splitlines()) def run_concurrent_producers_test(allocator_type): print('-- [%s] concurrent producers' % allocator_type) child_pids = set() while (len(child_pids) < 8) and (0 not in child_pids): child_pids.add(os.fork()) if 0 in child_pids: # child process: generate the numbers [0, 1000) prefixed with our pid q = sharedstructures.Queue(POOL_NAME_PREFIX + allocator_type, allocator_type) pid = os.getpid() for x in range(1000): q.push_back(b'%d-%d' % (pid, x)) os._exit(0) else: # parent process: write the key, then wait for children to terminate q = sharedstructures.Queue(POOL_NAME_PREFIX + allocator_type, allocator_type) latest_value_from_process = {pid: -1 for pid in child_pids} num_failures = 0 while child_pids: try: data = q.pop_front() pid, value = data.split(b'-') pid = int(pid) value = int(value) assert pid in latest_value_from_process assert latest_value_from_process[pid] < value latest_value_from_process[pid] = value except IndexError: # queue is empty pid, exit_status = os.wait() child_pids.remove(pid) if os.WIFEXITED(exit_status) and (os.WEXITSTATUS(exit_status) == 0): print('-- [%s] child %d terminated successfully' % ( allocator_type, pid)) else: print('-- [%s] child %d failed (%d)' % ( allocator_type, pid, exit_status)) num_failures += 1 assert 0 == len(child_pids) assert 0 == num_failures def run_concurrent_consumers_test(allocator_type): print('-- [%s] concurrent consumers' % allocator_type) # initialize the queue before forking children q = sharedstructures.Queue(POOL_NAME_PREFIX + allocator_type, allocator_type) del q child_pids = set() while (len(child_pids) < 8) and (0 not in child_pids): child_pids.add(os.fork()) if 0 in child_pids: # child process: read numbers and expect them to be in increasing order # stop when -1 is received q = sharedstructures.Queue(POOL_NAME_PREFIX + allocator_type, allocator_type) prev_value = -1 value = 0 while True: try: item = q.pop_front() value = int(item) if value == -1: break except IndexError: time.sleep(0.00001) continue assert value > prev_value prev_value = value os._exit(0) else: # parent process: push numbers [0, 10000), then wait for children q = sharedstructures.Queue(POOL_NAME_PREFIX + allocator_type, allocator_type) for v in range(10000): q.push_back(b'%d' % v) for _ in child_pids: q.push_back(b'-1') num_failures = 0 while child_pids: pid, exit_status = os.wait() child_pids.remove(pid) if os.WIFEXITED(exit_status) and (os.WEXITSTATUS(exit_status) == 0): print('-- [%s] child %d terminated successfully' % ( allocator_type, pid)) else: print('-- [%s] child %d failed (%d)' % ( allocator_type, pid, exit_status)) num_failures += 1 assert 0 == len(child_pids) assert 0 == num_failures def main(): try: for allocator_type in ALLOCATOR_TYPES: sharedstructures.delete_pool(POOL_NAME_PREFIX + allocator_type) run_basic_test(allocator_type) sharedstructures.delete_pool(POOL_NAME_PREFIX + allocator_type) run_raw_test(allocator_type) sharedstructures.delete_pool(POOL_NAME_PREFIX + allocator_type) run_concurrent_producers_test(allocator_type) sharedstructures.delete_pool(POOL_NAME_PREFIX + allocator_type) run_concurrent_consumers_test(allocator_type) print('all tests passed') return 0 finally: for allocator_type in ALLOCATOR_TYPES: sharedstructures.delete_pool(POOL_NAME_PREFIX + allocator_type) if __name__ == '__main__': sys.exit(main())
28.869565
98
0.610047
ae92693e17836c2059ffcf614c94346ea02db32e
1,426
cs
C#
Application/ExperimentTemplates/BatchExperimentTemplate.cs
bartoszkp/dotrl
56b7b184c177987a005d862ef667b0efc819b1bd
[ "BSD-4-Clause", "BSD-3-Clause" ]
5
2016-10-15T15:18:48.000Z
2021-09-05T22:49:42.000Z
Application/ExperimentTemplates/BatchExperimentTemplate.cs
bartoszkp/dotrl
56b7b184c177987a005d862ef667b0efc819b1bd
[ "BSD-4-Clause", "BSD-3-Clause" ]
null
null
null
Application/ExperimentTemplates/BatchExperimentTemplate.cs
bartoszkp/dotrl
56b7b184c177987a005d862ef667b0efc819b1bd
[ "BSD-4-Clause", "BSD-3-Clause" ]
2
2016-10-16T12:59:52.000Z
2018-03-13T17:33:53.000Z
using System.Collections.Generic; using System.Linq; namespace Application.ExperimentTemplates { public class BatchExperimentTemplate { public static BatchExperimentTemplate Create(BatchMode batchMode) { return new BatchExperimentTemplate() { BatchMode = batchMode }; } public static BatchExperimentTemplate Create(BatchExperiment batchExperiment) { return BatchExperimentTemplate .Create(batchExperiment.BatchMode) .WithExperimentTemplates(batchExperiment .Experiments .Select(e => ExperimentTemplate.Create(e))); } public BatchMode BatchMode { get; set; } public ExperimentTemplate[] ExperimentTemplates { get; set; } public BatchExperimentTemplate WithExperimentTemplates(IEnumerable<ExperimentTemplate> experimentTemplates) { this.ExperimentTemplates = experimentTemplates.ToArray(); return this; } public BatchExperiment ToBatchExperiment() { BatchExperiment result = new BatchExperiment(this.BatchMode); result.AddExperiments(ExperimentTemplates.Select(et => et.ToExperiment())); return result; } } }
31.688889
116
0.587658
718eebc48351cbe454873a66eb6f761551ccdcf4
1,056
sh
Shell
builder/build.sh
cockscomb/api-gateway-swift
e5f8239749a4214e68731cea45b52db6f8b1d57f
[ "MIT" ]
null
null
null
builder/build.sh
cockscomb/api-gateway-swift
e5f8239749a4214e68731cea45b52db6f8b1d57f
[ "MIT" ]
null
null
null
builder/build.sh
cockscomb/api-gateway-swift
e5f8239749a4214e68731cea45b52db6f8b1d57f
[ "MIT" ]
null
null
null
#!/bin/bash set -eu executable=$1 swift build --product $executable -c release target=.build/lambda/$executable rm -rf "$target" mkdir -p "$target" cp ".build/release/$executable" "$target/" cp -Pv \ /usr/lib/swift/linux/libBlocksRuntime.so \ /usr/lib/swift/linux/libFoundation.so \ /usr/lib/swift/linux/libFoundationNetworking.so \ /usr/lib/swift/linux/libFoundationXML.so \ /usr/lib/swift/linux/libdispatch.so \ /usr/lib/swift/linux/libicudataswift.so \ /usr/lib/swift/linux/libicudataswift.so.65 \ /usr/lib/swift/linux/libicudataswift.so.65.1 \ /usr/lib/swift/linux/libicui18nswift.so \ /usr/lib/swift/linux/libicui18nswift.so.65 \ /usr/lib/swift/linux/libicui18nswift.so.65.1 \ /usr/lib/swift/linux/libicuucswift.so \ /usr/lib/swift/linux/libicuucswift.so.65 \ /usr/lib/swift/linux/libicuucswift.so.65.1 \ /usr/lib/swift/linux/libswiftCore.so \ /usr/lib/swift/linux/libswiftDispatch.so \ /usr/lib/swift/linux/libswiftGlibc.so \ "$target" cd "$target" ln -s "$executable" "bootstrap" zip --symlinks lambda.zip *
29.333333
51
0.726326
b2c2cd4009dc2c051c24e964137cf6516088270a
805
css
CSS
app/src/main/assets/www/css/styles.css
TobiCode/Pos_system_2
ecc6479a7800ab29272221fa02a2a34e9ba9cf8a
[ "MIT" ]
null
null
null
app/src/main/assets/www/css/styles.css
TobiCode/Pos_system_2
ecc6479a7800ab29272221fa02a2a34e9ba9cf8a
[ "MIT" ]
null
null
null
app/src/main/assets/www/css/styles.css
TobiCode/Pos_system_2
ecc6479a7800ab29272221fa02a2a34e9ba9cf8a
[ "MIT" ]
null
null
null
table { margin: 0 auto; text-align: center; border-collapse: collapse; border: 1px solid #d4d4d4; } tr:nth-child(even) { background: #d4d4d4; } th, td { padding: 10px 30px; } th { border-bottom: 1px solid #d4d4d4; } h1 { color: blue; } #search { background-image: url('searchicon2.png'); /* Add a search icon to input */ background-position: 5px 5px; /* Position the search icon */ background-size: 30px 30px; background-repeat: no-repeat; /* Do not repeat the icon image */ width: 100%; /* Full-width */ font-size: 16px; /* Increase font-size */ padding: 12px 20px 12px 40px; /* Add some padding */ border: 1px solid #ddd; /* Add a grey border */ margin-bottom: 12px; /* Add some space below the input */ } input { width: 100%; height: 100%; }
16.770833
43
0.63354
cf315ffc4d6e495f814c33c49e8f3969745bb388
4,608
php
PHP
resources/views/welcome.blade.php
suryakindi66/lindingi-dirimu-withapi-v2
98cf76236793d733b73675964d90a98984bc8d92
[ "MIT" ]
null
null
null
resources/views/welcome.blade.php
suryakindi66/lindingi-dirimu-withapi-v2
98cf76236793d733b73675964d90a98984bc8d92
[ "MIT" ]
null
null
null
resources/views/welcome.blade.php
suryakindi66/lindingi-dirimu-withapi-v2
98cf76236793d733b73675964d90a98984bc8d92
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet"> <link rel="icon" href="/assets-landingpage/favicon.png"> <title>Lindungi Diri</title> <!-- Bootstrap core CSS --> <link href="/assets-landingpage/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <!-- Additional CSS Files --> <link rel="stylesheet" href="/assets-landingpage/assets/css/fontawesome.css"> <link rel="stylesheet" href="/assets-landingpage/assets/css/templatemo-digimedia-v3.css"> <link rel="stylesheet" href="/assets-landingpage/assets/css/animated.css"> <link rel="stylesheet" href="/assets-landingpage/assets/css/owl.css"> <!-- TemplateMo 568 DigiMedia https://templatemo.com/tm-568-digimedia --> </head> <body> <!-- ***** Preloader Start ***** --> <div id="js-preloader" class="js-preloader"> <div class="preloader-inner"> <span class="dot"></span> <div class="dots"> <span></span> <span></span> <span></span> </div> </div> </div> <!-- ***** Preloader End ***** --> <div class="main-banner wow fadeIn" id="top" data-wow-duration="1s" data-wow-delay="0.5s"> <div class="container" style="margin-top: -150px"> <div class="row"> <div class="col-lg-12"> <div class="row"> <div class="col-lg-6 align-self-center"> <div class="left-content show-up header-text wow fadeInLeft" data-wow-duration="1s" data-wow-delay="1s"> <div class="row"> <div class="col-lg-12"> <h6>Lindingi Diri Mu</h6> <h2>Catat Perjalanan Kamu</h2> <font style="color:grey">Catat perjalananmu hari ini, tetap patuhi protokol kesehatan, agar dapat membantu memutus rantai penularan virus.</font><br><br> <font style="color:grey">Data Sebaran Mengenai Covid-19 Di Indonesia : </font> <br><br> <font style="color:orange">Positif : {{$datapositif}} Orang </font> <hr width="100%"> <font style="color:blue">Dirawat : {{$datadirawat}} Orang</font><hr width="100%"> <font style="color:green">Sembuh : {{$datasembuh}} Orang</font> <hr width="100%"> <font style="color:red">Meninggal : {{$datameninggal}} Orang</font> <hr width="100%"> </div> <div class="col-lg-12"><br> <div class="border-first-button scroll-to-section"> <a href="/login">Catat Perjalananmu Disini</a> </div> </div> </div> </div> </div> <div class="col-lg-6"> <div class="right-image wow fadeInRight" data-wow-duration="1s" data-wow-delay="0.5s"> <img src="/assets-landingpage/assets/images/slider-dec-v3.png" alt=""> </div> <center> <br><font><i>Development By Surya Kindi.</i></font> <br><font><i>Inspiration Aplication From Peduli Lindungi.</i></font> <br><b><font style="color:gray">Real Data Statistic From API Covid-19</font></b></center> </div> </div> </div> </div> </div> </div> </div> <footer> <div class="container"> <div class="row"> <div class="col-lg-12"> <p>Copyright © 2022 Surya Kindi </p> </div> </div> </div> </footer> <!-- Scripts --> <script src="/assets-landingpage/vendor/jquery/jquery.min.js"></script> <script src="/assets-landingpage/vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="/assets-landingpage/assets/js/owl-carousel.js"></script> <script src="/assets-landingpage/assets/js/animation.js"></script> <script src="/assets-landingpage/assets/js/imagesloaded.js"></script> <script src="/assets-landingpage/assets/js/custom.js"></script> </body> </html>
33.391304
173
0.550998
9850b53cc74210a1ae61d1b6224d3ed70af0ddc2
860
cs
C#
QX.NodeParty.Runtime/Registry/Services/ServiceContainerNode.cs
alexrster/QX.NodeParty
b1949de988cf1ff0cc566fbf0a2754a93716eb96
[ "MIT" ]
1
2016-03-22T23:02:16.000Z
2016-03-22T23:02:16.000Z
QX.NodeParty.Runtime/Registry/Services/ServiceContainerNode.cs
alexrster/QX.NodeParty
b1949de988cf1ff0cc566fbf0a2754a93716eb96
[ "MIT" ]
null
null
null
QX.NodeParty.Runtime/Registry/Services/ServiceContainerNode.cs
alexrster/QX.NodeParty
b1949de988cf1ff0cc566fbf0a2754a93716eb96
[ "MIT" ]
null
null
null
using System; using System.Diagnostics; using System.Threading.Tasks; using QX.NodeParty.Services; namespace QX.NodeParty.Runtime.Registry.Services { public class ServiceContainerNode<TService> : Composition.Base.Node, IServiceContainerNode<TService> where TService : class { private readonly IServiceLocator _serviceLocator; protected Func<IServiceLocator, Task<TService>> Factory { get; } protected ServiceContainerNode(NodeUri nodeUri, IServiceLocator serviceLocator, Func<IServiceLocator, Task<TService>> factory) : base(nodeUri) { _serviceLocator = serviceLocator; Factory = factory; } public virtual async Task<TService> GetInstance(string data = null) { Debug.Print($"Service Locator OK - invoke Service Factory of '{typeof(TService)}'"); return await Factory(_serviceLocator); } } }
31.851852
146
0.743023
e0574d72952de7df32a7bf59c640be547bcdd101
3,703
h
C
src/shogun/classifier/svm/GNPPLib.h
srgnuclear/shogun
33c04f77a642416376521b0cd1eed29b3256ac13
[ "Ruby", "MIT" ]
1
2015-11-05T18:31:14.000Z
2015-11-05T18:31:14.000Z
src/shogun/classifier/svm/GNPPLib.h
waderly/shogun
9288b6fa38e001d63c32188f7f847dadea66e2ae
[ "Ruby", "MIT" ]
null
null
null
src/shogun/classifier/svm/GNPPLib.h
waderly/shogun
9288b6fa38e001d63c32188f7f847dadea66e2ae
[ "Ruby", "MIT" ]
null
null
null
/*----------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Library of solvers for Generalized Nearest Point Problem (GNPP). * * Written (W) 1999-2008 Vojtech Franc, xfrancv@cmp.felk.cvut.cz * Copyright (C) 1999-2008 Center for Machine Perception, CTU FEL Prague * -------------------------------------------------------------------- */ #ifndef GNPPLIB_H__ #define GNPPLIB_H__ #include <shogun/lib/config.h> #include <math.h> #include <limits.h> #include <shogun/base/SGObject.h> #include <shogun/io/SGIO.h> #include <shogun/lib/common.h> #include <shogun/kernel/Kernel.h> namespace shogun { /** @brief class GNPPLib, a Library of solvers for Generalized Nearest Point * Problem (GNPP). */ class CGNPPLib: public CSGObject { public: /** default constructor */ CGNPPLib(); /** constructor * * @param vector_y vector y * @param kernel kernel * @param num_data number of data * @param reg_const reg const */ CGNPPLib(float64_t* vector_y, CKernel* kernel, int32_t num_data, float64_t reg_const); virtual ~CGNPPLib(); /** -------------------------------------------------------------- QP solver based on MDM algorithm. Usage: exitflag = gnpp_mdm(diag_H, vector_c, vector_y, dim, tmax, tolabs, tolrel, th, &alpha, &t, &aHa11, &aHa22, &History ); -------------------------------------------------------------- */ int8_t gnpp_mdm(float64_t *diag_H, float64_t *vector_c, float64_t *vector_y, int32_t dim, int32_t tmax, float64_t tolabs, float64_t tolrel, float64_t th, float64_t *alpha, int32_t *ptr_t, float64_t *ptr_aHa11, float64_t *ptr_aHa22, float64_t **ptr_History, int32_t verb); /** -------------------------------------------------------------- QP solver based on improved MDM algorithm (u fixed v optimized) Usage: exitflag = gnpp_imdm( diag_H, vector_c, vector_y, dim, tmax, tolabs, tolrel, th, &alpha, &t, &aHa11, &aHa22, &History ); -------------------------------------------------------------- */ int8_t gnpp_imdm(float64_t *diag_H, float64_t *vector_c, float64_t *vector_y, int32_t dim, int32_t tmax, float64_t tolabs, float64_t tolrel, float64_t th, float64_t *alpha, int32_t *ptr_t, float64_t *ptr_aHa11, float64_t *ptr_aHa22, float64_t **ptr_History, int32_t verb); /** @return object name */ virtual const char* get_name() const { return "GNPPLib"; } protected: /** get col * * @param a a * @param b b * @return something floaty */ float64_t* get_col(int64_t a, int64_t b); /** kernel columns */ float64_t** kernel_columns; /** cache index */ float64_t* cache_index; /** first kernel inx */ int32_t first_kernel_inx; /** cache size */ int64_t Cache_Size; /** num data */ int32_t m_num_data; /** reg const */ float64_t m_reg_const; /** vector y */ float64_t* m_vector_y; /** kernel */ CKernel* m_kernel; }; } #endif // GNPPLIB_H__
30.105691
89
0.520659
df2529866c2da9575494ea6a4c906083c0fbde09
1,107
cs
C#
Code/Enum/MouseButton.cs
MichaelMcGlothlin/unity-doodles
8645a1944621d840503a5d203160c660e563008d
[ "MIT" ]
1
2019-04-29T23:04:58.000Z
2019-04-29T23:04:58.000Z
Code/Enum/MouseButton.cs
MichaelMcGlothlin/unity-doodles
8645a1944621d840503a5d203160c660e563008d
[ "MIT" ]
null
null
null
Code/Enum/MouseButton.cs
MichaelMcGlothlin/unity-doodles
8645a1944621d840503a5d203160c660e563008d
[ "MIT" ]
1
2020-02-06T10:02:18.000Z
2020-02-06T10:02:18.000Z
namespace Kavlon { public enum MouseButton { Primary = 0, // UnityEngine.KeyCode.Mouse0 Secondary, // UnityEngine.KeyCode.Mouse1 Middle, // UnityEngine.KeyCode.Mouse2 Button4, // UnityEngine.KeyCode.Mouse3 Button5, // UnityEngine.KeyCode.Mouse4 Button6, // UnityEngine.KeyCode.Mouse5 Button7 // UnityEngine.KeyCode.Mouse6 } public static class MouseButtonExtensions { public static UnityEngine.KeyCode ToKeyCode ( this MouseButton mouseButton ) { switch ( mouseButton ) { case MouseButton.Primary: { return UnityEngine.KeyCode.Mouse0; } case MouseButton.Secondary: { return UnityEngine.KeyCode.Mouse1; } case MouseButton.Middle: { return UnityEngine.KeyCode.Mouse2; } case MouseButton.Button4: { return UnityEngine.KeyCode.Mouse3; } case MouseButton.Button5: { return UnityEngine.KeyCode.Mouse4; } case MouseButton.Button6: { return UnityEngine.KeyCode.Mouse5; } case MouseButton.Button7: { return UnityEngine.KeyCode.Mouse6; } } return UnityEngine.KeyCode.None; } } }
27
80
0.693767
81da9396254d410338ff05a9008469e406db8560
3,912
php
PHP
resources/views/site/filter.blade.php
younginnovations/resourcecontracts-rc-subsite
a1af9efb72eef85e0ecf3994a2a385d2d7129e78
[ "MIT" ]
3
2016-03-21T15:43:40.000Z
2019-11-12T05:50:25.000Z
resources/views/site/filter.blade.php
younginnovations/resourcecontracts-rc-subsite
a1af9efb72eef85e0ecf3994a2a385d2d7129e78
[ "MIT" ]
13
2016-12-08T22:35:22.000Z
2021-04-16T20:52:43.000Z
resources/views/site/filter.blade.php
younginnovations/resourcecontracts-rc-subsite
a1af9efb72eef85e0ecf3994a2a385d2d7129e78
[ "MIT" ]
5
2015-09-29T17:29:29.000Z
2019-04-30T14:16:43.000Z
<?php header("Status: 301 Moved Permanently"); header("Location:./search/group?". $_SERVER['QUERY_STRING']); die(); ?> @extends('layout.app-full') @section('content') <div class="row"> <div class="col-lg-12 panel-top-wrapper search-top-wrapper attached-top-wrapper"> <div class="panel-top-content"> <div class="clearfix"> <div class="back back-button">Back</div> <div class="panel-title"> <?php $q = \Illuminate\Support\Facades\Input::get('q'); $params = Request::all(); $showSearchQ = showSearchQuery($params, $filter); ?> @if($showSearchQ) <div id="search_query" class="isolate" style="font-weight: normal; display: inline;">@lang('global.all_documents')</div> @else @lang('global.search_results') <div id="search_query" style="font-weight: normal; display: inline"> @if($q)for @endif <span>{{$q}}</span></div> @endif </div> </div> </div> </div> </div> <div class="row relative--small-screen"> <div class="filter-wrapper advance-filter-wrapper" style="min-height: 135px"> <div class="col-lg-12 static-search"> <div class="filter-country-wrap" style="display: none"> <!-- <input type="hidden" name="q" value="{{$q}}" id="header-input-clone"> --> @include('layout.partials.search', ['searchPage' =>true]) </form> </div> </div> <?php $params['download'] = true; $download_route = route('contract.csv.download'); $querystring = http_build_query($params); ?> @if($contracts->total!=0) <button class="clip-btn on-annotation"> <span class="icon"></span> <span class="text">@lang('clip.clip')</span> </button> <div class="social-share dropdown" id="social-toggler"> <a class="dropdown-toggle" data-toggle="dropdown"> <span class="text">@lang('contract.social_share')</span> </a> @include('contract.partials.share') </div> <div class="download-csv"> <!-- Build link dynamically with JS to prevent access for aggressive web crawlers. --> <a href="javascript:void(0)" onClick="window.location.href = '{{$download_route}}' + '?' + '{{$querystring}}'; return false;"> <span class="text">@lang('search.download')</span> </a> </div> @endif @if(!$showSearchQ) <div class="contract-number-wrap contract-search-number-wrap has-static-search"> <span>{{$contracts->total}}</span> {{ \Illuminate\Support\Facades\Lang::choice('global.documents' , $contracts->total) }} </div> @else <div class="contract-number-wrap contract-search-number-wrap"> <span>{{$contracts->total}}</span> {{ \Illuminate\Support\Facades\Lang::choice('global.documents' , $contracts->total) }} </div> @endif </div> </div> <div class="row"> <div class="col-lg-12 country-list-wrapper"> <div class="panel panel-default panel-wrap country-list-wrap"> <div class="panel-body"> @include('contract.partials.search_list') @include('contract.partials.pagination', ['total_item' => $contracts->total, 'per_page'=>$contracts->per_page, 'current_page' => $currentPage,'contracts' => $contracts ]) </div> </div> </div> </div> @stop @section('js') <script> var lang = <?php echo json_encode(trans('annotation'));?>; var contractURL = '{{url('contract')}}'; $(function () { $('.filter-country-wrap').show(); }); </script> <script type="text/javascript"> $('document').ready(function(){ $("#close_adv_search").on("click",function(){$(".static-search").slideUp(200),$(this).hide(),$("#open_adv_search").show()}),$("#open_adv_search").on("click",function(){$(".static-search").slideDown(200),$(this).hide(),$("#close_adv_search").show()}); var query = {!! json_encode($q) !!} if(query){ $('#query').val(query); } }); </script> @stop
34.619469
253
0.606084
2ca7d5a766386b8acd33397e6800e2896350a71f
1,900
cpp
C++
C++/ServerProject/main.cpp
AlexanderArgyriou/TCP-Sever-Client
ad621f94afda08b3d03cb760faf148b4348ed401
[ "MIT" ]
null
null
null
C++/ServerProject/main.cpp
AlexanderArgyriou/TCP-Sever-Client
ad621f94afda08b3d03cb760faf148b4348ed401
[ "MIT" ]
null
null
null
C++/ServerProject/main.cpp
AlexanderArgyriou/TCP-Sever-Client
ad621f94afda08b3d03cb760faf148b4348ed401
[ "MIT" ]
null
null
null
#include "pch.h" #define _WIN32_WINNT 0x0501 #include "Server.h" int main() { cout << "Server is Running..." << endl << endl; for (;;) { Server newServer; boost::asio::io_service NewService; tcp::acceptor NewAcceptor(NewService, tcp::endpoint(tcp::v4(), 4523)); //listen to new Connection tcp::socket ServerSocket(NewService); //ServerSide Socket creation NewAcceptor.accept(ServerSocket); //waiting for connection //After Connection enstablished string ClientGetName = newServer.Read(ServerSocket); //Catch client MsgName string ClientGetSurname = newServer.Read(ServerSocket); //Catch client MsgSurname string ClientGetAM = newServer.Read(ServerSocket); //Catch client MsgAm int ResponseResult = 0; cout << "Client Name: " << ClientGetName.c_str(); cout << "Client Surname: " << ClientGetSurname.c_str(); cout << "Client Am: " << ClientGetAM.c_str(); if (stoi(ClientGetAM) < 0) { cout << "Negative AM Error" << endl; newServer.Send(ServerSocket, "Negative AM Error"); //Response }//if else { if (((ClientGetName.length() + ClientGetSurname.length()) % 2) == 0) //name + surname letters are even { for (int i = 0; i <= stoi(ClientGetAM); ++i) { if (i % 2 == 0) ++ResponseResult; //number of even numbers from 0-ClientAm } //for } //if else { for (int i = 1; i <= stoi(ClientGetAM); ++i) //name + surname letters are odd { if (i % 2 != 0) ++ResponseResult; //number of odd numbers from 1-ClientAm } //for } //else cout << "Result sent Back:" << to_string(ResponseResult).c_str() << endl; string Return = "The Result is:" + to_string(ResponseResult) + "\n"; newServer.Send(ServerSocket, Return); //Response } //else cout << endl; ResponseResult = 0; //reset } //for infinite loop return 0; } //main
30.15873
106
0.625263
1ab7ba474d7b7f20ed8522d8830554523e2786a0
5,228
py
Python
neuropy/utility/validator.py
TheBuoys/neuropy
387a5eaa31629c726b5de1e71090b0d644f675b2
[ "Apache-2.0" ]
1
2019-09-29T20:35:34.000Z
2019-09-29T20:35:34.000Z
neuropy/utility/validator.py
TheBuoys/neuropy
387a5eaa31629c726b5de1e71090b0d644f675b2
[ "Apache-2.0" ]
null
null
null
neuropy/utility/validator.py
TheBuoys/neuropy
387a5eaa31629c726b5de1e71090b0d644f675b2
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 The NeuroPy Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from termcolor import cprint def validate_project(configuration): print('Validating project configuration...', end=' ') # Validate model path not empty model_directory = os.path.exists(configuration['model']) model = os.listdir(configuration['model']) if not (model and model_directory): cprint('failed', 'red') if not model_directory: cprint('Model directory not found', 'red') elif not model: cprint('Model directory is empty', 'red') exit(1) # Validate Data Loader path exists if not os.path.exists(configuration['data_loader']): cprint('failed\nData Loader not found', 'red') exit(1) # Validate data path not empty if set if (configuration['data']): data_directory = os.path.exists(configuration['data']) data = os.listdir(configuration['data']) if not (data and data_directory): cprint('failed', 'red') if not data_directory: cprint('Data directory not found', 'red') elif not data: cprint('Data directory is empty', 'red') exit(1) logs = os.path.exists(configuration['logs']) output = os.path.exists(configuration['output']) if not (logs or output): cprint('failed', 'yellow') if not logs: cprint('Log folder not found, creating...', 'yellow', end=' ') os.mkdir(os.path.abspath(configuration['logs'])) cprint('done', 'green') if not output: cprint('Output folder not found, creating...', 'yellow', end=' ') os.mkdir(os.path.abspath(configuration['output'])) cprint('done', 'green') else: cprint('done', 'green') return def validate_model(model): print('Validating model module...', end=' ') conditions = { "Configuration file": os.path.exists(os.path.join(model,"configuration.json")), "Parameters file": os.path.exists(os.path.join(model,"parameters.json")), "model.py entry point": os.path.exists(os.path.join(model,"model.py")) } if not all(conditions[name] == True for name in conditions): cprint('failed', 'red') for name in conditions: if not conditions[name] == True: cprint(name + ' not found', 'red') exit(1) if not os.path.exists(os.path.join(model,"weights")): cprint('failed\nWeights folder not found, creating...', 'yellow', end=' ') os.mkdir(os.path.abspath(os.path.join(model,"weights"))) cprint('done', 'green') return def validate_model_configuration(path, configuration): print('Validating model configuration...', end=' ') load_from = os.path.exists(os.path.join(os.path.abspath(path), configuration['load_from'])) load_from_path_not_empty = os.listdir(os.path.join(os.path.abspath(path), configuration["load_from"])) if load_from else None save_to = os.path.exists(os.path.join(os.path.abspath(path), configuration['save_to'])) # Validate load from and save to paths if not (load_from and save_to and load_from_path_not_empty): cprint('failed', 'yellow') if not (load_from and load_from_path_not_empty): cprint('Warm start file not found, reverting to cold start...', 'yellow', end=' ') configuration['load_from'] = None cprint('done', 'green') if not save_to: cprint('Model save folder not found, creating...', 'yellow', end=' ') os.mkdir(os.path.join(os.path.abspath(path), configuration['save_to'])) cprint('done', 'green') else: cprint('done', 'green') return def validate_optional_arguments(arguments): print('Validating optional paths...', end=' ') if arguments.infer_data: if not (os.path.exists(arguments.infer_data)): cprint('failed\nOptional infer path was specified but does not exist', 'red') exit(1) elif (os.path.isdir(arguments.infer_data) and not os.listdir(arguments.infer_data)): cprint('failed\nOptional infer path is a directory but it is empty', 'red') exit(1) if arguments.train_data: if not (os.path.exists(arguments.train_data)): cprint('failed\nOptional train path was specified but does not exist', 'red') exit(1) elif (os.path.isdir(arguments.train_data) and not os.listdir(arguments.train_data)): cprint('failed\nOptional train path is a directory but it is empty', 'red') exit(1) cprint('done', 'green') return
37.884058
129
0.632938
dfc908a1488f5757087da59d62fe6f5ddbd4f0f7
2,189
dart
Dart
lib/src/basic/basicAuthApi.dart
luismiguelduque/simple_auth
04bd4736ddb8db84a41e5f0d9c36303320cda8da
[ "MIT" ]
1
2020-09-15T06:10:20.000Z
2020-09-15T06:10:20.000Z
simple_auth/lib/src/basic/basicAuthApi.dart
Vjex/simple_auth
54f048ad8470ee1d1a001794eb0286fe51b591fa
[ "MIT" ]
null
null
null
simple_auth/lib/src/basic/basicAuthApi.dart
Vjex/simple_auth
54f048ad8470ee1d1a001794eb0286fe51b591fa
[ "MIT" ]
null
null
null
import "dart:async"; import "package:simple_auth/simple_auth.dart"; import "package:http/http.dart" as http; typedef void ShowBasicAuthenticator(BasicAuthAuthenticator authenticator); class BasicAuthApi extends AuthenticatedApi { String loginUrl; BasicAuthAuthenticator currentAuthenticator; static ShowBasicAuthenticator sharedShowAuthenticator; ShowBasicAuthenticator showAuthenticator; BasicAuthApi(String identifier, this.loginUrl, {http.Client client, Converter converter, AuthStorage authStorage}) : super(identifier, client: client, converter: converter, authStorage: authStorage) { currentAuthenticator = BasicAuthAuthenticator(client, loginUrl); } BasicAuthAccount get currentBasicAccount => currentAccount as BasicAuthAccount; @override Future<Request> authenticateRequest(Request request) async { Map<String, String> map = new Map.from(request.headers); map["Authorization"] = "Basic ${currentBasicAccount.key}"; return request.replace(headers: map); } BasicAuthAuthenticator getAuthenticator() => currentAuthenticator; @override Future<Account> performAuthenticate() async { BasicAuthAccount account = currentBasicAccount ?? await loadAccountFromCache<BasicAuthAccount>(); if (account?.isValid() ?? false) { return currentAccount = account; } BasicAuthAuthenticator authenticator = getAuthenticator(); await authenticator.resetAuthenticator(); if (showAuthenticator != null) showAuthenticator(authenticator); else if (sharedShowAuthenticator != null) sharedShowAuthenticator(authenticator); else throw new Exception( "Please call `SimpleAuthFlutter.init();` or implement the 'showAuthenticator' or 'sharedShowAuthenticator'"); var token = await authenticator.getAuthCode(); if (token?.isEmpty ?? true) { throw new Exception("Null Token"); } account = new BasicAuthAccount(identifier, key: token); saveAccountToCache(account); currentAccount = account; return account; } @override Future refreshAccount(Account account) async { //No need to refresh this puppy! return; } }
33.676923
119
0.737323
43b26955f00f519fa841a40e5eedb1d288d14242
843
tsx
TypeScript
src/components/register/RegisterRoomPhoto/styles.tsx
devho813/land-bnb-front
29a6c070017ba4398928196dca60af43ea9765bb
[ "MIT" ]
null
null
null
src/components/register/RegisterRoomPhoto/styles.tsx
devho813/land-bnb-front
29a6c070017ba4398928196dca60af43ea9765bb
[ "MIT" ]
null
null
null
src/components/register/RegisterRoomPhoto/styles.tsx
devho813/land-bnb-front
29a6c070017ba4398928196dca60af43ea9765bb
[ "MIT" ]
null
null
null
import { css } from "@emotion/react"; import palette from "../../../styles/palette"; export const container = css` padding: 62px 30px 100px; h2 { font-size: 19px; font-weight: 800; margin-bottom: 56px; } h3 { font-weight: bold; color: ${palette.gray_76}; margin-bottom: 6px; } `; export const registerRoomStepInfo = css` font-size: 14px; max-width: 400px; margin-bottom: 24px; `; export const registerRoomUploadPhotoWrapper = css` width: 858px; height: 433px; margin: auto; position: relative; display: flex; justify-content: center; align-items: center; border: 2px dashed ${palette.gray_bb}; border-radius: 6px; input { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; } img { width: 100%; max-height: 100%; } `;
16.86
50
0.628707
b914a12c1e3034e755dcdaa51963388fe0b62598
120
cpp
C++
src/common/BatchDeleteSql.cpp
luhouxiang/batch-database-demo
9669a7cb831d13c845c762333e65f1538c0d4bd2
[ "Apache-2.0" ]
1
2021-06-21T07:44:09.000Z
2021-06-21T07:44:09.000Z
src/common/BatchDeleteSql.cpp
luhouxiang/batch-database-demo
9669a7cb831d13c845c762333e65f1538c0d4bd2
[ "Apache-2.0" ]
null
null
null
src/common/BatchDeleteSql.cpp
luhouxiang/batch-database-demo
9669a7cb831d13c845c762333e65f1538c0d4bd2
[ "Apache-2.0" ]
null
null
null
#include "BatchDeleteSql.h" BatchDeleteSql::BatchDeleteSql(void) { } BatchDeleteSql::~BatchDeleteSql(void) { }
13.333333
38
0.716667
c6c15e89ccf4daa866adbebc113c115338ca36e1
538
py
Python
va_explorer/va_analytics/migrations/0003_auto_20210805_2354.py
VA-Explorer/va_explorer
e43cfbff0ce5209c12134b7ac4ce439db6fc87a2
[ "Apache-2.0" ]
null
null
null
va_explorer/va_analytics/migrations/0003_auto_20210805_2354.py
VA-Explorer/va_explorer
e43cfbff0ce5209c12134b7ac4ce439db6fc87a2
[ "Apache-2.0" ]
125
2020-10-07T12:00:15.000Z
2022-03-31T21:29:21.000Z
va_explorer/va_analytics/migrations/0003_auto_20210805_2354.py
VA-Explorer/va_explorer
e43cfbff0ce5209c12134b7ac4ce439db6fc87a2
[ "Apache-2.0" ]
2
2020-10-29T16:08:42.000Z
2020-12-08T19:03:41.000Z
# Generated by Django 3.1.5 on 2021-08-05 23:54 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('va_analytics', '0002_update_dashboard_permissions'), ] operations = [ migrations.AlterModelOptions( name='dashboard', options={'default_permissions': ('view',), 'managed': False, 'permissions': (('download_data', 'Can download data'), ('view_pii', 'Can view PII in data'), ('supervise_users', 'Can supervise other users'))}, ), ]
29.888889
218
0.639405
5d7c098b2c29bc5c4548848c198e47fd3d847a75
2,573
cc
C++
linux/flutter_jscore_plugin.cc
xuelongqy/flutter_jscore
dd8bf1153c7a8bfc78adfd24accb129740b8aa29
[ "MIT" ]
122
2020-02-26T06:27:46.000Z
2022-03-25T08:37:54.000Z
linux/flutter_jscore_plugin.cc
xuelongqy/flutter_jscore
dd8bf1153c7a8bfc78adfd24accb129740b8aa29
[ "MIT" ]
11
2020-03-15T10:36:57.000Z
2022-01-19T06:28:08.000Z
linux/flutter_jscore_plugin.cc
xuelongqy/flutter_jscore
dd8bf1153c7a8bfc78adfd24accb129740b8aa29
[ "MIT" ]
19
2020-03-10T15:30:13.000Z
2021-11-23T14:52:25.000Z
#include "include/flutter_jscore/flutter_jscore_plugin.h" #include <flutter_linux/flutter_linux.h> #include <gtk/gtk.h> #include <sys/utsname.h> #include <cstring> #define FLUTTER_JSCORE_PLUGIN(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), flutter_jscore_plugin_get_type(), \ FlutterJscorePlugin)) struct _FlutterJscorePlugin { GObject parent_instance; }; G_DEFINE_TYPE(FlutterJscorePlugin, flutter_jscore_plugin, g_object_get_type()) // Called when a method call is received from Flutter. static void flutter_jscore_plugin_handle_method_call( FlutterJscorePlugin* self, FlMethodCall* method_call) { g_autoptr(FlMethodResponse) response = nullptr; const gchar* method = fl_method_call_get_name(method_call); if (strcmp(method, "getPlatformVersion") == 0) { struct utsname uname_data = {}; uname(&uname_data); g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version); g_autoptr(FlValue) result = fl_value_new_string(version); response = FL_METHOD_RESPONSE(fl_method_success_response_new(result)); } else { response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new()); } fl_method_call_respond(method_call, response, nullptr); } static void flutter_jscore_plugin_dispose(GObject* object) { G_OBJECT_CLASS(flutter_jscore_plugin_parent_class)->dispose(object); } static void flutter_jscore_plugin_class_init(FlutterJscorePluginClass* klass) { G_OBJECT_CLASS(klass)->dispose = flutter_jscore_plugin_dispose; } static void flutter_jscore_plugin_init(FlutterJscorePlugin* self) {} static void method_call_cb(FlMethodChannel* channel, FlMethodCall* method_call, gpointer user_data) { FlutterJscorePlugin* plugin = FLUTTER_JSCORE_PLUGIN(user_data); flutter_jscore_plugin_handle_method_call(plugin, method_call); } void flutter_jscore_plugin_register_with_registrar(FlPluginRegistrar* registrar) { FlutterJscorePlugin* plugin = FLUTTER_JSCORE_PLUGIN( g_object_new(flutter_jscore_plugin_get_type(), nullptr)); g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new(); g_autoptr(FlMethodChannel) channel = fl_method_channel_new(fl_plugin_registrar_get_messenger(registrar), "flutter_jscore", FL_METHOD_CODEC(codec)); fl_method_channel_set_method_call_handler(channel, method_call_cb, g_object_ref(plugin), g_object_unref); g_object_unref(plugin); }
36.239437
82
0.743101
14d52346c97b21c926fd56d2d52940cdd49280f9
259
ts
TypeScript
apps/bettafish/src/app/pages/settings/index.ts
TheMajorTechie/pulp-fiction
19019ab3f2c888def4e54adabe6cb837731d6d8f
[ "Apache-2.0" ]
null
null
null
apps/bettafish/src/app/pages/settings/index.ts
TheMajorTechie/pulp-fiction
19019ab3f2c888def4e54adabe6cb837731d6d8f
[ "Apache-2.0" ]
null
null
null
apps/bettafish/src/app/pages/settings/index.ts
TheMajorTechie/pulp-fiction
19019ab3f2c888def4e54adabe6cb837731d6d8f
[ "Apache-2.0" ]
null
null
null
import { Routes } from '@angular/router'; import { SettingsComponent } from './settings.component'; export const SettingsPages = [ SettingsComponent, ]; export const SettingsRoutes: Routes = [ { path: 'settings', component: SettingsComponent }, ];
21.583333
57
0.706564
8e65f9c45f339162eb81b19c005de387f2a6642e
2,224
rs
Rust
src/ch03/type_size.rs
jony-lee/tao-of-rust-codes
49e64085a65673918b56d35ba681fda370e8bb13
[ "MIT" ]
1,124
2018-03-22T09:00:58.000Z
2022-03-31T10:41:39.000Z
src/ch03/type_size.rs
jony-lee/tao-of-rust-codes
49e64085a65673918b56d35ba681fda370e8bb13
[ "MIT" ]
323
2018-10-11T07:32:56.000Z
2022-01-19T12:35:19.000Z
src/ch03/type_size.rs
jony-lee/tao-of-rust-codes
49e64085a65673918b56d35ba681fda370e8bb13
[ "MIT" ]
155
2018-10-11T06:29:42.000Z
2022-03-30T09:09:43.000Z
/// # 动态大小类型:str /// ### 探索&str的组成 /// /// Basic usage: /// /// ``` /// fn str_compose(){ /// let str = "Hello Rust"; /// let ptr = str.as_ptr(); /// let len = str.len(); /// println!("{:p}", ptr); // 0x555db4b96c00 /// println!("{:?}", len); // 10 /// } /// str_compose(); /// ``` pub fn str_compose(){ let str = "Hello Rust"; let ptr = str.as_ptr(); let len = str.len(); println!("{:p}", ptr); // 0x555db4b96c00 println!("{:?}", len); // 10 } /// # 动态大小类型:`[T]` /// ### 探索数组 /// /// Error usage: /// /// ``` /// // Error: `[u32]` does not have a constant size known at compile-time /// fn reset(mut arr: [u32]) { /// arr[0] = 5; /// arr[1] = 4; /// arr[2] = 3; /// arr[3] = 2; /// arr[4] = 1; /// println!("reset arr {:?}", arr); /// } /// let arr: [u32] = [1, 2, 3, 4, 5]; /// reset(arr); /// println!("origin arr {:?}", arr); /// ``` /// /// Right usage 1: 指定固定长度 /// /// ``` /// fn reset(mut arr: [u32; 5]) { /// arr[0] = 5; /// arr[1] = 4; /// arr[2] = 3; /// arr[3] = 2; /// arr[4] = 1; /// println!("reset arr {:?}", arr); /// } /// let arr: [u32; 5] = [1, 2, 3, 4, 5]; /// reset(arr); /// println!("origin arr {:?}", arr); /// ``` /// /// Right usage 2: 使用胖指针 /// /// ``` /// fn reset(arr: &mut[u32]) { /// arr[0] = 5; /// arr[1] = 4; /// arr[2] = 3; /// arr[3] = 2; /// arr[4] = 1; /// println!("reset arr {:?}", arr); /// } /// let mut arr = [1, 2, 3, 4, 5]; /// println!("reset before : origin array {:?}", arr); /// { /// let mut_arr: &mut[u32] = &mut arr; /// reset(mut_arr); /// } /// println!("reset after : origin array {:?}", arr); /// ``` pub fn reset(mut arr: [u32; 5]) { arr[0] = 5; arr[1] = 4; arr[2] = 3; arr[3] = 2; arr[4] = 1; println!("reset arr {:?}", arr); } /// # 动态大小类型:比较`&[u32; 5]`和`&mut [u32]`的空间占用 /// /// Base usage: /// /// ``` /// fn compare_size(){ /// assert_eq!(std::mem::size_of::<&[u32; 5]>(), 8); /// assert_eq!(std::mem::size_of::<&mut [u32]>(), 16); /// } /// compare_size(); /// ``` pub fn compare_size(){ use std::mem::size_of; assert_eq!(size_of::<&[u32; 5]>(), 8); assert_eq!(size_of::<&mut [u32]>(), 16); }
21.180952
73
0.430755
5de9ebb1b258d1e6ae6c5592bbc939400e6b58e2
9,930
hpp
C++
include/lvr2/attrmaps/StableVector.hpp
jtpils/lvr2
b1010dfcc930d9ae0ff5cfa5c88d0810d65368ce
[ "BSD-3-Clause" ]
1
2019-08-07T03:55:27.000Z
2019-08-07T03:55:27.000Z
include/lvr2/attrmaps/StableVector.hpp
jtpils/lvr2
b1010dfcc930d9ae0ff5cfa5c88d0810d65368ce
[ "BSD-3-Clause" ]
null
null
null
include/lvr2/attrmaps/StableVector.hpp
jtpils/lvr2
b1010dfcc930d9ae0ff5cfa5c88d0810d65368ce
[ "BSD-3-Clause" ]
null
null
null
/** * Copyright (c) 2018, University Osnabrück * 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 the University Osnabrück 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 University Osnabrück 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. */ /* * StableVector.hpp * * @date 08.06.2017 * @author Johan M. von Behren <johan@vonbehren.eu> */ #ifndef LVR2_ATTRMAPS_STABLEVECTOR_H_ #define LVR2_ATTRMAPS_STABLEVECTOR_H_ #include <vector> #include <utility> #include <boost/optional.hpp> #include <boost/shared_array.hpp> using std::move; using std::vector; using boost::optional; #include <lvr2/util/BaseHandle.hpp> #include <lvr2/geometry/Handles.hpp> namespace lvr2 { /** * @brief Iterator over handles in this vector, which skips deleted elements * * Important: This is NOT a fail fast iterator. If the vector is changed while * using an instance of this iterator the behavior is undefined! */ template<typename HandleT, typename ElemT> class StableVectorIterator { private: /// Reference to the deleted marker array this iterator belongs to const vector<optional<ElemT>>* m_elements; /// Current position in the vector size_t m_pos; public: StableVectorIterator(const vector<optional<ElemT>>* deleted, bool startAtEnd = false); StableVectorIterator& operator=(const StableVectorIterator& other); bool operator==(const StableVectorIterator& other) const; bool operator!=(const StableVectorIterator& other) const; StableVectorIterator& operator++(); bool isAtEnd() const; HandleT operator*() const; }; /** * @brief A vector which guarantees stable indices and features O(1) deletion. * * This is basically a wrapper for the std::vector, which marks an element as * deleted but does not actually delete it. This means that indices are never * invalidated. When inserting an element, you get its index (its so called * "handle") back. This handle can later be used to access the element. This * remains true regardless of other insertions and deletions happening in * between. * * USE WITH CAUTION: This NEVER frees memory of deleted values (except on its * own destruction and can get very large if used incorrectly! If deletions in * your use-case are far more numerous than insertions, this data structure is * probably not fitting your needs. The memory requirement of this class is * O(n_p) where n_p is the number of `push()` calls. * * @tparam HandleT This handle type contains the actual index. It has to be * derived from `BaseHandle`! * @tparam ElemT Type of elements in the vector. */ template<typename HandleT, typename ElemT> class StableVector { static_assert( std::is_base_of<BaseHandle<Index>, HandleT>::value, "HandleT must inherit from BaseHandle!" ); public: using ElementType = ElemT; using HandleType = HandleT; /** * @brief Creates an empty StableVector. */ StableVector() : m_usedCount(0) {}; /** * @brief Creates a StableVector with `countElements` many copies of * `defaultValue`. * * The elements are stored contiguously in the vectors, thus the valid * indices of these elements are 0 to `countElements` - 1. */ StableVector(size_t countElements, const ElementType& defaultValue); StableVector(size_t countElements, const boost::shared_array<ElementType>& sharedArray); /** * @brief Adds the given element to the vector. * * @return The handle referring to the inserted element. */ HandleType push(const ElementType& elem); /** * @brief Adds the given element by moving from it. * * @return The handle referring to the inserted element. */ HandleType push(ElementType&& elem); /** * @brief Increases the size of the vector to the length of `upTo`. * * This means that the next call to `push()` after calling `resize(upTo)` * will return exactly the `upTo` handle. All elements that are inserted * by this method are marked as deleted and thus aren't initialized. They * can be set later with `set()`. * * If `upTo` is already a valid handle, this method will panic! */ void increaseSize(HandleType upTo); /** * @brief Increases the size of the vector to the length of `upTo` by * inserting copies of `elem`. * * This means that the next call to `push()` after calling `resize(upTo)` * will return exactly the `upTo` handle. * * If `upTo` is already a valid handle, this method will panic! */ void increaseSize(HandleType upTo, const ElementType& elem); /** * @brief The handle which would be returned by calling `push` now. */ HandleType nextHandle() const; /** * @brief Mark the element behind the given handle as deleted. * * While the element is deleted, the handle stays valid. This means that * trying to obtain the element with this handle later, will always result * in `none` (if `get()` was used). Additionally, the handle can also be * used with the `set()` method. */ void erase(HandleType handle); /** * @brief Removes all elements from the vector. */ void clear(); /** * @brief Returns the element referred to by `handle`. * * Returns `none` if the element was deleted or if the handle is out of * bounds. */ boost::optional<ElementType&> get(HandleType handle); /** * @brief Returns the element referred to by `handle`. * * Returns `none` if the element was deleted or if the handle is out of * bounds. */ boost::optional<const ElementType&> get(HandleType handle) const; /** * @brief Set a value for the existing `handle`. * * In this method, the `handle` has to be valid: it has to be obtained by * a prior `push()` call. If you want to insert a new element, use `push()` * instead of this `set()` method! */ void set(HandleType handle, const ElementType& elem); /** * @brief Set a value for the existing `handle` by moving from `elem`. * * In this method, the `handle` has to be valid: it has to be obtained by * a prior `push()` call. If you want to insert a new element, use `push()` * instead of this `set()` method! */ void set(HandleType handle, ElementType&& elem); /** * @brief Returns the element referred to by `handle`. * * If `handle` is out of bounds or the element was deleted, this method * will throw an exception in debug mode and has UB in release mode. Use * `get()` instead to gracefully handle the absence of an element. */ ElementType& operator[](HandleType handle); /** * @brief Returns the element referred to by `handle`. * * If `handle` is out of bounds or the element was deleted, this method * will throw an exception in debug mode and has UB in release mode. Use * `get()` instead to gracefully handle the absence of an element. */ const ElementType& operator[](HandleType handle) const; /** * @brief Absolute size of the vector (including deleted elements). */ size_t size() const; /** * @brief Number of non-deleted elements. */ size_t numUsed() const; /** * @brief Returns an iterator to the first element of this vector. * * This iterator auto skips deleted elements and returns handles to the * valid elements. */ StableVectorIterator<HandleType, ElementType> begin() const; /** * @brief Returns an iterator to the element after the last element of * this vector. */ StableVectorIterator<HandleType, ElementType> end() const; /** * @brief Increase the capacity of the vector to a value that's greater or * equal to newCap. * * If newCap is greater than the current capacity, new storage is * allocated, otherwise the method does nothing. * * @param newCap new capacity of the vector */ void reserve(size_t newCap); private: /// Count of used elements in elements vector size_t m_usedCount; /// Vector for stored elements vector<optional<ElementType>> m_elements; /** * @brief Assert that the requested handle is not deleted or throw an * exception otherwise. */ void checkAccess(HandleType handle) const; }; } // namespace lvr2 #include <lvr2/attrmaps/StableVector.tcc> #endif /* LVR2_ATTRMAPS_STABLEVECTOR_H_ */
33.661017
92
0.679557
7051439212bf1d7f8ab063d41c7c1be3ee4f2329
183
sql
SQL
src/test/resources/results/scriptCommand/testScriptCommandToGenerateScripts/Employee/create-stage.sql
granthenke/streamliner
f3b70574bc414f991239079dee1ffb9e2ed3c2eb
[ "Apache-2.0" ]
4
2020-10-05T10:24:19.000Z
2021-12-15T05:20:07.000Z
src/test/resources/results/scriptCommand/testScriptCommandToGenerateScripts/Employee/create-stage.sql
granthenke/streamliner
f3b70574bc414f991239079dee1ffb9e2ed3c2eb
[ "Apache-2.0" ]
34
2020-09-22T19:56:52.000Z
2022-03-23T11:39:13.000Z
src/test/resources/results/scriptCommand/testScriptCommandToGenerateScripts/Employee/create-stage.sql
granthenke/streamliner
f3b70574bc414f991239079dee1ffb9e2ed3c2eb
[ "Apache-2.0" ]
3
2021-03-23T05:34:30.000Z
2022-01-25T06:48:02.000Z
CREATE STAGE IF NOT EXISTS SANDBOX_POC1.EMPLOYEES.STREAMLINER_QUICKSTART_1_stage URL = 's3://streamliner-quickstart-1/employees/' STORAGE_INTEGRATION = STREAMLINER_QUICKSTART_1;
26.142857
80
0.830601
4f7ea88169c75990663b21d9243621edea3d9d13
23,755
rb
Ruby
actionview/test/template/form_collections_helper_test.rb
bronson/rails
a4ef62279d69d901b99fe0e71338b5aaebab01c0
[ "Ruby", "MIT" ]
6
2018-11-21T12:57:37.000Z
2021-11-14T19:40:15.000Z
actionview/test/template/form_collections_helper_test.rb
bronson/rails
a4ef62279d69d901b99fe0e71338b5aaebab01c0
[ "Ruby", "MIT" ]
null
null
null
actionview/test/template/form_collections_helper_test.rb
bronson/rails
a4ef62279d69d901b99fe0e71338b5aaebab01c0
[ "Ruby", "MIT" ]
1
2016-02-27T15:23:22.000Z
2016-02-27T15:23:22.000Z
require 'abstract_unit' class Category < Struct.new(:id, :name) end class FormCollectionsHelperTest < ActionView::TestCase def assert_no_select(selector, value = nil) assert_select(selector, :text => value, :count => 0) end def with_collection_radio_buttons(*args, &block) @output_buffer = collection_radio_buttons(*args, &block) end def with_collection_check_boxes(*args, &block) @output_buffer = collection_check_boxes(*args, &block) end # COLLECTION RADIO BUTTONS test 'collection radio accepts a collection and generates inputs from value method' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s assert_select 'input[type=radio][value=true]#user_active_true' assert_select 'input[type=radio][value=false]#user_active_false' end test 'collection radio accepts a collection and generates inputs from label method' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s assert_select 'label[for=user_active_true]', 'true' assert_select 'label[for=user_active_false]', 'false' end test 'collection radio handles camelized collection values for labels correctly' do with_collection_radio_buttons :user, :active, ['Yes', 'No'], :to_s, :to_s assert_select 'label[for=user_active_yes]', 'Yes' assert_select 'label[for=user_active_no]', 'No' end test 'collection radio should sanitize collection values for labels correctly' do with_collection_radio_buttons :user, :name, ['$0.99', '$1.99'], :to_s, :to_s assert_select 'label[for=user_name_099]', '$0.99' assert_select 'label[for=user_name_199]', '$1.99' end test 'collection radio accepts checked item' do with_collection_radio_buttons :user, :active, [[1, true], [0, false]], :last, :first, :checked => true assert_select 'input[type=radio][value=true][checked=checked]' assert_no_select 'input[type=radio][value=false][checked=checked]' end test 'collection radio accepts multiple disabled items' do collection = [[1, true], [0, false], [2, 'other']] with_collection_radio_buttons :user, :active, collection, :last, :first, :disabled => [true, false] assert_select 'input[type=radio][value=true][disabled=disabled]' assert_select 'input[type=radio][value=false][disabled=disabled]' assert_no_select 'input[type=radio][value=other][disabled=disabled]' end test 'collection radio accepts single disabled item' do collection = [[1, true], [0, false]] with_collection_radio_buttons :user, :active, collection, :last, :first, :disabled => true assert_select 'input[type=radio][value=true][disabled=disabled]' assert_no_select 'input[type=radio][value=false][disabled=disabled]' end test 'collection radio accepts multiple readonly items' do collection = [[1, true], [0, false], [2, 'other']] with_collection_radio_buttons :user, :active, collection, :last, :first, :readonly => [true, false] assert_select 'input[type=radio][value=true][readonly=readonly]' assert_select 'input[type=radio][value=false][readonly=readonly]' assert_no_select 'input[type=radio][value=other][readonly=readonly]' end test 'collection radio accepts single readonly item' do collection = [[1, true], [0, false]] with_collection_radio_buttons :user, :active, collection, :last, :first, :readonly => true assert_select 'input[type=radio][value=true][readonly=readonly]' assert_no_select 'input[type=radio][value=false][readonly=readonly]' end test 'collection radio accepts html options as input' do collection = [[1, true], [0, false]] with_collection_radio_buttons :user, :active, collection, :last, :first, {}, :class => 'special-radio' assert_select 'input[type=radio][value=true].special-radio#user_active_true' assert_select 'input[type=radio][value=false].special-radio#user_active_false' end test 'collection radio accepts html options as the last element of array' do collection = [[1, true, {class: 'foo'}], [0, false, {class: 'bar'}]] with_collection_radio_buttons :user, :active, collection, :second, :first assert_select 'input[type=radio][value=true].foo#user_active_true' assert_select 'input[type=radio][value=false].bar#user_active_false' end test 'collection radio sets the label class defined inside the block' do collection = [[1, true, {class: 'foo'}], [0, false, {class: 'bar'}]] with_collection_radio_buttons :user, :active, collection, :second, :first do |b| b.label(class: "collection_radio_buttons") end assert_select 'label.collection_radio_buttons[for=user_active_true]' assert_select 'label.collection_radio_buttons[for=user_active_false]' end test 'collection radio does not include the input class in the respective label' do collection = [[1, true, {class: 'foo'}], [0, false, {class: 'bar'}]] with_collection_radio_buttons :user, :active, collection, :second, :first assert_no_select 'label.foo[for=user_active_true]' assert_no_select 'label.bar[for=user_active_false]' end test 'collection radio does not wrap input inside the label' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s assert_select 'input[type=radio] + label' assert_no_select 'label input' end test 'collection radio accepts a block to render the label as radio button wrapper' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b| b.label { b.radio_button } end assert_select 'label[for=user_active_true] > input#user_active_true[type=radio]' assert_select 'label[for=user_active_false] > input#user_active_false[type=radio]' end test 'collection radio accepts a block to change the order of label and radio button' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b| b.label + b.radio_button end assert_select 'label[for=user_active_true] + input#user_active_true[type=radio]' assert_select 'label[for=user_active_false] + input#user_active_false[type=radio]' end test 'collection radio with block helpers accept extra html options' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b| b.label(:class => "radio_button") + b.radio_button(:class => "radio_button") end assert_select 'label.radio_button[for=user_active_true] + input#user_active_true.radio_button[type=radio]' assert_select 'label.radio_button[for=user_active_false] + input#user_active_false.radio_button[type=radio]' end test 'collection radio with block helpers allows access to current text and value' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b| b.label(:"data-value" => b.value) { b.radio_button + b.text } end assert_select 'label[for=user_active_true][data-value=true]', 'true' do assert_select 'input#user_active_true[type=radio]' end assert_select 'label[for=user_active_false][data-value=false]', 'false' do assert_select 'input#user_active_false[type=radio]' end end test 'collection radio with block helpers allows access to the current object item in the collection to access extra properties' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b| b.label(:class => b.object) { b.radio_button + b.text } end assert_select 'label.true[for=user_active_true]', 'true' do assert_select 'input#user_active_true[type=radio]' end assert_select 'label.false[for=user_active_false]', 'false' do assert_select 'input#user_active_false[type=radio]' end end test 'collection radio buttons with fields for' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] @output_buffer = fields_for(:post) do |p| p.collection_radio_buttons :category_id, collection, :id, :name end assert_select 'input#post_category_id_1[type=radio][value="1"]' assert_select 'input#post_category_id_2[type=radio][value="2"]' assert_select 'label[for=post_category_id_1]', 'Category 1' assert_select 'label[for=post_category_id_2]', 'Category 2' end test 'collection radio accepts checked item which has a value of false' do with_collection_radio_buttons :user, :active, [[1, true], [0, false]], :last, :first, :checked => false assert_no_select 'input[type=radio][value=true][checked=checked]' assert_select 'input[type=radio][value=false][checked=checked]' end test 'collection radio buttons generates only one hidden field for the entire collection, to ensure something will be sent back to the server when posting an empty collection' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_radio_buttons :user, :category_ids, collection, :id, :name assert_select "input[type=hidden][name='user[category_ids]'][value='']", count: 1 end test 'collection radio buttons generates a hidden field using the given :name in :html_options' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_radio_buttons :user, :category_ids, collection, :id, :name, {}, { name: "user[other_category_ids]" } assert_select "input[type=hidden][name='user[other_category_ids]'][value='']", count: 1 end test 'collection radio buttons generates a hidden field with index if it was provided' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_radio_buttons :user, :category_ids, collection, :id, :name, { index: 322 } assert_select "input[type=hidden][name='user[322][category_ids]'][value='']", count: 1 end test 'collection radio buttons does not generate a hidden field if include_hidden option is false' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_radio_buttons :user, :category_ids, collection, :id, :name, include_hidden: false assert_select "input[type=hidden][name='user[category_ids]'][value='']", count: 0 end test 'collection radio buttons does not generate a hidden field if include_hidden option is false with key as string' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_radio_buttons :user, :category_ids, collection, :id, :name, 'include_hidden' => false assert_select "input[type=hidden][name='user[category_ids]'][value='']", count: 0 end # COLLECTION CHECK BOXES test 'collection check boxes accepts a collection and generate a series of checkboxes for value method' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name assert_select 'input#user_category_ids_1[type=checkbox][value="1"]' assert_select 'input#user_category_ids_2[type=checkbox][value="2"]' end test 'collection check boxes generates only one hidden field for the entire collection, to ensure something will be sent back to the server when posting an empty collection' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name assert_select "input[type=hidden][name='user[category_ids][]'][value='']", :count => 1 end test 'collection check boxes generates a hidden field using the given :name in :html_options' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name, {}, {name: "user[other_category_ids][]"} assert_select "input[type=hidden][name='user[other_category_ids][]'][value='']", :count => 1 end test 'collection check boxes generates a hidden field with index if it was provided' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name, { index: 322 } assert_select "input[type=hidden][name='user[322][category_ids][]'][value='']", count: 1 end test 'collection check boxes does not generate a hidden field if include_hidden option is false' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name, include_hidden: false assert_select "input[type=hidden][name='user[category_ids][]'][value='']", :count => 0 end test 'collection check boxes does not generate a hidden field if include_hidden option is false with key as string' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name, 'include_hidden' => false assert_select "input[type=hidden][name='user[category_ids][]'][value='']", count: 0 end test 'collection check boxes accepts a collection and generate a series of checkboxes with labels for label method' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name assert_select 'label[for=user_category_ids_1]', 'Category 1' assert_select 'label[for=user_category_ids_2]', 'Category 2' end test 'collection check boxes handles camelized collection values for labels correctly' do with_collection_check_boxes :user, :active, ['Yes', 'No'], :to_s, :to_s assert_select 'label[for=user_active_yes]', 'Yes' assert_select 'label[for=user_active_no]', 'No' end test 'collection check box should sanitize collection values for labels correctly' do with_collection_check_boxes :user, :name, ['$0.99', '$1.99'], :to_s, :to_s assert_select 'label[for=user_name_099]', '$0.99' assert_select 'label[for=user_name_199]', '$1.99' end test 'collection check boxes accepts html options as the last element of array' do collection = [[1, 'Category 1', {class: 'foo'}], [2, 'Category 2', {class: 'bar'}]] with_collection_check_boxes :user, :active, collection, :first, :second assert_select 'input[type=checkbox][value="1"].foo' assert_select 'input[type=checkbox][value="2"].bar' end test 'collection check boxes propagates input id to the label for attribute' do collection = [[1, 'Category 1', {id: 'foo'}], [2, 'Category 2', {id: 'bar'}]] with_collection_check_boxes :user, :active, collection, :first, :second assert_select 'input[type=checkbox][value="1"]#foo' assert_select 'input[type=checkbox][value="2"]#bar' assert_select 'label[for=foo]' assert_select 'label[for=bar]' end test 'collection check boxes sets the label class defined inside the block' do collection = [[1, 'Category 1', {class: 'foo'}], [2, 'Category 2', {class: 'bar'}]] with_collection_check_boxes :user, :active, collection, :second, :first do |b| b.label(class: 'collection_check_boxes') end assert_select 'label.collection_check_boxes[for=user_active_category_1]' assert_select 'label.collection_check_boxes[for=user_active_category_2]' end test 'collection check boxes does not include the input class in the respective label' do collection = [[1, 'Category 1', {class: 'foo'}], [2, 'Category 2', {class: 'bar'}]] with_collection_check_boxes :user, :active, collection, :second, :first assert_no_select 'label.foo[for=user_active_category_1]' assert_no_select 'label.bar[for=user_active_category_2]' end test 'collection check boxes accepts selected values as :checked option' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :checked => [1, 3] assert_select 'input[type=checkbox][value="1"][checked=checked]' assert_select 'input[type=checkbox][value="3"][checked=checked]' assert_no_select 'input[type=checkbox][value="2"][checked=checked]' end test 'collection check boxes accepts selected string values as :checked option' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :checked => ['1', '3'] assert_select 'input[type=checkbox][value="1"][checked=checked]' assert_select 'input[type=checkbox][value="3"][checked=checked]' assert_no_select 'input[type=checkbox][value="2"][checked=checked]' end test 'collection check boxes accepts a single checked value' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :checked => 3 assert_select 'input[type=checkbox][value="3"][checked=checked]' assert_no_select 'input[type=checkbox][value="1"][checked=checked]' assert_no_select 'input[type=checkbox][value="2"][checked=checked]' end test 'collection check boxes accepts selected values as :checked option and override the model values' do user = Struct.new(:category_ids).new(2) collection = (1..3).map{|i| [i, "Category #{i}"] } @output_buffer = fields_for(:user, user) do |p| p.collection_check_boxes :category_ids, collection, :first, :last, :checked => [1, 3] end assert_select 'input[type=checkbox][value="1"][checked=checked]' assert_select 'input[type=checkbox][value="3"][checked=checked]' assert_no_select 'input[type=checkbox][value="2"][checked=checked]' end test 'collection check boxes accepts multiple disabled items' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :disabled => [1, 3] assert_select 'input[type=checkbox][value="1"][disabled=disabled]' assert_select 'input[type=checkbox][value="3"][disabled=disabled]' assert_no_select 'input[type=checkbox][value="2"][disabled=disabled]' end test 'collection check boxes accepts single disabled item' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :disabled => 1 assert_select 'input[type=checkbox][value="1"][disabled=disabled]' assert_no_select 'input[type=checkbox][value="3"][disabled=disabled]' assert_no_select 'input[type=checkbox][value="2"][disabled=disabled]' end test 'collection check boxes accepts a proc to disabled items' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :disabled => proc { |i| i.first == 1 } assert_select 'input[type=checkbox][value="1"][disabled=disabled]' assert_no_select 'input[type=checkbox][value="3"][disabled=disabled]' assert_no_select 'input[type=checkbox][value="2"][disabled=disabled]' end test 'collection check boxes accepts multiple readonly items' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :readonly => [1, 3] assert_select 'input[type=checkbox][value="1"][readonly=readonly]' assert_select 'input[type=checkbox][value="3"][readonly=readonly]' assert_no_select 'input[type=checkbox][value="2"][readonly=readonly]' end test 'collection check boxes accepts single readonly item' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :readonly => 1 assert_select 'input[type=checkbox][value="1"][readonly=readonly]' assert_no_select 'input[type=checkbox][value="3"][readonly=readonly]' assert_no_select 'input[type=checkbox][value="2"][readonly=readonly]' end test 'collection check boxes accepts a proc to readonly items' do collection = (1..3).map{|i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, :readonly => proc { |i| i.first == 1 } assert_select 'input[type=checkbox][value="1"][readonly=readonly]' assert_no_select 'input[type=checkbox][value="3"][readonly=readonly]' assert_no_select 'input[type=checkbox][value="2"][readonly=readonly]' end test 'collection check boxes accepts html options' do collection = [[1, 'Category 1'], [2, 'Category 2']] with_collection_check_boxes :user, :category_ids, collection, :first, :last, {}, :class => 'check' assert_select 'input.check[type=checkbox][value="1"]' assert_select 'input.check[type=checkbox][value="2"]' end test 'collection check boxes with fields for' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] @output_buffer = fields_for(:post) do |p| p.collection_check_boxes :category_ids, collection, :id, :name end assert_select 'input#post_category_ids_1[type=checkbox][value="1"]' assert_select 'input#post_category_ids_2[type=checkbox][value="2"]' assert_select 'label[for=post_category_ids_1]', 'Category 1' assert_select 'label[for=post_category_ids_2]', 'Category 2' end test 'collection check boxes does not wrap input inside the label' do with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s assert_select 'input[type=checkbox] + label' assert_no_select 'label input' end test 'collection check boxes accepts a block to render the label as check box wrapper' do with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b| b.label { b.check_box } end assert_select 'label[for=user_active_true] > input#user_active_true[type=checkbox]' assert_select 'label[for=user_active_false] > input#user_active_false[type=checkbox]' end test 'collection check boxes accepts a block to change the order of label and check box' do with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b| b.label + b.check_box end assert_select 'label[for=user_active_true] + input#user_active_true[type=checkbox]' assert_select 'label[for=user_active_false] + input#user_active_false[type=checkbox]' end test 'collection check boxes with block helpers accept extra html options' do with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b| b.label(:class => "check_box") + b.check_box(:class => "check_box") end assert_select 'label.check_box[for=user_active_true] + input#user_active_true.check_box[type=checkbox]' assert_select 'label.check_box[for=user_active_false] + input#user_active_false.check_box[type=checkbox]' end test 'collection check boxes with block helpers allows access to current text and value' do with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b| b.label(:"data-value" => b.value) { b.check_box + b.text } end assert_select 'label[for=user_active_true][data-value=true]', 'true' do assert_select 'input#user_active_true[type=checkbox]' end assert_select 'label[for=user_active_false][data-value=false]', 'false' do assert_select 'input#user_active_false[type=checkbox]' end end test 'collection check boxes with block helpers allows access to the current object item in the collection to access extra properties' do with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b| b.label(:class => b.object) { b.check_box + b.text } end assert_select 'label.true[for=user_active_true]', 'true' do assert_select 'input#user_active_true[type=checkbox]' end assert_select 'label.false[for=user_active_false]', 'false' do assert_select 'input#user_active_false[type=checkbox]' end end end
46.306043
180
0.717154
afd776336383ec74bd5f79922023bb8741517218
1,188
py
Python
LeetCode/1604_Alert_Using_Same_Key_Card_Three_or_More_Times_in_a_One_Hour_Period.py
Achyut-sudo/PythonAlgorithms
21fb6522510fde7a0877b19a8cedd4665938a4df
[ "MIT" ]
144
2020-09-13T22:54:57.000Z
2022-02-24T21:54:25.000Z
LeetCode/1604_Alert_Using_Same_Key_Card_Three_or_More_Times_in_a_One_Hour_Period.py
Achyut-sudo/PythonAlgorithms
21fb6522510fde7a0877b19a8cedd4665938a4df
[ "MIT" ]
587
2020-05-06T18:55:07.000Z
2021-09-20T13:14:53.000Z
LeetCode/1604_Alert_Using_Same_Key_Card_Three_or_More_Times_in_a_One_Hour_Period.py
Achyut-sudo/PythonAlgorithms
21fb6522510fde7a0877b19a8cedd4665938a4df
[ "MIT" ]
523
2020-09-09T12:07:13.000Z
2022-02-24T21:54:31.000Z
class Solution(object): def alertNames(self, keyName, keyTime): """ :type keyName: List[str] :type keyTime: List[str] :rtype: List[str] """ mapp = {} for i in range(len(keyName)): name = keyName[i] if(name not in mapp): mapp[name] = [keyTime[i]] else: mapp[name].append(keyTime[i]) res = [] for name, arr in mapp.items(): arr.sort() for i in range(len(arr)-2): time= arr[i] t2 = arr[i+1] t3 = arr[i+2] if(time[0:2]=="23"): endTime = "24:00" if(t2<=endTime and t3<=endTime and t2>time and t3>time): res.append(name) break else: start = int(time[0:2]) endTime = str(start+1)+time[2:] if(start<9): endTime = "0"+endTime if(t2<=endTime and t3<=endTime): res.append(name) break return sorted(res)
33
76
0.388047
1ccb6c1cb449cf1cde05d3184f976a3e87482d14
92
lua
Lua
client/src/network/headers.lua
carabalonepaulo/mirage-lua
78fffe09b8a0f1697e2cf25550d02d700a9374d1
[ "MIT" ]
null
null
null
client/src/network/headers.lua
carabalonepaulo/mirage-lua
78fffe09b8a0f1697e2cf25550d02d700a9374d1
[ "MIT" ]
null
null
null
client/src/network/headers.lua
carabalonepaulo/mirage-lua
78fffe09b8a0f1697e2cf25550d02d700a9374d1
[ "MIT" ]
null
null
null
local enum = require('lib.enum').enum return enum [[ Login, AddPlayer, RemovePlayer ]]
15.333333
37
0.684783
6b3223121f6c8430296b6b065ef0763cf4a46273
734
js
JavaScript
src/openI18nFile.js
liub-work/vue-swift-i18n
8a46388eb3a28550b836f4ea7383c6e97b0d8bdb
[ "MIT" ]
35
2019-07-23T10:27:17.000Z
2022-03-11T08:38:38.000Z
src/openI18nFile.js
liub-work/vue-swift-i18n
8a46388eb3a28550b836f4ea7383c6e97b0d8bdb
[ "MIT" ]
6
2020-04-20T12:37:48.000Z
2022-03-02T08:56:10.000Z
src/openI18nFile.js
liub-work/vue-swift-i18n
8a46388eb3a28550b836f4ea7383c6e97b0d8bdb
[ "MIT" ]
12
2019-07-24T11:12:32.000Z
2022-02-11T14:00:41.000Z
const { registerCommand, window, Range, Position, } = require('./utils/vs'); const { operation } = require('./utils/constant'); const { openFileByPath } = require('./utils'); const scrollTo = require('./lib/scroll'); module.exports = context => { context.subscriptions.push( registerCommand(operation.openI18nFile.cmd, (args = {}) => { const { fPath, option, key } = args; const currentEditor = window.activeTextEditor; if (!currentEditor) return; const viewColumn = currentEditor.viewColumn + 1; openFileByPath(fPath, { selection: new Range(new Position(0, 0), new Position(0, 0)), preview: false, viewColumn, }).then(editor => { if(key){ scrollTo(editor, key); } }); }) ); };
25.310345
65
0.644414
b300b8069a759a4c33c0e1f442dc7c9290118408
971
py
Python
pupy/cheese.py
jessekrubin/pup
2cab5da7b1b39453c44be556b691db83442b0565
[ "BSD-2-Clause" ]
2
2019-03-07T09:26:36.000Z
2019-07-31T17:24:23.000Z
pupy/cheese.py
jessekrubin/pup
2cab5da7b1b39453c44be556b691db83442b0565
[ "BSD-2-Clause" ]
2
2019-10-26T02:29:54.000Z
2021-06-25T15:28:12.000Z
pupy/cheese.py
jessekrubin/pup
2cab5da7b1b39453c44be556b691db83442b0565
[ "BSD-2-Clause" ]
1
2019-07-31T17:24:32.000Z
2019-07-31T17:24:32.000Z
# -*- coding: utf-8 -*- # Pretty ~ Useful ~ Python """ String Methods """ def string_score(strang: str) -> int: """Sum of letter values where a==1 and z == 26 :param strang: string to be scored :type strang: str :returns: -> score of the string :rtype: int .. doctest:: python >>> string_score('me') 18 >>> string_score('poooood') 95 >>> string_score('gregory') 95 """ return sum((ord(character) - 96 for character in strang.lower())) def is_palindrome(string: str) -> bool: """True a string is a palindrome; False if string is not a palindrome. :param string: .. doctest::python >>> is_palindrome("racecar") True >>> is_palindrome("greg") False """ return all( character == string[-index - 1] for index, character in enumerate(string) ) if __name__ == "__main__": from doctest import testmod testmod()
19.039216
81
0.569516
c6add104299bf43e66ba4f8f818416f54ad3c488
604
rb
Ruby
test.rb
koki-h/atnd_listing
172e2536ca789a7c0c7867613384346cd0e6289a
[ "MIT" ]
null
null
null
test.rb
koki-h/atnd_listing
172e2536ca789a7c0c7867613384346cd0e6289a
[ "MIT" ]
null
null
null
test.rb
koki-h/atnd_listing
172e2536ca789a7c0c7867613384346cd0e6289a
[ "MIT" ]
null
null
null
require './lib/atnd.rb' require './lib/twitter.rb' require 'pp' def get_token(source) consumer_credential(source) end def consumer_credential(source) auth = [] open(source) do |f| while (line = f.gets) do auth << line.chomp end end pp auth auth end consumer_key, consumer_secret, access_token, access_token_secret = get_token("auth.txt") members = ATND.event_members("61150") app = ATND_LISTING.app(consumer_key, consumer_secret, access_token, access_token_secret ) list = app.create_list("test",:description=>"テストやで。",:mode=>"private") app.add_list_members(list, members)
23.230769
89
0.730132
9731388ec19cb257dbb2b85cfb00b9dc6337f553
2,313
ts
TypeScript
src/extension.ts
diamantdev/temporary-typescript-sandbox
0ee7822413c971d8169d0f146778f2824d577f03
[ "MIT" ]
null
null
null
src/extension.ts
diamantdev/temporary-typescript-sandbox
0ee7822413c971d8169d0f146778f2824d577f03
[ "MIT" ]
null
null
null
src/extension.ts
diamantdev/temporary-typescript-sandbox
0ee7822413c971d8169d0f146778f2824d577f03
[ "MIT" ]
null
null
null
import * as vscode from 'vscode'; import { tmpdir } from 'os'; import * as fs from 'fs'; import * as randomstring from 'randomstring'; import { exec } from 'child_process'; export function activate(context: vscode.ExtensionContext) { // The command has been defined in the package.json file // Now provide the implementation of the command with registerCommand // The commandId parameter must match the command field in package.json let disposable = vscode.commands.registerCommand( 'temporary-typescript-sandbox.start', async () => { const folderdir = `${tmpdir().replace('\\', '/')}/${randomstring.generate( { length: 20, capitalization: 'lowercase', charset: 'alphabetic', } )}`; const folderCreated = await fs.mkdir(folderdir, (err) => { return err; }); const file1Created = await fs.writeFile( `${folderdir}/package.json`, '{"name": "sandbox","main": "index.ts", "scripts": {"start": "ts-node-dev --respawn index.ts"}}', (err) => { return err; } ); const file2Created = await fs.writeFile( `${folderdir}/tsconfig.json`, '{"compilerOptions": {"strict": true,"moduleResolution": "node","esModuleInterop": true, "watch": true}}', (err) => { return err; } ); const file3Created = await fs.writeFile( `${folderdir}/index.ts`, '', (err) => { return err; } ); exec( `cd ${folderdir} && npm init -y && npm i typescript ts-node-dev tslib @types/node --save-dev`, (err) => { const terminal = vscode.window.createTerminal('Sandbox - Directory'); const terminal2 = vscode.window.createTerminal( 'Sandbox - Typescript Runtime' ); terminal2.show(); terminal.sendText(`cd ${folderdir} && cls`); terminal2.sendText(`cd ${folderdir} && npm start`); vscode.workspace .openTextDocument(`${folderdir}/index.ts`) .then((document) => vscode.window.showTextDocument(document)); } ); } ); context.subscriptions.push(disposable); } // this method is called when your extension is deactivated export function deactivate() {}
34.014706
114
0.582361
3f82c03a817e1ffb21446932f7811590a5ae0b7c
6,977
php
PHP
src/Bfxmpl/Bundle/BudgetBundle/Controller/EcritureController.php
bfxfr/NotreBudget
552af53c8d354a460d49dc747d9c163ee990652a
[ "MIT" ]
null
null
null
src/Bfxmpl/Bundle/BudgetBundle/Controller/EcritureController.php
bfxfr/NotreBudget
552af53c8d354a460d49dc747d9c163ee990652a
[ "MIT" ]
null
null
null
src/Bfxmpl/Bundle/BudgetBundle/Controller/EcritureController.php
bfxfr/NotreBudget
552af53c8d354a460d49dc747d9c163ee990652a
[ "MIT" ]
null
null
null
<?php namespace Bfxmpl\Bundle\BudgetBundle\Controller; use Bfxmpl\Bundle\BudgetBundle\Entity\CompteBancaire; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Bfxmpl\Bundle\BudgetBundle\Entity\Ecriture; use Bfxmpl\Bundle\BudgetBundle\Form\Type\EcritureType; /** * Ecriture controller. * * @Route("/ecriture") */ class EcritureController extends Controller { /** * Lists all Ecriture entities. * * @Route("/", name="ecriture") * @Method("GET") * @Template() */ public function indexAction() { $em = $this->getDoctrine()->getManager(); $entities = $em->getRepository('BfxmplBudgetBundle:Ecriture')->findAll(); return array( 'entities' => $entities, ); } /** * Creates a new Ecriture entity. * * @Route("/", name="ecriture_create") * @Method("POST") * @Template("BfxmplBudgetBundle:Ecriture:new.html.twig") */ public function createAction(Request $request) { $entity = new Ecriture(); $form = $this->createCreateForm($entity); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($entity->getCompteBancaire()); $em->persist($entity->getCompteComptable()); $em->persist($entity); $em->flush(); return $this->redirect($this->generateUrl('ecriture_show', array('id' => $entity->getId()))); } return array( 'entity' => $entity, 'form' => $form->createView(), ); } /** * Creates a form to create a Ecriture entity. * * @param Ecriture $entity The entity * * @return \Symfony\Component\Form\Form The form */ private function createCreateForm(Ecriture $entity) { $form = $this->createForm(new EcritureType(), $entity, array( 'action' => $this->generateUrl('ecriture_create'), 'method' => 'POST', )); $form->add('submit', 'submit', array('label' => 'Ajouter')); return $form; } /** * Displays a form to create a new Ecriture entity. * * @Route("/new", name="ecriture_new") * @Method("GET") * @Template() */ public function newAction() { $entity = new Ecriture(); $form = $this->createCreateForm($entity); return array( 'entity' => $entity, 'form' => $form->createView(), ); } /** * Finds and displays a Ecriture entity. * * @Route("/{id}", name="ecriture_show") * @Method("GET") * @Template() */ public function showAction($id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BfxmplBudgetBundle:Ecriture')->find($id); if (!$entity) { throw $this->createNotFoundException('Impossible de trouver Ecriture entity.'); } $deleteForm = $this->createDeleteForm($id); return array( 'entity' => $entity, 'delete_form' => $deleteForm->createView(), ); } /** * Displays a form to edit an existing Ecriture entity. * * @Route("/{id}/edit", name="ecriture_edit") * @Method("GET") * @Template() */ public function editAction($id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BfxmplBudgetBundle:Ecriture')->find($id); if (!$entity) { throw $this->createNotFoundException('Impossible de trouver Ecriture entity.'); } $editForm = $this->createEditForm($entity); $deleteForm = $this->createDeleteForm($id); return array( 'entity' => $entity, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView(), ); } /** * Creates a form to edit a Ecriture entity. * * @param Ecriture $entity The entity * * @return \Symfony\Component\Form\Form The form */ private function createEditForm(Ecriture $entity) { $form = $this->createForm(new EcritureType(), $entity, array( 'action' => $this->generateUrl('ecriture_update', array('id' => $entity->getId())), 'method' => 'PUT', )); $form->add('submit', 'submit', array('label' => 'Modifier')); return $form; } /** * Edits an existing Ecriture entity. * * @Route("/{id}", name="ecriture_update") * @Method("PUT") * @Template("BfxmplBudgetBundle:Ecriture:edit.html.twig") */ public function updateAction(Request $request, $id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BfxmplBudgetBundle:Ecriture')->find($id); if (!$entity) { throw $this->createNotFoundException('Impossible de trouver Ecriture entity.'); } $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); if ($editForm->isValid()) { $em->flush(); return $this->redirect($this->generateUrl('ecriture_edit', array('id' => $id))); } return array( 'entity' => $entity, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView(), ); } /** * Deletes a Ecriture entity. * * @Route("/{id}", name="ecriture_delete") * @Method("DELETE") */ public function deleteAction(Request $request, $id) { $form = $this->createDeleteForm($id); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BfxmplBudgetBundle:Ecriture')->find($id); if (!$entity) { throw $this->createNotFoundException('Impossible de trouver Ecriture entity.'); } $em->remove($entity); $em->flush(); } return $this->redirect($this->generateUrl('ecriture')); } /** * Creates a form to delete a Ecriture entity by id. * * @param mixed $id The entity id * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm($id) { return $this->createFormBuilder() ->setAction($this->generateUrl('ecriture_delete', array('id' => $id))) ->setMethod('DELETE') ->add('submit', 'submit', array('label' => 'Supprimer')) ->getForm() ; } }
27.796813
105
0.553533
4d9a59da3b7c606ea28ce3093981242d7afa9211
421
cs
C#
Source/Web/OnlineStore.Web/Extensions/ByteExtensions.cs
PlamenHP/OnlineStore
40a38b4bbbaaf5fd1b69e0ad465e50e04d858c61
[ "MIT" ]
3
2018-11-18T12:39:23.000Z
2021-04-17T00:04:55.000Z
Source/Web/OnlineStore.Web/Extensions/ByteExtensions.cs
PlamenHP/OnlineStore
40a38b4bbbaaf5fd1b69e0ad465e50e04d858c61
[ "MIT" ]
null
null
null
Source/Web/OnlineStore.Web/Extensions/ByteExtensions.cs
PlamenHP/OnlineStore
40a38b4bbbaaf5fd1b69e0ad465e50e04d858c61
[ "MIT" ]
null
null
null
namespace OnlineStore.Web.Extensions { using System; public static class ByteExtensions { public static string ToStringImage(this byte[] imageData) { if (imageData == null) { return null; } var base64 = Convert.ToBase64String(imageData); return string.Format("data:image/jpg;base64,{0}", base64); } } }
23.388889
70
0.546318
e030e42c5180e682a1ba63b6398c424d2088dd70
620
c
C
njucs17-ps-tutorial/1-1-io/printf.c
hengxin/learning-c
8cadae4784875c5b333359f1f20f4d60d12d56b4
[ "MIT" ]
1
2018-10-17T13:04:55.000Z
2018-10-17T13:04:55.000Z
njucs17-ps-tutorial/1-1-io/printf.c
hengxin/learning-c
8cadae4784875c5b333359f1f20f4d60d12d56b4
[ "MIT" ]
1
2017-11-03T12:09:42.000Z
2017-11-03T12:09:42.000Z
njucs17-ps-tutorial/1-1-io/printf.c
hengxin/learning-c-cplusplus
8cadae4784875c5b333359f1f20f4d60d12d56b4
[ "MIT" ]
3
2017-10-26T00:56:19.000Z
2017-11-03T12:51:31.000Z
// File: printf.c // Created by hengxin on 17-10-18. /** * From cplusplus.com: http://www.cplusplus.com/reference/cstdio/printf/ */ #include <stdio.h> int main(void) { printf ("Characters: %c %c \n", 'a', 65); printf ("Decimals: %d %ld\n", 1977, 650000L); printf ("Preceding with blanks: %10d \n", 1977); printf ("Preceding with zeros: %010d \n", 1977); printf ("Some different radices: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100); printf ("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416); printf ("Width trick: %*d \n", 5, 10); printf ("%s \n", "A string"); return 0; }
28.181818
84
0.574194
d1ca6cb3299b8e305d7bcb3e3e01ff225d34818e
839
ps1
PowerShell
source/Module/Rule.WindowsFeature/Convert/Data.ps1
JakeDean3631/PowerStig
6eaf02d7b7bae910ec8cefc8cd1f2caee8e5955e
[ "MIT" ]
304
2019-05-07T19:29:43.000Z
2022-03-27T12:58:07.000Z
source/Module/Rule.WindowsFeature/Convert/Data.ps1
JakeDean3631/PowerStig
6eaf02d7b7bae910ec8cefc8cd1f2caee8e5955e
[ "MIT" ]
536
2019-05-07T02:56:27.000Z
2022-03-24T17:02:07.000Z
source/Module/Rule.WindowsFeature/Convert/Data.ps1
JakeDean3631/PowerStig
6eaf02d7b7bae910ec8cefc8cd1f2caee8e5955e
[ "MIT" ]
82
2019-05-10T03:35:55.000Z
2022-01-11T19:04:04.000Z
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # This is used to centralize the regEx patterns data regularExpression { ConvertFrom-StringData -StringData @' WindowsFeatureName = Get-Windows(?:Optional)?Feature\\s*(?:-Online\\s*)?(?:-Name|\\|\\s*Where\\s*(?:Feature)?Name\\s*-eq)\\s*(?'featureName'(\\w*(-?))+) FeatureNameEquals = FeatureName\\s-eq\\s*\\S* FeatureNameSpaceColon = FeatureName\\s\\:\\s\\S* IfTheApplicationExists = If the [\\s\\S]*?application exists WebDavPublishingFeature = ((W|w)eb(DAV|(D|d)av) (A|a)uthoring)|(WebDAV Publishing) SimpleTCP = Simple\\sTCP/IP\\sServices IISWebserver = Internet\\sInformation\\sServices IISHostableWebCore = Internet\\sInformation\\sServices\\sHostable\\sWeb\\sCore '@ }
44.157895
160
0.669845
6d0bbde15c2ac0d9975c70c5a3bb6b71e1999534
360
ts
TypeScript
src/models/album-day.ts
deanmoses/tacocat-gallery-redux
322eaf0264e69e20640d9fe6ec379dfb92d5fd1a
[ "MIT" ]
null
null
null
src/models/album-day.ts
deanmoses/tacocat-gallery-redux
322eaf0264e69e20640d9fe6ec379dfb92d5fd1a
[ "MIT" ]
8
2020-11-26T22:26:22.000Z
2022-02-26T02:19:06.000Z
src/models/album-day.ts
deanmoses/tacocat-gallery-redux
322eaf0264e69e20640d9fe6ec379dfb92d5fd1a
[ "MIT" ]
null
null
null
import DateBasedAlbum from '@src/models/album-datebased'; import * as DateUtils from '@src/utils/date-utils'; /** * Overrides the default album class with behavior specific to year albums. */ export default class DayAlbum extends DateBasedAlbum { /** * Friendly title of page */ get pageTitle(): string { return DateUtils.longDate(this.date); } }
24
76
0.725
447f1b3d29dfc34af858d449462868ae8893e701
798
py
Python
equip/visitors/blocks.py
neuroo/equip
470c168cf26d1d8340aa5ab37a5364d999a0b2f4
[ "Apache-2.0" ]
102
2015-01-03T13:51:03.000Z
2022-02-28T03:56:26.000Z
equip/visitors/blocks.py
neuroo/equip
470c168cf26d1d8340aa5ab37a5364d999a0b2f4
[ "Apache-2.0" ]
4
2016-12-09T00:31:39.000Z
2019-07-28T09:48:18.000Z
equip/visitors/blocks.py
neuroo/equip
470c168cf26d1d8340aa5ab37a5364d999a0b2f4
[ "Apache-2.0" ]
9
2015-05-08T12:17:28.000Z
2020-12-17T08:20:00.000Z
# -*- coding: utf-8 -*- """ equip.visitors.blocks ~~~~~~~~~~~~~~~~~~~~~ Callback the visit basic blocks in the program. :copyright: (c) 2014 by Romain Gaucher (@rgaucher) :license: Apache 2, see LICENSE for more details. """ class BlockVisitor(object): """ A basic block visitor. It first receives the control-flow graph, and then the ``visit`` method is called with all basic blocks in the CFG. The blocks are not passed to the ``visit`` method with a particular order. """ def __init__(self): self._control_flow = None @property def control_flow(self): return self._control_flow @control_flow.setter def control_flow(self, value): self._control_flow = value def new_control_flow(self): pass def visit(self, block): pass
21.567568
71
0.661654
200fa896cac442d778b85723a3bd49165a4cf9b8
2,814
py
Python
test/fstrings/prefixes3.py
kylebarron/MagicPython
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
[ "MIT" ]
1,482
2015-10-16T21:59:32.000Z
2022-03-30T11:44:40.000Z
test/fstrings/prefixes3.py
kylebarron/MagicPython
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
[ "MIT" ]
226
2015-10-15T15:53:44.000Z
2022-03-25T03:08:27.000Z
test/fstrings/prefixes3.py
kylebarron/MagicPython
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
[ "MIT" ]
129
2015-10-20T02:41:49.000Z
2022-03-22T01:44:36.000Z
fr'some {obj}' Fr'some {obj}' fR'some {obj}' FR'some {obj}' fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python ' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python some : source.python, string.interpolated.python, string.regexp.quoted.single.python {obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python Fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python ' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python some : source.python, string.interpolated.python, string.regexp.quoted.single.python {obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python fR : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python ' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python { : constant.character.format.placeholder.other.python, meta.fstring.python, source.python obj : meta.fstring.python, source.python } : constant.character.format.placeholder.other.python, meta.fstring.python, source.python ' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python FR : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python ' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python { : constant.character.format.placeholder.other.python, meta.fstring.python, source.python obj : meta.fstring.python, source.python } : constant.character.format.placeholder.other.python, meta.fstring.python, source.python ' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python
85.272727
153
0.734186
2febe828324595b72252acdfcd42dc8ab022af2d
1,156
py
Python
scraper/storage_spiders/huyhoangvn.py
chongiadung/choinho
d2a216fe7a5064d73cdee3e928a7beef7f511fd1
[ "MIT" ]
null
null
null
scraper/storage_spiders/huyhoangvn.py
chongiadung/choinho
d2a216fe7a5064d73cdee3e928a7beef7f511fd1
[ "MIT" ]
10
2020-02-11T23:34:28.000Z
2022-03-11T23:16:12.000Z
scraper/storage_spiders/huyhoangvn.py
chongiadung/choinho
d2a216fe7a5064d73cdee3e928a7beef7f511fd1
[ "MIT" ]
3
2018-08-05T14:54:25.000Z
2021-06-07T01:49:59.000Z
# Auto generated by generator.py. Delete this line if you make modification. from scrapy.spiders import Rule from scrapy.linkextractors import LinkExtractor XPATH = { 'name' : "//div[@class='main-full-content']/div[@class='content-center fl']/div[@class='content-main']/h1", 'price' : "//div[@class='info-detail']/div[@class='su-pi']/div/span[@class='price-new']|//div[@class='spritespin-stage']//img/@src", 'category' : "//div[@class='content-center fl']/div[@class='content-main']/div[@class='tree-url']/a", 'description' : "//div[@class='content-main']/div[@id='tab-content']/div[@class='multi-tab-content']/div[@class='tong-quan block']", 'images' : "//meta[@property='og:image']/@content", 'canonical' : "", 'base_url' : "//base/@href", 'brand' : "" } name = 'huyhoang.vn' allowed_domains = ['huyhoang.vn'] start_urls = ['http://huyhoang.vn'] tracking_url = '' sitemap_urls = [''] sitemap_rules = [('', 'parse_item')] sitemap_follow = [''] rules = [ #Rule(LinkExtractor(), 'parse_item'), #Rule(LinkExtractor(), 'parse'), Rule(LinkExtractor(allow=['/[a-zA-Z0-9-]+($|\?p=\d+$)']), 'parse_item_and_links'), ]
42.814815
136
0.636678
66fe3acbd6cf872f091d1986b8bc590fbab1d4a0
779
asm
Assembly
oeis/005/A005913.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/005/A005913.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/005/A005913.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A005913: a(n) = [ tau*a(n-1) ] + [ tau*a(n-2) ]. ; Submitted by Christian Krause ; 1,3,5,12,27,62,143,331,766,1774,4109,9518,22048,51074,118313,274073,634893,1470737,3406980,7892311,18282636,42351953,98108825,227270312,526474502,1219584727,2825183178,6544571946,15160582256,35119677229,81355168809,188460259723,436570534053,1011321068344,2342737824703,5426981289218,12571669609363,29122428905547,67462468527410,156277646846446,362019111321721,838621770974978,1942677755838720,4500237167278562,10424855332227677,24149306949437217,55942169704288413,129590731434896761 mov $2,1 mov $4,-2 lpb $0 sub $0,1 add $1,$5 sub $1,1 sub $4,$5 sub $3,$4 mov $4,$2 mov $2,$3 add $2,$1 mov $1,$3 add $5,3 add $5,$4 mov $3,$5 add $4,1 lpe mov $0,$3 div $0,2 add $0,1
31.16
484
0.743261
2c9fc944ffbcce02cc36a48cf7f568ac2cb822f2
6,843
py
Python
ScoreBehavioralStudy.py
NCMlab/ScoringCognitiveTasks
7170a97dab0c0feba682e1bdad1f78c6390c97fc
[ "MIT" ]
null
null
null
ScoreBehavioralStudy.py
NCMlab/ScoringCognitiveTasks
7170a97dab0c0feba682e1bdad1f78c6390c97fc
[ "MIT" ]
1
2020-01-30T03:49:45.000Z
2020-01-30T03:49:45.000Z
ScoreBehavioralStudy.py
NCMlab/ScoringCognitiveTasks
7170a97dab0c0feba682e1bdad1f78c6390c97fc
[ "MIT" ]
null
null
null
import os import importlib import sys import pandas as pd import csv import datetime import NCMPartv2 import ScoreNIHToolbox import glob import numpy as np importlib.reload(ScoreNIHToolbox) # importlib.reload(NCMPartv2) BaseDir = '/home/jsteffen' BaseDir = '/Users/jasonsteffener' sys.path.append(os.path.join(BaseDir,'Documents','GitHub','CognitiveTasks','DataHandlingScripts')) import ProcessBehavioralFunctions importlib.reload(ProcessBehavioralFunctions) # importlib.reload(DataHandlingScriptsPart1) # import DataHandlingBehavioral # importlib.reload(DataHandlingBehavioral) OutDataFolder = os.path.join(BaseDir, 'Dropbox/steffenercolumbia/Projects/MyProjects/NeuralCognitiveMapping/NeuroPsychData/CassParticipantData/data') df = ProcessBehavioralFunctions.CycleOverBehDataFolders(OutDataFolder) # subid = '1001003' # VisitFolder = os.path.join(OutDataFolder,subid) # ScoreOneBeh(VisitFolder,subid) # Data = DataHandlingBehavioral.ReadBehFile(VisitFolder, '*DMS_Block', subid) # # # Data = DataHandlingBehavioral.CheckDMSDataFrameForLoad(Data) def ScoreOneBeh(subdir, subid): Results = DataHandlingBehavioral.LoadRawBehData(subdir, subid) return Results # Load the NIH data dfNIH = ScoreNIHToolbox.Run(BaseDir) inputFileName = os.path.join(BaseDir,'Dropbox/steffenercolumbia/Projects/MyProjects/NeuralCognitiveMapping/data/SurveyMonkeyExports/Participant Questionnaire.csv') # open the file fid = open(inputFileName,'r', encoding="ISO-8859-1") data = csv.reader(fid) #data = pandas.read_csv(fid, sep=',', encoding='latin-1') # Read whole file into a list LL = list(data) fid.close() NPart = len(LL) - 2 HeaderLine1 = LL[0] HeaderLine2 = LL[1] PartData = LL[2:] PartCount = 0 DataList = [] for i in PartData: print("=================================") # Skip rows that are test subjects if len(i[9]) == 8: if not i[9][5] == '9': try: # 14 has missing NIH data # 15 has missing block data # 16 has data that does not look good # Empty rows in the survey monkey file need to be removed part = NCMPartv2.NCMParticipant() part.MakeParticipant(i) part.ReadBlockDataLong('DMS_Block','DMS',6) part.ReadStairData('DMS') DataList.append(part) # print str(RowCount)+" "+part.subid PartCount += 1 except: print(str(PartCount)+" "+part.subid) print("############# >>>>> Uhh Oh <<<<< ############") PartCount += 1 else: print("Skipping: %s"%(i[9])) # Map the psychopy ans SM data together for i in DataList: SMsubid = i.subid dfLOC = (df['AAsubid'] == SMsubid) dfLOC = [i for i, x in enumerate(dfLOC) if x] if len(dfLOC) > 0: df.loc[dfLOC[0],'ageSM'] = i.age df.loc[dfLOC[0],'ageGroupSM'] = i.ageGroup df.loc[dfLOC[0],'eduSM'] = i.edu df.loc[dfLOC[0],'sex'] = i.sex df.loc[dfLOC[0],'BDIscore'] = i.BDIscore df.loc[dfLOC[0],'GDSscore'] = i.GDSscore df.loc[dfLOC[0],'FOSC'] = i.FOSC df.loc[dfLOC[0],'PAAerobic'] = i.PAAerobicMin df.loc[dfLOC[0],'PABicycling'] = i.PABicyclingMin df.loc[dfLOC[0],'PAJogging'] = i.PAJoggingMin df.loc[dfLOC[0],'PALapSwim'] = i.PALapSwimMin df.loc[dfLOC[0],'PALowIntensity'] = i.PALowIntensityMin df.loc[dfLOC[0],'PARunning'] = i.PARunningMin df.loc[dfLOC[0],'PATennis'] = i.PATennisMin df.loc[dfLOC[0],'PAWalkHike'] = i.PAWalkHikeMin else: # the part is not in the tasks DF pass dfAll = df.merge(dfNIH, left_on='AAsubid', right_on='AAsubid', how='outer') dfAll['Checked'] = np.zeros([len(dfAll)]) BaseFileName = 'NCM_BehavStudy_Tasks_NIH_SM' now = datetime.datetime.now() NowString = now.strftime("_updated_%b-%d-%Y_%H-%M.csv") NewOutFileName = BaseFileName + NowString OutFile = os.path.join(OutDataFolder, NewOutFileName) dfAll.to_csv(OutFile, index = False) dfOld = LoadExistingData(OutDataFolder, BaseFileName) dfUpdated = SeeIfDataHasBeenChecked(dfAll, dfOld) def LoadExistingData(OutDataFolder, BaseFileName): Files = glob.glob(os.path.join(OutDataFolder, BaseFileName + '*.csv')) df = pd.read_csv(Files[-1]) return df def SeeIfDataHasBeenChecked(dfAll, dfOld): NewPartList = ScoreNIHToolbox.ExtractUniquePartIDs(dfAll['AAsubid']) OldPartList = ScoreNIHToolbox.ExtractUniquePartIDs(dfOld['AAsubid']) for i in NewPartList: print(i) try: # is the sub from dfAll in dfOld if len(find(OldPartList==i)) > 0: # this subject IS in the old table # pull out their new data # indexOld = dfOld.index[dfOld['AAsubid']==i].tolist() tempOld = dfOld[dfOld['AAsubid'] == i] if (tempOld['Checked'] == 0).all(): # update old DF with the new data tempNew = dfAll[dfAll['AAsubid'] == i] #replace old with new indexNew = dfAll.index[dfAll['AAsubid']==i].tolist() indexOld = dfOld.index[dfOld['AAsubid']==i].tolist() dfOld.loc[indexOld[0]] = dfAll.loc[indexNew[0]] else: # do not change old data pass else: # no .. add them to dfOld indexNew = dfAll.index[dfAll['AAsubid']==i].tolist() dfOld = dfOld.append(dfAll.loc[indexNew]) except: print("problem with: %s"%(i)) return dfOld # # yes # is Checked in dfOld == 1? # yes, do nothing # else, update dfOld #check existing data file to see i # inputFileName = [u'/Users/jasonsteffener/Dropbox/steffenercolumbia/Projects/MyProjects/NeuralCognitiveMapping/data/SurveyMonkeyExports/Participant Questionnaire.csv'] # # open the file # fid = open(inputFileName[0],'r', encoding="ISO-8859-1") # # data = csv.reader(fid) # data = pd.read_csv(fid, sep=',', encoding='latin-1') # # # df = pd.read_csv(inputFileName[0], sep=',', encoding='latin-1') # indices = [i for i, c in enumerate(df.columns) if not c.startswith('Unnamed')] # questions = [c for c in df.columns if not c.startswith('Unnamed')] # slices = [slice(i, j) for i, j in zip(indices, indices[1:] + [None])] # for q in slices: # print(df.iloc[:, q]) # Use `display` if using Jupyter # # def parse_response(s): # try: # return s[~s.isnull()][0] # except IndexError: # return np.nan # # data = [df.iloc[:, q].apply(parse_response, axis=1)[1:] for q in slices] # dfOUT = pd.concat(data, axis=1) # dfOUT.columns = questions ####
34.560606
168
0.620634
ff26c312523709e53089aa1aa00da19ba8277e01
5,409
py
Python
source/simulation.py
svaigen/DTMZ
10420094bbedfd0398ee0ef40fc1bc43bf1e4f98
[ "MIT" ]
null
null
null
source/simulation.py
svaigen/DTMZ
10420094bbedfd0398ee0ef40fc1bc43bf1e4f98
[ "MIT" ]
null
null
null
source/simulation.py
svaigen/DTMZ
10420094bbedfd0398ee0ef40fc1bc43bf1e4f98
[ "MIT" ]
2
2021-05-01T11:09:16.000Z
2021-09-07T09:13:06.000Z
import mobileEntity as me import mixZone as mz import datetime as dt import dtmzUtils as utils import pandas as pd import graphOperations as graphOp import os def simulation(G, n_mixzones, k_anonymity, mobile_entities_path,sim_file,mixzones_path, days, intervals, radius_mixzone, metric): print("Simulation begins at {}".format(dt.datetime.now())) df_mixzones_selected = pd.read_csv(mixzones_path,delimiter=',', header=None) counter_day = 0 counter_interval = 0 counter_changes = 0 mobile_entities, entities_per_day = utils.generateMobileEntities("{}".format(mobile_entities_path)) time_references, time_ordered = generateTimeReferences(mobile_entities) # last_date = dt.datetime.strptime("{} {}".format(days[len(days)-1],intervals[len(intervals)-1]), '%Y-%m-%d %H:%M:%S') last_date = dt.datetime.strptime("{} 23:59:59".format(days[len(days)-1]), '%Y-%m-%d %H:%M:%S') #beginning simulation for day 0, interval 0 print("Simulating initial interval") mixzones = graphOp.selectMixZonesByMetricAndRegion(n_mixzones,G,k_anonymity, radius_mixzone,metric) while time_ordered: timestamp = time_ordered.pop(0) # considered_date = dt.datetime.strptime("{} {}".format(days[counter_day],intervals[counter_interval]), '%Y-%m-%d %H:%M:%S') considered_date = dt.datetime.strptime("{} 23:59:59".format(days[counter_day]), '%Y-%m-%d %H:%M:%S') timestamp_date = dt.datetime.fromtimestamp(timestamp) if (timestamp_date > considered_date): genSimFile(days[counter_day],mixzones, entities_per_day[counter_day],n_mixzones,k_anonymity,radius_mixzone) for m in mixzones: for entity in m.entities: m.entities[entity].in_mix_zone = False m.entities[entity].mix_zone = None if (timestamp_date > last_date): print("Simulation ends at {}".format(dt.datetime.now())) return None counter_changes += 1 counter_day, counter_interval = adjustCounters(counter_changes, counter_day, counter_interval) selected_mixzones = df_mixzones_selected.iloc[counter_changes -1].values.tolist() mixzones = utils.generateMixZonesObjects(selected_mixzones,G,k_anonymity,radius_mixzone) # print("Simulating {} {}".format(days[counter_day],intervals[counter_interval])) print("Simulating {}".format(days[counter_day])) else: entities = time_references[timestamp] for entity in entities: if entity.in_mix_zone: already_in_mix_zone = entity.mix_zone.isInCoverage((entity.getCurrentLocation()[0],entity.getCurrentLocation()[1])) if not already_in_mix_zone: entity.exitMixZone() else: entity.enteringMixzone(mixzones) next_location = entity.nextLocation() if not entity.nextLocation() == -1: time = entity.getCurrentLocation()[2] if time in time_references: time_references[time].append(entity) else: time_references[time] = [entity] time_ordered.append(time) time_ordered.sort() print("Simulation ends at {}".format(dt.datetime.now())) return None def generateTimeReferences(mobile_entities): time_references = {} time_ordered = [] for entity in mobile_entities: if entity.getCurrentLocation()[2] in time_references: time_references[entity.getCurrentLocation()[2]].append(entity) else: time_ordered.append(entity.getCurrentLocation()[2]) time_references[entity.getCurrentLocation()[2]] = [entity] time_ordered.sort() return time_references, time_ordered def adjustCounters(counter_changes, counter_day, counter_interval): # counter_interval += 1 # if counter_interval % 4 == 0: # counter_interval = 0 # counter_day += 1 counter_day += 1 return counter_day, counter_interval def genSimFile(day, mixzones, coverage_day, n_mixzones, k_anonymity,radius_mixzone): path = "./m{}_k{}_r{}/".format(n_mixzones,k_anonymity,radius_mixzone) if not (os.path.exists(path)): os.mkdir(path) path_csv = "{}{}.csv".format(path,day) path_txt = "{}{}.txt".format(path,day) f = open(path_csv,"a") if (os.path.exists(path_csv)) else open(path_csv,"w") f_txt = open(path_txt,"a") if (os.path.exists(path_txt)) else open(path_txt,"w") for m in mixzones: entities_covered = 0 if m.entities_covered is None else len(m.entities_covered) entities_anonymized = 0 if m.entities_anonymized is None else len(m.entities_anonymized) f.write("{},{},{},{}\n".format(m.id,entities_covered,entities_anonymized,coverage_day)) if entities_covered == 0: f_txt.write(" <-> ") else: for e in m.entities_covered: f_txt.write("{},".format(int(e.id))) f_txt.write(" <-> ") if not entities_anonymized == 0: for e in m.entities_anonymized: f_txt.write("{},".format(int(e.id))) f_txt.write("\n") f.close() f_txt.close()
50.551402
135
0.63117
a173a7b1c1e25e7dd3031d6f010aa7f8cc3ed3e3
1,281
ps1
PowerShell
VenafiPS/Public/Test-ModuleHash.ps1
tonyjameshart/VenafiPS
6607201a3683c3ca3251d9ec9b9e453883cb18c5
[ "Apache-2.0" ]
7
2021-07-31T14:30:19.000Z
2021-12-14T17:11:00.000Z
VenafiPS/Public/Test-ModuleHash.ps1
tonyjameshart/VenafiPS
6607201a3683c3ca3251d9ec9b9e453883cb18c5
[ "Apache-2.0" ]
36
2021-05-06T00:02:07.000Z
2021-12-19T14:07:34.000Z
VenafiPS/Public/Test-ModuleHash.ps1
tonyjameshart/VenafiPS
6607201a3683c3ca3251d9ec9b9e453883cb18c5
[ "Apache-2.0" ]
4
2021-07-09T15:45:52.000Z
2021-12-09T20:59:50.000Z
<# .SYNOPSIS Validate module files .DESCRIPTION Validate all module files against the cryptographic hash created when the module was published. A file containing all hashes will be downloaded from the GitHub release and compared to the module files currently in use. .EXAMPLE Test-ModuleHash .INPUTS None .OUTPUTS Boolean #> function Test-ModuleHash { [CmdletBinding()] [OutputType([Boolean])] param ( ) try { Invoke-webrequest -Uri "https://github.com/Venafi/VenafiPS/releases/download/v$ModuleVersion/hash.json" -OutFile ('{0}/hash.json' -f $env:TEMP) -UseBasicParsing $json = (Get-Content -Path ('{0}/hash.json' -f $env:TEMP) -Raw) | ConvertFrom-Json } catch { Write-Error "Unable to download and process hash.json, $_" return $false } $hashFailed = $json | ForEach-Object { Write-Verbose ('Checking {0}' -f $_.File) $thisHash = Get-ChildItem -Path ('{0}/../{1}' -f $PSScriptRoot, $_.File) | Get-FileHash -Algorithm SHA256 if ( $thisHash.Hash -ne $_.Hash ) { $thisHash.Path } } if ( $hashFailed ) { Write-Error ('hash check failed for the following files: {0}' -f ($hashFailed -join ', ')) } -not $hashFailed }
27.847826
168
0.629196
e54afcd1a987dd7ee991aeede30c0195a4f660f8
2,913
sql
SQL
src/maw_database_pg/010/funcs/photo.get_categories.sql
AerisG222/mikeandwan.us
d93c8317aa00035a9035cc903a60de2d5aeb4428
[ "MIT" ]
null
null
null
src/maw_database_pg/010/funcs/photo.get_categories.sql
AerisG222/mikeandwan.us
d93c8317aa00035a9035cc903a60de2d5aeb4428
[ "MIT" ]
74
2020-02-09T12:58:49.000Z
2022-03-16T17:52:04.000Z
src/maw_database_pg/010/funcs/photo.get_categories.sql
AerisG222/mikeandwan.us
d93c8317aa00035a9035cc903a60de2d5aeb4428
[ "MIT" ]
null
null
null
DROP FUNCTION photo.get_categories(BOOLEAN, SMALLINT, SMALLINT, SMALLINT); CREATE OR REPLACE FUNCTION photo.get_categories ( _allow_private BOOLEAN, _year SMALLINT DEFAULT NULL, _id SMALLINT DEFAULT NULL, _since_id SMALLINT DEFAULT NULL ) RETURNS TABLE ( id SMALLINT, year SMALLINT, name VARCHAR(50), create_date TIMESTAMP, latitude REAL, longitude REAL, photo_count INTEGER, total_size_xs BIGINT, total_size_xs_sq BIGINT, total_size_sm BIGINT, total_size_md BIGINT, total_size_lg BIGINT, total_size_prt BIGINT, total_size_src BIGINT, total_size BIGINT, teaser_photo_path VARCHAR(255), teaser_photo_width SMALLINT, teaser_photo_height SMALLINT, teaser_photo_size INTEGER, teaser_photo_sq_path VARCHAR(255), teaser_photo_sq_width SMALLINT, teaser_photo_sq_height SMALLINT, teaser_photo_sq_size INTEGER, is_missing_gps_data BOOLEAN ) LANGUAGE SQL AS $$ WITH missing_gps_categories AS ( SELECT c.id FROM photo.category c INNER JOIN photo.photo p ON c.id = p.category_id LEFT OUTER JOIN photo.gps_override o ON p.id = o.photo_id WHERE COALESCE(p.gps_latitude, o.latitude) IS NULL OR COALESCE(p.gps_longitude, o.longitude) IS NULL GROUP BY c.id HAVING COUNT(1) > 0 ) SELECT c.id, c.year, c.name, c.create_date, c.gps_latitude AS latitude, c.gps_longitude AS longitude, c.photo_count, c.total_size_xs, c.total_size_xs_sq, c.total_size_sm, c.total_size_md, c.total_size_lg, c.total_size_prt, c.total_size_src, COALESCE(c.total_size_xs, 0) + COALESCE(c.total_size_xs_sq, 0) + COALESCE(c.total_size_sm, 0) + COALESCE(c.total_size_md, 0) + COALESCE(c.total_size_lg, 0) + COALESCE(c.total_size_prt, 0) + COALESCE(c.total_size_src, 0) AS total_size, c.teaser_photo_path, c.teaser_photo_height, c.teaser_photo_width, c.teaser_photo_size, c.teaser_photo_sq_path, c.teaser_photo_sq_height, c.teaser_photo_sq_width, c.teaser_photo_sq_size, CASE WHEN m.id IS NULL THEN FALSE ELSE TRUE END AS is_missing_gps_data FROM photo.category c LEFT OUTER JOIN missing_gps_categories m ON m.id = c.id WHERE (_allow_private OR c.is_private = FALSE) AND (_year IS NULL OR c.year = _year) AND (_id IS NULL OR c.id = _id) AND (_since_id IS NULL OR c.id > _since_id) ORDER BY c.id; $$; GRANT EXECUTE ON FUNCTION photo.get_categories TO website;
28.841584
74
0.615173
3923ce88882b388b86bbe9aa2e890b6089d784bb
264
py
Python
examples/print_type_info.py
josephmckenna/2021_June_IOP_CAPS_2021
d3c2e1d661d5fffa7233bf831b76ceccd2a69d63
[ "MIT" ]
null
null
null
examples/print_type_info.py
josephmckenna/2021_June_IOP_CAPS_2021
d3c2e1d661d5fffa7233bf831b76ceccd2a69d63
[ "MIT" ]
null
null
null
examples/print_type_info.py
josephmckenna/2021_June_IOP_CAPS_2021
d3c2e1d661d5fffa7233bf831b76ceccd2a69d63
[ "MIT" ]
null
null
null
import sys def PrintTypeInfoTitle(): print("Name\tBytes\tmin\tmax\n") def PrintTypeInfo(T): print((type(T).__name__) + "\t" + str(sys.getsizeof(T))) PrintTypeInfo(True) PrintTypeInfo('a') PrintTypeInfo(123) PrintTypeInfo(12345) PrintTypeInfo(2* 10**307)
20.307692
60
0.719697
4b856d7e96ae70293b35b9834d70ecd8f9fee9f8
21,225
sql
SQL
security-admin/db/sqlserver/patches/016-updated-schema-for-tag-based-policy.sql
lizhi16080910/ranger
23ab435f15a7e14cba45d47ecd6dbd5669421fd4
[ "Apache-2.0" ]
4
2019-04-20T03:35:03.000Z
2022-03-29T03:26:32.000Z
security-admin/db/sqlserver/patches/016-updated-schema-for-tag-based-policy.sql
lizhi16080910/ranger
23ab435f15a7e14cba45d47ecd6dbd5669421fd4
[ "Apache-2.0" ]
20
2018-10-17T19:48:21.000Z
2019-02-04T11:47:20.000Z
security-admin/db/sqlserver/patches/016-updated-schema-for-tag-based-policy.sql
lizhi16080910/ranger
23ab435f15a7e14cba45d47ecd6dbd5669421fd4
[ "Apache-2.0" ]
2
2018-01-23T21:46:29.000Z
2019-05-03T20:18:08.000Z
-- Licensed to the Apache Software Foundation (ASF) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- The ASF licenses this file to You under the Apache License, Version 2.0 -- (the "License"); you may not use this file except in compliance with -- the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. GO IF (OBJECT_ID('x_tag_def_FK_added_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_def] DROP CONSTRAINT x_tag_def_FK_added_by_id END GO IF (OBJECT_ID('x_tag_def_FK_upd_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_def] DROP CONSTRAINT x_tag_def_FK_upd_by_id END GO IF (OBJECT_ID('x_tag_FK_added_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag] DROP CONSTRAINT x_tag_FK_added_by_id END GO IF (OBJECT_ID('x_tag_FK_upd_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag] DROP CONSTRAINT x_tag_FK_upd_by_id END GO IF (OBJECT_ID('x_tag_FK_type') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag] DROP CONSTRAINT x_tag_FK_type END GO IF (OBJECT_ID('x_service_res_FK_service_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource] DROP CONSTRAINT x_service_res_FK_service_id END GO IF (OBJECT_ID('x_service_res_FK_added_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource] DROP CONSTRAINT x_service_res_FK_added_by_id END GO IF (OBJECT_ID('x_service_res_FK_upd_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource] DROP CONSTRAINT x_service_res_FK_upd_by_id END GO IF (OBJECT_ID('x_srvc_res_el_FK_res_def_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource_element] DROP CONSTRAINT x_srvc_res_el_FK_res_def_id END GO IF (OBJECT_ID('x_srvc_res_el_FK_res_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource_element] DROP CONSTRAINT x_srvc_res_el_FK_res_id END GO IF (OBJECT_ID('x_srvc_res_el_FK_added_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource_element] DROP CONSTRAINT x_srvc_res_el_FK_added_by_id END GO IF (OBJECT_ID('x_srvc_res_el_FK_upd_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource_element] DROP CONSTRAINT x_srvc_res_el_FK_upd_by_id END GO IF (OBJECT_ID('x_tag_attr_def_FK_tag_def_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_attr_def] DROP CONSTRAINT x_tag_attr_def_FK_tag_def_id END GO IF (OBJECT_ID('x_tag_attr_def_FK_added_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_attr_def] DROP CONSTRAINT x_tag_attr_def_FK_added_by_id END GO IF (OBJECT_ID('x_tag_attr_def_FK_upd_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_attr_def] DROP CONSTRAINT x_tag_attr_def_FK_upd_by_id END GO IF (OBJECT_ID('x_tag_attr_FK_tag_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_attr] DROP CONSTRAINT x_tag_attr_FK_tag_id END GO IF (OBJECT_ID('x_tag_attr_FK_added_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_attr] DROP CONSTRAINT x_tag_attr_FK_added_by_id END GO IF (OBJECT_ID('x_tag_attr_FK_upd_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_attr] DROP CONSTRAINT x_tag_attr_FK_upd_by_id END GO IF (OBJECT_ID('x_tag_res_map_FK_tag_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_resource_map] DROP CONSTRAINT x_tag_res_map_FK_tag_id END GO IF (OBJECT_ID('x_tag_attr_FK_tag_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_resource_map] DROP CONSTRAINT x_tag_res_map_FK_res_id END GO IF (OBJECT_ID('x_tag_res_map_FK_added_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_resource_map] DROP CONSTRAINT x_tag_res_map_FK_added_by_id END GO IF (OBJECT_ID('x_tag_res_map_FK_upd_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_tag_resource_map] DROP CONSTRAINT x_tag_res_map_FK_upd_by_id END GO IF (OBJECT_ID('x_srvc_res_el_val_FK_res_el_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource_element_val] DROP CONSTRAINT x_srvc_res_el_val_FK_res_el_id END GO IF (OBJECT_ID('x_srvc_res_el_val_FK_add_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource_element_val] DROP CONSTRAINT x_srvc_res_el_val_FK_add_by_id END GO IF (OBJECT_ID('x_srvc_res_el_val_FK_upd_by_id') IS NOT NULL) BEGIN ALTER TABLE [dbo].[x_service_resource_element_val] DROP CONSTRAINT x_srvc_res_el_val_FK_upd_by_id END GO IF (OBJECT_ID('x_service_resource_element_val') IS NOT NULL) BEGIN DROP TABLE [dbo].[x_service_resource_element_val] END GO IF (OBJECT_ID('x_tag_resource_map') IS NOT NULL) BEGIN DROP TABLE [dbo].[x_tag_resource_map] END GO IF (OBJECT_ID('x_tag_attr') IS NOT NULL) BEGIN DROP TABLE [dbo].[x_tag_attr] END GO IF (OBJECT_ID('x_tag_attr_def') IS NOT NULL) BEGIN DROP TABLE [dbo].[x_tag_attr_def] END GO IF (OBJECT_ID('x_service_resource_element') IS NOT NULL) BEGIN DROP TABLE [dbo].[x_service_resource_element] END GO IF (OBJECT_ID('x_service_resource') IS NOT NULL) BEGIN DROP TABLE [dbo].[x_service_resource] END GO IF (OBJECT_ID('x_tag') IS NOT NULL) BEGIN DROP TABLE [dbo].[x_tag] END GO IF (OBJECT_ID('x_tag_def') IS NOT NULL) BEGIN DROP TABLE [dbo].[x_tag_def] END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[x_tag_def]( [id] [bigint] IDENTITY(1,1) NOT NULL, [guid] [varchar](64) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [version] [bigint] DEFAULT NULL NULL, [name] [varchar](255) NOT NULL, [source] [varchar](128) DEFAULT NULL NULL, [is_enabled] [tinyint] DEFAULT 0 NOT NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [x_tag_def$x_tag_def_UK_guid] UNIQUE NONCLUSTERED ( [guid] ASC )WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [x_tag_def$x_tag_def_UK_name] UNIQUE NONCLUSTERED ( [name] ASC )WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[x_tag]( [id] [bigint] IDENTITY(1,1) NOT NULL, [guid] [varchar](64) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [version] [bigint] DEFAULT NULL NULL, [type] [bigint] NOT NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [x_tag$x_tag_UK_guid] UNIQUE NONCLUSTERED ( [guid] ASC )WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[x_service_resource]( [id] [bigint] IDENTITY(1,1) NOT NULL, [guid] [varchar](64) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [version] [bigint] DEFAULT NULL NULL, [service_id] [bigint] NOT NULL, [resource_signature] [varchar](128) DEFAULT NULL NULL, [is_enabled] [tinyint] DEFAULT 1 NOT NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [x_service_resource$x_service_res_UK_guid] UNIQUE NONCLUSTERED ( [guid] ASC )WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[x_service_resource_element]( [id] [bigint] IDENTITY(1,1) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [res_id] [bigint] NOT NULL, [res_def_id] [bigint] NOT NULL, [is_excludes] [tinyint] DEFAULT 0 NOT NULL, [is_recursive] [tinyint] DEFAULT 0 NOT NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[x_tag_attr_def]( [id] [bigint] IDENTITY(1,1) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [tag_def_id] [bigint] NOT NULL, [name] [varchar](255) NOT NULL, [type] [varchar](50) NOT NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[x_tag_attr]( [id] [bigint] IDENTITY(1,1) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [tag_id] [bigint] NOT NULL, [name] [varchar](255) NOT NULL, [value] [varchar](512) DEFAULT NULL NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[x_tag_resource_map]( [id] [bigint] IDENTITY(1,1) NOT NULL, [guid] [varchar](64) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [tag_id] [bigint] NOT NULL, [res_id] [bigint] NOT NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [x_tag_resource_map$x_tag_resource_map_UK_guid] UNIQUE NONCLUSTERED ( [guid] ASC )WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[x_service_resource_element_val]( [id] [bigint] IDENTITY(1,1) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [res_element_id] [bigint] NOT NULL, [value] [varchar](1024) NOT NULL, [sort_order] [tinyint] DEFAULT 0 NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[x_tag_def] WITH CHECK ADD CONSTRAINT [x_tag_def_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag_def] WITH CHECK ADD CONSTRAINT [x_tag_def_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag] WITH CHECK ADD CONSTRAINT [x_tag_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag] WITH CHECK ADD CONSTRAINT [x_tag_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag] WITH CHECK ADD CONSTRAINT [x_tag_FK_type] FOREIGN KEY([type]) REFERENCES [dbo].[x_tag_def] ([id]) GO ALTER TABLE [dbo].[x_service_resource] WITH CHECK ADD CONSTRAINT [x_service_res_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_service_resource] WITH CHECK ADD CONSTRAINT [x_service_res_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_service_resource] WITH CHECK ADD CONSTRAINT [x_service_res_FK_service_id] FOREIGN KEY([service_id]) REFERENCES [dbo].[x_service] ([id]) GO ALTER TABLE [dbo].[x_service_resource_element] WITH CHECK ADD CONSTRAINT [x_srvc_res_el_FK_res_def_id] FOREIGN KEY([res_def_id]) REFERENCES [dbo].[x_resource_def] ([id]) GO ALTER TABLE [dbo].[x_service_resource_element] WITH CHECK ADD CONSTRAINT [x_srvc_res_el_FK_res_id] FOREIGN KEY([res_id]) REFERENCES [dbo].[x_service_resource] ([id]) GO ALTER TABLE [dbo].[x_service_resource_element] WITH CHECK ADD CONSTRAINT [x_srvc_res_el_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_service_resource_element] WITH CHECK ADD CONSTRAINT [x_srvc_res_el_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag_attr_def] WITH CHECK ADD CONSTRAINT [x_tag_attr_def_FK_tag_def_id] FOREIGN KEY([tag_def_id]) REFERENCES [dbo].[x_tag_def] ([id]) GO ALTER TABLE [dbo].[x_tag_attr_def] WITH CHECK ADD CONSTRAINT [x_tag_attr_def_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag_attr_def] WITH CHECK ADD CONSTRAINT [x_tag_attr_def_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag_attr] WITH CHECK ADD CONSTRAINT [x_tag_attr_FK_tag_id] FOREIGN KEY([tag_id]) REFERENCES [dbo].[x_tag] ([id]) GO ALTER TABLE [dbo].[x_tag_attr] WITH CHECK ADD CONSTRAINT [x_tag_attr_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag_attr] WITH CHECK ADD CONSTRAINT [x_tag_attr_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag_resource_map] WITH CHECK ADD CONSTRAINT [x_tag_res_map_FK_tag_id] FOREIGN KEY([tag_id]) REFERENCES [dbo].[x_tag] ([id]) GO ALTER TABLE [dbo].[x_tag_resource_map] WITH CHECK ADD CONSTRAINT [x_tag_res_map_FK_res_id] FOREIGN KEY([res_id]) REFERENCES [dbo].[x_service_resource] ([id]) GO ALTER TABLE [dbo].[x_tag_resource_map] WITH CHECK ADD CONSTRAINT [x_tag_res_map_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_tag_resource_map] WITH CHECK ADD CONSTRAINT [x_tag_res_map_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_service_resource_element_val] WITH CHECK ADD CONSTRAINT [x_srvc_res_el_val_FK_res_el_id] FOREIGN KEY([res_element_id]) REFERENCES [dbo].[x_service_resource_element] ([id]) GO ALTER TABLE [dbo].[x_service_resource_element_val] WITH CHECK ADD CONSTRAINT [x_srvc_res_el_val_FK_add_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO ALTER TABLE [dbo].[x_service_resource_element_val] WITH CHECK ADD CONSTRAINT [x_srvc_res_el_val_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id]) GO INSERT INTO x_modules_master(create_time,update_time,added_by_id,upd_by_id,module,url) VALUES(CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,1,1,'Tag Based Policies',''); GO CREATE NONCLUSTERED INDEX [x_tag_def_IDX_added_by_id] ON [x_tag_def] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_def_IDX_upd_by_id] ON [x_tag_def] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_IDX_type] ON [x_tag] ( [type] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_IDX_added_by_id] ON [x_tag] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_IDX_upd_by_id] ON [x_tag] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_service_res_IDX_added_by_id] ON [x_service_resource] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_service_res_IDX_upd_by_id] ON [x_service_resource] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_srvc_res_el_IDX_added_by_id] ON [x_service_resource_element] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_srvc_res_el_IDX_upd_by_id] ON [x_service_resource_element] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_attr_def_IDX_tag_def_id] ON [x_tag_attr_def] ( [tag_def_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_attr_def_IDX_added_by_id] ON [x_tag_attr_def] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_attr_def_IDX_upd_by_id] ON [x_tag_attr_def] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_attr_IDX_tag_id] ON [x_tag_attr] ( [tag_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_attr_IDX_added_by_id] ON [x_tag_attr] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_attr_IDX_upd_by_id] ON [x_tag_attr] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_res_map_IDX_tag_id] ON [x_tag_resource_map] ( [tag_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_res_map_IDX_res_id] ON [x_tag_resource_map] ( [res_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_res_map_IDX_added_by_id] ON [x_tag_resource_map] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_tag_res_map_IDX_upd_by_id] ON [x_tag_resource_map] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_srvc_res_el_val_IDX_resel_id] ON [x_service_resource_element_val] ( [res_element_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_srvc_res_el_val_IDX_addby_id] ON [x_service_resource_element_val] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [x_srvc_res_el_val_IDX_updby_id] ON [x_service_resource_element_val] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 'x_service_def' and column_name = 'def_options') BEGIN ALTER TABLE [dbo].[x_service_def] ADD [def_options] [varchar](1024) DEFAULT NULL NULL; END GO IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 'x_policy_item' and column_name in('item_type','is_enabled','comments')) BEGIN ALTER TABLE [dbo].[x_policy_item] ADD [item_type] [int] DEFAULT 0 NOT NULL,[is_enabled] [tinyint] DEFAULT 1 NOT NULL,[comments] [varchar](255) DEFAULT NULL NULL; END GO IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 'x_service' and column_name in('tag_service','tag_version','tag_update_time')) BEGIN ALTER TABLE [dbo].[x_service] ADD [tag_service] [bigint] DEFAULT NULL NULL,[tag_version] [bigint] DEFAULT 0 NOT NULL,[tag_update_time] [datetime2] DEFAULT NULL NULL,CONSTRAINT [x_service_FK_tag_service] FOREIGN KEY([tag_service]) REFERENCES [dbo].[x_service] ([id]); END GO exit
36.785095
267
0.770789
c289376fe56ad4b5dfa6d6e30fa848e89aa3407d
543
h
C
BoostTest/Watch.h
SharpSnake/BoostTest
39452bdf0da5d1c0767d70521c2aa2e0863a2a9a
[ "MIT" ]
null
null
null
BoostTest/Watch.h
SharpSnake/BoostTest
39452bdf0da5d1c0767d70521c2aa2e0863a2a9a
[ "MIT" ]
null
null
null
BoostTest/Watch.h
SharpSnake/BoostTest
39452bdf0da5d1c0767d70521c2aa2e0863a2a9a
[ "MIT" ]
null
null
null
#ifndef WATCH_H #define WATCH_H #include <chrono> class MWatch { typedef std::chrono::high_resolution_clock clock_type; public: MWatch() noexcept { Tic(); } void Tic() noexcept { t1 = clock_type::now(); } template< typename Dura = std::chrono::milliseconds, typename Rep = double > auto Toc() noexcept { t2 = clock_type::now(); return std::chrono::duration_cast< std::chrono::duration< Rep, typename Dura::period > >( t2 - t1 ).count(); } private: clock_type::time_point t1; clock_type::time_point t2; }; #endif // !WATCH_H
20.111111
110
0.692449
f4c37bb290f0dfb147186f3b7b60e50aa4898255
3,439
tsx
TypeScript
src/pages/bigData/aiGrope/CityDynamic/useLeftLogicHook.tsx
liyujian3225/SZmediacube
2178d466af4966f244780b1077bb439f12836c75
[ "MIT" ]
null
null
null
src/pages/bigData/aiGrope/CityDynamic/useLeftLogicHook.tsx
liyujian3225/SZmediacube
2178d466af4966f244780b1077bb439f12836c75
[ "MIT" ]
null
null
null
src/pages/bigData/aiGrope/CityDynamic/useLeftLogicHook.tsx
liyujian3225/SZmediacube
2178d466af4966f244780b1077bb439f12836c75
[ "MIT" ]
null
null
null
import { useCallback, useEffect, useState } from 'react' import { usePage, useExtrackRes } from '@/utils/hook/business' import { queryShenzhenInformation, queryShenzhenTotalNews } from './server' function formatDate(date: any[]) { let obj if (Array.isArray(date)) { obj = date.map(item => item.format('YYYY-MM-DD')) } return obj } const useLeftLogicHook = (props) => { const { setLoad, tabCode, beginTime, endTime, defaultDistrict } = props const [data, setData] = useState([]) // 左侧数据 const [lPaneDate, setLPaneDate] = useState([beginTime, endTime]) // 左侧日期 const [pagination, setPagination, pageRef] = usePage() // 左侧列表分页 const [district, setDistrict] = useState(defaultDistrict) // 各区默认选中 const pagiReset = () => { setPagination({ curPage: 1, pageSize: pageRef.current.pageSize, total: 0 }) } const requestSzTotalNews = useCallback(async (params) => { setLoad(true) const response = await queryShenzhenTotalNews(params) const [data, pager] = useExtrackRes(response) data.length > 0 && setData(data) pageRef.current.total !== pager.total && setPagination({ ...pageRef.current, total: pager.total }) setLoad(false) }, []) // 拉取左侧列表数据 const requestSzInformations = useCallback(async (code, params?) => { setLoad(true) const response = await queryShenzhenInformation(code, params) const [data, pager] = useExtrackRes(response) data.length > 0 && setData(data) pageRef.current.total !== pager.total && setPagination({ ...pageRef.current, total: pager.total }) setLoad(false) }, []) // 左列表分页切换~~~~ const handlePagiChange = useCallback((curPage, pageSize) => { setData([]) setPagination({ ...pageRef.current, pageSize, curPage }) }, [tabCode]) // 左侧列表日期切换~~~ const handleLeftPaneDateChange = useCallback((date) => { setData([]) pagiReset() setLPaneDate(date) }, []) // 区域切换 const handleDistrictTagChange = useCallback((item) => { pagiReset() setData([]) setDistrict(item) }, []) useEffect(() => { const { type } = district if (data.length === 0 && tabCode) { const [beginTime, endTime] = formatDate(lPaneDate) if (tabCode.name === '全部') { requestSzTotalNews({ area: '001013013', page: pagination.curPage, limit: pagination.pageSize, beginTime, endTime, }) } else { requestSzInformations(tabCode.code, { page: pagination.curPage, limit: pagination.pageSize, beginTime, endTime, area: tabCode.code === 'regionNews' ? type : '' }) } } }, [data, tabCode, district, pagination, lPaneDate]) return { district, lPaneDate, leftData: data, setLeftData: setData, pagination, pagiReset, handleDistrictTagChange, handlePagiChange, handleLeftPaneDateChange, } } export default useLeftLogicHook
30.166667
76
0.544635
2c9e250ef4f241eb48bdbaea5a8fa09f53924a8e
1,214
py
Python
cli.py
gconnell/knocker
823d3706953e2ced060f7aa2087a468514ccdb50
[ "Apache-2.0" ]
4
2015-01-15T00:25:33.000Z
2021-07-19T21:34:03.000Z
cli.py
gconnell/knocker
823d3706953e2ced060f7aa2087a468514ccdb50
[ "Apache-2.0" ]
null
null
null
cli.py
gconnell/knocker
823d3706953e2ced060f7aa2087a468514ccdb50
[ "Apache-2.0" ]
2
2015-11-01T02:15:04.000Z
2016-05-30T16:54:45.000Z
#!/usr/bin/python # # Copyright 2012 Graeme Connell # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import getpass import hashlib import os import socket import struct import sys import time def main(): try: host = sys.argv[1] except IndexError: print 'Usage: %s <hostname>' % sys.argv[0] return t = int(time.time()) t -= t % 60 hasher = hashlib.sha1() hasher.update(getpass.getpass('Knocker secret').strip()) hasher.update(struct.pack('>i', t)) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) print hasher.hexdigest() s.sendto(hasher.hexdigest(), (host, 7777)) time.sleep(0.25) os.execlp('/usr/bin/ssh', 'ssh', host, *sys.argv[2:]) if __name__ == '__main__': main()
26.391304
74
0.709226
cfbbe92619beb46733659503ddaecabca2e37cca
538
sh
Shell
Docker/__test_run_Singularity.sh
ycl6/STAR-Fusion
0439b3105c66a95f4cd19525f0377da67abf8ed9
[ "BSD-3-Clause" ]
172
2015-04-13T18:27:25.000Z
2022-03-31T05:39:13.000Z
Docker/__test_run_Singularity.sh
ycl6/STAR-Fusion
0439b3105c66a95f4cd19525f0377da67abf8ed9
[ "BSD-3-Clause" ]
300
2015-04-23T04:24:08.000Z
2022-03-16T21:51:56.000Z
Docker/__test_run_Singularity.sh
ycl6/STAR-Fusion
0439b3105c66a95f4cd19525f0377da67abf8ed9
[ "BSD-3-Clause" ]
80
2015-07-14T15:39:32.000Z
2022-03-23T09:11:49.000Z
#!/bin/bash set -ve if [ -z ${CTAT_GENOME_LIB} ]; then echo "Error, must have CTAT_GENOME_LIB env var set" exit 1 fi VERSION=`cat VERSION.txt` # run STAR-Fusion cd ../ && singularity exec -e -B ${CTAT_GENOME_LIB}:/ctat_genome_lib Docker/star-fusion.v${VERSION}.simg /usr/local/src/STAR-Fusion/STAR-Fusion --left_fq testing/reads_1.fq.gz --right_fq testing/reads_2.fq.gz --genome_lib_dir /ctat_genome_lib -O testing/test_singularity_outdir/StarFusionOut --FusionInspector inspect --examine_coding_effect --denovo_reconstruct
35.866667
363
0.758364
5340c5fee4ff1fb245521acb90cd6f29f37984c4
1,104
html
HTML
_includes/footer.html
godaddy/gasket-blog
85b80bef6eeb0be3b9e645880bcffdfdea185f33
[ "X11", "MIT" ]
null
null
null
_includes/footer.html
godaddy/gasket-blog
85b80bef6eeb0be3b9e645880bcffdfdea185f33
[ "X11", "MIT" ]
null
null
null
_includes/footer.html
godaddy/gasket-blog
85b80bef6eeb0be3b9e645880bcffdfdea185f33
[ "X11", "MIT" ]
null
null
null
<footer> <article> <div class="footer-links"> <h4>Docs</h4> <a href="/#/docs/quick-start">Get Started</a> <a href="/#/README">Overview</a> <a href="/#/README?id=guides">Guides</a> </div> <div class="footer-links"> <h4>Channel</h4> <a target="_blank" href="https://godaddy-oss-slack.herokuapp.com">Slack</a> <!-- <a target="_blank" href="https://twitter.com/gasketjs">Twitter</a>--> <a target="_blank" href="https://stackoverflow.com/questions/tagged/gasket">Stack Overflow</a> </div> <div class="footer-links"> <h4>Contribute</h4> <a href="htts://gasket.dev/#/CONTRIBUTING">Guidelines</a> <a target="_blank" href="https://github.com/godaddy/gasket/">Github</a> </div> <div class="footer-copyright"> <a target="_blank" href="https://www.godaddy.com/engineering/"> <div class="godaddy-open-source"> GODADDY OPEN SOURCE </div> </a> <span class="godaddy-copyright"> Copyright (c) 2020 GoDaddy Operating Company, LLC. </span> </div> </article> </footer>
35.612903
100
0.594203
1abd21b725a2067bbeeb7d4d62b7b3c11490499c
7,180
py
Python
models/education_class.py
MIchaelMainer/msgraph-v10-models-python
adad66363ebe151be2332f3ef74a664584385748
[ "MIT" ]
1
2021-03-07T07:02:22.000Z
2021-03-07T07:02:22.000Z
models/education_class.py
MIchaelMainer/msgraph-v10-models-python
adad66363ebe151be2332f3ef74a664584385748
[ "MIT" ]
null
null
null
models/education_class.py
MIchaelMainer/msgraph-v10-models-python
adad66363ebe151be2332f3ef74a664584385748
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- ''' # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # # This file was generated and any changes will be overwritten. ''' from __future__ import unicode_literals from ..model.identity_set import IdentitySet from ..model.education_external_source import EducationExternalSource from ..model.education_term import EducationTerm from ..model.education_school import EducationSchool from ..model.education_user import EducationUser from ..model.group import Group from ..one_drive_object_base import OneDriveObjectBase class EducationClass(OneDriveObjectBase): def __init__(self, prop_dict={}): self._prop_dict = prop_dict @property def display_name(self): """ Gets and sets the displayName Returns: str: The displayName """ if "displayName" in self._prop_dict: return self._prop_dict["displayName"] else: return None @display_name.setter def display_name(self, val): self._prop_dict["displayName"] = val @property def mail_nickname(self): """ Gets and sets the mailNickname Returns: str: The mailNickname """ if "mailNickname" in self._prop_dict: return self._prop_dict["mailNickname"] else: return None @mail_nickname.setter def mail_nickname(self, val): self._prop_dict["mailNickname"] = val @property def description(self): """ Gets and sets the description Returns: str: The description """ if "description" in self._prop_dict: return self._prop_dict["description"] else: return None @description.setter def description(self, val): self._prop_dict["description"] = val @property def created_by(self): """ Gets and sets the createdBy Returns: :class:`IdentitySet<onedrivesdk.model.identity_set.IdentitySet>`: The createdBy """ if "createdBy" in self._prop_dict: if isinstance(self._prop_dict["createdBy"], OneDriveObjectBase): return self._prop_dict["createdBy"] else : self._prop_dict["createdBy"] = IdentitySet(self._prop_dict["createdBy"]) return self._prop_dict["createdBy"] return None @created_by.setter def created_by(self, val): self._prop_dict["createdBy"] = val @property def class_code(self): """ Gets and sets the classCode Returns: str: The classCode """ if "classCode" in self._prop_dict: return self._prop_dict["classCode"] else: return None @class_code.setter def class_code(self, val): self._prop_dict["classCode"] = val @property def external_name(self): """ Gets and sets the externalName Returns: str: The externalName """ if "externalName" in self._prop_dict: return self._prop_dict["externalName"] else: return None @external_name.setter def external_name(self, val): self._prop_dict["externalName"] = val @property def external_id(self): """ Gets and sets the externalId Returns: str: The externalId """ if "externalId" in self._prop_dict: return self._prop_dict["externalId"] else: return None @external_id.setter def external_id(self, val): self._prop_dict["externalId"] = val @property def external_source(self): """ Gets and sets the externalSource Returns: :class:`EducationExternalSource<onedrivesdk.model.education_external_source.EducationExternalSource>`: The externalSource """ if "externalSource" in self._prop_dict: if isinstance(self._prop_dict["externalSource"], OneDriveObjectBase): return self._prop_dict["externalSource"] else : self._prop_dict["externalSource"] = EducationExternalSource(self._prop_dict["externalSource"]) return self._prop_dict["externalSource"] return None @external_source.setter def external_source(self, val): self._prop_dict["externalSource"] = val @property def term(self): """ Gets and sets the term Returns: :class:`EducationTerm<onedrivesdk.model.education_term.EducationTerm>`: The term """ if "term" in self._prop_dict: if isinstance(self._prop_dict["term"], OneDriveObjectBase): return self._prop_dict["term"] else : self._prop_dict["term"] = EducationTerm(self._prop_dict["term"]) return self._prop_dict["term"] return None @term.setter def term(self, val): self._prop_dict["term"] = val @property def schools(self): """Gets and sets the schools Returns: :class:`SchoolsCollectionPage<onedrivesdk.request.schools_collection.SchoolsCollectionPage>`: The schools """ if "schools" in self._prop_dict: return SchoolsCollectionPage(self._prop_dict["schools"]) else: return None @property def members(self): """Gets and sets the members Returns: :class:`MembersCollectionPage<onedrivesdk.request.members_collection.MembersCollectionPage>`: The members """ if "members" in self._prop_dict: return MembersCollectionPage(self._prop_dict["members"]) else: return None @property def teachers(self): """Gets and sets the teachers Returns: :class:`TeachersCollectionPage<onedrivesdk.request.teachers_collection.TeachersCollectionPage>`: The teachers """ if "teachers" in self._prop_dict: return TeachersCollectionPage(self._prop_dict["teachers"]) else: return None @property def group(self): """ Gets and sets the group Returns: :class:`Group<onedrivesdk.model.group.Group>`: The group """ if "group" in self._prop_dict: if isinstance(self._prop_dict["group"], OneDriveObjectBase): return self._prop_dict["group"] else : self._prop_dict["group"] = Group(self._prop_dict["group"]) return self._prop_dict["group"] return None @group.setter def group(self, val): self._prop_dict["group"] = val
27.829457
151
0.578134
b94fcc1016efed435684bb35704fe55507361ac5
421
css
CSS
src/_styles/Chart.css
guzmonne/conapps-charts
b4f21920ca54200c9aebf93e79d73080df228bf7
[ "MIT" ]
null
null
null
src/_styles/Chart.css
guzmonne/conapps-charts
b4f21920ca54200c9aebf93e79d73080df228bf7
[ "MIT" ]
null
null
null
src/_styles/Chart.css
guzmonne/conapps-charts
b4f21920ca54200c9aebf93e79d73080df228bf7
[ "MIT" ]
null
null
null
.ChartContainer { position: relative; } g.xAxis g.tick text { text-anchor: end; transform: rotate(-45deg) translate(-1em); } g.Rects rect { /*fill: #5B5F97;*/ opacity: 0.6; } g.Rects rect:hover { opacity: 0.8; stroke: whitesmoke; stroke-width: 0.5px; } g.xGrid line, g.yGrid line { stroke: lightgrey; stroke-opacity: 0.7; stroke-width: 0.5px; } g.xGrid path, g.yGrid path { stroke-width: 0; }
13.580645
44
0.643705
7fa771c4fb932c65aa3eeabd87945256eb87b74d
301
php
PHP
module/POS/src/POS/V1/Rest/InkooporderRegel/InkooporderRegelResourceFactory.php
Profilan/apibasiclabel
34bd07b16964bb33ae2da2efa46795dee4327a70
[ "BSD-3-Clause" ]
null
null
null
module/POS/src/POS/V1/Rest/InkooporderRegel/InkooporderRegelResourceFactory.php
Profilan/apibasiclabel
34bd07b16964bb33ae2da2efa46795dee4327a70
[ "BSD-3-Clause" ]
null
null
null
module/POS/src/POS/V1/Rest/InkooporderRegel/InkooporderRegelResourceFactory.php
Profilan/apibasiclabel
34bd07b16964bb33ae2da2efa46795dee4327a70
[ "BSD-3-Clause" ]
null
null
null
<?php namespace POS\V1\Rest\InkooporderRegel; class InkooporderRegelResourceFactory { public function __invoke($services) { $resource = new InkooporderRegelResource(); $resource->setMapper($services->get('InkooporderRegel\Mapper')); return $resource; } }
21.5
72
0.671096
daa28774faee62116d3f5ee5c78db340bfc65839
887
php
PHP
resources/views/view_fonts/index.blade.php
withlovee/f0nt
727994ee61771d56d5b0717bbb8ca1188d69569a
[ "MIT" ]
null
null
null
resources/views/view_fonts/index.blade.php
withlovee/f0nt
727994ee61771d56d5b0717bbb8ca1188d69569a
[ "MIT" ]
null
null
null
resources/views/view_fonts/index.blade.php
withlovee/f0nt
727994ee61771d56d5b0717bbb8ca1188d69569a
[ "MIT" ]
null
null
null
@extends('app') @section('content') <div class="container"> <div id="app"></div> <div id="url" class="hidex">{{ action('ViewFontController@index') }}</div> </div> @endsection @section('js-components') <script type="text/jsx;harmony=true" src="{{ asset('js/components/Font.js') }}"></script> <script type="text/jsx;harmony=true" src="{{ asset('js/components/FontStyles.js') }}"></script> <script type="text/jsx;harmony=true" src="{{ asset('js/components/WebFontModal.js') }}"></script> <script type="text/jsx;harmony=true" src="{{ asset('js/components/DescriptionModal.js') }}"></script> <script type="text/jsx;harmony=true" src="{{ asset('js/components/FontList.js') }}"></script> <script type="text/jsx;harmony=true" src="{{ asset('js/components/FontCategory.js') }}"></script> <script type="text/jsx;harmony=true" src="{{ asset('js/components/FontApp.js') }}"></script> @endsection
49.277778
101
0.682074
da6c85b39af06c830a6a8bee0d481a865a43717f
4,321
php
PHP
inc/Login.class.php
s3inlc/cineast-evaluator
dae36023e74d2ab3ce4266fa552544f962ed8826
[ "MIT" ]
2
2017-05-13T12:30:52.000Z
2017-05-30T13:52:01.000Z
inc/Login.class.php
s3inlc/cineast-evaluator
dae36023e74d2ab3ce4266fa552544f962ed8826
[ "MIT" ]
14
2017-05-12T08:49:26.000Z
2017-08-14T11:27:23.000Z
inc/Login.class.php
s3inlc/cineast-evaluator
dae36023e74d2ab3ce4266fa552544f962ed8826
[ "MIT" ]
1
2020-03-19T02:11:22.000Z
2020-03-19T02:11:22.000Z
<?php use DBA\QueryFilter; use DBA\Session; use DBA\User; /** * Handles the login sessions * * @author Sein */ class Login { private $user = null; private $valid = false; private $session = null; /** * Creates a Login-Instance and checks automatically if there is a session * running. It updates the session lifetime again up to the session limit. */ public function __construct() { global $FACTORIES; $this->user = null; $this->session = null; $this->valid = false; if (isset($_COOKIE['session'])) { $session = $_COOKIE['session']; $filter1 = new QueryFilter(Session::SESSION_KEY, $session, "="); $filter2 = new QueryFilter(Session::IS_OPEN, "1", "="); $filter3 = new QueryFilter(Session::LAST_ACTION_DATE, time() - 10000, ">"); $check = $FACTORIES::getSessionFactory()->filter(array($FACTORIES::FILTER => array($filter1, $filter2, $filter3))); if ($check === null || sizeof($check) == 0) { setcookie("session", "", time() - 600); //delete invalid or old cookie return; } $s = $check[0]; $this->user = $FACTORIES::getUserFactory()->get($s->getUserId()); if ($this->user !== null) { if ($s->getLastActionDate() < time() - $this->user->getSessionLifetime()) { setcookie("session", "", time() - 600); //delete invalid or old cookie return; } $this->valid = true; $this->session = $s; $s->setLastActionDate(time()); $FACTORIES::getSessionFactory()->update($s); setcookie("session", $s->getSessionKey(), time() + $this->user->getSessionLifetime()); } } } /** * This is a very dirty hack to allow importing of queries from commandline and just provide the username there * * @param $user User */ public function overrideUser($user) { $this->valid = true; $this->user = $user; } /** * Returns true if the user currently is loggedin with a valid session */ public function isLoggedin() { return $this->valid; } /** * Logs the current user out and closes his session */ public function logout() { global $FACTORIES; $this->session->setIsOpen(0); $FACTORIES::getSessionFactory()->update($this->session); setcookie("session", "", time() - 600); $this->session = null; $this->valid = false; $this->user = null; } /** * Returns the uID of the currently logged in user, if the user is not logged * in, the uID will be -1 */ public function getUserID() { if (!$this->isLoggedin()) { return -1; } return $this->user->getId(); } public function getUser() { if (!$this->isLoggedin()) { return null; } return $this->user; } /** * Executes a login with given username and password (plain) * * @param string $username username of the user to be logged in * @param string $password password which was entered on login form * @return true on success and false on failure */ public function login($username, $password) { global $FACTORIES; if ($this->valid == true) { return false; } $filter = new QueryFilter(User::USERNAME, $username, "="); $check = $FACTORIES::getUserFactory()->filter(array($FACTORIES::FILTER => array($filter))); if ($check === null || sizeof($check) == 0) { return false; } $user = $check[0]; if ($user->getIsValid() != 1) { return false; } else if (!Encryption::passwordVerify($password, $user->getPasswordSalt(), $user->getPasswordHash())) { return false; } $this->user = $user; $startTime = time(); $s = new Session(0, $this->user->getId(), $startTime, $startTime, 1, $this->user->getSessionLifetime(), ""); $s = $FACTORIES::getSessionFactory()->save($s); if ($s === null) { return false; } $sessionKey = Encryption::sessionHash($s->getId(), $startTime, $user->getEmail()); $s->setSessionKey($sessionKey); $FACTORIES::getSessionFactory()->update($s); $this->user->setLastLoginDate(time()); $FACTORIES::getUserFactory()->update($this->user); $this->valid = true; setcookie("session", "$sessionKey", time() + $this->user->getSessionLifetime()); return true; } }
29
121
0.59315
0a4edfeaa2ac7105e66860ebfb5bef708fee76a4
2,885
cs
C#
src/WowChat.DAL/MSSQLAide.cs
yiyungent/WowChat
4e0e6067653ac8bb1367f6e0663b040107dd41c7
[ "MIT" ]
null
null
null
src/WowChat.DAL/MSSQLAide.cs
yiyungent/WowChat
4e0e6067653ac8bb1367f6e0663b040107dd41c7
[ "MIT" ]
null
null
null
src/WowChat.DAL/MSSQLAide.cs
yiyungent/WowChat
4e0e6067653ac8bb1367f6e0663b040107dd41c7
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using System.Data.SqlClient; using System.Configuration; namespace WowChat.DAL { public class MSSQLAide { private static readonly string conStr = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString; #region 执行非查询 public static int ExecuteNonQuery(string sql, params SqlParameter[] parameters) { using (SqlConnection conn = new SqlConnection(conStr)) { conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = sql; cmd.Parameters.AddRange(parameters); return cmd.ExecuteNonQuery(); } } #endregion #region 查询 /// <summary> /// 参数化SQL查询语句 /// </summary> /// <param name="sql"></param> /// <param name="parms"></param> /// <returns></returns> public static DataTable Query(string sql, params SqlParameter[] parms) { DataTable dt = new DataTable(); using (SqlConnection conn = new SqlConnection(conStr)) { SqlCommand cmd = new SqlCommand(sql, conn); foreach (SqlParameter p in parms) { cmd.Parameters.Add(new SqlParameter { ParameterName = p.ParameterName, SqlDbType = p.SqlDbType, Value = p.Value }); } SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(dt); return dt; } } #endregion #region 执行指定存储过程 /// <summary> /// 执行指定存储过程 /// </summary> /// <param name="procName">存储过程名</param> /// <param name="parms">参数</param> /// <returns></returns> public static DataTable ExecProc(string procName, IDataParameter[] parms) { DataTable dt = new DataTable(); using (SqlConnection conn = new SqlConnection(conStr)) { SqlCommand cmd = new SqlCommand(procName, conn); cmd.CommandType = CommandType.StoredProcedure; foreach (SqlParameter p in parms) { cmd.Parameters.Add(new SqlParameter { ParameterName = p.ParameterName, SqlDbType = p.SqlDbType, Value = p.Value }); } SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(dt); return dt; } } #endregion } }
32.055556
115
0.501906
25a43266bf6dca257fe6cf8c22518bf72dbb4e9c
2,110
cs
C#
ErrorCode/PaddingBinding.cs
StevenThuriot/ErrorCode
849e4223f92943bf29045fd0d9699bde37378714
[ "MIT" ]
1
2016-10-30T21:26:23.000Z
2016-10-30T21:26:23.000Z
ErrorCode/PaddingBinding.cs
StevenThuriot/ErrorCode
849e4223f92943bf29045fd0d9699bde37378714
[ "MIT" ]
null
null
null
ErrorCode/PaddingBinding.cs
StevenThuriot/ErrorCode
849e4223f92943bf29045fd0d9699bde37378714
[ "MIT" ]
null
null
null
using System; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Markup; namespace ErrorCode { public class PaddingBinding : MarkupExtension { public override sealed object ProvideValue(IServiceProvider serviceProvider) { var target = (IProvideValueTarget)serviceProvider.GetService(typeof(IProvideValueTarget)); //The markup expression is evaluated when it is encountered by the XAML parser : // in that case, when the template is parsed. But at this time, // the control is not created yet, so the ProvideValue method can’t access it... //When a markup extension is evaluated inside a template, //the TargetObject is actually an instance of System.Windows.SharedDp, an internal WPF class. //For the markup extension to be able to access its target, //it has to be evaluated when the template is applied : we need to defer its evaluation until this time. //It’s actually pretty simple, we just need to return the markup extension itself from ProvideValue: //this way, it will be evaluated again when the actual target control is created. // http://www.thomaslevesque.com/2009/08/23/wpf-markup-extensions-and-templates/ if (target == null || target.TargetObject.GetType().FullName == "System.Windows.SharedDp") return this; //Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContentPresenter}, AncestorLevel=2}, Path=ActualWidth, Mode=OneWay, Converter={err:PaddingConverter}, ConverterParameter=-25 var binding = new Binding("ActualWidth") { Mode = BindingMode.OneWay, RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(ContentPresenter), 2), Converter = new PaddingConverter(), ConverterParameter = -25 }; return binding.ProvideValue(serviceProvider); } } }
44.893617
217
0.665403
a32f9b96ad29e295f9c1701b0db19ef2b6380b8c
2,815
java
Java
sp2-security-jwt/src/main/java/com/zgy/learn/springsecurity/config/SecurityHandlerConfig.java
prayjourney/boot-mybatis-mbplus-shiro-es-quartz
e8e1f2de53e3486344871e32c17102a6c3b8f3b3
[ "BSD-3-Clause" ]
6
2020-10-21T02:37:49.000Z
2021-12-05T13:08:48.000Z
sp2-security-jwt/src/main/java/com/zgy/learn/springsecurity/config/SecurityHandlerConfig.java
prayjourney/boot-mybatis-mbplus-shiro-es-quartz
e8e1f2de53e3486344871e32c17102a6c3b8f3b3
[ "BSD-3-Clause" ]
4
2020-08-18T07:12:47.000Z
2021-02-23T14:12:14.000Z
sp2-security-jwt/src/main/java/com/zgy/learn/springsecurity/config/SecurityHandlerConfig.java
prayjourney/boot-mybatis-mbplus-shiro-es-quartz
e8e1f2de53e3486344871e32c17102a6c3b8f3b3
[ "BSD-3-Clause" ]
5
2020-10-21T02:37:53.000Z
2021-05-09T04:23:30.000Z
package com.zgy.learn.springsecurity.config; import com.zgy.learn.springsecurity.utils.JwtTokenUtil; import com.zgy.learn.springsecurity.utils.ResponseUtil; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; /** * @author: pray-journey.io * @date: 2021/2/26 * @despcription: 配置Security之中要使用的filter的Config, 提供各种filter的bean */ @Configuration public class SecurityHandlerConfig { /** * 登陆成功,返回Token */ @Bean public AuthenticationSuccessHandler loginSuccessHandler() { return new AuthenticationSuccessHandler() { @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities(); List<String> authoritiesList = authorities.stream().map(authority -> authority.toString()). collect(Collectors.toList()); // 创建token String jwtToken = JwtTokenUtil.createToken(authentication.getName(), authoritiesList); ResponseUtil.responseJson(response, HttpStatus.OK.value(), jwtToken); } }; } /** * 登陆失败 */ @Bean public AuthenticationFailureHandler loginFailureHandler() { return (request, response, exception) -> { String msg = null; if (exception instanceof BadCredentialsException) { msg = "密码错误"; } else { msg = exception.getMessage(); } ResponseUtil.responseJson(response, HttpStatus.UNAUTHORIZED.value(), msg); }; } /** * 未登录,返回401 */ @Bean public AuthenticationEntryPoint authenticationEntryPoint() { return (request, response, authException) -> ResponseUtil.responseJson(response, HttpStatus.UNAUTHORIZED.value(), "请先登录"); } }
37.039474
117
0.697691
2d4522b24eb0144ca150d80ffece1e680711fd5e
1,701
css
CSS
src/containers/Toolbar.module.css
Krad23/petmate
29cafeec8087fd46180012bd75d95a807fc4ea1d
[ "MIT" ]
147
2018-07-30T14:32:07.000Z
2022-02-22T03:24:46.000Z
src/containers/Toolbar.module.css
Krad23/petmate
29cafeec8087fd46180012bd75d95a807fc4ea1d
[ "MIT" ]
206
2018-07-25T19:07:29.000Z
2022-01-26T22:46:55.000Z
src/containers/Toolbar.module.css
Krad23/petmate
29cafeec8087fd46180012bd75d95a807fc4ea1d
[ "MIT" ]
15
2018-08-02T19:36:04.000Z
2021-11-06T19:26:10.000Z
.toolbar { display: flex; flex-direction: column; align-items: center; padding-top: 10px; height: 100%; } .end { margin-top: auto; margin-bottom: 20px; } .tooltip { color: rgb(173,173,173); position: relative; display: inline-block; display: flex; justify-content: center; width: 80%; border-width: 1px; border-style: solid; border-color: rgba(0,0,0,0); /* invisible border */ } /* Tooltip text */ .tooltip .tooltiptext { visibility: hidden; width: 120px; background-color: #111; color: #fff; text-align: center; padding: 5px 0; border-radius: 6px; /* Position the tooltip text - see examples below! */ position: absolute; top: 7px; left: 50px; z-index: 1; filter: drop-shadow(2.5px 2.5px 1.5px rgba(0,0,0,0.5)); } .tooltip:hover .tooltiptext { visibility: visible; } /* for icon text */ .tooltip:hover { color: rgb(255,255,255); } .tooltip .colorpicker { position: absolute; top: 15px; left: 48px; z-index: 1; } .icon { padding-top: 7px; padding-bottom: 7px; font-size: 25px; } .tooltip.selectedTool { border-style: solid; border-width: 1px; border-color: rgba(255,255,255,0.4); } .fadeOut { animation-name: fadeout; animation-duration: 0.25s; animation-fill-mode: forwards; animation-delay: 0.25s; animation-timing-function: ease-in; } .canvasFitSelectButton { margin-top: 3px; padding-top: 1px; padding-bottom: 1px; padding-left: 2px; padding-right: 2px; color: var(--main-text-color); cursor: default; } .canvasFitSelectButton:hover { color: rgb(255,255,255); } @keyframes fadeout { 0% { opacity: 1; } 100% { opacity: 0; } }
16.04717
57
0.636096
b56dc832bc83da7bc93b0596c6f05c69265382ab
1,853
rb
Ruby
app/models/caching_simple_datastream.rb
cwant/avalon
b77e0d49ee410b51c97abfe9d1b343a28e53a158
[ "Apache-2.0" ]
1
2018-05-01T22:38:14.000Z
2018-05-01T22:38:14.000Z
app/models/caching_simple_datastream.rb
cwant/avalon
b77e0d49ee410b51c97abfe9d1b343a28e53a158
[ "Apache-2.0" ]
null
null
null
app/models/caching_simple_datastream.rb
cwant/avalon
b77e0d49ee410b51c97abfe9d1b343a28e53a158
[ "Apache-2.0" ]
1
2016-04-21T18:45:30.000Z
2016-04-21T18:45:30.000Z
# Copyright 2011-2015, The Trustees of Indiana University and Northwestern # University. Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR # CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. # --- END LICENSE_HEADER BLOCK --- class CachingSimpleDatastream class FieldError < Exception; end class FieldCollector attr :fields def field(name, type) @fields ||= {} fields[name] = type end end def self.create(klass) cache_class = Class.new(ActiveFedora::SimpleDatastream) do class_attribute :owner_class def self.defined_attributes(ds) @defined_attributes ||= {} if @defined_attributes[ds].nil? fc = FieldCollector.new self.owner_class.ds_specs[ds][:block].call(fc) @defined_attributes[ds] = fc.fields end @defined_attributes[ds] end def self.type(field) field_def = self.owner_class.defined_attributes[field.to_s] raise FieldError, "Unknown field `#{field}` for #{self.owner_class.name}" if field_def.nil? self.defined_attributes(field_def.dsid)[field.to_sym] end def primary_solr_name(field) ActiveFedora::SolrService.solr_name(field, type: self.type(field)) end def type(field) self.class.type(field) end end cache_class.owner_class = klass cache_class end end
31.948276
99
0.67674
a435523a3ca1bb46c8ea731e7bfbf16f4688c486
6,079
php
PHP
database/migrations/2019_06_16_092835_create_banks_table.php
mehran-mrn/ashraf_new
40b48b625b0fbb34213ea41f18c7050f5734b0f8
[ "MIT" ]
null
null
null
database/migrations/2019_06_16_092835_create_banks_table.php
mehran-mrn/ashraf_new
40b48b625b0fbb34213ea41f18c7050f5734b0f8
[ "MIT" ]
4
2019-11-06T13:41:59.000Z
2022-02-18T02:43:56.000Z
database/migrations/2019_06_16_092835_create_banks_table.php
mehran-mrn/ashraf_new
40b48b625b0fbb34213ea41f18c7050f5734b0f8
[ "MIT" ]
null
null
null
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateBanksTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('banks', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->integer('card_number')->nullable(); $table->string('logo')->nullable(); $table->softDeletes(); $table->timestamps(); }); $data = array( array('name' => trim('بانک اقتصاد نوین'), 'card_number' => '627412','logo'=>'<i class="ibl64 ibl-en"></i>'), array('name' => trim('بانک انصار'), 'card_number' => '627381','logo'=>'<i class="ibl64 ibl-ansar"></i>'), array('name' => trim('بانک ایران زمین'), 'card_number' => '505785','logo'=>'<i class="ibl64 ibl-iz"></i>'), array('name' => trim('بانک پارسیان'), 'card_number' => '622106','logo'=>'<i class="ibl64 ibl-parsian"></i>'), array('name' => trim('بانک پارسیان'), 'card_number' => '639194','logo'=>'<i class="ibl64 ibl-parsian"></i>'), array('name' => trim('بانک پارسیان'), 'card_number' => '627884','logo'=>'<i class="ibl64 ibl-parsian"></i>'), array('name' => trim('بانک پاسارگاد'), 'card_number' => '639347','logo'=>'<i class="ibl64 ibl-bpi"></i>'), array('name' => trim('بانک پاسارگاد'), 'card_number' => '502229','logo'=>'<i class="ibl64 ibl-bpi"></i>'), array('name' => trim('بانک تات'), 'card_number' => '636214','logo'=>''), array('name' => trim('بانک تجارت'), 'card_number' => '627353','logo'=>'<i class="ibl64 ibl-tejarat"></i>'), array('name' => trim('بانک توسعه تعاون'), 'card_number' => '502908','logo'=>'<i class="ibl64 ibl-edbi"></i>'), array('name' => trim('بانک توسعه صادرات ایران'), 'card_number' => '627648','logo'=>'<i class="ibl64 ibl-edbi"></i>'), array('name' => trim('بانک توسعه صادرات ایران'), 'card_number' => '207177','logo'=>'<i class="ibl64 ibl-edbi"></i>'), array('name' => trim('بانک حکمت ایرانیان'), 'card_number' => '636949','logo'=>'<i class="ibl64 ibl-hi"></i>'), array('name' => trim('بانک دی'), 'card_number' => '502938','logo'=>'<i class="ibl64 ibl-day"></i>'), array('name' => trim('بانک رفاه کارگران'), 'card_number' => '589463','logo'=>'<i class="ibl64 ibl-rb"></i>'), array('name' => trim('بانک سامان'), 'card_number' => '621986','logo'=>'<i class="ibl64 ibl-sb"></i>'), array('name' => trim('بانک سپه'), 'card_number' => '589210','logo'=>'<i class="ibl64 ibl-sepah"></i>'), array('name' => trim('بانک سرمایه'), 'card_number' => '639607','logo'=>'<i class="ibl64 ibl-sarmayeh"></i>'), array('name' => trim('بانک سینا'), 'card_number' => '639346','logo'=>'<i class="ibl64 ibl-sina"></i>'), array('name' => trim('بانک شهر'), 'card_number' => '502806','logo'=>'<i class="ibl64 ibl-shahr"></i>'), array('name' => trim('بانک صادرات ایران'), 'card_number' => '603769','logo'=>'<i class="ibl64 ibl-bsi"></i>'), array('name' => trim('بانک صنعت و معدن'), 'card_number' => '627961','logo'=>'<i class="ibl64 ibl-bim"></i>'), array('name' => trim('بانک قرض الحسنه مهر ایران'), 'card_number' => '606373','logo'=>''), array('name' => trim('بانک قوامین'), 'card_number' => '639599','logo'=>'<i class="ibl64 ibl-ghbi"></i>'), array('name' => trim('بانک کارآفرین'), 'card_number' => '627488','logo'=>'<i class="ibl64 ibl-kar"></i>'), array('name' => trim('بانک کارآفرین'), 'card_number' => '502910','logo'=>'<i class="ibl64 ibl-kar"></i>'), array('name' => trim('بانک کشاورزی'), 'card_number' => '603770','logo'=>'<i class="ibl64 ibl-bki"></i>'), array('name' => trim('بانک کشاورزی'), 'card_number' => '639217','logo'=>'<i class="ibl64 ibl-bki"></i>'), array('name' => trim('بانک گردشگری'), 'card_number' => '505416','logo'=>'<i class="ibl64 ibl-tourism"></i>'), array('name' => trim('بانک مرکزی'), 'card_number' => '636795','logo'=>''), array('name' => trim('بانک مسکن'), 'card_number' => '628023','logo'=>'<i class="ibl64 ibl-maskan"></i>'), array('name' => trim('بانک ملت'), 'card_number' => '610433','logo'=>'<i class="ibl64 ibl-mellat animated pulse"></i>'), array('name' => trim('بانک ملت'), 'card_number' => '991975','logo'=>'<i class="ibl64 ibl-mellat animated pulse"></i>'), array('name' => trim('بانک ملی ایران'), 'card_number' => '603799','logo'=>'<i class="ibl64 ibl-bmi"></i>'), array('name' => trim('بانک مهر اقتصاد'), 'card_number' => '639370','logo'=>''), array('name' => trim('پست بانک ایران'), 'card_number' => '627760','logo'=>'<i class="ibl64 ibl-post"></i>'), array('name' => trim('موسسه اعتباری توسعه'), 'card_number' => '628157','logo'=>'<i class="ibl64 ibl-tt"></i>'), array('name' => trim('موسسه اعتباری کوثر'), 'card_number' => '505801','logo'=>''), array('name' => trim('بانک تجارت'), 'card_number' => '585983','logo'=>'<i class="ibl64 ibl-tejarat"></i>'), array('name' => trim('بانک شهر'), 'card_number' => '504706','logo'=>'<i class="ibl64 ibl-shahr"></i>'), array('name' => trim('بانک رسالت'), 'card_number' => '504172','logo'=>''), array('name' => trim('بانک خاورمیانه'), 'card_number' => '585947','logo'=>'<i class="ibl64 ibl-me"></i>'), array('name' => trim('آسان پرداخت'), "card_number" => '000000','logo'=>''), array('name' => trim('موسسه مالی و اعتباری نور'), 'card_number' => '507677','logo'=>''), ); \Illuminate\Support\Facades\DB::table('banks')->insert($data); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('banks'); } }
70.686047
131
0.537753
a8ffd1cc37afb72a4e0a38f0d39f1e0f82fe2731
456
sh
Shell
script/travis-publish-sonar.sh
wizzardo/bt
77a40b93145035f63bda4b48ece82cafdca1d765
[ "Apache-2.0" ]
2,199
2016-08-11T18:02:48.000Z
2022-03-31T11:02:54.000Z
script/travis-publish-sonar.sh
wizzardo/bt
77a40b93145035f63bda4b48ece82cafdca1d765
[ "Apache-2.0" ]
179
2016-09-01T22:42:54.000Z
2022-01-28T06:18:30.000Z
script/travis-publish-sonar.sh
wizzardo/bt
77a40b93145035f63bda4b48ece82cafdca1d765
[ "Apache-2.0" ]
380
2016-11-03T14:39:10.000Z
2022-03-26T08:31:48.000Z
#!/bin/bash if [ "$TRAVIS_REPO_SLUG" == "atomashpolskiy/bt" ] && [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$MAIN_BUILD" == "true" ]; then # prevent showing the token in travis logs #mvn sonar:sonar -Dsonar.login=${SONAR_TOKEN} -Psonar > /dev/null 2>&1 echo "TODO: Sonar stopped accepting Java 8; need to upgrade to at least Java 11" else echo "Skipping..." fi
32.571429
199
0.625
c389624fe7d5a220a5fb92268b496da511af5d25
909
cs
C#
src/Orleans/Client.Web/TemperatureController.cs
chunk1ty/FrameworkPlayground
f8e15d12c3998380bd76be1569e611a1b292c9de
[ "MIT" ]
null
null
null
src/Orleans/Client.Web/TemperatureController.cs
chunk1ty/FrameworkPlayground
f8e15d12c3998380bd76be1569e611a1b292c9de
[ "MIT" ]
null
null
null
src/Orleans/Client.Web/TemperatureController.cs
chunk1ty/FrameworkPlayground
f8e15d12c3998380bd76be1569e611a1b292c9de
[ "MIT" ]
null
null
null
using System.Threading.Tasks; using Grains.Contracts; using Microsoft.AspNetCore.Mvc; using Orleans; namespace Client.Web { [ApiController] public class TemperatureController : ControllerBase { private readonly IClusterClient _client; public TemperatureController(IClusterClient client) { _client = client; } [HttpGet("averagetemperature/{key}")] public async Task<double> GetAverageTemperature(long key) { var deviceGrain = _client.GetGrain<IDeviceGrain>(key); return await deviceGrain.GetAverageTemperature(); } [HttpPost("send")] public async Task<IActionResult> Send([FromBody]string temperature) { var decodeGrain = _client.GetGrain<IDecodeGrain>(0); await decodeGrain.Decode(temperature); return Ok("Ok"); } } }
25.25
75
0.632563
20d6c364ac14a56c853247814f1fe511b00a7e34
584
cs
C#
PokeAbilities/Passives/PassiveAbility_2270004.cs
TanaUmbreon/PokeAbilities
0f5077bc081ededfb4288fe5e8a02fea5ab9a12e
[ "MIT" ]
null
null
null
PokeAbilities/Passives/PassiveAbility_2270004.cs
TanaUmbreon/PokeAbilities
0f5077bc081ededfb4288fe5e8a02fea5ab9a12e
[ "MIT" ]
null
null
null
PokeAbilities/Passives/PassiveAbility_2270004.cs
TanaUmbreon/PokeAbilities
0f5077bc081ededfb4288fe5e8a02fea5ab9a12e
[ "MIT" ]
1
2021-07-07T09:48:52.000Z
2021-07-07T09:48:52.000Z
using System; using System.Linq; using LOR_DiceSystem; namespace PokeAbilities.Passives { /// <summary> /// パッシブ「てきおうりょく」 /// タイプ一致のとき、更に与えるダメージ・混乱ダメージ量+1 /// </summary> public class PassiveAbility_2270004 : PassiveAbilityBase { public override void BeforeGiveDamage(BattleDiceBehavior behavior) { if (!behavior.IsSameType()) { return; } owner.battleCardResultLog?.SetPassiveAbility(this); behavior.ApplyDiceStatBonus(new DiceStatBonus() { dmg = 1, breakDmg = 1 }); } } }
26.545455
88
0.619863
20f142762611e460290d5c3c4b16092fcfc72124
2,566
py
Python
api/resources/market.py
NathanBMcNamara/Speculator
e74aff778d6657a8c4993c62f264008c9be99e78
[ "MIT" ]
106
2017-11-09T13:58:45.000Z
2021-12-20T03:11:19.000Z
api/resources/market.py
NathanBMcNamara/Speculator
e74aff778d6657a8c4993c62f264008c9be99e78
[ "MIT" ]
6
2017-10-30T13:29:49.000Z
2021-09-13T12:06:59.000Z
api/resources/market.py
NathanBMcNamara/Speculator
e74aff778d6657a8c4993c62f264008c9be99e78
[ "MIT" ]
39
2017-10-30T16:35:01.000Z
2021-10-31T10:32:48.000Z
# TODO: Only require market stats that are being used by ML models # TODO: Allow storage/retrieval of multiple markets """ Allows storage/retrieval for custom market data instead of automatic gathering """ from api import api, db from api.helpers import HTTP_CODES, query_to_dict, validate_db from api.models.market import Data as DataModel from flask import abort from flask_restful import Resource from webargs import fields from webargs.flaskparser import use_kwargs data_kwargs = { 'id': fields.Integer(required=True), 'low': fields.Float(missing=None), 'high': fields.Float(missing=None), 'close': fields.Float(missing=None), 'volume': fields.Float(missing=None) } @api.resource('/api/private/market/') class Data(Resource): """ Market data at an instance in time """ @use_kwargs({'id': fields.Integer(missing=None)}) @validate_db(db) def get(self, id): if id is None: return [query_to_dict(q) for q in DataModel.query.all()] else: return query_to_dict(DataModel.query.get_or_404(id)) @use_kwargs(data_kwargs) @validate_db(db) def post(self, id, low, high, close, volume): try: post_request = DataModel(id, low, high, close, volume) db.session.add(post_request) db.session.commit() except: # ID already exists, use PUT abort(HTTP_CODES.UNPROCESSABLE_ENTITY) else: return query_to_dict(post_request) @use_kwargs(data_kwargs) @validate_db(db) def put(self, id, low, high, close, volume): """ Loop through function args, only change what is specified NOTE: Arg values of -1 clears since each must be >= 0 to be valid """ query = DataModel.query.get_or_404(id) for arg, value in locals().items(): if arg is not 'id' and arg is not 'self' and value is not None: if value == -1: setattr(query, arg, None) else: setattr(query, arg, value) db.session.commit() return query_to_dict(query) @use_kwargs({'id': fields.Integer(missing=None)}) @validate_db(db) def delete(self, id): try: if id is None: DataModel.query.delete() db.session.commit() else: db.session.delete(DataModel.query.get_or_404(id)) db.session.commit() except: return {'status': 'failed'} else: return {'status': 'successful'}
35.150685
86
0.615744
c57d37d7fdd1468838a1ff3da8d1f61dd2194bf3
267
css
CSS
stylesheets/style.css
emchang3/reanimation
b2734ad543e652d61f78b5bf2446d01a17979fc6
[ "MIT" ]
null
null
null
stylesheets/style.css
emchang3/reanimation
b2734ad543e652d61f78b5bf2446d01a17979fc6
[ "MIT" ]
null
null
null
stylesheets/style.css
emchang3/reanimation
b2734ad543e652d61f78b5bf2446d01a17979fc6
[ "MIT" ]
null
null
null
html, body { width: 100%; height: 100%; margin: 0px; } #test-container { position: absolute; } #inside { position: absolute; left: 100px; top: 100px; width: 200px; height: 200px; border: 1px solid black; } /*# sourceMappingURL=style.css.map */
14.833333
37
0.632959
ddce7e98166b732071044bae78c25e443efd3fab
321
lua
Lua
MMOCoreORB/bin/scripts/object/building/military/mun_all_military_tower_impl_guard_s01_pvp.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
18
2017-02-09T15:36:05.000Z
2021-12-21T04:22:15.000Z
MMOCoreORB/bin/scripts/object/building/military/mun_all_military_tower_impl_guard_s01_pvp.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
61
2016-12-30T21:51:10.000Z
2021-12-10T20:25:56.000Z
MMOCoreORB/bin/scripts/object/building/military/mun_all_military_tower_impl_guard_s01_pvp.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
71
2017-01-01T05:34:38.000Z
2022-03-29T01:04:00.000Z
object_building_military_mun_all_military_tower_impl_guard_s01_pvp = object_building_military_shared_mun_all_military_tower_impl_guard_s01_pvp:new { } ObjectTemplates:addTemplate(object_building_military_mun_all_military_tower_impl_guard_s01_pvp, "object/building/military/mun_all_military_tower_impl_guard_s01_pvp.iff")
80.25
169
0.934579
3cd3b245e7c3721231d1d113189563f0bf169b21
144
sh
Shell
.travis/travis-run.sh
PoojaChandak/repairnator
056e61ca522e64a14a376d5360a1f4ae0e50c46c
[ "MIT" ]
null
null
null
.travis/travis-run.sh
PoojaChandak/repairnator
056e61ca522e64a14a376d5360a1f4ae0e50c46c
[ "MIT" ]
null
null
null
.travis/travis-run.sh
PoojaChandak/repairnator
056e61ca522e64a14a376d5360a1f4ae0e50c46c
[ "MIT" ]
null
null
null
#!/usr/bin/env bash # running the Java tests of Repairnator on Travis set -e export M2_HOME=/usr/local/maven mvn clean test -B -f $TEST_PATH
16
49
0.736111
25b10f934a4e440ea27ef19dc5e40467a1146208
5,778
cs
C#
sdk/dotnet/ServiceCatalog/GetPortfolioConstraints.cs
RafalSumislawski/pulumi-aws
7c8a335d327c173aa32c8b3d98816e760db329fa
[ "ECL-2.0", "Apache-2.0" ]
1
2021-11-10T16:33:40.000Z
2021-11-10T16:33:40.000Z
sdk/dotnet/ServiceCatalog/GetPortfolioConstraints.cs
RafalSumislawski/pulumi-aws
7c8a335d327c173aa32c8b3d98816e760db329fa
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/dotnet/ServiceCatalog/GetPortfolioConstraints.cs
RafalSumislawski/pulumi-aws
7c8a335d327c173aa32c8b3d98816e760db329fa
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; using Pulumi.Utilities; namespace Pulumi.Aws.ServiceCatalog { public static class GetPortfolioConstraints { /// <summary> /// Provides information on Service Catalog Portfolio Constraints. /// /// {{% examples %}} /// ## Example Usage /// {{% example %}} /// ### Basic Usage /// /// ```csharp /// using Pulumi; /// using Aws = Pulumi.Aws; /// /// class MyStack : Stack /// { /// public MyStack() /// { /// var example = Output.Create(Aws.ServiceCatalog.GetPortfolioConstraints.InvokeAsync(new Aws.ServiceCatalog.GetPortfolioConstraintsArgs /// { /// PortfolioId = "port-3lli3b3an", /// })); /// } /// /// } /// ``` /// {{% /example %}} /// {{% /examples %}} /// </summary> public static Task<GetPortfolioConstraintsResult> InvokeAsync(GetPortfolioConstraintsArgs args, InvokeOptions? options = null) => Pulumi.Deployment.Instance.InvokeAsync<GetPortfolioConstraintsResult>("aws:servicecatalog/getPortfolioConstraints:getPortfolioConstraints", args ?? new GetPortfolioConstraintsArgs(), options.WithVersion()); /// <summary> /// Provides information on Service Catalog Portfolio Constraints. /// /// {{% examples %}} /// ## Example Usage /// {{% example %}} /// ### Basic Usage /// /// ```csharp /// using Pulumi; /// using Aws = Pulumi.Aws; /// /// class MyStack : Stack /// { /// public MyStack() /// { /// var example = Output.Create(Aws.ServiceCatalog.GetPortfolioConstraints.InvokeAsync(new Aws.ServiceCatalog.GetPortfolioConstraintsArgs /// { /// PortfolioId = "port-3lli3b3an", /// })); /// } /// /// } /// ``` /// {{% /example %}} /// {{% /examples %}} /// </summary> public static Output<GetPortfolioConstraintsResult> Invoke(GetPortfolioConstraintsInvokeArgs args, InvokeOptions? options = null) => Pulumi.Deployment.Instance.Invoke<GetPortfolioConstraintsResult>("aws:servicecatalog/getPortfolioConstraints:getPortfolioConstraints", args ?? new GetPortfolioConstraintsInvokeArgs(), options.WithVersion()); } public sealed class GetPortfolioConstraintsArgs : Pulumi.InvokeArgs { /// <summary> /// Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. /// </summary> [Input("acceptLanguage")] public string? AcceptLanguage { get; set; } /// <summary> /// Portfolio identifier. /// </summary> [Input("portfolioId", required: true)] public string PortfolioId { get; set; } = null!; /// <summary> /// Product identifier. /// </summary> [Input("productId")] public string? ProductId { get; set; } public GetPortfolioConstraintsArgs() { } } public sealed class GetPortfolioConstraintsInvokeArgs : Pulumi.InvokeArgs { /// <summary> /// Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. /// </summary> [Input("acceptLanguage")] public Input<string>? AcceptLanguage { get; set; } /// <summary> /// Portfolio identifier. /// </summary> [Input("portfolioId", required: true)] public Input<string> PortfolioId { get; set; } = null!; /// <summary> /// Product identifier. /// </summary> [Input("productId")] public Input<string>? ProductId { get; set; } public GetPortfolioConstraintsInvokeArgs() { } } [OutputType] public sealed class GetPortfolioConstraintsResult { public readonly string? AcceptLanguage; /// <summary> /// List of information about the constraints. See details below. /// </summary> public readonly ImmutableArray<Outputs.GetPortfolioConstraintsDetailResult> Details; /// <summary> /// The provider-assigned unique ID for this managed resource. /// </summary> public readonly string Id; /// <summary> /// Identifier of the portfolio the product resides in. The constraint applies only to the instance of the product that lives within this portfolio. /// </summary> public readonly string PortfolioId; /// <summary> /// Identifier of the product the constraint applies to. A constraint applies to a specific instance of a product within a certain portfolio. /// </summary> public readonly string? ProductId; [OutputConstructor] private GetPortfolioConstraintsResult( string? acceptLanguage, ImmutableArray<Outputs.GetPortfolioConstraintsDetailResult> details, string id, string portfolioId, string? productId) { AcceptLanguage = acceptLanguage; Details = details; Id = id; PortfolioId = portfolioId; ProductId = productId; } } }
34.189349
222
0.567844
23e4081080aa1ec95d866dddd62dedfe112b63c3
1,079
js
JavaScript
pm4js/objects/petri_net/util/reachable_visible_transitions.js
pm4js/pm4js-core
ce8b8bc6a18be8caa4587cef5b39e0aef6f7ec72
[ "BSD-3-Clause" ]
12
2021-08-14T21:50:36.000Z
2022-03-04T07:47:34.000Z
pm4js/objects/petri_net/util/reachable_visible_transitions.js
pm4js/pm4js-core
ce8b8bc6a18be8caa4587cef5b39e0aef6f7ec72
[ "BSD-3-Clause" ]
1
2021-11-30T14:57:39.000Z
2021-11-30T14:57:39.000Z
pm4js/objects/petri_net/util/reachable_visible_transitions.js
pm4js/pm4js-core
ce8b8bc6a18be8caa4587cef5b39e0aef6f7ec72
[ "BSD-3-Clause" ]
1
2022-03-04T07:32:51.000Z
2022-03-04T07:32:51.000Z
class PetriNetReachableVisibleTransitions { static apply(net, marking) { let reachableVisibleTransitions = {}; let visited = {}; let toVisit = []; toVisit.push(marking); while (toVisit.length > 0) { //console.log(reachableVisibleTransitions); let currMarking = toVisit.shift(); if (currMarking in visited) { continue; } visited[currMarking] = 0; let enabledTransitions = currMarking.getEnabledTransitions(); for (let trans of enabledTransitions) { if (trans.label != null) { reachableVisibleTransitions[trans.label] = 0; } else { let newMarking = currMarking.execute(trans); if (!(newMarking in visited)) { toVisit.push(newMarking); } } } } return Object.keys(reachableVisibleTransitions); } } try { require('../../../pm4js.js'); require('../petri_net.js'); module.exports = {PetriNetReachableVisibleTransitions: PetriNetReachableVisibleTransitions}; global.PetriNetReachableVisibleTransitions = PetriNetReachableVisibleTransitions; } catch (err) { //console.log(err); // not in Node }
26.317073
93
0.692308
7da8492cafc15eabadb73839edf0956581777fe6
1,568
css
CSS
resources/assets/css/extra.css
GCharalampidis/HLVF
ae95d3ba5846b17ab9d03432b7d0a805a39295fe
[ "MIT" ]
null
null
null
resources/assets/css/extra.css
GCharalampidis/HLVF
ae95d3ba5846b17ab9d03432b7d0a805a39295fe
[ "MIT" ]
null
null
null
resources/assets/css/extra.css
GCharalampidis/HLVF
ae95d3ba5846b17ab9d03432b7d0a805a39295fe
[ "MIT" ]
null
null
null
#face { width: 100px; height: 100px; position: relative; border-radius: 100px; margin: 20px auto; box-shadow: 5px 3px 15px #888888; background: #ffc806; /* For browsers that do not support gradients */ background: -webkit-radial-gradient(circle, #ffff73, #ffd904, #ff8600); /* Safari */ background: -o-radial-gradient(circle, #ffff73, #ffd904, #ff8600); /* Opera 11.6 to 12.0 */ background: -moz-radial-gradient(circle, #ffff73, #ffd904, #ff8600); /* Firefox 3.6 to 15 */ background: radial-gradient(circle, #ffff73, #ffd904, #ff8600); /* Standard syntax */ } #face:before, #face:after { position: absolute; content: ""; width: 9px; height: 9px; top: 37px; border-radius: 10px; background: black; } #face:before { left: 30px; } #face:after { left: 60px; } #mouth-box { width: 60px; height: 20px; left: 2px; top: 60px; overflow: hidden; position: relative; } #mouth { width: 60px; height: 60px; border-radius: 30px; border: 2px solid black; position: absolute; top: 0; left: 0; } #mouth.straight { height: 0px !important; top: 7px !important; border-width: 1px; bottom: auto !important; } .input_hidden { position: absolute; left: -9999px; } .selected { background-color: #4f545a; padding: 10px; border-radius: 25px; } #sites label { display: inline-block; cursor: pointer; } /*#sites label:hover {*/ /*background-color: #efefef;*/ /*}*/ #sites label img { padding: 3px; }
18.891566
96
0.610332
447aa1b2d685da588ba836de6504301945400662
1,383
py
Python
project3/solutions/problem4_dutch_national_flag_problem.py
ebitsdev/data-structures-algo-udacity
df0db1a93f01ace5e10f77947775f161d1531b15
[ "MIT" ]
null
null
null
project3/solutions/problem4_dutch_national_flag_problem.py
ebitsdev/data-structures-algo-udacity
df0db1a93f01ace5e10f77947775f161d1531b15
[ "MIT" ]
null
null
null
project3/solutions/problem4_dutch_national_flag_problem.py
ebitsdev/data-structures-algo-udacity
df0db1a93f01ace5e10f77947775f161d1531b15
[ "MIT" ]
null
null
null
# Problem 4: Dutch National Flag Problem def sort_zero_one_two(input_list): # We define 4 variables for the low, middle, high, and temporary values lo_end = 0 hi_end = len(input_list) - 1 mid = 0 tmp = None if len(input_list) <= 0 or input_list[mid] < 0: return "The list is either empty or invalid." while (mid <= hi_end): if input_list[mid] == 0: tmp = input_list[lo_end] input_list[lo_end] = input_list[mid] input_list[mid] = tmp lo_end += 1 mid += 1 elif input_list[mid] == 1: mid += 1 else: tmp = input_list[mid] input_list[mid] = input_list[hi_end] input_list[hi_end] = tmp hi_end -= 1 return input_list # Run some tests def test_function(test_case): sorted_array = sort_zero_one_two(test_case) print(sorted_array) if sorted_array == sorted(test_case): print("Pass") else: print("Fail") test_function([0, 0, 2, 2, 2, 1, 1, 1, 2, 0, 2]) test_function([2, 1, 2, 0, 0, 2, 1, 0, 1, 0, 0, 2, 2, 2, 1, 2, 0, 0, 0, 2, 1, 0, 2, 0, 0, 1]) test_function([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2]) test_function([1, 0, 2, 0, 1, 0, 2, 1, 0, 2, 2]) test_function([]) test_function([-1])
30.733333
93
0.527115
966073ca3fc1c68642ef8f658f735a06ec2ae90d
13,879
rs
Rust
src/apb_saradc/arb_ctrl.rs
bjoernQ/esp32c3
5c798e9b20f7c8370b782a4cdc5e6d3ef013cf14
[ "Apache-2.0", "MIT" ]
null
null
null
src/apb_saradc/arb_ctrl.rs
bjoernQ/esp32c3
5c798e9b20f7c8370b782a4cdc5e6d3ef013cf14
[ "Apache-2.0", "MIT" ]
null
null
null
src/apb_saradc/arb_ctrl.rs
bjoernQ/esp32c3
5c798e9b20f7c8370b782a4cdc5e6d3ef013cf14
[ "Apache-2.0", "MIT" ]
1
2022-01-05T12:39:38.000Z
2022-01-05T12:39:38.000Z
#[doc = "Register `ARB_CTRL` reader"] pub struct R(crate::R<ARB_CTRL_SPEC>); impl core::ops::Deref for R { type Target = crate::R<ARB_CTRL_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<ARB_CTRL_SPEC>> for R { #[inline(always)] fn from(reader: crate::R<ARB_CTRL_SPEC>) -> Self { R(reader) } } #[doc = "Register `ARB_CTRL` writer"] pub struct W(crate::W<ARB_CTRL_SPEC>); impl core::ops::Deref for W { type Target = crate::W<ARB_CTRL_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl core::ops::DerefMut for W { #[inline(always)] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } impl From<crate::W<ARB_CTRL_SPEC>> for W { #[inline(always)] fn from(writer: crate::W<ARB_CTRL_SPEC>) -> Self { W(writer) } } #[doc = "Field `ADC_ARB_APB_FORCE` reader - adc2 arbiter force to enableapb controller"] pub struct ADC_ARB_APB_FORCE_R(crate::FieldReader<bool, bool>); impl ADC_ARB_APB_FORCE_R { #[inline(always)] pub(crate) fn new(bits: bool) -> Self { ADC_ARB_APB_FORCE_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for ADC_ARB_APB_FORCE_R { type Target = crate::FieldReader<bool, bool>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `ADC_ARB_APB_FORCE` writer - adc2 arbiter force to enableapb controller"] pub struct ADC_ARB_APB_FORCE_W<'a> { w: &'a mut W, } impl<'a> ADC_ARB_APB_FORCE_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2); self.w } } #[doc = "Field `ADC_ARB_RTC_FORCE` reader - adc2 arbiter force to enable rtc controller"] pub struct ADC_ARB_RTC_FORCE_R(crate::FieldReader<bool, bool>); impl ADC_ARB_RTC_FORCE_R { #[inline(always)] pub(crate) fn new(bits: bool) -> Self { ADC_ARB_RTC_FORCE_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for ADC_ARB_RTC_FORCE_R { type Target = crate::FieldReader<bool, bool>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `ADC_ARB_RTC_FORCE` writer - adc2 arbiter force to enable rtc controller"] pub struct ADC_ARB_RTC_FORCE_W<'a> { w: &'a mut W, } impl<'a> ADC_ARB_RTC_FORCE_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3); self.w } } #[doc = "Field `ADC_ARB_WIFI_FORCE` reader - adc2 arbiter force to enable wifi controller"] pub struct ADC_ARB_WIFI_FORCE_R(crate::FieldReader<bool, bool>); impl ADC_ARB_WIFI_FORCE_R { #[inline(always)] pub(crate) fn new(bits: bool) -> Self { ADC_ARB_WIFI_FORCE_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for ADC_ARB_WIFI_FORCE_R { type Target = crate::FieldReader<bool, bool>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `ADC_ARB_WIFI_FORCE` writer - adc2 arbiter force to enable wifi controller"] pub struct ADC_ARB_WIFI_FORCE_W<'a> { w: &'a mut W, } impl<'a> ADC_ARB_WIFI_FORCE_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4); self.w } } #[doc = "Field `ADC_ARB_GRANT_FORCE` reader - adc2 arbiter force grant"] pub struct ADC_ARB_GRANT_FORCE_R(crate::FieldReader<bool, bool>); impl ADC_ARB_GRANT_FORCE_R { #[inline(always)] pub(crate) fn new(bits: bool) -> Self { ADC_ARB_GRANT_FORCE_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for ADC_ARB_GRANT_FORCE_R { type Target = crate::FieldReader<bool, bool>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `ADC_ARB_GRANT_FORCE` writer - adc2 arbiter force grant"] pub struct ADC_ARB_GRANT_FORCE_W<'a> { w: &'a mut W, } impl<'a> ADC_ARB_GRANT_FORCE_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5); self.w } } #[doc = "Field `ADC_ARB_APB_PRIORITY` reader - Set adc2 arbiterapb priority"] pub struct ADC_ARB_APB_PRIORITY_R(crate::FieldReader<u8, u8>); impl ADC_ARB_APB_PRIORITY_R { #[inline(always)] pub(crate) fn new(bits: u8) -> Self { ADC_ARB_APB_PRIORITY_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for ADC_ARB_APB_PRIORITY_R { type Target = crate::FieldReader<u8, u8>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `ADC_ARB_APB_PRIORITY` writer - Set adc2 arbiterapb priority"] pub struct ADC_ARB_APB_PRIORITY_W<'a> { w: &'a mut W, } impl<'a> ADC_ARB_APB_PRIORITY_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x03 << 6)) | ((value as u32 & 0x03) << 6); self.w } } #[doc = "Field `ADC_ARB_RTC_PRIORITY` reader - Set adc2 arbiter rtc priority"] pub struct ADC_ARB_RTC_PRIORITY_R(crate::FieldReader<u8, u8>); impl ADC_ARB_RTC_PRIORITY_R { #[inline(always)] pub(crate) fn new(bits: u8) -> Self { ADC_ARB_RTC_PRIORITY_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for ADC_ARB_RTC_PRIORITY_R { type Target = crate::FieldReader<u8, u8>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `ADC_ARB_RTC_PRIORITY` writer - Set adc2 arbiter rtc priority"] pub struct ADC_ARB_RTC_PRIORITY_W<'a> { w: &'a mut W, } impl<'a> ADC_ARB_RTC_PRIORITY_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x03 << 8)) | ((value as u32 & 0x03) << 8); self.w } } #[doc = "Field `ADC_ARB_WIFI_PRIORITY` reader - Set adc2 arbiter wifi priority"] pub struct ADC_ARB_WIFI_PRIORITY_R(crate::FieldReader<u8, u8>); impl ADC_ARB_WIFI_PRIORITY_R { #[inline(always)] pub(crate) fn new(bits: u8) -> Self { ADC_ARB_WIFI_PRIORITY_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for ADC_ARB_WIFI_PRIORITY_R { type Target = crate::FieldReader<u8, u8>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `ADC_ARB_WIFI_PRIORITY` writer - Set adc2 arbiter wifi priority"] pub struct ADC_ARB_WIFI_PRIORITY_W<'a> { w: &'a mut W, } impl<'a> ADC_ARB_WIFI_PRIORITY_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x03 << 10)) | ((value as u32 & 0x03) << 10); self.w } } #[doc = "Field `ADC_ARB_FIX_PRIORITY` reader - adc2 arbiter uses fixed priority"] pub struct ADC_ARB_FIX_PRIORITY_R(crate::FieldReader<bool, bool>); impl ADC_ARB_FIX_PRIORITY_R { #[inline(always)] pub(crate) fn new(bits: bool) -> Self { ADC_ARB_FIX_PRIORITY_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for ADC_ARB_FIX_PRIORITY_R { type Target = crate::FieldReader<bool, bool>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `ADC_ARB_FIX_PRIORITY` writer - adc2 arbiter uses fixed priority"] pub struct ADC_ARB_FIX_PRIORITY_W<'a> { w: &'a mut W, } impl<'a> ADC_ARB_FIX_PRIORITY_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12); self.w } } impl R { #[doc = "Bit 2 - adc2 arbiter force to enableapb controller"] #[inline(always)] pub fn adc_arb_apb_force(&self) -> ADC_ARB_APB_FORCE_R { ADC_ARB_APB_FORCE_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - adc2 arbiter force to enable rtc controller"] #[inline(always)] pub fn adc_arb_rtc_force(&self) -> ADC_ARB_RTC_FORCE_R { ADC_ARB_RTC_FORCE_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - adc2 arbiter force to enable wifi controller"] #[inline(always)] pub fn adc_arb_wifi_force(&self) -> ADC_ARB_WIFI_FORCE_R { ADC_ARB_WIFI_FORCE_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - adc2 arbiter force grant"] #[inline(always)] pub fn adc_arb_grant_force(&self) -> ADC_ARB_GRANT_FORCE_R { ADC_ARB_GRANT_FORCE_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bits 6:7 - Set adc2 arbiterapb priority"] #[inline(always)] pub fn adc_arb_apb_priority(&self) -> ADC_ARB_APB_PRIORITY_R { ADC_ARB_APB_PRIORITY_R::new(((self.bits >> 6) & 0x03) as u8) } #[doc = "Bits 8:9 - Set adc2 arbiter rtc priority"] #[inline(always)] pub fn adc_arb_rtc_priority(&self) -> ADC_ARB_RTC_PRIORITY_R { ADC_ARB_RTC_PRIORITY_R::new(((self.bits >> 8) & 0x03) as u8) } #[doc = "Bits 10:11 - Set adc2 arbiter wifi priority"] #[inline(always)] pub fn adc_arb_wifi_priority(&self) -> ADC_ARB_WIFI_PRIORITY_R { ADC_ARB_WIFI_PRIORITY_R::new(((self.bits >> 10) & 0x03) as u8) } #[doc = "Bit 12 - adc2 arbiter uses fixed priority"] #[inline(always)] pub fn adc_arb_fix_priority(&self) -> ADC_ARB_FIX_PRIORITY_R { ADC_ARB_FIX_PRIORITY_R::new(((self.bits >> 12) & 0x01) != 0) } } impl W { #[doc = "Bit 2 - adc2 arbiter force to enableapb controller"] #[inline(always)] pub fn adc_arb_apb_force(&mut self) -> ADC_ARB_APB_FORCE_W { ADC_ARB_APB_FORCE_W { w: self } } #[doc = "Bit 3 - adc2 arbiter force to enable rtc controller"] #[inline(always)] pub fn adc_arb_rtc_force(&mut self) -> ADC_ARB_RTC_FORCE_W { ADC_ARB_RTC_FORCE_W { w: self } } #[doc = "Bit 4 - adc2 arbiter force to enable wifi controller"] #[inline(always)] pub fn adc_arb_wifi_force(&mut self) -> ADC_ARB_WIFI_FORCE_W { ADC_ARB_WIFI_FORCE_W { w: self } } #[doc = "Bit 5 - adc2 arbiter force grant"] #[inline(always)] pub fn adc_arb_grant_force(&mut self) -> ADC_ARB_GRANT_FORCE_W { ADC_ARB_GRANT_FORCE_W { w: self } } #[doc = "Bits 6:7 - Set adc2 arbiterapb priority"] #[inline(always)] pub fn adc_arb_apb_priority(&mut self) -> ADC_ARB_APB_PRIORITY_W { ADC_ARB_APB_PRIORITY_W { w: self } } #[doc = "Bits 8:9 - Set adc2 arbiter rtc priority"] #[inline(always)] pub fn adc_arb_rtc_priority(&mut self) -> ADC_ARB_RTC_PRIORITY_W { ADC_ARB_RTC_PRIORITY_W { w: self } } #[doc = "Bits 10:11 - Set adc2 arbiter wifi priority"] #[inline(always)] pub fn adc_arb_wifi_priority(&mut self) -> ADC_ARB_WIFI_PRIORITY_W { ADC_ARB_WIFI_PRIORITY_W { w: self } } #[doc = "Bit 12 - adc2 arbiter uses fixed priority"] #[inline(always)] pub fn adc_arb_fix_priority(&mut self) -> ADC_ARB_FIX_PRIORITY_W { ADC_ARB_FIX_PRIORITY_W { w: self } } #[doc = "Writes raw bits to the register."] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.0.bits(bits); self } } #[doc = "digital saradc configure register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [arb_ctrl](index.html) module"] pub struct ARB_CTRL_SPEC; impl crate::RegisterSpec for ARB_CTRL_SPEC { type Ux = u32; } #[doc = "`read()` method returns [arb_ctrl::R](R) reader structure"] impl crate::Readable for ARB_CTRL_SPEC { type Reader = R; } #[doc = "`write(|w| ..)` method takes [arb_ctrl::W](W) writer structure"] impl crate::Writable for ARB_CTRL_SPEC { type Writer = W; } #[doc = "`reset()` method sets ARB_CTRL to value 0x0900"] impl crate::Resettable for ARB_CTRL_SPEC { #[inline(always)] fn reset_value() -> Self::Ux { 0x0900 } }
33.605327
422
0.620722
9fd4bd546525a5670feec8ec8284cbbeafa0fed6
5,454
py
Python
tests/ti_deps/deps/test_not_previously_skipped_dep.py
npodewitz/airflow
511ea702d5f732582d018dad79754b54d5e53f9d
[ "Apache-2.0" ]
8,092
2016-04-27T20:32:29.000Z
2019-01-05T07:39:33.000Z
tests/ti_deps/deps/test_not_previously_skipped_dep.py
npodewitz/airflow
511ea702d5f732582d018dad79754b54d5e53f9d
[ "Apache-2.0" ]
2,961
2016-05-05T07:16:16.000Z
2019-01-05T08:47:59.000Z
tests/ti_deps/deps/test_not_previously_skipped_dep.py
npodewitz/airflow
511ea702d5f732582d018dad79754b54d5e53f9d
[ "Apache-2.0" ]
3,546
2016-05-04T20:33:16.000Z
2019-01-05T05:14:26.000Z
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import pendulum import pytest from airflow.models import DagRun, TaskInstance from airflow.operators.empty import EmptyOperator from airflow.operators.python import BranchPythonOperator from airflow.ti_deps.dep_context import DepContext from airflow.ti_deps.deps.not_previously_skipped_dep import NotPreviouslySkippedDep from airflow.utils.state import State from airflow.utils.types import DagRunType @pytest.fixture(autouse=True, scope="function") def clean_db(session): yield session.query(DagRun).delete() session.query(TaskInstance).delete() def test_no_parent(session, dag_maker): """ A simple DAG with a single task. NotPreviouslySkippedDep is met. """ start_date = pendulum.datetime(2020, 1, 1) with dag_maker( "test_test_no_parent_dag", schedule_interval=None, start_date=start_date, session=session, ): op1 = EmptyOperator(task_id="op1") (ti1,) = dag_maker.create_dagrun(execution_date=start_date).task_instances ti1.refresh_from_task(op1) dep = NotPreviouslySkippedDep() assert len(list(dep.get_dep_statuses(ti1, session, DepContext()))) == 0 assert dep.is_met(ti1, session) assert ti1.state != State.SKIPPED def test_no_skipmixin_parent(session, dag_maker): """ A simple DAG with no branching. Both op1 and op2 are EmptyOperator. NotPreviouslySkippedDep is met. """ start_date = pendulum.datetime(2020, 1, 1) with dag_maker( "test_no_skipmixin_parent_dag", schedule_interval=None, start_date=start_date, session=session, ): op1 = EmptyOperator(task_id="op1") op2 = EmptyOperator(task_id="op2") op1 >> op2 _, ti2 = dag_maker.create_dagrun().task_instances ti2.refresh_from_task(op2) dep = NotPreviouslySkippedDep() assert len(list(dep.get_dep_statuses(ti2, session, DepContext()))) == 0 assert dep.is_met(ti2, session) assert ti2.state != State.SKIPPED def test_parent_follow_branch(session, dag_maker): """ A simple DAG with a BranchPythonOperator that follows op2. NotPreviouslySkippedDep is met. """ start_date = pendulum.datetime(2020, 1, 1) with dag_maker( "test_parent_follow_branch_dag", schedule_interval=None, start_date=start_date, session=session, ): op1 = BranchPythonOperator(task_id="op1", python_callable=lambda: "op2") op2 = EmptyOperator(task_id="op2") op1 >> op2 dagrun = dag_maker.create_dagrun(run_type=DagRunType.MANUAL, state=State.RUNNING) ti, ti2 = dagrun.task_instances ti.run() dep = NotPreviouslySkippedDep() assert len(list(dep.get_dep_statuses(ti2, session, DepContext()))) == 0 assert dep.is_met(ti2, session) assert ti2.state != State.SKIPPED def test_parent_skip_branch(session, dag_maker): """ A simple DAG with a BranchPythonOperator that does not follow op2. NotPreviouslySkippedDep is not met. """ start_date = pendulum.datetime(2020, 1, 1) with dag_maker( "test_parent_skip_branch_dag", schedule_interval=None, start_date=start_date, session=session, ): op1 = BranchPythonOperator(task_id="op1", python_callable=lambda: "op3") op2 = EmptyOperator(task_id="op2") op3 = EmptyOperator(task_id="op3") op1 >> [op2, op3] tis = { ti.task_id: ti for ti in dag_maker.create_dagrun(run_type=DagRunType.MANUAL, state=State.RUNNING).task_instances } tis["op1"].run() dep = NotPreviouslySkippedDep() assert len(list(dep.get_dep_statuses(tis["op2"], session, DepContext()))) == 1 assert not dep.is_met(tis["op2"], session) assert tis["op2"].state == State.SKIPPED def test_parent_not_executed(session, dag_maker): """ A simple DAG with a BranchPythonOperator that does not follow op2. Parent task is not yet executed (no xcom data). NotPreviouslySkippedDep is met (no decision). """ start_date = pendulum.datetime(2020, 1, 1) with dag_maker( "test_parent_not_executed_dag", schedule_interval=None, start_date=start_date, session=session, ): op1 = BranchPythonOperator(task_id="op1", python_callable=lambda: "op3") op2 = EmptyOperator(task_id="op2") op3 = EmptyOperator(task_id="op3") op1 >> [op2, op3] _, ti2, _ = dag_maker.create_dagrun().task_instances ti2.refresh_from_task(op2) dep = NotPreviouslySkippedDep() assert len(list(dep.get_dep_statuses(ti2, session, DepContext()))) == 0 assert dep.is_met(ti2, session) assert ti2.state == State.NONE
33.875776
106
0.702054
2d606a13b9e7ab4cd01fc8aed2a83b5a21c56269
815
css
CSS
src/components/tracks-table/TableRepostButton.module.css
ppak10/audius-client
95fd1db3867825158fc87b7b5516bc67904c247a
[ "Apache-2.0" ]
136
2020-08-17T23:51:51.000Z
2022-03-30T06:31:58.000Z
src/components/tracks-table/TableRepostButton.module.css
ppak10/audius-client
95fd1db3867825158fc87b7b5516bc67904c247a
[ "Apache-2.0" ]
907
2020-08-18T14:34:26.000Z
2022-03-31T21:40:46.000Z
src/components/tracks-table/TableRepostButton.module.css
ppak10/audius-client
95fd1db3867825158fc87b7b5516bc67904c247a
[ "Apache-2.0" ]
39
2020-08-29T03:43:48.000Z
2022-03-27T09:16:18.000Z
.tableRepostButton { display: flex; align-items: center; cursor: pointer; user-select: none; padding: 4px; } .tableRepostButton > div { display: flex; align-items: center; } .icon { width: 16px; height: 16px; position: relative; transition: all .07s ease-in-out !important; } .icon.notReposted { opacity: 0.0; } :global(.ant-table-tbody > tr:hover:not(.ant-table-expanded-row)) .icon { opacity: 1.0; } .icon g path { fill: var(--neutral-light-5); } .icon.reposted g path { fill: var(--primary); } .tableRepostButton:hover .icon { transform: scale3d(1.10,1.10,1.10); } .tableRepostButton:hover .icon g path { fill: var(--primary); } .tableRepostButton:active .icon { transform: scale(0.95); } .iconContainer { display: flex; justify-content: center; align-items: center; }
18.111111
73
0.669939
7f1cae9ff9f20a9c7f95decc3dc18e661c42ee25
693
cs
C#
HTMLWorker.cs
iKrax/webscraperSD
15d5b669db29ae9c645aae21ae3bf789406bd4e9
[ "MIT" ]
1
2018-05-31T12:12:23.000Z
2018-05-31T12:12:23.000Z
HTMLWorker.cs
iKrax/webscraperSD
15d5b669db29ae9c645aae21ae3bf789406bd4e9
[ "MIT" ]
null
null
null
HTMLWorker.cs
iKrax/webscraperSD
15d5b669db29ae9c645aae21ae3bf789406bd4e9
[ "MIT" ]
null
null
null
using System.IO; using System.Net; namespace SDWebScraper { class HTMLWorker { public static string getSource(string url) { //Create Request HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); //Get Response HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); //Read Response StreamReader sr = new StreamReader(resp.GetResponseStream()); //Output to string string source = sr.ReadToEnd(); //Close all the things sr.Close(); resp.Close(); return source; } } }
22.354839
74
0.526696
b2811c7d40e79e4029d1312d878e71261c3f2348
245
css
CSS
app/book-search.component.css
omarslvd/angular2-books
b530b37f3e0807184707e71ad5e48f08226486a8
[ "MIT" ]
null
null
null
app/book-search.component.css
omarslvd/angular2-books
b530b37f3e0807184707e71ad5e48f08226486a8
[ "MIT" ]
null
null
null
app/book-search.component.css
omarslvd/angular2-books
b530b37f3e0807184707e71ad5e48f08226486a8
[ "MIT" ]
null
null
null
.demo-card-container { display: flex; flex-flow: row wrap; } .demo-card-container md-card { margin: 0 16px 16px 0; width: 400px; background-color: #FFF; /*flex: 1 0 auto;*/ } .demo-card-container img { background-color: gray; }
14.411765
30
0.64898
a399e5e848f9dae767ee240d56a1b7a3a34b7cf1
5,999
java
Java
Blog-Core/src/main/java/site/btsearch/core/tools/HttpUtil.java
TakeaHeader/OpenBlog
1f74e33c1d2c4e9ce3bb50c8be699d70fbf1e1e8
[ "Apache-2.0" ]
null
null
null
Blog-Core/src/main/java/site/btsearch/core/tools/HttpUtil.java
TakeaHeader/OpenBlog
1f74e33c1d2c4e9ce3bb50c8be699d70fbf1e1e8
[ "Apache-2.0" ]
null
null
null
Blog-Core/src/main/java/site/btsearch/core/tools/HttpUtil.java
TakeaHeader/OpenBlog
1f74e33c1d2c4e9ce3bb50c8be699d70fbf1e1e8
[ "Apache-2.0" ]
null
null
null
package site.btsearch.core.tools; import com.alibaba.fastjson.JSONObject; import okhttp3.*; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; public final class HttpUtil { private static final OkHttpClient client ; private static final String UserAgent = "OkHttp BtSearch V0.1"; static { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.connectTimeout(60000, TimeUnit.MILLISECONDS); builder.readTimeout(60000, TimeUnit.MILLISECONDS); client = builder.build(); } private HttpUtil(){} public static JSONObject post(String url, JSONObject json){ return Request(url,"POST",json,null); } public static JSONObject post(String url, JSONObject json, Map headers){ return Request(url,"POST",json,headers); } public static JSONObject get(String url, JSONObject json){ return Request(url,"GET",json,null); } public static JSONObject get(String url, JSONObject json, Map headers){ return Request(url,"GET",json,headers); } public static String getHTML(String url, JSONObject json){ return RequestHTML(url,"GET",json,null); } public static InputStream getInputStream(String url, JSONObject json){ return RequestInputStream(url,"GET",json,null); } /* * url 地址 * method 请求类型 * json 请求数据 * headers 请求头 * */ private static JSONObject Request(String url, String method, JSONObject json, Map headers){ JSONObject object = null; RequestBody requestBody = null; if(json != null){ String data = JSONObject.toJSONString(json); requestBody = RequestBody.create(MediaTypeEnum.JSON.getMediaType(),data); } Request.Builder builder = new Request.Builder() .url(url) .header("User-Agent",UserAgent); if(headers != null){ Set<String> ketset = headers.keySet(); Iterator<String> it = ketset.iterator(); while (it.hasNext()){ String key = it.next(); builder.header(key, String.valueOf(headers.get(key))); } } if(requestBody != null){ builder.method(method, requestBody); } Request request = builder.build(); Response reponse = null; try{ reponse = client.newCall(request).execute(); }catch (IOException e){ // 待处理 object = new JSONObject(); object.put("code",-1); object.put("message","请求数据异常"); } if(reponse != null && reponse.isSuccessful()){ ResponseBody body = reponse.body(); try { object = JSONObject.parseObject(body.string()); }catch (IOException e){ object = new JSONObject(); object.put("code",-1); object.put("message","请求数据读取失败"); } } return object; } private static String RequestHTML(String url, String method, JSONObject json, Map headers){ RequestBody requestBody = null; if(json != null){ String data = JSONObject.toJSONString(json); requestBody = RequestBody.create(MediaTypeEnum.JSON.getMediaType(),data); } Request.Builder builder = new Request.Builder() .url(url) .header("User-Agent",UserAgent); if(headers != null){ Set<String> ketset = headers.keySet(); Iterator<String> it = ketset.iterator(); while (it.hasNext()){ String key = it.next(); builder.header(key, String.valueOf(headers.get(key))); } } if(requestBody != null){ builder.method(method, requestBody); } Request request = builder.build(); Response reponse = null; try{ reponse = client.newCall(request).execute(); }catch (IOException e){ // 待处理 return null; } if(reponse != null && reponse.isSuccessful()){ ResponseBody body = reponse.body(); try { return body.string(); }catch (IOException e){ return null; } } return null; } private static InputStream RequestInputStream(String url, String method, JSONObject json, Map headers){ RequestBody requestBody = null; if(json != null){ String data = JSONObject.toJSONString(json); requestBody = RequestBody.create(MediaTypeEnum.JSON.getMediaType(),data); } Request.Builder builder = new Request.Builder() .url(url) .header("User-Agent",UserAgent); if(headers != null){ Set<String> ketset = headers.keySet(); Iterator<String> it = ketset.iterator(); while (it.hasNext()){ String key = it.next(); builder.header(key, String.valueOf(headers.get(key))); } } if(requestBody != null){ builder.method(method, requestBody); } Request request = builder.build(); Response reponse = null; try{ reponse = client.newCall(request).execute(); }catch (IOException e){ // 待处理 return null; } if(reponse != null && reponse.isSuccessful()){ ResponseBody body = reponse.body(); try { return body.byteStream(); }catch (Exception e){ return null; } } return null; } public static void main(String[] args){ String HTML = getHTML("https://nyaa.si/?f=0&c=0_0&q=火影忍者",null); System.out.println(HTML); } }
31.082902
107
0.558926
0d62b793af66a61ba71aa5e42076fbdc33be8f69
288
cs
C#
src/DotVVM.Samples.Common/ViewModels/ControlSamples/Repeater/RequiredResourceViewModel.cs
vnwonah/dotvvm
d9e141790af6fd05fab4d42aecbe5683030d2706
[ "Apache-2.0" ]
641
2015-06-13T06:24:47.000Z
2022-03-18T20:06:06.000Z
src/DotVVM.Samples.Common/ViewModels/ControlSamples/Repeater/RequiredResourceViewModel.cs
vnwonah/dotvvm
d9e141790af6fd05fab4d42aecbe5683030d2706
[ "Apache-2.0" ]
879
2015-06-13T16:10:46.000Z
2022-03-28T14:42:37.000Z
src/DotVVM.Samples.Common/ViewModels/ControlSamples/Repeater/RequiredResourceViewModel.cs
vnwonah/dotvvm
d9e141790af6fd05fab4d42aecbe5683030d2706
[ "Apache-2.0" ]
128
2015-07-14T15:00:59.000Z
2022-03-02T17:39:24.000Z
using System.Collections.Generic; using DotVVM.Framework.ViewModel; namespace DotVVM.Samples.Common.ViewModels.ControlSamples.Repeater { public class RequiredResourceViewModel : DotvvmViewModelBase { public List<string> Items { get; set; } = new List<string>(0); } }
26.181818
70
0.743056
38d7ad74a04060029a254fa7f533ec0b5b3fd819
1,019
php
PHP
app/Http/Middleware/Authenticate.php
Aibram/aibram-adv
22d4372d4a7d7f0fef6b0006c94e01e23ff82ee8
[ "MIT" ]
null
null
null
app/Http/Middleware/Authenticate.php
Aibram/aibram-adv
22d4372d4a7d7f0fef6b0006c94e01e23ff82ee8
[ "MIT" ]
null
null
null
app/Http/Middleware/Authenticate.php
Aibram/aibram-adv
22d4372d4a7d7f0fef6b0006c94e01e23ff82ee8
[ "MIT" ]
null
null
null
<?php namespace App\Http\Middleware; use App\Exceptions\AuthenticationException; use Illuminate\Auth\Middleware\Authenticate as Middleware; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Route; use Laravel\Passport\Exceptions\MissingScopeException; class Authenticate extends Middleware { /** * Get the path the user should be redirected to when they are not authenticated. * * @param \Illuminate\Http\Request $request * @return string|null */ protected function redirectTo($request) { if (! $request->is('api/*')) { if (strpos(url()->current(),"/admin/")) { if(!checkLoggedIn('admin')) return route('admin.login'); } else{ if(!checkLoggedIn('user')) return route('frontend.login'); } } else{ throw new AuthenticationException(__('base.error.notAuth'),__('base.error.unauth'),403); } } }
28.305556
100
0.598626
b2d474596936169c18a025807bca0fea1cba3cbc
1,031
rb
Ruby
test/mr_test_case.rb
csail/tem_mr_search
7923b39a290103384f71465fe8eaabac74d3120e
[ "MIT" ]
1
2021-10-12T03:57:28.000Z
2021-10-12T03:57:28.000Z
test/mr_test_case.rb
csail/tem_mr_search
7923b39a290103384f71465fe8eaabac74d3120e
[ "MIT" ]
null
null
null
test/mr_test_case.rb
csail/tem_mr_search
7923b39a290103384f71465fe8eaabac74d3120e
[ "MIT" ]
1
2021-10-12T03:57:15.000Z
2021-10-12T03:57:15.000Z
require 'test/unit' require 'tem_mr_search' class MrTestCase < Test::Unit::TestCase include Tem::Mr::Search def setup super Thread.abort_on_exception = true @db_path = File.join File.dirname(__FILE__), "..", "testdata", "fares8.yml" @cluster_file = File.join File.dirname(__FILE__), "..", "testdata", "cluster.yml" @empty_cluster_file = File.join File.dirname(__FILE__), "..", "testdata", "empty_cluster.yml" @db = Db.new @db_path @client_query = WebClientQueryBuilder.query :layovers_cost => 1000, :start_time_cost => -1, :duration_cost => 1 end def fare_score(fare) 20000 + fare['start_time'] - fare['price'] - (fare['end_time'] - fare['start_time']) - fare['layovers'] * 1000 end def fare_id(fare) fare['flight'] end # Ensures that everything has loaded. def test_smoke end end
27.864865
79
0.552861
ffba36abaf60231b391f430437b61a59903fd571
22
sql
SQL
tests/data/commands/mock_command.sql
CalgaryMichael/branchdb-python
77b467105cdcaa7346c19c3882f05d85bc238268
[ "MIT" ]
null
null
null
tests/data/commands/mock_command.sql
CalgaryMichael/branchdb-python
77b467105cdcaa7346c19c3882f05d85bc238268
[ "MIT" ]
null
null
null
tests/data/commands/mock_command.sql
CalgaryMichael/branchdb-python
77b467105cdcaa7346c19c3882f05d85bc238268
[ "MIT" ]
null
null
null
SELECT {} FROM {arg2}
11
21
0.636364
1a8d7c12d4d3972bf3177a6b78a75b332ee4ce3c
4,059
cs
C#
EditorControls/FileControl.xaml.cs
DPS2004/quest
a369f92f25dd790ca2f664438f6570870f3fd84e
[ "MIT" ]
282
2015-01-12T17:35:36.000Z
2022-03-19T15:56:21.000Z
EditorControls/FileControl.xaml.cs
DPS2004/quest
a369f92f25dd790ca2f664438f6570870f3fd84e
[ "MIT" ]
391
2015-01-11T23:18:49.000Z
2022-03-15T16:27:29.000Z
EditorControls/FileControl.xaml.cs
DPS2004/quest
a369f92f25dd790ca2f664438f6570870f3fd84e
[ "MIT" ]
112
2015-01-02T02:30:33.000Z
2022-03-01T21:47:48.000Z
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows; using System.Windows.Controls; using MessageBox = System.Windows.Forms.MessageBox; namespace TextAdventures.Quest.EditorControls { [ControlType("file")] public partial class FileControl : UserControl, IElementEditorControl { private ControlDataHelper<string> m_helper; private IEditorData m_data; public FileControl() { InitializeComponent(); m_helper = new ControlDataHelper<string>(this); m_helper.Initialise += m_helper_Initialise; } void m_helper_Initialise() { string source = m_helper.ControlDefinition.GetString("source"); fileDropDown.BasePath = System.IO.Path.GetDirectoryName(m_helper.Controller.Filename); fileDropDown.Source = source; fileDropDown.Initialise(m_helper.Controller); fileDropDown.Preview = m_helper.ControlDefinition.GetBool("preview"); if (source == "libraries") { source = "*.aslx"; fileDropDown.FileLister = GetAvailableLibraries; } fileDropDown.FileFilter = string.Format("{0} ({1})|{1}", m_helper.ControlDefinition.GetString("filefiltername"), source); fileDropDown.ShowNewButton = !string.IsNullOrEmpty(m_helper.ControlDefinition.GetString("newfile")); fileDropDown.DefaultFilename = m_helper.ControlDefinition.GetString("newfile"); } private void lstFiles_SelectionChanged(object sender, SelectionChangedEventArgs e) { m_helper.SetDirty(fileDropDown.Filename); Save(); } public IControlDataHelper Helper { get { return m_helper; } } public void Populate(IEditorData data) { m_data = data; if (data == null) return; m_helper.StartPopulating(); fileDropDown.RefreshFileList(); fileDropDown.Filename = m_helper.Populate(data); fileDropDown.Enabled = m_helper.CanEdit(data) && !data.ReadOnly; m_helper.FinishedPopulating(); } public void Save() { if (m_data == null) return; if (!m_helper.IsDirty) return; string saveValue = Filename; m_helper.Save(saveValue); } private IEnumerable<string> GetAvailableLibraries() { yield return ""; foreach (string result in m_helper.Controller.GetAvailableLibraries()) { yield return result; } } public void RefreshFileList() { fileDropDown.RefreshFileList(); } public string Filename { get { return fileDropDown.Filename; } set { fileDropDown.Filename = value; } } private void FilenameUpdated(string filename) { if (m_data != null) { m_helper.Controller.StartTransaction(String.Format("Set filename to '{0}'", filename)); m_data.SetAttribute(m_helper.ControlDefinition.Attribute, filename); m_helper.Controller.EndTransaction(); Populate(m_data); } } public bool IsUpdatingList { get { return fileDropDown.IsUpdatingList; } } public Control FocusableControl { get { return fileDropDown.FocusableControl; } } public event EventHandler<SelectionChangedEventArgs> SelectionChanged { add { fileDropDown.SelectionChanged += value; } remove { fileDropDown.SelectionChanged -= value; } } } }
31.223077
134
0.558758
9d7599b6e28f472bd2710d46e9988330cc01be2f
6,917
swift
Swift
Examples/iOS/SequencerDemo/SequencerDemo/Conductor.swift
laurentVeliscek/AudioKit
3d88e8b2405ab32632ed410405dc914dc6a82833
[ "MIT" ]
null
null
null
Examples/iOS/SequencerDemo/SequencerDemo/Conductor.swift
laurentVeliscek/AudioKit
3d88e8b2405ab32632ed410405dc914dc6a82833
[ "MIT" ]
null
null
null
Examples/iOS/SequencerDemo/SequencerDemo/Conductor.swift
laurentVeliscek/AudioKit
3d88e8b2405ab32632ed410405dc914dc6a82833
[ "MIT" ]
null
null
null
// // Conductor.swift // SequencerDemo // // Created by Kanstantsin Linou on 6/30/16. // Copyright © 2016 AudioKit. All rights reserved. // import AudioKit class Conductor { let midi = AKMIDI() var fmOscillator = AKFMOscillatorBank() var melodicSound: AKMIDINode? var verb: AKReverb2? var bassDrum = AKSynthKick() var snareDrum = AKSynthSnare() var snareGhost = AKSynthSnare(duration: 0.06, resonance: 0.3) var snareMixer = AKMixer() var snareVerb: AKReverb? var sequence = AKSequencer() var mixer = AKMixer() var pumper: AKCompressor? var currentTempo = 110.0 let scale1: [Int] = [0, 2, 4, 7, 9] let scale2: [Int] = [0, 3, 5, 7, 10] let sequenceLength = AKDuration(beats: 8.0) init() { fmOscillator.modulatingMultiplier = 3 fmOscillator.modulationIndex = 0.3 melodicSound = AKMIDINode(node: fmOscillator) melodicSound?.enableMIDI(midi.client, name: "melodicSound midi in") verb = AKReverb2(melodicSound!) verb?.dryWetMix = 0.5 verb?.decayTimeAt0Hz = 7 verb?.decayTimeAtNyquist = 11 verb?.randomizeReflections = 600 verb?.gain = 1 bassDrum.enableMIDI(midi.client, name: "bassDrum midi in") snareDrum.enableMIDI(midi.client, name: "snareDrum midi in") snareGhost.enableMIDI(midi.client, name: "snareGhost midi in") snareMixer.connect(snareDrum) snareMixer.connect(snareGhost) snareVerb = AKReverb(snareMixer) pumper = AKCompressor(mixer) pumper?.headRoom = 0.10 pumper?.threshold = -15 pumper?.masterGain = 10 pumper?.attackTime = 0.01 pumper?.releaseTime = 0.3 mixer.connect(verb!) mixer.connect(bassDrum) mixer.connect(snareDrum) mixer.connect(snareGhost) mixer.connect(snareVerb!) AudioKit.output = pumper AudioKit.start() sequence.newTrack() sequence.setLength(sequenceLength) sequence.tracks[Sequence.Melody.rawValue].setMIDIOutput((melodicSound?.midiIn)!) generateNewMelodicSequence(minor: false) sequence.newTrack() sequence.tracks[Sequence.BassDrum.rawValue].setMIDIOutput(bassDrum.midiIn) generateBassDrumSequence() sequence.newTrack() sequence.tracks[Sequence.SnareDrum.rawValue].setMIDIOutput(snareDrum.midiIn) generateSnareDrumSequence() sequence.newTrack() sequence.tracks[Sequence.SnareDrumGhost.rawValue].setMIDIOutput(snareGhost.midiIn) generateSnareDrumGhostSequence() sequence.enableLooping() sequence.setTempo(100) sequence.play() } func generateNewMelodicSequence(stepSize: Float = 1/8, minor: Bool = false, clear: Bool = true) { if (clear) { sequence.tracks[Sequence.Melody.rawValue].clear() } sequence.setLength(sequenceLength) let numberOfSteps = Int(Float(sequenceLength.beats)/stepSize) //print("steps in sequence: \(numberOfSteps)") for i in 0 ..< numberOfSteps { if (arc4random_uniform(17) > 12) { let step = Double(i) * stepSize //print("step is \(step)") let scale = (minor ? scale2 : scale1) let scaleOffset = arc4random_uniform(UInt32(scale.count)-1) var octaveOffset = 0 for _ in 0 ..< 2 { octaveOffset += Int(12 * (((Float(arc4random_uniform(2)))*2.0)+(-1.0))) octaveOffset = Int((Float(arc4random_uniform(2))) * (Float(arc4random_uniform(2))) * Float(octaveOffset)) } //print("octave offset is \(octaveOffset)") let noteToAdd = 60 + scale[Int(scaleOffset)] + octaveOffset sequence.tracks[Sequence.Melody.rawValue].add(noteNumber: noteToAdd, velocity: 100, position: AKDuration(beats: step), duration: AKDuration(beats: 1)) } } sequence.setLength(sequenceLength) } func generateBassDrumSequence(stepSize: Float = 1, clear: Bool = true) { if (clear) { sequence.tracks[Sequence.BassDrum.rawValue].clear() } let numberOfSteps = Int(Float(sequenceLength.beats)/stepSize) for i in 0 ..< numberOfSteps { let step = Double(i) * stepSize sequence.tracks[Sequence.BassDrum.rawValue].add(noteNumber: 60, velocity: 100, position: AKDuration(beats: step), duration: AKDuration(beats: 1)) } } func generateSnareDrumSequence(stepSize: Float = 1, clear: Bool = true) { if (clear) { sequence.tracks[2].clear() } let numberOfSteps = Int(Float(sequenceLength.beats)/stepSize) for i in 1.stride(to: numberOfSteps, by: 2) { let step = (Double(i) * stepSize) sequence.tracks[Sequence.SnareDrum.rawValue].add(noteNumber: 60, velocity: 80, position: AKDuration(beats: step), duration: AKDuration(beats: 1)) } } func generateSnareDrumGhostSequence(stepSize: Float = 1/8, clear: Bool = true) { if (clear) { sequence.tracks[Sequence.SnareDrumGhost.rawValue].clear() } let numberOfSteps = Int(Float(sequenceLength.beats)/stepSize) //print("steps in sequnce: \(numberOfSteps)") for i in 0 ..< numberOfSteps { if(arc4random_uniform(17) > 14) { let step = Double(i) * stepSize sequence.tracks[Sequence.SnareDrumGhost.rawValue].add(noteNumber: 60, velocity: Int(arc4random_uniform(65) + 1), position: AKDuration(beats: step), duration: AKDuration(beats: 0.1)) } } sequence.setLength(sequenceLength) } func randomBool() -> Bool { return arc4random_uniform(2) == 0 ? true : false } func generateSequence() { generateNewMelodicSequence(minor: randomBool()) generateBassDrumSequence() generateSnareDrumSequence() generateSnareDrumGhostSequence() } func clear(typeOfSequence: Sequence) { sequence.tracks[typeOfSequence.rawValue].clear() } func increaseTempo() { currentTempo += 1.0 sequence.setTempo(currentTempo) } func decreaseTempo() { currentTempo -= 1.0 sequence.setTempo(currentTempo) } }
36.989305
125
0.57496
e418b799d4f8d06dfdffb0b2ca110ea4cd1240ac
3,967
swift
Swift
MyHabits/MyHabits/Detail screen scene/Controllers/HabitDetailsViewController.swift
firetrace/iOS_networking
b02644ba8658616204eae0162ef72756ce73b509
[ "MIT" ]
null
null
null
MyHabits/MyHabits/Detail screen scene/Controllers/HabitDetailsViewController.swift
firetrace/iOS_networking
b02644ba8658616204eae0162ef72756ce73b509
[ "MIT" ]
1
2021-02-16T13:09:31.000Z
2021-02-16T13:09:31.000Z
MyHabits/MyHabits/Detail screen scene/Controllers/HabitDetailsViewController.swift
firetrace/iOS_industrial_dev
1334a81bd308117cb933767fa0521fca816f5aec
[ "MIT" ]
null
null
null
// // HabitDetailsViewController.swift // MyHabits // // Created by Admin on 19.01.2021. // import UIKit class HabitDetailsViewController: UIViewController { weak var thisDelegate: HabitDelegate? private var data: HabitModel private lazy var editButton: UIBarButtonItem = { var button = UIBarButtonItem(title: "Править", style: .plain, target: self, action: #selector(edit)) button.tintColor = getColorStyle(style: .magenta) return button }() private lazy var tableView: UITableView = { var table = UITableView(frame: CGRect.zero, style: .grouped) table.dataSource = self table.register(HabitTableViewCell.self, forCellReuseIdentifier: HabitTableViewCell.reuseId) table.toAutoLayout() return table }() init(data: HabitModel) { self.data = data super.init(nibName: nil, bundle: nil) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() title = data.name view.backgroundColor = .systemBackground setupLayout() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationItem.largeTitleDisplayMode = .never navigationItem.rightBarButtonItem = editButton } private func setupLayout() { view.addSubview(tableView) NSLayoutConstraint.activate([tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), tableView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), tableView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor)]) } @objc private func edit() { let habitViewController = HabitViewController(data: data) habitViewController.thisDelegate = self let habitNavigationViewController = UINavigationController(rootViewController: habitViewController) navigationController?.present(habitNavigationViewController, animated: true, completion: nil) } } extension HabitDetailsViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { detailsTableHeader } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { HabitsStore.shared.dates.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: HabitTableViewCell.reuseId, for: indexPath) if let editCell = cell as? HabitTableViewCell, let index = data.id { let habit = HabitsStore.shared.habits[index] let date = HabitsStore.shared.dates.sorted(by: { $0.compare($1) == .orderedDescending })[indexPath.row] let isCheck = HabitsStore.shared.habit(habit, isTrackedIn: date) editCell.updateCell(object: CellModel(date: date, isCheck: isCheck)) } return cell } } extension HabitDetailsViewController: HabitDelegate { func updateData() { data.updateData() title = data.name thisDelegate?.updateData() } func presentController(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?) { present(viewControllerToPresent, animated: flag, completion: completion) } func dismissController(animated: Bool, completion: (() -> Void)?) { thisDelegate?.updateData() navigationController?.popViewController(animated: true) } }
35.738739
123
0.661709
0d45cafeb51301c494dccfd03cc635de28f2d6b9
3,149
h
C
myy/helpers/hitbox_action.h
Miouyouyou/QuickProtoGL
90e12b5179b0b69292772b42745c76251985d232
[ "MIT" ]
null
null
null
myy/helpers/hitbox_action.h
Miouyouyou/QuickProtoGL
90e12b5179b0b69292772b42745c76251985d232
[ "MIT" ]
null
null
null
myy/helpers/hitbox_action.h
Miouyouyou/QuickProtoGL
90e12b5179b0b69292772b42745c76251985d232
[ "MIT" ]
null
null
null
#ifndef MYY_HELPERS_HITBOX_ACTION_H #define MYY_HELPERS_HITBOX_ACTION_H 1 #include <stdint.h> struct box_coords_S { int16_t left, right, top, bottom; }; typedef struct box_coords_S box_coords_S_t; #include <myy/helpers/position.h> inline static uint8_t box_coords_S_pos_S_inside_window_coords (box_coords_S_t const box_coords, position_S position) { return (box_coords.left < position.x && box_coords.right > position.x && box_coords.top < position.y && box_coords.bottom > position.y); } #define HITBOX_ACTION_SIG void *, position_S const, position_S const #define HITBOX_ACTION_FULL_SIG(data,rel,abs) \ void * data, position_S const rel, position_S const abs struct hitbox_action_S { box_coords_S_t coords; uint8_t (* action)(HITBOX_ACTION_SIG); void * action_data; }; typedef struct hitbox_action_S hitbox_action_S_t; #define HITBOX_ACTION(left, right, top, bottom, action) {\ .left = left, .right = right, .top = top, .bottom = bottom, \ .action = action\ } struct hitboxes_S { uint16_t count; uint16_t max; hitbox_action_S_t * __restrict const data; }; typedef struct hitboxes_S hitboxes_S_t; /** * Update the coordinates of a hitbox. * * @param hitbox The hitbox to modify the coords from * @param new_coords The hitbox new coordinates */ inline static void hitbox_action_S_change_coords (hitbox_action_S_t * __restrict const hitbox, box_coords_S_t const new_coords) { hitbox->coords = new_coords; } uint8_t hitboxes_action_react_on_click_at (hitboxes_S_t const * __restrict const hitboxes, position_S const abs_screen_click_pos); hitboxes_S_t hitboxes_struct (unsigned int const initial_elements_max); void hitboxes_S_init (hitboxes_S_t * __restrict const hitboxes, unsigned int const initial_elements_max); uint8_t hitboxes_S_add (hitboxes_S_t * __restrict const hitboxes, int16_t const left, int16_t const right, int16_t const top, int16_t const bottom, uint8_t (* action)(HITBOX_ACTION_SIG), void * action_data); uint8_t hitboxes_S_delete (hitboxes_S_t * __restrict const hitboxes, int16_t const left, int16_t const right, int16_t const top, int16_t const bottom, uint8_t (* action)(HITBOX_ACTION_SIG)); uint8_t hitboxes_S_add_copy (hitboxes_S_t * __restrict const hitboxes, hitbox_action_S_t * model); uint8_t hitboxes_S_add_box_action (hitboxes_S_t * __restrict const hitboxes, box_coords_S_t * __restrict coords, uint8_t (* action)(HITBOX_ACTION_SIG), void * action_data); uint8_t hitboxes_S_delete_box_action (hitboxes_S_t * __restrict const hitboxes, box_coords_S_t * __restrict coords, uint8_t (* action)(HITBOX_ACTION_SIG)); /** * Reset the hitboxes counter to 0. This does not delete the previously * available data, however there is no way to know how many were stored * before the reset. * * @param hitboxes the hitboxes to reset */ inline static void hitboxes_S_quick_reset (hitboxes_S_t * __restrict const hitboxes) { hitboxes->count = 0; } /** * Reset the hitboxes counter to 0 and write 0 in all the usable * memory. * * @param hitboxes the hitboxes to reset */ void hitboxes_S_reset (hitboxes_S_t * __restrict const hitboxes); #endif
25.811475
71
0.775484
44787291fd9418de72796898a5095cdb9ef32be3
367
swift
Swift
Sources/Sio/Optional+Utils.swift
buscarini/sio
0c02f5b2651094372da1483675406dc3c6afc272
[ "MIT" ]
1
2020-06-03T04:53:38.000Z
2020-06-03T04:53:38.000Z
Sources/Sio/Optional+Utils.swift
buscarini/sio
0c02f5b2651094372da1483675406dc3c6afc272
[ "MIT" ]
null
null
null
Sources/Sio/Optional+Utils.swift
buscarini/sio
0c02f5b2651094372da1483675406dc3c6afc272
[ "MIT" ]
null
null
null
// // Optional+Utils.swift // Sio // // Created by José Manuel Sánchez Peñarroja on 23/03/2020. // import Foundation public extension Array { func traverse<A>(_ f: @escaping (Element) -> A?) -> [A]? { var result: [A] = [] for item in self { guard let current = f(item) else { return nil } result.append(current) } return result } }
15.291667
59
0.60218
daa2f7d89b9fd973d73893bb8989e05b80bcd576
985
php
PHP
application/home/widget/CategoryWidget.class.php
huangjinnan/aa
bfdda9c9410190bb359fd1c65c3885a3991194b5
[ "Apache-2.0" ]
288
2018-12-01T06:47:40.000Z
2022-02-23T08:04:26.000Z
application/home/widget/CategoryWidget.class.php
huangjinnan/aa
bfdda9c9410190bb359fd1c65c3885a3991194b5
[ "Apache-2.0" ]
6
2020-07-17T01:54:46.000Z
2022-02-26T10:53:43.000Z
application/home/widget/CategoryWidget.class.php
huangjinnan/aa
bfdda9c9410190bb359fd1c65c3885a3991194b5
[ "Apache-2.0" ]
78
2018-12-01T06:58:36.000Z
2021-04-26T15:20:41.000Z
<?php // +---------------------------------------------------------------------- // | WeiPHP [ 公众号和小程序运营管理系统 ] // +---------------------------------------------------------------------- // | Copyright (c) 2017 http://www.weiphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Author: 凡星 <weiphp@weiphp.cn> <QQ:203163051> // +---------------------------------------------------------------------- namespace Home\Widget; use think\Controller; /** * 分类widget * 用于动态调用分类信息 */ class CategoryWidget extends Controller{ /* 显示指定分类的同级分类或子分类列表 */ public function lists($cate, $child = false){ $field = 'id,name,pid,title,link_id'; if($child){ $category = D('Category')->getTree($cate, $field); $category = $category['_']; } else { $category = D('Category')->getSameLevel($cate, $field); } $this->assign('category', $category); $this->assign('current', $cate); return $this->fetch('Category/lists'); } }
28.142857
74
0.448731
3f3a73d4686f1d30597d2fee31efd61af5f30b60
6,574
php
PHP
book-an-appointment.php
princemanku/clinicupdated
77c5b5ac03f061320e9ce4f78bc94919b47f518c
[ "MIT" ]
null
null
null
book-an-appointment.php
princemanku/clinicupdated
77c5b5ac03f061320e9ce4f78bc94919b47f518c
[ "MIT" ]
null
null
null
book-an-appointment.php
princemanku/clinicupdated
77c5b5ac03f061320e9ce4f78bc94919b47f518c
[ "MIT" ]
null
null
null
<?php include 'header.php';?> <head> <script src="https://www.google.com/recaptcha/api.js" async defer></script> <!-- Web Fonts --> <link href='http://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,500,500italic,700,700italic' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Raleway:700,400,300' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=PT+Serif' rel='stylesheet' type='text/css'> <style type="text/css"> .picker-switch a {background-color:#f99b8b ;} /*.bootstrap-datetimepicker-widget td span{background-color: #f99b8b ;display: block; float:none;width:100%;}*/ </style> <?php if(isset($_POST["submit"])){ $captcha = $_POST["g-captcha-response"]; $secretkey= "6LcGtcAUAAAAAKuGB-gued3iCTKKPqGfVzKBhRM8"; $url = "https://www.google.com/recaptcha/api/siteverify? secret=".urldecode($secretkey)."&response=".urldecode($captcha). ""; $response= file_get_contents($url); $responseKey= json_decode($response,True); } ?> </head> </div> <!-- header-container end --> <!-- main-container start --> <!-- ================ --> <div class="main-container dark-translucent-bg" style="background-image:url('images/background-img-6.jpg');"> <div class="container"> <div class="row"> <!-- main start --> <!-- ================ --> <div class="main object-non-visible" data-animation-effect="fadeInUpSmall" data-effect-delay="100"> <div class="form-block center-block p-30 light-gray-bg border-clear"> <h2 class="title text-center">Book an Appointment</h2> <p id="responsed"></p> <p class="button-appiontment" style="text-align: center;">Clinic Timings - Monday-Sunday: 10:00AM - 7:00PM <br /> </p> <p class="token-text">*Consultation by token only. <br>*For procedures contact clinic and pre-book <br> Consultant:- Dr. Kunal/Megha Singh.</p> <form class="form-horizontal" role="form" action="../forms/appointment-mail.php" method="post" id="appointment_form"> <div class="form-group has-feedback"> <!--<label for="inputName" class="col-sm-3 control-label">Name <span class="text-danger small">*</span></label>--> <div class="col-sm-12"> <i class="fa fa-pencil form-control-feedback"></i> <input type="text" class="form-control" name="name" id="Name" placeholder="name"> </div> </div> <div class="form-group has-feedback"> <!--<label for="inputUserName" class="col-sm-3 control-label">Phone Number<span class="text-danger small">*</span></label>--> <div class="col-sm-12"> <i class="fa fa-phone form-control-feedback"></i> <input type="tel" class="form-control" name="phone" id="phone" minlength ="10" maxlength="10" placeholder="Phone"> </div> </div> <div class="form-group has-feedback"> <!--<label for="inputEmail" class="col-sm-3 control-label">Email<span class="text-danger small">*</span></label>--> <div class="col-sm-12"> <i class="fa fa-envelope form-control-feedback"></i> <input type="email" class="form-control" name="email" onkeyup="emailKeyPress()" id="email" placeholder="Email"> </div> </div> <div class="form-group has-feedback"> <!--<label for="inputdate" class="col-sm-3 control-label">Select Date <span class="text-danger small">*</span></label>--> <div class="col-sm-12"> <i class="fa fa-calendar form-control-feedback"></i> <input type="text" class="form-control" name="date" id="datepicker1"placeholder="Appointment Date & Time"> </div> </div> <div class="form-group has-feedback"> <!--<label for="inputPassword" class="col-sm-3 control-label">Message <span class="text-danger small"></span></label>--> <div class="col-sm-12"> <i class="fa fa-pencil form-control-feedback"></i> <textarea class="form-control" rows="6" id="message" name="message" placeholder=""></textarea> </div> </div> <div class="form-group has-feedback"> <!--<label for="inputPassword" class="col-sm-3 control-label"><span class="text-danger small"></span></label>--> <div class="col-sm-12"> <div class="g-recaptcha" data-sitekey="6LcGtcAUAAAAAG1af0W2iI-RgvwBvmtBLYfseQbv"></div> </div> </div> <div class="form-group"> <div class="col-sm-12"> <button type="submit" class="btn btn-group btn-default btn-animated">Submit <i class="fa fa-check"></i></button> </div> </div> </form> </div> </div> <!-- main end --> </div> </div> </div> <?php include 'footer.php';?> <!-- Date-picker --> <link rel="stylesheet" href="css/jquery-ui.css"> <script src="../code.jquery.com/jquery-1.12.4.js"></script> <script src="../code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <!-- <script> $( function() { $( "#datepicker1" ).datepicker(); } ); </script> --> <!-- Date-picker --> <script src="js/datepicker/moment-with-locales.js"></script> <script src="js/datepicker/bootstrap-datetimepicker.js"></script> <link href="js/datepicker/bootstrap-datetimepicker.css" rel="stylesheet"> <script type="text/javascript"> $(function () { var dateNow = new Date(); $('#datepicker1').datetimepicker({ format: 'DD/MM/YYYY', // enabledHours: [10, 11, 12, 13, 14, 15, 16, 17, 18,19], daysOfWeekDisabled: [0,3], minDate: moment(), }); }); $('#datepicker1').val(moment()); </script> <script language="JavaScript"> var frmvalidator = new Validator("appointment_form"); frmvalidator.addValidation("phone","req","Please provide your phone number"); frmvalidator.addValidation("name","req","Please provide your name"); frmvalidator.addValidation("message","req","Please provide your message"); frmvalidator.addValidation("email","req","Please provide your email"); frmvalidator.addValidation("email","email", "Please enter a valid email address"); </script>
45.027397
150
0.591573
9379b1b1897a204a702a1e36277c016df2e45469
4,920
cs
C#
VKHotkeys/Splasher.xaml.cs
pavlexander/VKHotkeys
fdc80335c09429e8c7e2f32c7320941343634110
[ "MIT" ]
null
null
null
VKHotkeys/Splasher.xaml.cs
pavlexander/VKHotkeys
fdc80335c09429e8c7e2f32c7320941343634110
[ "MIT" ]
null
null
null
VKHotkeys/Splasher.xaml.cs
pavlexander/VKHotkeys
fdc80335c09429e8c7e2f32c7320941343634110
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Runtime.InteropServices; using System.Diagnostics; using System.Media; using System.Windows.Interop; using System.Windows.Threading; using System.Threading; namespace VKHotkeys { /// <summary> /// Interaction logic for Splasher.xaml /// </summary> public partial class Splasher : Window { //public static int[] allCards { get { return logics.allCards; } } public static Dictionary<string, string> dic_params { get { return Form1.settings; } } public static Dictionary<string, string> dic_params_splash_test { get { return Settings.dic_params_splash_test; } } public Splasher() { InitializeComponent(); } public bool checkReason(string reason) { if (reason == "1" && dic_params["splash_display_for_songs"] == "True") { return true; } //if (reason == "2" && dic_params["splash_for_profiles"] == "yes") { return true; } if (reason == "3" && dic_params["splash_display_for_lock"] == "True") { return true; } if (reason == "ex" ) { return true; } if (reason == "test") { return true; } return false; } public void LoadSplasherParams(Splasher splash, string songname, string reason) { if (checkReason(reason)) { Dictionary<string, string> usethis; if (reason == "test") { usethis = new Dictionary<string, string>(dic_params_splash_test); } else { usethis = new Dictionary<string, string>(dic_params); } splash.ShowActivated = false; int splash_time = Int32.Parse(usethis["splash_time"]); System.Drawing.Color text = System.Drawing.ColorTranslator.FromHtml("#" + usethis["splash_text"]); System.Drawing.Color bckgr = System.Drawing.ColorTranslator.FromHtml("#" + usethis["splash_background"]); System.Drawing.Color brdr = System.Drawing.ColorTranslator.FromHtml("#" + usethis["splash_border"]); int visibility = Int32.Parse(usethis["splash_visibility"]); int display_shadow; if (usethis["splash_shadow"] == "True") { display_shadow = 1; } else { display_shadow = 0; } double width = Convert.ToDouble((songname.Count() * 22)); this.c_myTextBlock.Text = songname; this.c_border1.Width = width; this.c_rectangle1.Width = width; if (width < 200) { this.Width = 300; } else { this.Width = width + 60; } this.c_shadow1.Opacity = display_shadow; System.Drawing.Color bck_color = System.Drawing.Color.FromArgb(((int)(255 * ((double)visibility / 100))), bckgr.R, bckgr.G, bckgr.B); this.c_rectangle1.Fill = ConvertToBrush(bck_color); System.Drawing.Color text_color = System.Drawing.Color.FromArgb(255, text.R, text.G, text.B); this.c_myTextBlock.Foreground = ConvertToBrush(text_color); System.Drawing.Color border_color = System.Drawing.Color.FromArgb(255, brdr.R, brdr.G, brdr.B); this.c_border1.BorderBrush = ConvertToBrush(border_color); Thread.Sleep(5); splash.Show(); StartCloseTimer(splash_time); splash.Close(); } else { //splash.Close(); } } public System.Windows.Media.Brush ConvertToBrush(System.Drawing.Color color) { System.Windows.Media.Color c2 = new System.Windows.Media.Color(); c2.A = color.A; c2.R = color.R; c2.G = color.G; c2.B = color.B; var converter = new System.Windows.Media.BrushConverter(); return (System.Windows.Media.Brush)converter.ConvertFromString(c2.ToString()); } public void StartCloseTimer(int time) { //Show(); Thread.Sleep(time - 1); } protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); // Get this window's handle IntPtr hwnd = new WindowInteropHelper(this).Handle; Win32m.makeTransparent(hwnd); } } }
33.469388
149
0.564837
a3310dab8a1146468c271f117ce4df9a361fdcf4
7,160
java
Java
jasperreports-5.6.0/src/net/sf/jasperreports/components/iconlabel/IconLabelComponent.java
Tatetaylor/kbplumbapp
3caa9b3695b1f5978adca0980afb47f0895ca652
[ "Apache-2.0" ]
null
null
null
jasperreports-5.6.0/src/net/sf/jasperreports/components/iconlabel/IconLabelComponent.java
Tatetaylor/kbplumbapp
3caa9b3695b1f5978adca0980afb47f0895ca652
[ "Apache-2.0" ]
6
2020-03-04T21:44:08.000Z
2022-03-31T18:50:46.000Z
jasperreports-5.6.0/src/net/sf/jasperreports/components/iconlabel/IconLabelComponent.java
Tatetaylor/kbplumbapp
3caa9b3695b1f5978adca0980afb47f0895ca652
[ "Apache-2.0" ]
1
2018-06-08T19:38:47.000Z
2018-06-08T19:38:47.000Z
/* * JasperReports - Free Java Reporting Library. * Copyright (C) 2001 - 2011 Jaspersoft Corporation. All rights reserved. * http://www.jaspersoft.com * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is part of JasperReports. * * JasperReports is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JasperReports 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with JasperReports. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.jasperreports.components.iconlabel; import java.awt.Color; import java.io.Serializable; import net.sf.jasperreports.engine.JRAlignment; import net.sf.jasperreports.engine.JRBoxContainer; import net.sf.jasperreports.engine.JRDefaultStyleProvider; import net.sf.jasperreports.engine.JRLineBox; import net.sf.jasperreports.engine.JRStyle; import net.sf.jasperreports.engine.JRTextField; import net.sf.jasperreports.engine.base.JRBaseLineBox; import net.sf.jasperreports.engine.base.JRBaseObjectFactory; import net.sf.jasperreports.engine.component.BaseComponentContext; import net.sf.jasperreports.engine.component.ComponentContext; import net.sf.jasperreports.engine.component.ContextAwareComponent; import net.sf.jasperreports.engine.design.JRDesignTextField; import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport; import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport; import net.sf.jasperreports.engine.type.HorizontalAlignEnum; import net.sf.jasperreports.engine.type.VerticalAlignEnum; import net.sf.jasperreports.engine.util.JRStyleResolver; /** * @author Teodor Danciu (teodord@users.sourceforge.net) * @version $Id: TextInputComponent.java 5922 2013-02-19 11:03:27Z teodord $ */ public class IconLabelComponent implements ContextAwareComponent, JRBoxContainer, JRAlignment, Serializable, JRChangeEventsSupport { /** * */ private static final long serialVersionUID = 1L; public static final String PROPERTY_ICON_POSITION = "iconPosition"; public static final String PROPERTY_LABEL_FILL = "labelFill"; public static final String PROPERTY_HORIZONTAL_ALIGNMENT = "horizontalAlignment"; public static final String PROPERTY_VERTICAL_ALIGNMENT = "verticalAlignment"; private JRLineBox lineBox; private JRTextField labelTextField; private JRTextField iconTextField; private IconPositionEnum iconPosition; private ContainerFillEnum labelFill; private HorizontalAlignEnum horizontalAlign; private VerticalAlignEnum verticalAlign; private ComponentContext context; private transient JRPropertyChangeSupport eventSupport; public IconLabelComponent(JRDefaultStyleProvider defaultStyleProvider) { lineBox = new JRBaseLineBox(this); labelTextField = new JRDesignTextField(defaultStyleProvider); iconTextField = new JRDesignTextField(defaultStyleProvider); } public IconLabelComponent(IconLabelComponent component, JRBaseObjectFactory objectFactory) { this.lineBox = component.getLineBox().clone(this); this.labelTextField = (JRTextField)objectFactory.getVisitResult(component.getLabelTextField()); this.iconTextField = (JRTextField)objectFactory.getVisitResult(component.getIconTextField()); this.iconPosition = component.getIconPosition(); this.labelFill = component.getLabelFill(); this.horizontalAlign = component.getOwnHorizontalAlignmentValue(); this.verticalAlign = component.getOwnVerticalAlignmentValue(); this.context = new BaseComponentContext(component.getContext(), objectFactory); } public void setContext(ComponentContext context) { this.context = context; } public ComponentContext getContext() { return context; } /** * */ public JRLineBox getLineBox() { return lineBox; } /** * */ public void setLineBox(JRLineBox lineBox) { this.lineBox = lineBox; } /** * */ public JRDefaultStyleProvider getDefaultStyleProvider() { return context == null ? null : context.getComponentElement().getDefaultStyleProvider(); } /** * */ public JRStyle getStyle() { return context == null ? null : context.getComponentElement().getStyle(); } /** * */ public String getStyleNameReference() { return context == null ? null : context.getComponentElement().getStyleNameReference(); } /** * */ public Color getDefaultLineColor() { return Color.black; } /** * */ public JRTextField getLabelTextField() { return labelTextField; } /** * */ public void setLabelTextField(JRTextField labelTextField) { this.labelTextField = labelTextField; } /** * */ public JRTextField getIconTextField() { return iconTextField; } /** * */ public void setIconTextField(JRTextField iconTextField) { this.iconTextField = iconTextField; } /** * */ public IconPositionEnum getIconPosition() { return iconPosition; } /** * */ public void setIconPosition(IconPositionEnum iconPosition) { IconPositionEnum old = this.iconPosition; this.iconPosition = iconPosition; getEventSupport().firePropertyChange(PROPERTY_ICON_POSITION, old, this.iconPosition); } /** * */ public HorizontalAlignEnum getHorizontalAlignmentValue() { return JRStyleResolver.getHorizontalAlignmentValue(this); } /** * */ public HorizontalAlignEnum getOwnHorizontalAlignmentValue() { return horizontalAlign; } /** * */ public void setHorizontalAlignment(HorizontalAlignEnum horizontalAlign) { HorizontalAlignEnum old = this.horizontalAlign; this.horizontalAlign = horizontalAlign; getEventSupport().firePropertyChange(PROPERTY_HORIZONTAL_ALIGNMENT, old, this.horizontalAlign); } /** * */ public VerticalAlignEnum getVerticalAlignmentValue() { return JRStyleResolver.getVerticalAlignmentValue(this); } /** * */ public VerticalAlignEnum getOwnVerticalAlignmentValue() { return verticalAlign; } /** * */ public void setVerticalAlignment(VerticalAlignEnum verticalAlign) { VerticalAlignEnum old = this.verticalAlign; this.verticalAlign = verticalAlign; getEventSupport().firePropertyChange(PROPERTY_VERTICAL_ALIGNMENT, old, this.verticalAlign); } /** * */ public ContainerFillEnum getLabelFill() { return labelFill; } /** * */ public void setLabelFill(ContainerFillEnum labelFill) { ContainerFillEnum old = this.labelFill; this.labelFill = labelFill; getEventSupport().firePropertyChange(PROPERTY_LABEL_FILL, old, this.labelFill); } /** * */ public JRPropertyChangeSupport getEventSupport() { synchronized (this) { if (eventSupport == null) { eventSupport = new JRPropertyChangeSupport(this); } } return eventSupport; } }
24.604811
131
0.760475
7acbdc810c71bd8e6fb52b8dfc498d2dfcdf428a
980
cs
C#
src/Cosmos.Business.Extensions.Holiday/Cosmos/Business/Extensions/Holiday/Definitions/Europe/Belgium/Commemoration/SaintNicholas.cs
cosmos-open/cosmos-holiday
ced7df073e703e1ecc116c82e2a9efcda1457de3
[ "Apache-2.0" ]
null
null
null
src/Cosmos.Business.Extensions.Holiday/Cosmos/Business/Extensions/Holiday/Definitions/Europe/Belgium/Commemoration/SaintNicholas.cs
cosmos-open/cosmos-holiday
ced7df073e703e1ecc116c82e2a9efcda1457de3
[ "Apache-2.0" ]
2
2019-09-16T08:53:07.000Z
2019-11-25T09:15:50.000Z
src/Cosmos.Business.Extensions.Holiday/Cosmos/Business/Extensions/Holiday/Definitions/Europe/Belgium/Commemoration/SaintNicholas.cs
cosmos-open/Holiday
ced7df073e703e1ecc116c82e2a9efcda1457de3
[ "Apache-2.0" ]
null
null
null
using Cosmos.Business.Extensions.Holiday.Core; using Cosmos.I18N.Countries; namespace Cosmos.Business.Extensions.Holiday.Definitions.Europe.Belgium.Commemoration { /// <summary> /// Saint Nicholas /// </summary> public class SaintNicholas : BaseFixedHolidayFunc { /// <inheritdoc /> public override Country Country { get; } = Country.Belgium; /// <inheritdoc /> public override Country BelongsToCountry { get; } = Country.Belgium; /// <inheritdoc /> public override string Name { get; } = "Saint Nicholas"; /// <inheritdoc /> public override HolidayType HolidayType { get; set; } = HolidayType.Commemoration; /// <inheritdoc /> public override int Month { get; set; } = 12; /// <inheritdoc /> public override int Day { get; set; } = 6; /// <inheritdoc /> public override string I18NIdentityCode { get; } = "i18n_holiday_be_nicholas"; } }
30.625
90
0.619388
8526633b3d1187fcc111f5155de14266420df385
8,423
cs
C#
sdk/src/Services/AutoScaling/Generated/Model/InstancesDistribution.cs
PureKrome/aws-sdk-net
e62bda0394a18c40d82a7990650b0714db57397c
[ "Apache-2.0" ]
1
2020-12-21T09:21:28.000Z
2020-12-21T09:21:28.000Z
sdk/src/Services/AutoScaling/Generated/Model/InstancesDistribution.cs
PureKrome/aws-sdk-net
e62bda0394a18c40d82a7990650b0714db57397c
[ "Apache-2.0" ]
1
2020-12-22T00:42:26.000Z
2021-02-06T22:03:13.000Z
sdk/src/Services/AutoScaling/Generated/Model/InstancesDistribution.cs
PureKrome/aws-sdk-net
e62bda0394a18c40d82a7990650b0714db57397c
[ "Apache-2.0" ]
null
null
null
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the autoscaling-2011-01-01.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.AutoScaling.Model { /// <summary> /// Describes an instances distribution for an Auto Scaling group with a <a>MixedInstancesPolicy</a>. /// /// /// <para> /// The instances distribution specifies the distribution of On-Demand Instances and Spot /// Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group /// allocates instance types to fulfill On-Demand and Spot capacities. /// </para> /// /// <para> /// When you update <code>SpotAllocationStrategy</code>, <code>SpotInstancePools</code>, /// or <code>SpotMaxPrice</code>, this update action does not deploy any changes across /// the running Amazon EC2 instances in the group. Your existing Spot Instances continue /// to run as long as the maximum price for those instances is higher than the current /// Spot price. When scale out occurs, Amazon EC2 Auto Scaling launches instances based /// on the new settings. When scale in occurs, Amazon EC2 Auto Scaling terminates instances /// according to the group's termination policies. /// </para> /// </summary> public partial class InstancesDistribution { private string _onDemandAllocationStrategy; private int? _onDemandBaseCapacity; private int? _onDemandPercentageAboveBaseCapacity; private string _spotAllocationStrategy; private int? _spotInstancePools; private string _spotMaxPrice; /// <summary> /// Gets and sets the property OnDemandAllocationStrategy. /// <para> /// Indicates how to allocate instance types to fulfill On-Demand capacity. The only valid /// value is <code>prioritized</code>, which is also the default value. This strategy /// uses the order of instance types in the overrides to define the launch priority of /// each instance type. The first instance type in the array is prioritized higher than /// the last. If all your On-Demand capacity cannot be fulfilled using your highest priority /// instance, then the Auto Scaling groups launches the remaining capacity using the second /// priority instance type, and so on. /// </para> /// </summary> public string OnDemandAllocationStrategy { get { return this._onDemandAllocationStrategy; } set { this._onDemandAllocationStrategy = value; } } // Check to see if OnDemandAllocationStrategy property is set internal bool IsSetOnDemandAllocationStrategy() { return this._onDemandAllocationStrategy != null; } /// <summary> /// Gets and sets the property OnDemandBaseCapacity. /// <para> /// The minimum amount of the Auto Scaling group's capacity that must be fulfilled by /// On-Demand Instances. This base portion is provisioned first as your group scales. /// Defaults to 0 if not specified. If you specify weights for the instance types in the /// overrides, set the value of <code>OnDemandBaseCapacity</code> in terms of the number /// of capacity units, and not the number of instances. /// </para> /// </summary> public int OnDemandBaseCapacity { get { return this._onDemandBaseCapacity.GetValueOrDefault(); } set { this._onDemandBaseCapacity = value; } } // Check to see if OnDemandBaseCapacity property is set internal bool IsSetOnDemandBaseCapacity() { return this._onDemandBaseCapacity.HasValue; } /// <summary> /// Gets and sets the property OnDemandPercentageAboveBaseCapacity. /// <para> /// Controls the percentages of On-Demand Instances and Spot Instances for your additional /// capacity beyond <code>OnDemandBaseCapacity</code>. Expressed as a number (for example, /// 20 specifies 20% On-Demand Instances, 80% Spot Instances). Defaults to 100 if not /// specified. If set to 100, only On-Demand Instances are provisioned. /// </para> /// </summary> public int OnDemandPercentageAboveBaseCapacity { get { return this._onDemandPercentageAboveBaseCapacity.GetValueOrDefault(); } set { this._onDemandPercentageAboveBaseCapacity = value; } } // Check to see if OnDemandPercentageAboveBaseCapacity property is set internal bool IsSetOnDemandPercentageAboveBaseCapacity() { return this._onDemandPercentageAboveBaseCapacity.HasValue; } /// <summary> /// Gets and sets the property SpotAllocationStrategy. /// <para> /// Indicates how to allocate instances across Spot Instance pools. If the allocation /// strategy is <code>capacity-optimized</code> (recommended), the Auto Scaling group /// launches instances using Spot pools that are optimally chosen based on the available /// Spot capacity. If the allocation strategy is <code>lowest-price</code>, the Auto Scaling /// group launches instances using the Spot pools with the lowest price, and evenly allocates /// your instances across the number of Spot pools that you specify. Defaults to <code>lowest-price</code> /// if not specified. /// </para> /// </summary> public string SpotAllocationStrategy { get { return this._spotAllocationStrategy; } set { this._spotAllocationStrategy = value; } } // Check to see if SpotAllocationStrategy property is set internal bool IsSetSpotAllocationStrategy() { return this._spotAllocationStrategy != null; } /// <summary> /// Gets and sets the property SpotInstancePools. /// <para> /// The number of Spot Instance pools across which to allocate your Spot Instances. The /// Spot pools are determined from the different instance types in the overrides. Valid /// only when the Spot allocation strategy is <code>lowest-price</code>. Value must be /// in the range of 1 to 20. Defaults to 2 if not specified. /// </para> /// </summary> public int SpotInstancePools { get { return this._spotInstancePools.GetValueOrDefault(); } set { this._spotInstancePools = value; } } // Check to see if SpotInstancePools property is set internal bool IsSetSpotInstancePools() { return this._spotInstancePools.HasValue; } /// <summary> /// Gets and sets the property SpotMaxPrice. /// <para> /// The maximum price per unit hour that you are willing to pay for a Spot Instance. If /// you leave the value at its default (empty), Amazon EC2 Auto Scaling uses the On-Demand /// price as the maximum Spot price. To remove a value that you previously set, include /// the property but specify an empty string ("") for the value. /// </para> /// </summary> [AWSProperty(Min=0, Max=255)] public string SpotMaxPrice { get { return this._spotMaxPrice; } set { this._spotMaxPrice = value; } } // Check to see if SpotMaxPrice property is set internal bool IsSetSpotMaxPrice() { return this._spotMaxPrice != null; } } }
43.194872
114
0.652618
db72156b84b132cfa9f8d0e373f1e64af18dde77
2,719
php
PHP
src/AppBundle/Action/GameReport/Update/GameReportUpdateView.php
cerad/ng2016
4cb7640184f7f4e22e8453cd783446d8ff5920fe
[ "MIT" ]
4
2016-03-25T23:24:17.000Z
2020-03-09T14:10:13.000Z
src/AppBundle/Action/GameReport/Update/GameReportUpdateView.php
cerad/ng2016
4cb7640184f7f4e22e8453cd783446d8ff5920fe
[ "MIT" ]
144
2016-03-25T21:29:38.000Z
2019-07-07T23:57:33.000Z
src/AppBundle/Action/GameReport/Update/GameReportUpdateView.php
cerad/ng2016
4cb7640184f7f4e22e8453cd783446d8ff5920fe
[ "MIT" ]
null
null
null
<?php namespace AppBundle\Action\GameReport\Update; use AppBundle\Action\AbstractView2; use Symfony\Component\HttpFoundation\Request; class GameReportUpdateView extends AbstractView2 { /** @var GameReportUpdateForm */ private $form; private $project; public function __construct(GameReportUpdateForm $form) { $this->form = $form; } public function __invoke(Request $request) { $this->project = $this->getCurrentProjectInfo(); return $this->newResponse($this->render()); } private function render() { $content = <<<EOD {$this->form->render()} <br /> {$this->renderScoringNotes()} EOD; return $this->renderBaseTemplate($content); } private function renderScoringNotes() { return <<<EOD <legend class="text-left">Scoring Notes</legend> <div class="app_table" id="notes"> <table> <tbody> <tr> <td width="10%"></td> <td style="vertical-align: top;" width="35%"> <ul> <li>Enter score and other info then click "Save"</li> <li>Status fields will update themselves</li> <br><br> <li><strong>NOTE:</strong> Six points for proper participation in Soccerfest are added separately</li> </ul> </td> <td width="35%"> <ul> <li>Points earned will be calculated</li> <li>Win: 6 pts / Tie: 3 pts / Shutout: 1 pt</li> <li>For winner only: 1 pt per goal (3 pts max) <li>Player Cautions: No impact</li> <li>Player Sendoffs: -1 pt per sendoff</li> <li>Coach/Substitute/Spectator Ejections: -1 pt per ejection</li> <li>FORFEIT: Score as 1-0</li> </ul> </td> <td width="10%"></td> </tr> <tr><td>&nbsp;</td></tr> <tr> <td width="10%"></td> <td style="vertical-align: top;" width="35%" colspan=2> <ul class="ul_bullets"> <li>For help with Match Reporting, contact {$this->project['support']['name']} at <a href="mailto:{$this->project['support']['email']}">{$this->project['support']['email']}</a> or at {$this->project['support']['phone']}</li> <li>For help with Schedule Management, contact {$this->project['schedules']['name']} at <a href="mailto:{$this->project['schedules']['email']}">{$this->project['schedules']['email']}</a> or at {$this->project['schedules']['phone']}</li> <li>For help with Account Management, contact {$this->project['support']['name']} at <a href="mailto:{$this->project['support']['email']}">{$this->project['support']['email']}</a> or at {$this->project['support']['phone']}</li> </ul> </td> </tr> </tbody> </table> </div> EOD; } }
33.158537
246
0.588452
1a38e0b3cdd1ed4c39d704e4d95f4f19cd4da050
226
py
Python
homeassistant/components/xbox/const.py
tbarbette/core
8e58c3aa7bc8d2c2b09b6bd329daa1c092d52d3c
[ "Apache-2.0" ]
30,023
2016-04-13T10:17:53.000Z
2020-03-02T12:56:31.000Z
homeassistant/components/xbox/const.py
jagadeeshvenkatesh/core
1bd982668449815fee2105478569f8e4b5670add
[ "Apache-2.0" ]
31,101
2020-03-02T13:00:16.000Z
2022-03-31T23:57:36.000Z
homeassistant/components/xbox/const.py
jagadeeshvenkatesh/core
1bd982668449815fee2105478569f8e4b5670add
[ "Apache-2.0" ]
11,956
2016-04-13T18:42:31.000Z
2020-03-02T09:32:12.000Z
"""Constants for the xbox integration.""" DOMAIN = "xbox" OAUTH2_AUTHORIZE = "https://login.live.com/oauth20_authorize.srf" OAUTH2_TOKEN = "https://login.live.com/oauth20_token.srf" EVENT_NEW_FAVORITE = "xbox/new_favorite"
25.111111
65
0.761062
b1403378ea26bfc5476a7691f342e1382acebcea
1,703
sql
SQL
database_scripts/install/090_docker_compose.sql
guoci/limelight-core
6ce269903ebc5948dd844047d5a2b5580fdc5432
[ "Apache-2.0" ]
3
2019-02-21T21:23:04.000Z
2021-07-12T18:30:03.000Z
database_scripts/install/090_docker_compose.sql
guoci/limelight-core
6ce269903ebc5948dd844047d5a2b5580fdc5432
[ "Apache-2.0" ]
5
2020-11-13T01:30:36.000Z
2021-11-24T22:18:53.000Z
database_scripts/install/090_docker_compose.sql
guoci/limelight-core
6ce269903ebc5948dd844047d5a2b5580fdc5432
[ "Apache-2.0" ]
3
2021-01-31T18:42:54.000Z
2021-07-11T20:33:07.000Z
USE limelight ; -- Some initial system config for running inside docker via official docker compose file INSERT INTO config_system_tbl (config_key, config_value) VALUES ('spectral_storage_service_accept_import_base_url', 'http://spectr:8080/spectral_storage_accept_import'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('spectral_storage_service_get_data_base_url', 'http://spectr:8080/spectral_storage_get_data'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('email_from_address', ''); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('email_smtp_server_host', 'smtp'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('footer_center_of_page_html', 'Limelight Docker created by Michael Riffle (<a href="mailto:mriffle@uw.edu" target="_top">mriffle@uw.edu</a>)'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('file_import_limelight_xml_scans_temp_dir', '/data/limelight_upload'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('scan_file_import_allowed_via_web_submit', 'true'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('import_delete_uploaded_files_after_import', 'true'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('run_import_extra_emails_to_send_to', 'root@localhost'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('admin_email_address', 'root@localhost'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('run_import_failed_status_extra_emails_to_send_to', 'root@localhost'); INSERT INTO config_system_tbl (config_key, config_value) VALUES ('submit_import_received_emails_to_send_to', 'root@localhost');
100.176471
208
0.828538
20d1ada5c6848f5fbfc12465134bbcba224b4704
1,393
dart
Dart
lib/src/go_router_cupertino.dart
peerwaya/go_router
24e30d898627d79a82492fdff622aa0c07abdbed
[ "BSD-3-Clause" ]
null
null
null
lib/src/go_router_cupertino.dart
peerwaya/go_router
24e30d898627d79a82492fdff622aa0c07abdbed
[ "BSD-3-Clause" ]
null
null
null
lib/src/go_router_cupertino.dart
peerwaya/go_router
24e30d898627d79a82492fdff622aa0c07abdbed
[ "BSD-3-Clause" ]
null
null
null
// ignore_for_file: diagnostic_describe_all_properties import 'package:flutter/cupertino.dart'; import '../go_router.dart'; /// Checks for CupertinoApp in the widget tree. bool isCupertinoApp(Element elem) => elem.findAncestorWidgetOfExactType<CupertinoApp>() != null; /// Builds a Cupertino page. CupertinoPage<void> pageBuilderForCupertinoApp( LocalKey key, String restorationId, Widget child, ) => CupertinoPage<void>( key: key, restorationId: restorationId, child: child, ); /// Default error page implementation for Cupertino. class GoRouterCupertinoErrorScreen extends StatelessWidget { /// Provide an exception to this page for it to be displayed. const GoRouterCupertinoErrorScreen(this.error, {Key? key}) : super(key: key); /// The exception to be displayed. final Exception? error; @override Widget build(BuildContext context) => CupertinoPageScaffold( navigationBar: const CupertinoNavigationBar(middle: Text('Page Not Found')), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text(error?.toString() ?? 'page not found'), CupertinoButton( onPressed: () => context.go('/'), child: const Text('Home'), ), ], ), ), ); }
29.020833
79
0.642498
20c0b4e5babb472e0da06de4c115227a275cc54e
997
py
Python
python/get_reg_area_avg_rmse.py
E3SM-Project/a-prime
a8c084ab6f727904a2b38d8a93b9c83e2f978e3f
[ "BSD-3-Clause" ]
1
2017-06-07T13:13:32.000Z
2017-06-07T13:13:32.000Z
python/get_reg_area_avg_rmse.py
ACME-Climate/a-prime
a8c084ab6f727904a2b38d8a93b9c83e2f978e3f
[ "BSD-3-Clause" ]
31
2017-06-07T00:26:58.000Z
2018-04-09T17:03:15.000Z
python/get_reg_area_avg_rmse.py
ACME-Climate/a-prime
a8c084ab6f727904a2b38d8a93b9c83e2f978e3f
[ "BSD-3-Clause" ]
1
2018-08-05T23:43:59.000Z
2018-08-05T23:43:59.000Z
# # Copyright (c) 2017, UT-BATTELLE, LLC # All rights reserved. # # This software is released under the BSD license detailed # in the LICENSE file in the top level a-prime directory # import numpy def get_reg_area_avg_rmse(field, lat, lon, area_wgts, debug = False): nlon = lon.shape[0] nlat = lat.shape[0] if field.ndim == 2: nt = 1 else: nt = field.shape[0] if debug: print __name__, 'nlon, nlat: ', nlon, nlat area_average_rmse = numpy.zeros(nt) if field.ndim == 2: area_average_rmse[0] = numpy.sqrt(numpy.sum(numpy.power(field[:, :], 2.0) * area_wgts[:, :])/numpy.sum(area_wgts)) else: for i in range(0,nt): area_average_rmse[i] = numpy.sqrt(numpy.sum(numpy.power(field[i, :, :], 2.0) * area_wgts[:, :])/numpy.sum(area_wgts)) print __name__, 'area_average_rmse.shape: ', area_average_rmse.shape if debug: print __name__, 'area weighted total_field: ', area_average_rmse return area_average_rmse
29.323529
129
0.652959
c794a3eea5a5a34740123c01e3f91d819e82ccde
487
sql
SQL
common/from_reiwa.sql
ujnak/JPCOVIT19ETL
e8e76a77070051c76bfc171b95abf561e2ac1b6f
[ "MIT" ]
1
2020-07-19T08:20:56.000Z
2020-07-19T08:20:56.000Z
common/from_reiwa.sql
ujnak/JPCOVIT19ETL
e8e76a77070051c76bfc171b95abf561e2ac1b6f
[ "MIT" ]
null
null
null
common/from_reiwa.sql
ujnak/JPCOVIT19ETL
e8e76a77070051c76bfc171b95abf561e2ac1b6f
[ "MIT" ]
null
null
null
/* * 令和による年月日表示からDATEに変換する * データベースに令和の対応がないケースに対応。 */ create or replace function "FROM_REIWA" (p_string_date in VARCHAR2) return DATE is l_date varchar2(80); begin l_date := to_char ( to_number ( substr ( p_string_date, 3, instr(p_string_date,'年')-3 ) )+2018, '9999' ) || substr(p_string_date, instr(p_string_date,'年')); return to_date(l_date,'YYYY"年"MM"月"DD"日"'); end; /
16.233333
53
0.558522
33df70fea7a3202969d67525456461d0870df6c8
1,332
h
C
IfcPlusPlus/src/ifcpp/IFC4/include/IfcPileConstructionEnum.h
skrat/ifcplusplus
1e65d8e0d5e3365d4d1da399081ffaa78fd8a486
[ "MIT" ]
7
2018-03-07T06:51:41.000Z
2020-05-22T08:32:54.000Z
IfcPlusPlus/src/ifcpp/IFC4/include/IfcPileConstructionEnum.h
skrat/ifcplusplus
1e65d8e0d5e3365d4d1da399081ffaa78fd8a486
[ "MIT" ]
1
2019-03-06T08:59:24.000Z
2019-03-06T08:59:24.000Z
IfcPlusPlus/src/ifcpp/IFC4/include/IfcPileConstructionEnum.h
skrat/ifcplusplus
1e65d8e0d5e3365d4d1da399081ffaa78fd8a486
[ "MIT" ]
8
2018-05-02T20:16:07.000Z
2021-06-10T03:06:04.000Z
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */ #pragma once #include <vector> #include <map> #include <sstream> #include <string> #include "ifcpp/model/GlobalDefines.h" #include "ifcpp/model/BasicTypes.h" #include "ifcpp/model/BuildingObject.h" // TYPE IfcPileConstructionEnum = ENUMERATION OF (CAST_IN_PLACE ,COMPOSITE ,PRECAST_CONCRETE ,PREFAB_STEEL ,USERDEFINED ,NOTDEFINED); class IFCQUERY_EXPORT IfcPileConstructionEnum : virtual public BuildingObject { public: enum IfcPileConstructionEnumEnum { ENUM_CAST_IN_PLACE, ENUM_COMPOSITE, ENUM_PRECAST_CONCRETE, ENUM_PREFAB_STEEL, ENUM_USERDEFINED, ENUM_NOTDEFINED }; IfcPileConstructionEnum() = default; IfcPileConstructionEnum( IfcPileConstructionEnumEnum e ) { m_enum = e; } ~IfcPileConstructionEnum() = default; virtual const char* className() const { return "IfcPileConstructionEnum"; } virtual shared_ptr<BuildingObject> getDeepCopy( BuildingCopyOptions& options ); virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const; virtual const std::wstring toString() const; static shared_ptr<IfcPileConstructionEnum> createObjectFromSTEP( const std::wstring& arg, const std::map<int,shared_ptr<BuildingEntity> >& map ); IfcPileConstructionEnumEnum m_enum; };
36
147
0.773273