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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b40338d912bedd5fff3e1b4d636e586d6b5bb437 | 601 | dart | Dart | test/unit/latlong/sexagesimal_test.dart | DavBfr/dart-latlong | cb72fc8a85de0a4e6c2cd347e0e4a94cfed14edf | [
"Apache-2.0"
] | null | null | null | test/unit/latlong/sexagesimal_test.dart | DavBfr/dart-latlong | cb72fc8a85de0a4e6c2cd347e0e4a94cfed14edf | [
"Apache-2.0"
] | null | null | null | test/unit/latlong/sexagesimal_test.dart | DavBfr/dart-latlong | cb72fc8a85de0a4e6c2cd347e0e4a94cfed14edf | [
"Apache-2.0"
] | null | null | null | import 'package:latlong/latlong.dart';
import 'package:test/test.dart';
Future<void> main() async {
group('Sexagesimal', () {
setUp(() {});
test('> decimal2sexagesimal', () {
final sexa1 = decimal2sexagesimal(51.519475);
final sexa2 = decimal2sexagesimal(-19.37555556);
final sexa3 = decimal2sexagesimal(50.0);
expect(sexa1, '51° 31\' 10.11"');
expect(sexa2, '19° 22\' 32.00"');
expect(sexa3, '50° 0\' 0.00"');
final p1 = LatLng(51.519475, -19.37555556);
expect(p1.toSexagesimal(), '51° 31\' 10.11" N, 19° 22\' 32.00" W');
});
});
}
| 27.318182 | 73 | 0.585691 |
716ba4d358952188bba754876f02bc7bab4677c4 | 730 | ts | TypeScript | scenes/src/app/scenes/grid-list/grid-list-scene.ts | gnucoop/docs.ajf.rocks | d36582c92a0e1b698d1b9ca03732118863b5fc99 | [
"MIT"
] | 868 | 2016-11-16T22:46:36.000Z | 2022-03-19T15:54:00.000Z | scenes/src/app/scenes/grid-list/grid-list-scene.ts | gnucoop/docs.ajf.rocks | d36582c92a0e1b698d1b9ca03732118863b5fc99 | [
"MIT"
] | 614 | 2016-11-16T16:51:44.000Z | 2022-03-22T17:45:09.000Z | scenes/src/app/scenes/grid-list/grid-list-scene.ts | gnucoop/docs.ajf.rocks | d36582c92a0e1b698d1b9ca03732118863b5fc99 | [
"MIT"
] | 517 | 2016-11-16T16:45:50.000Z | 2022-03-21T06:31:42.000Z | import {CommonModule} from '@angular/common';
import {Component, NgModule, ViewEncapsulation} from '@angular/core';
import {MatGridListModule} from '@angular/material/grid-list';
@Component({
selector: 'app-grid-list-scene',
templateUrl: './grid-list-scene.html',
styleUrls: ['./grid-list-scene.scss'],
encapsulation: ViewEncapsulation.None,
})
export class GridListScene {
tiles = [
{cols: 3, rows: 1, color: '#f11'},
{cols: 1, rows: 2, color: '#f77'},
{cols: 1, rows: 1, color: '#c11'},
{cols: 2, rows: 1, color: '#d66'},
];
}
@NgModule({
imports: [
MatGridListModule,
CommonModule
],
exports: [GridListScene],
declarations: [GridListScene],
})
export class GridListSceneModule {}
| 24.333333 | 69 | 0.658904 |
f02925a066c59949b5a8b4cda912b76b76448958 | 499 | js | JavaScript | app/js/components/ui/formDropdownOption.js | fossabot/Motwo | a4df56b59b15ec315b395ddac78bdf61bfe79d11 | [
"MIT"
] | null | null | null | app/js/components/ui/formDropdownOption.js | fossabot/Motwo | a4df56b59b15ec315b395ddac78bdf61bfe79d11 | [
"MIT"
] | 1 | 2019-10-22T06:03:39.000Z | 2019-10-22T06:03:39.000Z | app/js/components/ui/formDropdownOption.js | fossabot/Motwo | a4df56b59b15ec315b395ddac78bdf61bfe79d11 | [
"MIT"
] | 1 | 2019-10-22T06:00:29.000Z | 2019-10-22T06:00:29.000Z | import React from 'react';
import radium from 'radium';
import theme from '../../utils/theme';
@theme
@radium
export default class FormDropdownOption extends React.Component {
getStyle() {
return {
width: '100%',
padding: '15px',
marginBottom: '-1px',
background: this.props.getThemeProp('formDropdownOptionBackground'),
':hover': {
filter: 'brightness(0.9)'
}
}
}
render() {
return (
<div style={this.getStyle()}>
{this.props.children}
</div>
);
}
} | 17.206897 | 71 | 0.635271 |
c7d2af625d021a02f98075fff1dd19eea5e57941 | 1,496 | py | Python | examples/plotting/file/slider.py | goncaloperes/bokeh | b857d2d17d7c19779bb0a7be2601d8238fb1d5e9 | [
"BSD-3-Clause"
] | 1 | 2021-10-30T00:32:00.000Z | 2021-10-30T00:32:00.000Z | examples/plotting/file/slider.py | Deng-Fankang/bokeh | 894731860c53b7c9ddd0057dee85cf064278dc0e | [
"BSD-3-Clause"
] | 12 | 2020-08-26T20:19:29.000Z | 2020-08-26T20:19:52.000Z | examples/plotting/file/slider.py | Deng-Fankang/bokeh | 894731860c53b7c9ddd0057dee85cf064278dc0e | [
"BSD-3-Clause"
] | 2 | 2021-01-12T18:22:24.000Z | 2021-10-30T00:32:02.000Z | import numpy as np
from bokeh.layouts import column, row
from bokeh.models import CustomJS, Slider
from bokeh.plotting import ColumnDataSource, figure, output_file, show
x = np.linspace(0, 10, 500)
y = np.sin(x)
source = ColumnDataSource(data=dict(x=x, y=y))
plot = figure(y_range=(-10, 10), plot_width=400, plot_height=400)
plot.line('x', 'y', source=source, line_width=3, line_alpha=0.6)
amp_slider = Slider(start=0.1, end=10, value=1, step=.1, title="Amplitude")
freq_slider = Slider(start=0.1, end=10, value=1, step=.1, title="Frequency")
phase_slider = Slider(start=0, end=6.4, value=0, step=.1, title="Phase")
offset_slider = Slider(start=-5, end=5, value=0, step=.1, title="Offset")
callback = CustomJS(args=dict(source=source, amp=amp_slider, freq=freq_slider, phase=phase_slider, offset=offset_slider),
code="""
const data = source.data;
const A = amp.value;
const k = freq.value;
const phi = phase.value;
const B = offset.value;
const x = data['x']
const y = data['y']
for (var i = 0; i < x.length; i++) {
y[i] = B + A*Math.sin(k*x[i]+phi);
}
source.change.emit();
""")
amp_slider.js_on_change('value', callback)
freq_slider.js_on_change('value', callback)
phase_slider.js_on_change('value', callback)
offset_slider.js_on_change('value', callback)
layout = row(
plot,
column(amp_slider, freq_slider, phase_slider, offset_slider),
)
output_file("slider.html", title="slider.py example")
show(layout)
| 30.530612 | 121 | 0.682487 |
9060f5fe95a0d26d30ab32069ad53c4eb0170100 | 147 | kt | Kotlin | app/src/main/java/com/odhiambopaul/movie/data/entity/Rating.kt | paulodhiambo/MovieApp | 006a2bbe5fd1e128ca34c660d41fbab63b826013 | [
"Unlicense"
] | 4 | 2020-04-27T19:36:19.000Z | 2021-09-19T07:35:16.000Z | app/src/main/java/com/odhiambopaul/movie/data/entity/Rating.kt | paulodhiambo/MovieApp | 006a2bbe5fd1e128ca34c660d41fbab63b826013 | [
"Unlicense"
] | 1 | 2020-05-06T15:46:03.000Z | 2020-05-06T15:46:46.000Z | app/src/main/java/com/odhiambopaul/movie/data/entity/Rating.kt | paulodhiambo/MovieApp | 006a2bbe5fd1e128ca34c660d41fbab63b826013 | [
"Unlicense"
] | 4 | 2020-05-06T16:56:32.000Z | 2022-02-09T03:38:30.000Z | package com.odhiambopaul.movie.data.entity
data class Rating(
val Source: String, // Internet Movie Database
val Value: String // 6.5/10
) | 24.5 | 50 | 0.721088 |
651245d2b7bd196161bc96e3a36e7b01a5a11759 | 1,047 | swift | Swift | JLKit/Extensions/UIKit/UINavigationBar+JLExtension.swift | jangsy7883/JLKit_Swift | 21743b52752f6efb7faa3890a615d54c7871690c | [
"MIT"
] | 1 | 2018-09-05T04:31:13.000Z | 2018-09-05T04:31:13.000Z | JLKit/Extensions/UIKit/UINavigationBar+JLExtension.swift | jangsy7883/JLKit_Swift | 21743b52752f6efb7faa3890a615d54c7871690c | [
"MIT"
] | null | null | null | JLKit/Extensions/UIKit/UINavigationBar+JLExtension.swift | jangsy7883/JLKit_Swift | 21743b52752f6efb7faa3890a615d54c7871690c | [
"MIT"
] | null | null | null | //
// UINavigationBar+JLExtension.swift
// JLKit_Swift
//
// Created by Jangsy on 2018. 7. 3..
// Copyright © 2018년 Dalkomm. All rights reserved.
//
#if os(iOS)
import UIKit
extension UINavigationBar {
public var titleTintColor: UIColor? {
set {
var attributes: [NSAttributedString.Key: Any]?
if titleTextAttributes != nil {
attributes = titleTextAttributes
} else {
let navigationBar = UINavigationBar.appearance()
if navigationBar.titleTextAttributes != nil {
attributes = navigationBar.titleTextAttributes
} else {
attributes = [NSAttributedString.Key: Any]()
}
}
attributes?[.foregroundColor] = newValue
titleTextAttributes = attributes
}
get {
if let color = titleTextAttributes?[.foregroundColor] as? UIColor {
return color
}
return nil
}
}
}
#endif
| 26.846154 | 79 | 0.547278 |
9ae52ec3e2e73c0175a38945c9be9b1ff4b67c20 | 2,236 | swift | Swift | Tumblr/General/Snippet/Optional+Snippet.swift | CepheusSun/TumblrClient | 3cb6ce0ba6a0b75c6b340a769259df863e6e6722 | [
"MIT"
] | null | null | null | Tumblr/General/Snippet/Optional+Snippet.swift | CepheusSun/TumblrClient | 3cb6ce0ba6a0b75c6b340a769259df863e6e6722 | [
"MIT"
] | null | null | null | Tumblr/General/Snippet/Optional+Snippet.swift | CepheusSun/TumblrClient | 3cb6ce0ba6a0b75c6b340a769259df863e6e6722 | [
"MIT"
] | null | null | null | //
// Optional+Snippet.swift
// Snippet
//
// Created by sunny on 2017/11/12.
// Copyright © 2017年 CepheusSun. All rights reserved.
//
import Foundation
public extension Optional {
/// 强制要求这个 optional 不为空
///
/// 这个方法返回 optional 的值,或者在optional 为空的时候触发 error
///
///
/// - Parameters:
/// - hint: 为空抛出的错误信息
///
/// - Returns: optional 的值.
func require(hint hintExpression: @autoclosure() -> String? = nil,
file: StaticString = #file,
line: UInt = #line) -> Wrapped {
guard let unwrapped = self else {
var message = "required value was nil \(file), at line \(line)"
if let hint = hintExpression() {
message.append(". Debugging hit: \(hint)")
}
#if !os(Linux)
let exception = NSException(name: .invalidArgumentException,
reason: message,
userInfo: nil)
exception.raise()
#endif
preconditionFailure(message)
}
return unwrapped
}
@discardableResult
func ifSome(_ handler: (Wrapped) -> Void) -> Optional {
switch self {
case .some(let wrapped): handler(wrapped); return self;
case .none: return self
}
}
@discardableResult
func ifNone(_ handler: () -> ()) -> Optional {
switch self {
case .some: return self;
case .none: handler(); return self
}
}
var not: Bool {
switch self {
case .none: return false
case .some(let wrapped):
if let value = wrapped as? Bool {
return !value
} else {
return false
}
}
}
var hasSome: Bool {
switch self {
case .none: return false
case .some: return true
}
}
/// 用来代替 ?? 操作符, 这样写可读性高些
///
/// - Sample:
// var a: String? = nil
// let res = a.or("b")
func `or`(_ value: Wrapped) -> Wrapped {
return self ?? value
}
}
extension Bool {
var not: Bool {
return !self
}
}
| 21.5 | 75 | 0.484794 |
2da8d09401a9c22ac86ba5011480a2c183d1b0e4 | 711 | html | HTML | useful-functions/index.html | herculeseduardo/my-javascript-utilities | 9964abe4c4d3b227df291edd1063ed4caa1f573d | [
"MIT"
] | null | null | null | useful-functions/index.html | herculeseduardo/my-javascript-utilities | 9964abe4c4d3b227df291edd1063ed4caa1f573d | [
"MIT"
] | null | null | null | useful-functions/index.html | herculeseduardo/my-javascript-utilities | 9964abe4c4d3b227df291edd1063ed4caa1f573d | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>utilities</title>
</head>
<body>
<p>It works!</p>
<img id="img"/>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="./getBase64FromImageUrl.js"></script>
<script>
$(document).ready(function() {
$('#img').attr('src', getBase64FromImageUrl('https://www.gravatar.com/avatar/d50c83cc0c6523b4d3f60852'));
});
</script>
</body>
</html> | 35.55 | 159 | 0.644163 |
661f1ca051d9bebe062a866613e128944a9bd438 | 1,788 | css | CSS | public/src/styles/lazyload/ng-tags-input.css | comsysreu/creditos | 03181f7491255378c2e2e0d3e58dfd2a8659d454 | [
"MIT"
] | 2 | 2019-02-27T04:43:08.000Z | 2019-12-03T23:20:53.000Z | public/src/styles/lazyload/ng-tags-input.css | comsysreu/creditos | 03181f7491255378c2e2e0d3e58dfd2a8659d454 | [
"MIT"
] | null | null | null | public/src/styles/lazyload/ng-tags-input.css | comsysreu/creditos | 03181f7491255378c2e2e0d3e58dfd2a8659d454 | [
"MIT"
] | null | null | null | tags-input {
display: block;
}
tags-input .host {
position: relative;
margin: 0;
padding: 0;
height: 100%;
}
tags-input .host:active {
outline: none;
}
tags-input .tags {
border: 1px solid #eeeeee;
overflow: hidden;
padding: 4px 5px;
padding-top: 6px;
}
tags-input .tags .tag-list {
list-style: none;
margin: 0;
padding: 0;
}
tags-input .tags .tag-item {
float: left;
margin-right: 4px;
font-size: 12px;
padding: 2px 10px;
margin-bottom: 4px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
border: 1px solid #38b4ee;
background: #38b4ee;
color: #fff;
}
tags-input .tags .tag-item.selected {
background-color: #f7f7f7;
color: #545454;
border-color: #f7f7f7;
}
tags-input .tags .tag-item.selected .remove-button {
color: #545454;
}
tags-input .tags .tag-item .remove-button {
margin-left: 4px;
padding: 0;
cursor: pointer;
vertical-align: middle;
font-weight: bold;
color: #fff;
}
tags-input .tags .input {
border-color: transparent;
outline: none;
font-size: 12px;
}
tags-input .tags .input:focus {
outline: none;
border-color: transparent;
}
tags-input .tags .input::-ms-clear {
display: none;
}
/*** tags autocomplete **/
tags-input .autocomplete {
position: absolute;
padding: 5px 0;
z-index: 999;
width: 100%;
background-color: white;
border: 1px solid #f7f7f7;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
tags-input .autocomplete .suggestion-list {
margin: 0;
padding: 0;
list-style: none;
}
tags-input .autocomplete .suggestion-item {
color: #777777;
background: #fff;
padding: 2px 10px;
}
tags-input .autocomplete .suggestion-item.selected {
color: #fff;
background: #38b4ee;
}
tags-input .autocomplete .suggestion-item.selected em {
color: #fff;
background-color: #139fe0;
}
| 19.648352 | 55 | 0.666667 |
a14fb1468f17ce034186bf1ff9a3c918168802c6 | 1,724 | kt | Kotlin | domain/src/main/kotlin/com/andremion/domain/UseCase.kt | khiemle/Theatre | 98f329d3a6641a51b90eabd2921898eba603e920 | [
"Apache-2.0"
] | 636 | 2018-02-24T00:45:26.000Z | 2022-03-28T05:59:08.000Z | domain/src/main/kotlin/com/andremion/domain/UseCase.kt | warrior2015/Theatre | 9e80c132e0ead48e7c395a0203d40f3024da9da1 | [
"Apache-2.0"
] | 11 | 2018-02-25T11:03:51.000Z | 2020-10-05T15:15:37.000Z | domain/src/main/kotlin/com/andremion/domain/UseCase.kt | warrior2015/Theatre | 9e80c132e0ead48e7c395a0203d40f3024da9da1 | [
"Apache-2.0"
] | 111 | 2018-02-26T07:53:09.000Z | 2022-03-28T04:21:08.000Z | /*
* Copyright (c) 2018. André Mion
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.andremion.domain
import io.reactivex.Observable
/**
* A base class for an use case that will be executed by presentation layer
*/
abstract class UseCase<in Params, Result> internal constructor(private val schedulers: Schedulers) {
internal abstract fun buildObservable(params: Params?): Observable<Result>
fun execute(params: Params? = null): Observable<Result> {
return buildObservable(params)
.subscribeOn(schedulers.subscribeOn)
// Unfortunately RxJava had a bug that if any Exceptions were being thrown later
// in the stream they would incorrectly cut ahead of the successful emissions
// and break the flow.
// In order to fix this, an overload was added in version 1.1.1
// for observeOn(Scheduler scheduler, boolean delayError)
// in order to signal the Scheduler to respect the delaying of errors.
// https://medium.com/yammer-engineering/chaining-multiple-sources-with-rxjava-20eb6850e5d9
.observeOn(schedulers.observeOn, true)
}
}
| 42.04878 | 107 | 0.693155 |
cb32926de1d7fe6f34b6030cc13cfb2df79d81f9 | 4,215 | h | C | dakota-6.3.0.Windows.x86/include/colin/BoostExtras.h | seakers/ExtUtils | b0186098063c39bd410d9decc2a765f24d631b25 | [
"BSD-2-Clause"
] | null | null | null | dakota-6.3.0.Windows.x86/include/colin/BoostExtras.h | seakers/ExtUtils | b0186098063c39bd410d9decc2a765f24d631b25 | [
"BSD-2-Clause"
] | null | null | null | dakota-6.3.0.Windows.x86/include/colin/BoostExtras.h | seakers/ExtUtils | b0186098063c39bd410d9decc2a765f24d631b25 | [
"BSD-2-Clause"
] | 1 | 2022-03-18T14:13:14.000Z | 2022-03-18T14:13:14.000Z | /* _________________________________________________________________________
*
* Acro: A Common Repository for Optimizers
* Copyright (c) 2008 Sandia Corporation.
* This software is distributed under the BSD License.
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
* the U.S. Government retains certain rights in this software.
* For more information, see the README.txt file in the top Acro directory.
* _________________________________________________________________________
*/
/**
* \file BoostExtras.h
*
* Declares supplemental utility functions for use with Boost template
* definitions.
*/
#ifndef colin_BoostExtras_h
#define colin_BoostExtras_h
#include <acro_config.h>
namespace colin
{
namespace boost_extras {
/** Special variant of boost::signal that calls slots in the reverse
* order from which they were registered (i.e. Last in, First out).
*/
template<typename Signature, // function type R (T1, T2, ..., TN)
typename Combiner = boost::last_value
<typename boost::function_traits<Signature>::result_type>,
typename Group = int,
typename GroupCompare = std::less<Group>,
typename SlotFunction = boost::function<Signature>
>
class lifo_signal : public boost::signal<Signature, Combiner, Group,
GroupCompare, SlotFunction>
{
typedef boost::signal<Signature, Combiner, Group,
GroupCompare, SlotFunction> signal_t;
public:
explicit lifo_signal(const Combiner& combiner = Combiner(),
const GroupCompare& group_compare = GroupCompare())
: signal_t(combiner, group_compare)
{}
// Connect a slot to this signal
boost::signals::connection
connect(const typename signal_t::slot_type& fcn)
{
return signal_t::connect(fcn, boost::signals::at_front);
}
boost::signals::connection
connect(const typename signal_t::group_type& group,
const typename signal_t::slot_type& fcn)
{
return signal_t::connect(group, fcn, boost::signals::at_front);
}
};
/** A Combiner class that will sum the return values from all of the slots.
*/
template<typename T>
struct sum {
typedef T result_type;
template<typename InputIterator>
T operator()(InputIterator first, InputIterator last) const
{
T value = T();
while (first != last)
value = value + *first++;
return value;
}
};
template<>
struct sum<void> {
struct unusable {};
typedef unusable result_type;
template<typename InputIterator>
result_type
operator()(InputIterator first, InputIterator last) const
{
while (first != last)
*first++;
return result_type();
}
};
/** A Combiner class that will call slots until each slot returns true.
* The return value is the number of slots that never returned true
* (after the first complete pass through the slots where no new slots
* returned true).
*/
struct call_until_pass {
typedef size_t result_type;
template<typename InputIterator>
size_t operator()(InputIterator first, InputIterator last) const
{
if (first == last)
return 0;
// an absurdly large number just to prevent infinite loops
size_t maxPasses = 100;
bool slotPassed = false;
std::list<InputIterator> pending;
for( ; first != last; ++first )
{
int ans = *first;
if ( ans != 0 )
slotPassed = true;
if ( ans >= 0 )
pending.push_back(first);
}
while ( slotPassed && ! pending.empty() && --maxPasses )
{
slotPassed = false;
std::list<InputIterator> active;
active.swap(pending);
while ( ! active.empty() )
{
int ans = *active.front();
if ( ans != 0 )
slotPassed = true;
if ( ans >= 0 )
pending.splice(pending.end(), active, active.begin());
else
active.pop_front();
}
}
return pending.size();
}
};
} // namespace colin::boost_extras
} // namespace colin
#endif // defined colin_BoostExtras_h
| 27.193548 | 77 | 0.63962 |
f85792ec0fb7168a4f99c7d699acdf43b265b753 | 1,150 | kt | Kotlin | trikot-viewmodels-declarative/sample/common/src/commonMain/kotlin/com/mirego/sample/viewmodels/showcase/animation/types/AnimationTypeShowcaseViewModelImpl.kt | mirego/trikot | 829b6498fc7efe24bf4173a4115821a68fbf78d4 | [
"BSD-3-Clause"
] | 30 | 2022-01-21T18:56:55.000Z | 2022-02-25T19:46:53.000Z | trikot-viewmodels-declarative/sample/common/src/commonMain/kotlin/com/mirego/sample/viewmodels/showcase/animation/types/AnimationTypeShowcaseViewModelImpl.kt | mirego/trikot | 829b6498fc7efe24bf4173a4115821a68fbf78d4 | [
"BSD-3-Clause"
] | 14 | 2022-01-21T17:27:04.000Z | 2022-03-16T17:58:32.000Z | trikot-viewmodels-declarative/sample/common/src/commonMain/kotlin/com/mirego/sample/viewmodels/showcase/animation/types/AnimationTypeShowcaseViewModelImpl.kt | mirego/trikot | 829b6498fc7efe24bf4173a4115821a68fbf78d4 | [
"BSD-3-Clause"
] | null | null | null | package com.mirego.sample.viewmodels.showcase.animation.types
import com.mirego.trikot.streams.cancellable.CancellableManager
import com.mirego.trikot.viewmodels.declarative.components.factory.VMDComponents
import com.mirego.trikot.viewmodels.declarative.viewmodel.VMDViewModelImpl
import com.mirego.trikot.viewmodels.declarative.viewmodel.internal.VMDPublishedProperty
import com.mirego.trikot.viewmodels.declarative.viewmodel.internal.published
class AnimationTypeShowcaseViewModelImpl(title: String, buttonTitle: String, cancellableManager: CancellableManager) : VMDViewModelImpl(cancellableManager), AnimationTypeShowcaseViewModel {
override val title = VMDComponents.Text.withContent(title, cancellableManager)
private val isTrailingDelegate = published(false, this)
override var isTrailing: Boolean by isTrailingDelegate
override val animateButton = VMDComponents.Button.withText(buttonTitle, cancellableManager)
override val propertyMapping: Map<String, VMDPublishedProperty<*>> by lazy {
super.propertyMapping.toMutableMap().also {
it[this::isTrailing.name] = isTrailingDelegate
}
}
}
| 50 | 189 | 0.817391 |
2a1bb566b20d87a3c47b6048e9af592b16d4dfcd | 1,553 | html | HTML | html/contact.html | selin-telli/kodluyoruzilkrepo | 04a2a2b9fc938bbb097d2f52766b9fde727d6bcc | [
"MIT"
] | null | null | null | html/contact.html | selin-telli/kodluyoruzilkrepo | 04a2a2b9fc938bbb097d2f52766b9fde727d6bcc | [
"MIT"
] | null | null | null | html/contact.html | selin-telli/kodluyoruzilkrepo | 04a2a2b9fc938bbb097d2f52766b9fde727d6bcc | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Selin | İletişim</title>
</head>
<body>
<header>
<nav>
<ul><br>
<li><a href="index.html">Homepage</a></li>
<li><a href="about-me.html">About Me</a></li>
<li><a href="contact.html">Contact</a></li>
</ul><br>
</nav>
</header>
<hr>
<section>
<h3>İletişim</h3>
<img src="https://picsum.photos/400/300" alt="">
<address><br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Non aut animi eum exercitationem nulla quis iure
<br>
molestias provident magnam harum, voluptas debitis laborum. Reprehenderit molestias eaque tempora minima
<br>
explicabo pariatur ea maxime culpa voluptatem, repellat corporis fugiat iusto vero rerum. <br>
</address>
<ul>
<li><a href="tel:0123456789">0123456789</a></li>
<li><a href="mailto:asdfg@hjkl.zxc">asdfg@hjkl.zxc</a></li>
</ul>
</section>
<hr>
<footer>
<nav>
<ul><br>
<li><a href="index.html">Homepage</a></li>
<li><a href="about-me.html">About Me</a></li>
<li><a href="contact.html">Contact</a></li>
</ul><br>
</nav>
</footer>
</body>
</html> | 23.892308 | 118 | 0.518995 |
40cacd6693f342a725954c7506ec24b52b76a7e3 | 511 | py | Python | HARMAN International Software Engineer 2019/dataDesignToStoreItems.py | sivolko/codeforce | 4b00c4c012780036e56d2f0e79adb2f5db7559df | [
"MIT"
] | null | null | null | HARMAN International Software Engineer 2019/dataDesignToStoreItems.py | sivolko/codeforce | 4b00c4c012780036e56d2f0e79adb2f5db7559df | [
"MIT"
] | null | null | null | HARMAN International Software Engineer 2019/dataDesignToStoreItems.py | sivolko/codeforce | 4b00c4c012780036e56d2f0e79adb2f5db7559df | [
"MIT"
] | null | null | null | class DataStructure(object):
def __init__(self):
self.name2id = {}
self.id2item = {}
def add_item(self, item_name, item_id, item):
self.name2id[item_name] = item_id
self.id2item[item_id] = item
def search_by_name(self, target_name):
target_id = self.name2id[target_name]
target_item = self.id2item[target_id]
return target_item
def search_by_id(self, target_id):
target_item = self.id2item[target_id]
return target_item
| 28.388889 | 49 | 0.649706 |
f9f3020a78144659edc0b88e6f24b83684c8c9bd | 587 | go | Go | hackerrank/30-days-of-code/30-dictionaries-and-maps/main.go | kamilsk/algo | 08b446760543844d62ecb98c98cd641203a60932 | [
"MIT"
] | 4 | 2019-07-26T21:29:09.000Z | 2022-01-09T01:21:46.000Z | hackerrank/30-days-of-code/30-dictionaries-and-maps/main.go | kamilsk/algo | 08b446760543844d62ecb98c98cd641203a60932 | [
"MIT"
] | null | null | null | hackerrank/30-days-of-code/30-dictionaries-and-maps/main.go | kamilsk/algo | 08b446760543844d62ecb98c98cd641203a60932 | [
"MIT"
] | null | null | null | package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanLines)
_ = scanner.Scan()
n, _ := strconv.Atoi(scanner.Text())
phonebook := make(map[string]string)
for i := 0; i < n && scanner.Scan(); i++ {
entry := strings.Split(scanner.Text(), " ")
name, phone := entry[0], entry[1]
phonebook[name] = phone
}
for scanner.Scan() {
name := scanner.Text()
phone, found := phonebook[name]
if !found {
fmt.Println("Not found")
continue
}
fmt.Printf("%s=%s\n", name, phone)
}
}
| 18.34375 | 45 | 0.613288 |
d1f9950703ca156a53f40e6d40d074115ea5e3c1 | 102 | rs | Rust | pac/rp2040/src/dma/ch1_al2_ctrl.rs | johnbatty/rp-microcontroller-rs | 5a52df396ba56998d5f08888437160331bbe80e9 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | 46 | 2021-01-22T23:56:22.000Z | 2022-01-22T02:57:38.000Z | pac/rp2040/src/dma/ch1_al2_ctrl.rs | johnbatty/rp-microcontroller-rs | 5a52df396ba56998d5f08888437160331bbe80e9 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | 7 | 2021-01-28T16:28:12.000Z | 2021-03-27T19:59:33.000Z | pac/rp2040/src/dma/ch1_al2_ctrl.rs | johnbatty/rp-microcontroller-rs | 5a52df396ba56998d5f08888437160331bbe80e9 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | 8 | 2021-01-25T20:11:46.000Z | 2021-05-20T08:06:13.000Z | #[doc = "Reader of register CH1_AL2_CTRL"]
pub type R = crate::R<u32, super::CH1_AL2_CTRL>;
impl R {}
| 25.5 | 48 | 0.686275 |
baf7cae369dde85b62a3205c0cf63c1306f1ec12 | 1,400 | swift | Swift | SimpleSearch/SearchDisplay/SearchDisplayInteractor.swift | SpaceYatri/SimpleSearch | b5b9f8fb9ed1ae3142d6fb709c0ea76b0e4cf138 | [
"MIT"
] | null | null | null | SimpleSearch/SearchDisplay/SearchDisplayInteractor.swift | SpaceYatri/SimpleSearch | b5b9f8fb9ed1ae3142d6fb709c0ea76b0e4cf138 | [
"MIT"
] | null | null | null | SimpleSearch/SearchDisplay/SearchDisplayInteractor.swift | SpaceYatri/SimpleSearch | b5b9f8fb9ed1ae3142d6fb709c0ea76b0e4cf138 | [
"MIT"
] | null | null | null | //
// SearchDisplayInteractor.swift
// SimpleSearch
//
// Created by Sushant Tiwari on 16/09/18.
// Copyright © 2018 Sushant Tiwari. All rights reserved.
//
import RIBs
import RxSwift
protocol SearchDisplayRouting: ViewableRouting {
// TODO: Declare methods the interactor can invoke to manage sub-tree via the router.
}
protocol SearchDisplayPresentable: Presentable {
weak var listener: SearchDisplayPresentableListener? { get set }
// TODO: Declare methods the interactor can invoke the presenter to present data.
}
protocol SearchDisplayListener: class {
// TODO: Declare methods the interactor can invoke to communicate with other RIBs.
}
final class SearchDisplayInteractor: PresentableInteractor<SearchDisplayPresentable>, SearchDisplayInteractable, SearchDisplayPresentableListener {
weak var router: SearchDisplayRouting?
weak var listener: SearchDisplayListener?
// TODO: Add additional dependencies to constructor. Do not perform any logic
// in constructor.
override init(presenter: SearchDisplayPresentable) {
super.init(presenter: presenter)
presenter.listener = self
}
override func didBecomeActive() {
super.didBecomeActive()
// TODO: Implement business logic here.
}
override func willResignActive() {
super.willResignActive()
// TODO: Pause any business logic.
}
}
| 29.787234 | 147 | 0.735714 |
3305691c62826956ff8ed131b9e4f86523e06726 | 1,431 | py | Python | repos/system_upgrade/common/models/selinux.py | sm00th/leapp-repository | 1c171ec3a5f9260a3c6f84a9b15cad78a875ac61 | [
"Apache-2.0"
] | null | null | null | repos/system_upgrade/common/models/selinux.py | sm00th/leapp-repository | 1c171ec3a5f9260a3c6f84a9b15cad78a875ac61 | [
"Apache-2.0"
] | 1 | 2022-03-07T15:34:11.000Z | 2022-03-07T15:35:15.000Z | repos/system_upgrade/common/models/selinux.py | sm00th/leapp-repository | 1c171ec3a5f9260a3c6f84a9b15cad78a875ac61 | [
"Apache-2.0"
] | null | null | null | from leapp.models import fields, Model
from leapp.topics import SystemInfoTopic, TransactionTopic
class SELinuxModule(Model):
"""SELinux module in cil including priority"""
topic = SystemInfoTopic
name = fields.String()
priority = fields.Integer()
content = fields.String()
# lines removed due to content invalid on RHEL 8
removed = fields.List(fields.String())
class SELinuxModules(Model):
"""
List of selinux modules that are not part of distribution policy
modules - list of custom policy modules (priority != 100,200)
templates - List of installed udica templates
"""
topic = SystemInfoTopic
modules = fields.List(fields.Model(SELinuxModule))
templates = fields.List(fields.Model(SELinuxModule))
class SELinuxCustom(Model):
"""SELinux customizations returned by semanage export"""
topic = SystemInfoTopic
commands = fields.List(fields.String())
removed = fields.List(fields.String())
class SELinuxRequestRPMs(Model):
"""
SELinux related RPM packages that need to be present after upgrade
Listed packages provide types that where used in policy
customizations (to_install), or the corresponding policy
was installed on RHEL-7 installation with priority 200
(to_keep).
"""
topic = TransactionTopic
to_keep = fields.List(fields.String(), default=[])
to_install = fields.List(fields.String(), default=[])
| 31.108696 | 70 | 0.716981 |
c468c04338e1b0f719704e0674ce9abeddebf4cb | 349 | h | C | OCWeibo/Classes/Other/AppDelegate.h | maple1994/-OC- | 399014781022c306bb3039dabf3a88dfc225f761 | [
"MIT"
] | null | null | null | OCWeibo/Classes/Other/AppDelegate.h | maple1994/-OC- | 399014781022c306bb3039dabf3a88dfc225f761 | [
"MIT"
] | null | null | null | OCWeibo/Classes/Other/AppDelegate.h | maple1994/-OC- | 399014781022c306bb3039dabf3a88dfc225f761 | [
"MIT"
] | null | null | null | //
// AppDelegate.h
// OCWeibo
//
// Created by Maple on 16/7/18.
// Copyright © 2016年 Maple. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
/**
* 更换根控制器
*/
+ (void)changeRootViewController: (UIViewController *)controller;
@end
| 16.619048 | 65 | 0.702006 |
fee472ff01c7ce975f1ae20f666ea537405518d7 | 9,719 | html | HTML | lists.whatwg.org/pipermail/commit-watchers-whatwg.org/2011/012665.html | zcorpan/whatwg.org | 3374e69f013e5939abc5f3fffaae50bb6eaf0bd3 | [
"CC-BY-4.0"
] | 1 | 2022-02-14T23:44:51.000Z | 2022-02-14T23:44:51.000Z | lists.whatwg.org/pipermail/commit-watchers-whatwg.org/2011/012665.html | Seanpm2001-Google/whatwg.org | 33ad837c0dc53b68865f4a35ccdc1c68dc07fce6 | [
"BSD-3-Clause"
] | 1 | 2021-01-31T11:51:12.000Z | 2021-01-31T11:51:12.000Z | lists.whatwg.org/pipermail/commit-watchers-whatwg.org/2011/012665.html | Seanpm2001-Google/whatwg.org | 33ad837c0dc53b68865f4a35ccdc1c68dc07fce6 | [
"BSD-3-Clause"
] | null | null | null | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [html5] r5798 - [e] (0) Remove the text that was trying to handwave the Link: header's non-exist [...]
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:commit-watchers%40lists.whatwg.org?Subject=Re%3A%20%5Bhtml5%5D%20r5798%20-%20%5Be%5D%20%280%29%20Remove%20the%20text%20that%20was%20trying%20to%20handwave%0A%09the%20Link%3A%20header%27s%20non-exist%20%5B...%5D&In-Reply-To=%3C20110121234322.C6E5D80581BB%40ps20323.dreamhostps.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<style type="text/css">
pre {
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
}
</style>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="012664.html">
<LINK REL="Next" HREF="012666.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[html5] r5798 - [e] (0) Remove the text that was trying to handwave the Link: header's non-exist [...]</H1>
<!--htdig_noindex-->
<B>whatwg at whatwg.org</B>
<A HREF="mailto:commit-watchers%40lists.whatwg.org?Subject=Re%3A%20%5Bhtml5%5D%20r5798%20-%20%5Be%5D%20%280%29%20Remove%20the%20text%20that%20was%20trying%20to%20handwave%0A%09the%20Link%3A%20header%27s%20non-exist%20%5B...%5D&In-Reply-To=%3C20110121234322.C6E5D80581BB%40ps20323.dreamhostps.com%3E"
TITLE="[html5] r5798 - [e] (0) Remove the text that was trying to handwave the Link: header's non-exist [...]">whatwg at whatwg.org
</A><BR>
<I>Fri Jan 21 15:43:22 PST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="012664.html">[html5] r5797 - [e] (0) Clarify the 'escaping a string' algorithm by expanding it into a full ex [...]
</A></li>
<LI>Next message: <A HREF="012666.html">[html5] r5799 - [e] (0) alphabetise more Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=11296
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#12665">[ date ]</a>
<a href="thread.html#12665">[ thread ]</a>
<a href="subject.html#12665">[ subject ]</a>
<a href="author.html#12665">[ author ]</a>
</LI>
</UL>
<HR>
<!--/htdig_noindex-->
<!--beginarticle-->
<PRE>Author: ianh
Date: 2011-01-21 15:43:21 -0800 (Fri, 21 Jan 2011)
New Revision: 5798
Modified:
complete.html
index
source
Log:
[e] (0) Remove the text that was trying to handwave the Link: header's non-existence, now that it exists formally again.
Fixing <A HREF="http://www.w3.org/Bugs/Public/show_bug.cgi?id=11294">http://www.w3.org/Bugs/Public/show_bug.cgi?id=11294</A>
Modified: complete.html
===================================================================
--- complete.html 2011-01-21 02:36:04 UTC (rev 5797)
+++ complete.html 2011-01-21 23:43:21 UTC (rev 5798)
@@ -13319,14 +13319,13 @@
<div class=impl>
- <p>Some versions of HTTP defined a <code title="">Link:</code>
- header, to be processed like a series of <code><a href=#the-link-element>link</a></code> elements.
- If supported, for the purposes of ordering links defined by HTTP
- headers must be assumed to come before any links in the document, in
- the order that they were given in the HTTP entity header. (URIs in
- these headers are to be processed and resolved according to the
- rules given in HTTP; the rules of <em>this</em> specification don't
- apply.) <a href=#refsHTTP>[HTTP]</a> <a href=#refsWEBLINK>[WEBLINK]</a></p> <!-- WEBLINK is ref for Link: header -->
+ <p>HTTP <code title="">Link:</code> headers, if supported, must be
+ assumed to come before any links in the document, in the order that
+ they were given in the HTTP entity header. (URLs in these headers
+ are to be processed and resolved according to the rules given in the
+ relevant specification; the rules of <em>this</em> specification
+ don't apply.) <a href=#refsHTTP>[HTTP]</a> <a href=#refsWEBLINK>[WEBLINK]</a></p> <!-- WEBLINK is ref for Link:
+ header -->
<p>The IDL attributes <dfn id=dom-link-href title=dom-link-href><code>href</code></dfn>, <dfn id=dom-link-rel title=dom-link-rel><code>rel</code></dfn>, <dfn id=dom-link-media title=dom-link-media><code>media</code></dfn>, <dfn id=dom-link-hreflang title=dom-link-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-link-type title=dom-link-type><code>type</code></dfn>, and <dfn id=dom-link-sizes title=dom-link-sizes><code>sizes</code></dfn> each must
<a href=#reflect>reflect</a> the respective content attributes of the same
Modified: index
===================================================================
--- index 2011-01-21 02:36:04 UTC (rev 5797)
+++ index 2011-01-21 23:43:21 UTC (rev 5798)
@@ -13298,14 +13298,13 @@
<div class=impl>
- <p>Some versions of HTTP defined a <code title="">Link:</code>
- header, to be processed like a series of <code><a href=#the-link-element>link</a></code> elements.
- If supported, for the purposes of ordering links defined by HTTP
- headers must be assumed to come before any links in the document, in
- the order that they were given in the HTTP entity header. (URIs in
- these headers are to be processed and resolved according to the
- rules given in HTTP; the rules of <em>this</em> specification don't
- apply.) <a href=#refsHTTP>[HTTP]</a> <a href=#refsWEBLINK>[WEBLINK]</a></p> <!-- WEBLINK is ref for Link: header -->
+ <p>HTTP <code title="">Link:</code> headers, if supported, must be
+ assumed to come before any links in the document, in the order that
+ they were given in the HTTP entity header. (URLs in these headers
+ are to be processed and resolved according to the rules given in the
+ relevant specification; the rules of <em>this</em> specification
+ don't apply.) <a href=#refsHTTP>[HTTP]</a> <a href=#refsWEBLINK>[WEBLINK]</a></p> <!-- WEBLINK is ref for Link:
+ header -->
<p>The IDL attributes <dfn id=dom-link-href title=dom-link-href><code>href</code></dfn>, <dfn id=dom-link-rel title=dom-link-rel><code>rel</code></dfn>, <dfn id=dom-link-media title=dom-link-media><code>media</code></dfn>, <dfn id=dom-link-hreflang title=dom-link-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-link-type title=dom-link-type><code>type</code></dfn>, and <dfn id=dom-link-sizes title=dom-link-sizes><code>sizes</code></dfn> each must
<a href=#reflect>reflect</a> the respective content attributes of the same
Modified: source
===================================================================
--- source 2011-01-21 02:36:04 UTC (rev 5797)
+++ source 2011-01-21 23:43:21 UTC (rev 5798)
@@ -13978,15 +13978,14 @@
<div class="impl">
- <p>Some versions of HTTP defined a <code title="">Link:</code>
- header, to be processed like a series of <code>link</code> elements.
- If supported, for the purposes of ordering links defined by HTTP
- headers must be assumed to come before any links in the document, in
- the order that they were given in the HTTP entity header. (URIs in
- these headers are to be processed and resolved according to the
- rules given in HTTP; the rules of <em>this</em> specification don't
- apply.) <a href="#refsHTTP">[HTTP]</a> <a
- href="#refsWEBLINK">[WEBLINK]</a></p> <!-- WEBLINK is ref for Link: header -->
+ <p>HTTP <code title="">Link:</code> headers, if supported, must be
+ assumed to come before any links in the document, in the order that
+ they were given in the HTTP entity header. (URLs in these headers
+ are to be processed and resolved according to the rules given in the
+ relevant specification; the rules of <em>this</em> specification
+ don't apply.) <a href="#refsHTTP">[HTTP]</a> <a
+ href="#refsWEBLINK">[WEBLINK]</a></p> <!-- WEBLINK is ref for Link:
+ header -->
<p>The IDL attributes <dfn
title="dom-link-href"><code>href</code></dfn>, <dfn
</PRE>
<!--endarticle-->
<!--htdig_noindex-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="012664.html">[html5] r5797 - [e] (0) Clarify the 'escaping a string' algorithm by expanding it into a full ex [...]
</A></li>
<LI>Next message: <A HREF="012666.html">[html5] r5799 - [e] (0) alphabetise more Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=11296
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#12665">[ date ]</a>
<a href="thread.html#12665">[ thread ]</a>
<a href="subject.html#12665">[ subject ]</a>
<a href="author.html#12665">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org">More information about the Commit-Watchers
mailing list</a><br>
<!--/htdig_noindex-->
</body></html>
| 60.36646 | 608 | 0.65871 |
907a3264a7bc1ba8741d015072be38a5d091db2e | 838 | py | Python | src/agent/baselines/random_agent.py | aliciafmachado/LfD | 44a19397a87a31783a7d82bd8958e3b61ff34de1 | [
"MIT"
] | null | null | null | src/agent/baselines/random_agent.py | aliciafmachado/LfD | 44a19397a87a31783a7d82bd8958e3b61ff34de1 | [
"MIT"
] | null | null | null | src/agent/baselines/random_agent.py | aliciafmachado/LfD | 44a19397a87a31783a7d82bd8958e3b61ff34de1 | [
"MIT"
] | null | null | null | """
Random Agent.
"""
import torch
import torch.nn as nn
from torch.nn.functional import one_hot
class RandomAgent(nn.Module):
def __init__(self, action_space='discrete', n_actions=2, action_range=(-1, 1)):
super(RandomAgent, self).__init__()
self.action_space = action_space
self.n_actions = n_actions
self.action_range = action_range
# action & reward buffer for evaluating policy's performance
self.saved_actions = []
self.rewards = []
def forward(self, x):
if self.action_space == 'discrete':
return one_hot(torch.randint(0, self.n_actions, (x.shape[0],)), num_classes=self.n_actions).float()
else:
return torch.rand(x.shape[0], self.n_actions) * (self.action_range[1] - self.action_range[0]) + self.action_range[0]
| 31.037037 | 128 | 0.650358 |
5fa175d139de20b440112f3b79627168b427406e | 1,153 | c | C | libft/ft_strcmp.c | gguarnay/42 | de524031196771ba89af172485af896e37dd13f5 | [
"Unlicense"
] | 1 | 2019-03-03T05:13:05.000Z | 2019-03-03T05:13:05.000Z | libft/ft_strcmp.c | gguarnay/42 | de524031196771ba89af172485af896e37dd13f5 | [
"Unlicense"
] | null | null | null | libft/ft_strcmp.c | gguarnay/42 | de524031196771ba89af172485af896e37dd13f5 | [
"Unlicense"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gguarnay <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/12/08 01:36:10 by gguarnay #+# #+# */
/* Updated: 2018/12/11 20:21:15 by gguarnay ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcmp(const char *s1, const char *s2)
{
size_t i;
i = 0;
while (s1[i] && s2[i])
{
if (s1[i] != s2[i])
return ((unsigned char)s1[i] - (unsigned char)s2[i]);
i++;
}
return ((unsigned char)s1[i] - (unsigned char)s2[i]);
}
| 41.178571 | 80 | 0.209887 |
21e7191ad855e0fa7b2f729b6fbe21eb4e63ed01 | 15,678 | html | HTML | docs/feature_8h_source.html | aeroith/RaspiKinect | fc58845914932595f9a7517dc9eec4a436bcd1b8 | [
"Apache-2.0"
] | 4 | 2017-01-08T23:27:32.000Z | 2022-03-21T06:39:39.000Z | docs/feature_8h_source.html | aeroith/RaspiKinect | fc58845914932595f9a7517dc9eec4a436bcd1b8 | [
"Apache-2.0"
] | null | null | null | docs/feature_8h_source.html | aeroith/RaspiKinect | fc58845914932595f9a7517dc9eec4a436bcd1b8 | [
"Apache-2.0"
] | null | null | null | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>RaspiKinect: /home/serhat/Work/Kinect/RaspiKinect/src/feature.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">RaspiKinect
 <span id="projectnumber">1.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('feature_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">feature.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#include <boost/shared_ptr.hpp></span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="preprocessor">#include <iostream></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include <omp.h></span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include <pcl/features/fpfh_omp.h></span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include <pcl/features/normal_3d.h></span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include <pcl/features/normal_3d_omp.h></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <pcl/features/vfh.h></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include <pcl/features/vfh.h></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include <pcl/keypoints/sift_keypoint.h></span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include <pcl/point_cloud.h></span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include <pcl/point_types.h></span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include <pcl/search/impl/search.hpp></span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include <pcl/search/kdtree.h></span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="class_feature.html"> 19</a></span> <span class="keyword">class </span><a class="code" href="class_feature.html">Feature</a> {</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="struct_feature_1_1my_cloud.html"> 25</a></span>  <span class="keyword">struct </span><a class="code" href="struct_feature_1_1my_cloud.html">myCloud</a> {</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  pcl::PointCloud<pcl::PointXYZRGB>::Ptr points;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  pcl::PointCloud<pcl::Normal>::Ptr normals;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  pcl::PointCloud<pcl::PointXYZRGB>::Ptr keypoints;</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  pcl::PointCloud<pcl::FPFHSignature33>::Ptr local_descriptor;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  pcl::PointCloud<pcl::VFHSignature308>::Ptr global_descriptor;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  };</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  pcl::PointCloud<pcl::Normal>::Ptr</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <a class="code" href="class_feature.html#a2160d57e3a1502d84bd87dd3a3b5da9c">estimateSurfaceNormals</a>(<span class="keyword">const</span> pcl::PointCloud<pcl::PointXYZRGB>::Ptr &cloud,</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordtype">float</span> radius);</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  pcl::PointCloud<pcl::Normal>::Ptr</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <a class="code" href="class_feature.html#afadf68008d421f98696ee7e60e4b28a6">estimateSurfaceNormalsOMP</a>(<span class="keyword">const</span> pcl::PointCloud<pcl::PointXYZRGB>::Ptr &cloud,</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordtype">float</span> radius);</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  pcl::PointCloud<pcl::PointXYZRGB>::Ptr</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <a class="code" href="class_feature.html#a448116b76768ad35cdda20deee99d0d1">getSiftKeypoints</a>(<span class="keyword">const</span> pcl::PointCloud<pcl::PointXYZRGB>::Ptr &cloud,</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> min_scale, <span class="keyword">const</span> <span class="keywordtype">int</span> n_octaves,</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> n_scales_per_octave, <span class="keyword">const</span> <span class="keywordtype">float</span> min_contrast);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  pcl::PointCloud<pcl::FPFHSignature33>::Ptr</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <a class="code" href="class_feature.html#a89423b19d0d8c4ed67b4b625ddf5422f">getLocalDescriptor</a>(<span class="keyword">const</span> pcl::PointCloud<pcl::PointXYZRGB>::Ptr &points,</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keyword">const</span> pcl::PointCloud<pcl::Normal>::Ptr &normals,</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="keyword">const</span> pcl::PointCloud<pcl::PointXYZRGB>::Ptr &keypoints,</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordtype">float</span> radius);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  pcl::PointCloud<pcl::VFHSignature308>::Ptr</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <a class="code" href="class_feature.html#ab2180a5c65923e5334204be9bf0fbd74">getGlobalDescriptor</a>(<span class="keyword">const</span> pcl::PointCloud<pcl::PointXYZRGB>::Ptr &points,</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keyword">const</span> pcl::PointCloud<pcl::Normal>::Ptr &normals);</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  boost::shared_ptr<Feature::myCloud></div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <a class="code" href="class_feature.html#acf2008a37df967514cb04d0598aa1c79">applyFeatures</a>(<span class="keyword">const</span> pcl::PointCloud<pcl::PointXYZRGB>::Ptr &cloud);</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> </div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> };</div><div class="ttc" id="class_feature_html_acf2008a37df967514cb04d0598aa1c79"><div class="ttname"><a href="class_feature.html#acf2008a37df967514cb04d0598aa1c79">Feature::applyFeatures</a></div><div class="ttdeci">boost::shared_ptr< Feature::myCloud > applyFeatures(const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &cloud)</div><div class="ttdef"><b>Definition:</b> feature.cpp:140</div></div>
<div class="ttc" id="class_feature_html"><div class="ttname"><a href="class_feature.html">Feature</a></div><div class="ttdef"><b>Definition:</b> feature.h:19</div></div>
<div class="ttc" id="class_feature_html_ab2180a5c65923e5334204be9bf0fbd74"><div class="ttname"><a href="class_feature.html#ab2180a5c65923e5334204be9bf0fbd74">Feature::getGlobalDescriptor</a></div><div class="ttdeci">pcl::PointCloud< pcl::VFHSignature308 >::Ptr getGlobalDescriptor(const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &points, const pcl::PointCloud< pcl::Normal >::Ptr &normals)</div><div class="ttdef"><b>Definition:</b> feature.cpp:105</div></div>
<div class="ttc" id="struct_feature_1_1my_cloud_html"><div class="ttname"><a href="struct_feature_1_1my_cloud.html">Feature::myCloud</a></div><div class="ttdef"><b>Definition:</b> feature.h:25</div></div>
<div class="ttc" id="class_feature_html_a2160d57e3a1502d84bd87dd3a3b5da9c"><div class="ttname"><a href="class_feature.html#a2160d57e3a1502d84bd87dd3a3b5da9c">Feature::estimateSurfaceNormals</a></div><div class="ttdeci">pcl::PointCloud< pcl::Normal >::Ptr estimateSurfaceNormals(const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &cloud, float radius)</div><div class="ttdef"><b>Definition:</b> feature.cpp:4</div></div>
<div class="ttc" id="class_feature_html_a89423b19d0d8c4ed67b4b625ddf5422f"><div class="ttname"><a href="class_feature.html#a89423b19d0d8c4ed67b4b625ddf5422f">Feature::getLocalDescriptor</a></div><div class="ttdeci">pcl::PointCloud< pcl::FPFHSignature33 >::Ptr getLocalDescriptor(const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &points, const pcl::PointCloud< pcl::Normal >::Ptr &normals, const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &keypoints, float radius)</div><div class="ttdef"><b>Definition:</b> feature.cpp:59</div></div>
<div class="ttc" id="class_feature_html_afadf68008d421f98696ee7e60e4b28a6"><div class="ttname"><a href="class_feature.html#afadf68008d421f98696ee7e60e4b28a6">Feature::estimateSurfaceNormalsOMP</a></div><div class="ttdeci">pcl::PointCloud< pcl::Normal >::Ptr estimateSurfaceNormalsOMP(const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &cloud, float radius)</div><div class="ttdef"><b>Definition:</b> feature.cpp:155</div></div>
<div class="ttc" id="class_feature_html_a448116b76768ad35cdda20deee99d0d1"><div class="ttname"><a href="class_feature.html#a448116b76768ad35cdda20deee99d0d1">Feature::getSiftKeypoints</a></div><div class="ttdeci">pcl::PointCloud< pcl::PointXYZRGB >::Ptr getSiftKeypoints(const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &cloud, const float min_scale, const int n_octaves, const int n_scales_per_octave, const float min_contrast)</div><div class="ttdef"><b>Definition:</b> feature.cpp:32</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_43e0a1f539e00dcfa1a6bc4d4fee4fc2.html">home</a></li><li class="navelem"><a class="el" href="dir_44d826ca363b84cf0e38c31c0eee7724.html">serhat</a></li><li class="navelem"><a class="el" href="dir_68ab8ffbf420d2e2cc142fc4003d6b74.html">Work</a></li><li class="navelem"><a class="el" href="dir_9c3f00f509115f51fb488397ac8b3c59.html">Kinect</a></li><li class="navelem"><a class="el" href="dir_348fe7589ab87cdc89985cb65648bebb.html">RaspiKinect</a></li><li class="navelem"><a class="el" href="dir_e1136f731d232e86ff5570847744347e.html">src</a></li><li class="navelem"><b>feature.h</b></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
</ul>
</div>
</body>
</html>
| 145.166667 | 8,706 | 0.68644 |
9093b4e2566f7f724c3a08fcaeb8afeb99071827 | 4,683 | py | Python | server/data/city_timezones.py | MikeSmvl/travelingstrategy | 3d38c64f00bafdf2ca1079d14f9b618bce8307b0 | [
"MIT"
] | null | null | null | server/data/city_timezones.py | MikeSmvl/travelingstrategy | 3d38c64f00bafdf2ca1079d14f9b618bce8307b0 | [
"MIT"
] | 2 | 2021-05-08T23:09:17.000Z | 2021-09-02T11:27:08.000Z | server/data/city_timezones.py | MikeSmvl/travelingstrategy | 3d38c64f00bafdf2ca1079d14f9b618bce8307b0 | [
"MIT"
] | 2 | 2020-10-14T01:18:32.000Z | 2020-11-09T16:54:16.000Z | import json
import datetime
import pytz
import math
from bs4 import BeautifulSoup
from helper_class.chrome_driver import create_driver, quit_driver
import urllib.request, json,urllib.parse
import contextlib
import traceback
from lib.database import Database
from helper_class.flags import Flags
from helper_class.logger import Logger
# Initialize flags, logger & database
FLAGS = Flags()
LEVEL = FLAGS.get_logger_level()
LOGGER = Logger(level=LEVEL) if LEVEL is not None else Logger()
def adding_lat_and_lng(cities):
not_found = []
cities_data = []
for city in cities:
city_name = city["city"].replace(" ", "")
try:
city_name = urllib.parse.quote_plus(city_name)
city_url = "https://maps.googleapis.com/maps/api/geocode/json?address={}&key=AIzaSyAxFRTW8Wb6bcJw90yaT2MjeHaOEe9k5iM".format(city_name,sep='')
LOGGER.info(f"Retrieving URL for {city_name}")
with contextlib.closing(urllib.request.urlopen(city_url)) as url:
city_data = json.loads(url.read().decode())
city_data = city_data['results']
lat_and_lng = city_data[0]["geometry"]["location"]
lat = round(lat_and_lng["lat"]*10000000)/10000000 #7 digits after decimal
lng = round(lat_and_lng["lng"]*10000000)/10000000
city_object = {
"city" : city["city"],
"country_name": city["country_name"],
"country_iso": city["country_iso"],
"lat": lat,
"lng": lng,
"timezone": city["timezone"],
"utc_offset": city["utc_offset"]
}
cities_data.append(city_object)
LOGGER.info(f'Timezone for {country_name}')
except:
LOGGER.error("Unexpected error:", traceback.format_exc())
LOGGER.warning("This city doesn't work",city_name)
city_url = "https://maps.googleapis.com/maps/api/geocode/json?address={}&key=AIzaSyAxFRTW8Wb6bcJw90yaT2MjeHaOEe9k5iM".format(city_name,sep='')
LOGGER.info("city url", city_url)
not_found.append(city_name)
LOGGER.warning("These are not found",not_found)
return cities_data
def get_cities_info():
info = {}
cities = []
with open('cityMap.json') as json_file:
data = json.load(json_file)
for city_info in data:
city = city_info["city"]
country_name = city_info["country"]
country_iso = city_info["iso2"]
timezone = city_info["timezone"]
utc_offset = None
if(timezone != None):
date = datetime.datetime.now(pytz.timezone(timezone))
utc_offset = date.utcoffset().total_seconds()/60/60
info = {
"city" : city,
"country_name": country_name,
"country_iso": country_iso,
"timezone": timezone,
"utc_offset": utc_offset
}
cities.append(info)
return cities
def save_cities_timezones():
LOGGER.info("Retreiving timezones information for all countries...")
data = adding_lat_and_lng(get_cities_info())
# geolocator = Nominatim(user_agent="travelingstrategy")
#con = sqlite3.connect('../countries.sqlite')
#cur = con.cursor()
# should not create the table every time
# change in the future
#cur.execute('DROP TABLE IF EXISTS timezones')
#con.commit()
#cur.execute('CREATE TABLE timezones (city VARCHAR, country_name VARCHAR, country_iso VARCHAR, timezone VARCHAR, lat REAL, lng REAL, utc_offset int)')
#SScon.commit()
db = Database("countries.sqlite")
db.drop_table("timezones")
db.add_table("timezones", city="VARCHAR", country_name="VARCHAR", country_iso="VARCHAR", timezone="VARCHAR", la="REAL", lng="REAL",utc_offset = "int")
for city_info in data:
city = city_info["city"]
country_name = city_info["country_name"]
country_iso = city_info["country_iso"]
timezone = city_info["timezone"]
lat = city_info["lat"]
lng = city_info["lng"]
utc_offset = city_info["utc_offset"]
LOGGER.success(f"{country_name} was sucefuly save into the timezone table with the following information: {country_iso} and {timezone}")
db.insert("timezones",city, country_name, country_iso, timezone, lat, lng, utc_offset)
LOGGER.success{f'{country_name} successfully saved to the database.'}
db.close_connection()
if __name__ == '__main__':
save_cities_timezones()
# adding_lat_and_lng(get_cities_info()) | 41.078947 | 154 | 0.62887 |
2cfb561b9f5f40efe017226ca7c69db9683cf9e3 | 864 | swift | Swift | SSUIKit/Classes/Extensions/Application.swift | wudi890520/SSUIKit | 75d7e477ef759e44956e84668a37e94da82e3fa3 | [
"MIT"
] | null | null | null | SSUIKit/Classes/Extensions/Application.swift | wudi890520/SSUIKit | 75d7e477ef759e44956e84668a37e94da82e3fa3 | [
"MIT"
] | null | null | null | SSUIKit/Classes/Extensions/Application.swift | wudi890520/SSUIKit | 75d7e477ef759e44956e84668a37e94da82e3fa3 | [
"MIT"
] | null | null | null | //
// Application.swift
// DeviceKit
//
// Created by 吴頔 on 2019/12/10.
//
import UIKit
import QMUIKit
public extension UIApplication {
static var rootViewController: UIViewController? {
return UIApplication.shared.keyWindow?.rootViewController
}
static var visiableController: UIViewController? {
return QMUIHelper.visibleViewController()
}
static var rootView: UIView? {
return rootViewController?.view
}
}
public extension UIApplication {
static func open(_ url: URL? = URL(string: UIApplication.openSettingsURLString)) {
if let url = url, UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
@objc static func endEditing() {
visiableController?.view.endEditing(true)
}
}
| 23.351351 | 86 | 0.662037 |
f04e7a8d807e4aa0e6268af965d1071f5bb8dc1f | 687 | js | JavaScript | node_modules/@react-icons/all-files/si/SiGatsby.esm.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | node_modules/@react-icons/all-files/si/SiGatsby.esm.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | node_modules/@react-icons/all-files/si/SiGatsby.esm.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | // THIS FILE IS AUTO GENERATED
import { GenIcon } from '../lib';
export function SiGatsby (props) {
return GenIcon({"tag":"svg","attr":{"role":"img","viewBox":"0 0 24 24"},"child":[{"tag":"title","attr":{},"child":[]},{"tag":"path","attr":{"d":"M12.001.007C5.326.007.007 5.326.007 12S5.326 23.995 12 23.995s11.994-5.319 11.994-11.994S18.676.007 12.001.007zM2.614 12.105l9.283 9.283c-5.111 0-9.283-4.172-9.283-9.283zm11.473 9.074L2.823 9.915C3.76 5.743 7.516 2.614 12 2.614a9.476 9.476 0 0 1 7.614 3.86L18.259 7.62a7.657 7.657 0 0 0-6.362-3.337A7.555 7.555 0 0 0 4.7 9.393l9.804 9.805c2.4-.835 4.276-2.92 4.798-5.424h-4.068v-1.773h6.154c0 4.485-3.129 8.24-7.301 9.178z"}}]})(props);
};
| 114.5 | 583 | 0.657933 |
f426826fecace9f8c0dcc93eef07c46bb53339b5 | 810 | swift | Swift | COVID-19/Models/Statistic.swift | miladgolchinpour/Covid-19 | 6efdd5137473a9b98313c4d33ebeb32dcfb8950d | [
"MIT"
] | 1 | 2021-08-08T18:28:57.000Z | 2021-08-08T18:28:57.000Z | COVID-19/Models/Statistic.swift | miladgolchinpour/Covid-19 | 6efdd5137473a9b98313c4d33ebeb32dcfb8950d | [
"MIT"
] | null | null | null | COVID-19/Models/Statistic.swift | miladgolchinpour/Covid-19 | 6efdd5137473a9b98313c4d33ebeb32dcfb8950d | [
"MIT"
] | null | null | null | //
// Statistic.swift
// Statistic
//
// Created by Milad Golchinpour on 8/8/21.
// Copyright © 2021 Milad Golchinpour. All rights reserved.
//
import Foundation
import SwiftUI
/// Stat type included confirmed, deaths, recovered
enum StatType: String, CaseIterable {
// Raw values are label texts of stat type
case confirmed = "Confirmed"
case deaths = "Deaths"
case recovered = "Recovered"
}
/// Statistic Model for show stats better in app
struct Statistic: Hashable {
var type: StatType
var value: Int
}
// Other data
extension Statistic {
/// Example Stats for placeholder status
static var example = [
Statistic(type: .confirmed, value: 326476233),
Statistic(type: .deaths, value: 7836427),
Statistic(type: .recovered, value: 32642)
]
}
| 23.142857 | 60 | 0.680247 |
adf430aa6735508a2a7c38a958b904b6d273c59a | 17 | rs | Rust | drivers/fb/src/fonts.rs | ardaku/novusk | e78975960f1c8c1ab10ffe19d065573ea237fb36 | [
"MIT"
] | 6 | 2021-05-31T07:36:52.000Z | 2022-01-13T18:43:09.000Z | drivers/fb/src/fonts.rs | ardaku/novusk | e78975960f1c8c1ab10ffe19d065573ea237fb36 | [
"MIT"
] | null | null | null | drivers/fb/src/fonts.rs | ardaku/novusk | e78975960f1c8c1ab10ffe19d065573ea237fb36 | [
"MIT"
] | 1 | 2021-11-11T13:20:36.000Z | 2021-11-11T13:20:36.000Z | pub use font8x8;
| 8.5 | 16 | 0.764706 |
6b84309cc75e373162e021be99e4794f6a9a18b2 | 680 | swift | Swift | LaserCatEyes/Classes/UpdateSubApp/UserDevice.swift | betalgo/LCE-iOS-SDK | 98a53f2e977daef7fa9e07fab820135f6abe1c30 | [
"BSD-3-Clause"
] | 6 | 2020-11-25T00:12:25.000Z | 2022-02-07T16:25:47.000Z | LaserCatEyes/Classes/UpdateSubApp/UserDevice.swift | betalgo/LCE-iOS-SDK | 98a53f2e977daef7fa9e07fab820135f6abe1c30 | [
"BSD-3-Clause"
] | null | null | null | LaserCatEyes/Classes/UpdateSubApp/UserDevice.swift | betalgo/LCE-iOS-SDK | 98a53f2e977daef7fa9e07fab820135f6abe1c30 | [
"BSD-3-Clause"
] | null | null | null | // This file was generated from JSON Schema using quicktype, do not modify it directly.
// To parse the JSON, add this file to your project and do:
//
// let device = try? newJSONDecoder().decode(Device.self, from: jsonData)
import Foundation
// MARK: - Device
class UserDevice: Codable {
let name, userFriendlyName, uuid, operatingSystem: String
let osVersion: String
init(name: String, userFriendlyName: String, uuid: String, operatingSystem: String, osVersion: String) {
self.name = name
self.userFriendlyName = userFriendlyName
self.uuid = uuid
self.operatingSystem = operatingSystem
self.osVersion = osVersion
}
}
| 32.380952 | 108 | 0.702941 |
9eb0fa83409824914b1cfe9b3068eef87cf57b6e | 1,257 | kt | Kotlin | AndroidExpert/MovieApp/app/src/androidTest/java/com/algokelvin/moviecatalog/utils/DataDummy.kt | algokelvin-373/ProjectAppAndroid | 5e92f01ab0dfded451463099cb4f0c9ed43db3d2 | [
"Apache-2.0"
] | null | null | null | AndroidExpert/MovieApp/app/src/androidTest/java/com/algokelvin/moviecatalog/utils/DataDummy.kt | algokelvin-373/ProjectAppAndroid | 5e92f01ab0dfded451463099cb4f0c9ed43db3d2 | [
"Apache-2.0"
] | null | null | null | AndroidExpert/MovieApp/app/src/androidTest/java/com/algokelvin/moviecatalog/utils/DataDummy.kt | algokelvin-373/ProjectAppAndroid | 5e92f01ab0dfded451463099cb4f0c9ed43db3d2 | [
"Apache-2.0"
] | null | null | null | package com.algokelvin.moviecatalog.utils
import com.algokelvin.moviecatalog.model.entity.SampleDataMovie
import com.algokelvin.moviecatalog.model.entity.SampleDataTVShow
fun dataMovie() : ArrayList<SampleDataMovie> {
val arrayDataMovie = ArrayList<SampleDataMovie>()
arrayDataMovie.add(
SampleDataMovie(
"384018",
"Fast & Furious Presents: Hobbs & Shaw",
"2019-08-01",
"Released",
"136",
"6.5",
"743",
"A spinoff of The Fate of the Furious, focusing on Johnson's US Diplomatic Security Agent Luke Hobbs forming an unlikely alliance with Statham's Deckard Shaw."
)
)
return arrayDataMovie
}
fun dataTVShow() : ArrayList<SampleDataTVShow> {
val arrayDataTVShow = ArrayList<SampleDataTVShow>()
arrayDataTVShow.add(
SampleDataTVShow(
"79340",
"The Outpost",
"2018-07-10",
"2",
"20",
"6.0",
"34",
"Talon, the lone survivor of a race called the Blackbloods, sets off to the edge of civilisation to track her family's killers. On her journey she discovers she has supernatural powers which she must learn to harness in order to achieve her goals."
)
)
return arrayDataTVShow
} | 33.078947 | 256 | 0.662689 |
9a4ba444fa92d17d4a6d65cf27cd610e5c25ffe0 | 2,205 | swift | Swift | DrawingTogether/Drawing/SendMqttMessage.swift | hansung-lab/SeeSeeCallCall-iOS | 9bc372b9cf16a61bf32549939fb1408e7799c3de | [
"Apache-2.0"
] | 1 | 2021-01-18T02:10:06.000Z | 2021-01-18T02:10:06.000Z | DrawingTogether/Drawing/SendMqttMessage.swift | hyeyeon0111/DrawingTogether_iOS | 2425cd8a5183a6afd6692ffe9491a34c9fb35b43 | [
"Apache-2.0"
] | null | null | null | DrawingTogether/Drawing/SendMqttMessage.swift | hyeyeon0111/DrawingTogether_iOS | 2425cd8a5183a6afd6692ffe9491a34c9fb35b43 | [
"Apache-2.0"
] | 4 | 2021-01-18T02:08:55.000Z | 2022-02-08T06:21:44.000Z | //
// SendMqttMessage.swift
// DrawingTogether
//
// Created by MJ B on 2020/07/17.
// Copyright © 2020 hansung. All rights reserved.
//
import Foundation
class SendMqttMessage: Thread {
static let INSTANCE = SendMqttMessage()
var client = MQTTClient.client
var parser = JSONParser.parser
var messageQueue: CircularQueue!
let semaphore = DispatchSemaphore(value: 0)
let queue = DispatchQueue(label: "sendThreadQueue")
var putCnt = 0
var takeCnt = 0
override private init() {
messageQueue = CircularQueue(capacity: 10000)
}
func putMqttMessage(messageFormat: MqttMessageFormat) {
//self.semaphore.signal()
queue.async {
if self.messageQueue.offer(value: messageFormat) {
self.putCnt += 1
print("msgQueue offer success \(self.putCnt), queue size=\(self.messageQueue.capacity)")
self.semaphore.signal()
} else {
print("msgQueue is FULL!")
self.semaphore.wait()
}
}
}
func startThread() {
if (self.isExecuting) {
print("sendThread is running")
} else {
self.start()
print("sendThread start")
}
}
override func main() {
while(true) {
if self.messageQueue.isEmpty() {
//print("msgQueue messageFormat is nil")
self.semaphore.wait()
} else {
self.semaphore.signal()
queue.async {
if let messageFormat = self.messageQueue.poll() {
self.client.publish(topic: self.client.topic_data, message: self.parser.jsonWrite(object: messageFormat)!)
self.takeCnt += 1
print("msgQueue poll success \(self.takeCnt), queue size=\(self.messageQueue.capacity)")
} /*else {
print("msgQueue poll failed, queue size=\(self.messageQueue.capacity)")
}*/
}
}
}
}
}
| 27.5625 | 130 | 0.51746 |
18e82fbb3dc73ad8fa4e0fb840ffd8162cc53785 | 65 | rb | Ruby | lib/guard/haml/version.rb | cqpx/guard-haml | 100dbaa3e08c4f6bc6e58a2dd614f286d07824c5 | [
"MIT"
] | 6 | 2015-01-16T06:09:53.000Z | 2018-07-27T14:57:39.000Z | lib/guard/haml/version.rb | rubyjedi/guard-haml2erb | d8ddeace08c912f008aaa36633778ddc529e6da8 | [
"MIT"
] | 3 | 2015-02-10T06:40:01.000Z | 2016-09-09T15:39:57.000Z | lib/guard/haml/version.rb | rubyjedi/guard-haml2erb | d8ddeace08c912f008aaa36633778ddc529e6da8 | [
"MIT"
] | 6 | 2015-02-06T04:46:36.000Z | 2020-12-07T10:34:30.000Z | module Guard
class HamlVersion
VERSION = '1.1.2'
end
end
| 10.833333 | 21 | 0.661538 |
83f64487f01ba7e1d33f0155beefde99697de85c | 587 | go | Go | golang/src/mypkg/work/race_conditions.go | thamada/goHolo | 052bce5ad9a9bc990537eb3474b344dae4e000ec | [
"MIT"
] | null | null | null | golang/src/mypkg/work/race_conditions.go | thamada/goHolo | 052bce5ad9a9bc990537eb3474b344dae4e000ec | [
"MIT"
] | null | null | null | golang/src/mypkg/work/race_conditions.go | thamada/goHolo | 052bce5ad9a9bc990537eb3474b344dae4e000ec | [
"MIT"
] | null | null | null | //Time-stamp: <2017-01-29 02:20:04 hamada>
package work
import (
"fmt"
"time"
)
func Race_conditions() {
ni := 100
for i := 0; i < ni; i++ {
// calc() is a closure which has 'i' on the shared memory.
calc := func(id int) {
ii := i // i is on shared memory
time.Sleep(100 * time.Nanosecond)
var s = fmt.Sprintf("%v%v", id, i)
if ii != i {
fmt.Printf("id=%v, i=%v\n", id, i)
fmt.Println(s)
fmt.Println([]byte(s))
}
}
if true {
go calc(i)
} else {
calc(i)
}
time.Sleep(10000 * time.Nanosecond)
}
time.Sleep(10 * time.Millisecond)
}
| 16.771429 | 60 | 0.560477 |
c24fadf2891cc64a181991b53ab9930a72701e19 | 627 | go | Go | connect/get_info.go | Dancheg97/TradeSet | 04c9734d52d76d7d236f48976b7d3ded1958426e | [
"MIT"
] | 1 | 2022-03-05T11:59:47.000Z | 2022-03-05T11:59:47.000Z | connect/get_info.go | Dancheg97/TradeSet | 04c9734d52d76d7d236f48976b7d3ded1958426e | [
"MIT"
] | null | null | null | connect/get_info.go | Dancheg97/TradeSet | 04c9734d52d76d7d236f48976b7d3ded1958426e | [
"MIT"
] | null | null | null | package connect
import (
"encoding/json"
"net/http"
"tradebits/mongoer"
)
type InfoResponse struct {
Name string `json:"name"`
Mkey string `json:"mkey"`
}
func saveInformation(adress string, mongo mongoer.IMongoer) error {
response, err := http.Get("http://" + adress + "/info/market")
if err != nil {
return err
}
dec := json.NewDecoder(response.Body)
resp := InfoResponse{}
err = dec.Decode(&resp)
if err != nil {
return err
}
newMarket := map[string]string{
"name": resp.Name,
"mkey": resp.Mkey,
"link": adress,
}
err = mongo.Put("net", newMarket)
if err != nil {
return err
}
return nil
}
| 17.416667 | 67 | 0.652313 |
ffffaf47a0daf14e7b541f5aa9ee57457b3c5e58 | 5,633 | html | HTML | app/admin/view/admin_dictionary/edit.html | li304665450/myApp | 0ef9bbf8e486ee5aab470782104ff1f0c6aaf14d | [
"Apache-2.0"
] | null | null | null | app/admin/view/admin_dictionary/edit.html | li304665450/myApp | 0ef9bbf8e486ee5aab470782104ff1f0c6aaf14d | [
"Apache-2.0"
] | null | null | null | app/admin/view/admin_dictionary/edit.html | li304665450/myApp | 0ef9bbf8e486ee5aab470782104ff1f0c6aaf14d | [
"Apache-2.0"
] | null | null | null | <!--_meta页面公共开头-->
{include file="public/_meta" /}
<link href="__STATIC__/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/admin/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<div class="page-container">
<form class="form form-horizontal" id="form-news-add">
<input type="hidden" name="id" id="id" value=""/>
<input type="hidden" name="pid" id="pid" value="0"/>
<input type="hidden" name="status" id="status" value="1"/>
<input type="hidden" name="type" id="type" value="0"/>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>字典名:</label>
<div class="formControls col-xs-8 col-sm-9">
<input class="input-text" value="" placeholder="" id="name" name="name">
</div>
</div>
<div class="row cl" id="value_label" style="display: none">
<label class="form-label col-xs-4 col-sm-2">字典值:</label>
<div class="formControls col-xs-8 col-sm-9">
<input class="input-text" value="" placeholder="" id="value" name="value">
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">备注:</label>
<div class="formControls col-xs-8 col-sm-9">
<input class="input-text" value="" placeholder="" id="remark" name="remark">
</div>
</div>
<div class="row cl" id="table_label" style="display: none">
<label class="form-label col-xs-4 col-sm-2">对应表名:</label>
<div class="formControls col-xs-8 col-sm-9">
<input class="input-text" value="" placeholder="" id="table" name="table">
</div>
</div>
<div class="row cl" id="field_lable" style="display: none">
<label class="form-label col-xs-4 col-sm-2">对应字段:</label>
<div class="formControls col-xs-8 col-sm-9">
<input class="input-text" value="" placeholder="" id="field" name="field">
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">排序值:</label>
<div class="formControls col-xs-8 col-sm-9">
<input class="input-text" value="" placeholder="0" id="listorder" name="listorder">
</div>
</div>
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button id="sub_btn" class="btn btn-primary radius" type="button"><i class="Hui-iconfont"></i> 保存并提交审核</button>
<button id="draft_btn" class="btn btn-secondary radius" type="button"><i class="Hui-iconfont"></i> 保存草稿</button>
<button onClick="layer_close();" class="btn btn-default radius" type="button"> 取消 </button>
</div>
</div>
</form>
</div>
<!--_footer 作为公共模版分离出去-->
{include file="public/_footer" /}
<!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__STATIC__/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/edit.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/image.js"></script>
<script type="text/javascript">
$(function(){
//数据加载方法
if(getUrlParam('id')){
info_display(getUrlParam('id'),'{:url("infoAjax")}');
}
//设置字段类型:栏目或字典内容
if(getUrlParam('type') == 0){
$('#type').val(1);
$('#field_lable').css('display','block');
}else if(getUrlParam('type') == 1){
$('#type').val(2);
$('#value_label').css('display','block');
}else {
$('#table_label').css('display','block');
}
//设置pid
if(getUrlParam('pid')){
$('#pid').val(getUrlParam('pid'));
}
//验证及提交操作
$("#form-news-add").validate({
rules:{
title:{
required:true,
minlength:2,
maxlength:20
},
small_title:{
required:true,
},
catid:{
required:true,
},
listorder:{
required:true,
number:1
},
source_type:{
required:true,
},
description:{
required:true,
},
content:{
required:true,
minlength:2,
maxlength:200
}
},
onkeyup:false,
focusCleanup:true,
success:"valid",
submitHandler:function(form){
$(form).ajaxSubmit({
type: 'post',
url: "{:url('saveAjax')}",
success: function(data){
console.log(data);
layer.msg(data.msg,{icon:1,time:1000});
var t = setTimeout('window.history.go(1)',1000);
},
error: function(XmlHttpRequest, textStatus, errorThrown){
layer.msg('页面错误',{icon:1,time:1000});
}
});
// var index = parent.layer.getFrameIndex(window.name);
// parent.$('.btn-refresh').click();
// parent.layer.close(index);
}
});
});
</script>
</body>
</html> | 36.577922 | 124 | 0.552104 |
a9bed919a54cb8d639ff590f22ff55e7652b35e5 | 2,743 | htm | HTML | _data/Vol01_Ch0001-0042F/HRS0006K/HRS_0006K-.htm | bronsonavila/hrsscraper | ecbb1048ab284af361fae78adb481eff554b067a | [
"MIT"
] | 1 | 2019-02-22T10:35:29.000Z | 2019-02-22T10:35:29.000Z | _data/Vol01_Ch0001-0042F/HRS0006K/HRS_0006K-.htm | bronsonavila/hrsscraper | ecbb1048ab284af361fae78adb481eff554b067a | [
"MIT"
] | null | null | null | _data/Vol01_Ch0001-0042F/HRS0006K/HRS_0006K-.htm | bronsonavila/hrsscraper | ecbb1048ab284af361fae78adb481eff554b067a | [
"MIT"
] | null | null | null | <div class="WordSection1">
<p align="center" class="RegularParagraphs" style="text-align:center"><b>CHAPTER 6K</b></p>
<p align="center" class="RegularParagraphs" style="text-align:center"><b>KAHO</b><b>OLAWE ISLAND RESERVE</b></p>
<p class="RegularParagraphs"></p>
<p class="RegularParagraphs">Section</p>
<p class="RegularParagraphs"> 6K-1 Administration of chapter</p>
<p class="RegularParagraphs"> 6K-2 Definitions</p>
<p class="RegularParagraphs"> 6K-3 Reservation of uses</p>
<p class="RegularParagraphs"> 6K-4 Powers and duties</p>
<p class="RegularParagraphs"> 6K-4.5 Procurement; exemptions</p>
<p class="RegularParagraphs"> 6K-5 Commission</p>
<p class="RegularParagraphs"> 6K-6 Responsibilities and duties of the commission</p>
<p class="RegularParagraphs"> 6K-7 Fishing</p>
<p class="RegularParagraphs"> 6K-8 Penalty</p>
<p class="RegularParagraphs"> 6K-8.5 General administrative penalties</p>
<p class="RegularParagraphs"> 6K-8.6 Administrative violation system</p>
<p class="RegularParagraphs"> 6K-9 Transfer</p>
<p class="RegularParagraphs"> 6K-9.5 Kahoolawe rehabilitation trust fund</p>
<p class="RegularParagraphs"> 6K-10 Severability</p>
<p class="RegularParagraphs"></p>
<p class="XNotesHeading">Note</p>
<p class="XNotes"></p>
<p class="XNotes"> L 2014, c 218, §8 purports to amend this chapter.</p>
<p class="XNotes"></p>
<p class="XNotesHeading">Cross References</p>
<p class="XNotes"></p>
<p class="XNotes"> Conclusive presumptions; unexploded ordnance on Kahoolawe and in the ocean adjacent to Kahoolawe, see §662-18.</p>
<p class="XNotes"> Environmental courts, jurisdiction over proceedings arising under this chapter, see §604A-2.</p>
<p class="XNotes"></p>
<p class="XNotesHeading">Case Notes</p>
<p class="XNotes"></p>
<p class="XNotes"> Administrative rules pertaining to entrance into the Kahoolawe island reserve did not: (1) abridge defendants' constitutional right to engage in traditional and customary Hawaiian practices; or (2) unconstitutionally burden defendants' right to practice their religion. 132 H. 36, 319 P.3d 1044 (2014).</p>
<p class="XNotes"> Complaints filed by the State against defendants for the offense of entrance into the Kahoolawe island reserve dismissed without prejudice because the complaints did not allege the requisite state of mind of intentionally, knowingly, or recklessly. 132 H. 36, 319 P.3d 1044 (2014).</p>
<p class="XNotes"> Where the defendants' purpose was to claim and manage, control, and subsequently occupy Kahoolawe, the defendants' intent to communicate through their presence on Kahoolawe could not be deemed "speech" for purposes of the First Amendment freedom of speech protections. 132 H. 36, 319 P.3d 1044 (2014).</p>
<p class="XNotes"></p>
</div> | 76.194444 | 326 | 0.751003 |
7afd80ecb9f77bb6fc98052a04bc288180586799 | 4,693 | dart | Dart | lib/view/account_page.dart | ssssky/costly | 99aebda2cbc129566a535786c808e3fcca3c5d30 | [
"BSD-3-Clause"
] | null | null | null | lib/view/account_page.dart | ssssky/costly | 99aebda2cbc129566a535786c808e3fcca3c5d30 | [
"BSD-3-Clause"
] | null | null | null | lib/view/account_page.dart | ssssky/costly | 99aebda2cbc129566a535786c808e3fcca3c5d30 | [
"BSD-3-Clause"
] | null | null | null | import 'package:costly/base/base_stateful_widget.dart';
import 'package:flutter/material.dart';
class AccountPage extends BaseStatefulWidget {
@override
IconData get iconData => Icons.account_balance;
@override
String get title => '资产';
@override
State<StatefulWidget> createState() {
return _AccountPageState();
}
}
class _AccountPageState extends State<AccountPage> {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2,
child: Scaffold(
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
child: SliverAppBar(
//阴影
elevation: 4.0,
forceElevated: true,
//标题
title: Text('账户'),
centerTitle: false,
//右侧按钮
actions: <Widget>[
IconButton(
icon: Icon(Icons.add),
onPressed: () {
print('aaa');
})
],
//标题栏导航
bottom: TabBar(
labelStyle: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
unselectedLabelStyle:
TextStyle(fontSize: 16.0, fontWeight: FontWeight.normal),
unselectedLabelColor: Colors.blueGrey,
indicatorWeight: 3.0,
indicatorSize: TabBarIndicatorSize.label,
tabs: [Tab(text: '资产'), Tab(text: '负债')]),
),
)
];
},
body: TabBarView(children: [
ListView(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
children: <Widget>[AccountItem(), AccountItem()],
),
ListView(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
children: <Widget>[AccountItem(), AccountItem(), AccountItem()],
)
])),
),
);
}
}
class AccountItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
color: Colors.lightBlue.shade600,
child: Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
//标题
Padding(
padding: const EdgeInsets.only(left: 30.0, top: 4.0, bottom: 4.0),
child: Text(
'现金',
style: TextStyle(fontSize: 25.0, color: Colors.white),
),
),
//结余
Padding(
padding: const EdgeInsets.all(4.0),
child: Row(
children: <Widget>[
Text(
'结余',
style: TextStyle(color: Colors.white),
),
Expanded(
child: Center(
child: Text(
'0.00',
style: TextStyle(color: Colors.white),
),
),
)
],
),
),
//月花
Padding(
padding: const EdgeInsets.all(4.0),
child: Row(
children: <Widget>[
Text(
'月花',
style: TextStyle(color: Colors.white),
),
Expanded(
child: Center(
child: Text(
'8.00',
style: TextStyle(color: Colors.white),
),
),
)
],
),
)
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Icon(
Icons.credit_card,
size: 40.0,
color: Colors.white,
),
),
],
),
);
}
}
| 32.143836 | 91 | 0.402941 |
27acb9142887641e5826c735331ff225b4da4ce6 | 629 | css | CSS | main.css | Thomasbernard78/Projet-1 | a7cf65229b251e87f04ec9e34d27817463a316eb | [
"MIT"
] | null | null | null | main.css | Thomasbernard78/Projet-1 | a7cf65229b251e87f04ec9e34d27817463a316eb | [
"MIT"
] | null | null | null | main.css | Thomasbernard78/Projet-1 | a7cf65229b251e87f04ec9e34d27817463a316eb | [
"MIT"
] | null | null | null |
.titre {
font-family: verdana;
font-size: 25px;
text-align: center;
background-color: blue;
color: white;
}
.texte {
font-family: verdana;
font-size: 20px;
text-align: center;
}
.titre2 {
font-weight: bolder;
font-size: 30px;
text-align: center;
}
.texte2 {
font-size: 20px;
text-align: right;
margin-right: 50px
}
.bouton {
display: inline-block;
height: 25px;
position: absolute;
right: 875px;
background: url('fond.jpg') repeat-x;
border-radius: 5px;
font-size: 1.2em;
text-align: center;
padding: 3px 8px 0px 8px;
color: white;
}
| 15.725 | 42 | 0.605723 |
74097af522e255863313ca8c876ec5bdfc0fda15 | 6,153 | rs | Rust | cdrs-tokio/src/query/utils.rs | wagenet/cdrs-tokio | ea60a3bb78bb2420fc279d612e67f40fe4469827 | [
"Apache-2.0",
"MIT"
] | null | null | null | cdrs-tokio/src/query/utils.rs | wagenet/cdrs-tokio | ea60a3bb78bb2420fc279d612e67f40fe4469827 | [
"Apache-2.0",
"MIT"
] | null | null | null | cdrs-tokio/src/query/utils.rs | wagenet/cdrs-tokio | ea60a3bb78bb2420fc279d612e67f40fe4469827 | [
"Apache-2.0",
"MIT"
] | null | null | null | use crate::cluster::{GetCompressor, GetConnection, GetRetryPolicy, ResponseCache};
use crate::error;
use crate::error::Error;
use crate::frame::frame_response::ResponseBody;
use crate::frame::frame_result::ResultKind;
use crate::frame::parser::parse_raw_frame;
use crate::frame::{Flag, Frame, FromBytes, Opcode, StreamId};
use crate::retry::{QueryInfo, RetryDecision};
use crate::transport::CdrsTransport;
use crate::types::INT_LEN;
use std::ops::Deref;
pub fn prepare_flags(with_tracing: bool, with_warnings: bool) -> Vec<Flag> {
let mut flags = vec![];
if with_tracing {
flags.push(Flag::Tracing);
}
if with_warnings {
flags.push(Flag::Warning);
}
flags
}
pub async fn send_frame<S: ?Sized, T>(
sender: &S,
frame_bytes: Vec<u8>,
stream_id: StreamId,
is_idempotent: bool,
) -> error::Result<Frame>
where
S: GetConnection<T> + GetCompressor + ResponseCache + GetRetryPolicy,
T: CdrsTransport + Unpin + 'static,
{
let compression = sender.compressor();
let mut retry_session = sender.retry_policy().new_session();
'next_node: loop {
let transport = sender
.connection()
.await
.ok_or_else(|| Error::from("Unable to get transport"))?
.pool();
let pool = transport
.get()
.await
.map_err(|error| Error::from(error.to_string()));
let pool = match pool {
Ok(pool) => pool,
Err(error) => {
let query_info = QueryInfo {
error: &error,
is_idempotent,
};
if retry_session.decide(query_info) == RetryDecision::DontRetry {
return Err(error);
}
continue;
}
};
'same_node: loop {
{
let mut lock = pool.lock().await;
loop {
if let Err(error) = lock.write_all(&frame_bytes).await {
let error = Error::from(error);
let query_info = QueryInfo {
error: &error,
is_idempotent,
};
match retry_session.decide(query_info) {
RetryDecision::RetrySameNode => continue,
RetryDecision::RetryNextNode => continue 'next_node,
RetryDecision::DontRetry => return Err(error),
}
}
// TLS connections may not write data to the stream immediately,
// but may wait for more data. Ensure the data is sent.
// Otherwise Cassandra server will not send out a response.
if let Err(error) = lock.flush().await {
let error = Error::from(error);
let query_info = QueryInfo {
error: &error,
is_idempotent,
};
match retry_session.decide(query_info) {
RetryDecision::RetrySameNode => continue,
RetryDecision::RetryNextNode => continue 'next_node,
RetryDecision::DontRetry => return Err(error),
}
}
break;
}
}
loop {
let frame = parse_raw_frame(pool.deref(), compression).await?;
if let Some(frame) = sender.match_or_cache_response(stream_id, frame).await {
// in case we get a SetKeyspace result, we need to store current keyspace
// checks are done manually for speed
match frame.opcode {
Opcode::Result => {
let result_kind = ResultKind::from_bytes(&frame.body[..INT_LEN])?;
if result_kind == ResultKind::SetKeyspace {
let response_body = frame.body()?;
let set_keyspace = response_body
.into_set_keyspace()
.expect("SetKeyspace not found with SetKeyspace opcode!");
let transport = pool.lock().await;
transport
.set_current_keyspace(set_keyspace.body.as_str())
.await;
}
}
Opcode::Error => {
let error = convert_frame_into_error(frame);
let query_info = QueryInfo {
error: &error,
is_idempotent,
};
match retry_session.decide(query_info) {
RetryDecision::RetrySameNode => continue 'same_node,
RetryDecision::RetryNextNode => continue 'next_node,
RetryDecision::DontRetry => return Err(error),
}
}
_ => {}
}
return Ok(frame);
}
}
}
}
}
fn convert_frame_into_error(frame: Frame) -> Error {
frame
.body()
.and_then(|err| -> Result<(), Error> {
match err {
ResponseBody::Error(err) => Err(Error::Server(err)),
_ => unreachable!(),
}
})
.unwrap_err()
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn prepare_flags_test() {
assert_eq!(prepare_flags(true, false), vec![Flag::Tracing]);
assert_eq!(prepare_flags(false, true), vec![Flag::Warning]);
assert_eq!(
prepare_flags(true, true),
vec![Flag::Tracing, Flag::Warning]
);
}
}
| 34.960227 | 94 | 0.462214 |
78198d2920267c90f7df254fb18604f20f5f51d4 | 346 | dart | Dart | example/simple.dart | 0xff00ff/dartness | f65d1bd1c93c0e2a9b48dec859b907ea1f235bb1 | [
"BSD-3-Clause"
] | 8 | 2018-05-29T10:03:43.000Z | 2019-11-09T19:13:08.000Z | example/simple.dart | 0xff00ff/dartness | f65d1bd1c93c0e2a9b48dec859b907ea1f235bb1 | [
"BSD-3-Clause"
] | 4 | 2019-06-25T21:44:08.000Z | 2020-10-23T09:56:30.000Z | example/simple.dart | 0xff00ff/dartness | f65d1bd1c93c0e2a9b48dec859b907ea1f235bb1 | [
"BSD-3-Clause"
] | 1 | 2019-06-25T20:26:21.000Z | 2019-06-25T20:26:21.000Z | import 'package:dartness/dartness.dart';
void main() {
final app = new Dartness();
final router = new Router();
// add simple middleware that will catch all requests
app.use((Context context) async {
context.res.write('m1');
});
router.get('/', (Context ctx) async => ctx.res.write('r1'));
app.use(router);
app.listen();
}
| 21.625 | 62 | 0.644509 |
729792b6e23b39d5847ec9aa11ff01960e30c167 | 3,100 | rs | Rust | kernel/src/syscall/fs.rs | hwangwy/rv-vrt | 70c60150e7550ba3dae64535ba9880f9c73b9721 | [
"Apache-2.0"
] | 1 | 2021-10-18T11:59:37.000Z | 2021-10-18T11:59:37.000Z | kernel/src/syscall/fs.rs | hwenyuu/rv-vrt | 70c60150e7550ba3dae64535ba9880f9c73b9721 | [
"Apache-2.0"
] | null | null | null | kernel/src/syscall/fs.rs | hwenyuu/rv-vrt | 70c60150e7550ba3dae64535ba9880f9c73b9721 | [
"Apache-2.0"
] | null | null | null | use alloc::vec::Vec;
use crate::ipc::MessagePacket;
use crate::mm::{UserBuffer, translated_byte_buffer, translated_str};
use crate::task::{PidHandle, current_task, current_user_token, find_task};
use crate::service::{REGISTRY, Service};
pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize {
let token = current_user_token();
let task = current_task().unwrap();
let inner = task.acquire_inner_lock();
if fd >= inner.fd_table.len() {
return -1;
}
if let Some(file) = &inner.fd_table[fd] {
let file = file.clone();
// release Task lock manually to avoid deadlock
file.write(UserBuffer::new(translated_byte_buffer(token, buf, len))) as isize
} else {
-1
}
}
pub fn sys_read(fd: usize, buf: *const u8, len: usize) -> isize {
let token = current_user_token();
let task = current_task().unwrap();
let inner = task.acquire_inner_lock();
if fd >= inner.fd_table.len() {
return -1;
}
if let Some(file) = &inner.fd_table[fd] {
let file = file.clone();
// release Task lock manually to avoid deadlock
drop(inner);
file.read(UserBuffer::new(translated_byte_buffer(token, buf, len))) as isize
} else {
-1
}
}
pub fn sys_close(fd: usize) -> isize {
let task = current_task().unwrap();
let mut inner = task.acquire_inner_lock();
if fd >= inner.fd_table.len() {
return -1;
}
if inner.fd_table[fd].is_none() {
return -1;
}
inner.fd_table[fd].take();
0
}
pub fn sys_channel_write(service_path: *const u8, buf: *const u8, len: usize) -> isize {
// get current task token
let token = current_user_token();
// find the task correspond to service
let service_path_str = translated_str(token, service_path);
let pid = REGISTRY.find_task(&Service::new(service_path_str));
let task = find_task(pid).unwrap();
let buf_arr = translated_byte_buffer(token, buf, len);
let mut data: Vec<u8> = Vec::new();
for buf in buf_arr {
for v in buf {
data.push(*v)
}
}
// transfer bytes to MessagePacket
let message_packet = MessagePacket {
data,
handle: PidHandle(current_task().unwrap().pid.0),
};
let inner = task.acquire_inner_lock();
inner.channel.1.write_msg(message_packet);
0
}
pub fn sys_channel_read(buf: *mut u8, len: usize) -> isize {
let task = current_task().unwrap();
let token = current_user_token();
let task_inner = task.acquire_inner_lock();
let message_packet: MessagePacket;
if let Some(m) = task_inner.channel.0.read_msg() {
message_packet = m;
} else {
return -1;
}
let user_buffer = UserBuffer::new(translated_byte_buffer(token, buf, len));
let mut iter = user_buffer.into_iter();
for message_byte in message_packet.data.iter() {
if let Some(buffer) = iter.next() {
unsafe {
*buffer = *message_byte;
}
continue;
} else {
break;
}
}
0
}
| 29.807692 | 88 | 0.61129 |
2f0dcc1f40f38e0f2526ecf0a023ba2150945c8e | 6,116 | php | PHP | resources/views/admin/car/edit.blade.php | meiyoufengzhengdexian/ouyazhulin | 6457b2f46f1e846529c2776d85f936fea6a292a8 | [
"Apache-2.0"
] | null | null | null | resources/views/admin/car/edit.blade.php | meiyoufengzhengdexian/ouyazhulin | 6457b2f46f1e846529c2776d85f936fea6a292a8 | [
"Apache-2.0"
] | null | null | null | resources/views/admin/car/edit.blade.php | meiyoufengzhengdexian/ouyazhulin | 6457b2f46f1e846529c2776d85f936fea6a292a8 | [
"Apache-2.0"
] | null | null | null | @extends('layout.admin')
@section('right_col')
<div class="right_col">
<div class="page-title">
<div class="title_left">
<h2>编辑Car</h2>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_content">
<form class="form-horizontal form-label-left" novalidate data-parsley-validate
action="{{ url("admin/car/$data->id") }}" method="post">
{{ csrf_field() }}
{{ method_field('PATCH') }}
<span class="section">Car信息</span>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12"
for="car_patt">车辆型号</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select name="car_patt" id="car_patt" class="form-control">
@foreach($car_patt_names as $car_patt)
<option
@if($car_patt->id == $data->car_patt)
selected="true"
@endif
value="{{ $car_patt->id }}">{{ $car_patt->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12"
for="license_plate">车辆牌照</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="license_plate" class="form-control col-md-7 col-xs-12"
name="license_plate" placeholder="请输入车辆牌照" required="required"
value="{{ $data->license_plate }}" type="text">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12"
for="km">行驶公里数</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="km" class="form-control col-md-7 col-xs-12" name="km"
placeholder="请输入行驶公里数" required="required" value="{{ $data->km }}"
data-validate-minmax="0," type="number">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12"
for="color">颜色</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="color" class="form-control col-md-7 col-xs-12" name="color"
placeholder="请输入颜色" required="required" value="{{ $data->color }}"
type="text">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12"
for="status">状态</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select name="status" id="status" class="form-control">
<option value="1" @if($data->status == 1) selected @endif>启用</option>
<option value="0" @if($data->status == 0) selected @endif>禁用</option>
</select>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12"
for="store">所属门店</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select name="store" id="store" class="form-control">
@foreach($stores as $store)
@endforeach
<option value="{{ $store->id }}" @if($data->store == $store->id) selected @endif>{{ $store->name }}</option>
</select>
</div>
</div>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<button type="reset" class="btn btn-primary return">取消</button>
<button id="send" type="submit" class="btn btn-success">确定</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('addcss')
@endpush
@push('addjs')
<script src="{{ asset('public/vendors/validator/validator.js') }}"></script>
<script>
@foreach($errors->all() as $e)
new PNotify({
title: 'Oh No!',
text: '{{ $e }}',
type: 'error'
});
@endforeach
</script>
@endpush | 53.649123 | 148 | 0.355134 |
76d27a9f6e5abbe5f966fb44e86c8bef572f5aa7 | 521 | h | C | src_blockchain/bc/BlockchainsConfig.h | alinous-core/codable-cash | 32a86a152a146c592bcfd8cc712f4e8cb38ee1a0 | [
"MIT"
] | 1 | 2020-10-15T08:24:35.000Z | 2020-10-15T08:24:35.000Z | src_blockchain/bc/BlockchainsConfig.h | Codablecash/codablecash | 8816b69db69ff2f5da6cdb6af09b8fb21d3df1d9 | [
"MIT"
] | null | null | null | src_blockchain/bc/BlockchainsConfig.h | Codablecash/codablecash | 8816b69db69ff2f5da6cdb6af09b8fb21d3df1d9 | [
"MIT"
] | null | null | null | /*
* BlockchainsConfig.h
*
* Created on: 2019/01/01
* Author: iizuka
*/
#ifndef BC_BLOCKCHAINSCONFIG_H_
#define BC_BLOCKCHAINSCONFIG_H_
namespace alinous {
class File;
}
namespace codablecash {
using namespace alinous;
/**
* load config from file
*/
class BlockchainsConfig {
public:
BlockchainsConfig(const BlockchainsConfig& inst);
BlockchainsConfig();
~BlockchainsConfig();
public:
File* baseFolder;
int ipV6Port = 14001;
};
} /* namespace codablecash */
#endif /* BC_BLOCKCHAINSCONFIG_H_ */
| 14.472222 | 50 | 0.725528 |
d297b3433caa604e0705ecb7c0fc033866da0a5c | 554 | php | PHP | public/pages/home.php | thalysonrodrigues/php-pqe-php | ee95d4b0cc51637e3c39e9c0b0b7e8bbb1d157cf | [
"MIT"
] | null | null | null | public/pages/home.php | thalysonrodrigues/php-pqe-php | ee95d4b0cc51637e3c39e9c0b0b7e8bbb1d157cf | [
"MIT"
] | null | null | null | public/pages/home.php | thalysonrodrigues/php-pqe-php | ee95d4b0cc51637e3c39e9c0b0b7e8bbb1d157cf | [
"MIT"
] | null | null | null | <nav class="navbar navbar-default">
<div class="container">
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="?page=cadastrar">Cadastrar</a></li>
<li><a href="?page=contato">Contato</a></li>
<li><a href="?page=listar">Listar usuários</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<?=get("message")?>
<h2>Página inicial</h2>
| 32.588235 | 76 | 0.592058 |
6724784693742495922709316ceeb427eac6432d | 17,875 | asm | Assembly | roms/ppu/bkg/bkg.asm | flga/vnes | fe8b504e5b780ff51add570d1bcc400d48248077 | [
"Unlicense"
] | 1 | 2019-02-28T12:11:33.000Z | 2019-02-28T12:11:33.000Z | roms/ppu/bkg/bkg.asm | flga/vnes | fe8b504e5b780ff51add570d1bcc400d48248077 | [
"Unlicense"
] | null | null | null | roms/ppu/bkg/bkg.asm | flga/vnes | fe8b504e5b780ff51add570d1bcc400d48248077 | [
"Unlicense"
] | null | null | null | ; A graphics test (first)
; This to be assembled using the NES Assembler.
; Copyright (C) 2003 Justin Patrick "Beneficii" Butler
.inesprg 1 ; Only 16kb PRG-ROM needed.
.ineschr 1 ; Only 8kb CHR-ROM needed.
.inesmir 0 ; No (though set to horizontal) mirroring needed.
.inesmap 0 ; No mappers needed.
.zp ; Declaring zero page variables
address_lo = $00
address_hi = $01
a.button = $02
b.button = $03
select.button = $04
start.button = $05
up.button = $06
down.button = $07
left.button = $08
right.button = $09
y.move = $0a
x.move = $0b
y.pos = $0c
x.pos = $0d
temp = $0e
curtile = $0f
nmiflag = $10
read.lo = $11
read.hi = $12
move.type.1 = $13
move.type.2 = $14
sound.flag = $15
check.sound.flag = $16
.bss ; Declaring page seven sprite variables
sprite.y = $0700
sprite.tile = $0701
sprite.attributes = $0702
sprite.x = $0703
.code ; Stajmp finish_nming code with .org at $8000. It doesn't really matter which I pick, because
.org $8000 ; the code is copied into the PRG-ROM twice. (That is, $8000 or $C000.)
wait_vblank: ; Wait for VBlank to be turned on.
lda $2002
bpl wait_vblank
rts
main: ; Begin the RESET routine.
sei ; The usual, setting the interrupt disable flag and
cld ; clearing the decimal mode flag.
ldx #$ff ; Set x to $FF.
txs ; Transfer $FF to the stack, thereby resetting it.
jsr wait_vblank ; Wait for VBlank before turning off the screen.
lda #$00 ; Turning
sta $2000 ; the screen
sta $2001 ; off
inx ; Getting ready to clear the zero page memory.
clearzp:
sta <$00, x ; No need to reload the accumulator, because I know it's zero.
inx ; Increment. Needs to go through all 256 bytes of the zero page memory.
bne clearzp ; Go back if not finished (if x is not yet back to zero).
ldx #$07 ; Getting ready to clear the seven other pages of WRAM,
ldy #$01 ; to ensure that they are clear (the real NES probably
sty <address_hi ; has all sorts of strange, loaded values at the start).
dey ; Am going to use indirect addressing to accomplish so.
sty <address_lo ; I will begin at $100 and end at $7FF
clearwram:
sta [address_lo], y ; There is no need to set the accumulator to zero, because it is already.
iny ; Increment y.
bne clearwram ; If not yet zero again, then go back.
inc address_hi ; Increment the address indicating that it is time to go the next page.
dex ; Count down to zero.
bne clearwram ; Go back if not done.
ldy #$20 ; Getting ready to load the palette.
ldx #$3f ; Loading the variables.
stx $2006 ; Reading to $2006, high byte first.
ldx #$00 ; Putting
stx $2006 ; low byte in.
loadpal:
lda paldata, x ; Loading the palette data, which is located
sta $2007 ; elsewhere in the PRG-ROM byte by byte.
inx ; Read further into the data.
dey ; Decrement y until it is done.
bne loadpal ; There are $20 bytes to load, so y starts at $20.
lda $2002 ; Reset $2006 (since it hasn't been yet).
stx $2006 ; x I know is 20 from the last loop, and
sty $2006 ; y I know is 00 from the last loop, so
; I can set $2006 to VRAM $2000
ldx #$08 ; Getting ready to clear the first two name tables of the PPU
tya ; (the other two are mirrors, so there is no need).
clearppu:
sta $2007 ; Storing 0 in there to make sure it is cleared.
iny ; Go to next byte.
bne clearppu
dex ; Get to next page.
bne clearppu
jsr wait_vblank ; Some emulators, such as NESticle, have problems if I don't
; wait for VBlank after clearing the PPU, so I might as well.
ldx #$20 ; $2002 has already been read to reset $2006 (wait_vblank),
stx $2006 ; so there is no need to do so again.
sty $2006
ldx #$04
lda #low(mapdata) ; Getting ready to load the maze data.
sta <address_lo ; Prepping for use of indirect addressing.
lda #high(mapdata)
sta <address_hi
loadmap:
lda [address_lo], y ; Loading name and attribute tables #1.
sta $2007 ; No need for name and attribute tables #2, as I will not
iny ; be scrolling in this ROM.
bne loadmap
inc <address_hi
dex
bne loadmap
lda #212 ; Putting the sprite together
sta <y.pos ; to be placed on the screen.
sta sprite.y ; Done 216 - 4, so that the sprite's feet
lda #016 ; are in the middle of the tiles
sta <x.pos ; rather than the edge.
sta sprite.x
ldx #001
stx sprite.tile
dex
stx sprite.attributes
stx $2003 ; Reset $4014
lda #$07 ; Loading the sprites
sta $4014 ; "automagically."
lda #%10001000 ; Turning the screen back on so you can actually see something.
sta $2000
lda #%00011110
sta $2001
eternity: ; It's a good idea now to throw the RESET routine into an eternal loop,
jmp eternity ; otherwise it'll go on like crazy. ~_^
store_y: ; In case the sprite is moving up or down.
lda #low(sprite.y) ; This ensures that the code below knows that
sta <read.lo ; and writes to the right sprite variable.
lda #high(sprite.y)
sta <read.hi
lda #$00
sta <y.move
sta <x.move
jmp animate_movement
store_x: ; Same as above, except for moving right or left.
lda #low(sprite.x)
sta <read.lo
lda #high(sprite.x)
sta <read.hi
lda #$00
sta <y.move
sta <x.move
jmp animate_movement
update_sprites: ; Check in which direction the sprite is moving, if any.
lda <y.move
bne store_y
lda <x.move
bne store_x
sta <nmiflag ; If the sprite isn't moving, then
sta <read.lo ; just go ahead and clear the useless
sta <read.hi ; flags before they hurt someone. ~_^
sta <move.type.1
sta <move.type.2
ldx <sound.flag ; If the sound flag is activated (see below), then
bne allow_beep2 ; prevent it from being deactivated.
jmp do_still_move
allow_beep2: ; You see, in the first NMI (this is the second), if the sprite
inx ; goes over the "finish" tile, then flag is activated, which signals
stx <sound.flag ; this NMI to give the first the go-ahead to play the tone
stx <check.sound.flag ; for going over the "finish" tile come the first's return.
do_still_move: ; In case the sprite changed direction and is facing
lda #$00 ; an obstruction.
sta $2003
lda #$07
sta $4014
jmp finish_nmi ; Finish this NMI.
animate_movement: ; In case the sprite is moving its position.
lda #$00 ; Ensuring these are cleared.
tax
tay
lda sprite.tile ; Load the appropriate tile for the sprite.
clc ; The initial values are set in the first NMI.
adc #$02 ; Clear the carry flag and add two (left foot out first for the sprite).
sta sprite.tile
lda [read.lo], y ; Add or subtract two (set in the first NMI)
clc ; to the sprite.pos value.
adc <move.type.1 ; Of course this is done by indirect addressing,
sta [read.lo], y ; so I don't have to keep checking to see, if I'm changing
inc <nmiflag ; the x or y positions of the sprite.
sty $2003
lda #$07 ; Store the updated sprite
sta $4014 ; into the SPR-RAM.
jmp finish_nmi ; Terminate this NMI without further ado.
third_frame: ; Same as last, except that the sprite.pos
lda #$00 ; is incremented or decremented by four.
tax
tay
ldx sprite.tile ; Load the sprite.tile into x (so I can easily decrement).
dex ; This will cause the sprite to step out with his right foot.
stx sprite.tile
lda [read.lo], y
clc
adc <move.type.2
sta [read.lo], y
inc <nmiflag
sty $2003
lda #$07
sta $4014
jmp finish_nmi
fourth_frame: ; Pretty much the same
lda #$00
tax
tay
ldx sprite.tile ; Add or subtract 2 to the sprite.pos this time, in order to
dex ; make the complete 8 pixels.
stx sprite.tile ; Also decrement the sprite's tile to make it stand still
lda [read.lo], y ; when its movement is finished.
clc
adc <move.type.1
sta [read.lo], y
sty <nmiflag ; Clear these, because we are done with them.
sty <read.lo ; Reset the NMI flag to zero so as to go to the
sty <read.hi ; first NMI next NMI.
sty <move.type.1
sty <move.type.2
ldx <sound.flag ; If the sound flag is activated, then do the "allow_beep" thing.
bne allow_beep
jmp final_write
allow_beep: ; I'll explain the check sound flag below.
inx
stx <sound.flag
stx <check.sound.flag
final_write: ; Perform the final sprite write. ^_^
sty $2003
lda #$07
sta $4014
jmp finish_nmi ; Terminate, O final NMI!
send_me: ; If the NMI flag is not zero, then go here,
lda <nmiflag ; because it is not the first NMI.
cmp #$02
beq third_frame
lda <nmiflag
cmp #$03
beq fourth_frame
jmp update_sprites
nmi: ; Start the NMI code.
pha ; Store the accumulator and the x and y registers in the stack to
txa ; prevent them from being destroyed by the code here in case that this
pha ; NMI interrupted RESET code.
tya ; (Advised to do that by someone on nesdev.parodius.com
pha ; "Membled" messageboards
lda $2002 ; Set $2006 to $0000 each NMI to prevent the background display
lda #$00 ; from being messed up. Thanks (^_^) to the ever-helpful Memblers
sta $2006 ; for his advice on that one. Now the sprite's feet are in the
sta $2006 ; middle of the tile in every emulator (and probably the real thing)!
lda <nmiflag ; If the NMI flag is anything but zero, then go to the handler.
bne send_me ; This was the result of the appendaging of the animation and sound codes.
ldx #$01 ; Strobe the game controller.
stx $4016
dex
stx $4016 ; Reset it.
ldy #$08 ; Prepare to read it.
read_buttons: ; Reading it.
lda $4016 ; a.button is the first in the variable array,
and #$01 ; so we just read it from there.
sta <a.button, x ; Fix it so we just have bit 0 of it.
inx
dey
bne read_buttons
lda #$00 ; Have accumulator=zero, so first writes are zero.
ldx <up.button ; Test if buttons have been pressed.
bne up
ldx <down.button
bne down
ldx <right.button
bne right
ldx <left.button
bne left
sta <y.move ; If they have not.
sta <x.move
jmp continue
up: ; If the player pressed up.
sta <x.move ; Clear x.move.
lda #$f8 ; Signal to decrement (not increment) 8
sta <y.move ; by taking advantage of the sign bit (number 7).
lda #$fe ; For the second and fourth NMI's,
sta <move.type.1 ; it is to move backward (not forward two).
lda #$fc ; For the third NMI,
sta <move.type.2 ; it is to move backward (not forward two).
lda #$40 ; Since I'm moving up, it will not look like
sta sprite.attributes ; the first foot is left. So I flip it (bit attributes.6).
lda #$01 ; Always do still tile first.
sta sprite.tile
jmp continue
down: ; Same as above, except that everything is opposite.
sta <x.move
sta sprite.attributes
lda #$08
sta <y.move
lda #$02
sta <move.type.1
lda #$04
sta <move.type.2
lda #$01
sta sprite.tile
jmp continue
left: ; Same as above, except that things are suited for left-right.
sta <y.move ; The unflipped sprite in this faces left.
sta sprite.attributes
lda #$f8
sta <x.move
lda #$fe
sta <move.type.1
lda #$fc
sta <move.type.2
lda #$04
sta sprite.tile
jmp continue
right: ; You get my drift.
sta <y.move
lda #$08
sta <x.move
lda #$02
sta <move.type.1
lda #$04
sta <move.type.2
lda #$40
sta sprite.attributes
lda #$04
sta sprite.tile
continue:
lda #$00 ; This was to put in, to ensure that sound was disabled.
sta $4015 ; Didn't know much about it, so I took that precaution.
sta <address_hi ; This was not designed to be a sound player, but I wanted
lda <x.pos ; to tinker with playing at least a tone when you get to the
clc ; "finish" tile.
adc <x.move ; This batch of code tests whether there will be an obstruction
sta <address_lo ; in the characters path if he moves in whatever direction he
lda <y.pos ; was gonna.
clc ; Ensure that address_hi is cleared, and store the x position
adc <y.move ; to address_lo.
clc ; Also we calculate the proposed position to get it ready.
adc #004 ; Add four to the y.move to get it in line with its true "spot."
sta <temp ; That was four off so the characters feet could be in the middle of the tile.
ldx #$03 ; Store in temp, because we have a lot more work to do with it.
ldy #$02 ; Prep vars for next two subroutines.
set_address_x: ; Divide x by 8 (by shifting right 3).
lsr <address_lo ; This ensures that the x tile position (0-31) is set up properly
dex ; for obstruction checking.
bne set_address_x
set_address_y: ; Get the y part ready. It is spread over more than 2 bytes
asl <temp ; so I can OR it and get the true position in the mapdata,
rol <address_hi ; for which the sprite's movement is proposed.
dey
bne set_address_y
lda <temp ; Store in upper 3 bits of address_lo.
ora <address_lo
sta <address_lo
clc ; Add the mapdata position to its true address,
lda #low(mapdata) ; so as to read from the spot the character is headed.
adc <address_lo
sta <address_lo
lda #high(mapdata)
adc <address_hi
sta <address_hi
lda [address_lo], y ; With indirect addressing, I needed to put that useless y,
sta <curtile ; so think nothing of it.
tax ; The cujmp finish_nmile part was part of testing, and I decided not to remove it.
dex
beq delete_move ; "Delete" the move if the tile was an obstruction (ID #1)
dex
beq chk_flag ; Do the sound if "finish" tile (ID #2)
sty <check.sound.flag
jmp finish
chk_flag: ; I had to do the check flag, so as to see if the second (or fourth)
lda <check.sound.flag ; NMI "approved" the sound being played.
beq snd_flag ; This was in case the sprite stood still after moving
jmp finish ; into the "finish" tile, so the player would not have to move it
; back out of the tile to actually play the sound.
snd_flag ; This turns on the sound flag.
ldx #$01 ; This flag goes onto the second (or fourth) NMI, which then
stx <sound.flag ; "approves" it by sending a two back to the first NMI.
jmp finish
delete_move: ; If an obstruction was in the sprite's way.
sty <y.move ; It sets these "flags" to zero to indicate no movement.
sty <x.move
finish: ; Finishing this.
lda <y.pos ; Might as well go ahead and store the positions
clc ; in the "unofficial" memory locations.
adc <y.move
sta <y.pos
lda <x.pos
clc
adc <x.move
sta <x.pos
inc <nmiflag ; Signal second NMI coming up.
ldx <sound.flag ; Branch to beep if the second (or fourth) NMI approved
cpx #$02 ; the tone being played.
beq beep
jmp finish_nmi ; Terminate this first NMI.
beep: ; Do the sound channel crap finally!
lda #$01 ; Make that beep!
sta $4015
lda #$0f
sta $4000
lda #$00
sta $4001
lda #$10
sta $4002
lda #$12
sta $4003
lda #$00
sta <sound.flag
finish_nmi: ; Terminate these NMI's.
pla
tay
pla
tax
pla
rti
brk: ; Now beginning the IRQ/BRK routine.
rti ; Terminate the IRQ/BRK routine if it is ever needed.
paldata: .incbin "all.pal" ; Include palette in the PRG-ROM.
mapdata: .incbin "bkg.map" ; Including the maze in the PRG-ROM.
.bank 1 ; Do the vector tables.
.org $FFFA
.dw nmi
.dw main
.dw brk
.bank 2 ; Do the CHR-ROM.
.incbin "bkg.chr" ; The background tiles for the "left half."
.incbin "spr.chr" ; The sprite tiles for the "right half."
; EOF!
| 35.536779 | 118 | 0.583664 |
5d6c53afbe916ba563ef914433d51f02ddf5bbf0 | 1,251 | kt | Kotlin | code/src/test/kotlin/utilTests/BufferedLaabTests.kt | C0DK/P3-HCL | b6adbc46cc7347aacd45dce5fddffd6fee2d37ac | [
"Apache-2.0"
] | 5 | 2018-02-08T12:34:50.000Z | 2021-09-09T11:33:53.000Z | src/test/kotlin/utilTests/BufferedLaabTests.kt | technight/HCL | 6dcfdf58765a488b1512b61c89420121cc66d2a7 | [
"Apache-2.0"
] | 10 | 2018-02-17T14:30:17.000Z | 2018-05-13T17:37:09.000Z | src/test/kotlin/utilTests/BufferedLaabTests.kt | technight/HCL | 6dcfdf58765a488b1512b61c89420121cc66d2a7 | [
"Apache-2.0"
] | 1 | 2018-07-04T13:55:53.000Z | 2018-07-04T13:55:53.000Z | package utilTests
import com.natpryce.hamkrest.assertion.assertThat
import com.natpryce.hamkrest.equalTo
import utils.BufferedLaabStream
import kotlin.coroutines.experimental.buildSequence
class BufferedLaabTests {
@org.junit.jupiter.api.Test
fun testBufferedLaabStream() {
fun testSequence() = buildSequence {
yield("hej")
yield("med")
yield("dig")
yield("der")
yield("!")
}
val bufferedLaab = BufferedLaabStream(testSequence())
assertThat(bufferedLaab.current, equalTo("hej"))
assertThat(bufferedLaab.hasBehind(1), equalTo(false))
assertThat(bufferedLaab.hasAhead(3), equalTo(true))
assertThat(bufferedLaab.hasAhead(5), equalTo(false))
assertThat(bufferedLaab.moveAhead(2), equalTo("dig"))
assertThat(bufferedLaab.lookBehind(1), equalTo("med"))
assertThat(bufferedLaab.lookAhead(1), equalTo("der"))
assertThat(bufferedLaab.hasNext(), equalTo(true))
assertThat(bufferedLaab.moveNext(), equalTo("der"))
assertThat(bufferedLaab.hasNext(), equalTo(true))
assertThat(bufferedLaab.moveNext(), equalTo("!"))
assertThat(bufferedLaab.hasNext(), equalTo(false))
}
} | 39.09375 | 62 | 0.671463 |
88519e848a300676c16b3acb8373ddd6277b0be0 | 296 | kt | Kotlin | sample/dynamic-features/shared/feature1Api/src/commonMain/kotlin/com/arkivanov/sample/dynamicfeatures/shared/feature1/Feature1.kt | Zikstar/Decompose | c25a6448e51e0e0bd71fb38d824cf7029a22442c | [
"Apache-2.0"
] | 1,421 | 2020-08-18T16:16:55.000Z | 2022-03-31T17:17:27.000Z | sample/dynamic-features/shared/feature1Api/src/commonMain/kotlin/com/arkivanov/sample/dynamicfeatures/shared/feature1/Feature1.kt | Zikstar/Decompose | c25a6448e51e0e0bd71fb38d824cf7029a22442c | [
"Apache-2.0"
] | 120 | 2020-09-10T16:33:09.000Z | 2022-03-31T21:48:11.000Z | sample/dynamic-features/shared/feature1Api/src/commonMain/kotlin/com/arkivanov/sample/dynamicfeatures/shared/feature1/Feature1.kt | Zikstar/Decompose | c25a6448e51e0e0bd71fb38d824cf7029a22442c | [
"Apache-2.0"
] | 63 | 2020-09-24T10:29:41.000Z | 2022-02-26T15:45:29.000Z | package com.arkivanov.sample.dynamicfeatures.shared.feature1
import com.arkivanov.decompose.value.Value
interface Feature1 {
val models: Value<Model>
fun onFeature2Clicked()
fun onCloseClicked()
data class Model(
val title: String,
val text: String,
)
}
| 16.444444 | 60 | 0.692568 |
39b7e174cf9cc4e43591b61ded6fb4f0735c5227 | 456 | js | JavaScript | packages/bpk-svgs/dist/js/icons/sm/money.js | jorgedc93/backpack | 25cb394c5575074a2b9082efdd3f3efaed69a7f4 | [
"Apache-2.0"
] | null | null | null | packages/bpk-svgs/dist/js/icons/sm/money.js | jorgedc93/backpack | 25cb394c5575074a2b9082efdd3f3efaed69a7f4 | [
"Apache-2.0"
] | 7 | 2021-08-04T15:15:46.000Z | 2022-01-20T10:25:35.000Z | packages/bpk-svgs/dist/js/icons/sm/money.js | jorgedc93/backpack | 25cb394c5575074a2b9082efdd3f3efaed69a7f4 | [
"Apache-2.0"
] | 2 | 2021-08-05T08:22:46.000Z | 2021-08-11T10:33:38.000Z | import React from "react";
export default (({
styles = {},
...props
}) => <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" style={{
width: "1.125rem",
height: "1.125rem"
}} {...props}><path d="M21 3H3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h18a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3zM4.5 13.5A1.5 1.5 0 1 1 6 12a1.5 1.5 0 0 1-1.5 1.5zM12 15a3 3 0 1 1 3-3 3 3 0 0 1-3 3zm7.5-1.5A1.5 1.5 0 1 1 21 12a1.5 1.5 0 0 1-1.5 1.5z" /></svg>); | 57 | 244 | 0.592105 |
3e940676db917d84f8303baee3efce38e5cd7b34 | 2,730 | c | C | server.c | aydinsimsek/TCP-socket-based-server-and-multi-client-chatroom | 0c401102ec2a7495c35456e2ddb597f1e5c2e6bd | [
"MIT"
] | null | null | null | server.c | aydinsimsek/TCP-socket-based-server-and-multi-client-chatroom | 0c401102ec2a7495c35456e2ddb597f1e5c2e6bd | [
"MIT"
] | null | null | null | server.c | aydinsimsek/TCP-socket-based-server-and-multi-client-chatroom | 0c401102ec2a7495c35456e2ddb597f1e5c2e6bd | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define BUFFER_SIZE 1024
#define portNum 5001
#define BACKLOG 5
int main()
{
int sockfd, newsockfd, clientNum, numofBytes;
struct sockaddr_in serverAddr, clientAddr;
socklen_t len;
char buffer[BUFFER_SIZE];
pid_t child_process_id;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd == -1)
{
perror("ERROR - Creating the server socket is failed");
exit(EXIT_FAILURE);
}
printf("\nServer socket is created successfully.\n\n"
"********************************* WELCOME TO MY CHAT ROOM *********************************\n"
"- I'm glad to have you in my chat room and I'm looking forward to respond to your messages.\n"
"- Please just type 'Bye.' when you are leaving.\n\n");
memset(&serverAddr, 0, sizeof(serverAddr));
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = INADDR_ANY;
serverAddr.sin_port = htons(portNum);
if(bind(sockfd, (struct sockaddr *) &serverAddr, sizeof(serverAddr)) == -1)
{
perror("ERROR - Binding the socket is failed");
exit(EXIT_FAILURE);
}
if(listen(sockfd, BACKLOG) == -1)
{
perror("ERROR - Listening for connections is failed");
exit(EXIT_FAILURE);
}
printf("Listening for connections...\n");
len = sizeof(clientAddr);
clientNum = 0;
while(1)
{
newsockfd = accept(sockfd, (struct sockaddr *) &clientAddr, &len);
if(newsockfd == -1)
{
exit(EXIT_FAILURE);
}
clientNum++;
printf("Connected to %s:%d\n", inet_ntoa(clientAddr.sin_addr), ntohs(clientAddr.sin_port));
child_process_id = fork();
if(child_process_id == 0)
{
close(sockfd);
while(1)
{
read(newsockfd, buffer, BUFFER_SIZE);
printf("\nClient %d: %s\n", clientNum, buffer);
if(!strncmp("Bye.", buffer, 3))
{
printf("Disconnected from %s:%d\n", inet_ntoa(clientAddr.sin_addr), ntohs(clientAddr.sin_port));
break;
}
memset(buffer, 0, BUFFER_SIZE);
printf("\t\t\t\t Server: ");
fgets(buffer, BUFFER_SIZE, stdin);
numofBytes = write(newsockfd, buffer, BUFFER_SIZE);
if(numofBytes == -1)
{
perror("ERROR - Writing data to the client is failed.");
exit(EXIT_FAILURE);
}
}
}
}
close(newsockfd);
return 0;
} | 27.857143 | 102 | 0.555678 |
f76f8e1aa408753cc09c3d50e130fcb6cbde30bb | 101 | sql | SQL | framework/resources/Functional/window_functions/negative/q24.sql | aravi5/drill-test-framework | 7bf960cbe1697c8086a880661a361e8991a73107 | [
"Apache-2.0"
] | null | null | null | framework/resources/Functional/window_functions/negative/q24.sql | aravi5/drill-test-framework | 7bf960cbe1697c8086a880661a361e8991a73107 | [
"Apache-2.0"
] | null | null | null | framework/resources/Functional/window_functions/negative/q24.sql | aravi5/drill-test-framework | 7bf960cbe1697c8086a880661a361e8991a73107 | [
"Apache-2.0"
] | null | null | null | -- DRILL-3211 (requires group by)
select sum(a2), sum(a2) over(partition by b2) from t2 group by b2;
| 33.666667 | 66 | 0.712871 |
5892297beeb21abc26350d33591101d60d10f407 | 319 | rs | Rust | 7kyu/numbers-to-letters/benches/bench.rs | lincot/rusted-katana | 3979ff39d5c10f5d413debf0447d9e7588f2478f | [
"BSD-2-Clause"
] | null | null | null | 7kyu/numbers-to-letters/benches/bench.rs | lincot/rusted-katana | 3979ff39d5c10f5d413debf0447d9e7588f2478f | [
"BSD-2-Clause"
] | null | null | null | 7kyu/numbers-to-letters/benches/bench.rs | lincot/rusted-katana | 3979ff39d5c10f5d413debf0447d9e7588f2478f | [
"BSD-2-Clause"
] | null | null | null | #![feature(test)]
extern crate test;
use numbers_to_letters::switcher;
use test::{black_box, Bencher};
#[bench]
fn bench(bencher: &mut Bencher) {
let numbers = black_box(&[
"25", "7", "8", "4", "14", "23", "8", "25", "23", "29", "16", "16", "4",
]);
bencher.iter(|| switcher(numbers.to_vec()));
}
| 22.785714 | 80 | 0.561129 |
c8eff32674a03bc84dc685d04820c4ba9a3887b4 | 827 | swift | Swift | eosswiftTests/eos-chain-actions/abihex/DelegateBandwidthArgsTests.swift | amirghezal/eos-swift | f5304eca181ca127119b73a8a79f831c10766ee4 | [
"Apache-2.0"
] | 19 | 2018-12-27T17:50:53.000Z | 2022-01-09T12:55:09.000Z | eosswiftTests/eos-chain-actions/abihex/DelegateBandwidthArgsTests.swift | amirghezal/eos-swift | f5304eca181ca127119b73a8a79f831c10766ee4 | [
"Apache-2.0"
] | 5 | 2019-04-04T09:41:48.000Z | 2020-08-24T01:03:37.000Z | eosswiftTests/eos-chain-actions/abihex/DelegateBandwidthArgsTests.swift | amirghezal/eos-swift | f5304eca181ca127119b73a8a79f831c10766ee4 | [
"Apache-2.0"
] | 14 | 2018-12-29T05:09:53.000Z | 2022-03-07T17:22:58.000Z | import Foundation
import XCTest
@testable import eosswift
class DelegateBandwidthArgsTests: XCTestCase {
func testDelegateBandwidthDecodable() {
let delegateBandwidthArgs: DelegateBandwidthArgs = DelegateBandwidthArgs(
from: AccountNameWriterValue(name: "memtripissue"),
receiver: AccountNameWriterValue(name: "memtripproxy"),
stake_net_quantity: AssetWriterValue(asset: "51.2345 EOS"),
stake_cpu_quantity: AssetWriterValue(asset: "171.2345 EOS"),
transfer: 1
)
let delegateBandwidthBody: DelegateBandwidthBody = DelegateBandwidthBody(args: delegateBandwidthArgs)
XCTAssertEqual(delegateBandwidthBody.toHex(), "a034c6aeba9ba592e03bbdb5ba9ba59259d107000000000004454f5300000000d9201a000000000004454f530000000001000000")
}
}
| 37.590909 | 161 | 0.749698 |
1a16f2e8eb4f3c3c3c70d5672a115d8d434f2931 | 739 | dart | Dart | packages/kakao_flutter_sdk_story/lib/src/model/story_image.dart | RuffaloLavoisier/Ruffalo-kakao_flutter_sdk | cd7ceb159dda199d6b091e58ebce3ff540da5de7 | [
"Apache-2.0"
] | 34 | 2019-08-16T07:20:51.000Z | 2020-03-09T07:00:11.000Z | packages/kakao_flutter_sdk_story/lib/src/model/story_image.dart | RuffaloLavoisier/Ruffalo-kakao_flutter_sdk | cd7ceb159dda199d6b091e58ebce3ff540da5de7 | [
"Apache-2.0"
] | 15 | 2019-10-18T13:48:55.000Z | 2020-03-09T01:38:04.000Z | packages/kakao_flutter_sdk_story/lib/src/model/story_image.dart | RuffaloLavoisier/Ruffalo-kakao_flutter_sdk | cd7ceb159dda199d6b091e58ebce3ff540da5de7 | [
"Apache-2.0"
] | 8 | 2019-08-24T10:47:15.000Z | 2020-03-06T04:35:52.000Z | import 'package:json_annotation/json_annotation.dart';
part 'story_image.g.dart';
/// 카카오스토리의 내스토리 정보 중 이미지 내용을 담고 있는 클래스
@JsonSerializable(includeIfNull: false)
class StoryImage {
/// 1280 * 1706
final String? xlarge;
/// 720 * 960
final String? large;
/// 240 * 320
final String? medium;
/// 160 * 213
final String? small;
/// 원본 이미지의 url
final String? original;
/// @nodoc
StoryImage(this.xlarge, this.large, this.medium, this.small, this.original);
/// @nodoc
factory StoryImage.fromJson(Map<String, dynamic> json) =>
_$StoryImageFromJson(json);
/// @nodoc
Map<String, dynamic> toJson() => _$StoryImageToJson(this);
/// @nodoc
@override
String toString() => toJson().toString();
}
| 19.972973 | 78 | 0.663058 |
6b3edb5ab4dad4b327e12f5c4bbb5ad535f16d29 | 2,476 | c | C | Vk2D/Vk2D/Vk2D_Math/vk2d_vec2.c | Sausty/vk2d | fa38388dc16921a2e4a800a2ab5aa183a113b725 | [
"MIT"
] | 5 | 2021-07-24T19:53:46.000Z | 2022-01-18T10:14:17.000Z | Vk2D/Vk2D/Vk2D_Math/vk2d_vec2.c | Sausty/vk2d | fa38388dc16921a2e4a800a2ab5aa183a113b725 | [
"MIT"
] | null | null | null | Vk2D/Vk2D/Vk2D_Math/vk2d_vec2.c | Sausty/vk2d | fa38388dc16921a2e4a800a2ab5aa183a113b725 | [
"MIT"
] | 2 | 2021-07-24T20:19:34.000Z | 2021-10-06T14:15:29.000Z | #include "vk2d_vec2.h"
#include <math.h>
vk2d_vec2 vk2d_vec2_new(f32 x, f32 y)
{
vk2d_vec2 res;
res.x = x;
res.y = y;
return res;
}
vk2d_vec2 vk2d_vec2_identity()
{
return vk2d_vec2_new(0, 0);
}
vk2d_vec2 vk2d_vec2_scalar(f32 scalar)
{
return vk2d_vec2_new(scalar, scalar);
}
vk2d_vec2 vk2d_vec2_add(vk2d_vec2 left, vk2d_vec2 right)
{
return vk2d_vec2_new(left.x + right.x, left.y + right.y);
}
vk2d_vec2 vk2d_vec2_sub(vk2d_vec2 left, vk2d_vec2 right)
{
return vk2d_vec2_new(left.x - right.x, left.y - right.y);
}
vk2d_vec2 vk2d_vec2_mul(vk2d_vec2 left, vk2d_vec2 right)
{
return vk2d_vec2_new(left.x * right.x, left.y * right.y);
}
vk2d_vec2 vk2d_vec2_div(vk2d_vec2 left, vk2d_vec2 right)
{
return vk2d_vec2_new(left.x / right.x, left.y / right.y);
}
vk2d_vec2 vk2d_vec2_add_scalar(vk2d_vec2 left, f32 right)
{
return vk2d_vec2_new(left.x + right, left.y + right);
}
vk2d_vec2 vk2d_vec2_sub_scalar(vk2d_vec2 left, f32 right)
{
return vk2d_vec2_new(left.x - right, left.y - right);
}
vk2d_vec2 vk2d_vec2_mul_scalar(vk2d_vec2 left, f32 right)
{
return vk2d_vec2_new(left.x * right, left.y * right);
}
vk2d_vec2 vk2d_vec2_div_scalar(vk2d_vec2 left, f32 right)
{
return vk2d_vec2_new(left.x / right, left.y / right);
}
f32 vk2d_vec2_magnitude(vk2d_vec2 vec)
{
return (f32)sqrt(vec.x * vec.x + vec.y * vec.y);
}
vk2d_vec2 vk2d_vec2_normalise(vk2d_vec2 vec)
{
f32 length = vk2d_vec2_magnitude(vec);
return vk2d_vec2_new(vec.x / length, vec.y / length);
}
f32 vk2d_vec2_distance(vk2d_vec2 left, vk2d_vec2 right)
{
f32 a = left.x - right.x;
f32 b = left.y - right.y;
return (f32)sqrt(a * a + b * b);
}
f32 vk2d_vec2_dot(vk2d_vec2 left, vk2d_vec2 right)
{
return (left.x * right.x + left.y * right.y);
}
// BOOLEAN SHIT
i32 vk2d_vec2_eq(vk2d_vec2 left, vk2d_vec2 right)
{
return left.x == right.x && left.y == right.y;
}
i32 vk2d_vec2_not_eq(vk2d_vec2 left, vk2d_vec2 right)
{
return !vk2d_vec2_eq(left, right);
}
i32 vk2d_vec2_greater(vk2d_vec2 left, vk2d_vec2 right)
{
return left.x > right.x && left.y > right.y;
}
i32 vk2d_vec2_greater_equal(vk2d_vec2 left, vk2d_vec2 right)
{
return left.x >= right.x && left.y >= right.y;
}
i32 vk2d_vec2_less(vk2d_vec2 left, vk2d_vec2 right)
{
return left.x < right.x && left.y < right.y;
}
i32 vk2d_vec2_less_equal(vk2d_vec2 left, vk2d_vec2 right)
{
return left.x <= right.x && left.y <= right.y;
}
| 20.806723 | 61 | 0.693861 |
b1c808bff984e7d50e549b93076d1525af9093db | 3,151 | c | C | src/onion/random-default.c | dmoulding/onion | 0e9447b113042006883832963b28e360768b59d0 | [
"Apache-2.0"
] | null | null | null | src/onion/random-default.c | dmoulding/onion | 0e9447b113042006883832963b28e360768b59d0 | [
"Apache-2.0"
] | null | null | null | src/onion/random-default.c | dmoulding/onion | 0e9447b113042006883832963b28e360768b59d0 | [
"Apache-2.0"
] | 1 | 2021-06-18T04:57:24.000Z | 2021-06-18T04:57:24.000Z | /*
Onion HTTP server library
Copyright (C) 2010-2014 David Moreno Montero and othes
This library is free software; you can redistribute it and/or
modify it under the terms of, at your choice:
a. the Apache License Version 2.0.
b. the GNU General Public License as published by the
Free Software Foundation; either version 2.0 of the License,
or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of both libraries, if not see
<http://www.gnu.org/licenses/> and
<http://www.apache.org/licenses/LICENSE-2.0>.
*/
#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#include <assert.h>
#include "types_internal.h"
#include "log.h"
#ifdef HAVE_PTHREADS
#include <pthread.h>
static pthread_mutex_t onion_random_refcount_mutex = PTHREAD_MUTEX_INITIALIZER;
#define onion_random_refcount_mutex_lock() pthread_mutex_lock(&onion_random_refcount_mutex);
#define onion_random_refcount_mutex_unlock() pthread_mutex_unlock(&onion_random_refcount_mutex);
#else
#define onion_random_refcount_mutex_lock() ;
#define onion_random_refcount_mutex_unlock() ;
#endif
static size_t onion_random_refcount=0;
/**
* @short Initializes the global random number generator
*
* Initializes the global random number generator with some random seed.
*
* onion_random_free() must be called later to free up used memory.
*
* It is safe to call onion_random_init() more than once, but union_random_free() must be called the same amount of times.
*/
void onion_random_init() {
onion_random_refcount_mutex_lock();
if( onion_random_refcount == 0 ) {
int fd=open("/dev/random", O_RDONLY);
if (fd<0){
ONION_WARNING("Unsecure random number generation; could not open /dev/random to feed the seed");
// Just in case nobody elses do it... If somebody else do it, then no problem.
srand(time(NULL));
}
else{
unsigned int sr;
ssize_t n;
n = read(fd, &sr, sizeof(sr));
if (n != sizeof(sr)) {
ONION_ERROR("Error reading seed value from /dev/random after file descriptor opened");
exit(1);
} else {
close(fd);
srand(sr);
}
}
}
onion_random_refcount++;
onion_random_refcount_mutex_unlock();
}
/**
* @short Free up memory used by global random number generator
*
* onion_random_free() must not be called more times than onion_random_init()
*/
void onion_random_free() {
onion_random_refcount_mutex_lock();
assert( onion_random_refcount > 0 );
onion_random_refcount--;
if( onion_random_refcount > 0 ) {
onion_random_refcount_mutex_unlock();
return;
}
onion_random_refcount_mutex_unlock();
//rand() based implementatio does nothing actually, just checks if refcount is ok
}
/**
* @short Generates random data
*
* Generate size bytes of random data and put on data
*/
void onion_random_generate(void* data, size_t size) {
unsigned char* data_char = data;
size_t i;
for( i=0;i<size;++i ) {
data_char[i] = rand();
}
}
| 28.908257 | 122 | 0.738496 |
577bafd10078b68016cfba1c1e9222a65d3480c5 | 161 | kt | Kotlin | src/main/kotlin/de/larskolmetz/smarthomemanager/core/out/HeatingStore.kt | LarsK93/SmartHomeCotroller | b2e2cfd38a2d5642fab10e1670008b296e33b082 | [
"MIT"
] | null | null | null | src/main/kotlin/de/larskolmetz/smarthomemanager/core/out/HeatingStore.kt | LarsK93/SmartHomeCotroller | b2e2cfd38a2d5642fab10e1670008b296e33b082 | [
"MIT"
] | null | null | null | src/main/kotlin/de/larskolmetz/smarthomemanager/core/out/HeatingStore.kt | LarsK93/SmartHomeCotroller | b2e2cfd38a2d5642fab10e1670008b296e33b082 | [
"MIT"
] | null | null | null | package de.larskolmetz.smarthomemanager.core.out
interface HeatingStore {
fun fetchTargetTemperatureAndValve(tryCount: Int = 0): Pair<Double?, Double?>?
} | 23 | 82 | 0.776398 |
36b650a285aaeaeec66953c926d50162c0f8415d | 6,384 | sql | SQL | rpc/doc/sql/gozero_pms_product_attribute_value.sql | arbullzhang/zero-admin | cbef9004461449cfaba0a6f53a5555e611730f03 | [
"Apache-2.0"
] | 150 | 2021-04-13T22:55:15.000Z | 2022-03-21T02:17:33.000Z | rpc/doc/sql/gozero_pms_product_attribute_value.sql | changzhi777/zero-admin | cbef1411506ee8b72be9a2f75c43d31d1d09ebe3 | [
"Apache-2.0"
] | 12 | 2021-04-25T05:48:25.000Z | 2022-03-26T08:40:22.000Z | rpc/doc/sql/gozero_pms_product_attribute_value.sql | changzhi777/zero-admin | cbef1411506ee8b72be9a2f75c43d31d1d09ebe3 | [
"Apache-2.0"
] | 43 | 2021-04-19T03:18:37.000Z | 2022-03-17T12:25:41.000Z | create table pms_product_attribute_value
(
id bigint auto_increment
primary key,
product_id bigint null,
product_attribute_id bigint null,
value varchar(64) null comment '手动添加规格或参数的值,参数单值,规格有多个时以逗号隔开'
)
comment '存储产品参数信息的表';
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (1, 9, 1, 'X');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (2, 10, 1, 'X');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (3, 11, 1, 'X');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (4, 12, 1, 'X');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (5, 13, 1, 'X');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (6, 14, 1, 'X');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (7, 18, 1, 'X');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (8, 7, 1, 'X');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (9, 7, 1, 'XL');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (10, 7, 1, 'XXL');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (11, 22, 7, 'x,xx');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (12, 22, 24, 'no110');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (13, 22, 25, '春季');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (14, 22, 37, '青年');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (15, 22, 38, '2018年春');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (16, 22, 39, '长袖');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (124, 23, 7, '米白色,浅黄色');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (125, 23, 24, 'no1098');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (126, 23, 25, '春季');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (127, 23, 37, '青年');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (128, 23, 38, '2018年春');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (129, 23, 39, '长袖');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (184, 31, 25, '夏季');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (185, 31, 37, '青年');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (186, 31, 38, '2018年夏');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (187, 31, 39, '短袖');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (199, 30, 25, '夏季');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (200, 30, 37, '青年');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (201, 30, 38, '2018年夏');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (202, 30, 39, '短袖');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (213, 27, 43, '黑色,蓝色');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (214, 27, 45, '5.8');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (215, 27, 46, '4G');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (216, 27, 47, 'Android');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (217, 27, 48, '3000ml');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (218, 28, 43, '金色,银色');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (219, 28, 45, '5.0');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (220, 28, 46, '4G');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (221, 28, 47, 'Android');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (222, 28, 48, '2800ml');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (223, 29, 43, '金色,银色');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (224, 29, 45, '4.7');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (225, 29, 46, '4G');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (226, 29, 47, 'IOS');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (227, 29, 48, '1960ml');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (228, 26, 43, '金色,银色');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (229, 26, 45, '5.0');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (230, 26, 46, '4G');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (231, 26, 47, 'Android');
INSERT INTO gozero.pms_product_attribute_value (id, product_id, product_attribute_id, value) VALUES (232, 26, 48, '3000'); | 106.4 | 125 | 0.776316 |
6f24af8d4ca519bcf62d6dd38f215cc05a2d5af0 | 473 | swift | Swift | Abridge-Recorder/Classes/Utils/Defaults+Extensions.swift | arvindhsukumar/AVAudioEngine | 27fcf7ec6859f29438e85e531dee841018039a33 | [
"MIT"
] | null | null | null | Abridge-Recorder/Classes/Utils/Defaults+Extensions.swift | arvindhsukumar/AVAudioEngine | 27fcf7ec6859f29438e85e531dee841018039a33 | [
"MIT"
] | null | null | null | Abridge-Recorder/Classes/Utils/Defaults+Extensions.swift | arvindhsukumar/AVAudioEngine | 27fcf7ec6859f29438e85e531dee841018039a33 | [
"MIT"
] | null | null | null | //
// Defaults+Extensions.swift
// AVAudioEngine
//
// Created by arvindhsukumar on 16/10/19.
// Copyright © 2019 arvindh. All rights reserved.
//
import Foundation
import SwiftyUserDefaults
extension DefaultsKeys {
static let pauseTimestamp = DefaultsKey<Date?>("pauseTimestamp")
static let bytesProcessed = DefaultsKey<[String: [Int]]>("bytesProcessed", defaultValue: [:])
static let bytesSaved = DefaultsKey<[String: Int]>("bytesSaved", defaultValue: [:])
}
| 27.823529 | 95 | 0.733615 |
630f7e4582d738002dd1a7a5d12bf6cf8a844ffc | 1,946 | swift | Swift | Tests/WebAPITests/MuzArbuzAPITests.swift | shvets/WebAPI | 0eb54d184c6b0e169bc507f943fc93084d724c8f | [
"MIT"
] | null | null | null | Tests/WebAPITests/MuzArbuzAPITests.swift | shvets/WebAPI | 0eb54d184c6b0e169bc507f943fc93084d724c8f | [
"MIT"
] | null | null | null | Tests/WebAPITests/MuzArbuzAPITests.swift | shvets/WebAPI | 0eb54d184c6b0e169bc507f943fc93084d724c8f | [
"MIT"
] | null | null | null | import XCTest
@testable import WebAPI
class MuzArbuzAPITests: XCTestCase {
var subject = MuzArbuzAPI()
// func testGetAlbums() throws {
// let result = try subject.getAlbums()
//
// print(result as Any)
// }
//
// func testGetAlbumContainer() throws {
// let result = try subject.getAlbums(params: ["parent_id": "14485"])
//
// print(result["items"] as Any)
// }
//
// func testGetAlbumsByYearRange() throws {
// let result = try subject.getAlbums(params: ["year__gte": "2014", "year__lte": "2015"])
//
// print(result["items"] as Any)
// }
//
// func testGetArtistTracks() throws {
// let result = try subject.getTracks(params: ["artists": "1543"])
//
// print(result["items"] as Any)
// }
//
// func testGetAlbumTracks() throws {
// let result = try subject.getTracks(params: ["album": "14486"])
//
// print(result["items"] as Any)
// }
//
// func testGetCollectionTracks() throws {
// let result = try subject.getTracks(params: ["collection__id": "115"])
//
// print(result["items"] as Any)
// }
//
// func testGetArtists() throws {
// let result = try subject.getArtists()
//
// print(result["items"] as Any)
// }
//
// func testGetArtistAnnotated() throws {
// let result = try subject.getArtistAnnotated(params: ["title__istartswith": "b"])
//
// print(result["items"] as Any)
// }
//
// func testGetCollections() throws {
// let result = try subject.getCollections()
//
// print(result["items"] as Any)
// }
//
// func testGetGenres() throws {
// let result = try subject.getGenres()
//
// print(result["items"] as Any)
// print((result["items"] as! [Any]).count)
// }
//
// func testGetAlbumsByGenre() throws {
// let result = try subject.getAlbums(params: ["genre__in": "1"])
//
// print(result["items"] as Any)
// }
//
// func testSearch() throws {
// let result = try subject.search("макаревич")
//
// print(result as Any)
// }
}
| 23.731707 | 92 | 0.613052 |
e066d08811c1f4c231b4303c60f8de3d9762124d | 265 | swift | Swift | WavesCore/WavesCoreTests/WavesCoreTests.swift | a-melnichuk/CryptoCore | 640044789c0357f56fd2fa02a5cf732fc7aeed4f | [
"MIT"
] | null | null | null | WavesCore/WavesCoreTests/WavesCoreTests.swift | a-melnichuk/CryptoCore | 640044789c0357f56fd2fa02a5cf732fc7aeed4f | [
"MIT"
] | null | null | null | WavesCore/WavesCoreTests/WavesCoreTests.swift | a-melnichuk/CryptoCore | 640044789c0357f56fd2fa02a5cf732fc7aeed4f | [
"MIT"
] | null | null | null | //
// WavesCoreTests.swift
// WavesCoreTests
//
// Created by Alex Melnichuk on 5/6/19.
// Copyright © 2019 Alex Melnichuk. All rights reserved.
//
import XCTest
@testable import WavesCore
@testable import CryptoCore
class WavesCoreTests: XCTestCase {
}
| 15.588235 | 57 | 0.724528 |
94db1b152d8fc7fdf40f1a9e17a4445a5ec86dce | 2,891 | swift | Swift | Sources/ShinyUI/Layers/Layout/TextLayout.swift | AngelLandoni/ShinyUI | d1d69a65dcc18d77a54abf79142e185f9e2b90a6 | [
"BSD-3-Clause"
] | 8 | 2021-02-07T22:21:07.000Z | 2021-03-04T11:33:30.000Z | Sources/ShinyUI/Layers/Layout/TextLayout.swift | AngelLandoni/ShinyUI | d1d69a65dcc18d77a54abf79142e185f9e2b90a6 | [
"BSD-3-Clause"
] | null | null | null | Sources/ShinyUI/Layers/Layout/TextLayout.swift | AngelLandoni/ShinyUI | d1d69a65dcc18d77a54abf79142e185f9e2b90a6 | [
"BSD-3-Clause"
] | 1 | 2021-02-08T13:46:27.000Z | 2021-02-08T13:46:27.000Z | // Copyright (c) 2021 Angel Landoni.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDi
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if canImport(UIKit)
import UIKit
extension TextElement: Layout {
func layout<S: Storable>(_ constraint: Size<Float>, _ storable: S) {
var selfFrame = getFrame(storable) ?? .fromOrigin(.zero)
// Calculates the text width, if the constraint width is bigger than
// the required width the size will be set to that specific width
// and height.
let unboundedWidth = text.width(
withConstrainedHeight: constraint.height,
font: UIFont.systemFont(ofSize: CGFloat(fontSize))
)
// Checks if the size of the text fits.
if unboundedWidth <= constraint.width {
// Calcualtes the height based on the needed width.
let boundedHeight = text.height(
withConstrainedWidth: unboundedWidth,
font: UIFont.systemFont(ofSize: CGFloat(fontSize))
)
selfFrame.size = Size(width: unboundedWidth, height: boundedHeight)
// Submit the size.
setFrame(storable, frame: selfFrame)
return
}
// Calculates the height based on bounded width (AKA multiline).
let boundedHeight = text.height(
withConstrainedWidth: constraint.width,
font: UIFont.systemFont(ofSize: CGFloat(fontSize))
)
selfFrame.size = Size(width: constraint.width, height: boundedHeight)
// Sets a new frame for the text.
setFrame(storable, frame: selfFrame)
}
}
#endif
| 41.898551 | 84 | 0.687651 |
b6790fe8a29b08f9b2e95f1986d0d8f02050313b | 4,356 | swift | Swift | Sources/MastodonAPI/Responses/Instance.swift | li-bei/MastodonAPI | 1a170b110fc3d0728473599632fda81856b4e28c | [
"MIT"
] | 2 | 2021-05-26T12:03:01.000Z | 2021-12-11T09:53:49.000Z | Sources/MastodonAPI/Responses/Instance.swift | li-bei/MastodonAPI | 1a170b110fc3d0728473599632fda81856b4e28c | [
"MIT"
] | null | null | null | Sources/MastodonAPI/Responses/Instance.swift | li-bei/MastodonAPI | 1a170b110fc3d0728473599632fda81856b4e28c | [
"MIT"
] | null | null | null | import Foundation
extension Responses {
/// Represents the software instance of Mastodon running on this domain.
public struct Instance: Codable {
/// The domain name of the instance.
///
/// Added in 1.1.0.
public let uri: String
/// The title of the website.
///
/// Added in 1.1.0.
public let title: String
/// Admin-defined description of the Mastodon site.
///
/// Added in 1.1.0.
public let description: String
/// An email that may be contacted for any inquiries.
///
/// Added in 1.1.0.
public let email: String
/// The version of Mastodon installed on the instance.
///
/// Added in 1.3.0.
public let version: String
/// URLs of interest for clients apps.
///
/// Added in 1.4.2.
public let urls: [String: URL]
/// Statistics about how much information the instance contains.
///
/// Added in 1.6.0.
public let statistics: Statistics
/// Banner image for the website.
///
/// Added in 1.6.1.
public let thumbnailURL: URL?
/// Primary langauges of the website and its staff.
///
/// Added in 2.3.0.
public let languages: [String]
/// A user that can be contacted, as an alternative to `email`.
///
/// Added in 2.3.0.
public let contactAccount: Account?
/// Whether registrations are enabled.
///
/// Added in 2.7.2.
public let registrations: Bool
/// A shorter description defined by the admin.
///
/// Added in 2.9.2.
public let shortDescription: String
/// Whether registrations require moderator approval.
///
/// Added in 2.9.2.
public let approvalRequired: Bool
/// Whether invites are enabled.
///
/// Added in 3.1.4.
public let invitesEnabled: Bool
// MARK: Decodable
private enum CodingKeys: String, CodingKey {
case uri
case title
case description
case email
case version
case urls
case statistics = "stats"
case thumbnailURL = "thumbnail"
case languages
case contactAccount = "contact_account"
case registrations
case shortDescription = "short_description"
case approvalRequired = "approval_required"
case invitesEnabled = "invites_enabled"
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
uri = try container.decode(String.self, forKey: .uri)
title = try container.decode(String.self, forKey: .title)
description = try container.decode(String.self, forKey: .description)
email = try container.decode(String.self, forKey: .email)
version = try container.decode(String.self, forKey: .version)
urls = try container.decode([String: URL].self, forKey: .urls)
statistics = try container.decode(Statistics.self, forKey: .statistics)
thumbnailURL = try container.decodeIfPresent(URL.self, forKey: .thumbnailURL)
languages = try container.decode([String].self, forKey: .languages)
contactAccount = try container.decodeIfPresent(Account.self, forKey: .contactAccount)
registrations = try container.decode(Bool.self, forKey: .registrations)
shortDescription = try container.decode(String.self, forKey: .shortDescription)
approvalRequired = try container.decode(Bool.self, forKey: .approvalRequired)
invitesEnabled = try container.decodeIfPresent(Bool.self, forKey: .invitesEnabled) ?? false
}
}
}
// MARK: -
extension Responses.Instance {
public struct Statistics: Codable {
public let userCount: Int
public let statusCount: Int
public let domainCount: Int
// MARK: Decodable
private enum CodingKeys: String, CodingKey {
case userCount = "user_count"
case statusCount = "status_count"
case domainCount = "domain_count"
}
}
}
| 33 | 103 | 0.583563 |
e7554da878155de2371bb84fc9003526f5b72330 | 987 | js | JavaScript | urldecode-latin1.js | loge5/node-urldecode-latin1 | 34cafa935aca21606c1099659b47ccda1fb1768f | [
"MIT"
] | 1 | 2020-02-09T01:00:00.000Z | 2020-02-09T01:00:00.000Z | urldecode-latin1.js | loge5/node-urldecode-latin1 | 34cafa935aca21606c1099659b47ccda1fb1768f | [
"MIT"
] | 2 | 2020-07-19T08:27:19.000Z | 2021-04-29T05:19:45.000Z | urldecode-latin1.js | loge5/node-urldecode-latin1 | 34cafa935aca21606c1099659b47ccda1fb1768f | [
"MIT"
] | 1 | 2020-06-18T15:40:48.000Z | 2020-06-18T15:40:48.000Z | const querystring = require('querystring')
/**
* @param {Buffer|string} input
* @return {object}
*/
function urldecodeLatin1 (input) {
if (input instanceof Buffer) {
input = input.toString('latin1')
}
const pageSize = 64
const prefixOffset = 0xC2
let output = ''
for (let i = 0; i < input.length; i++) {
if (input[i] === '%') {
if (i + 2 >= input.length) {
throw new Error('invalid input (incomplete)')
}
let charCode = parseInt(input.substr(i + 1, 2), 16)
const pageNr = Math.floor(charCode / pageSize) - 2 // first page is 128 byte long (2xpageSize)
if (pageNr >= 0) {
charCode -= pageSize * pageNr
output += '%' + (prefixOffset + pageNr).toString(16).toUpperCase() // page prefix
}
output += '%' + (charCode < 16 ? '0' : '') + charCode.toString(16).toUpperCase()
i += 2
} else {
output += input[i]
}
}
return querystring.parse(output)
}
module.exports = urldecodeLatin1
| 29.029412 | 100 | 0.5846 |
9ff33a96dfe574578db2c0b4ce2afdbf5afcf28f | 588 | kt | Kotlin | src/main/kotlin/com/gh0u1l5/wechatmagician/spellbook/mirror/com/tencent/mm/modelsfs/Methods.kt | WHNB/WechatSpellbook | 3b9eda1f3e5ff704a7574fee9e36b93d9115eb9f | [
"MIT"
] | 1,612 | 2018-03-06T20:25:46.000Z | 2022-03-29T17:50:56.000Z | src/main/kotlin/com/gh0u1l5/wechatmagician/spellbook/mirror/com/tencent/mm/modelsfs/Methods.kt | WHNB/WechatSpellbook | 3b9eda1f3e5ff704a7574fee9e36b93d9115eb9f | [
"MIT"
] | 39 | 2018-03-20T09:09:53.000Z | 2021-09-08T13:56:23.000Z | src/main/kotlin/com/gh0u1l5/wechatmagician/spellbook/mirror/com/tencent/mm/modelsfs/Methods.kt | WHNB/WechatSpellbook | 3b9eda1f3e5ff704a7574fee9e36b93d9115eb9f | [
"MIT"
] | 449 | 2018-03-17T07:54:14.000Z | 2022-03-18T12:49:43.000Z | package com.gh0u1l5.wechatmagician.spellbook.mirror.com.tencent.mm.modelsfs
import com.gh0u1l5.wechatmagician.spellbook.C
import com.gh0u1l5.wechatmagician.spellbook.WechatGlobal.wxLazy
import com.gh0u1l5.wechatmagician.spellbook.mirror.com.tencent.mm.modelsfs.Classes.EncEngine
import com.gh0u1l5.wechatmagician.spellbook.util.ReflectionUtil.findMethodsByExactParameters
import java.lang.reflect.Method
object Methods {
val EncEngine_transFor: Method by wxLazy("EncEngine_transFor") {
findMethodsByExactParameters(EncEngine, C.Int, C.ByteArray, C.Int).firstOrNull()
}
} | 45.230769 | 92 | 0.829932 |
2a7011a53310ad8e06750d24a9388a99ad5f4ec0 | 714 | java | Java | foml-mod/src/main/java/dev/onyxstudios/foml/FOML.java | marcus8448/FOML | 5a2cad434873aa40832ad13093da4bd564a81afd | [
"MIT"
] | 18 | 2020-02-12T10:04:22.000Z | 2022-02-20T02:20:39.000Z | foml-mod/src/main/java/dev/onyxstudios/foml/FOML.java | marcus8448/FOML | 5a2cad434873aa40832ad13093da4bd564a81afd | [
"MIT"
] | 10 | 2020-02-13T16:29:35.000Z | 2021-04-08T04:15:39.000Z | foml-mod/src/main/java/dev/onyxstudios/foml/FOML.java | marcus8448/FOML | 5a2cad434873aa40832ad13093da4bd564a81afd | [
"MIT"
] | 4 | 2020-02-13T09:33:03.000Z | 2021-08-01T17:33:34.000Z | package dev.onyxstudios.foml;
import dev.onyxstudios.foml.obj.ItemOBJLoader;
import dev.onyxstudios.foml.obj.OBJLoader;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class FOML implements ClientModInitializer {
public static final String MODID = "foml";
public static Logger LOGGER = LogManager.getLogger("FOML");
@Override
public void onInitializeClient() {
ModelLoadingRegistry.INSTANCE.registerResourceProvider(OBJLoader.INSTANCE);
ModelLoadingRegistry.INSTANCE.registerVariantProvider(ItemOBJLoader.INSTANCE);
}
}
| 35.7 | 86 | 0.796919 |
e385a1595475fa3f2f9b8ec78293e27df00523c1 | 1,304 | dart | Dart | pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_parent.dart | zhesha/sdk | 80f68a9f4c2af9cb3eef5e5a571b8f516fe319d3 | [
"BSD-3-Clause"
] | 1 | 2021-01-10T16:32:02.000Z | 2021-01-10T16:32:02.000Z | pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_parent.dart | zhesha/sdk | 80f68a9f4c2af9cb3eef5e5a571b8f516fe319d3 | [
"BSD-3-Clause"
] | null | null | null | pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_parent.dart | zhesha/sdk | 80f68a9f4c2af9cb3eef5e5a571b8f516fe319d3 | [
"BSD-3-Clause"
] | 1 | 2021-06-05T07:28:45.000Z | 2021-06-05T07:28:45.000Z | // Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analysis_server/src/services/correction/assist.dart';
import 'package:analysis_server/src/services/correction/dart/flutter_swap_with_child.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer_plugin/utilities/assist/assist.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
class FlutterSwapWithParent extends FlutterParentAndChild {
@override
AssistKind get assistKind => DartAssistKind.FLUTTER_SWAP_WITH_PARENT;
@override
Future<void> compute(DartChangeBuilder builder) async {
var child = flutter.identifyNewExpression(node);
if (!flutter.isWidgetCreation(child)) {
return;
}
// NamedExpression (child:), ArgumentList, InstanceCreationExpression
var expr = child.parent?.parent?.parent;
if (expr is! InstanceCreationExpression) {
return;
}
await swapParentAndChild(builder, expr, child);
}
/// Return an instance of this class. Used as a tear-off in `AssistProcessor`.
static FlutterSwapWithParent newInstance() => FlutterSwapWithParent();
}
| 38.352941 | 91 | 0.766871 |
584ebf25869465c1c42afe1317d30169d77a1e0c | 3,614 | h | C | physx/samples/sampleframework/platform/include/windows/WindowsSampleUserInputIds.h | ceti-dev/PhysX | c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa | [
"BSD-3-Clause"
] | 2,372 | 2018-12-20T18:01:39.000Z | 2022-03-31T09:58:37.000Z | physx/samples/sampleframework/platform/include/windows/WindowsSampleUserInputIds.h | ceti-dev/PhysX | c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa | [
"BSD-3-Clause"
] | 534 | 2018-12-20T20:04:42.000Z | 2022-03-31T19:00:50.000Z | physx/samples/sampleframework/platform/include/windows/WindowsSampleUserInputIds.h | ceti-dev/PhysX | c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa | [
"BSD-3-Clause"
] | 694 | 2018-12-20T18:32:36.000Z | 2022-03-16T03:45:42.000Z | //
// 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 NVIDIA CORPORATION 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 ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
#ifndef WINDOWS_SAMPLE_USER_INPUT_IDS_H
#define WINDOWS_SAMPLE_USER_INPUT_IDS_H
namespace SampleFramework
{
enum WindowsSampleUserInputIds
{
WKEY_UNKNOWN = 0,
WKEY_DEFINITION_START,
WKEY_A,
WKEY_B,
WKEY_C,
WKEY_D,
WKEY_E,
WKEY_F,
WKEY_G,
WKEY_H,
WKEY_I,
WKEY_J,
WKEY_K,
WKEY_L,
WKEY_M,
WKEY_N,
WKEY_O,
WKEY_P,
WKEY_Q,
WKEY_R,
WKEY_S,
WKEY_T,
WKEY_U,
WKEY_V,
WKEY_W,
WKEY_X,
WKEY_Y,
WKEY_Z,
WKEY_0,
WKEY_1,
WKEY_2,
WKEY_3,
WKEY_4,
WKEY_5,
WKEY_6,
WKEY_7,
WKEY_8,
WKEY_9,
WKEY_SPACE,
WKEY_RETURN,
WKEY_SHIFT,
WKEY_CONTROL,
WKEY_ESCAPE,
WKEY_COMMA,
WKEY_NUMPAD0,
WKEY_NUMPAD1,
WKEY_NUMPAD2,
WKEY_NUMPAD3,
WKEY_NUMPAD4,
WKEY_NUMPAD5,
WKEY_NUMPAD6,
WKEY_NUMPAD7,
WKEY_NUMPAD8,
WKEY_NUMPAD9,
WKEY_MULTIPLY,
WKEY_ADD,
WKEY_SEPARATOR,
WKEY_SUBTRACT,
WKEY_DECIMAL,
WKEY_DIVIDE,
WKEY_F1,
WKEY_F2,
WKEY_F3,
WKEY_F4,
WKEY_F5,
WKEY_F6,
WKEY_F7,
WKEY_F8,
WKEY_F9,
WKEY_F10,
WKEY_F11,
WKEY_F12,
WKEY_TAB,
WKEY_BACKSPACE,
WKEY_PRIOR,
WKEY_NEXT,
WKEY_UP,
WKEY_DOWN,
WKEY_LEFT,
WKEY_RIGHT,
SCAN_CODE_UP ,
SCAN_CODE_DOWN ,
SCAN_CODE_LEFT,
SCAN_CODE_RIGHT,
SCAN_CODE_FORWARD,
SCAN_CODE_BACKWARD,
SCAN_CODE_LEFT_SHIFT,
SCAN_CODE_SPACE,
SCAN_CODE_L,
SCAN_CODE_9,
SCAN_CODE_0,
WKEY_DEFINITION_END,
MOUSE_DEFINITION_START,
MOUSE_BUTTON_LEFT,
MOUSE_BUTTON_RIGHT,
MOUSE_BUTTON_CENTER,
MOUSE_MOVE,
MOUSE_DEFINITION_END,
GAMEPAD_DEFINITION_START,
GAMEPAD_DIGI_UP,
GAMEPAD_DIGI_DOWN,
GAMEPAD_DIGI_LEFT,
GAMEPAD_DIGI_RIGHT,
GAMEPAD_START,
GAMEPAD_SELECT,
GAMEPAD_LEFT_STICK,
GAMEPAD_RIGHT_STICK,
GAMEPAD_NORTH,
GAMEPAD_SOUTH,
GAMEPAD_WEST,
GAMEPAD_EAST,
GAMEPAD_LEFT_SHOULDER_TOP,
GAMEPAD_RIGHT_SHOULDER_TOP,
GAMEPAD_LEFT_SHOULDER_BOT,
GAMEPAD_RIGHT_SHOULDER_BOT,
GAMEPAD_RIGHT_STICK_X,
GAMEPAD_RIGHT_STICK_Y,
GAMEPAD_LEFT_STICK_X ,
GAMEPAD_LEFT_STICK_Y ,
GAMEPAD_DEFINITION_END,
NUM_KEY_CODES,
};
}
#endif
| 20.189944 | 74 | 0.749585 |
963c22116d9fe966196a0a78bf70c20205e33b0a | 115 | php | PHP | app/Models/SpecialAsset.php | mohamedhatemminisy/expand_repo | c75f643cbe59fe3c0d086d149538eb9a9054e4c9 | [
"MIT"
] | null | null | null | app/Models/SpecialAsset.php | mohamedhatemminisy/expand_repo | c75f643cbe59fe3c0d086d149538eb9a9054e4c9 | [
"MIT"
] | null | null | null | app/Models/SpecialAsset.php | mohamedhatemminisy/expand_repo | c75f643cbe59fe3c0d086d149538eb9a9054e4c9 | [
"MIT"
] | 1 | 2021-08-21T06:43:04.000Z | 2021-08-21T06:43:04.000Z | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SpecialAsset extends Model
{
//
}
| 10.454545 | 39 | 0.730435 |
f75a26a0f17c6a9cae6636822f98dfcc6fdd9696 | 2,075 | h | C | util/simple_io.h | ganeshkamath89/redfish | e42d67d2f8be8b4dbfe57cb756f24a1b3deaadd7 | [
"Apache-2.0"
] | 4 | 2016-09-18T09:03:37.000Z | 2018-07-17T08:49:46.000Z | util/simple_io.h | ganeshkamath89/redfish | e42d67d2f8be8b4dbfe57cb756f24a1b3deaadd7 | [
"Apache-2.0"
] | null | null | null | util/simple_io.h | ganeshkamath89/redfish | e42d67d2f8be8b4dbfe57cb756f24a1b3deaadd7 | [
"Apache-2.0"
] | 5 | 2016-09-18T09:03:39.000Z | 2018-10-12T05:01:19.000Z | /*
* Copyright 2011-2012 the Redfish 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.
*/
#ifndef REDFISH_SIMPLE_IO_DOT_H
#define REDFISH_SIMPLE_IO_DOT_H
#include "util/compiler.h"
#include <stdio.h> /* for FILE */
#include <unistd.h> /* for ssize_t */
/** Read a whole file using read(2)
*
* If the buffer is too small to read the whole file, we'll only read the first
* part. The bytes we don't read will be zeroed. The last byte will always be
* zero.
*
* @param file the file name to read
* @param buf the buffer to read the file into
* @param sz size of the buffer
*
* @return The number of bytes read on success; a negative error code
* otherwise.
*/
extern ssize_t simple_io_read_whole_file_zt(const char *file, char *buf,
int sz);
/** Copy_to_fd failed because of an error on the source fd. */
#define COPY_FD_TO_FD_SRCERR 0x08000000
/** Copy one file descriptor to another, using read(2) and write(2).
*
* @param ifd input file descriptor
* @param ofd output file descriptor
*
* @return 0 on success; on failure, the error number.
* If the source caused the problem, the error number will be ORed
* with COPY_FD_TO_FD_SRCERR.
*/
extern int copy_fd_to_fd(int ifd, int ofd);
/** Thin wrapper around fprintf that returns either 0 or -EIO.
*
* @param out FILE to write to
* @param fmt Format string, as in printf
* @param ... varargs (see man page for fprintf)
*
* @return 0 on success; a negative error code on I/O error
*/
extern int zfprintf(FILE *out, const char *fmt, ...) PRINTF_FORMAT(2, 3);
#endif
| 31.439394 | 79 | 0.717108 |
3e2c53e7edb454d5b15b7b1bd612206088043827 | 12,361 | h | C | gitrepo/gutz/simGutz/RK4.h | djmkultra/group-ring-field | e28ac7e07c001b5b7acd1150136b771c24c0ba6a | [
"Apache-2.0"
] | null | null | null | gitrepo/gutz/simGutz/RK4.h | djmkultra/group-ring-field | e28ac7e07c001b5b7acd1150136b771c24c0ba6a | [
"Apache-2.0"
] | null | null | null | gitrepo/gutz/simGutz/RK4.h | djmkultra/group-ring-field | e28ac7e07c001b5b7acd1150136b771c24c0ba6a | [
"Apache-2.0"
] | null | null | null | /////////////////////////////////////////////////////////////////////////////////////////////
//
// 8MMNMM8
// $MMMMMMMMMMMNMMNNNNN:
// 7MMMMMMMMMMMMMNNNMNNNNNNNMNDDDDD7
// MMMMMMMMMMMMMMNNNNNNNNNNNNNND8DD888
// ZMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNDDD8888:
// 8MMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNDDD88888=
// MMMMMMMMMMMMMMMMMMMMMMMNNNMNNNNNNNNNNNNNDD88888O8
// MMMMMMMMMMMMMMMMNNNNNNNNNNNDDDDDDDDDDNNDNNNDD888888O8
// MMMMMMMMMMMMMMMNNNNNNNNNNNNDDDDDDDDDDDDDDD888ND88888OO8
// MMMMMMMMMMMMMMMNNNNNNNNNNNNNNDDDDDDDDDDDDDDD888OO8DDOOZZZ
// MMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMNDDDDDD8888OOOZZ$$$$Z
// ,MMMMMMMMMMMMMMMMMNNNNNMMMMMMMMMMMMMMMDDDDDDMMMDN8OOOOZZZ++I7
// MMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNDDDDDDDDMMM88OMMD8OOZZZ$~I
// MMMMMMMMMMMMMMMMMNND8Z7I+=~::::::::~~=?I$O88DDDDD8MMOO8M8OZZ$$$
// MMMMMMMMMMMMMNDOI+:, ,~+78O888OMMZDMO$$$$
// MMMMMMMMMMM87=, ,+$8OOOMMZM8$$7
// MMMMMMMMMO?: :IOZO8M7MO77
// MMMMMMMDI, :7ZZZM7MZ7
// MMMMMMD?, ,7DZMDMZ7
// :MMMMN?, ,$$$MMZ,
// MMMM8~ +N$MM7
// MMMZ, ~DZMM
// MMD: 8""""8 8 1XD
// #2IN eeeee eeeee eeeeeee eeee 8 " 8 2YE
// 1HM 8 8 8 88 8 8 8 8 8e 8e 3ZF
// 0GL 8e 8 8 8 8e 8 8 8eee 88 ee 88 4AG
// 9FK 88 8 8 8 88 8 8 88 88 8 88 5BH
// 8EJ 88ee8 8eee8 88 8 8 88ee 88eee8 88eee 6CJ
// 7DI 7DI
// OO?~ ,~78D
// D8$+:, ,~?ZDN
// ,NDO$?=::, ,:~=?$8DM,
// ~7NNNNN8NNNNNZ:
//
//
// Copyright 2011
// Art, Research, Technology and Science Laboratory
// The University of New Mexico
// Project Home Page
// <<<<http://artslab.unm.edu/domegl>>>>>
// Code Repository
// <<<https://svn.cs.unm.edu/domegl>>>>>>
//
/////////////////////////////////////////////////////////////////////////////////////////////
#ifndef _RK4_h
#define _RK4_h
#include <vec.h>
/////////////////////////////////////////////////////////////////////////////////////////////
/// Runge-Kutta 4th Order Solver
///
/// This is a templatized class that requires a functor to find the "acceleration" (dv/dt) of a particle
/// at a particular time.
///
///
/// Example functor that implements gravity
/// \code
/// template <typename T = float>
/// class Gravity
/// {
/// public:
/// typedef T precision; //< Precision of simulation. RK4 uses this to determine its precision
/// typedef gutz::vec<T,3> vec_type; //< gutz::vec type used for the simulation. RK4 uses this to determine to represent vectors
/// struct State //< State of a particle. RK4 uses this data structure to pass around state.
/// {
/// vec_type x; //< Must have a public member named x for RK4 to work
/// vec_type v; //< Must have a public member named v for RK4 to work
/// };
///
/// /// Constructor
/// Gravity(void) {}
///
/// /// Newton's second law of gravitation
/// T secondLaw(T m1, T m2, T r)
/// {
/// static const T G = 6.67e-11f; // Nm^2/kg^2
/// return G * m1 * m2 / (r * r);
/// }
///
/// /// The "functor" part of the functor. The RK4 needs a functor defined in
/// /// exactly this way to compile and function properly.
/// ///
/// /// In this case, it calculates acceleration at this instant.
/// vec_type operator()(const State& state)
/// {
/// static T m1 = 1e0f; // Particle mass
/// static T m2 = 9.5e9f; // Singularity mass
///
/// // Vector pointing from particle to singularity, assume singularity is at 0
/// vec_type force = vec_type(static_cast<T>(0)) - state.x;
///
/// // Find the distance between the particle and the singularity
/// T dist = force.norm();
///
/// // Determine the magnitude of the gravitational force
/// T g = secondLaw(m1, m2, dist);
///
/// // Scale the force by the magnitude / distance. Normalizes and scales
/// // in a single step.
/// force *= (g / dist);
///
/// // Convert force into acceleration via a = F/m
/// vec_type accel = force / m1;
/// return accel;
/// }
/// };
/// \endcode
namespace gutz
{
template <class FIELD>
class RK4
{
public:
typedef FIELD field_type;
typedef typename FIELD::particle_type particle_type;
typedef typename particle_type::value_type value_type;
typedef typename particle_type::vec_type vec_type;
// dx/dt and dv/dt. Used to pass around derivatives.
struct Derivative
{
vec_type dx;
vec_type dv;
};
/// Constructor
RK4(field_type* field)
: _field (field)
{}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Integration step
///
/// @params state the current state for a particle
/// t the current time
/// dt size of the time step
particle_type operator()(const particle_type& state, value_type t, value_type dt)
{
Derivative a = evaluate(state, t);
Derivative b = evaluate(state, t, dt*0.5f, a);
Derivative c = evaluate(state, t, dt*0.5f, b);
Derivative d = evaluate(state, t, dt, c);
static value_type one_sixth = 1.0f/6.0f; // What if we're using complex numbers? Will this work?
const vec_type dxdt = (a.dx + (b.dx + c.dx) * 2.0f + d.dx) * one_sixth;
const vec_type dvdt = (a.dv + (b.dv + c.dv) * 2.0f + d.dv) * one_sixth;
// std::cout << "state.x: " << state.x << std::endl;
// std::cout << "state.x + dxdt * dt: " << state.x + dxdt * dt << std::endl;
// std::cout << "newState.x: " << newState.x << std::endl;
return particle_type(state.getPosition() + dxdt * dt,
state.getVelocity() + dvdt * dt,
state.getMass());
}
protected:
Derivative evaluate(const particle_type& initial, value_type t)
{
Derivative output;
output.dx = initial.getVelocity();
// Call _field's functor with particle_type's current state
output.dv = (*_field)(initial);
return output;
}
Derivative evaluate(const particle_type& initial, value_type t, value_type dt, const Derivative& d)
{
particle_type state(initial.getPosition() + d.dx * dt,
initial.getVelocity() + d.dv * dt,
initial.getMass());
Derivative output;
output.dx = state.getVelocity();
output.dv = (*_field)(state);
return output;
}
private:
field_type* _field; //< Force field
};
namespace deprecated
{
template <typename FUNCTOR>
class RK4
{
public:
// Functor's precision, could be float, double, complex, etc.
typedef typename FUNCTOR::precision PRECISION;
// gutz::vec type used to represent position, velocity, and acceleration
typedef typename FUNCTOR::vec_type vec_type;
// State structure. Must have x and v members at a minimum
typedef typename FUNCTOR::State State;
// dx/dt and dv/dt. Used to pass around derivatives.
struct Derivative
{
vec_type dx;
vec_type dv;
};
/// Constructor
RK4() {}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Integration step
///
/// @params state the current state for a particle
/// t the current time
/// dt size of the time step
State operator()(const State& state, PRECISION t, PRECISION dt)
{
State newState;
Derivative a = evaluate(state, t);
Derivative b = evaluate(state, t, dt*0.5f, a);
Derivative c = evaluate(state, t, dt*0.5f, b);
Derivative d = evaluate(state, t, dt, c);
static PRECISION one_sixth = 1.0f/6.0f; // What if we're using complex numbers? Will this work?
const vec_type dxdt = (a.dx + (b.dx + c.dx) * 2.0f + d.dx) * one_sixth;
const vec_type dvdt = (a.dv + (b.dv + c.dv) * 2.0f + d.dv) * one_sixth;
// std::cout << "state.x: " << state.x << std::endl;
// std::cout << "state.x + dxdt * dt: " << state.x + dxdt * dt << std::endl;
newState.x = state.x + dxdt*dt;
newState.v = state.v + dvdt*dt;
// std::cout << "newState.x: " << newState.x << std::endl;
return newState;
}
FUNCTOR* getFunctor(void) { return &_acceleration; }
protected:
Derivative evaluate(const State& initial, PRECISION t)
{
Derivative output;
output.dx = initial.v;
output.dv = _acceleration(initial);
return output;
}
Derivative evaluate(const State& initial, PRECISION t, PRECISION dt, const Derivative& d)
{
State state;
state.x = initial.x + d.dx * dt;
state.v = initial.v + d.dv * dt;
Derivative output;
output.dx = state.v;
output.dv = _acceleration(state);
return output;
}
private:
FUNCTOR _acceleration; //< Force field
};
}
}
#endif
| 44.624549 | 131 | 0.410323 |
759caf1b66a4a534f119cbfb356c99f46da926f5 | 831 | h | C | PROX/FOUNDATION/MESH_ARRAY/MESH_ARRAY/include/mesh_array_io_obj.h | diku-dk/PROX | c6be72cc253ff75589a1cac28e4e91e788376900 | [
"MIT"
] | 2 | 2019-11-27T09:44:45.000Z | 2020-01-13T00:24:21.000Z | PROX/FOUNDATION/MESH_ARRAY/MESH_ARRAY/include/mesh_array_io_obj.h | erleben/matchstick | 1cfdc32b95437bbb0063ded391c34c9ee9b9583b | [
"MIT"
] | null | null | null | PROX/FOUNDATION/MESH_ARRAY/MESH_ARRAY/include/mesh_array_io_obj.h | erleben/matchstick | 1cfdc32b95437bbb0063ded391c34c9ee9b9583b | [
"MIT"
] | null | null | null | #ifndef MESH_ARRAY_IO_OBJ_H
#define MESH_ARRAY_IO_OBJ_H
#include <mesh_array_t3mesh.h>
#include <mesh_array_vertex_attribute.h>
#include <string>
namespace mesh_array
{
template<typename T>
void read_obj(
std::string const & filename
, T3Mesh & mesh
, VertexAttribute<T,T3Mesh> & X
, VertexAttribute<T,T3Mesh> & Y
, VertexAttribute<T,T3Mesh> & Z
);
template<typename T>
void write_obj(
std::string const & filename
, T3Mesh const & mesh
, VertexAttribute<T,T3Mesh> const & X
, VertexAttribute<T,T3Mesh> const & Y
, VertexAttribute<T,T3Mesh> const & Z
);
} // namespace mesh_array
//MESH_ARRAY_IO_OBJ_H
#endif
| 23.742857 | 54 | 0.56077 |
5d9f6d244b2aa6fbb47db3f0333c8aa7e59489cd | 1,070 | go | Go | pkg/snowflake/terraform.go | ezeql/bariloche | 89b7f4bb9cf59c0197639f81a74671db92e752b3 | [
"MIT"
] | null | null | null | pkg/snowflake/terraform.go | ezeql/bariloche | 89b7f4bb9cf59c0197639f81a74671db92e752b3 | [
"MIT"
] | null | null | null | pkg/snowflake/terraform.go | ezeql/bariloche | 89b7f4bb9cf59c0197639f81a74671db92e752b3 | [
"MIT"
] | null | null | null | package snowflake
import (
"fmt"
"io/ioutil"
"path/filepath"
"strings"
)
type TFResource interface {
// Address is combination of a resource type and a resource name.
Address() string // Example: snowflake_schema.example
ResourceName() string // ResourceName is the name of a resource
ID() string // ID is the unique ID representing a resource
HCL() []byte // HCL generates the Hashicorp Configuration Language of a resource
}
func JoinToLower(sep string, terms ...string) string {
if len(terms) == 0 {
panic("bad usage.")
}
return strings.ToLower(strings.Join(terms, sep))
}
func GenerateTFImport(resourceType, resourceName, ID string) string {
return fmt.Sprintf(`terraform import %v.%v "%v"`, resourceType, resourceName, ID)
}
func GenerateProvider(outputDir string) error {
const provider = `terraform {
required_providers {
snowflake = {
source = "chanzuckerberg/snowflake"
version = "0.32.0"
}
}
}`
out := filepath.Join(outputDir, "provider.tf")
return ioutil.WriteFile(out, []byte(provider), 0644)
}
| 24.318182 | 90 | 0.701869 |
ed15e79092017d81035db172f50ac2deac390b10 | 3,920 | kt | Kotlin | core/src/Game/com/lyeeedar/Board/CompletionCondition/CompletionConditionKill.kt | Lyeeedar/MatchDungeon | c35a65d458591b1508c6db499583391151c2db05 | [
"Apache-2.0"
] | 1 | 2018-05-13T12:56:22.000Z | 2018-05-13T12:56:22.000Z | core/src/Game/com/lyeeedar/Board/CompletionCondition/CompletionConditionKill.kt | Lyeeedar/MatchDungeon | c35a65d458591b1508c6db499583391151c2db05 | [
"Apache-2.0"
] | null | null | null | core/src/Game/com/lyeeedar/Board/CompletionCondition/CompletionConditionKill.kt | Lyeeedar/MatchDungeon | c35a65d458591b1508c6db499583391151c2db05 | [
"Apache-2.0"
] | null | null | null | package com.lyeeedar.Board.CompletionCondition
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.utils.ObjectMap
import com.badlogic.gdx.utils.ObjectSet
import com.lyeeedar.Board.Grid
import com.lyeeedar.Board.MonsterAI
import com.lyeeedar.Board.isMonster
import com.lyeeedar.Components.*
import com.lyeeedar.Game.Global
import com.lyeeedar.Renderables.Sprite.Sprite
import com.lyeeedar.UI.SpriteWidget
import com.lyeeedar.UI.Tutorial
import com.lyeeedar.Util.*
import ktx.collections.set
@DataClass(name = "Kill")
class CompletionConditionKillData : AbstractCompletionConditionData()
{
override val classID: String = "Kill"
var all: Boolean = true
var named: String? = null
override fun load(xmlData: XmlData)
{
/* Autogenerated method contents. Do not modify. */
super.load(xmlData)
all = xmlData.getBoolean("All", true)
named = xmlData.get("Named", null)
}
}
class CompletionConditionKill(data: CompletionConditionKillData) : AbstractCompletionCondition<CompletionConditionKillData>(data)
{
val tick = AssetManager.loadSprite("Oryx/uf_split/uf_interface/uf_interface_680", colour = Colour(Color.FOREST))
val monsters = ObjectSet<Entity>()
val monsterCountMap = ObjectMap<String, Int>()
val monsterSpriteMap = ObjectMap<String, Sprite>()
val table = Table()
lateinit var grid: Grid
override fun attachHandlers(grid: Grid)
{
this.grid = grid
grid.onDamaged += fun(c) : HandlerAction {
rebuildWidget()
return HandlerAction.KeepAttached
}
grid.onTurn += fun() : HandlerAction {
rebuildWidget()
return HandlerAction.KeepAttached
}
if (!Global.resolveInstantly)
{
Future.call(
{
val tutorial = Tutorial("KillComplete")
tutorial.addPopup(Localisation.getText("completioncondition.kill.tutorial", "UI"), table)
tutorial.show()
}, 0.5f)
}
rebuildWidget()
}
override fun isCompleted(): Boolean = monsters.filter { it.damageable()!!.hp > 0 }.count() == 0
override fun createTable(grid: Grid): Table
{
rebuildWidget()
return table
}
fun rebuildWidget()
{
monsters.clear()
for (tile in grid.grid)
{
val contents = tile.contents ?: continue
var monsterEntity: Entity? = null
if (contents.isMonster())
{
monsterEntity = contents
}
else if (contents.container()?.containedEntity?.isMonster() == true)
{
monsterEntity = contents.container()!!.containedEntity!!
}
if (monsterEntity != null)
{
val name = (monsterEntity.ai()!!.ai as MonsterAI).desc.name
if (data.all || name == data.named)
{
monsters.add(monsterEntity)
}
}
}
table.clear()
for (monster in monsterCountMap.keys().toList())
{
monsterCountMap[monster] = 0
}
for (monster in monsters)
{
val ai = monster.ai()!!.ai as MonsterAI
val desc = ai.originalDesc ?: ai.desc
if (!monsterCountMap.containsKey(desc.name))
{
monsterCountMap[desc.name] = 0
}
var count = monsterCountMap[desc.name]
if (monster.damageable()!!.hp > 0)
{
count++
}
monsterCountMap[desc.name] = count
monsterSpriteMap[desc.name] = monster.sprite()!!
}
var row = Table()
var counter = 0
for (monster in monsterCountMap)
{
val sprite = monsterSpriteMap[monster.key].copy()
val count = monster.value
row.add(SpriteWidget(sprite, 24f, 24f)).padLeft(5f)
if (count == 0)
{
row.add(SpriteWidget(tick, 24f, 24f))
}
else
{
row.add(Label(" x $count", Statics.skin))
}
counter++
if (counter == 2)
{
counter = 0
table.add(row).expand().fill()
table.row()
row = Table()
}
}
table.add(row)
}
override fun getDescription(grid: Grid): Table
{
val table = Table()
table.add(Label(Localisation.getText("completioncondition.kill.description", "UI"), Statics.skin))
return table
}
} | 21.899441 | 129 | 0.690816 |
95bac774d628e661345986f7af56c0b704b53a82 | 13,775 | html | HTML | XML-GGXReader.html | Verites/verigraph-docs | fc38ff7e134e3ef198f6c969dae235ee0d5ecef9 | [
"Apache-2.0"
] | null | null | null | XML-GGXReader.html | Verites/verigraph-docs | fc38ff7e134e3ef198f6c969dae235ee0d5ecef9 | [
"Apache-2.0"
] | null | null | null | XML-GGXReader.html | Verites/verigraph-docs | fc38ff7e134e3ef198f6c969dae235ee0d5ecef9 | [
"Apache-2.0"
] | 1 | 2022-02-23T18:56:21.000Z | 2022-02-23T18:56:21.000Z | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>XML.GGXReader</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_XML-GGXReader.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/XML.GGXReader.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">verigraph-1.1.1: Software specification and verification tool based on graph rewriting.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">XML.GGXReader</p></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:readGrammar">readGrammar</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="Abstract-AdhesiveHLR.html#t:MorphismsConfig">MorphismsConfig</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> (<a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b), <a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="SndOrder-Morphism.html#t:RuleMorphism">RuleMorphism</a> a b), [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-Int.html#t:Int">Int</a>)])</li><li class="src short"><a href="#v:readGGName">readGGName</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.9.1.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:readName">readName</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:readNames">readNames</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-String.html#t:String">String</a>)]</li><li class="src short"><a href="#v:readTypeGraph">readTypeGraph</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [ParsedTypeGraph]</li><li class="src short"><a href="#v:readRules">readRules</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [RuleWithNacs]</li><li class="src short"><a href="#v:readGraphs">readGraphs</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="TypedGraph-Graph.html#t:TypedGraph">TypedGraph</a> a b)]</li><li class="src short"><a href="#v:readSequences">readSequences</a> :: <a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b) -> <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, [<a href="TypedGraph-DPO-GraphRule.html#t:GraphRule">GraphRule</a> a b])]</li><li class="src short"><a href="#v:readSequencesWithObjectFlow">readSequencesWithObjectFlow</a> :: <a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b) -> <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="TypedGraph-DPO-GraphRule.html#t:GraphRule">GraphRule</a> a b)], [<a href="Grammar-Core.html#t:ObjectFlow">ObjectFlow</a> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b)])]</li><li class="src short"><a href="#v:instantiateRule">instantiateRule</a> :: TypeGraph a b -> RuleWithNacs -> <a href="TypedGraph-DPO-GraphRule.html#t:GraphRule">GraphRule</a> a b</li><li class="src short"><a href="#v:instantiateSpan">instantiateSpan</a> :: <a href="TypedGraph-Graph.html#t:TypedGraph">TypedGraph</a> a b -> <a href="TypedGraph-Graph.html#t:TypedGraph">TypedGraph</a> a b -> [Mapping] -> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b, <a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b)</li><li class="src short"><a href="#v:minimalSafetyNacsWithLog">minimalSafetyNacsWithLog</a> :: <a href="Abstract-AdhesiveHLR.html#t:MorphismsConfig">MorphismsConfig</a> -> <a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="SndOrder-Morphism.html#t:RuleMorphism">RuleMorphism</a> a b) -> (<a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="SndOrder-Morphism.html#t:RuleMorphism">RuleMorphism</a> a b), [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-Int.html#t:Int">Int</a>)])</li><li class="src short"><a href="#v:printMinimalSafetyNacsLog">printMinimalSafetyNacsLog</a> :: [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-Int.html#t:Int">Int</a>)] -> [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>]</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:readGrammar" class="def">readGrammar</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="Abstract-AdhesiveHLR.html#t:MorphismsConfig">MorphismsConfig</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> (<a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b), <a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="SndOrder-Morphism.html#t:RuleMorphism">RuleMorphism</a> a b), [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-Int.html#t:Int">Int</a>)]) <a href="src/XML.GGXReader.html#readGrammar" class="link">Source</a> <a href="#v:readGrammar" class="selflink">#</a></p><div class="doc"><p>Reads the grammar in the XML, adds the needed minimal safety nacs
to second order, and returns the grammar and a log</p></div></div><div class="top"><p class="src"><a id="v:readGGName" class="def">readGGName</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> <a href="src/XML.GGXReader.html#readGGName" class="link">Source</a> <a href="#v:readGGName" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:readName" class="def">readName</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>] <a href="src/XML.GGXReader.html#readName" class="link">Source</a> <a href="#v:readName" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:readNames" class="def">readNames</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-String.html#t:String">String</a>)] <a href="src/XML.GGXReader.html#readNames" class="link">Source</a> <a href="#v:readNames" class="selflink">#</a></p><div class="doc"><p>Reads the names of node/edge types and NACs, which are necessary when reexporting this grammar.</p><p>To lookup the name of a node type, use <code><a href="I.html">I</a> ++ show nodeId</code> as key, where <code>nodeId</code> is the ID of
the node in the type graph. Lookup of edge types is analogous.</p></div></div><div class="top"><p class="src"><a id="v:readTypeGraph" class="def">readTypeGraph</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [ParsedTypeGraph] <a href="src/XML.GGXReader.html#readTypeGraph" class="link">Source</a> <a href="#v:readTypeGraph" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:readRules" class="def">readRules</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [RuleWithNacs] <a href="src/XML.GGXReader.html#readRules" class="link">Source</a> <a href="#v:readRules" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:readGraphs" class="def">readGraphs</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="TypedGraph-Graph.html#t:TypedGraph">TypedGraph</a> a b)] <a href="src/XML.GGXReader.html#readGraphs" class="link">Source</a> <a href="#v:readGraphs" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:readSequences" class="def">readSequences</a> :: <a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b) -> <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, [<a href="TypedGraph-DPO-GraphRule.html#t:GraphRule">GraphRule</a> a b])] <a href="src/XML.GGXReader.html#readSequences" class="link">Source</a> <a href="#v:readSequences" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:readSequencesWithObjectFlow" class="def">readSequencesWithObjectFlow</a> :: <a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b) -> <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="TypedGraph-DPO-GraphRule.html#t:GraphRule">GraphRule</a> a b)], [<a href="Grammar-Core.html#t:ObjectFlow">ObjectFlow</a> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b)])] <a href="src/XML.GGXReader.html#readSequencesWithObjectFlow" class="link">Source</a> <a href="#v:readSequencesWithObjectFlow" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:instantiateRule" class="def">instantiateRule</a> :: TypeGraph a b -> RuleWithNacs -> <a href="TypedGraph-DPO-GraphRule.html#t:GraphRule">GraphRule</a> a b <a href="src/XML.GGXReader.Span.html#instantiateRule" class="link">Source</a> <a href="#v:instantiateRule" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:instantiateSpan" class="def">instantiateSpan</a> :: <a href="TypedGraph-Graph.html#t:TypedGraph">TypedGraph</a> a b -> <a href="TypedGraph-Graph.html#t:TypedGraph">TypedGraph</a> a b -> [Mapping] -> (<a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b, <a href="TypedGraph-Morphism.html#t:TypedGraphMorphism">TypedGraphMorphism</a> a b) <a href="src/XML.GGXReader.Span.html#instantiateSpan" class="link">Source</a> <a href="#v:instantiateSpan" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:minimalSafetyNacsWithLog" class="def">minimalSafetyNacsWithLog</a> :: <a href="Abstract-AdhesiveHLR.html#t:MorphismsConfig">MorphismsConfig</a> -> <a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="SndOrder-Morphism.html#t:RuleMorphism">RuleMorphism</a> a b) -> (<a href="Grammar-Core.html#t:Grammar">Grammar</a> (<a href="SndOrder-Morphism.html#t:RuleMorphism">RuleMorphism</a> a b), [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-Int.html#t:Int">Int</a>)]) <a href="src/XML.GGXReader.html#minimalSafetyNacsWithLog" class="link">Source</a> <a href="#v:minimalSafetyNacsWithLog" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:printMinimalSafetyNacsLog" class="def">printMinimalSafetyNacsLog</a> :: [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-Int.html#t:Int">Int</a>)] -> [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>] <a href="src/XML.GGXReader.html#printMinimalSafetyNacsLog" class="link">Source</a> <a href="#v:printMinimalSafetyNacsLog" class="selflink">#</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html> | 2,295.833333 | 6,602 | 0.680944 |
7c684256eb57765b4f10b8cab532dd7e9c5807f9 | 1,898 | sql | SQL | npcapi-web/src/main/resources/Databases/employee.sql | dengxiaoning/mygihub | a706e54b18fe8f607b281c6728b86ad34b1986f2 | [
"MIT"
] | 2 | 2019-03-27T08:18:47.000Z | 2019-06-09T02:19:35.000Z | npcapi-web/target/npcapi-web/WEB-INF/classes/Databases/employee.sql | dengxiaoning/mygihub | a706e54b18fe8f607b281c6728b86ad34b1986f2 | [
"MIT"
] | null | null | null | npcapi-web/target/npcapi-web/WEB-INF/classes/Databases/employee.sql | dengxiaoning/mygihub | a706e54b18fe8f607b281c6728b86ad34b1986f2 | [
"MIT"
] | null | null | null | CREATE TABLE `department`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`departmentid` int(11) NOT NULL,
`departmentname` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 comment='部门表';
insert into department values(default ,20,'生成技术部');
insert into department values(default ,30,'系统维护部');
insert into department values(default ,40,'人事部');
insert into department values(default ,50,'营销部');
CREATE TABLE `employee` (
`employee_id` int(11) NOT NULL AUTO_INCREMENT,
`employee_account` varchar(255) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(100) NOT NULL,
`age` int(11) DEFAULT NULL,
`address` varchar(255) DEFAULT NULL,
`departmentid` int(11) DEFAULT NULL,
`role` int(3) NOT NULL,
PRIMARY KEY (`employee_id`),
KEY `departmentid` (`departmentid`) USING BTREE,
CONSTRAINT `employee_ibfk_1` FOREIGN KEY (`departmentid`) REFERENCES `department` (`departmentid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 comment='员工表';
insert into employee values(default,'1004','希腊','123456',20,'四川成都青羊',20,40);
insert into employee values(default,'1005','何星','123456',22,'四川成都青羊',20,30);
insert into employee values(default,'1006','李协议','123456',33,'四川成都青羊',30,30);
insert into employee values(default,'1007','可兴隆','123456',35,'四川成都青羊',40,20);
insert into employee values(default,'1008','图一哼','123456',29,'四川成都青羊',50,20);
insert into employee values(default,'1009','布朗','123456',28,'四川成都青羊',20,40);
insert into employee values(default,'1010','泰克','123456',34,'四川成都青羊',40,30);
insert into employee values(default,'1011','冰红','123456',40,'四川成都青羊',30,20);
insert into employee values(default,'1009','犀利','123456',28,'四川成都青羊',20,40);
insert into employee values(default,'1010','阔绰','123456',34,'四川成都青羊',40,30);
insert into employee values(default,'1011','鸿基','123456',40,'四川成都青羊',30,20);
| 49.947368 | 136 | 0.722339 |
c9665653d2281bfb6f90b7d7dbda84be9e90c9db | 3,425 | swift | Swift | ShowTime/MovieDetailsViewController.swift | kanchanamv/ShowTime | 9d4395ab58df5fd6f57e3ad6381f70b660f0ebd4 | [
"Apache-2.0"
] | null | null | null | ShowTime/MovieDetailsViewController.swift | kanchanamv/ShowTime | 9d4395ab58df5fd6f57e3ad6381f70b660f0ebd4 | [
"Apache-2.0"
] | 1 | 2016-02-08T05:32:56.000Z | 2016-02-08T19:27:25.000Z | ShowTime/MovieDetailsViewController.swift | kanchanamv/ShowTime | 9d4395ab58df5fd6f57e3ad6381f70b660f0ebd4 | [
"Apache-2.0"
] | null | null | null | //
// MovieDetailsViewController.swift
// ShowTime
//
// Created by Kanch on 2/5/16.
// Copyright © 2016 Kanch. All rights reserved.
//
import UIKit
class MovieDetailsViewController: UIViewController {
@IBOutlet weak var detailsTitleLabel: UILabel!
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var detailsOverviewLabel: UILabel!
@IBOutlet weak var detailsImageView: UIImageView!
@IBOutlet weak var infoView: UIView!
var movie : NSDictionary!
override func viewDidLoad() {
super.viewDidLoad()
scrollView.contentSize = CGSize(width: scrollView.frame.size.width, height: infoView.frame.origin.y + infoView.frame.size.height )
print(movie)
let title = movie["title"] as? String
detailsTitleLabel.text = title
let overview = movie["overview"] as? String
detailsOverviewLabel.text = overview
detailsOverviewLabel.sizeToFit()
if let posterpath = movie["poster_path"] as? String
{
let baseUrl = "https://image.tmdb.org/t/p/w342"
let imageUrl = NSURL(string: baseUrl + posterpath)
let imageRequest = NSURLRequest(URL: imageUrl!)
// detailsImageView.setImageWithURL(imageUrl!, placeholderImage: nil)
self.detailsImageView.setImageWithURLRequest(
imageRequest,
placeholderImage: nil,
success: { (imageRequest, imageResponse, image) -> Void in
// imageResponse will be nil if the image is cached
if imageResponse != nil {
print("Image was NOT cached, fade in image")
self.detailsImageView.alpha = 0.0
self.detailsImageView.image = image
UIView.animateWithDuration(0.9, animations: { () -> Void in
self.detailsImageView.alpha = 1.0
})
} else {
print("Image was cached so just update the image")
self.detailsImageView.image = image
// self.detailsImageView.alpha = 0.0
// self.detailsImageView.image = image
// UIView.animateWithDuration(0.9, animations: { () -> Void in
// self.detailsImageView.alpha = 1.0
// })
}
},
failure: { (imageRequest, imageResponse, error) -> Void in
// do something for the failure condition
})
}
else
{
detailsImageView.image = nil
}
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
// override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
//}
}
| 34.94898 | 138 | 0.55708 |
297138bd37d61f2e1778b942c10f6d03a1ff70ae | 2,133 | swift | Swift | NewNotifications/ViewController.swift | burakfirik/iNotifyMe | 08f5fa50ab5bf92313032c51437962e7f90de4e3 | [
"Apache-2.0"
] | 1 | 2019-06-29T17:05:53.000Z | 2019-06-29T17:05:53.000Z | NewNotifications/ViewController.swift | burakfirik/iNotifyMe | 08f5fa50ab5bf92313032c51437962e7f90de4e3 | [
"Apache-2.0"
] | null | null | null | NewNotifications/ViewController.swift | burakfirik/iNotifyMe | 08f5fa50ab5bf92313032c51437962e7f90de4e3 | [
"Apache-2.0"
] | null | null | null |
import UIKit
import UserNotifications
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// 1. REQUEST PERMISSION
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound], completionHandler: { (granted, error) in
if granted {
self.loadNotification()
} else {
print(error?.localizedDescription)
}
})
}
// 3. SCHEDULE NOTIFICATION
@IBAction func notifyMeButtonTapped(sender: UIButton) {
scheduleNotification(inSeconds: 5, completion: { success in
if success {
print("Successfully scheduled notification")
} else {
print("Error scheduling notification")
}
})
}
func loadNotification() {
}
// 2. CREATE NOTIFICATION
func scheduleNotification(inSeconds: TimeInterval, completion: @escaping (_ Success: Bool) -> ()) {
// Add an attachment
let myImage = "bk"
guard let imageUrl = Bundle.main.url(forResource: myImage, withExtension: "gif") else {
completion(false)
return
}
var attachment: UNNotificationAttachment
attachment = try! UNNotificationAttachment(identifier: "myNotification", url: imageUrl, options: .none)
// Create our notification content
let notif = UNMutableNotificationContent()
// ONLY FOR EXTENSION
notif.categoryIdentifier = "myNotificationCategory"
notif.title = "New Notification!"
notif.subtitle = "These are great!"
notif.body = "The new notification options in iOS 10 are what I've been waiting for! 👊"
// Add our attachment
notif.attachments = [attachment]
let notifTrigger = UNTimeIntervalNotificationTrigger(timeInterval: inSeconds, repeats: false)
let request = UNNotificationRequest(identifier: "myNotification", content: notif, trigger: notifTrigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: { error in
if error != nil {
print(error)
completion(false)
} else {
completion(true)
}
})
}
}
| 27.346154 | 135 | 0.662447 |
cc926e4cce8f00a634c6eafe3f0f30afea8e1d88 | 2,629 | kt | Kotlin | src/main/kotlin/aoc2020/CrabCups.kt | komu/advent-of-code | f07e74761d742c519fef4ba06fa474f1016bdbbd | [
"MIT"
] | null | null | null | src/main/kotlin/aoc2020/CrabCups.kt | komu/advent-of-code | f07e74761d742c519fef4ba06fa474f1016bdbbd | [
"MIT"
] | null | null | null | src/main/kotlin/aoc2020/CrabCups.kt | komu/advent-of-code | f07e74761d742c519fef4ba06fa474f1016bdbbd | [
"MIT"
] | null | null | null | package aoc2020
fun crabCups1(labels: String) =
crapCups(labels, iterations = 100, maxLabel = 9).answer()
fun crabCups2(labels: String): Long {
val one = crapCups(labels, iterations = 10_000_000, maxLabel = 1_000_000)
return one.next.label.toLong() * one.next.next.label
}
private fun crapCups(labels: String, iterations: Int, maxLabel: Int): CupCircleNode {
val first = CupCircleNode.build(labels, maxLabel)
val nodesByLabels = Array(maxLabel + 1) { first }
for (node in first)
nodesByLabels[node.label] = node
var current = first
repeat(iterations) {
val firstRemoved = current.next
val lastRemoved = firstRemoved.next.next
val afterLast = lastRemoved.next
current.next = afterLast
val destinationLabel = pickDestinationLabel(current.label - 1, firstRemoved, maxLabel)
val destination = nodesByLabels[destinationLabel]
val next = destination.next
destination.next = firstRemoved
lastRemoved.next = next
current = current.next
}
return nodesByLabels[1]
}
private fun pickDestinationLabel(firstCandidate: Int, firstRemoved: CupCircleNode, maxLabel: Int): Int {
val illegal1 = firstRemoved.label
val illegal2 = firstRemoved.next.label
val illegal3 = firstRemoved.next.next.label
var value = if (firstCandidate == 0) maxLabel else firstCandidate
while (value == illegal1 || value == illegal2 || value == illegal3)
value = if (value == 1) maxLabel else (value - 1)
return value
}
private class CupCircleNode(val label: Int) : Iterable<CupCircleNode> {
lateinit var next: CupCircleNode
override fun iterator() = iterator {
val first = this@CupCircleNode
var node = first
do {
yield(node)
node = node.next
} while (node != first)
}
fun answer() =
drop(1).map { it.label }.joinToString("")
companion object {
fun build(labelString: String, maxLabel: Int): CupCircleNode {
val givenLabels = labelString.map { it.toString().toInt() }
val first = CupCircleNode(givenLabels.first())
var previous = first
for (cup in givenLabels.drop(1)) {
val node = CupCircleNode(cup)
previous.next = node
previous = node
}
for (cup in 10..maxLabel) {
val node = CupCircleNode(cup)
previous.next = node
previous = node
}
previous.next = first
return first
}
}
}
| 27.968085 | 104 | 0.615824 |
ece6bb18772cb109e542728c77ca060e29f97f04 | 180 | sql | SQL | trunk/sql/Procedures/dbo.spTagDelete.sql | tue65786/MedLog | 2ff87f0dcea581a6363c8955b9f73c787d0ba66d | [
"Apache-2.0"
] | 2 | 2016-09-10T16:29:48.000Z | 2016-09-19T19:25:14.000Z | trunk/sql/Procedures/dbo.spTagDelete.sql | tue65786/MedLogDB | 2ff87f0dcea581a6363c8955b9f73c787d0ba66d | [
"Apache-2.0"
] | 3 | 2016-10-09T17:57:48.000Z | 2016-12-11T01:59:40.000Z | trunk/sql/Procedures/dbo.spTagDelete.sql | tue65786/MedLog | 2ff87f0dcea581a6363c8955b9f73c787d0ba66d | [
"Apache-2.0"
] | null | null | null | SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
CREATE PROC [dbo].[spTagDelete]
@Id int
AS
SET NOCOUNT OFF
DELETE
FROM [dbo].[Tag]
WHERE [Id] = @Id
GO
| 12.857143 | 33 | 0.611111 |
3dc40b6d6bfde7cbca6f2495b5619ed84c661111 | 5,117 | lua | Lua | extract_resnet_feat.lua | LuoweiZhou/ProcNets-YouCook2 | 815ae582b5a93ef2d85ddac9e2783454d2114efb | [
"MIT"
] | 32 | 2018-03-04T06:07:34.000Z | 2022-01-27T02:20:43.000Z | extract_resnet_feat.lua | LuoweiZhou/ProcNets-YouCook2 | 815ae582b5a93ef2d85ddac9e2783454d2114efb | [
"MIT"
] | 7 | 2018-07-20T09:20:27.000Z | 2021-08-05T14:49:31.000Z | extract_resnet_feat.lua | LuoweiZhou/ProcNets-YouCook2 | 815ae582b5a93ef2d85ddac9e2783454d2114efb | [
"MIT"
] | 11 | 2018-03-04T06:07:36.000Z | 2020-12-03T15:24:38.000Z | require 'torch'
require 'nn'
require 'nngraph'
require 'csvigo'
local utils = require 'misc.utils'
require 'misc.DataLoaderFeatExtract'
local net_utils = require 'misc.net_utils'
require 'misc.optim_updates'
-------------------------------------------------------------------------------
-- Input arguments and options
-------------------------------------------------------------------------------
cmd = torch.CmdLine()
cmd:text()
cmd:text('Train and validate a Procedure Segmentation model')
cmd:text()
cmd:text('Options')
-- Data input settings
cmd:option('-image_folder', '/z/home/luozhou/YouCookII/raw_frames_all', 'root directory of raw images')
cmd:option('-train_data_folder', 'train_raw_frames', 'training frame folder')
cmd:option('-train_feat_folder', 'train_feat_frame', 'training frame feature folder')
cmd:option('-val_data_folder', 'test_raw_frames', 'val/testing frame folder')
cmd:option('-val_feat_folder', 'test_feat_frame', 'val/testing frame feature folder')
cmd:option('-images_use', -1, 'number of videos to extract feature from. -1 = all')
-- Model settings
cmd:option('-frames_per_video', 500, 'number of frames sampled in one video')
cmd:option('-cnn_model_t7','/z/home/luozhou/dataset/e2eglstm/tc-resnet34/model_ide2eglstm-resnet-lr5-decay3.t7','path to CNN model t7 file containing the weights. For now it does not support other models than model_ide2eglstm-resnet-lr5-decay3.t7')
cmd:option('-input_encoding_size',512,'the encoding size of each token in the vocabulary, and the image.')
-- misc
cmd:option('-backend', 'cudnn', 'nn|cudnn')
cmd:option('-id', '', 'an id identifying this run/job. used in cross-val and appended when writing progress files')
cmd:option('-seed', 123, 'random number generator seed to use')
cmd:option('-gpuid', 0, 'which gpu to use. -1 = use CPU')
cmd:text()
-------------------------------------------------------------------------------
-- Basic Torch initializations
-------------------------------------------------------------------------------
local opt = cmd:parse(arg)
torch.manualSeed(opt.seed)
torch.setdefaulttensortype('torch.FloatTensor') -- for CPU
if opt.gpuid >= 0 then
require 'cutorch'
require 'cunn'
if opt.backend == 'cudnn' then require 'cudnn' end
cutorch.manualSeed(opt.seed)
cutorch.setDevice(opt.gpuid + 1) -- note +1 because lua is 1-indexed
end
-------------------------------------------------------------------------------
-- Create the Data Loader instance
-------------------------------------------------------------------------------
local loader_val
loader_val = DataLoaderFeatExtract{folder_path = opt.image_folder, split = opt.val_data_folder}
-------------------------------------------------------------------------------
-- Initialize the networks
-------------------------------------------------------------------------------
local protos = {}
local loaded_checkpoint = torch.load(opt.cnn_model_t7)
protos = loaded_checkpoint.protos
if opt.gpuid >= 0 then
for k,v in pairs(protos) do v:cuda() end
end
collectgarbage()
protos.cnn:evaluate()
loader_val:resetIterator()
local function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
-------------------------------------------------------------------------------
-- Feature extraction
-------------------------------------------------------------------------------
n=0
while true do
-- fetch a batch of data
local data = loader_val:getBatch{batch_size = opt.batch_size, frames_per_video = opt.frames_per_video}
local feats_all=torch.CudaTensor(opt.frames_per_video, opt.input_encoding_size)
local deco = 20
for i=1,#data.images do
if file_exists(path.join(data.infos[i].file_path,'resnet_34_feat_mscoco.dat')) == false then -- for .dat
-- if file_exists(path.join(data.infos[i].file_path,'resnet_34_feat_mscoco.csv')) == false then -- for .csv
print('[INFO] processing '.. data.infos[i].file_path)
data.images[i] = net_utils.prepro(data.images[i], false, opt.gpuid >= 0) -- preprocess in place, and don't augment
-- The input pixel value is between 0 and 255, which can directly feed into our pre-trained model on MSCOCO. Remember to divide data.images[i] by 255.0 if taking pre-trained Resnet models from ImageNet... Legacy issue on vgg/resnet input format...
-- forward pass
for j=1,deco do
local feats = protos.cnn:forward(data.images[i]:sub((j-1)*opt.frames_per_video/deco+1,j*opt.frames_per_video/deco,1,3,1,224,1,224))
feats_all:sub((j-1)*opt.frames_per_video/deco+1,j*opt.frames_per_video/deco,1,opt.input_encoding_size):copy(feats)
end
-- save feature to file
torch.save(path.join(data.infos[i].file_path,'resnet_34_feat_mscoco.dat'),feats_all)
-- csvigo.save{path = path.join(data.infos[i].file_path,'resnet_34_feat_mscoco.csv'), data=torch.totable(feats_all)}
else
print('[INFO]' .. data.infos[i].file_path .. 'has already been processed!' )
end
end
n=n+1
if n >= opt.images_use and opt.images_use > 0 then break end -- we've used enough images
end
| 44.495652 | 253 | 0.619308 |
3c3e0ad02725843ff254cc44f634c96fef0c19da | 918 | swift | Swift | googleBooks/googleBooks/Classes/Helper/PlistReader.swift | kobinary/GoogleBooks | b3fc1cc70101d35815808b4ceee1081a0911623e | [
"MIT"
] | null | null | null | googleBooks/googleBooks/Classes/Helper/PlistReader.swift | kobinary/GoogleBooks | b3fc1cc70101d35815808b4ceee1081a0911623e | [
"MIT"
] | null | null | null | googleBooks/googleBooks/Classes/Helper/PlistReader.swift | kobinary/GoogleBooks | b3fc1cc70101d35815808b4ceee1081a0911623e | [
"MIT"
] | null | null | null | //
// PlistReader.swift
// googleBooks
//
// Created by Maria Ortega on 10/04/2018.
// Copyright © 2018 Maria Ortega. All rights reserved.
//
import UIKit
let apiEnpointsPLIST = "APIEndpoints"
class PlistReader: NSObject {
static func getAPIEnpoint(key: String) -> String {
let plistPath = Bundle.main.path(forResource: apiEnpointsPLIST, ofType: "plist")
let plistData = FileManager.default.contents(atPath: plistPath!)
var format = PropertyListSerialization.PropertyListFormat.xml
let plistDict = try! PropertyListSerialization.propertyList(from: plistData!,
options: .mutableContainersAndLeaves,
format: &format) as? [String : AnyObject]
let value = plistDict?[key] as? String
return value!
}
}
| 28.6875 | 110 | 0.588235 |
264e2692c466ab9210b17b6a8e16c567062f1afa | 573 | java | Java | mxcache-guice-integration/src/main/java/com/maxifier/mxcache/guice/GuiceInstanceProviderName.java | akochurov/mxcache | b1c7da980bf7fa8252663883580c047b6bd56b01 | [
"MIT"
] | 2 | 2016-04-15T14:17:12.000Z | 2016-07-06T17:54:20.000Z | mxcache-guice-integration/src/main/java/com/maxifier/mxcache/guice/GuiceInstanceProviderName.java | akochurov/mxcache | b1c7da980bf7fa8252663883580c047b6bd56b01 | [
"MIT"
] | 16 | 2015-04-16T13:36:03.000Z | 2020-01-14T11:35:37.000Z | mxcache-guice-integration/src/main/java/com/maxifier/mxcache/guice/GuiceInstanceProviderName.java | akochurov/mxcache | b1c7da980bf7fa8252663883580c047b6bd56b01 | [
"MIT"
] | 3 | 2015-12-02T14:30:20.000Z | 2019-12-10T09:16:19.000Z | /*
* Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
*/
package com.maxifier.mxcache.guice;
import com.google.inject.BindingAnnotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* GuiceInstanceProviderName
*
* @author Alexander Kochurov (alexander.kochurov@maxifier.com)
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
@BindingAnnotation
public @interface GuiceInstanceProviderName {
}
| 24.913043 | 64 | 0.769634 |
df1ca3b0a8cbc01560b57b6ca6d793a18a8f9703 | 2,690 | kt | Kotlin | app/src/main/java/com/miniweebs/reciboi/presentation/meals/MealExtendedActivity.kt | ken1000minus7/ReciBoi | 9747e61063539cf842830b8807fc3cc1f1b84295 | [
"MIT"
] | null | null | null | app/src/main/java/com/miniweebs/reciboi/presentation/meals/MealExtendedActivity.kt | ken1000minus7/ReciBoi | 9747e61063539cf842830b8807fc3cc1f1b84295 | [
"MIT"
] | null | null | null | app/src/main/java/com/miniweebs/reciboi/presentation/meals/MealExtendedActivity.kt | ken1000minus7/ReciBoi | 9747e61063539cf842830b8807fc3cc1f1b84295 | [
"MIT"
] | null | null | null | package com.miniweebs.reciboi.presentation.meals
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
import com.miniweebs.reciboi.data.api.ApiInstance
import com.miniweebs.reciboi.data.api.Meal
import com.miniweebs.reciboi.data.api.MealByCategory
import com.miniweebs.reciboi.databinding.ActivityMealExtendedBinding
import com.miniweebs.reciboi.presentation.adapters.CategoryAdapter
import com.miniweebs.reciboi.presentation.adapters.ListenersCategory
import com.miniweebs.reciboi.presentation.mealActivity.MealActivity
import com.miniweebs.reciboi.presentation.viewmodel.MealViewModel
import kotlinx.coroutines.runBlocking
class MealExtendedActivity : AppCompatActivity() , ListenersCategory {
private lateinit var binding: ActivityMealExtendedBinding
private lateinit var viewModel : MealViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMealExtendedBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
viewModel = ViewModelProvider(this)[MealViewModel::class.java]
val categoryBundle = intent.extras
val category = categoryBundle?.getString("category")
val switch = categoryBundle?.getInt("switch")
Log.d("soe","$category")
val gridLayoutManager = GridLayoutManager(this,2)
binding.rvCategorySearchResult.layoutManager = gridLayoutManager
if (switch==1) {
viewModel.getMealsByCategory(category!!)
viewModel.mealsByCategory.observe(this) {
val categories: MutableList<MealByCategory> = mutableListOf()
categories.addAll(it.meals)
binding.rvCategorySearchResult.adapter = CategoryAdapter(this, categories,this)
}
}
else if (switch==2) {
viewModel.getMealsByArea(category!!)
viewModel.mealsByArea.observe(this) {
val areas: MutableList<MealByCategory> = mutableListOf()
areas.addAll(it.meals)
binding.rvCategorySearchResult.adapter = CategoryAdapter(this, areas,this)
}
}
}
override fun onItemClicked(category: MealByCategory) {
runBlocking {
val meal = ApiInstance.api.getMealById(category.idMeal).body()?.meals?.get(0)
val intent = Intent(applicationContext, MealActivity::class.java)
intent.putExtra("Meal",meal)
startActivity(intent)
}
}
} | 41.384615 | 95 | 0.718216 |
a1743af5dc9dcbaabc25913d8f9b7d3ba842c395 | 1,908 | c | C | examples/account.h.c | mirohs/headify | 21925ca27f3fb6aa807f6f3b3041bb87852a6efb | [
"MIT"
] | null | null | null | examples/account.h.c | mirohs/headify | 21925ca27f3fb6aa807f6f3b3041bb87852a6efb | [
"MIT"
] | null | null | null | examples/account.h.c | mirohs/headify | 21925ca27f3fb6aa807f6f3b3041bb87852a6efb | [
"MIT"
] | null | null | null | *#include "util.h"
#include "account.h"
;
int ibalance(int a) {
return a;
}
*int ff(int a, int b);
*char* hello = "hello";// hello
*int i;
*typedef void (*MyFuncType)(void);
/*
make account && ./account
*/;
/*abc*//*def*/#include "util.h"
*# /*mytest*/ define bo (
*# define bc ) // test
*typedef struct {
char* owner;
int balance; }
Account;
*Account acc = {NULL, 123};
*struct Account;
*struct Point {
int x;
int y; };
int a[10]; // line comment
*int apub[10]; // line comment
*int b[2][3] = {{1, 2, 3}, {4, 5, 6}};
double d = 3.14;
#define xyz 123
*typedef int (*fp)(double, double);
Account open_account(char* owner, int initial) {
require("not empty", strlen(owner) > 0);
require("not negative", initial >= 0);
Account a;
a.owner = owner;
a.balance = initial;
return a; }
Account deposit(Account a, int amount) {
require("not n\
egative", amount >= 0);
ensure_code(int old_balance = a.balance);
a.balance += amount;
ensure("amount added", a.balance == old_balance + amount);
return a; }
Account withdraw(Account a, int amount) {
require("not negative", amount >= 0);
require("sufficient balance", a.balance >= amount);
ensure_code(int old_balance = a.balance);
a.balance -= amount;
ensure("amount subtracted", a.balance == old_balance - amount);
ensure("balance not negative", a.balance >= 0);
return a; }
*int balance(Account a) {
return a.balance; }
char* owner(Account a) {
return a.owner; }
*union IntOrFLoat {
int i;
float f; };
union IntOrFloat { int i; float f; };
*int main(void) {
Account a = open_account("Ida", 100);
printf("%d\n", balance(a));
a = deposit(a, 10);
printf("%d\n", balance(a));
a = withdraw(a, 20);
printf("%d\n", balance(a));
a = withdraw(a, 80);
printf("%d\n", balance(a));
return 0; }
| 19.08 | 67 | 0.58805 |
d2b0e64ba48110d2950e6c89634f485a3e461f46 | 8,515 | php | PHP | app/Http/routes.php | CaoJiayuan/dj-api | bf4754c1845abc494f3aae83702b33e19d6e51e2 | [
"MIT"
] | null | null | null | app/Http/routes.php | CaoJiayuan/dj-api | bf4754c1845abc494f3aae83702b33e19d6e51e2 | [
"MIT"
] | null | null | null | app/Http/routes.php | CaoJiayuan/dj-api | bf4754c1845abc494f3aae83702b33e19d6e51e2 | [
"MIT"
] | null | null | null | <?php
use Dingo\Api\Routing\Router;
/** @var Dingo\Api\Routing\Router $api */
$api = app('api.router');
$api->version('v1', ['namespace' => 'App\Http\Controllers\V1'], function (Router $api) {
$api->get('/', function () {
return "DJ platform !";
});
$api->get('t', function (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $exception) {
return $exception->getTrace();
// $a = \App\Entity\Account::find(1);
// return $a->unfinishedTrip();
return substr('13323148593', -4);
return \App\Utils\YunTuUtil::around(30.57, 104.06);
});
$api->get('provinces', 'LocationController@provinces');
$api->get('cities', 'LocationController@cities');
$api->get('areas', 'LocationController@areas');
$api->post('login', "AuthController@login");
$api->post('register', "AuthController@register");
$api->post('sms/code', 'SmsController@postCode');
$api->get('truck/sizes', 'OtherController@truckSizes');
$api->get('car/types', 'OtherController@carTypes');
$api->get('banner','OtherController@banner');
$api->get('about', function () {
return view('about');
});
$api->get('license', function () {
return view('license');
});
$api->get('rule/local', 'PayRuleController@local');
$api->get('rule/journey', 'PayRuleController@journey');
$api->get('rule/truck', 'PayRuleController@truck');
$api->get('rule/chauffeur', 'PayRuleController@chauffeur');
$api->get('rule/chauffeur/journey', 'PayRuleController@chauffeurJourney');
$api->get('insure/seller', 'InsureController@seller');
$api->get('insure/insurance', 'InsureController@insurance');
$api->post('password/forgot', 'PasswordController@resetPassword');
$api->post('hook', 'PingXXController@hook');
$api->any('rebate', 'TraderController@rebate');
// Role type passenger
$api->group(['middleware' => 'api.passenger'], function (Router $api) {
$api->get('passenger/local/detail', 'LocalController@detail');
$api->get('passenger/local/predictPay', 'LocalController@predictPay');
$api->get('passenger/journey/predictPay', 'JourneyController@predictPay');
$api->get('passenger/truck/predictPay', 'TruckController@predictPay');
$api->get('passenger/chauffeur/predictPay', 'ChauffeurController@predict');
$api->get('passenger/chauffeur/journey/predictPay', 'ChauffeurController@predictJourney');
// Role type passenger and authenticated
$api->group(['middleware' => 'api.authenticate'], function (Router $api) {
$api->get('passenger/trip/unpayed', 'OrderController@unpayed');
$api->post('trip/comment', 'LocalController@comment');
$api->get('passenger/trips', 'AccountController@trips');
$api->get('passenger/truck/list', 'TruckController@getList');
$api->get('passenger/journey/list', 'JourneyController@getList');
$api->get('passenger/local/mine', 'LocalController@mine');
$api->post('passenger/local/taxi', 'LocalController@taxi');
$api->post('passenger/local/push', 'LocalController@pushDrivers');
$api->post('passenger/local/cancel', 'LocalController@passengerCancelOrder');
$api->post('passenger/truck/publish', 'TruckController@publish');
$api->post('passenger/truck/cancel', 'TruckController@cancel');
$api->get('passenger/truck/passengerAccept', 'TruckController@passengerAccept');
$api->post('balance/pay', 'PaymentController@balanceTripPay');
$api->post('balance/prepay', 'PaymentController@balancePrePay');
$api->post('passenger/journey/publish', 'JourneyController@publish');
$api->post('passenger/journey/cancel', 'JourneyController@cancel');
$api->get('passenger/journey/passengerAccept', 'JourneyController@passengerAccept');
$api->post('passenger/chauffeur/publish', 'ChauffeurController@publish');
$api->post('passenger/chauffeur/journey/publish', 'ChauffeurController@journeyPublish');
$api->post('passenger/chauffeur/cancel', 'ChauffeurController@cancel');
$api->get('buyer/orders', 'ShopController@orders');
$api->get('charge/trip', 'PaymentController@getTripPayData');
$api->get('charge/wash', 'PaymentController@getWashPayData');
$api->get('charge/insure', 'PaymentController@getInsureData');
$api->get('charge/prepay', 'PaymentController@getPrePayData');
});
});
// Role type driver
$api->group(['middleware' => 'api.driver'], function (Router $api) {
// Role type driver and authenticated
$api->group(['middleware' => 'api.authenticate'], function (Router $api) {
$api->get('driver/trip/unpayed', 'OrderController@unpayedDriver');
$api->get('driver/trips', 'AccountController@trips');
$api->get('driver/journey/list', 'JourneyController@getList');
$api->get('driver/chauffeur/list', 'ChauffeurController@journeyList');
$api->get('driver/truck/list', 'TruckController@getList');
$api->get('driver/local/work', 'LocalController@driverWork');
$api->post('driver/local/accept', 'LocalController@acceptTrip');
$api->post('driver/local/cancel', 'LocalController@driverCancelOrder');
$api->post('driver/local/in-position', 'LocalController@inPosition');
$api->post('driver/local/finish', 'LocalController@finish');
$api->post('driver/local/active', 'LocalController@active');
//司机端轮询
$api->post('driver/local/trip', 'LocalController@trip');
$api->post('driver/truck/publish', 'TruckController@publish');
$api->post('driver/truck/accept', 'TruckController@accept');
$api->post('driver/truck/active', 'TruckController@active');
$api->post('driver/truck/finish', 'TruckController@finish');
$api->post('driver/truck/cancel', 'TruckController@cancel');
$api->post('driver/chauffeur/accept', 'ChauffeurController@accept');
$api->post('driver/chauffeur/cancel', 'ChauffeurController@cancel');
$api->post('driver/chauffeur/active', 'ChauffeurController@active');
$api->post('driver/chauffeur/finish', 'ChauffeurController@finish');
$api->post('driver/chauffeur/in-position', 'ChauffeurController@inPosition');
$api->post('driver/journey/publish', 'JourneyController@publish');
$api->post('driver/journey/cancel', 'JourneyController@cancel');
$api->post('driver/journey/accept', 'JourneyController@accept');
$api->post('driver/journey/active', 'JourneyController@active');
$api->post('driver/journey/finish', 'JourneyController@finish');
$api->get('driver/journey/related', 'JourneyController@related');
$api->get('seller/orders', 'ShopController@orders');
});
});
//Just authenticated
$api->group(['middleware' => 'api.authenticate'], function (Router $api) {
$api->get('account/credits', 'AccountController@creditCards');
$api->post('complain', 'OtherController@complain');
$api->post('feedback', 'AccountController@feedback');
$api->post('account/credits/add', 'AccountController@addCreditCard');
$api->post('account/withdraw', 'AccountController@withdraw');
$api->post('insure/bay', 'InsureController@bay');
$api->post('insure/done', 'InsureController@done');
$api->post('wash/pay', 'PaymentController@balanceWashPay');
$api->post('insure/pay', 'PaymentController@balanceInsurePay');
$api->post('trader/first', 'TraderController@applyFirst');
$api->get('trip/detail', 'LocalController@detail');
$api->get('trip/unfinished', 'AccountController@unfinishedTrip');
$api->get('account/trips', 'AccountController@trips');
$api->get('account/insurances', 'InsureController@orders');
$api->get('account', 'AccountController@detail');
$api->post('password/update', 'PasswordController@updatePassword');
$api->post('account/edit', 'AccountController@edit');
$api->get('account/recharge', 'PaymentController@getRechargeData');
$api->post('account/cert/car', 'AccountController@certCar');
$api->post('account/cert/truck', 'AccountController@certTruck');
$api->post('account/cert/chauffeur', 'AccountController@certChauffeur');
$api->post('account/cert/shop', 'AccountController@certShop');
$api->post('account/cert/journey', 'AccountController@certJourney');
$api->post('account/shop/edit', 'AccountController@editShop');
$api->get('account/credit', 'AccountController@credit');
$api->get('account/balance', 'AccountController@balance');
$api->post('shop/code', 'ShopController@code');
$api->post('journey/publish', 'JourneyController@publish');
});
}); | 47.569832 | 102 | 0.684087 |
6446bc482ec55dab0d90806046e08df12602a772 | 2,508 | rs | Rust | clients/rust/generated/src/models/list_view.rs | PankTrue/swaggy-jenkins | aca35a7cca6e1fcc08bd399e05148942ac2f514b | [
"MIT"
] | 23 | 2017-08-01T12:25:26.000Z | 2022-01-25T03:44:11.000Z | clients/rust/generated/src/models/list_view.rs | PankTrue/swaggy-jenkins | aca35a7cca6e1fcc08bd399e05148942ac2f514b | [
"MIT"
] | 35 | 2017-06-14T03:28:15.000Z | 2022-02-14T10:25:54.000Z | clients/rust/generated/src/models/list_view.rs | PankTrue/swaggy-jenkins | aca35a7cca6e1fcc08bd399e05148942ac2f514b | [
"MIT"
] | 11 | 2017-08-31T19:00:20.000Z | 2021-12-19T12:04:12.000Z | /*
* Swaggy Jenkins
*
* Jenkins API clients generated from Swagger / Open API specification
*
* OpenAPI spec version: 1.1.1
* Contact: blah@cliffano.com
* Generated by: https://openapi-generator.tech
*/
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct ListView {
#[serde(rename = "_class")]
_class: Option<String>,
#[serde(rename = "description")]
description: Option<String>,
#[serde(rename = "jobs")]
jobs: Option<Vec<::models::FreeStyleProject>>,
#[serde(rename = "name")]
name: Option<String>,
#[serde(rename = "url")]
url: Option<String>
}
impl ListView {
pub fn new() -> ListView {
ListView {
_class: None,
description: None,
jobs: None,
name: None,
url: None
}
}
pub fn set__class(&mut self, _class: String) {
self._class = Some(_class);
}
pub fn with__class(mut self, _class: String) -> ListView {
self._class = Some(_class);
self
}
pub fn _class(&self) -> Option<&String> {
self._class.as_ref()
}
pub fn reset__class(&mut self) {
self._class = None;
}
pub fn set_description(&mut self, description: String) {
self.description = Some(description);
}
pub fn with_description(mut self, description: String) -> ListView {
self.description = Some(description);
self
}
pub fn description(&self) -> Option<&String> {
self.description.as_ref()
}
pub fn reset_description(&mut self) {
self.description = None;
}
pub fn set_jobs(&mut self, jobs: Vec<::models::FreeStyleProject>) {
self.jobs = Some(jobs);
}
pub fn with_jobs(mut self, jobs: Vec<::models::FreeStyleProject>) -> ListView {
self.jobs = Some(jobs);
self
}
pub fn jobs(&self) -> Option<&Vec<::models::FreeStyleProject>> {
self.jobs.as_ref()
}
pub fn reset_jobs(&mut self) {
self.jobs = None;
}
pub fn set_name(&mut self, name: String) {
self.name = Some(name);
}
pub fn with_name(mut self, name: String) -> ListView {
self.name = Some(name);
self
}
pub fn name(&self) -> Option<&String> {
self.name.as_ref()
}
pub fn reset_name(&mut self) {
self.name = None;
}
pub fn set_url(&mut self, url: String) {
self.url = Some(url);
}
pub fn with_url(mut self, url: String) -> ListView {
self.url = Some(url);
self
}
pub fn url(&self) -> Option<&String> {
self.url.as_ref()
}
pub fn reset_url(&mut self) {
self.url = None;
}
}
| 19.44186 | 81 | 0.618421 |
452cc36935904e569ecbccd6a207ec6f06cba13f | 6,298 | swift | Swift | DouYuZB/Classes/Home/ViewModel/RZZRecommendViewModel.swift | rzz09517001/dYZB | 11dc4fd06e75e67fbecb0d814aa737256f231c98 | [
"MIT"
] | null | null | null | DouYuZB/Classes/Home/ViewModel/RZZRecommendViewModel.swift | rzz09517001/dYZB | 11dc4fd06e75e67fbecb0d814aa737256f231c98 | [
"MIT"
] | null | null | null | DouYuZB/Classes/Home/ViewModel/RZZRecommendViewModel.swift | rzz09517001/dYZB | 11dc4fd06e75e67fbecb0d814aa737256f231c98 | [
"MIT"
] | null | null | null | //
// RZZRecommendViewModel.swift
// DouYuZB
//
// Created by 任志忠 on 2019/1/5.
// Copyright © 2019 rzz. All rights reserved.
//
import UIKit
class RZZRecommendViewModel : RZZBaseViewModel{
private lazy var firstGroup : RZZAchorGroup = RZZAchorGroup()
private lazy var secondGroup : RZZAchorGroup = RZZAchorGroup()
lazy var cycleModels : [RZZCycleModel] = [RZZCycleModel]()
}
extension RZZRecommendViewModel {
//请求推荐数据
func requestData(finishCallBack:@escaping () -> ()) {
let dGroup = DispatchGroup()
//1.请求推荐数据
let firstData : [String : Any] = ["error" : 0, "data" :[
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311]
]
]
dGroup.enter()
RZZNetWorkTools.requestDta(urlString: "https://apiv2.douyucdn.cn/mgapi/livenc/home/getRecCardList", method: .GET, parameters: ["client_sys" : "ios", "limit" : "10", "offset" : "0"]) { (result) in
guard let dataArray = firstData["data"] as? [[String : NSObject]] else { return }
self.firstGroup.icon_name = "home_header_hot"
self.firstGroup.tag_name = "热门"
for dic in dataArray {
let anchor = RZZAnchorModel.init(dic: dic)
self.firstGroup.anchors.append(anchor)
}
dGroup.leave()
}
//2.请求颜值数据
let secondData : [String : Any] = ["error" : 0, "data" :[
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311],
["room_id" : 19002,
"vertical_src" : "https://rpic.douyucdn.cn/asrpic/190105/19002_1731.jpg/dy1",
"is_vertical" : 0,
"room_name" : "DOTA2好汉杯淘汰赛",
"nickname" : "imbadota2频道",
"online" : 232311]
]
]
dGroup.enter()
RZZNetWorkTools.requestDta(urlString: "https://apiv2.douyucdn.cn/mgapi/livenc/home/getRecCardList", method: .GET, parameters: ["client_sys" : "ios", "limit" : "10", "offset" : "0"]) { (result) in
guard let dataArray = secondData["data"] as? [[String : NSObject]] else { return }
self.secondGroup.icon_name = "home_header_normal"
self.secondGroup.tag_name = "颜值"
for dic in dataArray {
let anchor = RZZAnchorModel.init(dic: dic)
self.secondGroup.anchors.append(anchor)
}
dGroup.leave()
}
//3.请求后面部分的数据
dGroup.enter()
loadAnchorData(URLString: "https://apiv2.douyucdn.cn/mgapi/livenc/home/getRecCardList", parameters: ["client_sys" : "ios", "limit" : "10", "offset" : "0"]) {
dGroup.leave()
}
dGroup.notify(queue: DispatchQueue.main) {
self.anchorGroups.insert(self.secondGroup, at: 0)
self.anchorGroups.insert(self.firstGroup, at: 0)
finishCallBack()
}
}
//请求无限轮播数据
func requestCycleData(finishCallBack: @escaping () -> ()) {
RZZNetWorkTools.requestDta(urlString: "https://apiv3.douyucdn.cn/mgapi/live/mhome/getSlidesRec?client_sys=ios", method: .GET) { (result) in
guard let resultDict = result as? [String : NSObject] else { return }
guard let dataArray = resultDict["data"] as? [[String : NSObject]] else { return }
for dict in dataArray {
self.cycleModels.append(RZZCycleModel(dict: dict))
}
finishCallBack()
}
}
}
| 42.268456 | 203 | 0.539854 |
423604638847fc5a2c4cee348c55d8875cafcfe8 | 119,292 | dart | Dart | lib/src/tdapi/tdapi.dart | anggaaryas/tdlib | 410e2621a61f897ba9f90232133af0ea3aa1532a | [
"BSD-3-Clause"
] | 20 | 2017-01-06T01:04:26.000Z | 2019-04-09T08:15:34.000Z | lib/src/tdapi/tdapi.dart | anggaaryas/tdlib | 410e2621a61f897ba9f90232133af0ea3aa1532a | [
"BSD-3-Clause"
] | null | null | null | lib/src/tdapi/tdapi.dart | anggaaryas/tdlib | 410e2621a61f897ba9f90232133af0ea3aa1532a | [
"BSD-3-Clause"
] | null | null | null | import 'dart:convert' show json;
part 'object.dart';
part 'function.dart';
part 'objects/error.dart';
part 'objects/ok.dart';
part 'objects/tdlib_parameters.dart';
part 'objects/authentication_code_type.dart';
part 'objects/authentication_code_info.dart';
part 'objects/email_address_authentication_code_info.dart';
part 'objects/text_entity.dart';
part 'objects/text_entities.dart';
part 'objects/formatted_text.dart';
part 'objects/terms_of_service.dart';
part 'objects/authorization_state.dart';
part 'objects/password_state.dart';
part 'objects/recovery_email_address.dart';
part 'objects/temporary_password_state.dart';
part 'objects/local_file.dart';
part 'objects/remote_file.dart';
part 'objects/file.dart';
part 'objects/input_file.dart';
part 'objects/photo_size.dart';
part 'objects/minithumbnail.dart';
part 'objects/thumbnail_format.dart';
part 'objects/thumbnail.dart';
part 'objects/mask_point.dart';
part 'objects/mask_position.dart';
part 'objects/closed_vector_path.dart';
part 'objects/poll_option.dart';
part 'objects/poll_type.dart';
part 'objects/animation.dart';
part 'objects/audio.dart';
part 'objects/document.dart';
part 'objects/photo.dart';
part 'objects/sticker.dart';
part 'objects/video.dart';
part 'objects/video_note.dart';
part 'objects/voice_note.dart';
part 'objects/animated_emoji.dart';
part 'objects/contact.dart';
part 'objects/location.dart';
part 'objects/venue.dart';
part 'objects/game.dart';
part 'objects/poll.dart';
part 'objects/profile_photo.dart';
part 'objects/chat_photo_info.dart';
part 'objects/user_type.dart';
part 'objects/bot_command.dart';
part 'objects/bot_commands.dart';
part 'objects/chat_location.dart';
part 'objects/animated_chat_photo.dart';
part 'objects/chat_photo.dart';
part 'objects/chat_photos.dart';
part 'objects/input_chat_photo.dart';
part 'objects/user.dart';
part 'objects/user_full_info.dart';
part 'objects/users.dart';
part 'objects/chat_administrator.dart';
part 'objects/chat_administrators.dart';
part 'objects/chat_permissions.dart';
part 'objects/chat_member_status.dart';
part 'objects/chat_member.dart';
part 'objects/chat_members.dart';
part 'objects/chat_members_filter.dart';
part 'objects/supergroup_members_filter.dart';
part 'objects/chat_invite_link.dart';
part 'objects/chat_invite_links.dart';
part 'objects/chat_invite_link_count.dart';
part 'objects/chat_invite_link_counts.dart';
part 'objects/chat_invite_link_member.dart';
part 'objects/chat_invite_link_members.dart';
part 'objects/chat_invite_link_info.dart';
part 'objects/chat_join_request.dart';
part 'objects/chat_join_requests.dart';
part 'objects/chat_join_requests_info.dart';
part 'objects/basic_group.dart';
part 'objects/basic_group_full_info.dart';
part 'objects/supergroup.dart';
part 'objects/supergroup_full_info.dart';
part 'objects/secret_chat_state.dart';
part 'objects/secret_chat.dart';
part 'objects/message_sender.dart';
part 'objects/message_senders.dart';
part 'objects/message_forward_origin.dart';
part 'objects/message_forward_info.dart';
part 'objects/message_reply_info.dart';
part 'objects/message_interaction_info.dart';
part 'objects/message_sending_state.dart';
part 'objects/message.dart';
part 'objects/messages.dart';
part 'objects/found_messages.dart';
part 'objects/message_position.dart';
part 'objects/message_positions.dart';
part 'objects/message_calendar_day.dart';
part 'objects/message_calendar.dart';
part 'objects/sponsored_message.dart';
part 'objects/notification_settings_scope.dart';
part 'objects/chat_notification_settings.dart';
part 'objects/scope_notification_settings.dart';
part 'objects/draft_message.dart';
part 'objects/chat_type.dart';
part 'objects/chat_filter.dart';
part 'objects/chat_filter_info.dart';
part 'objects/recommended_chat_filter.dart';
part 'objects/recommended_chat_filters.dart';
part 'objects/chat_list.dart';
part 'objects/chat_lists.dart';
part 'objects/chat_source.dart';
part 'objects/chat_position.dart';
part 'objects/video_chat.dart';
part 'objects/chat.dart';
part 'objects/chats.dart';
part 'objects/chat_nearby.dart';
part 'objects/chats_nearby.dart';
part 'objects/public_chat_type.dart';
part 'objects/chat_action_bar.dart';
part 'objects/keyboard_button_type.dart';
part 'objects/keyboard_button.dart';
part 'objects/inline_keyboard_button_type.dart';
part 'objects/inline_keyboard_button.dart';
part 'objects/reply_markup.dart';
part 'objects/login_url_info.dart';
part 'objects/message_thread_info.dart';
part 'objects/rich_text.dart';
part 'objects/page_block_caption.dart';
part 'objects/page_block_list_item.dart';
part 'objects/page_block_horizontal_alignment.dart';
part 'objects/page_block_vertical_alignment.dart';
part 'objects/page_block_table_cell.dart';
part 'objects/page_block_related_article.dart';
part 'objects/page_block.dart';
part 'objects/web_page_instant_view.dart';
part 'objects/web_page.dart';
part 'objects/country_info.dart';
part 'objects/countries.dart';
part 'objects/phone_number_info.dart';
part 'objects/bank_card_action_open_url.dart';
part 'objects/bank_card_info.dart';
part 'objects/address.dart';
part 'objects/labeled_price_part.dart';
part 'objects/invoice.dart';
part 'objects/order_info.dart';
part 'objects/shipping_option.dart';
part 'objects/saved_credentials.dart';
part 'objects/input_credentials.dart';
part 'objects/payments_provider_stripe.dart';
part 'objects/payment_form_theme.dart';
part 'objects/payment_form.dart';
part 'objects/validated_order_info.dart';
part 'objects/payment_result.dart';
part 'objects/payment_receipt.dart';
part 'objects/dated_file.dart';
part 'objects/passport_element_type.dart';
part 'objects/date.dart';
part 'objects/personal_details.dart';
part 'objects/identity_document.dart';
part 'objects/input_identity_document.dart';
part 'objects/personal_document.dart';
part 'objects/input_personal_document.dart';
part 'objects/passport_element.dart';
part 'objects/input_passport_element.dart';
part 'objects/passport_elements.dart';
part 'objects/passport_element_error_source.dart';
part 'objects/passport_element_error.dart';
part 'objects/passport_suitable_element.dart';
part 'objects/passport_required_element.dart';
part 'objects/passport_authorization_form.dart';
part 'objects/passport_elements_with_errors.dart';
part 'objects/encrypted_credentials.dart';
part 'objects/encrypted_passport_element.dart';
part 'objects/input_passport_element_error_source.dart';
part 'objects/input_passport_element_error.dart';
part 'objects/message_content.dart';
part 'objects/text_entity_type.dart';
part 'objects/input_thumbnail.dart';
part 'objects/message_scheduling_state.dart';
part 'objects/message_send_options.dart';
part 'objects/message_copy_options.dart';
part 'objects/input_message_content.dart';
part 'objects/search_messages_filter.dart';
part 'objects/chat_action.dart';
part 'objects/user_status.dart';
part 'objects/stickers.dart';
part 'objects/emojis.dart';
part 'objects/sticker_set.dart';
part 'objects/sticker_set_info.dart';
part 'objects/sticker_sets.dart';
part 'objects/call_discard_reason.dart';
part 'objects/call_protocol.dart';
part 'objects/call_server_type.dart';
part 'objects/call_server.dart';
part 'objects/call_id.dart';
part 'objects/group_call_id.dart';
part 'objects/call_state.dart';
part 'objects/group_call_video_quality.dart';
part 'objects/group_call_recent_speaker.dart';
part 'objects/group_call.dart';
part 'objects/group_call_video_source_group.dart';
part 'objects/group_call_participant_video_info.dart';
part 'objects/group_call_participant.dart';
part 'objects/call_problem.dart';
part 'objects/call.dart';
part 'objects/phone_number_authentication_settings.dart';
part 'objects/animations.dart';
part 'objects/dice_stickers.dart';
part 'objects/imported_contacts.dart';
part 'objects/http_url.dart';
part 'objects/input_inline_query_result.dart';
part 'objects/inline_query_result.dart';
part 'objects/inline_query_results.dart';
part 'objects/callback_query_payload.dart';
part 'objects/callback_query_answer.dart';
part 'objects/custom_request_result.dart';
part 'objects/game_high_score.dart';
part 'objects/game_high_scores.dart';
part 'objects/chat_event_action.dart';
part 'objects/chat_event.dart';
part 'objects/chat_events.dart';
part 'objects/chat_event_log_filters.dart';
part 'objects/language_pack_string_value.dart';
part 'objects/language_pack_string.dart';
part 'objects/language_pack_strings.dart';
part 'objects/language_pack_info.dart';
part 'objects/localization_target_info.dart';
part 'objects/device_token.dart';
part 'objects/push_receiver_id.dart';
part 'objects/background_fill.dart';
part 'objects/background_type.dart';
part 'objects/background.dart';
part 'objects/backgrounds.dart';
part 'objects/input_background.dart';
part 'objects/theme_settings.dart';
part 'objects/chat_theme.dart';
part 'objects/hashtags.dart';
part 'objects/can_transfer_ownership_result.dart';
part 'objects/check_chat_username_result.dart';
part 'objects/check_sticker_set_name_result.dart';
part 'objects/reset_password_result.dart';
part 'objects/message_file_type.dart';
part 'objects/push_message_content.dart';
part 'objects/notification_type.dart';
part 'objects/notification_group_type.dart';
part 'objects/notification.dart';
part 'objects/notification_group.dart';
part 'objects/option_value.dart';
part 'objects/json_object_member.dart';
part 'objects/json_value.dart';
part 'objects/user_privacy_setting_rule.dart';
part 'objects/user_privacy_setting_rules.dart';
part 'objects/user_privacy_setting.dart';
part 'objects/account_ttl.dart';
part 'objects/session.dart';
part 'objects/sessions.dart';
part 'objects/connected_website.dart';
part 'objects/connected_websites.dart';
part 'objects/chat_report_reason.dart';
part 'objects/internal_link_type.dart';
part 'objects/message_link.dart';
part 'objects/message_link_info.dart';
part 'objects/file_part.dart';
part 'objects/file_type.dart';
part 'objects/storage_statistics_by_file_type.dart';
part 'objects/storage_statistics_by_chat.dart';
part 'objects/storage_statistics.dart';
part 'objects/storage_statistics_fast.dart';
part 'objects/database_statistics.dart';
part 'objects/network_type.dart';
part 'objects/network_statistics_entry.dart';
part 'objects/network_statistics.dart';
part 'objects/auto_download_settings.dart';
part 'objects/auto_download_settings_presets.dart';
part 'objects/connection_state.dart';
part 'objects/top_chat_category.dart';
part 'objects/t_me_url_type.dart';
part 'objects/t_me_url.dart';
part 'objects/t_me_urls.dart';
part 'objects/suggested_action.dart';
part 'objects/count.dart';
part 'objects/text.dart';
part 'objects/seconds.dart';
part 'objects/deep_link_info.dart';
part 'objects/text_parse_mode.dart';
part 'objects/proxy_type.dart';
part 'objects/proxy.dart';
part 'objects/proxies.dart';
part 'objects/input_sticker.dart';
part 'objects/date_range.dart';
part 'objects/statistical_value.dart';
part 'objects/statistical_graph.dart';
part 'objects/chat_statistics_message_interaction_info.dart';
part 'objects/chat_statistics_message_sender_info.dart';
part 'objects/chat_statistics_administrator_actions_info.dart';
part 'objects/chat_statistics_inviter_info.dart';
part 'objects/chat_statistics.dart';
part 'objects/message_statistics.dart';
part 'objects/point.dart';
part 'objects/vector_path_command.dart';
part 'objects/bot_command_scope.dart';
part 'objects/update.dart';
part 'objects/updates.dart';
part 'objects/log_stream.dart';
part 'objects/log_verbosity_level.dart';
part 'objects/log_tags.dart';
part 'objects/test_int.dart';
part 'objects/test_string.dart';
part 'objects/test_bytes.dart';
part 'objects/test_vector_int.dart';
part 'objects/test_vector_int_object.dart';
part 'objects/test_vector_string.dart';
part 'objects/test_vector_string_object.dart';
part 'functions/get_authorization_state.dart';
part 'functions/set_tdlib_parameters.dart';
part 'functions/check_database_encryption_key.dart';
part 'functions/set_authentication_phone_number.dart';
part 'functions/resend_authentication_code.dart';
part 'functions/check_authentication_code.dart';
part 'functions/request_qr_code_authentication.dart';
part 'functions/register_user.dart';
part 'functions/check_authentication_password.dart';
part 'functions/request_authentication_password_recovery.dart';
part 'functions/check_authentication_password_recovery_code.dart';
part 'functions/recover_authentication_password.dart';
part 'functions/check_authentication_bot_token.dart';
part 'functions/log_out.dart';
part 'functions/close.dart';
part 'functions/destroy.dart';
part 'functions/confirm_qr_code_authentication.dart';
part 'functions/get_current_state.dart';
part 'functions/set_database_encryption_key.dart';
part 'functions/get_password_state.dart';
part 'functions/set_password.dart';
part 'functions/get_recovery_email_address.dart';
part 'functions/set_recovery_email_address.dart';
part 'functions/check_recovery_email_address_code.dart';
part 'functions/resend_recovery_email_address_code.dart';
part 'functions/request_password_recovery.dart';
part 'functions/check_password_recovery_code.dart';
part 'functions/recover_password.dart';
part 'functions/reset_password.dart';
part 'functions/cancel_password_reset.dart';
part 'functions/create_temporary_password.dart';
part 'functions/get_temporary_password_state.dart';
part 'functions/get_me.dart';
part 'functions/get_user.dart';
part 'functions/get_user_full_info.dart';
part 'functions/get_basic_group.dart';
part 'functions/get_basic_group_full_info.dart';
part 'functions/get_supergroup.dart';
part 'functions/get_supergroup_full_info.dart';
part 'functions/get_secret_chat.dart';
part 'functions/get_chat.dart';
part 'functions/get_message.dart';
part 'functions/get_message_locally.dart';
part 'functions/get_replied_message.dart';
part 'functions/get_chat_pinned_message.dart';
part 'functions/get_callback_query_message.dart';
part 'functions/get_messages.dart';
part 'functions/get_message_thread.dart';
part 'functions/get_message_viewers.dart';
part 'functions/get_file.dart';
part 'functions/get_remote_file.dart';
part 'functions/load_chats.dart';
part 'functions/get_chats.dart';
part 'functions/search_public_chat.dart';
part 'functions/search_public_chats.dart';
part 'functions/search_chats.dart';
part 'functions/search_chats_on_server.dart';
part 'functions/search_chats_nearby.dart';
part 'functions/get_top_chats.dart';
part 'functions/remove_top_chat.dart';
part 'functions/add_recently_found_chat.dart';
part 'functions/remove_recently_found_chat.dart';
part 'functions/clear_recently_found_chats.dart';
part 'functions/get_recently_opened_chats.dart';
part 'functions/check_chat_username.dart';
part 'functions/get_created_public_chats.dart';
part 'functions/check_created_public_chats_limit.dart';
part 'functions/get_suitable_discussion_chats.dart';
part 'functions/get_inactive_supergroup_chats.dart';
part 'functions/get_groups_in_common.dart';
part 'functions/get_chat_history.dart';
part 'functions/get_message_thread_history.dart';
part 'functions/delete_chat_history.dart';
part 'functions/delete_chat.dart';
part 'functions/search_chat_messages.dart';
part 'functions/search_messages.dart';
part 'functions/search_secret_messages.dart';
part 'functions/search_call_messages.dart';
part 'functions/delete_all_call_messages.dart';
part 'functions/search_chat_recent_location_messages.dart';
part 'functions/get_active_live_location_messages.dart';
part 'functions/get_chat_message_by_date.dart';
part 'functions/get_chat_sparse_message_positions.dart';
part 'functions/get_chat_message_calendar.dart';
part 'functions/get_chat_message_count.dart';
part 'functions/get_chat_scheduled_messages.dart';
part 'functions/get_message_public_forwards.dart';
part 'functions/get_chat_sponsored_message.dart';
part 'functions/remove_notification.dart';
part 'functions/remove_notification_group.dart';
part 'functions/get_message_link.dart';
part 'functions/get_message_embedding_code.dart';
part 'functions/get_message_link_info.dart';
part 'functions/get_chat_available_message_senders.dart';
part 'functions/set_chat_message_sender.dart';
part 'functions/send_message.dart';
part 'functions/send_message_album.dart';
part 'functions/send_bot_start_message.dart';
part 'functions/send_inline_query_result_message.dart';
part 'functions/forward_messages.dart';
part 'functions/resend_messages.dart';
part 'functions/send_chat_screenshot_taken_notification.dart';
part 'functions/add_local_message.dart';
part 'functions/delete_messages.dart';
part 'functions/delete_chat_messages_by_sender.dart';
part 'functions/delete_chat_messages_by_date.dart';
part 'functions/edit_message_text.dart';
part 'functions/edit_message_live_location.dart';
part 'functions/edit_message_media.dart';
part 'functions/edit_message_caption.dart';
part 'functions/edit_message_reply_markup.dart';
part 'functions/edit_inline_message_text.dart';
part 'functions/edit_inline_message_live_location.dart';
part 'functions/edit_inline_message_media.dart';
part 'functions/edit_inline_message_caption.dart';
part 'functions/edit_inline_message_reply_markup.dart';
part 'functions/edit_message_scheduling_state.dart';
part 'functions/get_text_entities.dart';
part 'functions/parse_text_entities.dart';
part 'functions/parse_markdown.dart';
part 'functions/get_markdown_text.dart';
part 'functions/get_file_mime_type.dart';
part 'functions/get_file_extension.dart';
part 'functions/clean_file_name.dart';
part 'functions/get_language_pack_string.dart';
part 'functions/get_json_value.dart';
part 'functions/get_json_string.dart';
part 'functions/set_poll_answer.dart';
part 'functions/get_poll_voters.dart';
part 'functions/stop_poll.dart';
part 'functions/hide_suggested_action.dart';
part 'functions/get_login_url_info.dart';
part 'functions/get_login_url.dart';
part 'functions/get_inline_query_results.dart';
part 'functions/answer_inline_query.dart';
part 'functions/get_callback_query_answer.dart';
part 'functions/answer_callback_query.dart';
part 'functions/answer_shipping_query.dart';
part 'functions/answer_pre_checkout_query.dart';
part 'functions/set_game_score.dart';
part 'functions/set_inline_game_score.dart';
part 'functions/get_game_high_scores.dart';
part 'functions/get_inline_game_high_scores.dart';
part 'functions/delete_chat_reply_markup.dart';
part 'functions/send_chat_action.dart';
part 'functions/open_chat.dart';
part 'functions/close_chat.dart';
part 'functions/view_messages.dart';
part 'functions/open_message_content.dart';
part 'functions/click_animated_emoji_message.dart';
part 'functions/get_internal_link_type.dart';
part 'functions/get_external_link_info.dart';
part 'functions/get_external_link.dart';
part 'functions/read_all_chat_mentions.dart';
part 'functions/create_private_chat.dart';
part 'functions/create_basic_group_chat.dart';
part 'functions/create_supergroup_chat.dart';
part 'functions/create_secret_chat.dart';
part 'functions/create_new_basic_group_chat.dart';
part 'functions/create_new_supergroup_chat.dart';
part 'functions/create_new_secret_chat.dart';
part 'functions/upgrade_basic_group_chat_to_supergroup_chat.dart';
part 'functions/get_chat_lists_to_add_chat.dart';
part 'functions/add_chat_to_list.dart';
part 'functions/get_chat_filter.dart';
part 'functions/create_chat_filter.dart';
part 'functions/edit_chat_filter.dart';
part 'functions/delete_chat_filter.dart';
part 'functions/reorder_chat_filters.dart';
part 'functions/get_recommended_chat_filters.dart';
part 'functions/get_chat_filter_default_icon_name.dart';
part 'functions/set_chat_title.dart';
part 'functions/set_chat_photo.dart';
part 'functions/set_chat_message_ttl.dart';
part 'functions/set_chat_permissions.dart';
part 'functions/set_chat_theme.dart';
part 'functions/set_chat_draft_message.dart';
part 'functions/set_chat_notification_settings.dart';
part 'functions/toggle_chat_has_protected_content.dart';
part 'functions/toggle_chat_is_marked_as_unread.dart';
part 'functions/toggle_chat_default_disable_notification.dart';
part 'functions/set_chat_client_data.dart';
part 'functions/set_chat_description.dart';
part 'functions/set_chat_discussion_group.dart';
part 'functions/set_chat_location.dart';
part 'functions/set_chat_slow_mode_delay.dart';
part 'functions/pin_chat_message.dart';
part 'functions/unpin_chat_message.dart';
part 'functions/unpin_all_chat_messages.dart';
part 'functions/join_chat.dart';
part 'functions/leave_chat.dart';
part 'functions/add_chat_member.dart';
part 'functions/add_chat_members.dart';
part 'functions/set_chat_member_status.dart';
part 'functions/ban_chat_member.dart';
part 'functions/can_transfer_ownership.dart';
part 'functions/transfer_chat_ownership.dart';
part 'functions/get_chat_member.dart';
part 'functions/search_chat_members.dart';
part 'functions/get_chat_administrators.dart';
part 'functions/clear_all_draft_messages.dart';
part 'functions/get_chat_notification_settings_exceptions.dart';
part 'functions/get_scope_notification_settings.dart';
part 'functions/set_scope_notification_settings.dart';
part 'functions/reset_all_notification_settings.dart';
part 'functions/toggle_chat_is_pinned.dart';
part 'functions/set_pinned_chats.dart';
part 'functions/download_file.dart';
part 'functions/get_file_downloaded_prefix_size.dart';
part 'functions/cancel_download_file.dart';
part 'functions/get_suggested_file_name.dart';
part 'functions/upload_file.dart';
part 'functions/cancel_upload_file.dart';
part 'functions/write_generated_file_part.dart';
part 'functions/set_file_generation_progress.dart';
part 'functions/finish_file_generation.dart';
part 'functions/read_file_part.dart';
part 'functions/delete_file.dart';
part 'functions/get_message_file_type.dart';
part 'functions/get_message_import_confirmation_text.dart';
part 'functions/import_messages.dart';
part 'functions/replace_primary_chat_invite_link.dart';
part 'functions/create_chat_invite_link.dart';
part 'functions/edit_chat_invite_link.dart';
part 'functions/get_chat_invite_link.dart';
part 'functions/get_chat_invite_link_counts.dart';
part 'functions/get_chat_invite_links.dart';
part 'functions/get_chat_invite_link_members.dart';
part 'functions/revoke_chat_invite_link.dart';
part 'functions/delete_revoked_chat_invite_link.dart';
part 'functions/delete_all_revoked_chat_invite_links.dart';
part 'functions/check_chat_invite_link.dart';
part 'functions/join_chat_by_invite_link.dart';
part 'functions/get_chat_join_requests.dart';
part 'functions/process_chat_join_request.dart';
part 'functions/process_chat_join_requests.dart';
part 'functions/create_call.dart';
part 'functions/accept_call.dart';
part 'functions/send_call_signaling_data.dart';
part 'functions/discard_call.dart';
part 'functions/send_call_rating.dart';
part 'functions/send_call_debug_information.dart';
part 'functions/get_video_chat_available_participants.dart';
part 'functions/set_video_chat_default_participant.dart';
part 'functions/create_video_chat.dart';
part 'functions/get_group_call.dart';
part 'functions/start_scheduled_group_call.dart';
part 'functions/toggle_group_call_enabled_start_notification.dart';
part 'functions/join_group_call.dart';
part 'functions/start_group_call_screen_sharing.dart';
part 'functions/toggle_group_call_screen_sharing_is_paused.dart';
part 'functions/end_group_call_screen_sharing.dart';
part 'functions/set_group_call_title.dart';
part 'functions/toggle_group_call_mute_new_participants.dart';
part 'functions/invite_group_call_participants.dart';
part 'functions/get_group_call_invite_link.dart';
part 'functions/revoke_group_call_invite_link.dart';
part 'functions/start_group_call_recording.dart';
part 'functions/end_group_call_recording.dart';
part 'functions/toggle_group_call_is_my_video_paused.dart';
part 'functions/toggle_group_call_is_my_video_enabled.dart';
part 'functions/set_group_call_participant_is_speaking.dart';
part 'functions/toggle_group_call_participant_is_muted.dart';
part 'functions/set_group_call_participant_volume_level.dart';
part 'functions/toggle_group_call_participant_is_hand_raised.dart';
part 'functions/load_group_call_participants.dart';
part 'functions/leave_group_call.dart';
part 'functions/end_group_call.dart';
part 'functions/get_group_call_stream_segment.dart';
part 'functions/toggle_message_sender_is_blocked.dart';
part 'functions/block_message_sender_from_replies.dart';
part 'functions/get_blocked_message_senders.dart';
part 'functions/add_contact.dart';
part 'functions/import_contacts.dart';
part 'functions/get_contacts.dart';
part 'functions/search_contacts.dart';
part 'functions/remove_contacts.dart';
part 'functions/get_imported_contact_count.dart';
part 'functions/change_imported_contacts.dart';
part 'functions/clear_imported_contacts.dart';
part 'functions/share_phone_number.dart';
part 'functions/get_user_profile_photos.dart';
part 'functions/get_stickers.dart';
part 'functions/search_stickers.dart';
part 'functions/get_installed_sticker_sets.dart';
part 'functions/get_archived_sticker_sets.dart';
part 'functions/get_trending_sticker_sets.dart';
part 'functions/get_attached_sticker_sets.dart';
part 'functions/get_sticker_set.dart';
part 'functions/search_sticker_set.dart';
part 'functions/search_installed_sticker_sets.dart';
part 'functions/search_sticker_sets.dart';
part 'functions/change_sticker_set.dart';
part 'functions/view_trending_sticker_sets.dart';
part 'functions/reorder_installed_sticker_sets.dart';
part 'functions/get_recent_stickers.dart';
part 'functions/add_recent_sticker.dart';
part 'functions/remove_recent_sticker.dart';
part 'functions/clear_recent_stickers.dart';
part 'functions/get_favorite_stickers.dart';
part 'functions/add_favorite_sticker.dart';
part 'functions/remove_favorite_sticker.dart';
part 'functions/get_sticker_emojis.dart';
part 'functions/search_emojis.dart';
part 'functions/get_animated_emoji.dart';
part 'functions/get_emoji_suggestions_url.dart';
part 'functions/get_saved_animations.dart';
part 'functions/add_saved_animation.dart';
part 'functions/remove_saved_animation.dart';
part 'functions/get_recent_inline_bots.dart';
part 'functions/search_hashtags.dart';
part 'functions/remove_recent_hashtag.dart';
part 'functions/get_web_page_preview.dart';
part 'functions/get_web_page_instant_view.dart';
part 'functions/set_profile_photo.dart';
part 'functions/delete_profile_photo.dart';
part 'functions/set_name.dart';
part 'functions/set_bio.dart';
part 'functions/set_username.dart';
part 'functions/set_location.dart';
part 'functions/change_phone_number.dart';
part 'functions/resend_change_phone_number_code.dart';
part 'functions/check_change_phone_number_code.dart';
part 'functions/set_commands.dart';
part 'functions/delete_commands.dart';
part 'functions/get_commands.dart';
part 'functions/get_active_sessions.dart';
part 'functions/terminate_session.dart';
part 'functions/terminate_all_other_sessions.dart';
part 'functions/toggle_session_can_accept_calls.dart';
part 'functions/toggle_session_can_accept_secret_chats.dart';
part 'functions/set_inactive_session_ttl.dart';
part 'functions/get_connected_websites.dart';
part 'functions/disconnect_website.dart';
part 'functions/disconnect_all_websites.dart';
part 'functions/set_supergroup_username.dart';
part 'functions/set_supergroup_sticker_set.dart';
part 'functions/toggle_supergroup_sign_messages.dart';
part 'functions/toggle_supergroup_is_all_history_available.dart';
part 'functions/toggle_supergroup_is_broadcast_group.dart';
part 'functions/report_supergroup_spam.dart';
part 'functions/get_supergroup_members.dart';
part 'functions/close_secret_chat.dart';
part 'functions/get_chat_event_log.dart';
part 'functions/get_payment_form.dart';
part 'functions/validate_order_info.dart';
part 'functions/send_payment_form.dart';
part 'functions/get_payment_receipt.dart';
part 'functions/get_saved_order_info.dart';
part 'functions/delete_saved_order_info.dart';
part 'functions/delete_saved_credentials.dart';
part 'functions/get_support_user.dart';
part 'functions/get_backgrounds.dart';
part 'functions/get_background_url.dart';
part 'functions/search_background.dart';
part 'functions/set_background.dart';
part 'functions/remove_background.dart';
part 'functions/reset_backgrounds.dart';
part 'functions/get_localization_target_info.dart';
part 'functions/get_language_pack_info.dart';
part 'functions/get_language_pack_strings.dart';
part 'functions/synchronize_language_pack.dart';
part 'functions/add_custom_server_language_pack.dart';
part 'functions/set_custom_language_pack.dart';
part 'functions/edit_custom_language_pack_info.dart';
part 'functions/set_custom_language_pack_string.dart';
part 'functions/delete_language_pack.dart';
part 'functions/register_device.dart';
part 'functions/process_push_notification.dart';
part 'functions/get_push_receiver_id.dart';
part 'functions/get_recently_visited_t_me_urls.dart';
part 'functions/set_user_privacy_setting_rules.dart';
part 'functions/get_user_privacy_setting_rules.dart';
part 'functions/get_option.dart';
part 'functions/set_option.dart';
part 'functions/set_account_ttl.dart';
part 'functions/get_account_ttl.dart';
part 'functions/delete_account.dart';
part 'functions/remove_chat_action_bar.dart';
part 'functions/report_chat.dart';
part 'functions/report_chat_photo.dart';
part 'functions/get_chat_statistics.dart';
part 'functions/get_message_statistics.dart';
part 'functions/get_statistical_graph.dart';
part 'functions/get_storage_statistics.dart';
part 'functions/get_storage_statistics_fast.dart';
part 'functions/get_database_statistics.dart';
part 'functions/optimize_storage.dart';
part 'functions/set_network_type.dart';
part 'functions/get_network_statistics.dart';
part 'functions/add_network_statistics.dart';
part 'functions/reset_network_statistics.dart';
part 'functions/get_auto_download_settings_presets.dart';
part 'functions/set_auto_download_settings.dart';
part 'functions/get_bank_card_info.dart';
part 'functions/get_passport_element.dart';
part 'functions/get_all_passport_elements.dart';
part 'functions/set_passport_element.dart';
part 'functions/delete_passport_element.dart';
part 'functions/set_passport_element_errors.dart';
part 'functions/get_preferred_country_language.dart';
part 'functions/send_phone_number_verification_code.dart';
part 'functions/resend_phone_number_verification_code.dart';
part 'functions/check_phone_number_verification_code.dart';
part 'functions/send_email_address_verification_code.dart';
part 'functions/resend_email_address_verification_code.dart';
part 'functions/check_email_address_verification_code.dart';
part 'functions/get_passport_authorization_form.dart';
part 'functions/get_passport_authorization_form_available_elements.dart';
part 'functions/send_passport_authorization_form.dart';
part 'functions/send_phone_number_confirmation_code.dart';
part 'functions/resend_phone_number_confirmation_code.dart';
part 'functions/check_phone_number_confirmation_code.dart';
part 'functions/set_bot_updates_status.dart';
part 'functions/upload_sticker_file.dart';
part 'functions/get_suggested_sticker_set_name.dart';
part 'functions/check_sticker_set_name.dart';
part 'functions/create_new_sticker_set.dart';
part 'functions/add_sticker_to_set.dart';
part 'functions/set_sticker_set_thumbnail.dart';
part 'functions/set_sticker_position_in_set.dart';
part 'functions/remove_sticker_from_set.dart';
part 'functions/get_map_thumbnail_file.dart';
part 'functions/accept_terms_of_service.dart';
part 'functions/send_custom_request.dart';
part 'functions/answer_custom_query.dart';
part 'functions/set_alarm.dart';
part 'functions/get_countries.dart';
part 'functions/get_country_code.dart';
part 'functions/get_phone_number_info.dart';
part 'functions/get_phone_number_info_sync.dart';
part 'functions/get_application_download_link.dart';
part 'functions/get_deep_link_info.dart';
part 'functions/get_application_config.dart';
part 'functions/save_application_log_event.dart';
part 'functions/add_proxy.dart';
part 'functions/edit_proxy.dart';
part 'functions/enable_proxy.dart';
part 'functions/disable_proxy.dart';
part 'functions/remove_proxy.dart';
part 'functions/get_proxies.dart';
part 'functions/get_proxy_link.dart';
part 'functions/ping_proxy.dart';
part 'functions/set_log_stream.dart';
part 'functions/get_log_stream.dart';
part 'functions/set_log_verbosity_level.dart';
part 'functions/get_log_verbosity_level.dart';
part 'functions/get_log_tags.dart';
part 'functions/set_log_tag_verbosity_level.dart';
part 'functions/get_log_tag_verbosity_level.dart';
part 'functions/add_log_message.dart';
part 'functions/test_call_empty.dart';
part 'functions/test_call_string.dart';
part 'functions/test_call_bytes.dart';
part 'functions/test_call_vector_int.dart';
part 'functions/test_call_vector_int_object.dart';
part 'functions/test_call_vector_string.dart';
part 'functions/test_call_vector_string_object.dart';
part 'functions/test_square_int.dart';
part 'functions/test_network.dart';
part 'functions/test_proxy.dart';
part 'functions/test_get_difference.dart';
part 'functions/test_use_update.dart';
part 'functions/test_return_error.dart';
TdObject? convertToObject(String? query) {
if (query == null) return null;
final newJson = json.decode(query);
switch (newJson['@type']) {
case 'error': return TdError.fromJson(newJson);
case 'ok': return Ok.fromJson(newJson);
case 'tdlibParameters': return TdlibParameters.fromJson(newJson);
case 'authenticationCodeType': return AuthenticationCodeType.fromJson(newJson);
case 'authenticationCodeTypeTelegramMessage': return AuthenticationCodeTypeTelegramMessage.fromJson(newJson);
case 'authenticationCodeTypeSms': return AuthenticationCodeTypeSms.fromJson(newJson);
case 'authenticationCodeTypeCall': return AuthenticationCodeTypeCall.fromJson(newJson);
case 'authenticationCodeTypeFlashCall': return AuthenticationCodeTypeFlashCall.fromJson(newJson);
case 'authenticationCodeTypeMissedCall': return AuthenticationCodeTypeMissedCall.fromJson(newJson);
case 'authenticationCodeInfo': return AuthenticationCodeInfo.fromJson(newJson);
case 'emailAddressAuthenticationCodeInfo': return EmailAddressAuthenticationCodeInfo.fromJson(newJson);
case 'textEntity': return TextEntity.fromJson(newJson);
case 'textEntities': return TextEntities.fromJson(newJson);
case 'formattedText': return FormattedText.fromJson(newJson);
case 'termsOfService': return TermsOfService.fromJson(newJson);
case 'authorizationState': return AuthorizationState.fromJson(newJson);
case 'authorizationStateWaitTdlibParameters': return AuthorizationStateWaitTdlibParameters.fromJson(newJson);
case 'authorizationStateWaitEncryptionKey': return AuthorizationStateWaitEncryptionKey.fromJson(newJson);
case 'authorizationStateWaitPhoneNumber': return AuthorizationStateWaitPhoneNumber.fromJson(newJson);
case 'authorizationStateWaitCode': return AuthorizationStateWaitCode.fromJson(newJson);
case 'authorizationStateWaitOtherDeviceConfirmation': return AuthorizationStateWaitOtherDeviceConfirmation.fromJson(newJson);
case 'authorizationStateWaitRegistration': return AuthorizationStateWaitRegistration.fromJson(newJson);
case 'authorizationStateWaitPassword': return AuthorizationStateWaitPassword.fromJson(newJson);
case 'authorizationStateReady': return AuthorizationStateReady.fromJson(newJson);
case 'authorizationStateLoggingOut': return AuthorizationStateLoggingOut.fromJson(newJson);
case 'authorizationStateClosing': return AuthorizationStateClosing.fromJson(newJson);
case 'authorizationStateClosed': return AuthorizationStateClosed.fromJson(newJson);
case 'passwordState': return PasswordState.fromJson(newJson);
case 'recoveryEmailAddress': return RecoveryEmailAddress.fromJson(newJson);
case 'temporaryPasswordState': return TemporaryPasswordState.fromJson(newJson);
case 'localFile': return LocalFile.fromJson(newJson);
case 'remoteFile': return RemoteFile.fromJson(newJson);
case 'file': return File.fromJson(newJson);
case 'inputFile': return InputFile.fromJson(newJson);
case 'inputFileId': return InputFileId.fromJson(newJson);
case 'inputFileRemote': return InputFileRemote.fromJson(newJson);
case 'inputFileLocal': return InputFileLocal.fromJson(newJson);
case 'inputFileGenerated': return InputFileGenerated.fromJson(newJson);
case 'photoSize': return PhotoSize.fromJson(newJson);
case 'minithumbnail': return Minithumbnail.fromJson(newJson);
case 'thumbnailFormat': return ThumbnailFormat.fromJson(newJson);
case 'thumbnailFormatJpeg': return ThumbnailFormatJpeg.fromJson(newJson);
case 'thumbnailFormatPng': return ThumbnailFormatPng.fromJson(newJson);
case 'thumbnailFormatWebp': return ThumbnailFormatWebp.fromJson(newJson);
case 'thumbnailFormatGif': return ThumbnailFormatGif.fromJson(newJson);
case 'thumbnailFormatTgs': return ThumbnailFormatTgs.fromJson(newJson);
case 'thumbnailFormatMpeg4': return ThumbnailFormatMpeg4.fromJson(newJson);
case 'thumbnail': return Thumbnail.fromJson(newJson);
case 'maskPoint': return MaskPoint.fromJson(newJson);
case 'maskPointForehead': return MaskPointForehead.fromJson(newJson);
case 'maskPointEyes': return MaskPointEyes.fromJson(newJson);
case 'maskPointMouth': return MaskPointMouth.fromJson(newJson);
case 'maskPointChin': return MaskPointChin.fromJson(newJson);
case 'maskPosition': return MaskPosition.fromJson(newJson);
case 'closedVectorPath': return ClosedVectorPath.fromJson(newJson);
case 'pollOption': return PollOption.fromJson(newJson);
case 'pollType': return PollType.fromJson(newJson);
case 'pollTypeRegular': return PollTypeRegular.fromJson(newJson);
case 'pollTypeQuiz': return PollTypeQuiz.fromJson(newJson);
case 'animation': return Animation.fromJson(newJson);
case 'audio': return Audio.fromJson(newJson);
case 'document': return Document.fromJson(newJson);
case 'photo': return Photo.fromJson(newJson);
case 'sticker': return Sticker.fromJson(newJson);
case 'video': return Video.fromJson(newJson);
case 'videoNote': return VideoNote.fromJson(newJson);
case 'voiceNote': return VoiceNote.fromJson(newJson);
case 'animatedEmoji': return AnimatedEmoji.fromJson(newJson);
case 'contact': return Contact.fromJson(newJson);
case 'location': return Location.fromJson(newJson);
case 'venue': return Venue.fromJson(newJson);
case 'game': return Game.fromJson(newJson);
case 'poll': return Poll.fromJson(newJson);
case 'profilePhoto': return ProfilePhoto.fromJson(newJson);
case 'chatPhotoInfo': return ChatPhotoInfo.fromJson(newJson);
case 'userType': return UserType.fromJson(newJson);
case 'userTypeRegular': return UserTypeRegular.fromJson(newJson);
case 'userTypeDeleted': return UserTypeDeleted.fromJson(newJson);
case 'userTypeBot': return UserTypeBot.fromJson(newJson);
case 'userTypeUnknown': return UserTypeUnknown.fromJson(newJson);
case 'botCommand': return BotCommand.fromJson(newJson);
case 'botCommands': return BotCommands.fromJson(newJson);
case 'chatLocation': return ChatLocation.fromJson(newJson);
case 'animatedChatPhoto': return AnimatedChatPhoto.fromJson(newJson);
case 'chatPhoto': return ChatPhoto.fromJson(newJson);
case 'chatPhotos': return ChatPhotos.fromJson(newJson);
case 'inputChatPhoto': return InputChatPhoto.fromJson(newJson);
case 'inputChatPhotoPrevious': return InputChatPhotoPrevious.fromJson(newJson);
case 'inputChatPhotoStatic': return InputChatPhotoStatic.fromJson(newJson);
case 'inputChatPhotoAnimation': return InputChatPhotoAnimation.fromJson(newJson);
case 'user': return User.fromJson(newJson);
case 'userFullInfo': return UserFullInfo.fromJson(newJson);
case 'users': return Users.fromJson(newJson);
case 'chatAdministrator': return ChatAdministrator.fromJson(newJson);
case 'chatAdministrators': return ChatAdministrators.fromJson(newJson);
case 'chatPermissions': return ChatPermissions.fromJson(newJson);
case 'chatMemberStatus': return ChatMemberStatus.fromJson(newJson);
case 'chatMemberStatusCreator': return ChatMemberStatusCreator.fromJson(newJson);
case 'chatMemberStatusAdministrator': return ChatMemberStatusAdministrator.fromJson(newJson);
case 'chatMemberStatusMember': return ChatMemberStatusMember.fromJson(newJson);
case 'chatMemberStatusRestricted': return ChatMemberStatusRestricted.fromJson(newJson);
case 'chatMemberStatusLeft': return ChatMemberStatusLeft.fromJson(newJson);
case 'chatMemberStatusBanned': return ChatMemberStatusBanned.fromJson(newJson);
case 'chatMember': return ChatMember.fromJson(newJson);
case 'chatMembers': return ChatMembers.fromJson(newJson);
case 'chatMembersFilter': return ChatMembersFilter.fromJson(newJson);
case 'chatMembersFilterContacts': return ChatMembersFilterContacts.fromJson(newJson);
case 'chatMembersFilterAdministrators': return ChatMembersFilterAdministrators.fromJson(newJson);
case 'chatMembersFilterMembers': return ChatMembersFilterMembers.fromJson(newJson);
case 'chatMembersFilterMention': return ChatMembersFilterMention.fromJson(newJson);
case 'chatMembersFilterRestricted': return ChatMembersFilterRestricted.fromJson(newJson);
case 'chatMembersFilterBanned': return ChatMembersFilterBanned.fromJson(newJson);
case 'chatMembersFilterBots': return ChatMembersFilterBots.fromJson(newJson);
case 'supergroupMembersFilter': return SupergroupMembersFilter.fromJson(newJson);
case 'supergroupMembersFilterRecent': return SupergroupMembersFilterRecent.fromJson(newJson);
case 'supergroupMembersFilterContacts': return SupergroupMembersFilterContacts.fromJson(newJson);
case 'supergroupMembersFilterAdministrators': return SupergroupMembersFilterAdministrators.fromJson(newJson);
case 'supergroupMembersFilterSearch': return SupergroupMembersFilterSearch.fromJson(newJson);
case 'supergroupMembersFilterRestricted': return SupergroupMembersFilterRestricted.fromJson(newJson);
case 'supergroupMembersFilterBanned': return SupergroupMembersFilterBanned.fromJson(newJson);
case 'supergroupMembersFilterMention': return SupergroupMembersFilterMention.fromJson(newJson);
case 'supergroupMembersFilterBots': return SupergroupMembersFilterBots.fromJson(newJson);
case 'chatInviteLink': return ChatInviteLink.fromJson(newJson);
case 'chatInviteLinks': return ChatInviteLinks.fromJson(newJson);
case 'chatInviteLinkCount': return ChatInviteLinkCount.fromJson(newJson);
case 'chatInviteLinkCounts': return ChatInviteLinkCounts.fromJson(newJson);
case 'chatInviteLinkMember': return ChatInviteLinkMember.fromJson(newJson);
case 'chatInviteLinkMembers': return ChatInviteLinkMembers.fromJson(newJson);
case 'chatInviteLinkInfo': return ChatInviteLinkInfo.fromJson(newJson);
case 'chatJoinRequest': return ChatJoinRequest.fromJson(newJson);
case 'chatJoinRequests': return ChatJoinRequests.fromJson(newJson);
case 'chatJoinRequestsInfo': return ChatJoinRequestsInfo.fromJson(newJson);
case 'basicGroup': return BasicGroup.fromJson(newJson);
case 'basicGroupFullInfo': return BasicGroupFullInfo.fromJson(newJson);
case 'supergroup': return Supergroup.fromJson(newJson);
case 'supergroupFullInfo': return SupergroupFullInfo.fromJson(newJson);
case 'secretChatState': return SecretChatState.fromJson(newJson);
case 'secretChatStatePending': return SecretChatStatePending.fromJson(newJson);
case 'secretChatStateReady': return SecretChatStateReady.fromJson(newJson);
case 'secretChatStateClosed': return SecretChatStateClosed.fromJson(newJson);
case 'secretChat': return SecretChat.fromJson(newJson);
case 'messageSender': return MessageSender.fromJson(newJson);
case 'messageSenderUser': return MessageSenderUser.fromJson(newJson);
case 'messageSenderChat': return MessageSenderChat.fromJson(newJson);
case 'messageSenders': return MessageSenders.fromJson(newJson);
case 'messageForwardOrigin': return MessageForwardOrigin.fromJson(newJson);
case 'messageForwardOriginUser': return MessageForwardOriginUser.fromJson(newJson);
case 'messageForwardOriginChat': return MessageForwardOriginChat.fromJson(newJson);
case 'messageForwardOriginHiddenUser': return MessageForwardOriginHiddenUser.fromJson(newJson);
case 'messageForwardOriginChannel': return MessageForwardOriginChannel.fromJson(newJson);
case 'messageForwardOriginMessageImport': return MessageForwardOriginMessageImport.fromJson(newJson);
case 'messageForwardInfo': return MessageForwardInfo.fromJson(newJson);
case 'messageReplyInfo': return MessageReplyInfo.fromJson(newJson);
case 'messageInteractionInfo': return MessageInteractionInfo.fromJson(newJson);
case 'messageSendingState': return MessageSendingState.fromJson(newJson);
case 'messageSendingStatePending': return MessageSendingStatePending.fromJson(newJson);
case 'messageSendingStateFailed': return MessageSendingStateFailed.fromJson(newJson);
case 'message': return Message.fromJson(newJson);
case 'messages': return Messages.fromJson(newJson);
case 'foundMessages': return FoundMessages.fromJson(newJson);
case 'messagePosition': return MessagePosition.fromJson(newJson);
case 'messagePositions': return MessagePositions.fromJson(newJson);
case 'messageCalendarDay': return MessageCalendarDay.fromJson(newJson);
case 'messageCalendar': return MessageCalendar.fromJson(newJson);
case 'sponsoredMessage': return SponsoredMessage.fromJson(newJson);
case 'notificationSettingsScope': return NotificationSettingsScope.fromJson(newJson);
case 'notificationSettingsScopePrivateChats': return NotificationSettingsScopePrivateChats.fromJson(newJson);
case 'notificationSettingsScopeGroupChats': return NotificationSettingsScopeGroupChats.fromJson(newJson);
case 'notificationSettingsScopeChannelChats': return NotificationSettingsScopeChannelChats.fromJson(newJson);
case 'chatNotificationSettings': return ChatNotificationSettings.fromJson(newJson);
case 'scopeNotificationSettings': return ScopeNotificationSettings.fromJson(newJson);
case 'draftMessage': return DraftMessage.fromJson(newJson);
case 'chatType': return ChatType.fromJson(newJson);
case 'chatTypePrivate': return ChatTypePrivate.fromJson(newJson);
case 'chatTypeBasicGroup': return ChatTypeBasicGroup.fromJson(newJson);
case 'chatTypeSupergroup': return ChatTypeSupergroup.fromJson(newJson);
case 'chatTypeSecret': return ChatTypeSecret.fromJson(newJson);
case 'chatFilter': return ChatFilter.fromJson(newJson);
case 'chatFilterInfo': return ChatFilterInfo.fromJson(newJson);
case 'recommendedChatFilter': return RecommendedChatFilter.fromJson(newJson);
case 'recommendedChatFilters': return RecommendedChatFilters.fromJson(newJson);
case 'chatList': return ChatList.fromJson(newJson);
case 'chatListMain': return ChatListMain.fromJson(newJson);
case 'chatListArchive': return ChatListArchive.fromJson(newJson);
case 'chatListFilter': return ChatListFilter.fromJson(newJson);
case 'chatLists': return ChatLists.fromJson(newJson);
case 'chatSource': return ChatSource.fromJson(newJson);
case 'chatSourceMtprotoProxy': return ChatSourceMtprotoProxy.fromJson(newJson);
case 'chatSourcePublicServiceAnnouncement': return ChatSourcePublicServiceAnnouncement.fromJson(newJson);
case 'chatPosition': return ChatPosition.fromJson(newJson);
case 'videoChat': return VideoChat.fromJson(newJson);
case 'chat': return Chat.fromJson(newJson);
case 'chats': return Chats.fromJson(newJson);
case 'chatNearby': return ChatNearby.fromJson(newJson);
case 'chatsNearby': return ChatsNearby.fromJson(newJson);
case 'publicChatType': return PublicChatType.fromJson(newJson);
case 'publicChatTypeHasUsername': return PublicChatTypeHasUsername.fromJson(newJson);
case 'publicChatTypeIsLocationBased': return PublicChatTypeIsLocationBased.fromJson(newJson);
case 'chatActionBar': return ChatActionBar.fromJson(newJson);
case 'chatActionBarReportSpam': return ChatActionBarReportSpam.fromJson(newJson);
case 'chatActionBarReportUnrelatedLocation': return ChatActionBarReportUnrelatedLocation.fromJson(newJson);
case 'chatActionBarInviteMembers': return ChatActionBarInviteMembers.fromJson(newJson);
case 'chatActionBarReportAddBlock': return ChatActionBarReportAddBlock.fromJson(newJson);
case 'chatActionBarAddContact': return ChatActionBarAddContact.fromJson(newJson);
case 'chatActionBarSharePhoneNumber': return ChatActionBarSharePhoneNumber.fromJson(newJson);
case 'chatActionBarJoinRequest': return ChatActionBarJoinRequest.fromJson(newJson);
case 'keyboardButtonType': return KeyboardButtonType.fromJson(newJson);
case 'keyboardButtonTypeText': return KeyboardButtonTypeText.fromJson(newJson);
case 'keyboardButtonTypeRequestPhoneNumber': return KeyboardButtonTypeRequestPhoneNumber.fromJson(newJson);
case 'keyboardButtonTypeRequestLocation': return KeyboardButtonTypeRequestLocation.fromJson(newJson);
case 'keyboardButtonTypeRequestPoll': return KeyboardButtonTypeRequestPoll.fromJson(newJson);
case 'keyboardButton': return KeyboardButton.fromJson(newJson);
case 'inlineKeyboardButtonType': return InlineKeyboardButtonType.fromJson(newJson);
case 'inlineKeyboardButtonTypeUrl': return InlineKeyboardButtonTypeUrl.fromJson(newJson);
case 'inlineKeyboardButtonTypeLoginUrl': return InlineKeyboardButtonTypeLoginUrl.fromJson(newJson);
case 'inlineKeyboardButtonTypeCallback': return InlineKeyboardButtonTypeCallback.fromJson(newJson);
case 'inlineKeyboardButtonTypeCallbackWithPassword': return InlineKeyboardButtonTypeCallbackWithPassword.fromJson(newJson);
case 'inlineKeyboardButtonTypeCallbackGame': return InlineKeyboardButtonTypeCallbackGame.fromJson(newJson);
case 'inlineKeyboardButtonTypeSwitchInline': return InlineKeyboardButtonTypeSwitchInline.fromJson(newJson);
case 'inlineKeyboardButtonTypeBuy': return InlineKeyboardButtonTypeBuy.fromJson(newJson);
case 'inlineKeyboardButtonTypeUser': return InlineKeyboardButtonTypeUser.fromJson(newJson);
case 'inlineKeyboardButton': return InlineKeyboardButton.fromJson(newJson);
case 'replyMarkup': return ReplyMarkup.fromJson(newJson);
case 'replyMarkupRemoveKeyboard': return ReplyMarkupRemoveKeyboard.fromJson(newJson);
case 'replyMarkupForceReply': return ReplyMarkupForceReply.fromJson(newJson);
case 'replyMarkupShowKeyboard': return ReplyMarkupShowKeyboard.fromJson(newJson);
case 'replyMarkupInlineKeyboard': return ReplyMarkupInlineKeyboard.fromJson(newJson);
case 'loginUrlInfo': return LoginUrlInfo.fromJson(newJson);
case 'loginUrlInfoOpen': return LoginUrlInfoOpen.fromJson(newJson);
case 'loginUrlInfoRequestConfirmation': return LoginUrlInfoRequestConfirmation.fromJson(newJson);
case 'messageThreadInfo': return MessageThreadInfo.fromJson(newJson);
case 'richText': return RichText.fromJson(newJson);
case 'richTextPlain': return RichTextPlain.fromJson(newJson);
case 'richTextBold': return RichTextBold.fromJson(newJson);
case 'richTextItalic': return RichTextItalic.fromJson(newJson);
case 'richTextUnderline': return RichTextUnderline.fromJson(newJson);
case 'richTextStrikethrough': return RichTextStrikethrough.fromJson(newJson);
case 'richTextFixed': return RichTextFixed.fromJson(newJson);
case 'richTextUrl': return RichTextUrl.fromJson(newJson);
case 'richTextEmailAddress': return RichTextEmailAddress.fromJson(newJson);
case 'richTextSubscript': return RichTextSubscript.fromJson(newJson);
case 'richTextSuperscript': return RichTextSuperscript.fromJson(newJson);
case 'richTextMarked': return RichTextMarked.fromJson(newJson);
case 'richTextPhoneNumber': return RichTextPhoneNumber.fromJson(newJson);
case 'richTextIcon': return RichTextIcon.fromJson(newJson);
case 'richTextReference': return RichTextReference.fromJson(newJson);
case 'richTextAnchor': return RichTextAnchor.fromJson(newJson);
case 'richTextAnchorLink': return RichTextAnchorLink.fromJson(newJson);
case 'richTexts': return RichTexts.fromJson(newJson);
case 'pageBlockCaption': return PageBlockCaption.fromJson(newJson);
case 'pageBlockListItem': return PageBlockListItem.fromJson(newJson);
case 'pageBlockHorizontalAlignment': return PageBlockHorizontalAlignment.fromJson(newJson);
case 'pageBlockHorizontalAlignmentLeft': return PageBlockHorizontalAlignmentLeft.fromJson(newJson);
case 'pageBlockHorizontalAlignmentCenter': return PageBlockHorizontalAlignmentCenter.fromJson(newJson);
case 'pageBlockHorizontalAlignmentRight': return PageBlockHorizontalAlignmentRight.fromJson(newJson);
case 'pageBlockVerticalAlignment': return PageBlockVerticalAlignment.fromJson(newJson);
case 'pageBlockVerticalAlignmentTop': return PageBlockVerticalAlignmentTop.fromJson(newJson);
case 'pageBlockVerticalAlignmentMiddle': return PageBlockVerticalAlignmentMiddle.fromJson(newJson);
case 'pageBlockVerticalAlignmentBottom': return PageBlockVerticalAlignmentBottom.fromJson(newJson);
case 'pageBlockTableCell': return PageBlockTableCell.fromJson(newJson);
case 'pageBlockRelatedArticle': return PageBlockRelatedArticle.fromJson(newJson);
case 'pageBlock': return PageBlock.fromJson(newJson);
case 'pageBlockTitle': return PageBlockTitle.fromJson(newJson);
case 'pageBlockSubtitle': return PageBlockSubtitle.fromJson(newJson);
case 'pageBlockAuthorDate': return PageBlockAuthorDate.fromJson(newJson);
case 'pageBlockHeader': return PageBlockHeader.fromJson(newJson);
case 'pageBlockSubheader': return PageBlockSubheader.fromJson(newJson);
case 'pageBlockKicker': return PageBlockKicker.fromJson(newJson);
case 'pageBlockParagraph': return PageBlockParagraph.fromJson(newJson);
case 'pageBlockPreformatted': return PageBlockPreformatted.fromJson(newJson);
case 'pageBlockFooter': return PageBlockFooter.fromJson(newJson);
case 'pageBlockDivider': return PageBlockDivider.fromJson(newJson);
case 'pageBlockAnchor': return PageBlockAnchor.fromJson(newJson);
case 'pageBlockList': return PageBlockList.fromJson(newJson);
case 'pageBlockBlockQuote': return PageBlockBlockQuote.fromJson(newJson);
case 'pageBlockPullQuote': return PageBlockPullQuote.fromJson(newJson);
case 'pageBlockAnimation': return PageBlockAnimation.fromJson(newJson);
case 'pageBlockAudio': return PageBlockAudio.fromJson(newJson);
case 'pageBlockPhoto': return PageBlockPhoto.fromJson(newJson);
case 'pageBlockVideo': return PageBlockVideo.fromJson(newJson);
case 'pageBlockVoiceNote': return PageBlockVoiceNote.fromJson(newJson);
case 'pageBlockCover': return PageBlockCover.fromJson(newJson);
case 'pageBlockEmbedded': return PageBlockEmbedded.fromJson(newJson);
case 'pageBlockEmbeddedPost': return PageBlockEmbeddedPost.fromJson(newJson);
case 'pageBlockCollage': return PageBlockCollage.fromJson(newJson);
case 'pageBlockSlideshow': return PageBlockSlideshow.fromJson(newJson);
case 'pageBlockChatLink': return PageBlockChatLink.fromJson(newJson);
case 'pageBlockTable': return PageBlockTable.fromJson(newJson);
case 'pageBlockDetails': return PageBlockDetails.fromJson(newJson);
case 'pageBlockRelatedArticles': return PageBlockRelatedArticles.fromJson(newJson);
case 'pageBlockMap': return PageBlockMap.fromJson(newJson);
case 'webPageInstantView': return WebPageInstantView.fromJson(newJson);
case 'webPage': return WebPage.fromJson(newJson);
case 'countryInfo': return CountryInfo.fromJson(newJson);
case 'countries': return Countries.fromJson(newJson);
case 'phoneNumberInfo': return PhoneNumberInfo.fromJson(newJson);
case 'bankCardActionOpenUrl': return BankCardActionOpenUrl.fromJson(newJson);
case 'bankCardInfo': return BankCardInfo.fromJson(newJson);
case 'address': return Address.fromJson(newJson);
case 'labeledPricePart': return LabeledPricePart.fromJson(newJson);
case 'invoice': return Invoice.fromJson(newJson);
case 'orderInfo': return OrderInfo.fromJson(newJson);
case 'shippingOption': return ShippingOption.fromJson(newJson);
case 'savedCredentials': return SavedCredentials.fromJson(newJson);
case 'inputCredentials': return InputCredentials.fromJson(newJson);
case 'inputCredentialsSaved': return InputCredentialsSaved.fromJson(newJson);
case 'inputCredentialsNew': return InputCredentialsNew.fromJson(newJson);
case 'inputCredentialsApplePay': return InputCredentialsApplePay.fromJson(newJson);
case 'inputCredentialsGooglePay': return InputCredentialsGooglePay.fromJson(newJson);
case 'paymentsProviderStripe': return PaymentsProviderStripe.fromJson(newJson);
case 'paymentFormTheme': return PaymentFormTheme.fromJson(newJson);
case 'paymentForm': return PaymentForm.fromJson(newJson);
case 'validatedOrderInfo': return ValidatedOrderInfo.fromJson(newJson);
case 'paymentResult': return PaymentResult.fromJson(newJson);
case 'paymentReceipt': return PaymentReceipt.fromJson(newJson);
case 'datedFile': return DatedFile.fromJson(newJson);
case 'passportElementType': return PassportElementType.fromJson(newJson);
case 'passportElementTypePersonalDetails': return PassportElementTypePersonalDetails.fromJson(newJson);
case 'passportElementTypePassport': return PassportElementTypePassport.fromJson(newJson);
case 'passportElementTypeDriverLicense': return PassportElementTypeDriverLicense.fromJson(newJson);
case 'passportElementTypeIdentityCard': return PassportElementTypeIdentityCard.fromJson(newJson);
case 'passportElementTypeInternalPassport': return PassportElementTypeInternalPassport.fromJson(newJson);
case 'passportElementTypeAddress': return PassportElementTypeAddress.fromJson(newJson);
case 'passportElementTypeUtilityBill': return PassportElementTypeUtilityBill.fromJson(newJson);
case 'passportElementTypeBankStatement': return PassportElementTypeBankStatement.fromJson(newJson);
case 'passportElementTypeRentalAgreement': return PassportElementTypeRentalAgreement.fromJson(newJson);
case 'passportElementTypePassportRegistration': return PassportElementTypePassportRegistration.fromJson(newJson);
case 'passportElementTypeTemporaryRegistration': return PassportElementTypeTemporaryRegistration.fromJson(newJson);
case 'passportElementTypePhoneNumber': return PassportElementTypePhoneNumber.fromJson(newJson);
case 'passportElementTypeEmailAddress': return PassportElementTypeEmailAddress.fromJson(newJson);
case 'date': return Date.fromJson(newJson);
case 'personalDetails': return PersonalDetails.fromJson(newJson);
case 'identityDocument': return IdentityDocument.fromJson(newJson);
case 'inputIdentityDocument': return InputIdentityDocument.fromJson(newJson);
case 'personalDocument': return PersonalDocument.fromJson(newJson);
case 'inputPersonalDocument': return InputPersonalDocument.fromJson(newJson);
case 'passportElement': return PassportElement.fromJson(newJson);
case 'passportElementPersonalDetails': return PassportElementPersonalDetails.fromJson(newJson);
case 'passportElementPassport': return PassportElementPassport.fromJson(newJson);
case 'passportElementDriverLicense': return PassportElementDriverLicense.fromJson(newJson);
case 'passportElementIdentityCard': return PassportElementIdentityCard.fromJson(newJson);
case 'passportElementInternalPassport': return PassportElementInternalPassport.fromJson(newJson);
case 'passportElementAddress': return PassportElementAddress.fromJson(newJson);
case 'passportElementUtilityBill': return PassportElementUtilityBill.fromJson(newJson);
case 'passportElementBankStatement': return PassportElementBankStatement.fromJson(newJson);
case 'passportElementRentalAgreement': return PassportElementRentalAgreement.fromJson(newJson);
case 'passportElementPassportRegistration': return PassportElementPassportRegistration.fromJson(newJson);
case 'passportElementTemporaryRegistration': return PassportElementTemporaryRegistration.fromJson(newJson);
case 'passportElementPhoneNumber': return PassportElementPhoneNumber.fromJson(newJson);
case 'passportElementEmailAddress': return PassportElementEmailAddress.fromJson(newJson);
case 'inputPassportElement': return InputPassportElement.fromJson(newJson);
case 'inputPassportElementPersonalDetails': return InputPassportElementPersonalDetails.fromJson(newJson);
case 'inputPassportElementPassport': return InputPassportElementPassport.fromJson(newJson);
case 'inputPassportElementDriverLicense': return InputPassportElementDriverLicense.fromJson(newJson);
case 'inputPassportElementIdentityCard': return InputPassportElementIdentityCard.fromJson(newJson);
case 'inputPassportElementInternalPassport': return InputPassportElementInternalPassport.fromJson(newJson);
case 'inputPassportElementAddress': return InputPassportElementAddress.fromJson(newJson);
case 'inputPassportElementUtilityBill': return InputPassportElementUtilityBill.fromJson(newJson);
case 'inputPassportElementBankStatement': return InputPassportElementBankStatement.fromJson(newJson);
case 'inputPassportElementRentalAgreement': return InputPassportElementRentalAgreement.fromJson(newJson);
case 'inputPassportElementPassportRegistration': return InputPassportElementPassportRegistration.fromJson(newJson);
case 'inputPassportElementTemporaryRegistration': return InputPassportElementTemporaryRegistration.fromJson(newJson);
case 'inputPassportElementPhoneNumber': return InputPassportElementPhoneNumber.fromJson(newJson);
case 'inputPassportElementEmailAddress': return InputPassportElementEmailAddress.fromJson(newJson);
case 'passportElements': return PassportElements.fromJson(newJson);
case 'passportElementErrorSource': return PassportElementErrorSource.fromJson(newJson);
case 'passportElementErrorSourceUnspecified': return PassportElementErrorSourceUnspecified.fromJson(newJson);
case 'passportElementErrorSourceDataField': return PassportElementErrorSourceDataField.fromJson(newJson);
case 'passportElementErrorSourceFrontSide': return PassportElementErrorSourceFrontSide.fromJson(newJson);
case 'passportElementErrorSourceReverseSide': return PassportElementErrorSourceReverseSide.fromJson(newJson);
case 'passportElementErrorSourceSelfie': return PassportElementErrorSourceSelfie.fromJson(newJson);
case 'passportElementErrorSourceTranslationFile': return PassportElementErrorSourceTranslationFile.fromJson(newJson);
case 'passportElementErrorSourceTranslationFiles': return PassportElementErrorSourceTranslationFiles.fromJson(newJson);
case 'passportElementErrorSourceFile': return PassportElementErrorSourceFile.fromJson(newJson);
case 'passportElementErrorSourceFiles': return PassportElementErrorSourceFiles.fromJson(newJson);
case 'passportElementError': return PassportElementError.fromJson(newJson);
case 'passportSuitableElement': return PassportSuitableElement.fromJson(newJson);
case 'passportRequiredElement': return PassportRequiredElement.fromJson(newJson);
case 'passportAuthorizationForm': return PassportAuthorizationForm.fromJson(newJson);
case 'passportElementsWithErrors': return PassportElementsWithErrors.fromJson(newJson);
case 'encryptedCredentials': return EncryptedCredentials.fromJson(newJson);
case 'encryptedPassportElement': return EncryptedPassportElement.fromJson(newJson);
case 'inputPassportElementErrorSource': return InputPassportElementErrorSource.fromJson(newJson);
case 'inputPassportElementErrorSourceUnspecified': return InputPassportElementErrorSourceUnspecified.fromJson(newJson);
case 'inputPassportElementErrorSourceDataField': return InputPassportElementErrorSourceDataField.fromJson(newJson);
case 'inputPassportElementErrorSourceFrontSide': return InputPassportElementErrorSourceFrontSide.fromJson(newJson);
case 'inputPassportElementErrorSourceReverseSide': return InputPassportElementErrorSourceReverseSide.fromJson(newJson);
case 'inputPassportElementErrorSourceSelfie': return InputPassportElementErrorSourceSelfie.fromJson(newJson);
case 'inputPassportElementErrorSourceTranslationFile': return InputPassportElementErrorSourceTranslationFile.fromJson(newJson);
case 'inputPassportElementErrorSourceTranslationFiles': return InputPassportElementErrorSourceTranslationFiles.fromJson(newJson);
case 'inputPassportElementErrorSourceFile': return InputPassportElementErrorSourceFile.fromJson(newJson);
case 'inputPassportElementErrorSourceFiles': return InputPassportElementErrorSourceFiles.fromJson(newJson);
case 'inputPassportElementError': return InputPassportElementError.fromJson(newJson);
case 'messageContent': return MessageContent.fromJson(newJson);
case 'messageText': return MessageText.fromJson(newJson);
case 'messageAnimation': return MessageAnimation.fromJson(newJson);
case 'messageAudio': return MessageAudio.fromJson(newJson);
case 'messageDocument': return MessageDocument.fromJson(newJson);
case 'messagePhoto': return MessagePhoto.fromJson(newJson);
case 'messageExpiredPhoto': return MessageExpiredPhoto.fromJson(newJson);
case 'messageSticker': return MessageSticker.fromJson(newJson);
case 'messageVideo': return MessageVideo.fromJson(newJson);
case 'messageExpiredVideo': return MessageExpiredVideo.fromJson(newJson);
case 'messageVideoNote': return MessageVideoNote.fromJson(newJson);
case 'messageVoiceNote': return MessageVoiceNote.fromJson(newJson);
case 'messageLocation': return MessageLocation.fromJson(newJson);
case 'messageVenue': return MessageVenue.fromJson(newJson);
case 'messageContact': return MessageContact.fromJson(newJson);
case 'messageAnimatedEmoji': return MessageAnimatedEmoji.fromJson(newJson);
case 'messageDice': return MessageDice.fromJson(newJson);
case 'messageGame': return MessageGame.fromJson(newJson);
case 'messagePoll': return MessagePoll.fromJson(newJson);
case 'messageInvoice': return MessageInvoice.fromJson(newJson);
case 'messageCall': return MessageCall.fromJson(newJson);
case 'messageVideoChatScheduled': return MessageVideoChatScheduled.fromJson(newJson);
case 'messageVideoChatStarted': return MessageVideoChatStarted.fromJson(newJson);
case 'messageVideoChatEnded': return MessageVideoChatEnded.fromJson(newJson);
case 'messageInviteVideoChatParticipants': return MessageInviteVideoChatParticipants.fromJson(newJson);
case 'messageBasicGroupChatCreate': return MessageBasicGroupChatCreate.fromJson(newJson);
case 'messageSupergroupChatCreate': return MessageSupergroupChatCreate.fromJson(newJson);
case 'messageChatChangeTitle': return MessageChatChangeTitle.fromJson(newJson);
case 'messageChatChangePhoto': return MessageChatChangePhoto.fromJson(newJson);
case 'messageChatDeletePhoto': return MessageChatDeletePhoto.fromJson(newJson);
case 'messageChatAddMembers': return MessageChatAddMembers.fromJson(newJson);
case 'messageChatJoinByLink': return MessageChatJoinByLink.fromJson(newJson);
case 'messageChatJoinByRequest': return MessageChatJoinByRequest.fromJson(newJson);
case 'messageChatDeleteMember': return MessageChatDeleteMember.fromJson(newJson);
case 'messageChatUpgradeTo': return MessageChatUpgradeTo.fromJson(newJson);
case 'messageChatUpgradeFrom': return MessageChatUpgradeFrom.fromJson(newJson);
case 'messagePinMessage': return MessagePinMessage.fromJson(newJson);
case 'messageScreenshotTaken': return MessageScreenshotTaken.fromJson(newJson);
case 'messageChatSetTheme': return MessageChatSetTheme.fromJson(newJson);
case 'messageChatSetTtl': return MessageChatSetTtl.fromJson(newJson);
case 'messageCustomServiceAction': return MessageCustomServiceAction.fromJson(newJson);
case 'messageGameScore': return MessageGameScore.fromJson(newJson);
case 'messagePaymentSuccessful': return MessagePaymentSuccessful.fromJson(newJson);
case 'messagePaymentSuccessfulBot': return MessagePaymentSuccessfulBot.fromJson(newJson);
case 'messageContactRegistered': return MessageContactRegistered.fromJson(newJson);
case 'messageWebsiteConnected': return MessageWebsiteConnected.fromJson(newJson);
case 'messagePassportDataSent': return MessagePassportDataSent.fromJson(newJson);
case 'messagePassportDataReceived': return MessagePassportDataReceived.fromJson(newJson);
case 'messageProximityAlertTriggered': return MessageProximityAlertTriggered.fromJson(newJson);
case 'messageUnsupported': return MessageUnsupported.fromJson(newJson);
case 'textEntityType': return TextEntityType.fromJson(newJson);
case 'textEntityTypeMention': return TextEntityTypeMention.fromJson(newJson);
case 'textEntityTypeHashtag': return TextEntityTypeHashtag.fromJson(newJson);
case 'textEntityTypeCashtag': return TextEntityTypeCashtag.fromJson(newJson);
case 'textEntityTypeBotCommand': return TextEntityTypeBotCommand.fromJson(newJson);
case 'textEntityTypeUrl': return TextEntityTypeUrl.fromJson(newJson);
case 'textEntityTypeEmailAddress': return TextEntityTypeEmailAddress.fromJson(newJson);
case 'textEntityTypePhoneNumber': return TextEntityTypePhoneNumber.fromJson(newJson);
case 'textEntityTypeBankCardNumber': return TextEntityTypeBankCardNumber.fromJson(newJson);
case 'textEntityTypeBold': return TextEntityTypeBold.fromJson(newJson);
case 'textEntityTypeItalic': return TextEntityTypeItalic.fromJson(newJson);
case 'textEntityTypeUnderline': return TextEntityTypeUnderline.fromJson(newJson);
case 'textEntityTypeStrikethrough': return TextEntityTypeStrikethrough.fromJson(newJson);
case 'textEntityTypeSpoiler': return TextEntityTypeSpoiler.fromJson(newJson);
case 'textEntityTypeCode': return TextEntityTypeCode.fromJson(newJson);
case 'textEntityTypePre': return TextEntityTypePre.fromJson(newJson);
case 'textEntityTypePreCode': return TextEntityTypePreCode.fromJson(newJson);
case 'textEntityTypeTextUrl': return TextEntityTypeTextUrl.fromJson(newJson);
case 'textEntityTypeMentionName': return TextEntityTypeMentionName.fromJson(newJson);
case 'textEntityTypeMediaTimestamp': return TextEntityTypeMediaTimestamp.fromJson(newJson);
case 'inputThumbnail': return InputThumbnail.fromJson(newJson);
case 'messageSchedulingState': return MessageSchedulingState.fromJson(newJson);
case 'messageSchedulingStateSendAtDate': return MessageSchedulingStateSendAtDate.fromJson(newJson);
case 'messageSchedulingStateSendWhenOnline': return MessageSchedulingStateSendWhenOnline.fromJson(newJson);
case 'messageSendOptions': return MessageSendOptions.fromJson(newJson);
case 'messageCopyOptions': return MessageCopyOptions.fromJson(newJson);
case 'inputMessageContent': return InputMessageContent.fromJson(newJson);
case 'inputMessageText': return InputMessageText.fromJson(newJson);
case 'inputMessageAnimation': return InputMessageAnimation.fromJson(newJson);
case 'inputMessageAudio': return InputMessageAudio.fromJson(newJson);
case 'inputMessageDocument': return InputMessageDocument.fromJson(newJson);
case 'inputMessagePhoto': return InputMessagePhoto.fromJson(newJson);
case 'inputMessageSticker': return InputMessageSticker.fromJson(newJson);
case 'inputMessageVideo': return InputMessageVideo.fromJson(newJson);
case 'inputMessageVideoNote': return InputMessageVideoNote.fromJson(newJson);
case 'inputMessageVoiceNote': return InputMessageVoiceNote.fromJson(newJson);
case 'inputMessageLocation': return InputMessageLocation.fromJson(newJson);
case 'inputMessageVenue': return InputMessageVenue.fromJson(newJson);
case 'inputMessageContact': return InputMessageContact.fromJson(newJson);
case 'inputMessageDice': return InputMessageDice.fromJson(newJson);
case 'inputMessageGame': return InputMessageGame.fromJson(newJson);
case 'inputMessageInvoice': return InputMessageInvoice.fromJson(newJson);
case 'inputMessagePoll': return InputMessagePoll.fromJson(newJson);
case 'inputMessageForwarded': return InputMessageForwarded.fromJson(newJson);
case 'searchMessagesFilter': return SearchMessagesFilter.fromJson(newJson);
case 'searchMessagesFilterEmpty': return SearchMessagesFilterEmpty.fromJson(newJson);
case 'searchMessagesFilterAnimation': return SearchMessagesFilterAnimation.fromJson(newJson);
case 'searchMessagesFilterAudio': return SearchMessagesFilterAudio.fromJson(newJson);
case 'searchMessagesFilterDocument': return SearchMessagesFilterDocument.fromJson(newJson);
case 'searchMessagesFilterPhoto': return SearchMessagesFilterPhoto.fromJson(newJson);
case 'searchMessagesFilterVideo': return SearchMessagesFilterVideo.fromJson(newJson);
case 'searchMessagesFilterVoiceNote': return SearchMessagesFilterVoiceNote.fromJson(newJson);
case 'searchMessagesFilterPhotoAndVideo': return SearchMessagesFilterPhotoAndVideo.fromJson(newJson);
case 'searchMessagesFilterUrl': return SearchMessagesFilterUrl.fromJson(newJson);
case 'searchMessagesFilterChatPhoto': return SearchMessagesFilterChatPhoto.fromJson(newJson);
case 'searchMessagesFilterVideoNote': return SearchMessagesFilterVideoNote.fromJson(newJson);
case 'searchMessagesFilterVoiceAndVideoNote': return SearchMessagesFilterVoiceAndVideoNote.fromJson(newJson);
case 'searchMessagesFilterMention': return SearchMessagesFilterMention.fromJson(newJson);
case 'searchMessagesFilterUnreadMention': return SearchMessagesFilterUnreadMention.fromJson(newJson);
case 'searchMessagesFilterFailedToSend': return SearchMessagesFilterFailedToSend.fromJson(newJson);
case 'searchMessagesFilterPinned': return SearchMessagesFilterPinned.fromJson(newJson);
case 'chatAction': return ChatAction.fromJson(newJson);
case 'chatActionTyping': return ChatActionTyping.fromJson(newJson);
case 'chatActionRecordingVideo': return ChatActionRecordingVideo.fromJson(newJson);
case 'chatActionUploadingVideo': return ChatActionUploadingVideo.fromJson(newJson);
case 'chatActionRecordingVoiceNote': return ChatActionRecordingVoiceNote.fromJson(newJson);
case 'chatActionUploadingVoiceNote': return ChatActionUploadingVoiceNote.fromJson(newJson);
case 'chatActionUploadingPhoto': return ChatActionUploadingPhoto.fromJson(newJson);
case 'chatActionUploadingDocument': return ChatActionUploadingDocument.fromJson(newJson);
case 'chatActionChoosingSticker': return ChatActionChoosingSticker.fromJson(newJson);
case 'chatActionChoosingLocation': return ChatActionChoosingLocation.fromJson(newJson);
case 'chatActionChoosingContact': return ChatActionChoosingContact.fromJson(newJson);
case 'chatActionStartPlayingGame': return ChatActionStartPlayingGame.fromJson(newJson);
case 'chatActionRecordingVideoNote': return ChatActionRecordingVideoNote.fromJson(newJson);
case 'chatActionUploadingVideoNote': return ChatActionUploadingVideoNote.fromJson(newJson);
case 'chatActionWatchingAnimations': return ChatActionWatchingAnimations.fromJson(newJson);
case 'chatActionCancel': return ChatActionCancel.fromJson(newJson);
case 'userStatus': return UserStatus.fromJson(newJson);
case 'userStatusEmpty': return UserStatusEmpty.fromJson(newJson);
case 'userStatusOnline': return UserStatusOnline.fromJson(newJson);
case 'userStatusOffline': return UserStatusOffline.fromJson(newJson);
case 'userStatusRecently': return UserStatusRecently.fromJson(newJson);
case 'userStatusLastWeek': return UserStatusLastWeek.fromJson(newJson);
case 'userStatusLastMonth': return UserStatusLastMonth.fromJson(newJson);
case 'stickers': return Stickers.fromJson(newJson);
case 'emojis': return Emojis.fromJson(newJson);
case 'stickerSet': return StickerSet.fromJson(newJson);
case 'stickerSetInfo': return StickerSetInfo.fromJson(newJson);
case 'stickerSets': return StickerSets.fromJson(newJson);
case 'callDiscardReason': return CallDiscardReason.fromJson(newJson);
case 'callDiscardReasonEmpty': return CallDiscardReasonEmpty.fromJson(newJson);
case 'callDiscardReasonMissed': return CallDiscardReasonMissed.fromJson(newJson);
case 'callDiscardReasonDeclined': return CallDiscardReasonDeclined.fromJson(newJson);
case 'callDiscardReasonDisconnected': return CallDiscardReasonDisconnected.fromJson(newJson);
case 'callDiscardReasonHungUp': return CallDiscardReasonHungUp.fromJson(newJson);
case 'callProtocol': return CallProtocol.fromJson(newJson);
case 'callServerType': return CallServerType.fromJson(newJson);
case 'callServerTypeTelegramReflector': return CallServerTypeTelegramReflector.fromJson(newJson);
case 'callServerTypeWebrtc': return CallServerTypeWebrtc.fromJson(newJson);
case 'callServer': return CallServer.fromJson(newJson);
case 'callId': return CallId.fromJson(newJson);
case 'groupCallId': return GroupCallId.fromJson(newJson);
case 'callState': return CallState.fromJson(newJson);
case 'callStatePending': return CallStatePending.fromJson(newJson);
case 'callStateExchangingKeys': return CallStateExchangingKeys.fromJson(newJson);
case 'callStateReady': return CallStateReady.fromJson(newJson);
case 'callStateHangingUp': return CallStateHangingUp.fromJson(newJson);
case 'callStateDiscarded': return CallStateDiscarded.fromJson(newJson);
case 'callStateError': return CallStateError.fromJson(newJson);
case 'groupCallVideoQuality': return GroupCallVideoQuality.fromJson(newJson);
case 'groupCallVideoQualityThumbnail': return GroupCallVideoQualityThumbnail.fromJson(newJson);
case 'groupCallVideoQualityMedium': return GroupCallVideoQualityMedium.fromJson(newJson);
case 'groupCallVideoQualityFull': return GroupCallVideoQualityFull.fromJson(newJson);
case 'groupCallRecentSpeaker': return GroupCallRecentSpeaker.fromJson(newJson);
case 'groupCall': return GroupCall.fromJson(newJson);
case 'groupCallVideoSourceGroup': return GroupCallVideoSourceGroup.fromJson(newJson);
case 'groupCallParticipantVideoInfo': return GroupCallParticipantVideoInfo.fromJson(newJson);
case 'groupCallParticipant': return GroupCallParticipant.fromJson(newJson);
case 'callProblem': return CallProblem.fromJson(newJson);
case 'callProblemEcho': return CallProblemEcho.fromJson(newJson);
case 'callProblemNoise': return CallProblemNoise.fromJson(newJson);
case 'callProblemInterruptions': return CallProblemInterruptions.fromJson(newJson);
case 'callProblemDistortedSpeech': return CallProblemDistortedSpeech.fromJson(newJson);
case 'callProblemSilentLocal': return CallProblemSilentLocal.fromJson(newJson);
case 'callProblemSilentRemote': return CallProblemSilentRemote.fromJson(newJson);
case 'callProblemDropped': return CallProblemDropped.fromJson(newJson);
case 'callProblemDistortedVideo': return CallProblemDistortedVideo.fromJson(newJson);
case 'callProblemPixelatedVideo': return CallProblemPixelatedVideo.fromJson(newJson);
case 'call': return Call.fromJson(newJson);
case 'phoneNumberAuthenticationSettings': return PhoneNumberAuthenticationSettings.fromJson(newJson);
case 'animations': return Animations.fromJson(newJson);
case 'diceStickers': return DiceStickers.fromJson(newJson);
case 'diceStickersRegular': return DiceStickersRegular.fromJson(newJson);
case 'diceStickersSlotMachine': return DiceStickersSlotMachine.fromJson(newJson);
case 'importedContacts': return ImportedContacts.fromJson(newJson);
case 'httpUrl': return HttpUrl.fromJson(newJson);
case 'inputInlineQueryResult': return InputInlineQueryResult.fromJson(newJson);
case 'inputInlineQueryResultAnimation': return InputInlineQueryResultAnimation.fromJson(newJson);
case 'inputInlineQueryResultArticle': return InputInlineQueryResultArticle.fromJson(newJson);
case 'inputInlineQueryResultAudio': return InputInlineQueryResultAudio.fromJson(newJson);
case 'inputInlineQueryResultContact': return InputInlineQueryResultContact.fromJson(newJson);
case 'inputInlineQueryResultDocument': return InputInlineQueryResultDocument.fromJson(newJson);
case 'inputInlineQueryResultGame': return InputInlineQueryResultGame.fromJson(newJson);
case 'inputInlineQueryResultLocation': return InputInlineQueryResultLocation.fromJson(newJson);
case 'inputInlineQueryResultPhoto': return InputInlineQueryResultPhoto.fromJson(newJson);
case 'inputInlineQueryResultSticker': return InputInlineQueryResultSticker.fromJson(newJson);
case 'inputInlineQueryResultVenue': return InputInlineQueryResultVenue.fromJson(newJson);
case 'inputInlineQueryResultVideo': return InputInlineQueryResultVideo.fromJson(newJson);
case 'inputInlineQueryResultVoiceNote': return InputInlineQueryResultVoiceNote.fromJson(newJson);
case 'inlineQueryResult': return InlineQueryResult.fromJson(newJson);
case 'inlineQueryResultArticle': return InlineQueryResultArticle.fromJson(newJson);
case 'inlineQueryResultContact': return InlineQueryResultContact.fromJson(newJson);
case 'inlineQueryResultLocation': return InlineQueryResultLocation.fromJson(newJson);
case 'inlineQueryResultVenue': return InlineQueryResultVenue.fromJson(newJson);
case 'inlineQueryResultGame': return InlineQueryResultGame.fromJson(newJson);
case 'inlineQueryResultAnimation': return InlineQueryResultAnimation.fromJson(newJson);
case 'inlineQueryResultAudio': return InlineQueryResultAudio.fromJson(newJson);
case 'inlineQueryResultDocument': return InlineQueryResultDocument.fromJson(newJson);
case 'inlineQueryResultPhoto': return InlineQueryResultPhoto.fromJson(newJson);
case 'inlineQueryResultSticker': return InlineQueryResultSticker.fromJson(newJson);
case 'inlineQueryResultVideo': return InlineQueryResultVideo.fromJson(newJson);
case 'inlineQueryResultVoiceNote': return InlineQueryResultVoiceNote.fromJson(newJson);
case 'inlineQueryResults': return InlineQueryResults.fromJson(newJson);
case 'callbackQueryPayload': return CallbackQueryPayload.fromJson(newJson);
case 'callbackQueryPayloadData': return CallbackQueryPayloadData.fromJson(newJson);
case 'callbackQueryPayloadDataWithPassword': return CallbackQueryPayloadDataWithPassword.fromJson(newJson);
case 'callbackQueryPayloadGame': return CallbackQueryPayloadGame.fromJson(newJson);
case 'callbackQueryAnswer': return CallbackQueryAnswer.fromJson(newJson);
case 'customRequestResult': return CustomRequestResult.fromJson(newJson);
case 'gameHighScore': return GameHighScore.fromJson(newJson);
case 'gameHighScores': return GameHighScores.fromJson(newJson);
case 'chatEventAction': return ChatEventAction.fromJson(newJson);
case 'chatEventMessageEdited': return ChatEventMessageEdited.fromJson(newJson);
case 'chatEventMessageDeleted': return ChatEventMessageDeleted.fromJson(newJson);
case 'chatEventPollStopped': return ChatEventPollStopped.fromJson(newJson);
case 'chatEventMessagePinned': return ChatEventMessagePinned.fromJson(newJson);
case 'chatEventMessageUnpinned': return ChatEventMessageUnpinned.fromJson(newJson);
case 'chatEventMemberJoined': return ChatEventMemberJoined.fromJson(newJson);
case 'chatEventMemberJoinedByInviteLink': return ChatEventMemberJoinedByInviteLink.fromJson(newJson);
case 'chatEventMemberJoinedByRequest': return ChatEventMemberJoinedByRequest.fromJson(newJson);
case 'chatEventMemberLeft': return ChatEventMemberLeft.fromJson(newJson);
case 'chatEventMemberInvited': return ChatEventMemberInvited.fromJson(newJson);
case 'chatEventMemberPromoted': return ChatEventMemberPromoted.fromJson(newJson);
case 'chatEventMemberRestricted': return ChatEventMemberRestricted.fromJson(newJson);
case 'chatEventTitleChanged': return ChatEventTitleChanged.fromJson(newJson);
case 'chatEventPermissionsChanged': return ChatEventPermissionsChanged.fromJson(newJson);
case 'chatEventDescriptionChanged': return ChatEventDescriptionChanged.fromJson(newJson);
case 'chatEventUsernameChanged': return ChatEventUsernameChanged.fromJson(newJson);
case 'chatEventPhotoChanged': return ChatEventPhotoChanged.fromJson(newJson);
case 'chatEventInvitesToggled': return ChatEventInvitesToggled.fromJson(newJson);
case 'chatEventLinkedChatChanged': return ChatEventLinkedChatChanged.fromJson(newJson);
case 'chatEventSlowModeDelayChanged': return ChatEventSlowModeDelayChanged.fromJson(newJson);
case 'chatEventMessageTtlChanged': return ChatEventMessageTtlChanged.fromJson(newJson);
case 'chatEventSignMessagesToggled': return ChatEventSignMessagesToggled.fromJson(newJson);
case 'chatEventHasProtectedContentToggled': return ChatEventHasProtectedContentToggled.fromJson(newJson);
case 'chatEventStickerSetChanged': return ChatEventStickerSetChanged.fromJson(newJson);
case 'chatEventLocationChanged': return ChatEventLocationChanged.fromJson(newJson);
case 'chatEventIsAllHistoryAvailableToggled': return ChatEventIsAllHistoryAvailableToggled.fromJson(newJson);
case 'chatEventInviteLinkEdited': return ChatEventInviteLinkEdited.fromJson(newJson);
case 'chatEventInviteLinkRevoked': return ChatEventInviteLinkRevoked.fromJson(newJson);
case 'chatEventInviteLinkDeleted': return ChatEventInviteLinkDeleted.fromJson(newJson);
case 'chatEventVideoChatCreated': return ChatEventVideoChatCreated.fromJson(newJson);
case 'chatEventVideoChatEnded': return ChatEventVideoChatEnded.fromJson(newJson);
case 'chatEventVideoChatParticipantIsMutedToggled': return ChatEventVideoChatParticipantIsMutedToggled.fromJson(newJson);
case 'chatEventVideoChatParticipantVolumeLevelChanged': return ChatEventVideoChatParticipantVolumeLevelChanged.fromJson(newJson);
case 'chatEventVideoChatMuteNewParticipantsToggled': return ChatEventVideoChatMuteNewParticipantsToggled.fromJson(newJson);
case 'chatEvent': return ChatEvent.fromJson(newJson);
case 'chatEvents': return ChatEvents.fromJson(newJson);
case 'chatEventLogFilters': return ChatEventLogFilters.fromJson(newJson);
case 'languagePackStringValue': return LanguagePackStringValue.fromJson(newJson);
case 'languagePackStringValueOrdinary': return LanguagePackStringValueOrdinary.fromJson(newJson);
case 'languagePackStringValuePluralized': return LanguagePackStringValuePluralized.fromJson(newJson);
case 'languagePackStringValueDeleted': return LanguagePackStringValueDeleted.fromJson(newJson);
case 'languagePackString': return LanguagePackString.fromJson(newJson);
case 'languagePackStrings': return LanguagePackStrings.fromJson(newJson);
case 'languagePackInfo': return LanguagePackInfo.fromJson(newJson);
case 'localizationTargetInfo': return LocalizationTargetInfo.fromJson(newJson);
case 'deviceToken': return DeviceToken.fromJson(newJson);
case 'deviceTokenFirebaseCloudMessaging': return DeviceTokenFirebaseCloudMessaging.fromJson(newJson);
case 'deviceTokenApplePush': return DeviceTokenApplePush.fromJson(newJson);
case 'deviceTokenApplePushVoIP': return DeviceTokenApplePushVoIP.fromJson(newJson);
case 'deviceTokenWindowsPush': return DeviceTokenWindowsPush.fromJson(newJson);
case 'deviceTokenMicrosoftPush': return DeviceTokenMicrosoftPush.fromJson(newJson);
case 'deviceTokenMicrosoftPushVoIP': return DeviceTokenMicrosoftPushVoIP.fromJson(newJson);
case 'deviceTokenWebPush': return DeviceTokenWebPush.fromJson(newJson);
case 'deviceTokenSimplePush': return DeviceTokenSimplePush.fromJson(newJson);
case 'deviceTokenUbuntuPush': return DeviceTokenUbuntuPush.fromJson(newJson);
case 'deviceTokenBlackBerryPush': return DeviceTokenBlackBerryPush.fromJson(newJson);
case 'deviceTokenTizenPush': return DeviceTokenTizenPush.fromJson(newJson);
case 'pushReceiverId': return PushReceiverId.fromJson(newJson);
case 'backgroundFill': return BackgroundFill.fromJson(newJson);
case 'backgroundFillSolid': return BackgroundFillSolid.fromJson(newJson);
case 'backgroundFillGradient': return BackgroundFillGradient.fromJson(newJson);
case 'backgroundFillFreeformGradient': return BackgroundFillFreeformGradient.fromJson(newJson);
case 'backgroundType': return BackgroundType.fromJson(newJson);
case 'backgroundTypeWallpaper': return BackgroundTypeWallpaper.fromJson(newJson);
case 'backgroundTypePattern': return BackgroundTypePattern.fromJson(newJson);
case 'backgroundTypeFill': return BackgroundTypeFill.fromJson(newJson);
case 'background': return Background.fromJson(newJson);
case 'backgrounds': return Backgrounds.fromJson(newJson);
case 'inputBackground': return InputBackground.fromJson(newJson);
case 'inputBackgroundLocal': return InputBackgroundLocal.fromJson(newJson);
case 'inputBackgroundRemote': return InputBackgroundRemote.fromJson(newJson);
case 'themeSettings': return ThemeSettings.fromJson(newJson);
case 'chatTheme': return ChatTheme.fromJson(newJson);
case 'hashtags': return Hashtags.fromJson(newJson);
case 'canTransferOwnershipResult': return CanTransferOwnershipResult.fromJson(newJson);
case 'canTransferOwnershipResultOk': return CanTransferOwnershipResultOk.fromJson(newJson);
case 'canTransferOwnershipResultPasswordNeeded': return CanTransferOwnershipResultPasswordNeeded.fromJson(newJson);
case 'canTransferOwnershipResultPasswordTooFresh': return CanTransferOwnershipResultPasswordTooFresh.fromJson(newJson);
case 'canTransferOwnershipResultSessionTooFresh': return CanTransferOwnershipResultSessionTooFresh.fromJson(newJson);
case 'checkChatUsernameResult': return CheckChatUsernameResult.fromJson(newJson);
case 'checkChatUsernameResultOk': return CheckChatUsernameResultOk.fromJson(newJson);
case 'checkChatUsernameResultUsernameInvalid': return CheckChatUsernameResultUsernameInvalid.fromJson(newJson);
case 'checkChatUsernameResultUsernameOccupied': return CheckChatUsernameResultUsernameOccupied.fromJson(newJson);
case 'checkChatUsernameResultPublicChatsTooMuch': return CheckChatUsernameResultPublicChatsTooMuch.fromJson(newJson);
case 'checkChatUsernameResultPublicGroupsUnavailable': return CheckChatUsernameResultPublicGroupsUnavailable.fromJson(newJson);
case 'checkStickerSetNameResult': return CheckStickerSetNameResult.fromJson(newJson);
case 'checkStickerSetNameResultOk': return CheckStickerSetNameResultOk.fromJson(newJson);
case 'checkStickerSetNameResultNameInvalid': return CheckStickerSetNameResultNameInvalid.fromJson(newJson);
case 'checkStickerSetNameResultNameOccupied': return CheckStickerSetNameResultNameOccupied.fromJson(newJson);
case 'resetPasswordResult': return ResetPasswordResult.fromJson(newJson);
case 'resetPasswordResultOk': return ResetPasswordResultOk.fromJson(newJson);
case 'resetPasswordResultPending': return ResetPasswordResultPending.fromJson(newJson);
case 'resetPasswordResultDeclined': return ResetPasswordResultDeclined.fromJson(newJson);
case 'messageFileType': return MessageFileType.fromJson(newJson);
case 'messageFileTypePrivate': return MessageFileTypePrivate.fromJson(newJson);
case 'messageFileTypeGroup': return MessageFileTypeGroup.fromJson(newJson);
case 'messageFileTypeUnknown': return MessageFileTypeUnknown.fromJson(newJson);
case 'pushMessageContent': return PushMessageContent.fromJson(newJson);
case 'pushMessageContentHidden': return PushMessageContentHidden.fromJson(newJson);
case 'pushMessageContentAnimation': return PushMessageContentAnimation.fromJson(newJson);
case 'pushMessageContentAudio': return PushMessageContentAudio.fromJson(newJson);
case 'pushMessageContentContact': return PushMessageContentContact.fromJson(newJson);
case 'pushMessageContentContactRegistered': return PushMessageContentContactRegistered.fromJson(newJson);
case 'pushMessageContentDocument': return PushMessageContentDocument.fromJson(newJson);
case 'pushMessageContentGame': return PushMessageContentGame.fromJson(newJson);
case 'pushMessageContentGameScore': return PushMessageContentGameScore.fromJson(newJson);
case 'pushMessageContentInvoice': return PushMessageContentInvoice.fromJson(newJson);
case 'pushMessageContentLocation': return PushMessageContentLocation.fromJson(newJson);
case 'pushMessageContentPhoto': return PushMessageContentPhoto.fromJson(newJson);
case 'pushMessageContentPoll': return PushMessageContentPoll.fromJson(newJson);
case 'pushMessageContentScreenshotTaken': return PushMessageContentScreenshotTaken.fromJson(newJson);
case 'pushMessageContentSticker': return PushMessageContentSticker.fromJson(newJson);
case 'pushMessageContentText': return PushMessageContentText.fromJson(newJson);
case 'pushMessageContentVideo': return PushMessageContentVideo.fromJson(newJson);
case 'pushMessageContentVideoNote': return PushMessageContentVideoNote.fromJson(newJson);
case 'pushMessageContentVoiceNote': return PushMessageContentVoiceNote.fromJson(newJson);
case 'pushMessageContentBasicGroupChatCreate': return PushMessageContentBasicGroupChatCreate.fromJson(newJson);
case 'pushMessageContentChatAddMembers': return PushMessageContentChatAddMembers.fromJson(newJson);
case 'pushMessageContentChatChangePhoto': return PushMessageContentChatChangePhoto.fromJson(newJson);
case 'pushMessageContentChatChangeTitle': return PushMessageContentChatChangeTitle.fromJson(newJson);
case 'pushMessageContentChatSetTheme': return PushMessageContentChatSetTheme.fromJson(newJson);
case 'pushMessageContentChatDeleteMember': return PushMessageContentChatDeleteMember.fromJson(newJson);
case 'pushMessageContentChatJoinByLink': return PushMessageContentChatJoinByLink.fromJson(newJson);
case 'pushMessageContentChatJoinByRequest': return PushMessageContentChatJoinByRequest.fromJson(newJson);
case 'pushMessageContentMessageForwards': return PushMessageContentMessageForwards.fromJson(newJson);
case 'pushMessageContentMediaAlbum': return PushMessageContentMediaAlbum.fromJson(newJson);
case 'notificationType': return NotificationType.fromJson(newJson);
case 'notificationTypeNewMessage': return NotificationTypeNewMessage.fromJson(newJson);
case 'notificationTypeNewSecretChat': return NotificationTypeNewSecretChat.fromJson(newJson);
case 'notificationTypeNewCall': return NotificationTypeNewCall.fromJson(newJson);
case 'notificationTypeNewPushMessage': return NotificationTypeNewPushMessage.fromJson(newJson);
case 'notificationGroupType': return NotificationGroupType.fromJson(newJson);
case 'notificationGroupTypeMessages': return NotificationGroupTypeMessages.fromJson(newJson);
case 'notificationGroupTypeMentions': return NotificationGroupTypeMentions.fromJson(newJson);
case 'notificationGroupTypeSecretChat': return NotificationGroupTypeSecretChat.fromJson(newJson);
case 'notificationGroupTypeCalls': return NotificationGroupTypeCalls.fromJson(newJson);
case 'notification': return Notification.fromJson(newJson);
case 'notificationGroup': return NotificationGroup.fromJson(newJson);
case 'optionValue': return OptionValue.fromJson(newJson);
case 'optionValueBoolean': return OptionValueBoolean.fromJson(newJson);
case 'optionValueEmpty': return OptionValueEmpty.fromJson(newJson);
case 'optionValueInteger': return OptionValueInteger.fromJson(newJson);
case 'optionValueString': return OptionValueString.fromJson(newJson);
case 'jsonObjectMember': return JsonObjectMember.fromJson(newJson);
case 'jsonValue': return JsonValue.fromJson(newJson);
case 'jsonValueNull': return JsonValueNull.fromJson(newJson);
case 'jsonValueBoolean': return JsonValueBoolean.fromJson(newJson);
case 'jsonValueNumber': return JsonValueNumber.fromJson(newJson);
case 'jsonValueString': return JsonValueString.fromJson(newJson);
case 'jsonValueArray': return JsonValueArray.fromJson(newJson);
case 'jsonValueObject': return JsonValueObject.fromJson(newJson);
case 'userPrivacySettingRule': return UserPrivacySettingRule.fromJson(newJson);
case 'userPrivacySettingRuleAllowAll': return UserPrivacySettingRuleAllowAll.fromJson(newJson);
case 'userPrivacySettingRuleAllowContacts': return UserPrivacySettingRuleAllowContacts.fromJson(newJson);
case 'userPrivacySettingRuleAllowUsers': return UserPrivacySettingRuleAllowUsers.fromJson(newJson);
case 'userPrivacySettingRuleAllowChatMembers': return UserPrivacySettingRuleAllowChatMembers.fromJson(newJson);
case 'userPrivacySettingRuleRestrictAll': return UserPrivacySettingRuleRestrictAll.fromJson(newJson);
case 'userPrivacySettingRuleRestrictContacts': return UserPrivacySettingRuleRestrictContacts.fromJson(newJson);
case 'userPrivacySettingRuleRestrictUsers': return UserPrivacySettingRuleRestrictUsers.fromJson(newJson);
case 'userPrivacySettingRuleRestrictChatMembers': return UserPrivacySettingRuleRestrictChatMembers.fromJson(newJson);
case 'userPrivacySettingRules': return UserPrivacySettingRules.fromJson(newJson);
case 'userPrivacySetting': return UserPrivacySetting.fromJson(newJson);
case 'userPrivacySettingShowStatus': return UserPrivacySettingShowStatus.fromJson(newJson);
case 'userPrivacySettingShowProfilePhoto': return UserPrivacySettingShowProfilePhoto.fromJson(newJson);
case 'userPrivacySettingShowLinkInForwardedMessages': return UserPrivacySettingShowLinkInForwardedMessages.fromJson(newJson);
case 'userPrivacySettingShowPhoneNumber': return UserPrivacySettingShowPhoneNumber.fromJson(newJson);
case 'userPrivacySettingAllowChatInvites': return UserPrivacySettingAllowChatInvites.fromJson(newJson);
case 'userPrivacySettingAllowCalls': return UserPrivacySettingAllowCalls.fromJson(newJson);
case 'userPrivacySettingAllowPeerToPeerCalls': return UserPrivacySettingAllowPeerToPeerCalls.fromJson(newJson);
case 'userPrivacySettingAllowFindingByPhoneNumber': return UserPrivacySettingAllowFindingByPhoneNumber.fromJson(newJson);
case 'accountTtl': return AccountTtl.fromJson(newJson);
case 'session': return Session.fromJson(newJson);
case 'sessions': return Sessions.fromJson(newJson);
case 'connectedWebsite': return ConnectedWebsite.fromJson(newJson);
case 'connectedWebsites': return ConnectedWebsites.fromJson(newJson);
case 'chatReportReason': return ChatReportReason.fromJson(newJson);
case 'chatReportReasonSpam': return ChatReportReasonSpam.fromJson(newJson);
case 'chatReportReasonViolence': return ChatReportReasonViolence.fromJson(newJson);
case 'chatReportReasonPornography': return ChatReportReasonPornography.fromJson(newJson);
case 'chatReportReasonChildAbuse': return ChatReportReasonChildAbuse.fromJson(newJson);
case 'chatReportReasonCopyright': return ChatReportReasonCopyright.fromJson(newJson);
case 'chatReportReasonUnrelatedLocation': return ChatReportReasonUnrelatedLocation.fromJson(newJson);
case 'chatReportReasonFake': return ChatReportReasonFake.fromJson(newJson);
case 'chatReportReasonCustom': return ChatReportReasonCustom.fromJson(newJson);
case 'internalLinkType': return InternalLinkType.fromJson(newJson);
case 'internalLinkTypeActiveSessions': return InternalLinkTypeActiveSessions.fromJson(newJson);
case 'internalLinkTypeAuthenticationCode': return InternalLinkTypeAuthenticationCode.fromJson(newJson);
case 'internalLinkTypeBackground': return InternalLinkTypeBackground.fromJson(newJson);
case 'internalLinkTypeBotStart': return InternalLinkTypeBotStart.fromJson(newJson);
case 'internalLinkTypeBotStartInGroup': return InternalLinkTypeBotStartInGroup.fromJson(newJson);
case 'internalLinkTypeChangePhoneNumber': return InternalLinkTypeChangePhoneNumber.fromJson(newJson);
case 'internalLinkTypeChatInvite': return InternalLinkTypeChatInvite.fromJson(newJson);
case 'internalLinkTypeFilterSettings': return InternalLinkTypeFilterSettings.fromJson(newJson);
case 'internalLinkTypeGame': return InternalLinkTypeGame.fromJson(newJson);
case 'internalLinkTypeLanguagePack': return InternalLinkTypeLanguagePack.fromJson(newJson);
case 'internalLinkTypeMessage': return InternalLinkTypeMessage.fromJson(newJson);
case 'internalLinkTypeMessageDraft': return InternalLinkTypeMessageDraft.fromJson(newJson);
case 'internalLinkTypePassportDataRequest': return InternalLinkTypePassportDataRequest.fromJson(newJson);
case 'internalLinkTypePhoneNumberConfirmation': return InternalLinkTypePhoneNumberConfirmation.fromJson(newJson);
case 'internalLinkTypeProxy': return InternalLinkTypeProxy.fromJson(newJson);
case 'internalLinkTypePublicChat': return InternalLinkTypePublicChat.fromJson(newJson);
case 'internalLinkTypeQrCodeAuthentication': return InternalLinkTypeQrCodeAuthentication.fromJson(newJson);
case 'internalLinkTypeSettings': return InternalLinkTypeSettings.fromJson(newJson);
case 'internalLinkTypeStickerSet': return InternalLinkTypeStickerSet.fromJson(newJson);
case 'internalLinkTypeTheme': return InternalLinkTypeTheme.fromJson(newJson);
case 'internalLinkTypeThemeSettings': return InternalLinkTypeThemeSettings.fromJson(newJson);
case 'internalLinkTypeUnknownDeepLink': return InternalLinkTypeUnknownDeepLink.fromJson(newJson);
case 'internalLinkTypeUnsupportedProxy': return InternalLinkTypeUnsupportedProxy.fromJson(newJson);
case 'internalLinkTypeVideoChat': return InternalLinkTypeVideoChat.fromJson(newJson);
case 'messageLink': return MessageLink.fromJson(newJson);
case 'messageLinkInfo': return MessageLinkInfo.fromJson(newJson);
case 'filePart': return FilePart.fromJson(newJson);
case 'fileType': return FileType.fromJson(newJson);
case 'fileTypeNone': return FileTypeNone.fromJson(newJson);
case 'fileTypeAnimation': return FileTypeAnimation.fromJson(newJson);
case 'fileTypeAudio': return FileTypeAudio.fromJson(newJson);
case 'fileTypeDocument': return FileTypeDocument.fromJson(newJson);
case 'fileTypePhoto': return FileTypePhoto.fromJson(newJson);
case 'fileTypeProfilePhoto': return FileTypeProfilePhoto.fromJson(newJson);
case 'fileTypeSecret': return FileTypeSecret.fromJson(newJson);
case 'fileTypeSecretThumbnail': return FileTypeSecretThumbnail.fromJson(newJson);
case 'fileTypeSecure': return FileTypeSecure.fromJson(newJson);
case 'fileTypeSticker': return FileTypeSticker.fromJson(newJson);
case 'fileTypeThumbnail': return FileTypeThumbnail.fromJson(newJson);
case 'fileTypeUnknown': return FileTypeUnknown.fromJson(newJson);
case 'fileTypeVideo': return FileTypeVideo.fromJson(newJson);
case 'fileTypeVideoNote': return FileTypeVideoNote.fromJson(newJson);
case 'fileTypeVoiceNote': return FileTypeVoiceNote.fromJson(newJson);
case 'fileTypeWallpaper': return FileTypeWallpaper.fromJson(newJson);
case 'storageStatisticsByFileType': return StorageStatisticsByFileType.fromJson(newJson);
case 'storageStatisticsByChat': return StorageStatisticsByChat.fromJson(newJson);
case 'storageStatistics': return StorageStatistics.fromJson(newJson);
case 'storageStatisticsFast': return StorageStatisticsFast.fromJson(newJson);
case 'databaseStatistics': return DatabaseStatistics.fromJson(newJson);
case 'networkType': return NetworkType.fromJson(newJson);
case 'networkTypeNone': return NetworkTypeNone.fromJson(newJson);
case 'networkTypeMobile': return NetworkTypeMobile.fromJson(newJson);
case 'networkTypeMobileRoaming': return NetworkTypeMobileRoaming.fromJson(newJson);
case 'networkTypeWiFi': return NetworkTypeWiFi.fromJson(newJson);
case 'networkTypeOther': return NetworkTypeOther.fromJson(newJson);
case 'networkStatisticsEntry': return NetworkStatisticsEntry.fromJson(newJson);
case 'networkStatisticsEntryFile': return NetworkStatisticsEntryFile.fromJson(newJson);
case 'networkStatisticsEntryCall': return NetworkStatisticsEntryCall.fromJson(newJson);
case 'networkStatistics': return NetworkStatistics.fromJson(newJson);
case 'autoDownloadSettings': return AutoDownloadSettings.fromJson(newJson);
case 'autoDownloadSettingsPresets': return AutoDownloadSettingsPresets.fromJson(newJson);
case 'connectionState': return ConnectionState.fromJson(newJson);
case 'connectionStateWaitingForNetwork': return ConnectionStateWaitingForNetwork.fromJson(newJson);
case 'connectionStateConnectingToProxy': return ConnectionStateConnectingToProxy.fromJson(newJson);
case 'connectionStateConnecting': return ConnectionStateConnecting.fromJson(newJson);
case 'connectionStateUpdating': return ConnectionStateUpdating.fromJson(newJson);
case 'connectionStateReady': return ConnectionStateReady.fromJson(newJson);
case 'topChatCategory': return TopChatCategory.fromJson(newJson);
case 'topChatCategoryUsers': return TopChatCategoryUsers.fromJson(newJson);
case 'topChatCategoryBots': return TopChatCategoryBots.fromJson(newJson);
case 'topChatCategoryGroups': return TopChatCategoryGroups.fromJson(newJson);
case 'topChatCategoryChannels': return TopChatCategoryChannels.fromJson(newJson);
case 'topChatCategoryInlineBots': return TopChatCategoryInlineBots.fromJson(newJson);
case 'topChatCategoryCalls': return TopChatCategoryCalls.fromJson(newJson);
case 'topChatCategoryForwardChats': return TopChatCategoryForwardChats.fromJson(newJson);
case 'tMeUrlType': return TMeUrlType.fromJson(newJson);
case 'tMeUrlTypeUser': return TMeUrlTypeUser.fromJson(newJson);
case 'tMeUrlTypeSupergroup': return TMeUrlTypeSupergroup.fromJson(newJson);
case 'tMeUrlTypeChatInvite': return TMeUrlTypeChatInvite.fromJson(newJson);
case 'tMeUrlTypeStickerSet': return TMeUrlTypeStickerSet.fromJson(newJson);
case 'tMeUrl': return TMeUrl.fromJson(newJson);
case 'tMeUrls': return TMeUrls.fromJson(newJson);
case 'suggestedAction': return SuggestedAction.fromJson(newJson);
case 'suggestedActionEnableArchiveAndMuteNewChats': return SuggestedActionEnableArchiveAndMuteNewChats.fromJson(newJson);
case 'suggestedActionCheckPassword': return SuggestedActionCheckPassword.fromJson(newJson);
case 'suggestedActionCheckPhoneNumber': return SuggestedActionCheckPhoneNumber.fromJson(newJson);
case 'suggestedActionViewChecksHint': return SuggestedActionViewChecksHint.fromJson(newJson);
case 'suggestedActionConvertToBroadcastGroup': return SuggestedActionConvertToBroadcastGroup.fromJson(newJson);
case 'suggestedActionSetPassword': return SuggestedActionSetPassword.fromJson(newJson);
case 'count': return Count.fromJson(newJson);
case 'text': return Text.fromJson(newJson);
case 'seconds': return Seconds.fromJson(newJson);
case 'deepLinkInfo': return DeepLinkInfo.fromJson(newJson);
case 'textParseMode': return TextParseMode.fromJson(newJson);
case 'textParseModeMarkdown': return TextParseModeMarkdown.fromJson(newJson);
case 'textParseModeHTML': return TextParseModeHTML.fromJson(newJson);
case 'proxyType': return ProxyType.fromJson(newJson);
case 'proxyTypeSocks5': return ProxyTypeSocks5.fromJson(newJson);
case 'proxyTypeHttp': return ProxyTypeHttp.fromJson(newJson);
case 'proxyTypeMtproto': return ProxyTypeMtproto.fromJson(newJson);
case 'proxy': return Proxy.fromJson(newJson);
case 'proxies': return Proxies.fromJson(newJson);
case 'inputSticker': return InputSticker.fromJson(newJson);
case 'inputStickerStatic': return InputStickerStatic.fromJson(newJson);
case 'inputStickerAnimated': return InputStickerAnimated.fromJson(newJson);
case 'dateRange': return DateRange.fromJson(newJson);
case 'statisticalValue': return StatisticalValue.fromJson(newJson);
case 'statisticalGraph': return StatisticalGraph.fromJson(newJson);
case 'statisticalGraphData': return StatisticalGraphData.fromJson(newJson);
case 'statisticalGraphAsync': return StatisticalGraphAsync.fromJson(newJson);
case 'statisticalGraphError': return StatisticalGraphError.fromJson(newJson);
case 'chatStatisticsMessageInteractionInfo': return ChatStatisticsMessageInteractionInfo.fromJson(newJson);
case 'chatStatisticsMessageSenderInfo': return ChatStatisticsMessageSenderInfo.fromJson(newJson);
case 'chatStatisticsAdministratorActionsInfo': return ChatStatisticsAdministratorActionsInfo.fromJson(newJson);
case 'chatStatisticsInviterInfo': return ChatStatisticsInviterInfo.fromJson(newJson);
case 'chatStatistics': return ChatStatistics.fromJson(newJson);
case 'chatStatisticsSupergroup': return ChatStatisticsSupergroup.fromJson(newJson);
case 'chatStatisticsChannel': return ChatStatisticsChannel.fromJson(newJson);
case 'messageStatistics': return MessageStatistics.fromJson(newJson);
case 'point': return Point.fromJson(newJson);
case 'vectorPathCommand': return VectorPathCommand.fromJson(newJson);
case 'vectorPathCommandLine': return VectorPathCommandLine.fromJson(newJson);
case 'vectorPathCommandCubicBezierCurve': return VectorPathCommandCubicBezierCurve.fromJson(newJson);
case 'botCommandScope': return BotCommandScope.fromJson(newJson);
case 'botCommandScopeDefault': return BotCommandScopeDefault.fromJson(newJson);
case 'botCommandScopeAllPrivateChats': return BotCommandScopeAllPrivateChats.fromJson(newJson);
case 'botCommandScopeAllGroupChats': return BotCommandScopeAllGroupChats.fromJson(newJson);
case 'botCommandScopeAllChatAdministrators': return BotCommandScopeAllChatAdministrators.fromJson(newJson);
case 'botCommandScopeChat': return BotCommandScopeChat.fromJson(newJson);
case 'botCommandScopeChatAdministrators': return BotCommandScopeChatAdministrators.fromJson(newJson);
case 'botCommandScopeChatMember': return BotCommandScopeChatMember.fromJson(newJson);
case 'update': return Update.fromJson(newJson);
case 'updateAuthorizationState': return UpdateAuthorizationState.fromJson(newJson);
case 'updateNewMessage': return UpdateNewMessage.fromJson(newJson);
case 'updateMessageSendAcknowledged': return UpdateMessageSendAcknowledged.fromJson(newJson);
case 'updateMessageSendSucceeded': return UpdateMessageSendSucceeded.fromJson(newJson);
case 'updateMessageSendFailed': return UpdateMessageSendFailed.fromJson(newJson);
case 'updateMessageContent': return UpdateMessageContent.fromJson(newJson);
case 'updateMessageEdited': return UpdateMessageEdited.fromJson(newJson);
case 'updateMessageIsPinned': return UpdateMessageIsPinned.fromJson(newJson);
case 'updateMessageInteractionInfo': return UpdateMessageInteractionInfo.fromJson(newJson);
case 'updateMessageContentOpened': return UpdateMessageContentOpened.fromJson(newJson);
case 'updateMessageMentionRead': return UpdateMessageMentionRead.fromJson(newJson);
case 'updateMessageLiveLocationViewed': return UpdateMessageLiveLocationViewed.fromJson(newJson);
case 'updateNewChat': return UpdateNewChat.fromJson(newJson);
case 'updateChatTitle': return UpdateChatTitle.fromJson(newJson);
case 'updateChatPhoto': return UpdateChatPhoto.fromJson(newJson);
case 'updateChatPermissions': return UpdateChatPermissions.fromJson(newJson);
case 'updateChatLastMessage': return UpdateChatLastMessage.fromJson(newJson);
case 'updateChatPosition': return UpdateChatPosition.fromJson(newJson);
case 'updateChatReadInbox': return UpdateChatReadInbox.fromJson(newJson);
case 'updateChatReadOutbox': return UpdateChatReadOutbox.fromJson(newJson);
case 'updateChatActionBar': return UpdateChatActionBar.fromJson(newJson);
case 'updateChatDraftMessage': return UpdateChatDraftMessage.fromJson(newJson);
case 'updateChatMessageSender': return UpdateChatMessageSender.fromJson(newJson);
case 'updateChatMessageTtl': return UpdateChatMessageTtl.fromJson(newJson);
case 'updateChatNotificationSettings': return UpdateChatNotificationSettings.fromJson(newJson);
case 'updateChatPendingJoinRequests': return UpdateChatPendingJoinRequests.fromJson(newJson);
case 'updateChatReplyMarkup': return UpdateChatReplyMarkup.fromJson(newJson);
case 'updateChatTheme': return UpdateChatTheme.fromJson(newJson);
case 'updateChatUnreadMentionCount': return UpdateChatUnreadMentionCount.fromJson(newJson);
case 'updateChatVideoChat': return UpdateChatVideoChat.fromJson(newJson);
case 'updateChatDefaultDisableNotification': return UpdateChatDefaultDisableNotification.fromJson(newJson);
case 'updateChatHasProtectedContent': return UpdateChatHasProtectedContent.fromJson(newJson);
case 'updateChatHasScheduledMessages': return UpdateChatHasScheduledMessages.fromJson(newJson);
case 'updateChatIsBlocked': return UpdateChatIsBlocked.fromJson(newJson);
case 'updateChatIsMarkedAsUnread': return UpdateChatIsMarkedAsUnread.fromJson(newJson);
case 'updateChatFilters': return UpdateChatFilters.fromJson(newJson);
case 'updateChatOnlineMemberCount': return UpdateChatOnlineMemberCount.fromJson(newJson);
case 'updateScopeNotificationSettings': return UpdateScopeNotificationSettings.fromJson(newJson);
case 'updateNotification': return UpdateNotification.fromJson(newJson);
case 'updateNotificationGroup': return UpdateNotificationGroup.fromJson(newJson);
case 'updateActiveNotifications': return UpdateActiveNotifications.fromJson(newJson);
case 'updateHavePendingNotifications': return UpdateHavePendingNotifications.fromJson(newJson);
case 'updateDeleteMessages': return UpdateDeleteMessages.fromJson(newJson);
case 'updateChatAction': return UpdateChatAction.fromJson(newJson);
case 'updateUserStatus': return UpdateUserStatus.fromJson(newJson);
case 'updateUser': return UpdateUser.fromJson(newJson);
case 'updateBasicGroup': return UpdateBasicGroup.fromJson(newJson);
case 'updateSupergroup': return UpdateSupergroup.fromJson(newJson);
case 'updateSecretChat': return UpdateSecretChat.fromJson(newJson);
case 'updateUserFullInfo': return UpdateUserFullInfo.fromJson(newJson);
case 'updateBasicGroupFullInfo': return UpdateBasicGroupFullInfo.fromJson(newJson);
case 'updateSupergroupFullInfo': return UpdateSupergroupFullInfo.fromJson(newJson);
case 'updateServiceNotification': return UpdateServiceNotification.fromJson(newJson);
case 'updateFile': return UpdateFile.fromJson(newJson);
case 'updateFileGenerationStart': return UpdateFileGenerationStart.fromJson(newJson);
case 'updateFileGenerationStop': return UpdateFileGenerationStop.fromJson(newJson);
case 'updateCall': return UpdateCall.fromJson(newJson);
case 'updateGroupCall': return UpdateGroupCall.fromJson(newJson);
case 'updateGroupCallParticipant': return UpdateGroupCallParticipant.fromJson(newJson);
case 'updateNewCallSignalingData': return UpdateNewCallSignalingData.fromJson(newJson);
case 'updateUserPrivacySettingRules': return UpdateUserPrivacySettingRules.fromJson(newJson);
case 'updateUnreadMessageCount': return UpdateUnreadMessageCount.fromJson(newJson);
case 'updateUnreadChatCount': return UpdateUnreadChatCount.fromJson(newJson);
case 'updateOption': return UpdateOption.fromJson(newJson);
case 'updateStickerSet': return UpdateStickerSet.fromJson(newJson);
case 'updateInstalledStickerSets': return UpdateInstalledStickerSets.fromJson(newJson);
case 'updateTrendingStickerSets': return UpdateTrendingStickerSets.fromJson(newJson);
case 'updateRecentStickers': return UpdateRecentStickers.fromJson(newJson);
case 'updateFavoriteStickers': return UpdateFavoriteStickers.fromJson(newJson);
case 'updateSavedAnimations': return UpdateSavedAnimations.fromJson(newJson);
case 'updateSelectedBackground': return UpdateSelectedBackground.fromJson(newJson);
case 'updateChatThemes': return UpdateChatThemes.fromJson(newJson);
case 'updateLanguagePackStrings': return UpdateLanguagePackStrings.fromJson(newJson);
case 'updateConnectionState': return UpdateConnectionState.fromJson(newJson);
case 'updateTermsOfService': return UpdateTermsOfService.fromJson(newJson);
case 'updateUsersNearby': return UpdateUsersNearby.fromJson(newJson);
case 'updateDiceEmojis': return UpdateDiceEmojis.fromJson(newJson);
case 'updateAnimatedEmojiMessageClicked': return UpdateAnimatedEmojiMessageClicked.fromJson(newJson);
case 'updateAnimationSearchParameters': return UpdateAnimationSearchParameters.fromJson(newJson);
case 'updateSuggestedActions': return UpdateSuggestedActions.fromJson(newJson);
case 'updateNewInlineQuery': return UpdateNewInlineQuery.fromJson(newJson);
case 'updateNewChosenInlineResult': return UpdateNewChosenInlineResult.fromJson(newJson);
case 'updateNewCallbackQuery': return UpdateNewCallbackQuery.fromJson(newJson);
case 'updateNewInlineCallbackQuery': return UpdateNewInlineCallbackQuery.fromJson(newJson);
case 'updateNewShippingQuery': return UpdateNewShippingQuery.fromJson(newJson);
case 'updateNewPreCheckoutQuery': return UpdateNewPreCheckoutQuery.fromJson(newJson);
case 'updateNewCustomEvent': return UpdateNewCustomEvent.fromJson(newJson);
case 'updateNewCustomQuery': return UpdateNewCustomQuery.fromJson(newJson);
case 'updatePoll': return UpdatePoll.fromJson(newJson);
case 'updatePollAnswer': return UpdatePollAnswer.fromJson(newJson);
case 'updateChatMember': return UpdateChatMember.fromJson(newJson);
case 'updateNewChatJoinRequest': return UpdateNewChatJoinRequest.fromJson(newJson);
case 'updates': return Updates.fromJson(newJson);
case 'logStream': return LogStream.fromJson(newJson);
case 'logStreamDefault': return LogStreamDefault.fromJson(newJson);
case 'logStreamFile': return LogStreamFile.fromJson(newJson);
case 'logStreamEmpty': return LogStreamEmpty.fromJson(newJson);
case 'logVerbosityLevel': return LogVerbosityLevel.fromJson(newJson);
case 'logTags': return LogTags.fromJson(newJson);
case 'testInt': return TestInt.fromJson(newJson);
case 'testString': return TestString.fromJson(newJson);
case 'testBytes': return TestBytes.fromJson(newJson);
case 'testVectorInt': return TestVectorInt.fromJson(newJson);
case 'testVectorIntObject': return TestVectorIntObject.fromJson(newJson);
case 'testVectorString': return TestVectorString.fromJson(newJson);
case 'testVectorStringObject': return TestVectorStringObject.fromJson(newJson);
default: return null;
}
}
| 65.365479 | 133 | 0.823484 |
41d3b22f8f513cf15036ca069ca3131b81ea3cb3 | 9,571 | h | C | inc/Type/Queue.h | po2xel/vkpp | 04cf67cefa4e967fc234378da06366d66447c335 | [
"MIT"
] | 5 | 2017-04-05T13:29:40.000Z | 2018-04-10T21:04:51.000Z | inc/Type/Queue.h | po2xel/vkpp | 04cf67cefa4e967fc234378da06366d66447c335 | [
"MIT"
] | null | null | null | inc/Type/Queue.h | po2xel/vkpp | 04cf67cefa4e967fc234378da06366d66447c335 | [
"MIT"
] | null | null | null | #ifndef __VKPP_TYPE_QUEUE_H__
#define __VKPP_TYPE_QUEUE_H__
#include <initializer_list>
#include <Info/Common.h>
#include <Info/PipelineStage.h>
#include <Type/Fence.h>
#include <Type/Semaphore.h>
#include <Type/CommandBuffer.h>
#include <Type/Swapchain.h>
namespace vkpp
{
class SubmitInfo : public internal::VkTrait<SubmitInfo, VkSubmitInfo>
{
private:
const internal::Structure sType = internal::Structure::eSubmitInfo;
SubmitInfo(const Semaphore&, PipelineStageFlags&&, CommandBuffer&, Semaphore&) noexcept = delete;
SubmitInfo& SetWaitSemaphore(const Semaphore&, PipelineStageFlags&&) noexcept = delete;
SubmitInfo& SetCommandBuffer(CommandBuffer&&) noexcept = delete;
SubmitInfo& SetSignalSemaphore(Semaphore&&) noexcept = delete;
public:
const void* pNext{ nullptr };
uint32_t waitSemaphoreCount{ 0 };
const Semaphore* pWaitSemaphores{ nullptr };
const PipelineStageFlags* pWaitDstStageMask{ nullptr };
uint32_t commandBufferCount{ 0 };
const CommandBuffer* pCommandBuffers{ nullptr };
uint32_t signalSemaphoreCount{ 0 };
const Semaphore* pSignalSemaphores{ nullptr };
DEFINE_CLASS_MEMBER(SubmitInfo)
SubmitInfo(uint32_t aWaitSemaphoreCount, const Semaphore* apWaitSemaphores, const PipelineStageFlags* apWaitDstStageMask,
uint32_t aCommandBufferCount, const CommandBuffer* apCommandBuffers, uint32_t aSignalSemaphoreCount = 0, const Semaphore* apSignalSemaphores = nullptr) noexcept
: waitSemaphoreCount(aWaitSemaphoreCount), pWaitSemaphores(apWaitSemaphores), pWaitDstStageMask(apWaitDstStageMask),
commandBufferCount(aCommandBufferCount), pCommandBuffers(apCommandBuffers), signalSemaphoreCount(aSignalSemaphoreCount), pSignalSemaphores(apSignalSemaphores)
{}
SubmitInfo(const Semaphore& aWaitSemaphore, const PipelineStageFlags& aWaitDstStageMask, const CommandBuffer& aCommandBuffer, const Semaphore& aSignalSemaphore) noexcept
: SubmitInfo(1, aWaitSemaphore.AddressOf(), &aWaitDstStageMask, 1, aCommandBuffer.AddressOf(), 1, aSignalSemaphore.AddressOf())
{}
template <typename C, typename = EnableIfValueType<ValueType<C>, CommandBuffer>>
explicit SubmitInfo(C&& aCommandBuffers) noexcept : commandBufferCount(SizeOf<uint32_t>(aCommandBuffers)), pCommandBuffers(DataOf(aCommandBuffers))
{
StaticLValueRefAssert(C, aCommandBuffers);
}
SubmitInfo(const CommandBuffer& aCommandBuffer) noexcept : commandBufferCount(1), pCommandBuffers(aCommandBuffer.AddressOf())
{}
SubmitInfo& SetNext(const void* apNext) noexcept
{
pNext = apNext;
return *this;
}
SubmitInfo& SetWaitSemaphores(uint32_t aWaitSemaphoreCount, const Semaphore* apWaitSemaphores, const PipelineStageFlags* apWaitDstStageMask) noexcept
{
waitSemaphoreCount = aWaitSemaphoreCount;
pWaitSemaphores = apWaitSemaphores;
pWaitDstStageMask = apWaitDstStageMask;
return *this;
}
SubmitInfo& SetWaitSemaphore(const Semaphore& aWaitSemaphore, const PipelineStageFlags& aWaitDstStageMask) noexcept
{
return SetWaitSemaphores(1, aWaitSemaphore.AddressOf(), &aWaitDstStageMask);
}
template <typename S, typename F, typename = EnableIfValueType<ValueType<S>, Semaphore, ValueType<F>, PipelineStageFlags>>
SubmitInfo& SetWaitSemaphores(S&& aWaitSemaphores, F&& aWaitDstStageMasks)
{
static_assert(SizeOf<uint32_t>(aWaitSemaphores) <= SizeOf<uint32_t>(aWaitDstStageMasks));
return SetWaitSemaphores(SizeOf<uint32_t>(aWaitSemaphores), DataOf(aWaitSemaphores), DataOf(aWaitDstStageMasks));
}
SubmitInfo& ClearWaitSemaphores(void) noexcept
{
return SetWaitSemaphores(0, nullptr, nullptr);
}
SubmitInfo& SetCommandBuffers(uint32_t aCommandBufferCount, const CommandBuffer* apCommandBuffers) noexcept
{
commandBufferCount = aCommandBufferCount;
pCommandBuffers = apCommandBuffers;
return *this;
}
SubmitInfo& SetCommandBuffer(const CommandBuffer& aCommandBuffer) noexcept
{
return SetCommandBuffers(1, aCommandBuffer.AddressOf());
}
template <typename C, typename = EnableIfValueType<ValueType<C>, CommandBuffer>>
SubmitInfo& SetCommandBuffers(C&& aCommandBuffers) noexcept
{
StaticLValueRefAssert(C, aCommandBuffers);
return SetCommandBuffers(SizeOf<uint32_t>(aCommandBuffers), DataOf(aCommandBuffers));
}
SubmitInfo& SetSignalSemaphores(uint32_t aSignalSemaphoreCount, const Semaphore* apSignalSemaphores) noexcept
{
signalSemaphoreCount = aSignalSemaphoreCount;
pSignalSemaphores = apSignalSemaphores;
return *this;
}
SubmitInfo& SetSignalSemaphore(const Semaphore& aSignalSemaphore) noexcept
{
return SetSignalSemaphores(1, aSignalSemaphore.AddressOf());
}
template <typename S, typename = EnableIfValueType<ValueType<S>, Semaphore>>
SubmitInfo& SetSignalSemaphores(S&& aSignalSemaphores) noexcept
{
StaticLValueRefAssert(S, aSignalSemaphores);
return SetSignalSemaphores(SizeOf<uint32_t>(aSignalSemaphores), DataOf(aSignalSemaphores));
}
SubmitInfo& ClearSignalSemaphores(void) noexcept
{
return SetSignalSemaphores(0, nullptr);
}
};
ConsistencyCheck(SubmitInfo, pNext, waitSemaphoreCount, pWaitSemaphores, pWaitDstStageMask, commandBufferCount, pCommandBuffers, signalSemaphoreCount, pSignalSemaphores)
namespace khr
{
class PresentInfo : public internal::VkTrait<PresentInfo, VkPresentInfoKHR>
{
private:
const internal::Structure sType = internal::Structure::ePresent;
public:
const void* pNext{ nullptr };
uint32_t waitSemaphoreCount{ 0 };
const Semaphore* pWaitSemaphores{ nullptr };
uint32_t swapchainCount{ 0 };
const Swapchain* pSwapchains{ nullptr };
const uint32_t* pImageIndices{ nullptr };
Result* pResults{ nullptr };
DEFINE_CLASS_MEMBER(PresentInfo)
PresentInfo(uint32_t aWaitSemaphoreCount, const Semaphore* apWaitSemaphores,
uint32_t aSwapchainCount, const Swapchain* apSwapchains, const uint32_t* apImageIndices, Result* apResults = nullptr) noexcept
: waitSemaphoreCount(aWaitSemaphoreCount), pWaitSemaphores(apWaitSemaphores),
swapchainCount(aSwapchainCount), pSwapchains(apSwapchains), pImageIndices(apImageIndices), pResults(apResults)
{}
PresentInfo& SetNext(const void* apNext) noexcept
{
pNext = apNext;
return *this;
}
PresentInfo& SetWaitSemaphores(uint32_t aWaitSemaphoreCount, const Semaphore* apWaitSemaphores) noexcept
{
waitSemaphoreCount = aWaitSemaphoreCount;
pWaitSemaphores = apWaitSemaphores;
return *this;
}
template <typename S, typename = EnableIfValueType<ValueType<S>, Semaphore>>
PresentInfo& SetWaitSemaphores(S&& aWaitSemaphores) noexcept
{
StaticLValueRefAssert(S, aWaitSemaphores);
return SetWaitSemaphores(SizeOf<uint32_t>(aWaitSemaphores), DataOf(aWaitSemaphores));
}
PresentInfo& SetSwapchainImages(uint32_t aSwapchainCount, const Swapchain* apSwapchains, const uint32_t* apImageIndices, Result* apResults) noexcept
{
swapchainCount = aSwapchainCount;
pSwapchains = apSwapchains;
pImageIndices = apImageIndices;
pResults = apResults;
return *this;
}
// TODO: Container overload.
};
ConsistencyCheck(PresentInfo, pNext, waitSemaphoreCount, pWaitSemaphores, swapchainCount, pSwapchains, pImageIndices, pResults)
} // End of namespace khr.
class Queue : public internal::VkTrait<Queue, VkQueue>
{
private:
VkQueue mQueue{ VK_NULL_HANDLE };
public:
DEFINE_CLASS_MEMBER(Queue)
Queue(std::nullptr_t) noexcept
{}
explicit Queue(VkQueue aQueue) noexcept : mQueue(aQueue)
{}
VkResult Wait(void) const
{
return vkQueueWaitIdle(mQueue);
}
void Submit(const SubmitInfo& aSubmit) const
{
return Submit(1, aSubmit.AddressOf());
}
void Submit(const SubmitInfo& aSubmit, const Fence& aFence) const
{
return Submit(1, aSubmit.AddressOf(), aFence);
}
void Submit(uint32_t aSubmitCount, const SubmitInfo* apSubmits) const
{
assert(aSubmitCount != 0 && apSubmits != nullptr);
ThrowIfFailed(vkQueueSubmit(mQueue, aSubmitCount, &apSubmits[0], VK_NULL_HANDLE));
}
void Submit(uint32_t aSubmitCount, const SubmitInfo* apSubmits, const Fence& aFence) const
{
assert(aSubmitCount != 0 && apSubmits != nullptr);
ThrowIfFailed(vkQueueSubmit(mQueue, aSubmitCount, &apSubmits[0], aFence));
}
template <typename T, typename = EnableIfValueType<ValueType<T>, SubmitInfo>>
void Submit(T&& aSubmitInfos, const Fence& aFence) const
{
Submit(SizeOf<uint32_t>(aSubmitInfos), DataOf(aSubmitInfos), aFence);
}
void Submit(const std::initializer_list<SubmitInfo>& aSubmitInfos, const Fence& aFence) const
{
Submit(SizeOf<uint32_t>(aSubmitInfos), DataOf(aSubmitInfos), aFence);
}
void Present(const khr::PresentInfo& aPresentInfo) const
{
ThrowIfFailed(vkQueuePresentKHR(mQueue, &aPresentInfo));
}
};
StaticSizeCheck(Queue)
} // End of namespace vkpp.
#endif // __VKPP_TYPE_QUEUE_H__
| 32.890034 | 173 | 0.713823 |
13aefd3d83bef19ad347ccb2b72e6d4ab024332b | 12,134 | sql | SQL | ppid (2).sql | Fikri-mtwoo/ppid | f84ed25205e1fc0fb7109390a9185f1c12413322 | [
"MIT"
] | 2 | 2021-07-01T12:07:44.000Z | 2021-07-01T12:07:47.000Z | ppid (2).sql | Fikri-mtwoo/ppid | f84ed25205e1fc0fb7109390a9185f1c12413322 | [
"MIT"
] | 1 | 2021-08-25T05:51:36.000Z | 2021-08-25T05:51:36.000Z | ppid (2).sql | Fikri-mtwoo/ppid | f84ed25205e1fc0fb7109390a9185f1c12413322 | [
"MIT"
] | 2 | 2021-07-01T12:07:48.000Z | 2021-08-23T10:12:42.000Z | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 11 Jul 2021 pada 07.51
-- Versi server: 10.4.13-MariaDB
-- Versi PHP: 7.4.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `ppid`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `admin`
--
CREATE TABLE `admin` (
`id` int(100) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`level` int(100) NOT NULL,
`instansi` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `admin`
--
INSERT INTO `admin` (`id`, `username`, `password`, `level`, `instansi`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, 'Diskominfo');
-- --------------------------------------------------------
--
-- Struktur dari tabel `data_instansi`
--
CREATE TABLE `data_instansi` (
`id` int(11) NOT NULL,
`user_id` varchar(100) NOT NULL,
`katpem` text NOT NULL,
`info` varchar(255) NOT NULL,
`tujuan` int(200) NOT NULL,
`tujuan_ins` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `data_instansi`
--
INSERT INTO `data_instansi` (`id`, `user_id`, `katpem`, `info`, `tujuan`, `tujuan_ins`) VALUES
(17, '', '', '', 0, 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `db_dispu`
--
CREATE TABLE `db_dispu` (
`id` int(200) NOT NULL,
`user_id` int(100) NOT NULL,
`katpem` varchar(200) NOT NULL,
`info` varchar(100) NOT NULL,
`tujuan` varchar(200) NOT NULL,
`tujuan_ins` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `db_dispu`
--
INSERT INTO `db_dispu` (`id`, `user_id`, `katpem`, `info`, `tujuan`, `tujuan_ins`) VALUES
(20, 34, '4', 'mau minta info program disnaker', 'mau nyari tau loker', 1),
(21, 30, '1', 'profil dispu', 'pengen tau aja', 2);
-- --------------------------------------------------------
--
-- Struktur dari tabel `instansi`
--
CREATE TABLE `instansi` (
`id` int(11) NOT NULL,
`nama_instansi` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `instansi`
--
INSERT INTO `instansi` (`id`, `nama_instansi`) VALUES
(1, 'Disnaker (Dinas Tenaga Kerja)'),
(2, 'Dispu (Dinas Pekerja Umum)');
-- --------------------------------------------------------
--
-- Struktur dari tabel `kategori_pem`
--
CREATE TABLE `kategori_pem` (
`id` int(11) NOT NULL,
`katpem` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `kategori_pem`
--
INSERT INTO `kategori_pem` (`id`, `katpem`) VALUES
(1, 'Perorangan'),
(2, 'Instansi'),
(3, 'Mahasiswa'),
(4, 'Organisasi');
-- --------------------------------------------------------
--
-- Struktur dari tabel `pengajuan_informasi`
--
CREATE TABLE `pengajuan_informasi` (
`id` int(11) NOT NULL,
`user_id` int(200) NOT NULL,
`katpem` text NOT NULL,
`info` text NOT NULL,
`tujuan` text NOT NULL,
`tujuan_ins` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `pengajuan_informasi`
--
INSERT INTO `pengajuan_informasi` (`id`, `user_id`, `katpem`, `info`, `tujuan`, `tujuan_ins`) VALUES
(10, 30, '1', 'profil dispu', 'pengen tau aja', '2'),
(17, 34, '4', 'mau minta info program disnaker', 'mau nyari tau loker', '1');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`id_instansi` int(200) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(200) NOT NULL,
`image` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`role` int(11) NOT NULL,
`is_active` int(1) NOT NULL,
`date_created` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user`
--
INSERT INTO `user` (`id`, `id_instansi`, `name`, `email`, `image`, `password`, `role`, `is_active`, `date_created`) VALUES
(17, 0, 'Admin1', 'admin@gmail.com', 'logo.png', '$2y$10$PnpLtV5gf6M8L0bpMV10f.YYTAqTgF6CQ55Cit418nPb7ONb3YRtG', 1, 1, 1623830646),
(30, 0, 'aan abdul rohman', 'aanabdulrohman3@gmail.com', 'new.png', '$2y$10$jh/CDhSLiY6FArl8eWZegOLDtSgk6tY/e.rsgMZWgFX38kE2mruKW', 2, 1, 1624258447),
(31, 1, 'Disnaker (Dinas Tenaga Kerja)', 'admindisnaker@gmail.com', 'new.png', '$2y$10$i/IHF6Iz3JXmHYoTd.mbKe8vuluKf7ucrtIqdF1/JFq97XVeXpd96', 3, 1, 1624415392),
(32, 0, 'Admin diskominfo', 'admindiskominfo@gmail.com', 'new.png', '$2y$10$avOMknRWS5sw1c82Vk9t9eQqOhV2bDAE.vpz4XyZdToytsX5Fwuce', 4, 1, 1624416823),
(34, 0, 'rengginang', 'rengginangwalet@gmail.com', 'new.png', '$2y$10$njKAqAHdRihQ9CuuCzuff.qO/QwiPo8V.sbCnN.4qYoX/IHOBzQGq', 2, 1, 1625045388),
(35, 2, 'Dispu (Dinas Pekerja Umum)', 'admindispu@gmail.com', 'new.png', '$2y$10$lwo7qg9UcADhoaZcSJ5PLujzpFkYKyYO9D2N.dl1bUNEo2GRQ9eTC', 3, 1, 1625719204);
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_access_menu`
--
CREATE TABLE `user_access_menu` (
`id` int(11) NOT NULL,
`role` int(11) NOT NULL,
`menu_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_access_menu`
--
INSERT INTO `user_access_menu` (`id`, `role`, `menu_id`) VALUES
(1, 1, 1),
(3, 2, 2),
(4, 1, 3),
(8, 1, 4),
(9, 3, 4),
(11, 4, 9),
(13, 1, 9),
(14, 1, 5),
(15, 4, 5),
(16, 2, 10),
(17, 1, 2);
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_menu`
--
CREATE TABLE `user_menu` (
`id` int(11) NOT NULL,
`menu` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_menu`
--
INSERT INTO `user_menu` (`id`, `menu`) VALUES
(1, 'admin'),
(2, 'user'),
(3, 'menu'),
(4, 'instansi'),
(5, 'diskominfo');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_role`
--
CREATE TABLE `user_role` (
`id` int(11) NOT NULL,
`user_role` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_role`
--
INSERT INTO `user_role` (`id`, `user_role`) VALUES
(1, 'admin'),
(2, 'user'),
(3, 'instansi'),
(4, 'diskominfo');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_sub_menu`
--
CREATE TABLE `user_sub_menu` (
`id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL,
`title` varchar(200) NOT NULL,
`url` varchar(200) NOT NULL,
`icon` varchar(200) NOT NULL,
`is_active` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_sub_menu`
--
INSERT INTO `user_sub_menu` (`id`, `menu_id`, `title`, `url`, `icon`, `is_active`) VALUES
(1, 1, 'Dashboard', 'admin', 'fas fa-fw fa-tachometer-alt', 1),
(2, 2, 'My Profile', 'user/profile', 'fas fa-fw fa-user', 1),
(3, 2, 'Edit Profile', 'user/edit', 'fas fa-fw fa-user-edit', 1),
(4, 3, 'Menu management', 'menu', 'fas fa-fw fa-folder', 1),
(5, 3, 'Submenu Management', 'menu/submenu', 'fas fa-fw fa-folder-open', 1),
(12, 1, 'Role', 'admin/role', 'fas fa-fw fa-user-tie', 1),
(13, 2, 'Rubah Password', 'user/ubahpassword', 'fas fa-fw fa-key', 1),
(15, 4, 'Dashboard instansi', 'instansi', 'fas fa-fw fa-user-tie', 1),
(16, 5, 'Dashboard diskominfo', 'diskominfo', 'fas fa-fw fa-user-tie', 1),
(17, 2, 'Dashboard User', 'user', 'fas fa-fw fa-user-tie', 1),
(18, 5, 'Disposisi', 'diskominfo/disposisi', 'fas fa-fw fa-key', 1),
(19, 4, 'Input Data', 'instansi/inputdata', 'fas fa-fw fa-key', 1),
(20, 2, 'Permohonan', 'user/permohonan', 'fas fa-fw fa-user-tie', 1),
(21, 2, 'Informasi Anda', 'user/informasi', 'fas fa-fw fa-user-tie', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_token`
--
CREATE TABLE `user_token` (
`id` int(11) NOT NULL,
`email` varchar(100) NOT NULL,
`token` varchar(200) NOT NULL,
`date_created` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_token`
--
INSERT INTO `user_token` (`id`, `email`, `token`, `date_created`) VALUES
(14, 'aanabdulrohman3@gmail.com', 'NeoRojmZl0Fz2aKTcFw1OaZXMwQfVn/CO4SPTORK28U=', 1624262083),
(15, 'aanabdulrohman3@gmail.com', 'vzUmG12cnzDOKeZMubdXEH+htzND31d7lX07KVHIp5s=', 1624262788),
(16, 'aanabdulrohman3@gmail.com', 'G0VDspkaIrrwTYZO7gA8ZmFJQmK6wEQaVvhLcXATitI=', 1624262904),
(17, 'rengginangwalet@gmail.com', 'RigNQe2dJWNlY4c7DMzb4ikCt4LksjFOV/nierEbwCY=', 1624415392),
(18, 'admindiskominfo@gmail.com', 'EGYuoJ4qrU63MxQBkOjzSD081oEEwbAqUQrA6dI8PKM=', 1624416823),
(19, 'rengginangwalet@gmail.com', 'msIVqFhY4MR/G8SsINpZNYAY6tgtMOGWJ/upXorWyV8=', 1625045388),
(20, 'admindispu@gmail.com', 'F5qH/ZK2kB9zHk/4TJO0zd44XMPOEE5WqLpFm+crR4Y=', 1625719204);
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `data_instansi`
--
ALTER TABLE `data_instansi`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `db_dispu`
--
ALTER TABLE `db_dispu`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `instansi`
--
ALTER TABLE `instansi`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `kategori_pem`
--
ALTER TABLE `kategori_pem`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `pengajuan_informasi`
--
ALTER TABLE `pengajuan_informasi`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_access_menu`
--
ALTER TABLE `user_access_menu`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_menu`
--
ALTER TABLE `user_menu`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_role`
--
ALTER TABLE `user_role`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_sub_menu`
--
ALTER TABLE `user_sub_menu`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_token`
--
ALTER TABLE `user_token`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `admin`
--
ALTER TABLE `admin`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT untuk tabel `data_instansi`
--
ALTER TABLE `data_instansi`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT untuk tabel `db_dispu`
--
ALTER TABLE `db_dispu`
MODIFY `id` int(200) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT untuk tabel `instansi`
--
ALTER TABLE `instansi`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT untuk tabel `kategori_pem`
--
ALTER TABLE `kategori_pem`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT untuk tabel `pengajuan_informasi`
--
ALTER TABLE `pengajuan_informasi`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT untuk tabel `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;
--
-- AUTO_INCREMENT untuk tabel `user_access_menu`
--
ALTER TABLE `user_access_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT untuk tabel `user_menu`
--
ALTER TABLE `user_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT untuk tabel `user_role`
--
ALTER TABLE `user_role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT untuk tabel `user_sub_menu`
--
ALTER TABLE `user_sub_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT untuk tabel `user_token`
--
ALTER TABLE `user_token`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 25.707627 | 161 | 0.643728 |
2c16b17dfda090b8aa2eee73c8e8cf6f506a3878 | 7,732 | lua | Lua | spec/02-integration/04-admin_api/16-ca_certificates_routes_spec.lua | mohatagarvit/kong | c1957918bdc5a19e6a88f5e34caa1d10de7f1d0a | [
"BSD-2-Clause",
"Apache-2.0"
] | 5 | 2020-06-05T02:14:38.000Z | 2020-08-19T05:16:13.000Z | spec/02-integration/04-admin_api/16-ca_certificates_routes_spec.lua | mohatagarvit/kong | c1957918bdc5a19e6a88f5e34caa1d10de7f1d0a | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | spec/02-integration/04-admin_api/16-ca_certificates_routes_spec.lua | mohatagarvit/kong | c1957918bdc5a19e6a88f5e34caa1d10de7f1d0a | [
"BSD-2-Clause",
"Apache-2.0"
] | 3 | 2020-06-29T06:04:20.000Z | 2021-05-10T06:23:54.000Z | local ssl_fixtures = require "spec.fixtures.ssl"
local helpers = require "spec.helpers"
local cjson = require "cjson"
for _, strategy in helpers.each_strategy() do
describe("/ca_certificates with DB: #" .. strategy, function()
local client, bp, db
lazy_setup(function()
bp, db = helpers.get_db_utils(strategy, {
"ca_certificates",
})
assert(helpers.start_kong {
database = strategy,
})
client = assert(helpers.admin_client(10000))
end)
it("GET", function()
local res = client:get("/ca_certificates")
local body = assert.res_status(200, res)
local json = cjson.decode(body)
assert.equal(0, #json.data)
res = client:post("/ca_certificates", {
body = {
cert = ssl_fixtures.cert_ca,
},
headers = { ["Content-Type"] = "application/json" },
})
assert.res_status(201, res)
res = client:get("/ca_certificates")
body = assert.res_status(200, res)
json = cjson.decode(body)
assert.equal(1, #json.data)
assert.equals(json.data[1].cert, ssl_fixtures.cert_ca)
end)
describe("POST", function()
it("missing field", function()
local res = client:post("/ca_certificates", {
body = { },
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (cert: required field missing)", json.message)
end)
it("non CA cert", function()
local res = client:post("/ca_certificates", {
body = {
cert = ssl_fixtures.cert,
},
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (certificate does not appear to be a CA because it is missing the \"CA\" basic constraint)", json.message)
end)
it("expired cert", function()
local res = client:post("/ca_certificates", {
body = {
cert = ssl_fixtures.cert_alt,
},
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (certificate expired, \"Not After\" time is in the past)", json.message)
end)
it("multiple certs", function()
local res = client:post("/ca_certificates", {
body = {
cert = ssl_fixtures.cert .. "\n" .. ssl_fixtures.cert,
},
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (please submit only one certificate at a time)", json.message)
end)
end)
describe("DELETE", function()
local ca
lazy_setup(function()
db:truncate("ca_certificates")
ca = assert(bp.ca_certificates:insert())
end)
it("works", function()
local res = client:delete("/ca_certificates/" .. ca.id)
assert.res_status(204, res)
res = client:get("/ca_certificates")
local body = assert.res_status(200, res)
local json = cjson.decode(body)
assert.equal(0, #json.data)
end)
end)
describe("PATCH", function()
local ca
lazy_setup(function()
db:truncate("ca_certificates")
ca = assert(bp.ca_certificates:insert())
end)
it("non CA cert", function()
local res = client:patch("/ca_certificates/" .. ca.id, {
body = {
cert = ssl_fixtures.cert,
},
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (certificate does not appear to be a CA because it is missing the \"CA\" basic constraint)", json.message)
end)
it("expired cert", function()
local res = client:patch("/ca_certificates/" .. ca.id, {
body = {
cert = ssl_fixtures.cert_alt,
},
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (certificate expired, \"Not After\" time is in the past)", json.message)
end)
it("works", function()
local res = client:patch("/ca_certificates/" .. ca.id, {
body = {
cert = ssl_fixtures.cert_ca,
},
headers = { ["Content-Type"] = "application/json" },
})
assert.res_status(200, res)
end)
end)
describe("PUT", function()
local ca
lazy_setup(function()
db:truncate("ca_certificates")
ca = assert(bp.ca_certificates:insert())
end)
it("missing field", function()
local res = client:put("/ca_certificates/" .. ca.id, {
body = { },
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (cert: required field missing)", json.message)
end)
it("non CA cert", function()
local res = client:put("/ca_certificates/" .. ca.id, {
body = {
cert = ssl_fixtures.cert,
},
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (certificate does not appear to be a CA because it is missing the \"CA\" basic constraint)", json.message)
end)
it("expired cert", function()
local res = client:put("/ca_certificates/" .. ca.id, {
body = {
cert = ssl_fixtures.cert_alt,
},
headers = { ["Content-Type"] = "application/json" },
})
local body = assert.res_status(400, res)
local json = cjson.decode(body)
assert.equal("schema violation (certificate expired, \"Not After\" time is in the past)", json.message)
end)
it("updates existing cert", function()
local res = client:put("/ca_certificates/" .. ca.id, {
body = {
cert = ssl_fixtures.cert_ca,
},
headers = { ["Content-Type"] = "application/json" },
})
assert.res_status(200, res)
res = client:get("/ca_certificates")
local body = assert.res_status(200, res)
local json = cjson.decode(body)
assert.equal(1, #json.data)
assert.equals(json.data[1].cert, ssl_fixtures.cert_ca)
end)
it("creates new cert when uuid does not exist", function()
db:truncate("ca_certificates")
local res = client:put("/ca_certificates/123e4567-e89b-12d3-a456-426655440000", {
body = {
cert = ssl_fixtures.cert_ca,
},
headers = { ["Content-Type"] = "application/json" },
})
assert.res_status(200, res)
local res = client:get("/ca_certificates/123e4567-e89b-12d3-a456-426655440000")
local body = assert.res_status(200, res)
local json = cjson.decode(body)
assert.equal(ssl_fixtures.cert_ca, json.cert)
end)
end)
lazy_teardown(function()
if client then client:close() end
helpers.stop_kong()
end)
end)
end
| 30.203125 | 145 | 0.566606 |
3d778478e675528eb840268c36ab8ecf7387eef3 | 3,272 | kt | Kotlin | core/src/main/kotlin/me/shkschneider/skeleton/helper/KeyboardHelper.kt | shkschneider/android_Skeleton | ef82d0b963a7ec7a3210fa396a2ecc6358e42d26 | [
"Apache-2.0"
] | 25 | 2015-05-08T06:51:56.000Z | 2022-03-13T19:20:19.000Z | core/src/main/kotlin/me/shkschneider/skeleton/helper/KeyboardHelper.kt | shkschneider/android_Skeleton | ef82d0b963a7ec7a3210fa396a2ecc6358e42d26 | [
"Apache-2.0"
] | null | null | null | core/src/main/kotlin/me/shkschneider/skeleton/helper/KeyboardHelper.kt | shkschneider/android_Skeleton | ef82d0b963a7ec7a3210fa396a2ecc6358e42d26 | [
"Apache-2.0"
] | 12 | 2015-05-09T12:21:05.000Z | 2022-02-11T00:53:02.000Z | package me.shkschneider.skeleton.helper
import android.app.Activity
import android.content.res.Configuration
import android.graphics.Rect
import android.view.KeyEvent
import android.view.ViewTreeObserver
import android.view.Window
import android.view.WindowManager
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import android.widget.TextView
import me.shkschneider.skeleton.SkeletonReceiver
import me.shkschneider.skeleton.helperx.Logger
import me.shkschneider.skeleton.helperx.Metrics
import me.shkschneider.skeleton.ui.ViewHelper
object KeyboardHelper {
fun has(): Boolean {
return ApplicationHelper.resources().configuration.keyboard != Configuration.KEYBOARD_NOKEYS
}
fun show(window: Window) {
Logger.verbose("SOFT_INPUT_STATE_ALWAYS_VISIBLE")
if (has()) {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
}
}
fun hide(window: Window) {
Logger.verbose("SOFT_INPUT_STATE_ALWAYS_HIDDEN")
if (has()) {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
}
}
fun keyboardCallback(editText: EditText, skeletonReceiver: SkeletonReceiver?, all: Boolean = false): Boolean {
skeletonReceiver ?: run {
editText.setOnEditorActionListener(null)
return false
}
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
editText.setOnEditorActionListener(TextView.OnEditorActionListener { textView, actionId, keyEvent ->
if (all) {
skeletonReceiver.post(KeyboardHelper::class.java.simpleName, actionId)
return@OnEditorActionListener false
}
when (actionId) {
EditorInfo.IME_NULL -> return@OnEditorActionListener false
EditorInfo.IME_ACTION_DONE,
EditorInfo.IME_ACTION_GO,
EditorInfo.IME_ACTION_SEARCH,
EditorInfo.IME_ACTION_SEND,
KeyEvent.KEYCODE_DPAD_CENTER,
KeyEvent.KEYCODE_ENTER -> skeletonReceiver.post((KeyboardHelper::class.java.simpleName), actionId)
}
false
})
return true
}
// <https://github.com/yshrsmz/KeyboardVisibilityEvent>
fun keyboardListener(activity: Activity, listener: Listener) {
val root = ViewHelper.children(ViewHelper.content(activity))[0]
root.viewTreeObserver.addOnGlobalLayoutListener(object: ViewTreeObserver.OnGlobalLayoutListener {
private val rect = Rect()
private val visibleThreshold = Math.round(Metrics.pixelsFromDp(1.toFloat()).toFloat())
private var wasOpened = false
override fun onGlobalLayout() {
root.getWindowVisibleDisplayFrame(rect)
val heightDiff = root.rootView.height - rect.height()
val isOpen = heightDiff > visibleThreshold
if (isOpen == wasOpened) {
return
}
wasOpened = isOpen
listener.onKeyboardVisibilityChanged(isOpen)
}
})
}
interface Listener {
fun onKeyboardVisibilityChanged(isOpen: Boolean)
}
}
| 34.808511 | 114 | 0.665954 |
8623fc8b539867d64900dcf90ff6c5cf200ec9be | 2,839 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21_40.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21_40.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21_40.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %r8
push %rbp
push %rbx
push %rdx
lea addresses_normal_ht+0x381c, %rdx
nop
nop
nop
nop
and %rbp, %rbp
mov $0x6162636465666768, %r13
movq %r13, (%rdx)
inc %r13
lea addresses_D_ht+0x180c4, %r11
nop
nop
nop
nop
xor $56007, %rdx
movb (%r11), %r15b
nop
nop
and %r11, %r11
lea addresses_WT_ht+0xdc1c, %rbx
nop
nop
nop
nop
sub $43822, %r8
mov (%rbx), %r13w
nop
nop
xor %r8, %r8
lea addresses_WC_ht+0x1db2a, %r15
nop
nop
nop
nop
xor %rbx, %rbx
mov (%r15), %edx
nop
nop
nop
nop
nop
dec %r8
lea addresses_D_ht+0x719c, %r11
nop
and $2973, %r13
movb (%r11), %bl
nop
nop
nop
nop
dec %r15
pop %rdx
pop %rbx
pop %rbp
pop %r8
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r9
push %rax
push %rbp
push %rbx
push %rcx
push %rdx
// Store
lea addresses_US+0xf01c, %rbp
nop
nop
nop
nop
add $48190, %r12
mov $0x5152535455565758, %rax
movq %rax, (%rbp)
sub %rax, %rax
// Store
mov $0x2c3aa90000000894, %rbp
nop
xor $35837, %rcx
mov $0x5152535455565758, %r9
movq %r9, %xmm3
vmovups %ymm3, (%rbp)
inc %rcx
// Store
mov $0xd4, %r9
nop
nop
nop
nop
dec %rbp
movw $0x5152, (%r9)
nop
nop
nop
nop
nop
and %r9, %r9
// Faulty Load
lea addresses_D+0x1f41c, %rbx
nop
nop
and $42632, %rdx
movups (%rbx), %xmm2
vpextrq $1, %xmm2, %rbp
lea oracles, %rax
and $0xff, %rbp
shlq $12, %rbp
mov (%rax,%rbp,1), %rbp
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': True, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 2}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'36': 21}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 18.555556 | 128 | 0.640719 |
4100736c11cd1dbc8b753b9aae18b2df90e4da5c | 1,079 | h | C | code/common/pins_parameters.h | iocafe/pins | 0d446aee48a4b0dd5b4bbb1eebc8ced14fbe767b | [
"MIT"
] | 2 | 2020-04-28T23:26:41.000Z | 2020-06-08T14:00:55.000Z | code/common/pins_parameters.h | iocafe/pins | 0d446aee48a4b0dd5b4bbb1eebc8ced14fbe767b | [
"MIT"
] | null | null | null | code/common/pins_parameters.h | iocafe/pins | 0d446aee48a4b0dd5b4bbb1eebc8ced14fbe767b | [
"MIT"
] | null | null | null | /**
@file common/pins_parameters.h
@brief Run time access to IO pin parameters.
@author Pekka Lehtikoski
@version 1.0
@date 26.4.2021
Copyright 2020 Pekka Lehtikoski. This file is part of the eosal and shall only be used,
modified, and distributed under the terms of the project licensing. By continuing to use, modify,
or distribute this file you indicate that you have read the license and understand and accept
it fully.
****************************************************************************************************
*/
#pragma once
#ifndef PINS_PARAMETERS_H_
#define PINS_PARAMETERS_H_
#include "pins.h"
/* Modify IO pin parameter.
*/
void pin_set_prm(
const Pin *pin,
pinPrm prm,
os_int value);
/* Get value of IO pin parmeter.
*/
os_int pin_get_prm(
const Pin *pin,
pinPrm prm);
/* Get fequency setting for the pin.
*/
os_int pin_get_frequency(
const Pin *pin,
os_int default_frequency);
/* Get speed setting for the pin.
*/
os_int pin_get_speed(
const Pin *pin,
os_int default_speed);
#endif
| 22.957447 | 100 | 0.643188 |
f619eba21611cc94e1e1d0855f4f91491092e245 | 5,899 | kt | Kotlin | app/src/main/java/divyansh/tech/animeclassroom/common/utils/MangaParser.kt | krishnachaitanya0107/AnimeClassroom | 7bfa10ec1ef58e932a738d2b9556834fee39d6ad | [
"MIT",
"Unlicense"
] | 61 | 2021-05-13T15:47:23.000Z | 2022-03-27T19:54:03.000Z | app/src/main/java/divyansh/tech/animeclassroom/common/utils/MangaParser.kt | krishnachaitanya0107/AnimeClassroom | 7bfa10ec1ef58e932a738d2b9556834fee39d6ad | [
"MIT",
"Unlicense"
] | 72 | 2021-10-02T20:40:22.000Z | 2022-01-19T17:17:39.000Z | app/src/main/java/divyansh/tech/animeclassroom/common/utils/MangaParser.kt | krishnachaitanya0107/AnimeClassroom | 7bfa10ec1ef58e932a738d2b9556834fee39d6ad | [
"MIT",
"Unlicense"
] | 26 | 2021-10-03T07:38:16.000Z | 2022-03-21T14:37:05.000Z | package divyansh.tech.animeclassroom.common.utils
import android.util.Log
import divyansh.tech.animeclassroom.common.data.Chapters
import divyansh.tech.animeclassroom.common.data.Manga
import divyansh.tech.animeclassroom.common.data.MangaDetail
import divyansh.tech.animeclassroom.common.data.GenreModel
import org.jsoup.Jsoup
/*
* The util file to parse manga
* */
object MangaParser {
/*
* Parse the Home page data
* */
fun parseHomePageData(response: String): ResultWrapper<*> {
return try {
val mangaList = ArrayList<Manga>()
val jsoup = Jsoup.parse(response)
val latestUpdates =
jsoup.getElementById("latest_update").select("a")
// Log.i("LATEST-UPDATES", latestUpdates.toString())
for (i in 0 until latestUpdates.size - 1 step 3) {
if (latestUpdates[i].select("img").first() == null) continue
val imageUrl = latestUpdates[i].select("img").first().attr("data-src")
val name = latestUpdates[i + 1].attr("title")
val mangaUrl = latestUpdates[i + 1].attr("href")
// val chapterNum = latestUpdates[i + 2].text()
// val chapterUrl = latestUpdates[i + 2].attr("href")
Log.i("IMAGE", imageUrl)
Log.i("NAME", name)
Log.i("MANGA", mangaUrl)
val model = Manga(
name = name,
imageUrl = imageUrl,
mangaUrl = mangaUrl
)
mangaList.add(model)
}
Log.i("MANGA-LIST -> ", mangaList.toString())
ResultWrapper.Success(mangaList)
} catch (e: Exception) {
Log.i("MANGA EX -> ", e.stackTraceToString())
ResultWrapper.Error("Something went wrong", null)
}
}
/*
* get manga details
* */
fun parseMangaDetails(response: String): ResultWrapper<MangaDetail> {
return try {
val jsoup = Jsoup.parse(response)
val manga = jsoup.getElementById("content")
val name = manga.getElementsByClass("mx-1").first().text()
Log.i("MANGA DETAIL NAME -> ", name)
val imageUrl = manga.select("img").first().attr("src")
Log.i("MANGA DETAIL IMAGE -> ", imageUrl)
val listGenre = ArrayList<GenreModel>()
manga.getElementsByClass("badge badge-secondary").forEach {
listGenre.add(
GenreModel(
it.text(), it.attr("href")
)
)
}
Log.i("MANGA DETAIL GENRE -> ", listGenre.toString())
val desc = manga.getElementsByClass("col-lg-9 col-xl-10").lastIndex
val summary = manga.getElementsByClass("col-lg-9 col-xl-10")[desc].text()
Log.i("MANGA DETAIL DEC -> ", summary)
val chapterList = manga.getElementsByClass("text-truncate").select("a")
Log.i("MANGA DETAIL CHAPNA -> ", chapterList.toString())
val chapters = ArrayList<Chapters>()
chapterList.forEachIndexed { index, element ->
chapters.add(
Chapters(
chapterName = element.select("a").first().text(),
chapterUrl = element.select("a").first().attr("href")
)
)
}
Log.i("MANGA DETAIL CHAP -> ", chapters.toString())
val model = MangaDetail(
name = name,
imageUrl = imageUrl,
genreModel = listGenre,
summary = summary,
chapters = chapters
)
ResultWrapper.Success(model)
} catch (e: Exception) {
ResultWrapper.Error("Something went wrong", null)
}
}
/*
* Fetch chapter items
* */
fun parseChapterItems(response: String): ResultWrapper<ArrayList<String>> {
return try {
val jsoup = Jsoup.parse(response)
val list = ArrayList<String>()
val items = jsoup.getElementsByClass("reader-image-wrapper")
Log.i("MANGA ITEM -> ", items.toString())
for (i in 0 until items.size - 1) {
list.add(items[i].select("img").attr("data-src"))
}
Log.i("MANGA ITEM -> ", list.toString())
ResultWrapper.Success(list)
} catch (e: Exception) {
ResultWrapper.Error("Something went wrong", null)
}
}
/*
* Parse the Featured Titles
* */
fun parseFeaturedTitles(response: String): ResultWrapper<*> {
return try {
val jsoup = Jsoup.parse(response)
val featuredTitles = jsoup.getElementsByClass("hled_titles_own_carousel")
Log.i("FEATURED TITLES -> ", featuredTitles.toString())
ResultWrapper.Success(featuredTitles)
} catch (e: Exception) {
ResultWrapper.Error("Something went wrong", null)
}
}
/*
* Parse genre manga
* */
fun getMangaSearch(response: String): ResultWrapper<ArrayList<Manga>> {
return try {
val list = ArrayList<Manga>()
val jsoup = Jsoup.parse(response)
val elements = jsoup.getElementById("content").select("div").first().select("a")
for (i in 0 until elements.size - 1 step 2) {
list.add(
Manga(
imageUrl = elements[i].select("img").attr("data-src"),
name = elements[i+1].text(),
mangaUrl = elements[i+1].attr("href")
)
)
}
ResultWrapper.Success(list)
} catch (e: Exception) {
ResultWrapper.Error("Something went wrong", null)
}
}
} | 38.555556 | 92 | 0.532294 |
d278b61fb7e6eb70f55e6e7fa0b139aeab473284 | 5,358 | php | PHP | application/modules/admin/views/show/showSingle.php | thirdessential/trade-game-backend | 8810580aae538d8fcf2a2bf450f7e8fb490d7b86 | [
"MIT"
] | null | null | null | application/modules/admin/views/show/showSingle.php | thirdessential/trade-game-backend | 8810580aae538d8fcf2a2bf450f7e8fb490d7b86 | [
"MIT"
] | null | null | null | application/modules/admin/views/show/showSingle.php | thirdessential/trade-game-backend | 8810580aae538d8fcf2a2bf450f7e8fb490d7b86 | [
"MIT"
] | null | null | null | <!-- Main content -->
<style type="text/css">
ul.single-ul li {
padding: 10px;
}
ul.single-ul {
list-style-type: none;
margin-top: 15px;
}
</style>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box box-primary box-solid">
<div class="box-header box-header-background with-border">
<h3 class="box-title"><?php echo ucfirst($show[0]->title); ?></h3>
<div class="box-tools pull-right">
<!-- <a href="<?php echo base_url(); ?>admin/type/edit_type" class="btn btn-warning">Add New</a> -->
</div>
</div>
<div class="box-body table-responsive">
<div class="col-md-12" style='margin-bottom:10px'>
<img src="<?php echo base_url(); ?><?php echo $show[0]->bannerImage ?>" class="img img-responsive" style='width: 100%'>
</div>
<div class="col-md-9">
<h2><?php echo ucfirst($show[0]->title); ?></h2>
<p><?php echo $show[0]->details; ?></p>
<a class="btn btn-info"><?php echo ucfirst($show[0]->categoryTitle); ?></a>
<a class="btn btn-info"><?php echo ucfirst($show[0]->subCatTitle); ?></a>
<div class="col-md-12">
<div class="col-md-6">
<?php
if($show[0]->mediaType=='image'){
?>
<h3 class="text-justify" style=" float: left; width: 100%;">Media Image</h3>
<img src="<?php echo base_url(); ?><?php echo $show[0]->fileLink ?>" class="img img-responsive" >
<?php
}
?>
</div>
<div class="col-md-6">
<ul class="single-ul">
<li><i class="fa fa-thumbs-up "></i> Like : <?php echo $show[0]->totalView; ?></li>
<li><i class="fa fa-eye"></i>View : <?php echo $show[0]->totalLike; ?></li>
<li><i class="fa fa-download"></i>Downlaod : <?php echo $show[0]->totalDownlaod; ?></li>
<li><i class="fa fa-comments-o"></i>Comment : <?php echo $show[0]->totalComment; ?></li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 well">
<?php if($show[0]->profileImage){
?>
<img src='<?php echo base_url(); ?><?php echo $show[0]->profileImage ?>' class='img img-responsive'>
<?php
}else{
?>
<img src='<?php echo base_url(); ?>assets/uploads/users/No_Image_Available1.png' class='img img-responsive'>
<?php
} ?>
<h4 class="text-center">Post By :- <?php echo ucfirst($show[0]->username); ?></h4>
</div>
<div class="col-md-12 well">
<h3>Comment List</h3>
<table class="table table-bordered">
<thead>
<tr>
<td>Comment By </td>
<td>Review</td>
<td>Comment</td>
</tr>
</thead>
<tbody>
<?php if (!empty($review)) {
foreach ($review as $key => $rw) {
?>
<tr>
<td><?php echo $rw->reviewBy; ?></td>
<td><?php echo $rw->rating; ?></td>
<td><?php echo $rw->comment; ?></td>
</tr>
<?php } }else{
?>
<tr>
<td colspan="3">No comment in this post</td>
</tr>
<?php
} ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
| 44.65 | 151 | 0.306458 |
6cb2525161793c635ff0be4f0d0a73c693be4fc2 | 3,141 | go | Go | client/listers/messenger/v1alpha1/message.go | attic/messenger | cdcf638fc9fa8f235a9d835a7fbcbfc0f8016530 | [
"Apache-2.0"
] | 2 | 2019-02-01T17:54:57.000Z | 2019-05-15T11:44:33.000Z | client/listers/messenger/v1alpha1/message.go | searchlight/messenger | cdcf638fc9fa8f235a9d835a7fbcbfc0f8016530 | [
"Apache-2.0"
] | 3 | 2018-05-30T04:35:33.000Z | 2018-06-01T06:59:24.000Z | client/listers/messenger/v1alpha1/message.go | kubeware/messenger | cdcf638fc9fa8f235a9d835a7fbcbfc0f8016530 | [
"Apache-2.0"
] | 1 | 2018-05-30T08:49:45.000Z | 2018-05-30T08:49:45.000Z | /*
Copyright 2018 The Attic 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.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
v1alpha1 "github.com/appscode/messenger/apis/messenger/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// MessageLister helps list Messages.
type MessageLister interface {
// List lists all Messages in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.Message, err error)
// Messages returns an object that can list and get Messages.
Messages(namespace string) MessageNamespaceLister
MessageListerExpansion
}
// messageLister implements the MessageLister interface.
type messageLister struct {
indexer cache.Indexer
}
// NewMessageLister returns a new MessageLister.
func NewMessageLister(indexer cache.Indexer) MessageLister {
return &messageLister{indexer: indexer}
}
// List lists all Messages in the indexer.
func (s *messageLister) List(selector labels.Selector) (ret []*v1alpha1.Message, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Message))
})
return ret, err
}
// Messages returns an object that can list and get Messages.
func (s *messageLister) Messages(namespace string) MessageNamespaceLister {
return messageNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// MessageNamespaceLister helps list and get Messages.
type MessageNamespaceLister interface {
// List lists all Messages in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1alpha1.Message, err error)
// Get retrieves the Message from the indexer for a given namespace and name.
Get(name string) (*v1alpha1.Message, error)
MessageNamespaceListerExpansion
}
// messageNamespaceLister implements the MessageNamespaceLister
// interface.
type messageNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Messages in the indexer for a given namespace.
func (s messageNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Message, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Message))
})
return ret, err
}
// Get retrieves the Message from the indexer for a given namespace and name.
func (s messageNamespaceLister) Get(name string) (*v1alpha1.Message, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("message"), name)
}
return obj.(*v1alpha1.Message), nil
}
| 33.063158 | 101 | 0.76568 |
085aeeb0f3d94570f74e96a9358c0091669d6938 | 671 | cql | SQL | input/cql/ANCDT11.cql | workcartersmith/smart-anc | bbcd1026cceae3408e3f548eb46787f4d4c4b45d | [
"CC0-1.0"
] | 7 | 2021-08-13T22:32:16.000Z | 2022-03-23T11:34:00.000Z | input/cql/ANCDT11.cql | workcartersmith/smart-anc | bbcd1026cceae3408e3f548eb46787f4d4c4b45d | [
"CC0-1.0"
] | 14 | 2019-12-02T20:28:15.000Z | 2020-10-13T15:17:42.000Z | input/cql/ANCDT11.cql | workcartersmith/smart-anc | bbcd1026cceae3408e3f548eb46787f4d4c4b45d | [
"CC0-1.0"
] | 3 | 2021-06-22T15:35:01.000Z | 2021-08-11T19:42:07.000Z | library ANCDT11
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'
include ANCConfig called Config
include ANCConcepts called Cx
include ANCDataElements called PatientData
include ANCContactDataElements called ContactData
context Patient
/*
"ANC contact number" = 1
*/
define "Should Conduct syphilis test":
ContactData."ANC contact number" = 1
/*
"Gestational age" ≥ 29 weeks
*/
define "Should Conduct syphilis test 2":
ContactData."Gestational age" >= 29 'weeks'
/*
"Syphilis diagnosis" = "Syphilis positive"
*/
define "Should No syphilis test required ":
ContactData."Syphilis diagnosis" in Cx."Syphilis diagnosis - Syphilis positive Choices"
| 21.645161 | 89 | 0.766021 |
e51e8ef95cefdf0432fc2256d7c93eb7c0d2d888 | 1,258 | dart | Dart | examples/my_anime/lib/models/aime_entity.dart | roketstorm/SurfGear | df2d474a98fbfdbdcd8956c43406b01e3ad822e3 | [
"Apache-2.0"
] | null | null | null | examples/my_anime/lib/models/aime_entity.dart | roketstorm/SurfGear | df2d474a98fbfdbdcd8956c43406b01e3ad822e3 | [
"Apache-2.0"
] | null | null | null | examples/my_anime/lib/models/aime_entity.dart | roketstorm/SurfGear | df2d474a98fbfdbdcd8956c43406b01e3ad822e3 | [
"Apache-2.0"
] | null | null | null | class AnimeEntity {
AnimeEntity({
this.startDate = '',
this.endDate = '',
this.airing = false,
this.background = '',
this.broadcast = '',
this.duration = '',
this.endingThemes = const [],
this.episodes = 0,
this.favorites = 0,
this.genres = const [],
this.imageUrl = '',
this.id = 0,
this.members = 0,
this.openingThemes = const [],
this.popularity = 0,
this.premiered = '',
this.rank = 0,
this.rating = '',
this.score = 0,
this.scoredBy = 0,
this.status = '',
this.synopsis = '',
this.title = '',
this.titleEnglish = '',
this.titleJapanese = '',
this.trailerUrl = '',
this.type = '',
this.isFavorite = false,
});
String startDate;
String endDate;
bool airing;
String background;
String broadcast;
String duration;
List<String> endingThemes;
int episodes;
int favorites;
List<String> genres;
String imageUrl;
int id;
int members;
List<String> openingThemes;
int popularity;
String premiered;
int rank;
String rating;
double score;
int scoredBy;
String status;
String synopsis;
String title;
String titleEnglish;
String titleJapanese;
String trailerUrl;
String type;
bool isFavorite;
}
| 20.290323 | 34 | 0.616057 |
70fc6230fc5753916c8c03d211c78695fda3b0f7 | 1,697 | h | C | src/liboconfig/oconfig.h | TranscendComputing/TopStackMessageAgent | 97da381e932b5ad0257dbcb108ad32caa049f599 | [
"Apache-2.0"
] | null | null | null | src/liboconfig/oconfig.h | TranscendComputing/TopStackMessageAgent | 97da381e932b5ad0257dbcb108ad32caa049f599 | [
"Apache-2.0"
] | null | null | null | src/liboconfig/oconfig.h | TranscendComputing/TopStackMessageAgent | 97da381e932b5ad0257dbcb108ad32caa049f599 | [
"Apache-2.0"
] | null | null | null | #ifndef OCONFIG_H
#define OCONFIG_H 1
#include <stdio.h>
/**
* oconfig - src/oconfig.h
* Copyright (C) 2006-2009 Florian octo Forster <octo at verplant.org>
*
* 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; only version 2 of the License is applicable.
*
* This program 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 General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Types
*/
#define OCONFIG_TYPE_STRING 0
#define OCONFIG_TYPE_NUMBER 1
#define OCONFIG_TYPE_BOOLEAN 2
struct oconfig_value_s
{
union
{
char *string;
double number;
int boolean;
} value;
int type;
};
typedef struct oconfig_value_s oconfig_value_t;
struct oconfig_item_s;
typedef struct oconfig_item_s oconfig_item_t;
struct oconfig_item_s
{
char *key;
oconfig_value_t *values;
int values_num;
oconfig_item_t *parent;
oconfig_item_t *children;
int children_num;
};
/*
* Functions
*/
oconfig_item_t *oconfig_parse_fh (FILE *fh);
oconfig_item_t *oconfig_parse_file (const char *file);
oconfig_item_t *oconfig_clone (const oconfig_item_t *ci);
void oconfig_free (oconfig_item_t *ci);
/*
* vim: shiftwidth=2:tabstop=8:softtabstop=2
*/
#endif /* OCONFIG_H */
| 24.242857 | 79 | 0.724219 |