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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
22a7226f0d0b991ac23b0478195652fe88b1dcfc
| 292 |
html
|
HTML
|
RequestDispatcher/WebContent/login.html
|
shub113/Servlet
|
dd23f47fa472b7428bb350b04fa7dfd125408648
|
[
"MIT"
] | null | null | null |
RequestDispatcher/WebContent/login.html
|
shub113/Servlet
|
dd23f47fa472b7428bb350b04fa7dfd125408648
|
[
"MIT"
] | null | null | null |
RequestDispatcher/WebContent/login.html
|
shub113/Servlet
|
dd23f47fa472b7428bb350b04fa7dfd125408648
|
[
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login page</title>
</head>
<body>
<form action="serv1" method="post">
Username <input type="text" name="t1"><br/>
Password <input type="password" name="t2"><br/>
<input type="submit" value="Login">
</form>
</body>
</html>
| 19.466667 | 49 | 0.633562 |
38e330bf356a60f8f1dd354590f46b7c89bc761c
| 1,149 |
c
|
C
|
libft/ft_memcpy.c
|
lucaslf02/libft
|
6c1446e7cbcd32c7ffa58f575bc39d11f13c9865
|
[
"MIT"
] | null | null | null |
libft/ft_memcpy.c
|
lucaslf02/libft
|
6c1446e7cbcd32c7ffa58f575bc39d11f13c9865
|
[
"MIT"
] | null | null | null |
libft/ft_memcpy.c
|
lucaslf02/libft
|
6c1446e7cbcd32c7ffa58f575bc39d11f13c9865
|
[
"MIT"
] | null | null | null |
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: llemes-f <llemes-f@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/17 20:57:11 by llemes-f #+# #+# */
/* Updated: 2021/02/28 18:57:26 by llemes-f ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dest, const void *src, size_t n)
{
size_t i;
void *dest_aux;
if (!dest && !src)
return (NULL);
i = 0;
dest_aux = dest;
while (i < n)
{
((char*)dest)[i] = ((char*)src)[i];
i++;
}
return (dest_aux);
}
| 37.064516 | 80 | 0.211488 |
e74da2d78d304199dfccbeca07631b9f42b9d6aa
| 935 |
js
|
JavaScript
|
reactPrimerosPasos/basicos/src/components/Producto.js
|
maxicosia/maxicosia.github.io
|
36bd9d5dcb199b4cab890128624d45bb3450f34b
|
[
"MIT"
] | null | null | null |
reactPrimerosPasos/basicos/src/components/Producto.js
|
maxicosia/maxicosia.github.io
|
36bd9d5dcb199b4cab890128624d45bb3450f34b
|
[
"MIT"
] | 10 |
2020-05-08T22:33:38.000Z
|
2022-03-02T10:14:24.000Z
|
reactPrimerosPasos/basicos/src/components/Producto.js
|
maxicosia/maxicosia.github.io
|
36bd9d5dcb199b4cab890128624d45bb3450f34b
|
[
"MIT"
] | 1 |
2020-05-08T18:54:14.000Z
|
2020-05-08T18:54:14.000Z
|
import React from "react";
const Producto = ({ producto, carrito, agregarProducto, productos }) => {
const { nombre, precio, id } = producto;
//Agregar producto al carrito
const seleccionarProducto = (id) => {
const producto = productos.filter((producto) => producto.id === id)[0];
agregarProducto([...carrito, producto]);
};
//Eliminar producto del carrito
const eliminarProducto = (id) => {
const productos = carrito.filter((producto) => producto.id !== id);
//Colocar los productos en el state
agregarProducto(productos);
};
return (
<div>
<h2>{nombre}</h2>
<p>${precio}</p>
{productos ? (
<button type="button" onClick={() => seleccionarProducto(id)}>
Comprar
</button>
) : (
<button type="button" onClick={() => eliminarProducto(id)}>
Eliminar
</button>
)}
</div>
);
};
export default Producto;
| 23.974359 | 75 | 0.586096 |
83b0c8aaad809c6965cb8f414430f7bb97cc823b
| 1,007 |
rs
|
Rust
|
sept/src/st/utf8_string_term.rs
|
vdods/sept-rs
|
5cd3d8099f73c4171ad000ad1893d805f52b372b
|
[
"Apache-2.0"
] | null | null | null |
sept/src/st/utf8_string_term.rs
|
vdods/sept-rs
|
5cd3d8099f73c4171ad000ad1893d805f52b372b
|
[
"Apache-2.0"
] | null | null | null |
sept/src/st/utf8_string_term.rs
|
vdods/sept-rs
|
5cd3d8099f73c4171ad000ad1893d805f52b372b
|
[
"Apache-2.0"
] | null | null | null |
use crate::{dy, st::{self, Inhabits, Stringify, TermTrait}};
impl dy::Deconstruct for String {
fn deconstruct(self) -> dy::Deconstruction {
// Deconstruct only the constructor, otherwise infinite recursion!
dy::ParametricDeconstruction::new(
st::Utf8String.deconstruct(),
vec![dy::NonParametricDeconstruction::new_unchecked(dy::Value::from(self)).into()],
).into()
}
}
impl Inhabits<st::Utf8String> for String {
fn inhabits(&self, _rhs: &st::Utf8String) -> bool {
true
}
}
impl dy::IntoValue for String {}
impl Stringify for String {
fn stringify(&self) -> String {
// Create a quoted string literal.
format!("{:?}", self)
}
}
impl TermTrait for String {
type AbstractTypeType = st::Utf8String;
fn is_parametric(&self) -> bool {
true
}
fn is_type(&self) -> bool {
false
}
fn abstract_type(&self) -> Self::AbstractTypeType {
Self::AbstractTypeType{}
}
}
| 24.560976 | 95 | 0.607746 |
7a2e88068cd91961898195d225fdf06ef752414d
| 286 |
rb
|
Ruby
|
lib/bundle_outdated_formatter/formatter/json_formatter.rb
|
JunichiIto/bundle_outdated_formatter
|
1c65bbf2829932395d14851daf67ce150bcbab8f
|
[
"MIT"
] | 15 |
2018-04-05T02:27:38.000Z
|
2021-09-02T14:18:58.000Z
|
lib/bundle_outdated_formatter/formatter/json_formatter.rb
|
JunichiIto/bundle_outdated_formatter
|
1c65bbf2829932395d14851daf67ce150bcbab8f
|
[
"MIT"
] | 6 |
2018-05-24T09:39:56.000Z
|
2021-07-17T00:54:26.000Z
|
lib/bundle_outdated_formatter/formatter/json_formatter.rb
|
JunichiIto/bundle_outdated_formatter
|
1c65bbf2829932395d14851daf67ce150bcbab8f
|
[
"MIT"
] | 3 |
2018-05-08T10:44:07.000Z
|
2020-03-27T05:13:58.000Z
|
require 'json'
require 'bundle_outdated_formatter/formatter'
module BundleOutdatedFormatter
# Formatter for JSON
class JSONFormatter < Formatter
def convert
text = @pretty ? JSON.pretty_generate(@outdated_gems) : @outdated_gems.to_json
text.chomp
end
end
end
| 22 | 84 | 0.748252 |
1fa62bfa8f17f3b782124ba2ac0c7c9a697ea1ad
| 5,471 |
css
|
CSS
|
Code/css/index.css
|
HADB/OP-ChristmasGifts
|
bcc1e721a6b82aca524d10b9ac346258e8312729
|
[
"MIT"
] | null | null | null |
Code/css/index.css
|
HADB/OP-ChristmasGifts
|
bcc1e721a6b82aca524d10b9ac346258e8312729
|
[
"MIT"
] | null | null | null |
Code/css/index.css
|
HADB/OP-ChristmasGifts
|
bcc1e721a6b82aca524d10b9ac346258e8312729
|
[
"MIT"
] | 2 |
2018-04-15T08:16:49.000Z
|
2019-12-03T02:04:01.000Z
|
body {
background-color: #e61839;
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
.hide {
display: none;
}
.header {
padding: 0;
}
.header .logo {
width: 100%;
position: absolute;
top: 0;
}
.pages {
position: absolute;
top: 17%;
width: 100%;
height: 85%;
}
.pages img {
position: absolute;
}
.page-1 .girl {
width: 80%;
bottom: 0;
}
.page-1 .right-gift {
width: 67%;
bottom: 0;
right: 0;
}
.page-1 .slogan {
width: 70%;
right: 10%;
top: 5%;
}
.page-1 .left-gift {
width: 15%;
left: 0;
top: 0;
}
.page-1 .button {
width: 45%;
right: 5%;
top: 30%;
}
.page-2 {
height: 80%;
}
.page-2 .bottom-layer {
width: 80%;
left: 10%;
z-index: 1;
}
.page-2 .bottom-layer.opacity-0 {
opacity: 0;
}
.page-2 #cas {
position: absolute;
left: 10%;
z-index: 2;
}
.page-3 .slogan {
top: 5%;
left: 10%;
width: 80%;
}
.page-3 .gift {
bottom: 0;
width: 100%;
}
.page-4 .left-gift {
width: 15%;
left: 0;
top: 0;
}
.page-4 .text {
width: 60%;
left: 20%;
top: 5px;
}
.page-4 .shadow-1 {
width: 100px;
height: 30px;
left: 50%;
top: 50%;
margin-left: -130px;
margin-top: -30px;
}
.page-4 .shadow-2 {
width: 100px;
height: 30px;
left: 50%;
top: 50%;
margin-left: 30px;
margin-top: -30px;
}
.page-4 .shadow-3 {
width: 100px;
height: 30px;
left: 50%;
top: 50%;
margin-left: -130px;
margin-top: 140px;
}
.page-4 .shadow-4 {
width: 100px;
height: 30px;
left: 50%;
top: 50%;
margin-left: 30px;
margin-top: 140px;
}
.page-4 .gift-1 {
width: 120px;
height: 120px;
left: 50%;
top: 50%;
margin-left: -140px;
margin-top: -150px;
}
.page-4 .gift-2 {
width: 120px;
height: 120px;
left: 50%;
top: 50%;
margin-left: 20px;
margin-top: -150px;
}
.page-4 .gift-3 {
width: 120px;
height: 120px;
left: 50%;
top: 50%;
margin-left: -140px;
margin-top: 20px;
}
.page-4 .gift-4 {
width: 120px;
height: 120px;
left: 50%;
top: 50%;
margin-left: 20px;
margin-top: 20px;
}
.page-5 .bottom-gift {
bottom: 0;
right: 0;
width: 80%;
}
.page-5 .gift {
width: 60%;
top: 5px;
left: 20%;
}
.page-5 .get-jifen-button {
width: 50%;
left: 25%;
bottom: 60px;
}
.page-5 .form .background {
width: 320px;
height: 475px;
left: 50%;
top: 50%;
margin-left: -160px;
margin-top: -300px;
}
.page-5 .form .name {
font-family: 'Microsoft Yahei';
font-size: 14px;
background-color: transparent;
border: none;
position: absolute;
width: 160px;
height: 25px;
left: 50%;
top: 50%;
margin-left: -55px;
margin-top: -79px;
padding-left: 2px;
padding-top: 0;
}
.page-5 .form .phone {
font-family: 'Microsoft Yahei';
font-size: 14px;
background-color: transparent;
border: none;
position: absolute;
width: 160px;
height: 25px;
left: 50%;
top: 50%;
margin-left: -55px;
margin-top: -35px;
padding-left: 2px;
padding-top: 0;
}
.page-5 .form .age {
font-family: 'Microsoft Yahei';
font-size: 14px;
padding-top: 4px;
background-color: transparent;
border: none;
position: absolute;
width: 176px;
height: 27px;
left: 50%;
top: 50%;
margin-left: -55px;
margin-top: 9px;
padding-left: 2px;
}
.page-5 .form .button {
position: absolute;
width: 120px;
height: 40px;
left: 50%;
top: 50%;
margin-left: -60px;
margin-top: 90px;
}
.page-5 .dropdown {
position: absolute;
background-image: url('../img/page_5/dropdown.png');
background-size: 120px 150px;
width: 120px;
height: 150px;
left: 50%;
top: 50%;
margin-left: -20px;
margin-top: 26px;
}
.page-5 .dropdown div {
position: absolute;
width: 97px;
height: 35px;
left: 50%;
top: 50%;
margin-left: -49px;
background-color: #fff;
opacity: 0;
}
.page-5 .dropdown-age-1 {
margin-top: -64px;
}
.page-5 .dropdown-age-2 {
margin-top: -34px;
}
.page-5 .dropdown-age-3 {
margin-top: -4px;
}
.page-5 .dropdown-age-4 {
margin-top: 26px;
}
.page-6 .bottom-gift {
bottom: 0;
right: 0;
width: 80%;
}
.page-6 .shops-button {
width: 50%;
left: 25%;
bottom: 60px;
}
.page-6 .text {
width: 100%;
bottom: 35%;
}
.page-6 .jifen-90 {
width: 60%;
left: 20%;
top: 0;
}
.page-6 .jifen-100 {
width: 60%;
left: 20%;
top: 0;
}
.page-6 .jifen-200 {
width: 60%;
left: 20%;
top: 0;
}
.page-6 .jifen-400 {
width: 60%;
left: 20%;
top: 0;
}
.page-6 .phone-number {
position: absolute;
width: 100%;
text-align: center;
color: #fff;
font-size: 18px;
top: 32%;
font-family: "Microsoft YaHei",Arial,SimHei;
}
.page-7 .bottom-gift {
bottom: 0;
right: 0;
width: 80%;
}
.page-7 .back-button {
width: 50%;
left: 25%;
bottom: 60px;
}
.page-7 .left-gift {
width: 15%;
left: 0;
top: 0;
}
.page-7 .title {
top: 5px;
width: 40%;
left: 30%;
}
.page-7 .text {
width: 60%;
top: 18%;
left: 15%;
}
| 14.247396 | 56 | 0.514348 |
0b4a7fb8ebee09432022b77e8750863d12e69e9f
| 134 |
py
|
Python
|
python/pangram.py
|
emiliot/hackerrank
|
7a3081f6b0a33f8402c63b94a6a54728a9adf47e
|
[
"MIT"
] | null | null | null |
python/pangram.py
|
emiliot/hackerrank
|
7a3081f6b0a33f8402c63b94a6a54728a9adf47e
|
[
"MIT"
] | null | null | null |
python/pangram.py
|
emiliot/hackerrank
|
7a3081f6b0a33f8402c63b94a6a54728a9adf47e
|
[
"MIT"
] | null | null | null |
s = input().strip()
res = [c for c in set(s.lower()) if c.isalpha()]
if len(res) == 26:
print("pangram")
else:
print("not pangram")
| 19.142857 | 48 | 0.604478 |
858f0c01f818eafb83ce33dee70e5cf4bf738aee
| 435 |
js
|
JavaScript
|
client/components/index.js
|
langyuxiansheng/biu-server-admin
|
4ae8ebf3be07ef2e3f268fd15c508b991a062447
|
[
"MIT"
] | 19 |
2019-09-29T09:21:52.000Z
|
2022-01-21T04:12:26.000Z
|
client/components/index.js
|
langyuxiansheng/biu-server-admin
|
4ae8ebf3be07ef2e3f268fd15c508b991a062447
|
[
"MIT"
] | 3 |
2020-08-07T13:16:38.000Z
|
2021-08-08T08:54:26.000Z
|
client/components/index.js
|
langyuxiansheng/biu-server-admin
|
4ae8ebf3be07ef2e3f268fd15c508b991a062447
|
[
"MIT"
] | 3 |
2020-04-10T05:19:04.000Z
|
2021-06-25T01:38:37.000Z
|
/**
* 同一导出自定义的全局组件
*/
// 卡片布局容器
import CardContainer from './CardContainer';
// 图片显示
import ImgDialog from './ImgDialog';
import DialogContainer from './DialogContainer';
import AppTables from './AppTables';
import AppTreeTable from './AppTreeTable';
//预览文件
import ReadFileDialog from './ReadFileDialog';
export default {
CardContainer,
ImgDialog,
DialogContainer,
AppTables,
AppTreeTable,
ReadFileDialog
};
| 19.772727 | 48 | 0.724138 |
50dcb33c9d639a9fb033436b30d38ccd729ddf23
| 3,088 |
swift
|
Swift
|
Documentations/UIKit VIPER Architecture/UIKitViperArchitectureDemo/Scenes/Post Details/PostDetailsViewController.swift
|
VakhoKontridze/VCore
|
7feb5f442da98199d891ef3f6a2236b418d683da
|
[
"MIT"
] | 29 |
2022-01-03T08:45:23.000Z
|
2022-02-01T18:18:33.000Z
|
Documentations/UIKit VIPER Architecture/UIKitViperArchitectureDemo/Scenes/Post Details/PostDetailsViewController.swift
|
VakhoKontridze/VCore
|
7feb5f442da98199d891ef3f6a2236b418d683da
|
[
"MIT"
] | null | null | null |
Documentations/UIKit VIPER Architecture/UIKitViperArchitectureDemo/Scenes/Post Details/PostDetailsViewController.swift
|
VakhoKontridze/VCore
|
7feb5f442da98199d891ef3f6a2236b418d683da
|
[
"MIT"
] | 1 |
2022-01-06T08:00:23.000Z
|
2022-01-06T08:00:23.000Z
|
//
// PostDetailsViewController.swift
// UIKitViperArchitectureDemo
//
// Created by Vakhtang Kontridze on 17.06.22.
//
import UIKit
import VCore
// MARK: - Post Details View Controller
final class PostDetailsViewController: UIViewController, PostDetailsViewable {
// MARK: Subviews
private let scrollableView: ScrollableView = {
let scrollabelView: ScrollableView = .init(direction: .vertical)
scrollabelView.translatesAutoresizingMaskIntoConstraints = false
scrollabelView.scrollView.bounces = false
return scrollabelView
}()
private let bodyLabel: UILabel = .init(
numberOfLines: 0,
color: UIModel.Colors.bodyLabel,
font: UIModel.Fonts.bodyLabel
).withTranslatesAutoresizingMaskIntoConstraints(false)
// MARK: Properties
var presenter: (any PostDetailsPresentable)!
private var bodyLabelHeightConstraint: NSLayoutConstraint?
private typealias UIModel = PostDetailsUIModel
// MARK: Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
setUp()
presenter.viewDidLoad()
}
// MARK: Setup
private func setUp() {
setUpView()
addSubviews()
setUpLayout()
setUpNavBar()
}
private func setUpView() {
view.backgroundColor = UIModel.Colors.background
}
private func addSubviews() {
view.addSubview(scrollableView)
scrollableView.contentView.addSubview(bodyLabel)
}
private func setUpLayout() {
NSLayoutConstraint.activate([
scrollableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
scrollableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
scrollableView.topAnchor.constraint(equalTo: view.topAnchor),
scrollableView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
bodyLabel.heightAnchor.constraint(equalToConstant: 0)
.storing(in: &bodyLabelHeightConstraint),
bodyLabel.leadingAnchor.constraint(equalTo: scrollableView.contentView.leadingAnchor, constant: UIModel.Layout.bodyLabelMarginHor),
bodyLabel.trailingAnchor.constraint(equalTo: scrollableView.contentView.trailingAnchor, constant: -UIModel.Layout.bodyLabelMarginHor),
bodyLabel.topAnchor.constraint(equalTo: scrollableView.contentView.safeAreaLayoutGuide.topAnchor, constant: UIModel.Layout.bodyLabelMarginTop),
bodyLabel.bottomAnchor.constraint(equalTo: scrollableView.contentView.safeAreaLayoutGuide.bottomAnchor, constant: -UIModel.Layout.bodyLabelMarginBottom)
])
}
private func setUpNavBar() {
navigationItem.title = "Post Details"
}
// MARK: Viewable
func setTitle(to title: String) {
navigationItem.title = title
}
func setBody(to body: String) {
bodyLabel.text = body
bodyLabelHeightConstraint?.constant = bodyLabel
.multiLineHeight(width: view.frame.width - 2*UIModel.Layout.bodyLabelMarginHor)
}
}
| 34.696629 | 164 | 0.693977 |
27da2550a91044ede2316504a43ef4acfb31bbfa
| 1,129 |
css
|
CSS
|
plugins/chili/skins/jquery.chili.toolbar.css
|
uzmcoco/Cotonti
|
ef7451118587deca574e58f1c96119deb7eca83b
|
[
"BSD-3-Clause"
] | 2 |
2015-06-03T10:17:02.000Z
|
2017-10-26T16:40:25.000Z
|
plugins/chili/skins/jquery.chili.toolbar.css
|
uzmcoco/Cotonti
|
ef7451118587deca574e58f1c96119deb7eca83b
|
[
"BSD-3-Clause"
] | null | null | null |
plugins/chili/skins/jquery.chili.toolbar.css
|
uzmcoco/Cotonti
|
ef7451118587deca574e58f1c96119deb7eca83b
|
[
"BSD-3-Clause"
] | 1 |
2019-07-14T18:23:27.000Z
|
2019-07-14T18:23:27.000Z
|
.highlight {
/* resets */ margin: 0; padding: 0;
background-color: #E8E8E8;
overflow: hidden;
}
.highlight PRE {
margin: 0;
padding: 0 0 0 45px;
font: 12px "Consolas","Courier New",Courier,mono;
overflow: auto;
}
.highlight PRE ol {
/* resets */ margin: 0; padding: 0;
color: #222222;
list-style-image: none;
list-style-position: outside;
list-style-type: decimal-leading-zero;
}
.highlight PRE ol li {
margin: 0;
padding: 0 0 0 10px;
border-left: 1px solid #CCCCCC;
background-color: #F8F8F8;
}
.highlight .bar .tools {
padding: 4px 0 4px 50px;
font: normal 9px Arial,Helvetica,Geneva,sans-serif;
background-color: #EEEEEE;
border-bottom: 1px solid #CCCCCC;
}
.highlight .bar .tools a {
padding: 0 6px;
color: #B2B2B2;
text-decoration: none;
outline: 0;
}
.highlight .bar .tools a:hover {
color: #3E606F;
}
/* Hide useless elements in print layouts... */
@media print {
.highlight {
margin: 0; padding: 0;
border: 0 none;
}
.highlight PRE {
font-size: 14px;
overflow: hidden;
}
.highlight PRE ol li {
border-bottom: 0 none;
}
}
| 20.907407 | 53 | 0.638618 |
95d7112bcd13778368cb09ada52ed2a48b249f14
| 11 |
css
|
CSS
|
apps/test_apps/controls/start-stop-toggle-button/client/css/app.css
|
metabench/jsgui
|
f4cda2f5728bdbeb641a8a4972e1659b8f711e96
|
[
"MIT"
] | 3 |
2015-06-08T21:28:34.000Z
|
2018-04-24T08:48:45.000Z
|
apps/window/client/css/app.css
|
metabench/jsgui
|
f4cda2f5728bdbeb641a8a4972e1659b8f711e96
|
[
"MIT"
] | null | null | null |
apps/window/client/css/app.css
|
metabench/jsgui
|
f4cda2f5728bdbeb641a8a4972e1659b8f711e96
|
[
"MIT"
] | 3 |
2015-09-11T20:55:24.000Z
|
2021-02-22T13:23:05.000Z
|
// app.css
| 5.5 | 10 | 0.545455 |
5bcc1dc33adc6854af509d71e2ed041bcfdf12a8
| 460 |
h
|
C
|
13_RTOSDemo/RX700_RX72N_RenesasSim_Renesas_e2studio_CS+/src/smc_workaround/u_bsp_lowlvl_ext.h
|
NoMaY-jp/FreeRTOS_examples_for_Renesas_R_CPUs
|
69484b4bc97bb85e6cf1ef762d9b1e389dfdd38c
|
[
"MIT"
] | 4 |
2021-06-01T01:33:58.000Z
|
2022-03-29T03:20:48.000Z
|
13_RTOSDemo/RX700_RX72N_RenesasSim_Renesas_e2studio_CS+/src/smc_workaround/u_bsp_lowlvl_ext.h
|
NoMaY-jp/FreeRTOS_examples_for_Renesas_R_CPUs
|
69484b4bc97bb85e6cf1ef762d9b1e389dfdd38c
|
[
"MIT"
] | null | null | null |
13_RTOSDemo/RX700_RX72N_RenesasSim_Renesas_e2studio_CS+/src/smc_workaround/u_bsp_lowlvl_ext.h
|
NoMaY-jp/FreeRTOS_examples_for_Renesas_R_CPUs
|
69484b4bc97bb85e6cf1ef762d9b1e389dfdd38c
|
[
"MIT"
] | null | null | null |
#ifndef U_BSP_LOWLVL_EXT_H
#define U_BSP_LOWLVL_EXT_H
#include "mcu/all/lowlvl.h"
/* Check ready flag to output one character to standard output
* (the E1 Virtual Console or a serial port via user own charput function) */
bool is_charput_ready (void);
/* Check ready flag to input one character from standard input
* (the E1 Virtual Console or a serial port via user own charget function) */
bool is_charget_ready (void);
#endif /* U_BSP_LOWLVL_EXT_H */
| 30.666667 | 77 | 0.767391 |
bb550b57f59a91b0f0e28cff0d0094797df5dce8
| 1,629 |
html
|
HTML
|
shio-app/src/main/resources/ui/templates/widget/payment/rede-card/rede-card-form.html
|
openshio/shiohara
|
d86b34e3c4d33feb47154092af82d51ed4a04595
|
[
"Apache-2.0"
] | 113 |
2019-05-23T21:02:58.000Z
|
2020-02-27T13:30:23.000Z
|
shio-app/src/main/resources/ui/templates/widget/payment/rede-card/rede-card-form.html
|
openshio/shiohara
|
d86b34e3c4d33feb47154092af82d51ed4a04595
|
[
"Apache-2.0"
] | 198 |
2020-03-09T20:55:41.000Z
|
2022-03-30T04:35:16.000Z
|
shio-app/src/main/resources/ui/templates/widget/payment/rede-card/rede-card-form.html
|
openshio/shiohara
|
d86b34e3c4d33feb47154092af82d51ed4a04595
|
[
"Apache-2.0"
] | 15 |
2019-09-05T12:37:47.000Z
|
2020-02-13T23:10:30.000Z
|
<ul class="list-inline">
<li style="display: inline-block; margin-right: 10px;"><img
src="/img/widget/payment/f_diners.png" alt=""></li>
<li style="display: inline-block; margin-right: 10px;"><img
src="/img/widget/payment/f_mastercard.png" alt=""></li>
<li style="display: inline-block; margin-right: 10px;"><img
src="/img/widget/payment/f_visa.png" alt=""></li>
</ul>
<div class="form-group">
<input class="form-control" type="text" name="num_cartao"
id="num_cartao" placeholder="Número do Cartão" autocomplete="off" />
</div>
<div class="form-group">
<input class="form-control" type="text" name="nome" id="nome"
placeholder="Nome impresso no cartão" autocomplete="off" />
</div>
<div class="form-inline">
<div class="form-group"
style="margin-right: 10px; margin-bottom: 10px;">
<input class="form-control" type="text" name="validade" id="validade"
autocomplete="off" placeholder="Validade" />
</div>
<div class="form-group"
style="margin-right: 10px; margin-bottom: 10px;">
<label class="sr-only" for="cod_seg">Código de segurança</label> <input
class="form-control" type="text" name="cod_seg" id="cod_seg"
placeholder="Código de segurança" maxlength="3" autocomplete="off" />
</div>
</div>
<div class="form-group">
<label for="parcelas"> Parcelas </label> <select class="form-control"
name="parcelas" id="parcelas">
<option value="01" th:text="'1x de R$ ' + ${#numbers.formatDecimal(shProduct.value, 0, 'POINT', 2, 'COMMA')}"></option>
<option value="02" th:text="'2x de R$ ' + ${#numbers.formatDecimal(shProduct.value/2, 0, 'POINT', 2, 'COMMA')}"></option>
</select>
</div>
| 38.785714 | 123 | 0.674647 |
bb3a977d345e7abd372f59ef6ede072a0dda4dac
| 6,166 |
html
|
HTML
|
index.html
|
danielaraujo95/portifolio-pessoal
|
309e9aad0bd816a78b71cb397eebeff747cc7e73
|
[
"MIT"
] | null | null | null |
index.html
|
danielaraujo95/portifolio-pessoal
|
309e9aad0bd816a78b71cb397eebeff747cc7e73
|
[
"MIT"
] | null | null | null |
index.html
|
danielaraujo95/portifolio-pessoal
|
309e9aad0bd816a78b71cb397eebeff747cc7e73
|
[
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html lang="pt-br">
<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>Portfólio</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Vollkorn&display=swap" rel="stylesheet">
<link rel="stylesheet" href="./style.css">
<link rel="shortcut icon" type="imagex/png" href="./Logo.png">
</head>
<body>
<header class="menu">
<nav class="menu-nav">
<span class="menu-btn"> </span>
<ul class="mobile-menu">
<li><a href="#home">Início</a></li>
<li><a href=" #sobre">Sobre</a></li>
<li><a href="#conhecimento">Conhecimento</a></li>
<li><a href="#Insurtech">Experiências</a></li>
<li><a href="#Projetos">Projetos</a></li>
<li><a href="#contato">Contatos</a></li>
</ul>
</nav>
</header>
<section class="home" id="home">
<div class="home-inf">
<img src="./Image/home.png" alt="home">
</div>
<div class="home-inf2">
<img class="daniel" src="./Image/Daniel.png" alt="Daniel">
</div>
</section>
<section class="sobre" id="sobre">
<div class="sobre-inf">
<h3>Sobre</h3>
<p>Meu nome é Daniel, tenho 26 anos e sou estudante de administração na Pontifícia Universidade Católica do Rio de Janeiro. Além da universidade estudo também Desenvolvimento Web através do curso de Desenvolvimento Web full Stack do ProgramadorBR. Atualmente sou estagiário de inovação e tecnologia no Insurtech Innovation Program - ECOA PUC-RIO.</p>
</div>
<div class="img-sobre">
<img src="./Image/FotoDePerfil.jpg">
</div>
</section>
<section class="conhecimento" id="conhecimento">
<div class="conhecimento-img">
<img src="./Image/conhecimento.png" alt="conhecimento">
</div>
<div class="conhecimento-inf">
<div class="conhecimento-t">
<h3>Conhecimento</h3>
<p>Domino de forma fluente a linguagem de programação JavaScript e também possuo conhecimento avançado em HTML, CSS e JQuery. Meu objetivo é me tornar um Desenvolvedor Full Stack então continuo estudando e aprofundando meus conhecimentos para atingir esse objetivo.</p>
</div>
<div class="icones">
<img class="ic" src="./Image/HTML.png" alt="html">
<img class="ic" src="./Image/CSS.png" alt="css">
<img class="ic" src="./Image/JS.png" alt="JS">
<img class="ic" src="./Image/Bootstrap.png" alt="Bootstrap">
</div>
</div>
</section>
<section class="Insurtech" id="Insurtech">
<div class="Insurtech-info">
<h3>Experiências</h3>
<h4>Insurtech Innovation Program - 2021</h4>
<p>
Estagiário de inovação e tecnologia no Insurtech Innovation Program. O Insurtech Innovation Program é um programa de formação e cocriação multidisciplinar promovida pela PUC-Rio em parceria com a MAG Seguros e o IRB Brasil RE. Seu objetivo é criar soluções inovadoras que gerem impacto positivo no mercado de seguros e resseguros.</p>
<p><a href="http://insurtech.les.inf.puc-rio.br/">Saiba mais</a></p>
</div>
<div class="insu-img">
<img src="./Image/Insurtech.png" alt="">
</div>
</section>
<section class="globo" id="globo">
<div class="globo-img">
<img src="./Image/globo.png" alt="globo">
</div>
<div class="globo-info">
<h4>Globo - 2019 até 2021</h4>
<p> Estagiário no departamento Administrativo no Hub Digital da Globo.com era um setor da globo que cuida da gestão de dados e do desenvolvimento dos produtos digitais, visando a melhor experiência de consumo, interação e relacionamento com os usuários. Em março de 2020, após uma mudança no escopo da empresa, realizei uma movimentação interna, passando para o time de Governança da TV Globo Minhas preincipais atividades eram:
<ul>
<li> Elaboração de relatórios gerenciais.</li>
</li>Planejamento Financeiro e Orçamentário.</li>
<li>Gestão de contratos.</li>
</ul>
</p>
</div>
</section>
<section class="ef" id="ef">
<div class="ef-info">
<h4>EF - Education First</h4>
<p> Minha carreira profissional começou na EF, que é uma rede de escolas no exterior presente em mais de 100 países. Na EF eu pude desenvolver várias habilidades como: trabalho em equipe, organização, resiliência e negociação. </p><br>
<p><a href="https://www.ef.com/ca/about-us/">Saiba mais</a></p>
</div>
<div>
<img src="./Image/EF.png" alt="ef">
</div>
</section>
<section class="conhecimento" id="Projetos">
<div class="conhecimento-inf">
<div class="conhecimento-t">
<h3>Projetos</h3>
</div>
<div class="icones">
<div>
<img class="ic" src="./Image/Captura de Tela 2022-04-21 às 23.58.png" alt="html">
</div>
<div>
<img class="ic" src="./Image/Captura de Tela 2022-04-22 às 00.02.png" alt="css">
</div>
<div>
<img class="ic" src="./Image/Captura de Tela 2022-04-22 às 00.03.png" alt="css">
</div>
</div>
</div>
</section>
<section class="contato" id="contato">
<div>
<img src="./Image/contato.png" alt="contato">
</div>
<div class="contato-info">
<div>
<h3>Contato</h3>
</div>
<div class="in">
<img src="./Image/107178_circle_linkedin_icon 1.png" alt=""> <a href="https://www.linkedin.com/in/danielaraujo95/">linkedin</a>
</div>
<div class="em">
<img src="./Image/4096577_email_gmail_google_latter_mail_icon 1.png" alt=""> <a href="mailto:araujohipismo@gmail.com?subject=Questions" title="e-mail">E-mail</a>
</div>
<div class="git">
<img src="./Image/4202098_github_code_developer_logo_icon 2.png" alt=""> <a href="https://github.com/danielaraujo95" title="e-mail">Github</a>
</div>
</div>
</section>
<script src="./jquery-3.6.0.min.js"></script>
<script src="./App.js"></script>
</body>
</html>
| 42.524138 | 434 | 0.633798 |
1d2dcc33361a02585cd949199a9edafe13ec7f2e
| 239 |
lua
|
Lua
|
MMOCoreORB/bin/scripts/object/custom_content/tangible/food/generic/dish_patot_panak.lua
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 18 |
2017-02-09T15:36:05.000Z
|
2021-12-21T04:22:15.000Z
|
MMOCoreORB/bin/scripts/object/custom_content/tangible/food/generic/dish_patot_panak.lua
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 61 |
2016-12-30T21:51:10.000Z
|
2021-12-10T20:25:56.000Z
|
MMOCoreORB/bin/scripts/object/custom_content/tangible/food/generic/dish_patot_panak.lua
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 71 |
2017-01-01T05:34:38.000Z
|
2022-03-29T01:04:00.000Z
|
object_tangible_food_generic_dish_patot_panak = object_tangible_food_generic_shared_dish_patot_panak:new {
}
ObjectTemplates:addTemplate(object_tangible_food_generic_dish_patot_panak, "object/tangible/food/generic/dish_patot_panak.iff")
| 39.833333 | 127 | 0.899582 |
9c3ce3bd60774c694df4d94d74f558519c1235fc
| 3,249 |
js
|
JavaScript
|
src/lib/components/AntdBadge.react.js
|
ReilYoung/feffery-antd-components
|
594fb1284c7fec53da4dd1a64f0d505b71b859c3
|
[
"MIT"
] | 1 |
2022-02-26T10:02:08.000Z
|
2022-02-26T10:02:08.000Z
|
src/lib/components/AntdBadge.react.js
|
ReilYoung/feffery-antd-components
|
594fb1284c7fec53da4dd1a64f0d505b71b859c3
|
[
"MIT"
] | null | null | null |
src/lib/components/AntdBadge.react.js
|
ReilYoung/feffery-antd-components
|
594fb1284c7fec53da4dd1a64f0d505b71b859c3
|
[
"MIT"
] | null | null | null |
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Badge } from 'antd';
import 'antd/dist/antd.css';
// 定义徽标组件AntdBadge,api参数参考https://ant.design/components/badge-cn/
export default class AntdBadge extends Component {
render() {
// 取得必要属性或参数
let {
id,
children,
className,
style,
color,
count,
dot,
offset,
overflowCount,
showZero,
status,
text,
title,
size,
nClicks,
loading_state,
setProps
} = this.props;
// icon图标模式
return (
<Badge
id={id}
className={className}
style={style}
color={color}
count={count}
dot={dot}
offset={offset?.length === 2 ? offset : undefined}
overflowCount={overflowCount}
showZero={showZero}
status={status}
text={text}
title={title}
size={size}
onClick={() => {
nClicks++;
setProps({ nClicks: nClicks })
}}
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
>{children}</Badge>
);
}
}
// 定义参数或属性
AntdBadge.propTypes = {
// 组件id
id: PropTypes.string,
// 可选,传入要对其添加徽标的目标元素
children: PropTypes.node,
// css类名
className: PropTypes.string,
// 自定义css字典
style: PropTypes.object,
// 自定义徽标颜色
color: PropTypes.string,
// 自定义展示的数字,为0时若不设置showZero=true则会自动隐藏
// 可配合overflowCount参数设置展示封顶的数值大小,譬如count=105时
// 设置overflowCount=99,会显示为99+
count: PropTypes.number,
// 设置是否不展示数字,只显示一个小红点,默认为false
dot: PropTypes.bool,
// 设置徽标的位置像素偏移,格式为[x方向偏移, y方向偏移]
offset: PropTypes.arrayOf(PropTypes.number),
// 设置数字值封顶大小,默认为99
overflowCount: PropTypes.number,
// 设置当count=0时,是否仍然显示0数值,默认为false
showZero: PropTypes.bool,
// 设置徽标状态,可选的有'success'、'processing'、'default'、'error'及'warning'
status: PropTypes.oneOf(['success', 'processing', 'default', 'error', 'warning']),
// 当status已设置时有效,用于设置状态徽标的文本内容
text: PropTypes.string,
// 设置鼠标放在状态徽标上时显示的文字内容
title: PropTypes.string,
// 设置徽标规格大小,可选的有'default'和'small'
size: PropTypes.oneOf(['default', 'small']),
// 记录徽标被点击次数,默认为0
nClicks: PropTypes.number,
loading_state: PropTypes.shape({
/**
* Determines if the component is loading or not
*/
is_loading: PropTypes.bool,
/**
* Holds which property is loading
*/
prop_name: PropTypes.string,
/**
* Holds the name of the component that is loading
*/
component_name: PropTypes.string
}),
/**
* Dash-assigned callback that should be called to report property changes
* to Dash, to make them available for callbacks.
*/
setProps: PropTypes.func
};
// 设置默认参数
AntdBadge.defaultProps = {
nClicks: 0
}
| 24.428571 | 86 | 0.537396 |
284ce16f3e2bdfca103fa3a8c0bf0d394c0718e3
| 15 |
sql
|
SQL
|
spec/test/03/deploy/01.sql
|
art-ws/db-evo
|
0392d7683ad1e6390c1da92bd3b70725d4dd77a6
|
[
"MIT"
] | null | null | null |
spec/test/03/deploy/01.sql
|
art-ws/db-evo
|
0392d7683ad1e6390c1da92bd3b70725d4dd77a6
|
[
"MIT"
] | null | null | null |
spec/test/03/deploy/01.sql
|
art-ws/db-evo
|
0392d7683ad1e6390c1da92bd3b70725d4dd77a6
|
[
"MIT"
] | null | null | null |
\i './_t.sql';
| 7.5 | 14 | 0.4 |
e6ce0e6551578852f6e47126e601fd047391c7cd
| 1,408 |
sql
|
SQL
|
Sql/Schema/Tables/Articles/Articles.sql
|
Datasilk/Saber-Collector
|
e66b4cc489f5a649d62489b2a38155fe1822505c
|
[
"Apache-2.0"
] | null | null | null |
Sql/Schema/Tables/Articles/Articles.sql
|
Datasilk/Saber-Collector
|
e66b4cc489f5a649d62489b2a38155fe1822505c
|
[
"Apache-2.0"
] | null | null | null |
Sql/Schema/Tables/Articles/Articles.sql
|
Datasilk/Saber-Collector
|
e66b4cc489f5a649d62489b2a38155fe1822505c
|
[
"Apache-2.0"
] | null | null | null |
BEGIN TRY
CREATE TABLE [dbo].[Articles]
(
[articleId] INT NOT NULL PRIMARY KEY,
[feedId] INT NULL DEFAULT 0,
[subjects] SMALLINT NULL DEFAULT 0,
[subjectId] INT NULL DEFAULT 0,
[domainId] INT NULL DEFAULT 0,
[score] SMALLINT NULL DEFAULT 0,
[images] SMALLINT NULL DEFAULT 0,
[filesize] FLOAT NULL DEFAULT 0,
[linkcount] INT DEFAULT 0,
[linkwordcount] INT DEFAULT 0,
[wordcount] INT DEFAULT 0,
[sentencecount] SMALLINT DEFAULT 0,
[paragraphcount] SMALLINT DEFAULT 0,
[importantcount] SMALLINT DEFAULT 0,
[analyzecount] SMALLINT DEFAULT 0,
[yearstart] SMALLINT NULL DEFAULT 0,
[yearend] SMALLINT NULL DEFAULT 0,
[years] NVARCHAR(50) DEFAULT '',
[datecreated] DATETIME NULL,
[datepublished] DATETIME NULL,
[relavance] SMALLINT NULL DEFAULT 0,
[importance] SMALLINT NULL DEFAULT 0,
[fiction] SMALLINT NULL DEFAULT 1,
[domain] NVARCHAR(50) NULL DEFAULT '',
[url] NVARCHAR(250) NULL DEFAULT '',
[title] NVARCHAR(250) NULL DEFAULT '',
[summary] NVARCHAR(250) NULL DEFAULT '',
[analyzed] FLOAT DEFAULT 0,
[visited] INT NOT NULL DEFAULT 0,
[cached] BIT NULL DEFAULT 0,
[active] BIT NULL DEFAULT 0,
[deleted] BIT NULL DEFAULT 0
)
END TRY BEGIN CATCH END CATCH
| 38.054054 | 48 | 0.615057 |
39425f2f4cb152013fb309b253097c907a78e0ab
| 630 |
sql
|
SQL
|
resources/database/schema.sql
|
bsoliveira/slimapi
|
4e741b5b9dcf0177ef466db70c1c952f6018abd3
|
[
"CC0-1.0"
] | null | null | null |
resources/database/schema.sql
|
bsoliveira/slimapi
|
4e741b5b9dcf0177ef466db70c1c952f6018abd3
|
[
"CC0-1.0"
] | null | null | null |
resources/database/schema.sql
|
bsoliveira/slimapi
|
4e741b5b9dcf0177ef466db70c1c952f6018abd3
|
[
"CC0-1.0"
] | null | null | null |
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE (`email`)
);
--
-- Seed admin: admin@gmail.com, password: password
--
INSERT INTO `users`(`username`,`email`,`password`)
VALUES("Administrador","admin@gmail.com","$2y$10$hbMFu2OtL60r4QA37bLSXOboZU5XM6Pd8f9UHp7JToYvttMItc0RS");
| 30 | 105 | 0.726984 |
a07384c93e6f601fd0987241c409b99976c3d998
| 1,931 |
lua
|
Lua
|
kong/db/dao/vaults.lua
|
liyangau/kong
|
57f9ac4b92017ae34922773118e9d4caa9b19f08
|
[
"ECL-2.0",
"Apache-2.0"
] | 1 |
2022-03-12T22:13:37.000Z
|
2022-03-12T22:13:37.000Z
|
kong/db/dao/vaults.lua
|
johnfishbein/kong
|
6c0154e77985fc7b3bd5bdf6dfe924bf6dfd7ae3
|
[
"ECL-2.0",
"Apache-2.0"
] | 5 |
2022-02-16T15:57:27.000Z
|
2022-03-29T00:06:06.000Z
|
kong/db/dao/vaults.lua
|
johnfishbein/kong
|
6c0154e77985fc7b3bd5bdf6dfe924bf6dfd7ae3
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
local constants = require "kong.constants"
local utils = require "kong.tools.utils"
local vault_loader = require "kong.db.schema.vault_loader"
local Vaults = {}
local type = type
local pairs = pairs
local concat = table.concat
local insert = table.insert
local tostring = tostring
local log = ngx.log
local WARN = ngx.WARN
local DEBUG = ngx.DEBUG
local function load_vault_strategy(vault)
local ok, strategy = utils.load_module_if_exists("kong.vaults." .. vault)
if not ok then
return nil, vault .. " vault is enabled but not installed;\n" .. strategy
end
return strategy
end
local function load_vault(self, vault)
local db = self.db
if constants.DEPRECATED_VAULTS[vault] then
log(WARN, "vault '", vault, "' has been deprecated")
end
local strategy, err = load_vault_strategy(vault)
if not strategy then
return nil, err
end
if type(strategy.init) == "function" then
strategy.init()
end
local _, err = vault_loader.load_subschema(self.schema, vault, db.errors)
if err then
return nil, err
end
log(DEBUG, "Loading vault: ", vault)
return strategy
end
--- Load subschemas for enabled vaults into the Vaults entity. It has two side effects:
-- * It makes the Vault sub-schemas available for the rest of the application
-- * It initializes the Vault.
-- @param vault_set a set of vault names.
-- @return true if success, or nil and an error message.
function Vaults:load_vault_schemas(vault_set)
local strategies = {}
local errors
for vault in pairs(vault_set) do
local strategy, err = load_vault(self, vault)
if strategy then
strategies[vault] = strategy
else
errors = errors or {}
insert(errors, "on vault '" .. vault .. "': " .. tostring(err))
end
end
if errors then
return nil, "error loading vault schemas: " .. concat(errors, "; ")
end
self.strategies = strategies
return true
end
return Vaults
| 21.943182 | 87 | 0.701191 |
0b740ea892a08bb96379c733e82f7e4324d439a4
| 684 |
py
|
Python
|
examples/driving_in_traffic/scenarios/loop/scenario.py
|
zbzhu99/SMARTS
|
652aa23e71bd4e2732e2742140cfcd0ec082a7da
|
[
"MIT"
] | 2 |
2021-12-13T12:41:54.000Z
|
2021-12-16T03:10:24.000Z
|
examples/driving_in_traffic/scenarios/loop/scenario.py
|
zbzhu99/SMARTS
|
652aa23e71bd4e2732e2742140cfcd0ec082a7da
|
[
"MIT"
] | null | null | null |
examples/driving_in_traffic/scenarios/loop/scenario.py
|
zbzhu99/SMARTS
|
652aa23e71bd4e2732e2742140cfcd0ec082a7da
|
[
"MIT"
] | null | null | null |
from pathlib import Path
from smarts.sstudio import gen_scenario
from smarts.sstudio import types as t
traffic = t.Traffic(
flows=[
t.Flow(
route=t.RandomRoute(),
rate=60 * 60,
actors={t.TrafficActor(name="car", vehicle_type=vehicle_type): 1},
)
for vehicle_type in [
"passenger",
"bus",
"coach",
"truck",
"trailer",
"passenger",
"bus",
"coach",
"truck",
"trailer",
]
]
)
gen_scenario(
t.Scenario(
traffic={"basic": traffic},
),
output_dir=Path(__file__).parent,
)
| 20.117647 | 78 | 0.483918 |
2aa1e786bb780986bf73e07597b6124f6634abec
| 1,308 |
swift
|
Swift
|
Example/Peregrine_Example/PGRouteDefine.swift
|
joenggaa/Falcop
|
21c1c2c71ffb3d584ca86f04735216152f9257b8
|
[
"MIT"
] | 4 |
2020-01-06T06:47:12.000Z
|
2021-03-05T01:24:59.000Z
|
Example/Peregrine_Example/PGRouteDefine.swift
|
joenggaa/Falcop
|
21c1c2c71ffb3d584ca86f04735216152f9257b8
|
[
"MIT"
] | 2 |
2019-09-02T14:42:14.000Z
|
2020-03-08T03:31:36.000Z
|
Example/Peregrine_Example/PGRouteDefine.swift
|
joenggaa/Falcop
|
21c1c2c71ffb3d584ca86f04735216152f9257b8
|
[
"MIT"
] | null | null | null |
//
// PGRouteDefine.swift
// Peregrine
//
// Created by Rake Yang on 2021/07/09.
// Copyright © 2020 BinaryParadise. All rights reserved.
/**
Generated automatic by Peregrine version 0.9.0
Don't modify manually ⚠️
*/
import Foundation
public class PGRouteDefine: NSObject {
@objc static let ap_tlbb_most_like_wangyuyan = "ap://tlbb/most/like/wangyuyan?t=multi"
@objc static let ap_tlbb_most_like_wangzuxian = "ap://tlbb/most/like/wangzuxian?c=nice&a=%d&b=%@"
@objc static let ap_tlbb_wyy = "ap://tlbb/wyy?c=王语嫣1&result=%d"
@objc static let ap_tlbb_xlv = "ap://tlbb/xlv?c=小龙女"
@objc static let ap_tlbb_xxlv = "ap://tlbb/xxlv?c=小龙女"
@objc static let ap_tlbb_yangmi = "ap://tlbb/yangmi?c=杨幂22"
@objc static let swift_test_auth1 = "swift://test/auth1"
@objc static let swift_test_auth2 = "swift://test/auth2"
@objc static let swift_test_auth3 = "swift://test/auth3"
@objc static let ap_webview_UIWebView = "ap://webview/UIWebView"
@objc static let pg_test_m1 = "pg://test/m1?t=%@"
@objc static let _invalidurl_haha = "invalidurl/haha"
@objc static let swift_testsub_auth0 = "swift://testsub/auth0"
@objc static let swift_testsub_auth1 = "swift://testsub/auth1"
@objc static let swift_testsub_auth2 = "swift://testsub/auth2"
@objc static let swift_testsub_url = "swift://testsub/url"
}
| 40.875 | 98 | 0.731651 |
bb74b0d983ccc324bf501452fb1cbd29022ae366
| 716 |
rs
|
Rust
|
tests/stopwords_test.rs
|
jaroslavgratz/rake-rs
|
920167dff8d89ad4560c31d1a92f72e30bac5515
|
[
"Apache-2.0",
"MIT"
] | 20 |
2018-03-17T12:29:31.000Z
|
2022-03-04T11:50:03.000Z
|
tests/stopwords_test.rs
|
jaroslavgratz/rake-rs
|
920167dff8d89ad4560c31d1a92f72e30bac5515
|
[
"Apache-2.0",
"MIT"
] | 6 |
2019-03-10T10:00:50.000Z
|
2020-06-22T10:23:24.000Z
|
tests/stopwords_test.rs
|
jaroslavgratz/rake-rs
|
920167dff8d89ad4560c31d1a92f72e30bac5515
|
[
"Apache-2.0",
"MIT"
] | 6 |
2019-03-10T00:48:40.000Z
|
2022-01-28T19:31:31.000Z
|
extern crate rake;
use rake::StopWords;
#[test]
fn test_deref() {
let mut sw = StopWords::new();
sw.insert("What".to_string());
sw.insert("which".to_string());
sw.insert("Who".to_string());
sw.insert("tree".to_string());
sw.remove("tree");
assert_eq!(sw.contains("what"), true);
assert_eq!(sw.contains("which"), true);
assert_eq!(sw.contains("who"), true);
assert_eq!(sw.contains("tree"), false);
}
#[test]
fn test_file() {
let sw = StopWords::from_file("tests/SmartStoplist.txt").unwrap();
assert_eq!(sw.contains("what"), true);
assert_eq!(sw.contains("which"), true);
assert_eq!(sw.contains("who"), true);
assert_eq!(sw.contains("tree"), false);
}
| 23.866667 | 70 | 0.622905 |
eb50a84c1201a633f3f222a70f0c244bdfe90007
| 89 |
rs
|
Rust
|
packages/lib-wasm/src/processing/navigator/mod.rs
|
unchartedsoftware/synthetic-data-showcase
|
b128e116d9a2d5119f98d86d20224009d94c79b1
|
[
"MIT"
] | null | null | null |
packages/lib-wasm/src/processing/navigator/mod.rs
|
unchartedsoftware/synthetic-data-showcase
|
b128e116d9a2d5119f98d86d20224009d94c79b1
|
[
"MIT"
] | null | null | null |
packages/lib-wasm/src/processing/navigator/mod.rs
|
unchartedsoftware/synthetic-data-showcase
|
b128e116d9a2d5119f98d86d20224009d94c79b1
|
[
"MIT"
] | null | null | null |
pub mod attributes_intersection;
pub mod navigate_result;
pub mod selected_attributes;
| 14.833333 | 32 | 0.842697 |
da0141a597e1af9184fde706de8062429db071a8
| 332 |
lua
|
Lua
|
scripts/zones/Abyssea-Konschtat/npcs/Atma_Fabricant.lua
|
MatthewJHBerry/topaz
|
aa6f3a1b4be1f1ae1e71dde680d768d958e163a9
|
[
"FTL"
] | null | null | null |
scripts/zones/Abyssea-Konschtat/npcs/Atma_Fabricant.lua
|
MatthewJHBerry/topaz
|
aa6f3a1b4be1f1ae1e71dde680d768d958e163a9
|
[
"FTL"
] | null | null | null |
scripts/zones/Abyssea-Konschtat/npcs/Atma_Fabricant.lua
|
MatthewJHBerry/topaz
|
aa6f3a1b4be1f1ae1e71dde680d768d958e163a9
|
[
"FTL"
] | 1 |
2020-05-28T21:35:05.000Z
|
2020-05-28T21:35:05.000Z
|
-----------------------------------
-- Zone: Abyssea - Konschtat
-- NPC: Atma Fabricant
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
player:startEvent(2182)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
| 18.444444 | 44 | 0.593373 |
cf9d4dea8d1074e5368d8a95ca059f33833070e1
| 1,043 |
css
|
CSS
|
assets/plugins/noty/themes/sunset.min.css
|
radhsyn83/bubroto
|
a44c1ef2380454e8c1083466c927c60efae524af
|
[
"MIT"
] | null | null | null |
assets/plugins/noty/themes/sunset.min.css
|
radhsyn83/bubroto
|
a44c1ef2380454e8c1083466c927c60efae524af
|
[
"MIT"
] | null | null | null |
assets/plugins/noty/themes/sunset.min.css
|
radhsyn83/bubroto
|
a44c1ef2380454e8c1083466c927c60efae524af
|
[
"MIT"
] | null | null | null |
.noty_theme__sunset.noty_bar{margin:4px 0;overflow:hidden;border-radius:2px;position:relative}.noty_theme__sunset.noty_bar .noty_body{padding:10px;font-size:14px;text-shadow:1px 1px 1px rgba(0,0,0,.1)}.noty_theme__sunset.noty_bar .noty_buttons{padding:10px}.noty_theme__sunset.noty_type__alert,.noty_theme__sunset.noty_type__notification{background-color:#073b4c;color:#fff}.noty_theme__sunset.noty_type__alert .noty_progressbar,.noty_theme__sunset.noty_type__notification .noty_progressbar{background-color:#fff}.noty_theme__sunset.noty_type__warning{background-color:#ffd166;color:#fff}.noty_theme__sunset.noty_type__error{background-color:#ef476f;color:#fff}.noty_theme__sunset.noty_type__error .noty_progressbar{opacity:.4}.noty_theme__sunset.noty_type__info,.noty_theme__sunset.noty_type__information{background-color:#118ab2;color:#fff}.noty_theme__sunset.noty_type__info .noty_progressbar,.noty_theme__sunset.noty_type__information .noty_progressbar{opacity:.6}.noty_theme__sunset.noty_type__success{background-color:#06d6a0;color:#fff}
| 1,043 | 1,043 | 0.872483 |
1e446bbc3cfb2b70c1ebf5673b9313adafce046a
| 1,201 |
css
|
CSS
|
schemtic/lib/worklib/protection/rclamp0524p/sym_1/symbol.css
|
McDeggy/KVM_prototype
|
a1bfbb434f31bda57135e5452663c361452f3a5b
|
[
"Unlicense"
] | null | null | null |
schemtic/lib/worklib/protection/rclamp0524p/sym_1/symbol.css
|
McDeggy/KVM_prototype
|
a1bfbb434f31bda57135e5452663c361452f3a5b
|
[
"Unlicense"
] | null | null | null |
schemtic/lib/worklib/protection/rclamp0524p/sym_1/symbol.css
|
McDeggy/KVM_prototype
|
a1bfbb434f31bda57135e5452663c361452f3a5b
|
[
"Unlicense"
] | null | null | null |
P "CDS_LMAN_SYM_OUTLINE" "-125,275,200,-250" 0 0 0.00 0.00 22 0 0 0 0 0 0 0 0
L -125 275 -125 -250 -1 0
L -125 275 200 275 -1 0
L 200 275 200 -250 -1 0
L -125 -250 200 -250 -1 0
T 50 117 0 0 32 0 0 1 0 11 0
RCLAMP0524P
L -175 200 -125 200 -1 0
C -175 200 "1" -200 200 0 1 32 0 R
X "PIN_TEXT" "IN1" -115 200 0 0 24 0 0 0 0 0 1 0 0
L -175 75 -125 75 -1 0
C -175 75 "2" -200 75 0 1 32 0 R
X "PIN_TEXT" "IN2" -115 75 0 0 24 0 0 0 0 0 1 0 0
L 50 -300 50 -250 -1 0
C 50 -300 "3" 50 -325 0 1 32 1 R
X "PIN_TEXT" "GND" 50 -240 90 0 24 0 0 0 0 0 1 0 0
L -175 -50 -125 -50 -1 0
C -175 -50 "4" -200 -50 0 1 32 0 R
X "PIN_TEXT" "IN3" -115 -49 0 0 24 0 0 0 0 0 1 0 0
L -175 -175 -125 -175 -1 0
C -175 -175 "5" -200 -175 0 1 32 0 R
X "PIN_TEXT" "IN4" -115 -175 0 0 24 0 0 0 0 0 1 0 0
L 250 -175 200 -175 -1 0
C 250 -175 "6" 275 -175 0 1 32 0 L
X "PIN_TEXT" "OUT4" 190 -175 0 0 24 0 0 2 0 0 1 0 0
L 250 -50 200 -50 -1 0
C 250 -50 "7" 275 -50 0 1 32 0 L
X "PIN_TEXT" "OUT3" 190 -50 0 0 24 0 0 2 0 0 1 0 0
L 250 75 200 75 -1 0
C 250 75 "9" 275 75 0 1 32 0 L
X "PIN_TEXT" "OUT2" 190 74 0 0 24 0 0 2 0 0 1 0 0
L 250 200 200 200 -1 0
C 250 200 "10" 275 200 0 1 32 0 L
X "PIN_TEXT" "OUT1" 190 201 0 0 24 0 0 2 0 0 1 0 0
| 32.459459 | 77 | 0.587011 |
6b38ef412d677e9b57ecd24985c768f7dd6508b6
| 4,082 |
h
|
C
|
Gems/Atom/RHI/Metal/Code/Source/RHI/Fence.h
|
aaarsene/o3de
|
37e3b0226958974defd14dd6d808e8557dcd7345
|
[
"Apache-2.0",
"MIT"
] | 1 |
2021-07-20T12:39:24.000Z
|
2021-07-20T12:39:24.000Z
|
Gems/Atom/RHI/Metal/Code/Source/RHI/Fence.h
|
aaarsene/o3de
|
37e3b0226958974defd14dd6d808e8557dcd7345
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
Gems/Atom/RHI/Metal/Code/Source/RHI/Fence.h
|
aaarsene/o3de
|
37e3b0226958974defd14dd6d808e8557dcd7345
|
[
"Apache-2.0",
"MIT"
] | 1 |
2021-07-20T11:07:25.000Z
|
2021-07-20T11:07:25.000Z
|
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <Atom/RHI/Fence.h>
#include <Atom/RHI/Scope.h>
#include <AzCore/Memory/PoolAllocator.h>
#include <AzCore/std/containers/array.h>
#include <AzCore/std/smart_ptr/intrusive_ptr.h>
#include <Metal/Metal.h>
namespace AZ
{
namespace Metal
{
class Device;
//! A simple wrapper around MTLSharedEvent that also includes a monotonically increasing
//! fence value.
class Fence final
{
public:
AZ_CLASS_ALLOCATOR(Fence, AZ::SystemAllocator, 0);
RHI::ResultCode Init(RHI::Ptr<Device> metalDevice, RHI::FenceState initialState);
void Shutdown();
uint64_t Increment();
void SignalFromCpu();
void SignalFromCpu(uint64_t fenceValueToSignal);
void SignalFromGpu(id<MTLCommandBuffer> commandBufferToSignalFrom) const;
void SignalFromGpu(id<MTLCommandBuffer> commandBufferToSignalFrom, uint64_t fenceValueToSignal) const;
void WaitOnCpu() const;
void WaitOnCpu(uint64_t fenceValue) const;
void WaitOnGpu(id<MTLCommandBuffer> waitingCommandBuffer) const;
void WaitOnGpu(id<MTLCommandBuffer> waitingCommandBuffer, uint64_t fenceValueToWaitFor) const;
uint64_t GetPendingValue() const;
uint64_t GetCompletedValue() const;
RHI::FenceState GetFenceState() const;
id<MTLSharedEvent> Get() const;
private:
RHI::Ptr<Device> m_device;
id<MTLSharedEvent> m_fence = nil;
uint64_t m_pendingValue = 1;
};
//! A simple utility wrapping a set of fences, one for each command queue.
class FenceSet final
{
public:
FenceSet() = default;
void Init(RHI::Ptr<Device> metalDevice, RHI::FenceState initialState);
void Shutdown();
void Wait() const;
void Reset();
Fence& GetFence(RHI::HardwareQueueClass hardwareQueueClass);
const Fence& GetFence(RHI::HardwareQueueClass hardwareQueueClass) const;
private:
AZStd::array<Fence, RHI::HardwareQueueClassCount> m_fences;
};
using FenceValueSet = AZStd::array<uint64_t, RHI::HardwareQueueClassCount>;
//! The RHI fence implementation for Metal.
//! This exists separately from Fence to decouple
//! the RHI::Device instance from low-level queue management. This is because RHI::Fence holds
//! a reference to the RHI device, which would create circular dependency issues if the device
//! indirectly held a reference to one. Therefore, this implementation is only used when passing
//! fences back and forth between the user and the RHI interface. Low-level systems will use
//! the internal Fence instance instead.
class FenceImpl final
: public RHI::Fence
{
public:
AZ_CLASS_ALLOCATOR(FenceImpl, AZ::SystemAllocator, 0);
static RHI::Ptr<FenceImpl> Create();
Metal::Fence& Get()
{
return m_fence;
}
private:
FenceImpl() = default;
//////////////////////////////////////////////////////////////////////////
// RHI::Fence overrides ...
RHI::ResultCode InitInternal(RHI::Device& device, RHI::FenceState initialState) override;
void ShutdownInternal() override;
void SignalOnCpuInternal() override;
void WaitOnCpuInternal() const override;
void ResetInternal() override;
RHI::FenceState GetFenceStateInternal() const override;
//////////////////////////////////////////////////////////////////////////
Metal::Fence m_fence;
};
}
}
| 34.888889 | 158 | 0.601666 |
3eec3151dcff351d38a3799101756b54b395f037
| 679 |
h
|
C
|
headers/os/arch/x86_64/arch_debugger.h
|
Yn0ga/haiku
|
74e271b2a286c239e60f0ec261f4f197f4727eee
|
[
"MIT"
] | 1,338 |
2015-01-03T20:06:56.000Z
|
2022-03-26T13:49:54.000Z
|
headers/os/arch/x86_64/arch_debugger.h
|
Yn0ga/haiku
|
74e271b2a286c239e60f0ec261f4f197f4727eee
|
[
"MIT"
] | 15 |
2015-01-17T22:19:32.000Z
|
2021-12-20T12:35:00.000Z
|
headers/os/arch/x86_64/arch_debugger.h
|
Yn0ga/haiku
|
74e271b2a286c239e60f0ec261f4f197f4727eee
|
[
"MIT"
] | 350 |
2015-01-08T14:15:27.000Z
|
2022-03-21T18:14:35.000Z
|
/*
* Copyright 2005-2012, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _ARCH_X86_64_DEBUGGER_H
#define _ARCH_X86_64_DEBUGGER_H
#include <posix/arch/x86_64/signal.h>
struct x86_64_debug_cpu_state {
struct savefpu extended_registers;
uint64 gs;
uint64 fs;
uint64 es;
uint64 ds;
uint64 r15;
uint64 r14;
uint64 r13;
uint64 r12;
uint64 r11;
uint64 r10;
uint64 r9;
uint64 r8;
uint64 rbp;
uint64 rsi;
uint64 rdi;
uint64 rdx;
uint64 rcx;
uint64 rbx;
uint64 rax;
uint64 vector;
uint64 error_code;
uint64 rip;
uint64 cs;
uint64 rflags;
uint64 rsp;
uint64 ss;
} __attribute__((aligned(16)));
#endif // _ARCH_X86_64_DEBUGGER_H
| 15.088889 | 50 | 0.734904 |
f23cdde1551f6adc180bc6e9342ec64c5f70127e
| 502 |
kt
|
Kotlin
|
app/src/main/java/live/hms/android100ms/ui/meeting/chat/ChatUtil.kt
|
apnerve/sample-app-android
|
c7dd4d06cb708fc000201203227c40b5287a7d40
|
[
"MIT"
] | null | null | null |
app/src/main/java/live/hms/android100ms/ui/meeting/chat/ChatUtil.kt
|
apnerve/sample-app-android
|
c7dd4d06cb708fc000201203227c40b5287a7d40
|
[
"MIT"
] | null | null | null |
app/src/main/java/live/hms/android100ms/ui/meeting/chat/ChatUtil.kt
|
apnerve/sample-app-android
|
c7dd4d06cb708fc000201203227c40b5287a7d40
|
[
"MIT"
] | null | null | null |
package live.hms.android100ms.ui.meeting.chat
fun addMessageToChatCollections(
collection: MutableList<ChatMessageCollection>,
message: ChatMessage
) {
if (collection.isNotEmpty()) {
val lastMessage = collection.last()
if (lastMessage.peerId == message.customerId) {
lastMessage.messages.add(message)
return
}
}
// Add the message as new collection as previous message belongs
// to another user
collection.add(ChatMessageCollection.fromChatMessage(message))
}
| 25.1 | 66 | 0.739044 |
d45383d66c3a021c9c9768a3b0d28a1c7b9fdec4
| 3,933 |
lua
|
Lua
|
scripts/states/creeperEffect.lua
|
nanderv/LD41
|
1ccfa25fa76dfcf86e0dc314c0e13f3116904f72
|
[
"BSD-3-Clause"
] | null | null | null |
scripts/states/creeperEffect.lua
|
nanderv/LD41
|
1ccfa25fa76dfcf86e0dc314c0e13f3116904f72
|
[
"BSD-3-Clause"
] | null | null | null |
scripts/states/creeperEffect.lua
|
nanderv/LD41
|
1ccfa25fa76dfcf86e0dc314c0e13f3116904f72
|
[
"BSD-3-Clause"
] | null | null | null |
--
-- Created by IntelliJ IDEA.
-- User: nander
-- Date: 21/04/2018
-- Time: 18:03
-- To change this template use File | Settings | File Templates.
--
--
-- Created by IntelliJ IDEA.
-- User: nander
-- Date: 21/04/2018
-- Time: 18:25
-- To change this template use File | Settings | File Templates.
--
local menu = {} -- previously: Gamestate.new()
menu.name = "runCard"
function menu:enter(prev, state, cardIndex, card)
menu.prev = prev
menu.state = state
menu.card = cardIndex
menu.cardData = card or STATE.hand[cardIndex]
menu.showing = "costs"
menu.item = 1
menu.time = 0
menu.fromHand = not card
menu.cardDone = false
menu.cardEnding = false
end
local effects = {}
effects.add_cost = {
exec = function(card, index)
local c = scripts.gameobjects.cards[menu.cardData]
if c.costs and c.costs.type then
STATE.properties[c.costs.type] = STATE.properties[c.costs.type] - c.costs.value
end
end,
draw = function(card, index, time)
end,
duration = 1,
small = false,
}
effects.add_card = {
exec = function(card, index)
local c = scripts.gameobjects.cards[menu.cardData]
local effect = c.effects[index]
STATE.discardPile[#STATE.discardPile + 1] = effect.card
end,
draw = function(c, index, time)
scripts.rendering.renderCard.renderCard(scripts.gameobjects.cards[c.effects[index].card], 1210 - 1200 * (0.5 - time), 568 - 800 * (0.5 - time), 0.5)
end,
duration = 0.5,
small = false,
}
effects.place_building = {
exec = function(card, index)
local c = scripts.gameobjects.cards[menu.cardData]
local effect = c.effects[index]
scripts.gameobjects.buildings[effect.building]:build(STATE)
menu.cardEnding = true
end,
draw = function(card, index, time)
end,
duration = 0,
small = true,
}
effects.next_turn = {
exec = function(card, index)
local c = scripts.gameobjects.cards[STATE.hand[card]]
local effect = c.effects[index]
table.insert(STATE.currentTurnEffects, table.clone(effect))
end,
draw = function(card, index, time) end,
duration = 0,
small = true,
}
effects.resource = {
exec = function(card, index)
local c = scripts.gameobjects.cards[menu.cardData]
local effect = c.effects[index]
if effect.resource and STATE.properties[effect.resource] then
STATE.properties[effect.resource] = STATE.properties[effect.resource] + effect.value
end
end,
draw = function(card, index, time)
end,
duration = 0.5,
small = false,
}
menu.effects = effects
function menu:update(dt, wait)
menu.prev:update(dt, true)
end
function menu:draw()
menu.prev:draw(true)
love.graphics.push()
love.graphics.scale(GLOBSCALE())
scripts.rendering.renderUI.drawCard(menu.state, menu.cardData, false, true)
if scripts.gameobjects.cards[menu.cardData].is_creeper then
scripts.rendering.renderUI.drawMessage("Drew creeper .. " .. scripts.gameobjects.cards[menu.cardData].name .. "; a disaster occured.")
end
if menu.showing == "effects" then
effects[scripts.gameobjects.cards[menu.cardData].effects[menu.item].type].draw(scripts.gameobjects.cards[menu.cardData], menu.item, menu.time)
end
love.graphics.pop()
end
function menu:mousepressed(x, y, click)
if click == 1 then
Gamestate.pop()
for item = 1, #scripts.gameobjects.cards[menu.cardData].effects do
effects[scripts.gameobjects.cards[menu.cardData].effects[item].type].exec(menu.cardData, item)
end
else
scripts.rendering.renderUI.mousePressed(x, y, click)
end
end
function menu:mousereleased(x, y, mouse_btn)
scripts.rendering.renderUI.mouseReleased(x, y, mouse_btn)
end
function menu:wheelmoved(x, y)
scripts.rendering.renderUI.wheelmoved(x, y)
end
return menu
| 28.708029 | 156 | 0.660564 |
c4758853193db0af39082af2350304ead32bed91
| 87 |
sql
|
SQL
|
migrations/sqls/20200520071812-2faFix-down.sql
|
devcafe-latte/deadbolt
|
100e26d8416a55a11baf4204fffbb7c453c62795
|
[
"MIT"
] | null | null | null |
migrations/sqls/20200520071812-2faFix-down.sql
|
devcafe-latte/deadbolt
|
100e26d8416a55a11baf4204fffbb7c453c62795
|
[
"MIT"
] | 6 |
2020-04-06T06:12:22.000Z
|
2021-04-27T16:16:26.000Z
|
migrations/sqls/20200520071812-2faFix-down.sql
|
devcafe-latte/deadbolt
|
100e26d8416a55a11baf4204fffbb7c453c62795
|
[
"MIT"
] | null | null | null |
ALTER TABLE `emailTwoFactor`
DROP `userToken`,
DROP `attempt`;
DROP TABLE `totpToken`;
| 17.4 | 28 | 0.758621 |
3f3c134a06e7ec1ab30012b152cd65c7e5509c53
| 35 |
sql
|
SQL
|
test/JDBC/input/views/sys-hash_indexes.sql
|
babelfish-for-postgresql/babelfish_extensions
|
5d99ceee2dc1e1d1a18744a4405a6a86125631f0
|
[
"PostgreSQL",
"Apache-2.0",
"BSD-3-Clause"
] | 115 |
2021-10-29T18:17:24.000Z
|
2022-03-28T01:05:20.000Z
|
test/JDBC/input/views/sys-hash_indexes.sql
|
babelfish-for-postgresql/babelfish_extensions
|
5d99ceee2dc1e1d1a18744a4405a6a86125631f0
|
[
"PostgreSQL",
"Apache-2.0",
"BSD-3-Clause"
] | 81 |
2021-10-29T19:22:51.000Z
|
2022-03-31T19:31:12.000Z
|
test/JDBC/input/views/sys-hash_indexes.sql
|
babelfish-for-postgresql/babelfish_extensions
|
5d99ceee2dc1e1d1a18744a4405a6a86125631f0
|
[
"PostgreSQL",
"Apache-2.0",
"BSD-3-Clause"
] | 53 |
2021-10-30T01:26:50.000Z
|
2022-03-22T00:12:47.000Z
|
SELECT * FROM sys.hash_indexes;
GO
| 11.666667 | 31 | 0.771429 |
fe798e69e3d61738f93aae96906c785f8dbdb343
| 614 |
asm
|
Assembly
|
programs/oeis/047/A047350.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | 1 |
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/047/A047350.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/047/A047350.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
; A047350: Numbers that are congruent to {1, 2, 4} mod 7.
; 1,2,4,8,9,11,15,16,18,22,23,25,29,30,32,36,37,39,43,44,46,50,51,53,57,58,60,64,65,67,71,72,74,78,79,81,85,86,88,92,93,95,99,100,102,106,107,109,113,114,116,120,121,123,127,128,130,134,135,137,141
mov $2,$0
add $2,1
mov $5,$0
lpb $2
mov $0,$5
sub $2,1
sub $0,$2
mov $4,$0
mov $7,2
lpb $7
mov $0,$4
sub $7,1
add $0,$7
mul $0,4
cal $0,10410 ; Squares mod 49.
mov $3,$0
mov $6,$7
lpb $6
sub $6,1
mov $8,$3
lpe
lpe
lpb $4
mov $4,0
sub $8,$3
lpe
mov $3,$8
sub $3,7
add $1,$3
lpe
| 18.058824 | 197 | 0.534202 |
541deda0c94e70023deb426cefdc4234be254722
| 245 |
go
|
Go
|
input/main.go
|
genofire/logmania
|
29fb1c08011b244acc5e7ce298ae89a54f1261f9
|
[
"MIT"
] | null | null | null |
input/main.go
|
genofire/logmania
|
29fb1c08011b244acc5e7ce298ae89a54f1261f9
|
[
"MIT"
] | 8 |
2017-08-12T07:00:47.000Z
|
2017-11-20T18:47:34.000Z
|
input/main.go
|
genofire/logmania
|
29fb1c08011b244acc5e7ce298ae89a54f1261f9
|
[
"MIT"
] | null | null | null |
package input
import (
"github.com/bdlm/log"
)
var Register = make(map[string]Init)
type Input interface {
Listen()
Close()
}
type Init func(interface{}, chan *log.Entry) Input
func Add(name string, init Init) {
Register[name] = init
}
| 12.894737 | 50 | 0.693878 |
757e1c81f677107cc0656acbda35049a313beb2d
| 3,409 |
h
|
C
|
sqaodc/cuda/CUDAFormulas.h
|
rickyHong/Qubo-GPU-repl
|
a2bea6857885d318cd3aa6b6ed37dc6e7f011433
|
[
"Apache-2.0"
] | 51 |
2018-01-04T06:26:07.000Z
|
2022-03-31T12:05:16.000Z
|
sqaodc/cuda/CUDAFormulas.h
|
rickyHong/Qubo-GPU-repl
|
a2bea6857885d318cd3aa6b6ed37dc6e7f011433
|
[
"Apache-2.0"
] | 63 |
2018-02-21T10:57:26.000Z
|
2020-10-20T18:25:25.000Z
|
sqaodc/cuda/CUDAFormulas.h
|
rickyHong/Qubo-GPU-repl
|
a2bea6857885d318cd3aa6b6ed37dc6e7f011433
|
[
"Apache-2.0"
] | 15 |
2018-01-18T16:56:15.000Z
|
2021-09-16T12:19:43.000Z
|
#pragma once
#include <sqaodc/common/Common.h>
#include <sqaodc/cuda/DeviceFormulas.h>
namespace sqaod_cuda {
template<class real>
struct CUDADenseGraphFormulas : sqaod::cuda::DenseGraphFormulas<real> {
typedef sqaod::MatrixType<real> HostMatrix;
typedef sqaod::VectorType<real> HostVector;
typedef sqaod_cuda::DeviceMatrixType<real> DeviceMatrix;
typedef sqaod_cuda::DeviceVectorType<real> DeviceVector;
typedef sqaod_cuda::DeviceScalarType<real> DeviceScalar;
typedef sqaod_cuda::DeviceDenseGraphFormulas<real> DeviceFormulas;
void calculate_E(real *E, const HostMatrix &W, const HostVector &x);
void calculate_E(HostVector *E, const HostMatrix &W, const HostMatrix &x);
void calculateHamiltonian(HostVector *h, HostMatrix *J, real *c, const HostMatrix &W);
void calculate_E(real *E,
const HostVector &h, const HostMatrix &J, real c,
const HostVector &q);
void calculate_E(HostVector *E,
const HostVector &h, const HostMatrix &J, real c,
const HostMatrix &q);
void assignDevice(sqaod::cuda::Device &device);
sqaod_cuda::DeviceStream *devStream;
sqaod_cuda::DeviceCopy devCopy;
DeviceFormulas formulas;
CUDADenseGraphFormulas();
virtual ~CUDADenseGraphFormulas() { }
private:
CUDADenseGraphFormulas(const CUDADenseGraphFormulas &);
};
template<class real>
struct CUDABipartiteGraphFormulas : sqaod::cuda::BipartiteGraphFormulas<real> {
typedef sqaod::MatrixType<real> HostMatrix;
typedef sqaod::VectorType<real> HostVector;
typedef sqaod_cuda::DeviceMatrixType<real> DeviceMatrix;
typedef sqaod_cuda::DeviceVectorType<real> DeviceVector;
typedef sqaod_cuda::DeviceScalarType<real> DeviceScalar;
typedef sqaod_cuda::DeviceBipartiteGraphFormulas<real> DeviceFormulas;
void calculate_E(real *E,
const HostVector &b0, const HostVector &b1, const HostMatrix &W,
const HostVector &x0, const HostVector &x1);
void calculate_E(HostVector *E,
const HostVector &b0, const HostVector &b1, const HostMatrix &W,
const HostMatrix &x0, const HostMatrix &x1);
void calculate_E_2d(HostMatrix *E,
const HostVector &b0, const HostVector &b1, const HostMatrix &W,
const HostMatrix &x0, const HostMatrix &x1);
void calculateHamiltonian(HostVector *h0, HostVector *h1, HostMatrix *J, real *c,
const HostVector &b0, const HostVector &b1, const HostMatrix &W);
void calculate_E(real *E,
const HostVector &h0, const HostVector &h1, const HostMatrix &J,
real c,
const HostVector &q0, const HostVector &q1);
void calculate_E(HostVector *E,
const HostVector &h0, const HostVector &h1, const HostMatrix &J,
real c,
const HostMatrix &q0, const HostMatrix &q1);
void assignDevice(sqaod::cuda::Device &device);
sqaod_cuda::DeviceStream *devStream;
sqaod_cuda::DeviceCopy devCopy;
DeviceFormulas formulas;
CUDABipartiteGraphFormulas();
virtual ~CUDABipartiteGraphFormulas() { }
private:
CUDABipartiteGraphFormulas(const CUDABipartiteGraphFormulas &);
};
}
| 35.14433 | 95 | 0.664418 |
58c4366b5a404c2d1edd9b65186e0c62b084c303
| 4,291 |
rs
|
Rust
|
src/state.rs
|
stepchowfun/paxos
|
0f3a44d9b6743a55acbd0c42864d5b25c3d3c34d
|
[
"MIT"
] | 4 |
2019-05-24T12:29:44.000Z
|
2022-03-02T06:50:18.000Z
|
src/state.rs
|
stepchowfun/paxos
|
0f3a44d9b6743a55acbd0c42864d5b25c3d3c34d
|
[
"MIT"
] | null | null | null |
src/state.rs
|
stepchowfun/paxos
|
0f3a44d9b6743a55acbd0c42864d5b25c3d3c34d
|
[
"MIT"
] | null | null | null |
use {
crate::util::fsync,
futures::{
future::{err, ok},
prelude::Future,
},
serde::{Deserialize, Serialize},
std::{
cmp::Ordering,
io::{Error, ErrorKind::InvalidData},
path::Path,
sync::{Arc, RwLock},
},
tokio::{fs, fs::File},
};
// A representation of a proposal number
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProposalNumber {
pub round: u64,
pub proposer_ip: u32,
pub proposer_port: u16,
}
// We implement a custom ordering to ensure that round number takes precedence over proposer.
impl Ord for ProposalNumber {
fn cmp(&self, other: &Self) -> Ordering {
if self.round == other.round {
if self.proposer_ip == other.proposer_ip {
self.proposer_port.cmp(&other.proposer_port)
} else {
self.proposer_ip.cmp(&other.proposer_ip)
}
} else {
self.round.cmp(&other.round)
}
}
}
// `Ord` requires `PartialOrd`.
impl PartialOrd for ProposalNumber {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
// The state of the whole program is described by this struct.
#[derive(Deserialize, Serialize)]
pub struct State {
pub next_round: u64,
pub min_proposal_number: Option<ProposalNumber>,
pub accepted_proposal: Option<(ProposalNumber, String)>,
pub chosen_value: Option<String>,
}
// Return the state in which the program starts.
pub fn initial() -> State {
State {
next_round: 0,
min_proposal_number: None,
accepted_proposal: None,
chosen_value: None,
}
}
// Write the state to a file.
pub fn write(state: &State, path: &Path) -> impl Future<Item = (), Error = Error> {
// Clone some data that will outlive this function.
let path = path.to_owned();
// The `unwrap` is safe because serialization should never fail.
let payload = bincode::serialize(&state).unwrap();
// The `unwrap` is safe due to [ref:data_file_path_has_parent].
let parent = path.parent().unwrap().to_owned();
// Create the directories if necessary and write the file.
fs::create_dir_all(parent).and_then(move |_| {
File::create(path).and_then(move |file| {
tokio::io::write_all(file, payload).and_then(|(file, _)| fsync(file))
})
})
}
// Read the state from a file.
pub fn read(state: Arc<RwLock<State>>, path: &Path) -> impl Future<Item = (), Error = Error> {
// Clone some data that will outlive this function.
let path = path.to_owned();
// Do the read.
fs::read(path).and_then(move |data| {
// The `unwrap` is safe since it can only fail if a panic already happened.
let mut state_borrow = state.write().unwrap();
bincode::deserialize(&data).ok().map_or_else(
|| {
err(Error::new(
InvalidData,
"Unable to deserialize the persisted state.",
))
},
|result| {
*state_borrow = result;
ok(())
},
)
})
}
#[cfg(test)]
mod tests {
use crate::state::ProposalNumber;
#[test]
fn proposal_ord_round() {
let pn0 = ProposalNumber {
round: 0,
proposer_ip: 1,
proposer_port: 1,
};
let pn1 = ProposalNumber {
round: 1,
proposer_ip: 0,
proposer_port: 0,
};
assert!(pn1 > pn0);
}
#[test]
fn proposal_ord_proposer_ip() {
let pn0 = ProposalNumber {
round: 0,
proposer_ip: 0,
proposer_port: 1,
};
let pn1 = ProposalNumber {
round: 0,
proposer_ip: 1,
proposer_port: 0,
};
assert!(pn1 > pn0);
}
#[test]
fn proposal_ord_proposer_port() {
let pn0 = ProposalNumber {
round: 0,
proposer_ip: 0,
proposer_port: 0,
};
let pn1 = ProposalNumber {
round: 0,
proposer_ip: 0,
proposer_port: 1,
};
assert!(pn1 > pn0);
}
}
| 25.849398 | 94 | 0.555348 |
26487774638930b991acf0caf5108d7140b55c96
| 433 |
kt
|
Kotlin
|
app/src/main/java/nawrot/mateusz/lausannefleet/di/ActivityBuilderModule.kt
|
mateusz-nawrot/lausanne-fleet
|
419ad899a080e828a66ab38b481f5a351c4755cb
|
[
"MIT"
] | null | null | null |
app/src/main/java/nawrot/mateusz/lausannefleet/di/ActivityBuilderModule.kt
|
mateusz-nawrot/lausanne-fleet
|
419ad899a080e828a66ab38b481f5a351c4755cb
|
[
"MIT"
] | null | null | null |
app/src/main/java/nawrot/mateusz/lausannefleet/di/ActivityBuilderModule.kt
|
mateusz-nawrot/lausanne-fleet
|
419ad899a080e828a66ab38b481f5a351c4755cb
|
[
"MIT"
] | null | null | null |
package nawrot.mateusz.lausannefleet.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import nawrot.mateusz.lausannefleet.presentation.map.MapActivity
import nawrot.mateusz.lausannefleet.presentation.map.MapActivityModule
@Module
abstract class ActivityBuilderModule {
@ActivityScope
@ContributesAndroidInjector(modules = [MapActivityModule::class])
abstract fun mapActivity(): MapActivity
}
| 25.470588 | 70 | 0.833718 |
7c4acfd792105f0c49a53bcb9928b731ad24c0da
| 72,929 |
sql
|
SQL
|
src/tests/sql_regression/Goodx.cashbook.inte_cashbook.sql
|
margrit2103/github-actions-for-ci
|
3098130e92d4ef2bca31049ef3240663faeac540
|
[
"MIT"
] | null | null | null |
src/tests/sql_regression/Goodx.cashbook.inte_cashbook.sql
|
margrit2103/github-actions-for-ci
|
3098130e92d4ef2bca31049ef3240663faeac540
|
[
"MIT"
] | 16 |
2022-01-14T10:48:37.000Z
|
2022-01-14T15:04:14.000Z
|
src/tests/sql_regression/Goodx.cashbook.inte_cashbook.sql
|
margrit2103/github-actions-for-ci
|
3098130e92d4ef2bca31049ef3240663faeac540
|
[
"MIT"
] | null | null | null |
---------------------------------------------------------------------------------------------------------------------------------------
\echo set global parameters: static for test
---------------------------------------------------------------------------------------------------------------------------------------
SELECT set_config( 'test.finper' , lysglb.get_current_finperiod(1)::TEXT, false ) <> '' AS finper,
set_config( 'test.schema' , 'year'||mod( lysglb.get_current_finyear(1), 100 )::TEXT, false ) <> '' AS transaction_schema,
set_config( 'test.adir' , '1'::TEXT, false ) <> '' AS adir,
set_config( 'test.xml_template', '<era>
<header>
<a_id_integer>1</a_id_integer>
<delete_temp_integer>0</delete_temp_integer>
<global>
<adir_integer>%5$s</adir_integer>
<period_integer>%1$s</period_integer>
<user>AUTO</user>
</global>
<funder>
<name/>
</funder>
<reference_nos>
<goodx_cashbook>%2$s</goodx_cashbook>
<goodx_deposit_no/>
<allow_post_on_reconned>0</allow_post_on_reconned>
<bank_payment/>
</reference_nos>
<bank_deposit>
<bank_details>
<branch_code/>
<bank_name/>
<payer>S</payer>
</bank_details>
<transaction>
<paid_amount>100</paid_amount>
<date_time>2022-01-05T00:00:00</date_time>
</transaction>
</bank_deposit>
</header>
<payments>
<payment>
<a_id_integer>1</a_id_integer>
<transaction_type>%4$s</transaction_type>
<items>
<item>
<a_id_integer>1</a_id_integer>
<ledger>%3$s</ledger>
<paid_to_provider_amt>100</paid_to_provider_amt>
<vat>0</vat>
<payment_method>0</payment_method>
<cost_centre_id>0</cost_centre_id>
</item>
</items>
</payment>
</payments>
</era>', false) <> '' AS xml_template,
set_config( 'test.xml_template_reversal', '<era>
<header>
<a_id_integer>1</a_id_integer>
<delete_temp_integer>0</delete_temp_integer>
<global>
<adir_integer>%6$s</adir_integer>
<period_integer>%1$s</period_integer>
<user>AUTO</user>
</global>
<funder>
<name/>
</funder>
<reference_nos>
<goodx_cashbook>%2$s</goodx_cashbook>
<goodx_deposit_no>%5$s</goodx_deposit_no>
<allow_post_on_reconned>0</allow_post_on_reconned>
<bank_payment/>
</reference_nos>
<bank_deposit>
<bank_details>
<branch_code/>
<bank_name/>
<payer>S</payer>
</bank_details>
<transaction>
<paid_amount>100</paid_amount>
<date_time>2022-01-05T00:00:00</date_time>
</transaction>
</bank_deposit>
</header>
<payments>
<payment>
<a_id_integer>1</a_id_integer>
<transaction_type>-%4$s</transaction_type>
<items>
<item>
<a_id_integer>1</a_id_integer>
<ledger>%3$s</ledger>
<paid_to_provider_amt>100</paid_to_provider_amt>
<vat>0</vat>
<payment_method>0</payment_method>
<cost_centre_id>0</cost_centre_id>
</item>
</items>
</payment>
</payments>
</era>', false ) <> '' AS xml_template_reversal,
set_config( 'test.template_flag_tran_as_reconned', 'UPDATE %1$s SET ptipe = %7$s, kasrekon = %6$s WHERE entity = %2$s AND doknr = %3$L'
, false ) <> '' AS template_flag_tran_as_reconned;
;
\echo -----------------------------------------------------------------------------------------------------------------------------------------------
\echo --=======================================[TEST1: Deposit on KAS1, contra KAS2. Post and correction in KAS1, then another correction from KAS2]
\echo -----------------------------------------------------------------------------------------------------------------------------------------------
\echo set parameters for TEST1
SELECT set_config( 'test.primary_cashbook', 'KAS1', FALSE ) AS primary_cashbook,
set_config( 'test.contra_cashbook', 'KAS2', FALSE ) AS contra_cashbook,
set_config( 'test.primary_transaction', '20', FALSE ) AS primary_transaction,
set_config( 'test.contra_transaction', '30', FALSE ) AS contra_transaction;
WITH a AS (INSERT INTO lysglb.recon_mstr_s ( entity, cashbook )
SELECT current_setting( 'test.adir' )::Integer, substr( current_setting( 'test.primary_cashbook' ),4,10) ::INTEGER
RETURNING mainid)
SELECT set_config('test.reconid' , mainid::text, FALSE) <> '' AS recon_id FROM a;
\echo TEST1.00: post INTE-CASHBOOK deposit between KAS1 and KAS2
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template' )
, lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, current_setting( 'test.contra_cashbook' ) --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.adir') --5
)::xml --1
) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr,
set_config( 'test.contra_doknr', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr,
set_config( 'test.primary_analysis_table', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table,
set_config( 'test.contra_analysis_table', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
\echo Record posted document numbers
DO
$$
BEGIN
EXECUTE format('select set_config( %2$L ,doknr, false ), set_config( %3$L, nappikode, false ) from %1$s WHERE doknr = %4$L order by mainid desc limit 1', current_setting( 'test.primary_analysis_table' ),'test.primary_doknr','test.primary_nappi_doknr', current_setting( 'test.primary_doknr' ) );
EXECUTE format('select set_config( %2$L ,doknr, false ), set_config( %3$L, nappikode, false ) from %1$s WHERE doknr = %4$L order by mainid desc limit 1', current_setting( 'test.contra_analysis_table' ),'test.contra_doknr','test.contra_nappi_doknr', current_setting( 'test.contra_doknr' ) );
END;
$$;
\echo check(1) posted to correct tables (2) doknr vs nappikode
SELECT split_part( current_setting( 'test.primary_analysis_table' ), '.',2 ) AS primary_analysis_table,
split_part( current_setting( 'test.contra_analysis_table' ), '.',2 ) AS secondary_analysis_table,
current_setting( 'test.primary_doknr' ) = current_setting( 'test.contra_nappi_doknr' ) AS primary_doc_vs_contra_nappi,
current_setting( 'test.primary_nappi_doknr' ) = current_setting( 'test.contra_doknr' ) AS contra_doc_vs_primary_nappi;
\echo TEST1.01 : reverse INTE-CASHBOOK deposit between KAS1 and KAS2 on primary cashbook side.
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, current_setting( 'test.contra_cashbook' ) --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
-- check(1)posted to correct correct tables (2) same document numbers used for corrections AS source on both tables
SELECT split_part( current_setting( 'test.primary_analysis_table_reversal_p' ), '.',2 ) AS primary_analysis_table_reversal_p,
split_part( current_setting( 'test.contra_analysis_table_reversal_p' ), '.',2 ) AS contra_analysis_table_reversal_p,
current_setting( 'test.primary_doknr' )=current_setting( 'test.primary_doknr_reversal_p' ) AS primary_docno_for_reversal_ok,
current_setting( 'test.primary_nappi_doknr' )=current_setting( 'test.contra_doknr_reversal_p' ) AS contra_docno_for_reversal_ok;
\echo TEST1.02 : reverse INTE-CASHBOOK deposit between KAS1 and KAS2 on CONTRA cashbook side. (Change trantype to -30 and switch cashbook)
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, current_setting( 'test.primary_cashbook' ) --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
-- check(1)correct tables (2) same document numbers used for corrections AS source on both tables
SELECT split_part( current_setting( 'test.primary_analysis_table_reversal_p' ), '.',2 ) AS primary_analysis_table_reversal_p,
split_part( current_setting( 'test.contra_analysis_table_reversal_p' ), '.',2 ) AS contra_analysis_table_reversal_p,
current_setting ('test.primary_nappi_doknr' )=current_setting( 'test.primary_doknr_reversal_p' ) AS primary_docno_for_reversal_ok,
current_setting ('test.primary_doknr' )=current_setting( 'test.contra_doknr_reversal_p' ) AS contra_docno_for_reversal_ok;
---------------------------------------------------------------------------------------------------------------------------------------
\echo TEST1.1.2: Recon test - make sure that corrections cannot be posted if one of the two source transactions is flagged as reconned.
---------------------------------------------------------------------------------------------------------------------------------------
BEGIN; --recon_test_1_2
SAVEPOINT recon_test_1_2;
\echo TEST1.21 flag primary document as reconned
DO
$$
BEGIN
EXECUTE format(current_setting ('test.template_flag_tran_as_reconned')
,replace( current_setting( 'test.primary_analysis_table' ), '_s', '_d' ) --1
,current_setting( 'test.adir' ) --2
,current_setting( 'test.primary_doknr' ) --3
,current_setting( 'test.primary_cashbook' ) --4
,current_setting( 'test.primary_transaction' ) --5
,10 --6
,current_setting('test.reconid') --7
);
END;
$$;
\echo TEST1.22 Try and post correction from the primary document side (primary flagged as reconned) - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, current_setting( 'test.contra_cashbook' ) --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
\echo TEST1.22 Try and post correction from the contra document side (primary flagged as reconned) - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, current_setting( 'test.primary_cashbook' ) --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
ROLLBACK TO recon_test_1_2;
END; --recon_test_1_2
\echo TEST1.3 flag contra document as reconned,
BEGIN; --recon_test_1_3
SAVEPOINT recon_test_1_3;
DO
$$
BEGIN
EXECUTE format(current_setting ('test.template_flag_tran_as_reconned')
,replace( current_setting( 'test.contra_analysis_table' ), '_s', '_d' ) --1
,current_setting( 'test.adir' ) --2
,current_setting( 'test.contra_doknr' ) --3
,current_setting( 'test.contra_cashbook' ) --4
,current_setting( 'test.contra_transaction' ) --5
,10 --6
,current_setting('test.reconid') --7
);
END;
$$;
\echo TEST1.31 Try and post correction from the contra document side (contra flagged as reconned) - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, current_setting( 'test.primary_cashbook' ) --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
\echo TEST1.32 Try and post correction from the primary document side (contra flagged as reconned) - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, current_setting( 'test.contra_cashbook' ) --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
ROLLBACK TO recon_test_1_3;
END; --recon_test_1_3
---------------------------------------------------------------------------------------------------------------------------------------
\echo TEST1.4 Try and post correction to another cashbook. This must fail
---------------------------------------------------------------------------------------------------------------------------------------
BEGIN; --invalid_cashbook_test_1_4
SAVEPOINT invalid_cashbook_test_1_4;
\echo TEST1.41 Try and post correction from the primary document side - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, 'KAS3' --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
\echo TEST1.42 Try and post correction from the contra document side - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, 'KAS3' --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
ROLLBACK TO invalid_cashbook_test_1_4;
END; --invalid_cashbook_test_1_4
---------------------------------------------------------------------------------------------------------------------------------------
\echo TEST1.5 Try and post correction to a non-cashbook ledger. This must fail
---------------------------------------------------------------------------------------------------------------------------------------
BEGIN; --invalid_cashbook_test_1_5
SAVEPOINT invalid_cashbook_test_1_5;
\echo TEST1.51 Try and post correction from the primary document side - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, 'INC1' --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
\echo TEST1.52 Try and post correction from the contra document side - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, 'INC1' --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
ROLLBACK TO invalid_cashbook_test_1_5;
END; --invalid_cashbook_test_1_5
\echo ----------------------------------------------------------------------------------------
\echo --=======================================[TEST2: Cheque on KAS1, Contra (deposit) KAS2]
\echo ----------------------------------------------------------------------------------------
\echo set parameters for TEST2
SELECT set_config( 'test.primary_transaction', '30', FALSE ) AS primary_transaction,
set_config( 'test.contra_transaction', '20', FALSE ) AS contra_transaction;
\echo TEST2.00: post INTE-CASHBOOK cheque between KAS1 and KAS2
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template' )
, lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, current_setting( 'test.contra_cashbook' ) --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.adir') --5
)::xml --1
) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr,
set_config( 'test.contra_doknr', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr,
set_config( 'test.primary_analysis_table', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table,
set_config( 'test.contra_analysis_table', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
FROM a;
\echo Record posted document numbers
DO
$$
BEGIN
EXECUTE format('select set_config( %2$L ,doknr, false ), set_config( %3$L, nappikode, false ) from %1$s WHERE doknr = %4$L order by mainid desc limit 1', current_setting( 'test.primary_analysis_table' ),'test.primary_doknr','test.primary_nappi_doknr', current_setting( 'test.primary_doknr' ) );
EXECUTE format('select set_config( %2$L ,doknr, false ), set_config( %3$L, nappikode, false ) from %1$s WHERE doknr = %4$L order by mainid desc limit 1', current_setting( 'test.contra_analysis_table' ),'test.contra_doknr','test.contra_nappi_doknr', current_setting( 'test.contra_doknr' ) );
END;
$$;
\echo check(1) posted to correct tables (2) doknr vs nappikode
SELECT split_part( current_setting( 'test.primary_analysis_table' ), '.',2 ) AS primary_analysis_table,
split_part( current_setting( 'test.contra_analysis_table' ), '.',2 ) AS secondary_analysis_table,
current_setting( 'test.primary_doknr' ) = current_setting( 'test.contra_nappi_doknr' ) AS primary_doc_vs_contra_nappi,
current_setting( 'test.primary_nappi_doknr' ) = current_setting( 'test.contra_doknr' ) AS contra_doc_vs_primary_nappi;
\echo TEST2.01 : reverse INTE-CASHBOOK cheque between KAS1 and KAS2 on primary cashbook side.
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, current_setting( 'test.contra_cashbook' ) --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
-- check(1)posted to correct correct tables (2) same document numbers used for corrections AS source on both tables
SELECT split_part( current_setting( 'test.primary_analysis_table_reversal_p' ), '.',2 ) AS primary_analysis_table_reversal_p,
split_part( current_setting( 'test.contra_analysis_table_reversal_p' ), '.',2 ) AS contra_analysis_table_reversal_p,
current_setting( 'test.primary_doknr' )=current_setting( 'test.primary_doknr_reversal_p' ) AS primary_docno_for_reversal_ok,
current_setting( 'test.primary_nappi_doknr' )=current_setting( 'test.contra_doknr_reversal_p' ) AS contra_docno_for_reversal_ok;
\echo TEST2.02 : reverse INTE-CASHBOOK cheque between KAS1 and KAS2 on CONTRA cashbook side. (Change trantype to -20 and switch cashbook)
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, current_setting( 'test.primary_cashbook' ) --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
-- check(1)correct tables (2) same document numbers used for corrections AS source on both tables
SELECT split_part( current_setting( 'test.primary_analysis_table_reversal_p' ), '.',2 ) AS primary_analysis_table_reversal_p,
split_part( current_setting( 'test.contra_analysis_table_reversal_p' ), '.',2 ) AS contra_analysis_table_reversal_p,
current_setting ('test.primary_nappi_doknr' )=current_setting( 'test.primary_doknr_reversal_p' ) AS primary_docno_for_reversal_ok,
current_setting ('test.primary_doknr' )=current_setting( 'test.contra_doknr_reversal_p' ) AS contra_docno_for_reversal_ok;
---------------------------------------------------------------------------------------------------------------------------------------
\echo TEST2.1.2: Recon test - make sure that corrections cannot be posted if one of the two source transactions is flagged as reconned.
---------------------------------------------------------------------------------------------------------------------------------------
BEGIN; --recon_test_2_2
SAVEPOINT recon_test_2_2;
\echo TEST2.21 flag primary document as reconned
DO
$$
BEGIN
EXECUTE format(current_setting ('test.template_flag_tran_as_reconned')
,replace( current_setting( 'test.primary_analysis_table' ), '_s', '_d' ) --1
,current_setting( 'test.adir' ) --2
,current_setting( 'test.primary_doknr' ) --3
,current_setting( 'test.primary_cashbook' ) --4
,current_setting( 'test.primary_transaction' ) --5
,10 --6
,current_setting('test.reconid') --7
);
END;
$$;
\echo TEST2.22 Try and post correction from the primary document side (primary flagged as reconned) - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, current_setting( 'test.contra_cashbook' ) --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
\echo TEST2.22 Try and post correction from the contra document side (primary flagged as reconned) - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, current_setting( 'test.primary_cashbook' ) --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
ROLLBACK TO recon_test_2_2;
END; --recon_test_2_2
\echo Test2.3 flag contra document as reconned,
BEGIN; --recon_test_2_3
SAVEPOINT recon_test_2_3;
DO
$$
BEGIN
EXECUTE format(current_setting ('test.template_flag_tran_as_reconned')
,replace( current_setting( 'test.contra_analysis_table' ), '_s', '_d' ) --1
,current_setting( 'test.adir' ) --2
,current_setting( 'test.contra_doknr' ) --3
,current_setting( 'test.contra_cashbook' ) --4
,current_setting( 'test.contra_transaction' ) --5
,10 --6
,current_setting('test.reconid') --7
);
END;
$$;
\echo TEST2.31 Try and post correction from the contra document side (contra flagged as reconned) - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, current_setting( 'test.primary_cashbook' ) --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
FROM a;
\echo TEST2.32 Try and post correction from the primary document side (contra flagged as reconned) - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, current_setting( 'test.contra_cashbook' ) --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
ROLLBACK TO recon_test_2_3;
END; --recon_test_2_3
---------------------------------------------------------------------------------------------------------------------------------------
\echo TEST2.4 Try and post correction to another cashbook. This must fail
---------------------------------------------------------------------------------------------------------------------------------------
BEGIN; --invalid_cashbook_test_2_4
SAVEPOINT invalid_cashbook_test_2_4;
\echo TEST2.31 Try and post correction from the primary document side - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, 'KAS3' --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
\echo TEST2.32 Try and post correction from the contra document side - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, 'KAS3' --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
ROLLBACK TO invalid_cashbook_test_2_4;
END; --invalid_cashbook_test_2_4
---------------------------------------------------------------------------------------------------------------------------------------
\echo TEST2.5 Try and post correction to a non-cashbook ledger. This must fail
---------------------------------------------------------------------------------------------------------------------------------------
BEGIN; --invalid_cashbook_test_2_5
SAVEPOINT invalid_cashbook_test_2_5;
\echo TEST2.51 Try and post correction from the contra document side - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.primary_cashbook' ) --2
, 'INC1' --3
, current_setting( 'test.primary_transaction' )--4
, current_setting( 'test.primary_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
\echo TEST2.52 Try and post correction from the primary document side - should fail
with a AS ( select tariffs.cj_post_xml( format( current_setting( 'test.xml_template_reversal' ) , lysglb.get_current_finperiod(1)
, current_setting( 'test.contra_cashbook' ) --2
, 'INC1' --3
, current_setting( 'test.contra_transaction' )--4
, current_setting( 'test.contra_doknr' ) --5
, current_setting( 'test.adir') --6
)::xml ) AS res )
SELECT DISTINCT jsonb_array_elements( (xpath( 'era/feedback/summary/feedback_summary/text()',res ))[1]::TEXT::JSONB )->>'code' AS feedback_summary,
( xpath( 'era/feedback/summary/info/text()', res ) )[1]::TEXT AS info,
(xpath( 'era/feedback/summary/critical/text()', res ))[1]::TEXT AS critical_errors,
set_config( 'test.primary_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[1]::TEXT, false) <> '' AS primary_doknr_reversal_p,
set_config( 'test.contra_doknr_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/deposit_no/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_doknr_reversal_p,
set_config( 'test.primary_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[1]::TEXT, false) <> '' AS primary_analysis_table_reversal_p,
set_config( 'test.contra_analysis_table_reversal_p', (xpath( 'era/payments/payment/items/item/inte_cashbook/analysis_table/text()', res ))[2]::TEXT, FALSE) <> '' AS contra_analysis_table_reversal_p,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[1]::TEXT AS _primary_trantype,
(xpath( 'era/payments/payment/transaction_type/text()', res ))[2]::TEXT AS _contra_trantype
--, res
FROM a;
ROLLBACK TO invalid_cashbook_test_2_5;
END; --invalid_cashbook_test_2_5
| 89.593366 | 298 | 0.510839 |
1d835b21a623cd5e05fd2189659b01bdb3007b92
| 711 |
asm
|
Assembly
|
data/pokemon/base_stats/heatran.asm
|
TastySnax12/pokecrystal16-493-plus
|
9de36c8803c9bdf4b8564ed547f988b0b66f0c41
|
[
"blessing"
] | 2 |
2021-07-31T07:05:06.000Z
|
2021-10-16T03:32:26.000Z
|
data/pokemon/base_stats/heatran.asm
|
TastySnax12/pokecrystal16-493-plus
|
9de36c8803c9bdf4b8564ed547f988b0b66f0c41
|
[
"blessing"
] | null | null | null |
data/pokemon/base_stats/heatran.asm
|
TastySnax12/pokecrystal16-493-plus
|
9de36c8803c9bdf4b8564ed547f988b0b66f0c41
|
[
"blessing"
] | 3 |
2021-01-15T18:45:40.000Z
|
2021-10-16T03:35:27.000Z
|
db 0 ; species ID placeholder
db 91, 90, 106, 77, 130, 106
; hp atk def spd sat sdf
db FIRE, STEEL ; type
db 3 ; catch rate
db 255 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F50 ; gender ratio
db 100 ; unknown 1
db 10 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/heatran/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_SLOW ; growth rate
dn EGG_NONE, EGG_NONE ; egg groups
; tm/hm learnset
tmhm HEADBUTT, CURSE, ROAR, TOXIC, ROCK_SMASH, HIDDEN_POWER, SUNNY_DAY, SNORE, HYPER_BEAM, PROTECT, ENDURE, FRUSTRATION, SOLARBEAM, EARTHQUAKE, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, FIRE_BLAST, DETECT, REST, ATTRACT, STRENGTH, FLAMETHROWER
; end
| 32.318182 | 259 | 0.714487 |
d0467efba70bbc7b26acdb09d54a84aa68ff4cf1
| 469 |
lua
|
Lua
|
lovr-api/physics/HingeJoint/setLowerLimit.lua
|
jmiskovic/aquadeck
|
d9f1efa31cd9ac445ee5aa39339a5671ee80ff8b
|
[
"Unlicense"
] | 32 |
2017-01-13T23:15:10.000Z
|
2022-02-12T11:36:53.000Z
|
lovr-api/physics/HingeJoint/setLowerLimit.lua
|
jmiskovic/aquadeck
|
d9f1efa31cd9ac445ee5aa39339a5671ee80ff8b
|
[
"Unlicense"
] | 55 |
2017-11-22T07:34:49.000Z
|
2022-03-14T19:24:51.000Z
|
lovr-api/physics/HingeJoint/setLowerLimit.lua
|
jmiskovic/aquadeck
|
d9f1efa31cd9ac445ee5aa39339a5671ee80ff8b
|
[
"Unlicense"
] | 25 |
2017-10-06T21:57:27.000Z
|
2022-03-14T19:17:19.000Z
|
return {
summary = 'Set the HingeJoint\'s lower angle limit.',
description = 'Sets the lower limit of the hinge angle. This should be greater than -π.',
arguments = {
{
name = 'limit',
type = 'number',
description = 'The lower limit, in radians.'
}
},
returns = {},
related = {
'HingeJoint:getAngle',
'HingeJoint:getUpperLimit',
'HingeJoint:setUpperLimit',
'HingeJoint:getLimits',
'HingeJoint:setLimits'
}
}
| 23.45 | 92 | 0.616205 |
bb1e12044e2e6c1c0ce08fe9b392184efb9bd4bb
| 224 |
rb
|
Ruby
|
zoo-app/lib/zoo_app/animal_service_client.rb
|
azusa/pact-example
|
cfaf965d2022ada79bd8efa935f17c56eef34625
|
[
"MIT"
] | null | null | null |
zoo-app/lib/zoo_app/animal_service_client.rb
|
azusa/pact-example
|
cfaf965d2022ada79bd8efa935f17c56eef34625
|
[
"MIT"
] | null | null | null |
zoo-app/lib/zoo_app/animal_service_client.rb
|
azusa/pact-example
|
cfaf965d2022ada79bd8efa935f17c56eef34625
|
[
"MIT"
] | null | null | null |
require 'httparty'
class AnimalServiceClient
include HTTParty
base_uri 'http://animal-service.com'
def get_alligator
name = JSON.parse(self.class.get("/alligator").body)['name']
Alligator.new(name)
end
end
| 18.666667 | 64 | 0.723214 |
51d3512d2496ba24891e698fe7779ad301a46e09
| 63,889 |
sql
|
SQL
|
watchithd.sql
|
xabdoux/Watchithd
|
005862e3cdd2dc4d3af1b2b45c2ff01b211498f3
|
[
"MIT"
] | null | null | null |
watchithd.sql
|
xabdoux/Watchithd
|
005862e3cdd2dc4d3af1b2b45c2ff01b211498f3
|
[
"MIT"
] | null | null | null |
watchithd.sql
|
xabdoux/Watchithd
|
005862e3cdd2dc4d3af1b2b45c2ff01b211498f3
|
[
"MIT"
] | null | null | null |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Mer 27 Juillet 2016 à 22:42
-- Version du serveur : 5.6.17
-- Version de PHP : 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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 utf8 */;
--
-- Base de données : `watchithd`
--
-- --------------------------------------------------------
--
-- Structure de la table `actors`
--
CREATE TABLE IF NOT EXISTS `actors` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`actor_name1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`dist_name1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`actor_name2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`dist_name2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`actor_name3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`dist_name3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`actor_name4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`dist_name4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`actor_name5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`dist_name5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`movies_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `actors`
--
INSERT INTO `actors` (`id`, `actor_name1`, `dist_name1`, `actor_name2`, `dist_name2`, `actor_name3`, `dist_name3`, `actor_name4`, `dist_name4`, `actor_name5`, `dist_name5`, `movies_id`, `created_at`, `updated_at`) VALUES
(2, 'Tim Robbins', 'Andy Dufresne', 'Morgan Freeman', 'Ellis Boyd ''Red'' Redding', 'Bob Gunton', 'Warden Norton', 'William Sadler', 'Heywood', 'Clancy Brown', 'Captain Hadley', '2', '2016-07-26 15:26:25', '2016-07-26 14:26:25'),
(3, 'Louane Emera', '', ' Karin Viard', '', 'François Damiens', '', '', '', '', '', '3', '2016-07-26 17:57:40', '2016-07-26 16:57:40'),
(4, '', '', '', '', '', '', '', '', '', '', '4', '2016-07-26 19:28:16', '2016-07-26 18:28:16'),
(5, 'Robert Downey Jr.', 'Tony Stark / Iron Man', 'Chris Hemsworth', 'Thor', 'Mark Ruffalo', 'Bruce Banner / Hulk', 'Chris Evans', 'Steve Rogers / Captain America', 'Scarlett Johansson', 'Natasha Romanoff / Black Widow', '5', '2016-07-26 23:13:04', '2016-07-26 22:13:04'),
(6, 'Jennifer Lawrence', 'Katniss Everdeen', 'Josh Hutcherson', 'Peeta Mellark', 'Liam Hemsworth', 'Gale Hawthorne', 'Woody Harrelson', 'Haymitch Abernathy', '', '', '6', '2016-07-27 00:22:45', '2016-07-26 23:22:45'),
(7, 'Chris Pratt', 'Owen', 'Bryce Dallas Howard ', 'Claire', 'Irrfan Khan ', 'Masrani', 'Vincent D''Onofrio ', 'Hoskins', 'Ty Simpkins ', 'Gray', '7', '2016-07-27 01:12:55', '2016-07-27 00:12:55'),
(8, 'Harrison Ford ', 'Han Solo', 'Mark Hamill ', 'Luke Skywalker', 'Carrie Fisher', ' Princess Leia', 'Adam Driver', ' Rey', 'John Boyega ', 'Finn', '8', '2016-07-27 01:25:36', '2016-07-27 00:25:36'),
(9, 'Sandra Bulloc ', 'Scarlet Overkill', 'Jon Hamm ', 'Herb Overkill', 'Michael Keaton ', 'Walter Nelson', 'Allison Janney ', 'Madge Nelson', 'Steve Coogan ', 'Professor Flux / Tower Guard', '9', '2016-07-27 01:36:02', '2016-07-27 00:36:02'),
(10, 'Vin Diesel ', 'Dominic Toretto', 'Paul Walker', ' Brian O''Conner', 'Jason Statham ', 'Deckard Shaw', 'Michelle Rodriguez ', 'Letty', 'Jordana Brewster', ' Mia', '10', '2016-07-27 01:46:01', '2016-07-27 00:46:01'),
(11, 'Kate Winslet', 'Jeanine', 'Jai Courtney', 'Eric', 'Mekhi Phifer', 'Max', 'Shailene Woodley', 'Tris', 'Theo James', 'Four', '11', '2016-07-27 01:54:56', '2016-07-27 00:54:56'),
(12, 'Arnold Schwarzenegger', 'Guardian', 'Jason Clarke', 'ohn Connor', 'Emilia Clarke', 'Sarah Connor', 'Jai Courtney', 'Kyle Reese', 'J.K. Simmons', 'O''Brien', '12', '2016-07-27 02:01:28', '2016-07-27 01:01:28'),
(13, 'Dakota Johnson', 'Anastasia Steele', 'Jamie Dornan', 'Christian Grey', 'Jennifer Ehle', 'Carla', '', '', 'Eloise Mumford', 'Kate', '13', '2016-07-27 02:06:48', '2016-07-27 01:06:48'),
(14, 'Mark Wahlberg', 'John', 'Seth MacFarlane', 'Ted ', 'Amanda Seyfried', 'Samantha', 'Jessica Barth', 'Tami-Lynn', 'Giovanni Ribisi', 'Donny', '14', '2016-07-27 02:11:49', '2016-07-27 01:11:49'),
(15, 'Adam Sandler', 'Dracula', 'Andy Samberg', 'Jonathan ', 'Selena Gomez', 'Mavis', 'Kevin James', 'Frankenstein', 'Steve Buscemi', 'Wayne', '15', '2016-07-27 02:23:15', '2016-07-27 01:23:15'),
(16, 'Dylan O''Brien', 'Thomas', 'Ki Hong Lee', 'Minho', 'Kaya Scodelario', '', '', '', 'Thomas Brodie-Sangster', '', '16', '2016-07-27 12:11:07', '2016-07-27 11:11:07'),
(17, 'Tom Hardy', 'Max Rockatansky', 'Charlize Theron', 'Imperator Furiosa', 'Nicholas Hoult', 'Nux', 'Hugh Keays-Byrne', 'Immortan Joe', 'Nathan Jones', '', '17', '2016-07-27 12:25:30', '2016-07-27 11:25:30'),
(18, 'Sam Rockwell', 'Eric Bowen', 'Rosemarie DeWitt', 'Amy Bowen', 'Saxon Sharbino', 'Kendra Bowen', 'Kyle Catlett', 'Griffin Bowen', 'Kennedi Clements', '', '18', '2016-07-27 13:09:29', '2016-07-27 12:09:29'),
(19, 'George Clooney', 'Frank Walker', 'Hugh Laurie', 'Nix', 'Britt Robertson', 'Casey Newton', 'Raffey Cassidy', 'Athena', 'Tim McGraw', '', '19', '2016-07-27 13:33:57', '2016-07-27 12:33:57'),
(20, 'Tom Cruise', 'Ethan Hunt', 'Jeremy Renner', 'William Brandt ', 'Simon Pegg', 'Benji Dunn', 'Rebecca Ferguson', 'Ilsa Faust', 'Ving Rhames', 'Luther Stickell', '20', '2016-07-27 14:22:26', '2016-07-27 13:22:26'),
(21, 'Cate Blanchett', 'Stepmother', 'Lily James', 'Cinderella', 'Richard Madden', 'Prince', 'Helena Bonham', 'Fairy Godmother', 'Nonso Anozie', 'Captain', '21', '2016-07-27 16:08:36', '2016-07-27 15:08:36'),
(22, 'Miles Teller', 'Reed Richards', 'Michael B. Jordan', 'Johnny Storm', 'Kate Mara', 'Sue Storm', 'Jamie Bell', 'Ben Grimm / The Thing', 'Toby Kebbell', 'Victor Von Doom / Dr. Doom', '22', '2016-07-27 16:23:03', '2016-07-27 15:23:03'),
(23, 'Jeff Bridges', 'Master Gregory', 'Ben Barnes', 'Tom Ward', 'Julianne Moore', 'Mother Malkin', 'licia Vikander', 'Alice', 'Antje Traue', 'Bony Lizzie', '23', '2016-07-27 16:30:45', '2016-07-27 15:30:45'),
(24, 'Ed Skrein', 'Frank Martin', 'Ray Stevenson', 'Frank Senior', 'Loan Chabanol', 'Anna', 'Gabriella Wright', 'Gina', 'Tatiana Pajkovic', 'Maria', '24', '2016-07-27 16:40:04', '2016-07-27 15:40:04');
-- --------------------------------------------------------
--
-- Structure de la table `ar_servers`
--
CREATE TABLE IF NOT EXISTS `ar_servers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ar_name1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_link1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_name2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_link2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_name3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_link3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_name4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_link4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_name5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_link5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_name6` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ar_link6` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`movies_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `ar_servers`
--
INSERT INTO `ar_servers` (`id`, `ar_name1`, `ar_link1`, `ar_name2`, `ar_link2`, `ar_name3`, `ar_link3`, `ar_name4`, `ar_link4`, `ar_name5`, `ar_link5`, `ar_name6`, `ar_link6`, `movies_id`, `created_at`, `updated_at`) VALUES
(2, '', '', '', '', '', '', '', '', '', '', '', '', 2, '2016-07-26 15:26:25', '2016-07-26 14:26:25'),
(3, '', '', '', '', '', '', '', '', '', '', '', '', 3, '2016-07-26 17:03:26', '2016-07-26 16:03:26'),
(4, '', '', '', '', '', '', '', '', '', '', '', '', 4, '2016-07-26 19:28:16', '2016-07-26 18:28:16'),
(5, '', '', '', '', '', '', '', '', '', '', '', '', 5, '2016-07-26 23:13:05', '2016-07-26 22:13:05'),
(6, '', '', '', '', '', '', '', '', '', '', '', '', 6, '2016-07-27 00:22:46', '2016-07-26 23:22:46'),
(7, '', '', '', '', '', '', '', '', '', '', '', '', 7, '2016-07-27 01:12:55', '2016-07-27 00:12:55'),
(8, '', '', '', '', '', '', '', '', '', '', '', '', 8, '2016-07-27 01:25:37', '2016-07-27 00:25:37'),
(9, '', '', '', '', '', '', '', '', '', '', '', '', 9, '2016-07-27 01:36:03', '2016-07-27 00:36:03'),
(10, '', '', '', '', '', '', '', '', '', '', '', '', 10, '2016-07-27 01:46:01', '2016-07-27 00:46:01'),
(11, '', '', '', '', '', '', '', '', '', '', '', '', 11, '2016-07-27 01:54:56', '2016-07-27 00:54:56'),
(12, '', '', '', '', '', '', '', '', '', '', '', '', 12, '2016-07-27 02:01:28', '2016-07-27 01:01:28'),
(13, '', '', '', '', '', '', '', '', '', '', '', '', 13, '2016-07-27 02:06:49', '2016-07-27 01:06:49'),
(14, '', '', '', '', '', '', '', '', '', '', '', '', 14, '2016-07-27 02:11:49', '2016-07-27 01:11:49'),
(15, '', '', '', '', '', '', '', '', '', '', '', '', 15, '2016-07-27 02:23:15', '2016-07-27 01:23:15'),
(16, '', '', '', '', '', '', '', '', '', '', '', '', 16, '2016-07-27 12:11:08', '2016-07-27 11:11:08'),
(17, '', '', '', '', '', '', '', '', '', '', '', '', 17, '2016-07-27 12:25:30', '2016-07-27 11:25:30'),
(18, '', '', '', '', '', '', '', '', '', '', '', '', 18, '2016-07-27 13:09:29', '2016-07-27 12:09:29'),
(19, '', '', '', '', '', '', '', '', '', '', '', '', 19, '2016-07-27 13:33:57', '2016-07-27 12:33:57'),
(20, '', '', '', '', '', '', '', '', '', '', '', '', 20, '2016-07-27 14:22:26', '2016-07-27 13:22:26'),
(21, '', '', '', '', '', '', '', '', '', '', '', '', 21, '2016-07-27 16:08:37', '2016-07-27 15:08:37'),
(22, '', '', '', '', '', '', '', '', '', '', '', '', 22, '2016-07-27 16:23:03', '2016-07-27 15:23:03'),
(23, '', '', '', '', '', '', '', '', '', '', '', '', 23, '2016-07-27 16:30:46', '2016-07-27 15:30:46'),
(24, '', '', '', '', '', '', '', '', '', '', '', '', 24, '2016-07-27 16:40:05', '2016-07-27 15:40:05');
-- --------------------------------------------------------
--
-- Structure de la table `en_servers`
--
CREATE TABLE IF NOT EXISTS `en_servers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`en_name1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_link1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_name2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_link2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_name3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_link3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_name4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_link4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_name5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_link5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_name6` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`en_link6` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`movies_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `en_servers`
--
INSERT INTO `en_servers` (`id`, `en_name1`, `en_link1`, `en_name2`, `en_link2`, `en_name3`, `en_link3`, `en_name4`, `en_link4`, `en_name5`, `en_link5`, `en_name6`, `en_link6`, `movies_id`, `created_at`, `updated_at`) VALUES
(2, 'Thevideos', 'http://thevideos.tv/embed-dmxojpnjwmxx-728x410.html', '', '', '', '', '', '', '', '', '', '', 2, '2016-07-26 15:26:25', '2016-07-26 14:26:25'),
(3, '', '', '', '', '', '', '', '', '', '', '', '', 3, '2016-07-26 17:03:26', '2016-07-26 16:03:26'),
(4, '', '', '', '', '', '', '', '', '', '', '', '', 4, '2016-07-26 19:28:16', '2016-07-26 18:28:16'),
(5, 'Server 1', 'http://goo.gl/oO3cF6', '', '', '', '', '', '', '', '', '', '', 5, '2016-07-27 00:08:15', '2016-07-26 23:08:15'),
(6, 'Server 1', 'http://uptostream.com/iframe/ye92ejlnl7z5', '', '', '', '', '', '', '', '', '', '', 6, '2016-07-27 00:30:15', '2016-07-26 23:30:15'),
(7, 'Nowvideo', 'http://embed.nowvideo.sx/embed.php?v=0e169e0722782', '', '', '', '', '', '', '', '', '', '', 7, '2016-07-27 01:12:56', '2016-07-27 00:12:56'),
(8, '', '', '', '', '', '', '', '', '', '', '', '', 8, '2016-07-27 01:38:15', '2016-07-27 00:38:15'),
(9, '', '', '', '', '', '', '', '', '', '', '', '', 9, '2016-07-27 01:36:03', '2016-07-27 00:36:03'),
(10, 'Nowvideo', 'http://embed.nowvideo.sx/embed.php?v=5937cd02dc0d3', '', '', '', '', '', '', '', '', '', '', 10, '2016-07-27 01:46:01', '2016-07-27 00:46:01'),
(11, '', '', '', '', '', '', '', '', '', '', '', '', 11, '2016-07-27 01:54:56', '2016-07-27 00:54:56'),
(12, 'Nowvideo', 'http://embed.nowvideo.sx/embed.php?v=9b669948c0d4c', '', '', '', '', '', '', '', '', '', '', 12, '2016-07-27 02:01:28', '2016-07-27 01:01:28'),
(13, '', '', '', '', '', '', '', '', '', '', '', '', 13, '2016-07-27 02:06:49', '2016-07-27 01:06:49'),
(14, '', '', '', '', '', '', '', '', '', '', '', '', 14, '2016-07-27 02:11:49', '2016-07-27 01:11:49'),
(15, '', '', '', '', '', '', '', '', '', '', '', '', 15, '2016-07-27 02:23:16', '2016-07-27 01:23:16'),
(16, 'Nowvideo', 'https://www.youtube.com/embed/-44_igsZtgU', 'GoogleDrive', 'https://www.youtube.com/embed/-44_igsZtgU', 'Mega video', 'https://www.youtube.com/embed/-44_igsZtgU', 'Tune', 'https://www.youtube.com/embed/-44_igsZtgU', '', '', '', '', 16, '2016-07-27 12:11:08', '2016-07-27 11:11:08'),
(17, '', '', '', '', '', '', '', '', '', '', '', '', 17, '2016-07-27 12:29:39', '2016-07-27 11:29:39'),
(18, '', '', '', '', '', '', '', '', '', '', '', '', 18, '2016-07-27 13:09:29', '2016-07-27 12:09:29'),
(19, '', '', '', '', '', '', '', '', '', '', '', '', 19, '2016-07-27 13:33:57', '2016-07-27 12:33:57'),
(20, '', '', '', '', '', '', '', '', '', '', '', '', 20, '2016-07-27 14:22:27', '2016-07-27 13:22:27'),
(21, 'Spruto', 'http://www.spruto.tv/iframe_embed.php?video_id=120734', 'Server 2', 'http://hqq.tv/player/embed_player.php?vid=92NNWUD9N2KS&autoplay=none&hash_from=8e690f98a8c017373fcf567426307a56', '', '', '', '', '', '', '', '', 21, '2016-07-27 16:08:37', '2016-07-27 15:08:37'),
(22, '', '', '', '', '', '', '', '', '', '', '', '', 22, '2016-07-27 16:23:03', '2016-07-27 15:23:03'),
(23, 'Openload', 'https://openload.co/embed/VezUC4MvDpE/', '', '', '', '', '', '', '', '', '', '', 23, '2016-07-27 16:30:46', '2016-07-27 15:30:46'),
(24, '', '', '', '', '', '', '', '', '', '', '', '', 24, '2016-07-27 16:40:05', '2016-07-27 15:40:05');
-- --------------------------------------------------------
--
-- Structure de la table `es_servers`
--
CREATE TABLE IF NOT EXISTS `es_servers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`es_name1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_link1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_name2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_link2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_name3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_link3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_name4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_link4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_name5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_link5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_name6` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`es_link6` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`movies_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `es_servers`
--
INSERT INTO `es_servers` (`id`, `es_name1`, `es_link1`, `es_name2`, `es_link2`, `es_name3`, `es_link3`, `es_name4`, `es_link4`, `es_name5`, `es_link5`, `es_name6`, `es_link6`, `movies_id`, `created_at`, `updated_at`) VALUES
(2, '', '', '', '', '', '', '', '', '', '', '', '', 2, '2016-07-26 15:26:25', '2016-07-26 14:26:25'),
(3, '', '', '', '', '', '', '', '', '', '', '', '', 3, '2016-07-26 17:03:27', '2016-07-26 16:03:27'),
(4, '', '', '', '', '', '', '', '', '', '', '', '', 4, '2016-07-26 19:28:17', '2016-07-26 18:28:17'),
(5, '', '', '', '', '', '', '', '', '', '', '', '', 5, '2016-07-26 23:13:05', '2016-07-26 22:13:05'),
(6, '', '', '', '', '', '', '', '', '', '', '', '', 6, '2016-07-27 00:22:46', '2016-07-26 23:22:46'),
(7, '', '', '', '', '', '', '', '', '', '', '', '', 7, '2016-07-27 01:12:56', '2016-07-27 00:12:56'),
(8, '', '', '', '', '', '', '', '', '', '', '', '', 8, '2016-07-27 01:25:38', '2016-07-27 00:25:38'),
(9, '', '', '', '', '', '', '', '', '', '', '', '', 9, '2016-07-27 01:36:03', '2016-07-27 00:36:03'),
(10, '', '', '', '', '', '', '', '', '', '', '', '', 10, '2016-07-27 01:46:01', '2016-07-27 00:46:01'),
(11, '', '', '', '', '', '', '', '', '', '', '', '', 11, '2016-07-27 01:54:56', '2016-07-27 00:54:56'),
(12, '', '', '', '', '', '', '', '', '', '', '', '', 12, '2016-07-27 02:01:28', '2016-07-27 01:01:28'),
(13, '', '', '', '', '', '', '', '', '', '', '', '', 13, '2016-07-27 02:06:49', '2016-07-27 01:06:49'),
(14, '', '', '', '', '', '', '', '', '', '', '', '', 14, '2016-07-27 02:11:49', '2016-07-27 01:11:49'),
(15, '', '', '', '', '', '', '', '', '', '', '', '', 15, '2016-07-27 02:23:16', '2016-07-27 01:23:16'),
(16, '', '', '', '', '', '', '', '', '', '', '', '', 16, '2016-07-27 12:11:08', '2016-07-27 11:11:08'),
(17, '', '', '', '', '', '', '', '', '', '', '', '', 17, '2016-07-27 12:25:30', '2016-07-27 11:25:30'),
(18, '', '', '', '', '', '', '', '', '', '', '', '', 18, '2016-07-27 13:09:30', '2016-07-27 12:09:30'),
(19, '', '', '', '', '', '', '', '', '', '', '', '', 19, '2016-07-27 13:33:58', '2016-07-27 12:33:58'),
(20, '', '', '', '', '', '', '', '', '', '', '', '', 20, '2016-07-27 14:22:27', '2016-07-27 13:22:27'),
(21, '', '', '', '', '', '', '', '', '', '', '', '', 21, '2016-07-27 16:08:37', '2016-07-27 15:08:37'),
(22, '', '', '', '', '', '', '', '', '', '', '', '', 22, '2016-07-27 16:23:04', '2016-07-27 15:23:04'),
(23, '', '', '', '', '', '', '', '', '', '', '', '', 23, '2016-07-27 16:30:46', '2016-07-27 15:30:46'),
(24, '', '', '', '', '', '', '', '', '', '', '', '', 24, '2016-07-27 16:40:05', '2016-07-27 15:40:05');
-- --------------------------------------------------------
--
-- Structure de la table `fr_servers`
--
CREATE TABLE IF NOT EXISTS `fr_servers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`fr_name1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_link1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_name2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_link2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_name3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_link3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_name4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_link4` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_name5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_link5` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_name6` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fr_link6` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`movies_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `fr_servers`
--
INSERT INTO `fr_servers` (`id`, `fr_name1`, `fr_link1`, `fr_name2`, `fr_link2`, `fr_name3`, `fr_link3`, `fr_name4`, `fr_link4`, `fr_name5`, `fr_link5`, `fr_name6`, `fr_link6`, `movies_id`, `created_at`, `updated_at`) VALUES
(2, 'Server1', '/brafoz3/player.php?id=aH!BeF0cHM6Ly9waG90b3MuZ29vZ2xlLmNvbS9zaGFyZS9B!BeFjF!BeFaXBQTF94VGc1UFpGZGxwSUk0MDc4SnAzal!BeFibE5QeFNS!BeFnNlUElUQVY4eTJYSk5md3FXWTE2YUVqcUVxc0VjTDh3P2tleT1!BeFM2xUYUZaMFdYa3lVblkxUTJK!BeFE9HTllaa0ZNTWpKVVIzZG1MV3!BeFC&id2=', '', '', '', '', '', '', '', '', '', '', 2, '2016-07-26 21:09:55', '2016-07-26 20:09:55'),
(3, 'Streaming', 'https://openload.co/embed/fnXBHl5J6hw/', 'Server 2', 'http://hqq.tv/player/embed_player.php?vid=ZddT36Jj3Uk9', ' ', '', '', '', '', '', '', '', 3, '2016-07-26 18:12:44', '2016-07-26 17:12:44'),
(4, 'Server 1', 'http://goo.gl/xDyJEu', '', '', '', '', '', '', '', '', '', '', 4, '2016-07-26 19:28:17', '2016-07-26 18:28:17'),
(5, '', '', '', '', '', '', '', '', '', '', '', '', 5, '2016-07-26 23:13:05', '2016-07-26 22:13:05'),
(6, '', '', '', '', '', '', '', '', '', '', '', '', 6, '2016-07-27 00:22:47', '2016-07-26 23:22:47'),
(7, '', '', '', '', '', '', '', '', '', '', '', '', 7, '2016-07-27 01:12:56', '2016-07-27 00:12:56'),
(8, 'Server 1', 'http://uptostream.com/iframe/0nwlcgo71sff', '', '', '', '', '', '', '', '', '', '', 8, '2016-07-27 01:38:15', '2016-07-27 00:38:15'),
(9, 'streaming', 'http://goo.gl/IDkotK', '', '', '', '', '', '', '', '', '', '', 9, '2016-07-27 01:36:03', '2016-07-27 00:36:03'),
(10, '', '', '', '', '', '', '', '', '', '', '', '', 10, '2016-07-27 01:46:02', '2016-07-27 00:46:02'),
(11, 'Server 1', 'http://goo.gl/yIQgqJ', '', '', '', '', '', '', '', '', '', '', 11, '2016-07-27 01:54:57', '2016-07-27 00:54:57'),
(12, '', '', '', '', '', '', '', '', '', '', '', '', 12, '2016-07-27 02:01:29', '2016-07-27 01:01:29'),
(13, '', '', '', '', '', '', '', '', '', '', '', '', 13, '2016-07-27 02:06:49', '2016-07-27 01:06:49'),
(14, '', '', '', '', '', '', '', '', '', '', '', '', 14, '2016-07-27 02:11:49', '2016-07-27 01:11:49'),
(15, 'Openload', 'https://openload.io/embed/4pvtP3CK_MM/', '', '', '', '', '', '', '', '', '', '', 15, '2016-07-27 02:23:16', '2016-07-27 01:23:16'),
(16, '', '', '', '', '', '', '', '', '', '', '', '', 16, '2016-07-27 12:11:08', '2016-07-27 11:11:08'),
(17, 'Uptobox', 'http://goo.gl/TepFi3', '', '', '', '', '', '', '', '', '', '', 17, '2016-07-27 12:29:39', '2016-07-27 11:29:39'),
(18, 'Openload', 'https://openload.co/embed/7aaxhWy00CI/', 'Exashare', 'http://ajihezo.info/embed-4tcm3wpcr5j3-_-MUdUdVhUMkY4NVFDaWxETnUzVzBZWEIrSDhrL1J2UENXOU1rVFg4Mk5lL0VmOURhSWJRTkMweXRQY2FlRndOb3NKZlFTdmh0bGdUMApwSy9vWGh4N0ZRPT0K.html?247837657', '', '', '', '', '', '', '', '', 18, '2016-07-27 13:09:30', '2016-07-27 12:09:30'),
(19, 'Exashare', 'http://ajihezo.info/embed-h49rhyc8dwk1-_-MUdUdVhUMkY4NVFMbEUzVjVDRDBPRzVuVjhKZ1VPclNXOVprQ3lWcU02amJkWVRUZSswTkVFS2dJTTdDUTBjanFvVFlUdz09Cg==.html?307755101', '', '', '', '', '', '', '', '', '', '', 19, '2016-07-27 13:33:58', '2016-07-27 12:33:58'),
(20, 'Streaming', 'http://goo.gl/uS98sj', '', '', '', '', '', '', '', '', '', '', 20, '2016-07-27 14:22:27', '2016-07-27 13:22:27'),
(21, '', '', '', '', '', '', '', '', '', '', '', '', 21, '2016-07-27 16:08:37', '2016-07-27 15:08:37'),
(22, 'Google drive', 'https://865508acd718bfdcc95981a53b662d814b8f726f.googledrive.com/host/13vPlsY6OfyJ_rbbmkSEXOLe-eOzK81a4LQ/', 'Filmzenstream', 'http://filmzenstream.com/vid/les-4-fantastiques.html', '', '', '', '', '', '', '', '', 22, '2016-07-27 16:23:04', '2016-07-27 15:23:04'),
(23, '', '', '', '', '', '', '', '', '', '', '', '', 23, '2016-07-27 16:30:46', '2016-07-27 15:30:46'),
(24, 'Filmzenstream', 'http://filmzenstream.com/le-transporteur-4.html', '', '', '', '', '', '', '', '', '', '', 24, '2016-07-27 16:40:05', '2016-07-27 15:40:05');
-- --------------------------------------------------------
--
-- Structure de la table `genremovies`
--
CREATE TABLE IF NOT EXISTS `genremovies` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`genre_id` int(11) NOT NULL,
`movie_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `genremovies`
--
INSERT INTO `genremovies` (`id`, `genre_id`, `movie_id`, `created_at`, `updated_at`) VALUES
(2, 2, 2, '2016-07-26 15:26:25', '0000-00-00 00:00:00'),
(3, 3, 3, '2016-07-26 17:03:26', '0000-00-00 00:00:00'),
(4, 4, 4, '2016-07-26 19:28:16', '0000-00-00 00:00:00'),
(5, 5, 5, '2016-07-26 23:13:05', '0000-00-00 00:00:00'),
(6, 6, 6, '2016-07-27 00:22:45', '0000-00-00 00:00:00'),
(7, 7, 7, '2016-07-27 01:12:55', '0000-00-00 00:00:00'),
(8, 8, 8, '2016-07-27 01:25:37', '0000-00-00 00:00:00'),
(9, 9, 9, '2016-07-27 01:36:02', '0000-00-00 00:00:00'),
(10, 10, 10, '2016-07-27 01:46:01', '0000-00-00 00:00:00'),
(11, 11, 11, '2016-07-27 01:54:56', '0000-00-00 00:00:00'),
(12, 12, 12, '2016-07-27 02:01:28', '0000-00-00 00:00:00'),
(13, 13, 13, '2016-07-27 02:06:48', '0000-00-00 00:00:00'),
(14, 14, 14, '2016-07-27 02:11:49', '0000-00-00 00:00:00'),
(15, 15, 15, '2016-07-27 02:23:15', '0000-00-00 00:00:00'),
(16, 16, 16, '2016-07-27 12:11:07', '0000-00-00 00:00:00'),
(17, 17, 17, '2016-07-27 12:25:30', '0000-00-00 00:00:00'),
(18, 18, 18, '2016-07-27 13:09:29', '0000-00-00 00:00:00'),
(19, 19, 19, '2016-07-27 13:33:57', '0000-00-00 00:00:00'),
(20, 20, 20, '2016-07-27 14:22:26', '0000-00-00 00:00:00'),
(21, 21, 21, '2016-07-27 16:08:37', '0000-00-00 00:00:00'),
(22, 22, 22, '2016-07-27 16:23:03', '0000-00-00 00:00:00'),
(23, 23, 23, '2016-07-27 16:30:46', '0000-00-00 00:00:00'),
(24, 24, 24, '2016-07-27 16:40:05', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Structure de la table `genres`
--
CREATE TABLE IF NOT EXISTS `genres` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`genre_1` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`genre_2` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`genre_3` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `genres`
--
INSERT INTO `genres` (`id`, `genre_1`, `genre_2`, `genre_3`, `created_at`, `updated_at`) VALUES
(1, 'Action', 'Adolescents', '', '2016-07-26 13:54:25', '2016-07-26 10:27:39'),
(2, 'Crime', 'Drama', '', '2016-07-26 14:26:25', '2016-07-26 14:26:25'),
(3, 'Comedy', 'Drama', '', '2016-07-26 16:03:26', '2016-07-26 16:03:26'),
(4, 'Animation', 'Family', 'Comedy', '2016-07-26 18:28:16', '2016-07-26 18:28:16'),
(5, 'Action', 'Adventure', 'Science Fic.', '2016-07-26 22:13:05', '2016-07-26 22:13:05'),
(6, 'Adventure', 'Science Fic.', '', '2016-07-26 23:22:45', '2016-07-26 23:22:45'),
(7, 'Action', 'Adventure', 'Science Fic.', '2016-07-27 00:12:55', '2016-07-27 00:12:55'),
(8, 'Action', 'Adventure', 'Fantasy', '2016-07-27 00:25:36', '2016-07-27 00:25:36'),
(9, 'Animation', 'Comedy', 'Family', '2016-07-27 00:36:02', '2016-07-27 00:36:02'),
(10, 'Action', 'Crime', 'Thriller', '2016-07-27 00:46:01', '2016-07-27 00:46:01'),
(11, 'Adventure', 'Science Fic.', 'Thriller', '2016-07-27 00:54:56', '2016-07-27 00:54:56'),
(12, 'Action', 'Adventure', 'Science Fic.', '2016-07-27 01:01:28', '2016-07-27 01:01:28'),
(13, 'Drama', 'Romance', '', '2016-07-27 01:06:48', '2016-07-27 01:06:48'),
(14, 'Comedy', '', '', '2016-07-27 01:11:49', '2016-07-27 01:11:49'),
(15, 'Animation', 'Comedy', 'Family', '2016-07-27 01:23:15', '2016-07-27 01:23:15'),
(16, 'Action', 'Science Fic.', 'Thriller', '2016-07-27 11:11:07', '2016-07-27 11:11:07'),
(17, 'Action', 'Adventure', 'Science Fic.', '2016-07-27 11:25:30', '2016-07-27 11:25:30'),
(18, 'Terror', 'Thriller', '', '2016-07-27 12:09:29', '2016-07-27 12:09:29'),
(19, 'Action', 'Adventure', 'Family', '2016-07-27 12:33:57', '2016-07-27 12:33:57'),
(20, 'Action', 'Adventure', 'Thriller', '2016-07-27 13:22:26', '2016-07-27 13:22:26'),
(21, 'Drama', 'Fantasy', 'Romance', '2016-07-27 15:08:37', '2016-07-27 15:08:37'),
(22, 'Action', 'Adventure', 'Science Fic.', '2016-07-27 15:23:03', '2016-07-27 15:23:03'),
(23, 'Action', 'Adventure', 'Fantasy', '2016-07-27 15:30:46', '2016-07-27 15:30:46'),
(24, 'Action', 'Crime', 'Thriller', '2016-07-27 15:40:04', '2016-07-27 15:40:04');
-- --------------------------------------------------------
--
-- Structure de la table `migrations`
--
CREATE TABLE IF NOT EXISTS `migrations` (
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `movies`
--
CREATE TABLE IF NOT EXISTS `movies` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`country` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`language` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`director` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`producer` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`runtime` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`quality` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`trailer` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`tags` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`release_date` date NOT NULL,
`year` int(11) NOT NULL,
`rates_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `movies`
--
INSERT INTO `movies` (`id`, `title`, `country`, `language`, `director`, `producer`, `runtime`, `quality`, `cover`, `trailer`, `type`, `tags`, `release_date`, `year`, `rates_id`, `created_at`, `updated_at`) VALUES
(2, 'THE SHAWSHANK REDEMPTION', 'United States', ' English', 'Frank Darabont', ' Niki Marvin', '142 minutes', 'HQ', 'public/movies-images/1469546784.jpg', 'https://www.youtube.com/embed/6hB3S9bIaco', 'PG-13', 'THE SHAWSHANK REDEMPTION,Tim Robbins, Morgan Freeman, Bob Gunton ,William Sadler, Clancy Brown, crime, drama, best movie, top movie', '1994-10-23', 1994, '2', '2016-07-26 15:38:47', '2016-07-26 14:38:47'),
(3, 'THE BÉLIER FAMILY', 'France', 'French', 'Éric Lartigau', 'Philippe Rousselet, Éric Jehelmann, Stéphanie Bermann', '105 minutes', 'HD', 'public/movies-images/1469552605.jpg', 'https://www.youtube.com/embed/y36W7P1FxJI', 'PG-13', 'THE BÉLIER FAMILY, comedy, drama, Philippe Rousselet,best movie, movies 2016, top movies', '2014-12-17', 2014, '3', '2016-07-26 17:03:25', '2016-07-26 16:03:25'),
(4, 'Ice Age: Collision Course', 'United States', 'English', 'Mike Thurmeier', 'Lori Forte', '94 minutes', 'LQ', 'public/movies-images/1469561295.jpg', 'https://www.youtube.com/embed/HyLquKn3Swc', 'PG-3', 'Ice Age, Collision Course,animation, 2016 movies, family, comedy', '2016-07-13', 2016, '4', '2016-07-26 19:32:50', '2016-07-26 18:32:50'),
(5, 'Avengers: Age of Ultron', 'United States', 'English', 'Joss Whedon', 'Robert Downey Jr., Chris Evans, Mark Ruffalo', '2h 21min', 'HQ', 'public/movies-images/1469574784.jpg', 'https://www.youtube.com/embed/tmeOjFno6Do', 'PG-13', 'Avengers, Age of Ultron, adventure, science, action, movies 2016, new movies', '2015-04-13', 2015, '5', '2016-07-26 23:13:04', '2016-07-26 22:13:04'),
(6, 'The Hunger Games: Mockingjay - Part 2', 'United States, Germany', 'English', 'Francis Lawrence', 'Jennifer Lawrence, Josh Hutcherson, Liam Hemsworth', '2h 17min', 'MQ', 'public/movies-images/1469578965.jpg', 'https://www.youtube.com/embed/KmYNkasYthg', 'PG-13', 'The Hunger Games: Mockingjay - Part 2, Mockingjay, Hunger Games, adventure, science fiction, Jennifer Lawrence, Josh Hutcherson, Liam Hemsworth ', '2015-11-16', 2015, '6', '2016-07-27 00:22:45', '2016-07-26 23:22:45'),
(7, 'Jurassic World', 'United States', 'English', ' Colin Trevorrow', 'Chris Pratt, Bryce Dallas Howard, Ty Simpkins', '2h 4min', 'MQ', 'public/movies-images/1469581975.jpg', 'https://www.youtube.com/embed/RFinNxS5KN4', 'PG-13', '', '2015-06-09', 2015, '7', '2016-07-27 01:12:55', '2016-07-27 00:12:55'),
(8, 'Star Wars: The Force Awakens', 'United States', 'English', '.J. Abrams', 'Daisy Ridley, John Boyega, Oscar Isaac', '2h 15min', 'MQ', 'public/movies-images/1469582736.jpg', 'https://www.youtube.com/embed/sGbxmsDFVnE', 'PG-13', 'Star Wars: The Force Awakens, The Force Awakens, action, adventur, ', '2015-12-14', 2015, '8', '2016-07-27 01:25:36', '2016-07-27 00:25:36'),
(9, 'Minions', ' United States', 'English', 'Kyle Balda, Pierre Coffin', 'Sandra Bullock, Jon Hamm, Michael Keaton ', '1h 31min', 'MQ', 'public/movies-images/1469583362.jpg', 'https://www.youtube.com/embed/Wfql_DoHRKc', 'PG-8', 'Minions?Minions 2016 , comedy Minions , Minions family, ', '2015-07-10', 2015, '9', '2016-07-27 01:36:02', '2016-07-27 00:36:02'),
(10, 'Fast & Furious 7', 'United States', 'English', 'James Wan', 'Vin Diesel, Paul Walker, Dwayne Johnson', ' 2h 17min', 'HQ', 'public/movies-images/1469583960.jpg', 'https://www.youtube.com/embed/Skpu5HaVkOc', 'PG-13', 'Fast & Furious 7, cars , fast, furious, action, 2015 movies , speed,Vin Diesel, Paul Walker', '2015-03-16', 2015, '10', '2016-07-27 01:46:00', '2016-07-27 00:46:00'),
(11, 'Insurgent', 'United States', 'English', 'Robert Schwentke', 'Shailene Woodley, Ansel Elgort, Theo James', '1h 59min', 'HQ', 'public/movies-images/1469584495.jpg', 'https://www.youtube.com/embed/suZcGoRLXkU', 'PG-13', 'Insurgent, adventure, science fiction, movies 2016 , new movies', '2015-03-16', 2015, '11', '2016-07-27 01:54:56', '2016-07-27 00:54:55'),
(12, 'Terminator Genisys', 'United States', 'English', 'Alan Taylor', 'Arnold Schwarzenegger, Jason Clarke, Emilia Clarke', '2h 6min', 'HQ', 'public/movies-images/1469584888.JPG', 'https://www.youtube.com/embed/62E4FJTwSuc', 'PG-12', 'Terminator Genisys, action, adventure, science fiction , new films 2015 , new movies', '2015-07-01', 2015, '12', '2016-07-27 02:01:28', '2016-07-27 01:01:28'),
(13, 'Fifty Shades of Grey', 'United States', 'English', ' Sam Taylor-Johnson', ' Dakota Johnson, Jamie Dornan, Jennifer Ehle', ' 2h 5min', 'HQ', 'public/movies-images/1469585208.jpg', 'https://www.youtube.com/embed/SfZWFDs0LxA', 'PG-12', 'Fifty Shades of Grey,love, remance , new 2016,', '0205-02-09', 2015, '13', '2016-07-27 02:06:48', '2016-07-27 01:06:48'),
(14, 'Ted 2', 'United States', 'English', 'Seth MacFarlane', 'Mark Wahlberg, Seth MacFarlane, Amanda Seyfried', '1h 55min', 'HQ', 'public/movies-images/1469585508.jpg', 'https://www.youtube.com/embed/XnT-h5jJl6g', 'PG-8', 'Ted 2, comedy films, comedy movies, new movie comedy 2016', '2015-06-26', 2015, '14', '2016-07-27 02:11:48', '2016-07-27 01:11:48'),
(15, 'Hotel Transylvania 2', 'United States', 'English', 'Genndy Tartakovsky', 'Adam Sandler, Andy Samberg, Selena Gomez', '1h 29min', 'HQ', 'public/movies-images/1469586195.jpg', 'https://www.youtube.com/embed/T3nqmGgnJe8', 'PG-3', 'Hotel Transylvania 2, animation movie 2015 , animation comedy, new movies animation', '2015-09-25', 2015, '15', '2016-07-27 02:23:15', '2016-07-27 01:23:15'),
(16, 'Maze Runner: The Scorch Trials', 'United States', 'English', 'Wes Ball', 'Dylan O''Brien, Kaya Scodelario, Thomas Brodie-Sangster', '2h 12min', 'HQ', 'public/movies-images/1469621467.jpg', 'https://www.youtube.com/embed/-44_igsZtgU', 'PG-13', 'Maze Runner, The Scorch Trials,action , science fiction ', '2015-09-15', 2015, '16', '2016-07-27 12:11:07', '2016-07-27 11:11:07'),
(17, 'Mad Max: Fury Road', 'United States', 'English', 'George Miller', 'Tom Hardy, Charlize Theron, Nicholas Hoult', '2h', 'HQ', 'public/movies-images/1469622330.jpg', 'https://www.youtube.com/embed/hEJnMQG9ev8', 'PG-13', '', '2015-05-07', 2015, '17', '2016-07-27 12:25:30', '2016-07-27 11:25:30'),
(18, 'Poltergeist', 'United States | canada', 'English', 'Gil Kenan', 'Sam Rockwell, Rosemarie DeWitt, Kennedi Clements', '1h 33min', 'HQ', 'public/movies-images/1469624968.jpg', 'https://www.youtube.com/embed/fhr8d1yxSP8', 'PG-14', 'Poltergeist, herror movie, terror movie, thriler ', '2015-05-22', 2015, '18', '2016-07-27 13:09:28', '2016-07-27 12:09:28'),
(19, 'Tomorrowland', 'United States | Spain', 'English | French | Japanese', 'Brad Bird', 'George Clooney, Britt Robertson, Hugh Laurie', '2h 10min', 'MQ', 'public/movies-images/1469626437.jpg', 'https://www.youtube.com/embed/lNzukD8pS_s', 'PG-8', 'Tomorrowland, Tomorrowland 2015, Tomorrowland 2016, action, adventure ', '2015-05-09', 2015, '19', '2016-07-27 13:33:57', '2016-07-27 12:33:57'),
(20, 'Mission Impossible Rogue Nation', 'United States', 'English', 'Christopher McQuarrie', 'Tom Cruise, Rebecca Ferguson, Jeremy Renner', '2h 11min', '', 'public/movies-images/1469629346.jpg', 'https://www.youtube.com/embed/gOW_azQbOjw', 'PG-10', 'Mission Impossible Rogue Nation, action, adventure, Tom Cruise, Jeremy Renner', '2015-07-31', 2015, '20', '2016-07-27 14:32:40', '2016-07-27 13:32:40'),
(21, 'Cinderella', 'United States | UK', 'English', 'Kenneth Branagh', 'Lily James, Cate Blanchett, Richard Madden', '1h 45min', 'HQ', 'public/movies-images/1469635716.jpg', 'https://www.youtube.com/embed/20DF6U1HcGQ', 'PG-3', 'Cinderella, Drama, romance, new movies 2016, Cinderella 2015', '2015-03-13', 2015, '21', '2016-07-27 16:08:36', '2016-07-27 15:08:36'),
(22, 'Fantastic Four', 'United States | Germany | UK | Canada', 'English', 'Josh Trank', 'Miles Teller, Kate Mara, Michael B. Jordan', '1h 40min', 'HQ', 'public/movies-images/1469636582.jpg', 'https://www.youtube.com/embed/_rRoD28-WgU', 'PG-10', 'Fantastic Four 2015, new movies 2016', '2015-08-07', 2015, '22', '2016-07-27 16:23:02', '2016-07-27 15:23:02'),
(23, 'Seventh Son', 'United States | UK | Canada | China', 'English', 'Sergey Bodrov', 'Ben Barnes, Julianne Moore, Jeff Bridges', '1h 42min', 'HQ', 'public/movies-images/1469637045.jpg', 'https://www.youtube.com/embed/TXiNkOjM7oM', 'PG-13', 'Seventh Son 2015 , new movies, action', '2015-02-06', 2015, '23', '2016-07-27 16:30:45', '2016-07-27 15:30:45'),
(24, 'The Transporter Refueled', 'France | China | Belgium', 'English', 'Camille Delamarre', 'Ed Skrein, Loan Chabanol, Ray Stevenson', '1h 36min', 'HQ', 'public/movies-images/1469637604.jpg', 'https://www.youtube.com/embed/sU5lEfAkOGM', 'PG-13', 'The Transporter Refueled, Transporter 2015, new Transporter movie,', '2015-08-25', 2015, '24', '2016-07-27 16:40:04', '2016-07-27 15:40:04');
-- --------------------------------------------------------
--
-- Structure de la table `password_resets`
--
CREATE TABLE IF NOT EXISTS `password_resets` (
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY `password_resets_email_index` (`email`),
KEY `password_resets_token_index` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `rates`
--
CREATE TABLE IF NOT EXISTS `rates` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`star` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `rates`
--
INSERT INTO `rates` (`id`, `star`, `created_at`, `updated_at`) VALUES
(1, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i>', '2016-07-26 10:27:38', '2016-07-26 10:27:38'),
(2, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i>', '2016-07-26 14:26:24', '2016-07-26 14:26:24'),
(3, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i>', '2016-07-26 16:03:25', '2016-07-26 16:03:25'),
(4, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i>', '2016-07-26 18:28:15', '2016-07-26 18:28:15'),
(5, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-26 22:13:04', '2016-07-26 22:13:04'),
(6, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-26 23:22:45', '2016-07-26 23:22:45'),
(7, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 00:12:55', '2016-07-27 00:12:55'),
(8, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i>', '2016-07-27 00:25:36', '2016-07-27 00:25:36'),
(9, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i>', '2016-07-27 00:36:02', '2016-07-27 00:36:02'),
(10, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i>', '2016-07-27 00:46:00', '2016-07-27 00:46:00'),
(11, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 00:54:55', '2016-07-27 00:54:55'),
(12, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i>', '2016-07-27 01:01:28', '2016-07-27 01:01:28'),
(13, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 01:06:48', '2016-07-27 01:06:48'),
(14, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 01:11:48', '2016-07-27 01:11:48'),
(15, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 01:23:15', '2016-07-27 01:23:15'),
(16, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 11:11:07', '2016-07-27 11:11:07'),
(17, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i>', '2016-07-27 11:25:30', '2016-07-27 11:25:30'),
(18, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 12:09:28', '2016-07-27 12:09:28'),
(19, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i>', '2016-07-27 12:33:57', '2016-07-27 12:33:57'),
(20, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i>', '2016-07-27 13:22:26', '2016-07-27 13:22:26'),
(21, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 15:08:36', '2016-07-27 15:08:36'),
(22, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 15:23:02', '2016-07-27 15:23:02'),
(23, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 15:30:45', '2016-07-27 15:30:45'),
(24, '<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star-o"></i>', '2016-07-27 15:40:04', '2016-07-27 15:40:04');
-- --------------------------------------------------------
--
-- Structure de la table `storylines`
--
CREATE TABLE IF NOT EXISTS `storylines` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`en` text COLLATE utf8_unicode_ci NOT NULL,
`fr` text COLLATE utf8_unicode_ci NOT NULL,
`es` text COLLATE utf8_unicode_ci NOT NULL,
`ar` text COLLATE utf8_unicode_ci NOT NULL,
`movies_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
--
-- Contenu de la table `storylines`
--
INSERT INTO `storylines` (`id`, `en`, `fr`, `es`, `ar`, `movies_id`, `created_at`, `updated_at`) VALUES
(2, ' Andy Dufresne is a young and successful banker whose life changes drastically when he is convicted and sentenced to life imprisonment for the murder of his wife and her lover. Set in the 1940''s, the film shows how Andy, with the help of his friend Red, the prison entrepreneur, turns out to be a most unconventional prisoner.', '', '', '', 2, '2016-07-26 15:26:25', '2016-07-26 14:26:25'),
(3, ' The Béliers are ordinary people : Rodolphe and Gigi are married, have two children and run their farm for a living. Ordinary people? Well, almost… since three of them, Dad, Mum and their son Quentin, are deaf. Which is not the case of the boy’s big sister, Paula. And not only can she speak but her music teacher scouts her beautiful voice as well. He offers her to sit for the entrance exam of the Maîtrise de Radio France, a vocal elite choir in Paris. Her parents, who rely on her as their ears and mouth in the outside world, take the news badly. Paula, who hates the idea of betraying her parents and her brother, goes through a painful dilemma…\r\n', 'Dans la famille Bélier, tout le monde est sourd sauf Paula, 16 ans. Elle est une interprète indispensable àses parents au quotidien, notamment pour l’exploitation de la ferme familiale. Un jour, poussée par son professeur de musique qui lui a découvert un don pour le chant, elle décide de préparer le concours de Radio France. Un choix de vie qui signifierait pour elle l’éloignement de sa famille et un passage inévitable à l’âge adulte.\r\n', '', '', 3, '2016-07-26 17:58:56', '2016-07-26 16:58:56'),
(4, '', 'L’éternelle quête de Scrat pour attraper son insaisissable gland le catapulte dans l’espace, où il déclenche accidentellement une série d’événements cosmiques qui vont transformer et menacer le monde de l’Âge de Glace. Pour survivre, Sid, Manny, Diego et le reste de la bande vont devoir quitter leur foyer et se lancer dans une nouvelle aventure pleine d’humour au cours de laquelle ils vont traverser d’incroyables paysages exotiques et rencontrer des personnages tous plus étonnants les uns que les autres.', '', '', 4, '2016-07-26 19:30:38', '2016-07-26 18:30:38'),
(5, ' When Tony Stark tries to jumpstart a dormant peacekeeping program, things go awry and Earth''s Mightiest Heroes, including Iron Man, Captain America, Thor, the Incredible Hulk, Black Widow and Hawkeye, are put to the ultimate test as the fate of the planet hangs in the balance.\r\n As the villainous Ultron emerges, it is up to the Avengers to stop him from enacting his terrible plans, and soon uneasy alliances and unexpected action pave the way for a global adventure.', '', '', '', 5, '2016-07-26 23:13:05', '2016-07-26 22:13:05'),
(6, ' After young Katniss Everdeen agrees to be the symbol of rebellion,\r\nthe Mockingjay, she tries to return Peeta to his normal state, tries \r\nto get to the Capitol, and tries to deal with the battles coming her \r\nway...but all for her main goal; assassinating President Snow and returning\r\npeace to the Districts of Panem. As her squad starts to get smaller and\r\nsmaller, will she make it to the Capitol? Will she get revenge on Snow?\r\nOr will her target change? Will she be with her "Star-Crossed Lover", Peeta?\r\nOr her long time friend, Gale? Deaths, Bombs, Bows and Arrows, A Love Triangle,\r\nHope. What will happen?', '', '', '', 6, '2016-07-27 00:22:46', '2016-07-26 23:22:46'),
(7, ' 22 years after the original Jurassic Park failed, the new park (also known as Jurassic World) is open for business. After years of studying genetics the \r\nscientists on the park genetically engineer a new breed of dinosaur. When everything goes horribly wrong, will our heroes make it off the island?', '', '', '', 7, '2016-07-27 01:12:55', '2016-07-27 00:12:55'),
(8, ' 30 years after the defeat of Darth Vader and the Empire, Rey, a scavenger from the planet Jakku, finds a BB-8 droid that knows the whereabouts of the long lost Luke Skywalker.\r\nare thrown into the middle of a battle between the resistance and the daunting legions of the First Order.', '', '', '', 8, '2016-07-27 01:25:37', '2016-07-27 00:25:37'),
(9, ' Ever since the dawn of time, the Minions have lived to serve the most despicable of \r\nmasters. From T. rex to Napoleon, the easily distracted tribe has helped the biggest and the \r\nbaddest of villains. Now, join protective leader Kevin, teenage rebel Stuart and lovable little \r\nBob on a global road trip where they''ll earn a shot to work for a new boss-the world''s first \r\nfemale super-villain-and try to save all of Minionkind...from annihilation.', '', '', '', 9, '2016-07-27 01:36:03', '2016-07-27 00:36:03'),
(10, ' Dominic and his crew thought they''d left the criminal mercenary life behind. They''d \r\ndefeated international terrorist Owen Shaw and went their separate ways. But now, Shaw''s \r\nbrother, Deckard Shaw, is out killing the crew one by one for revenge. Worse, a Somalian terrorist \r\ncalled Jakarde and a shady government official called "Mr. Nobody" are both competing to steal a computer terrorism program called "God''s Eye," that can turn any technological device into a weapon. Torretto must reconvene with his team to stop Shaw and retrieve the God''s Eye program while caught in a power struggle between the terrorist and the United States government.', '', '', '', 10, '2016-07-27 01:46:01', '2016-07-27 00:46:01'),
(11, ' One choice can transform you-or it can destroy you. But every choice has consequences, and as unrest surges in the factions all around her, Tris Prior must continue trying to save those she loves--and herself--while grappling with haunting questions of grief and forgiveness, identity and \r\nloyalty, politics and love. Tris''s initiation day should have been marked by celebration and victory with her chosen faction; instead, the day ended with unspeakable horrors. War now looms \r\nas conflict between the factions and their ideologies grows. And in times of war, sides must be chosen, secrets will emerge, and choices will become even more irrevocable--and even more powerful. Transformed by her own decisions but also by haunting grief and guilt, radical new discoveries, and shifting relationships. Tris must fully embrace her Divergence, even if she does not know what she may lose by doing so.', '', '', '', 11, '2016-07-27 01:54:56', '2016-07-27 00:54:56'),
(12, ' When John Connor (Jason Clarke), leader of the human resistance, sends Sgt. Kyle Reese (Jai Courtney) back to 1984 to protect Sarah Connor (Emilia Clarke) and safeguard the future, an unexpected turn of events creates a fractured timeline. Now, Sgt. Reese finds himself in a \r\nnew and unfamiliar version of the past, where he is faced with unlikely allies, including the Guardian (Arnold Schwarzenegger), dangerous new enemies, and an unexpected new mission: To reset the future...', '', '', '', 12, '2016-07-27 02:01:28', '2016-07-27 01:01:28'),
(13, ' When Anastasia Steele, a literature student, \r\ngoes to interview the wealthy Christian Grey \r\nas a favor to her roommate Kate Kavanagh, she \r\nencounters a beautiful, brilliant and intimidating man. \r\nThe innocent and naive Ana starts to realize she wants him. \r\nDespite his enigmatic reserve and advice, she finds herself \r\ndesperate to get close to him. Not able to resist Ana''s beauty \r\nand independent spirit, Christian Grey admits he wants her too, \r\nbut on his own terms. Ana hesitates as she discovers the singular \r\ntastes of Christian Grey - despite the embellishments of success, \r\nhis multinational businesses, his vast wealth, and his loving family, \r\nGrey is consumed by the need to control everything.', '', '', '', 13, '2016-07-27 02:06:48', '2016-07-27 01:06:48'),
(14, ' Months after John''s divorce, Ted and Tami-Lynn''s \r\nmarriage seems on the same road. To patch things up, \r\nTed and Tami-Lynn plan to have a child with John''s help, \r\nbut their failed efforts backfire disastrously. Namely, \r\nTed is declared property by the government and he loses \r\nall his civil rights. Now, Ted must fight a seemingly hopeless \r\nlegal battle with an inexperienced young lawyer to regain his \r\nrightful legal status. Unfortunately, between Ted''s drunken \r\nidiocies and sinister forces interested in this situation to \r\nexploit him, Ted''s quest has all the odds against him.', '', '', '', 14, '2016-07-27 02:11:49', '2016-07-27 01:11:49'),
(15, ' The Drac pack is back for an all-new monster \r\ncomedy adventure in Sony Pictures Animation''s \r\nHotel Transylvania 2! Everything seems to be \r\nchanging for the better at Hotel Transylvania... \r\nDracula''s rigid monster-only hotel policy has finally \r\nrelaxed, opening up its doors to human guests. \r\nBut behind closed coffins, Drac is worried that his \r\nadorable half-human, half-vampire grandson, Dennis, \r\nisn''t showing signs of being a vampire. So while Mavis \r\nis busy visiting her human in-laws with Johnny - and in \r\nfor a major cultural shock of her own - "Vampa" Drac \r\nenlists his friends Frank, Murray, Wayne and Griffin \r\nto put Dennis through a "monster-in-training" boot camp. \r\nBut little do they know that Drac''s grumpy and very old, \r\nold, old school dad Vlad is about to pay a family visit \r\nto the hotel. And when Vlad finds out that his great-grandson \r\nis not a pure blood - and humans are now welcome at Hotel \r\nTransylvania - things are going to get batty!', '', '', '', 15, '2016-07-27 02:23:15', '2016-07-27 01:23:15'),
(16, ' In this next chapter of the epic "Maze Runner" saga, \r\nThomas (Dylan O''Brien) and his fellow Gladers face their \r\ngreatest challenge yet: searching for clues about the \r\nmysterious and powerful organization known as WCKD. \r\nTheir journey takes them to the Scorch, a desolate landscape \r\nfilled with unimaginable obstacles. Teaming up with resistance \r\nfighters, the Gladers take on WCKD''s vastly superior forces \r\nand uncover its shocking plans for them all.', '', '', '', 16, '2016-07-27 12:11:08', '2016-07-27 11:11:08'),
(17, ' An apocalyptic story set in the furthest reaches \r\nof our planet, in a stark desert landscape where \r\nhumanity is broken, and almost everyone is crazed \r\nfighting for the necessities of life. Within this \r\nworld exist two rebels on the run who just might \r\nbe able to restore order. There''s Max, a man of \r\naction and a man of few words, who seeks peace of \r\nmind following the loss of his wife and child in \r\nthe aftermath of the chaos. And Furiosa, a woman \r\nof action and a woman who believes her path to \r\nsurvival may be achieved if she can make it across \r\nthe desert back to her childhood homeland.', 'Hanté par un lourd passé, Mad Max estime que le meilleur moyen de survivre est de rester seul. Cependant, il se retrouve embarqué par une bande qui parcourt la Désolation à bord d’un véhicule militaire piloté par l’Imperator Furiosa. Ils fuient la Citadelle où sévit le terrible Immortan Joe qui s’est fait voler un objet irremplaçable. Enragé, ce Seigneur de guerre envoie ses hommes pour traquer les rebelles impitoyablement…\r\n\r\n', '', '', 17, '2016-07-27 12:30:11', '2016-07-27 11:30:11'),
(18, ' Legendary filmmaker Sam Raimi and director Gil Kenan \r\n reimagine and contemporize the classic tale about a \r\n family whose suburban home is invaded by angry spirits. \r\n When the terrifying apparitions escalate their attacks \r\n and take the youngest daughter, the family must come together to rescue her.', '', '', '', 18, '2016-07-27 13:09:29', '2016-07-27 12:09:29'),
(19, ' Bound by a shared destiny, a bright, optimistic \r\n teen bursting with scientific curiosity and a former \r\n boy-genius inventor jaded by disillusionment embark on \r\n a danger-filled mission to unearth the secrets of an \r\n enigmatic place somewhere in time and space that exists \r\n in their collective memory as "Tomorrowland".', '', '', '', 19, '2016-07-27 13:33:57', '2016-07-27 12:33:57'),
(20, ' CIA chief Hunley (Baldwin) convinces a Senate \r\n committee to disband the IMF (Impossible Mission Force), \r\n of which Ethan Hunt (Cruise) is a key member. Hunley \r\n argues that the IMF is too reckless. Now on his own, \r\n Hunt goes after a shadowy and deadly rogue organization called the Syndicate.', '', '', '', 20, '2016-07-27 14:22:26', '2016-07-27 13:22:26'),
(21, ' A girl named Ella (Cinderella) has the purest heart \r\n living in a cruel world filled with evil stepsisters \r\n and an evil stepmother out to ruin Ella''s life. Ella \r\n comes one with her pure heart when she meets the prince \r\n and dances her way to a better life with glass shoes, \r\n and a little help from her fairy godmother, of course.', '', '', '', 21, '2016-07-27 16:08:37', '2016-07-27 15:08:37'),
(22, ' FANTASTIC FOUR, a contemporary re-imagining of \r\n Marvel''s original and longest-running superhero team, \r\n centers on four young outsiders who teleport to an \r\n alternate and dangerous universe, which alters their \r\n physical form in shocking ways. Their lives irrevocably \r\n upended, the team must learn to harness their daunting \r\n new abilities and work together to save Earth from a former \r\n friend turned enemy.', '', '', '', 22, '2016-07-27 16:23:03', '2016-07-27 15:23:03'),
(23, ' John Gregory, who is a seventh son of a seventh\r\n son and also the local spook, has protected his country \r\n from witches, boggarts, ghouls and all manner of things \r\n that go bump in the night. However John is not young anymore, \r\n and has been seeking an apprentice to carry on his trade. \r\n Most have failed to survive. The last hope is a young farmer''s \r\n son named Thomas Ward. Will he survive the training to become \r\n the spook that so many others couldn''t? Should he trust the girl \r\n with pointy shoes? How can Thomas stand a chance against Mother Malkin, \r\n the most dangerous witch in the county?', '', '', '', 23, '2016-07-27 16:30:46', '2016-07-27 15:30:46'),
(24, ' Frank Martin, played by newcomer Ed Skrein, \r\n a former special-ops mercenary, is now living \r\n a less perilous life - or so he thinks - transporting \r\n classified packages for questionable people. When Frank''s \r\n father (Ray Stevenson) pays him a visit in the south of \r\n France, their father-son bonding weekend takes a turn for \r\n the worse when Frank is engaged by a cunning femme-fatale, \r\n Anna (Loan Chabanol), and her three seductive sidekicks to \r\n orchestrate the bank heist of the century. Frank must use \r\n his covert expertise and knowledge of fast cars, fast driving \r\n and fast women to outrun a sinister Russian kingpin, and worse \r\n than that, he is thrust into a dangerous game of chess with a \r\n team of gorgeous women out for revenge. From the producers of \r\n LUCY and the TAKEN trilogy, THE TRANSPORTER REFUELED is a fresh \r\n personification of the iconic role of Frank Martin, that launches \r\n the high-octane franchise into the present-day and introduces it \r\n to the next generation of thrill-seekers.', '', '', '', 24, '2016-07-27 16:40:05', '2016-07-27 15:40:05');
-- --------------------------------------------------------
--
-- Structure de la table `subscribes`
--
CREATE TABLE IF NOT EXISTS `subscribes` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
--
-- Contenu de la table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'abdellah', 'ajaadi51@gmail.com', '$2y$10$qzMW9zudyhGag3diCXdXV.s6ggvqRTBad69z.PXe.LleOSeraWgEi', NULL, '2016-07-26 10:26:00', '2016-07-26 10:26:00');
/*!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 */;
| 106.481667 | 1,562 | 0.620404 |
eb58fd652f9bf5ccf66f3b8016f551f12e5478a9
| 799 |
rs
|
Rust
|
src/wrapper/facade/breakpoint_instance.rs
|
HarryCU/jvmti-rs
|
d071ba928de4263c217803f7f6e7e3702408bbb6
|
[
"Apache-2.0"
] | 17 |
2020-08-25T16:53:17.000Z
|
2022-02-09T12:59:14.000Z
|
src/wrapper/facade/breakpoint_instance.rs
|
HarryCU/jvmti-rs
|
d071ba928de4263c217803f7f6e7e3702408bbb6
|
[
"Apache-2.0"
] | null | null | null |
src/wrapper/facade/breakpoint_instance.rs
|
HarryCU/jvmti-rs
|
d071ba928de4263c217803f7f6e7e3702408bbb6
|
[
"Apache-2.0"
] | null | null | null |
use crate::{objects::*, errors::*, Transform, JVMTIFacadeEnv};
use crate::sys::jlocation;
use jni::strings::JNIString;
impl<'a> JVMTIFacadeEnv<'a> {
pub fn set_breakpoint_i<K, M, V>(&self, class: K, name: M, sig: V, location: jlocation) -> Result<()>
where
K: Transform<'a, JClass<'a>>,
M: Into<JNIString>,
V: Into<JNIString> {
self.jvmti_rust().set_breakpoint_i(self.jni_rust(), class, name, sig, location)
}
pub fn clear_breakpoint_i<K, M, V>(&self, class: K, name: M, sig: V, location: jlocation) -> Result<()>
where
K: Transform<'a, JClass<'a>>,
M: Into<JNIString>,
V: Into<JNIString> {
self.jvmti_rust().clear_breakpoint_i(self.jni_rust(), class, name, sig, location)
}
}
| 36.318182 | 107 | 0.585732 |
30d803db9ff7c3c21f50bcaa1ab5c926a409e3e9
| 831 |
kts
|
Kotlin
|
subprojects/gradle/build-verdict/build.gradle.kts
|
StanlyT/avito-android
|
96463f7714c0550e331d2a37fb32ad98fac9d62d
|
[
"MIT"
] | null | null | null |
subprojects/gradle/build-verdict/build.gradle.kts
|
StanlyT/avito-android
|
96463f7714c0550e331d2a37fb32ad98fac9d62d
|
[
"MIT"
] | null | null | null |
subprojects/gradle/build-verdict/build.gradle.kts
|
StanlyT/avito-android
|
96463f7714c0550e331d2a37fb32ad98fac9d62d
|
[
"MIT"
] | null | null | null |
plugins {
id("convention.kotlin-jvm")
id("convention.publish-gradle-plugin")
id("convention.libraries")
id("convention.gradle-testing")
}
dependencies {
api(project(":gradle:build-verdict-tasks-api"))
implementation(gradleApi())
implementation(project(":common:throwable-utils"))
implementation(project(":gradle:gradle-extensions"))
implementation(project(":gradle:gradle-logger"))
implementation(libs.gson)
implementation(libs.kotlinHtml)
gradleTestImplementation(project(":gradle:test-project"))
}
gradlePlugin {
plugins {
create("buildVerdict") {
id = "com.avito.android.build-verdict"
implementationClass = "com.avito.android.build_verdict.BuildVerdictPlugin"
displayName = "Create file with a build verdict"
}
}
}
| 27.7 | 86 | 0.681107 |
438c10a1a248d23c1aeefb17ed9b6a5132239521
| 10,857 |
go
|
Go
|
cmd/commands/registration.go
|
agsdot/edu
|
50e8993ef9a5218ee1a75b4117c4309ece76b3fa
|
[
"Apache-2.0"
] | null | null | null |
cmd/commands/registration.go
|
agsdot/edu
|
50e8993ef9a5218ee1a75b4117c4309ece76b3fa
|
[
"Apache-2.0"
] | null | null | null |
cmd/commands/registration.go
|
agsdot/edu
|
50e8993ef9a5218ee1a75b4117c4309ece76b3fa
|
[
"Apache-2.0"
] | null | null | null |
package commands
import (
"errors"
"fmt"
"log"
"os"
"regexp"
"strconv"
"strings"
"time"
"github.com/gen2brain/beeep"
"github.com/harrybrwn/config"
"github.com/harrybrwn/edu/cmd/internal"
"github.com/harrybrwn/edu/cmd/internal/files"
"github.com/harrybrwn/edu/cmd/internal/opts"
"github.com/harrybrwn/edu/cmd/internal/watch"
"github.com/harrybrwn/edu/pkg/term"
"github.com/harrybrwn/edu/pkg/twilio"
"github.com/harrybrwn/edu/school"
"github.com/harrybrwn/edu/school/schedule"
"github.com/harrybrwn/edu/school/ucmerced/ucm"
"github.com/harrybrwn/errs"
"github.com/mitchellh/mapstructure"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
type scheduleFlags struct {
*opts.Global
term string
year int
open bool
columns []string
}
func (sf *scheduleFlags) install(fset *pflag.FlagSet) {
fset.StringVar(&sf.term, "term", sf.term, "specify the term (spring|summer|fall)")
fset.IntVar(&sf.year, "year", sf.year, "specify the year for registration")
fset.BoolVar(&sf.open, "open", sf.open, "only get classes that have seats open")
}
var courseTableHeader = []string{
"crn",
"name", // "code"
"seats open",
"activity",
"title",
"time",
"days",
}
func newRegistrationCmd(globals *opts.Global) *cobra.Command {
var sflags = scheduleFlags{
term: config.GetString("registration.term"),
year: config.GetInt("registration.year"),
Global: globals,
}
c := &cobra.Command{
Use: "registration",
Short: "Get registration data",
Long: `Use the 'registration' command to get information on class
registration information.`,
Aliases: []string{"reg", "register"},
Example: "" +
"$ edu registration cse 100 --term=fall\n" +
"\t$ edu reg --open --year=2021 --term=summer WRI 10",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if sflags.year == 0 {
return errs.New("no year given")
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
var (
subj string
num int
)
if len(args) >= 1 {
subj = args[0]
}
if len(args) >= 2 {
num, err = strconv.Atoi(args[1])
if err != nil {
return err
}
}
schedule, err := schedule.New(school.UCMerced, &schedule.Config{
Year: sflags.year,
Term: sflags.term,
CourseName: subj,
FilterClosed: sflags.open,
})
if err != nil {
return err
}
tab := internal.NewTable(cmd.OutOrStdout())
internal.SetTableHeader(tab, courseTableHeader, !sflags.NoColor)
tab.SetAutoWrapText(false)
if schedule.Len() == 0 {
return &internal.Error{Msg: "no courses found", Code: 1}
}
var courses []*ucm.Course
if sc, ok := schedule.(*ucm.Schedule); ok {
courses = sc.Ordered()
} else {
panic("don't yet support other schools")
}
for _, c := range courses {
if num != 0 && c.Number != num {
continue
}
tab.Append(courseRow(c, true, sflags))
}
if tab.NumLines() == 0 {
return &internal.Error{Msg: "no matches", Code: 1}
}
tab.Render()
return nil
},
}
sflags.install(c.PersistentFlags())
c.AddCommand(newCheckCRNCmd(&sflags), newWatchCmd(&sflags))
return c
}
func newCheckCRNCmd(sflags *scheduleFlags) *cobra.Command {
var subject string
cmd := &cobra.Command{
Use: "check-crns",
Hidden: true,
Deprecated: "",
RunE: func(cmd *cobra.Command, args []string) error {
schedule, err := ucm.BySubject(sflags.year, sflags.term, subject, true)
if err != nil {
return err
}
crns := config.GetIntSlice("crns")
crnargs, err := stroiArr(args)
if err != nil {
return err
}
crns = append(crns, crnargs...)
tab := internal.NewTable(cmd.OutOrStdout())
header := []string{"crn", "code", "open", "type", "time", "days"}
internal.SetTableHeader(tab, header, !sflags.NoColor)
tab.SetAutoWrapText(false)
for _, crn := range crns {
course := schedule.Get(crn)
if course == nil {
continue
}
crs, ok := course.(*ucm.Course)
if !ok {
fmt.Fprintf(os.Stderr, "Warning: only uc merced is supported\n")
continue
}
tab.Append(courseRow(crs, false, *sflags))
}
if tab.NumLines() == 0 {
return &internal.Error{Msg: fmt.Sprintf("could not find %v in schedule", crns), Code: 1}
}
tab.Render()
return nil
},
}
cmd.Flags().StringVar(&subject, "subject", "", "check the CRNs for a specific subject")
return cmd
}
type crnWatcher struct {
crns []int
names []string
subject string
flags scheduleFlags
verbose bool
twilio *twilio.Client
}
func (cw *crnWatcher) Watch() error {
var (
subject = cw.subject
crns = cw.crns
)
if config.GetInt("watch.year") != 0 {
cw.flags.year = config.GetInt("watch.year")
}
if config.GetString("watch.term") != "" {
cw.flags.term = config.GetString("watch.term")
}
if config.GetString("watch.subject") != "" {
subject = config.GetString("watch.subject")
}
configCrns := config.GetIntSlice("watch.crns")
if len(configCrns) > 0 {
crns = append(crns, configCrns...)
}
if len(crns) < 1 {
return errors.New("no crns to check (see 'edu config' watch settings)")
}
err := cw.checkCRNs(crns, subject)
if err != nil {
if cw.verbose {
fmt.Println(err)
}
return err
}
return nil
}
func (cw *crnWatcher) checkCRNs(crns []int, subject string) error {
schedule, err := ucm.BySubject(cw.flags.year, cw.flags.term, cw.subject, true)
if err != nil {
return err
}
openCrns := make([]int, 0)
for _, crn := range crns {
_, ok := schedule[crn]
if !ok {
continue
}
openCrns = append(openCrns, crn)
}
// return if no open classes
if len(openCrns) == 0 {
return &internal.Error{Msg: fmt.Sprintf("could not find %v in schedule", crns), Code: 1}
}
msg := "Open crns:\n"
for _, crn := range openCrns {
msg += fmt.Sprintf("%d\n", crn)
}
// desktop notification
if config.GetBool("notifications") {
if err = beeep.Notify("Found Open Courses", msg, ""); err != nil {
return err
}
}
// sms notification
if cw.twilio != nil {
to := config.GetString("watch.sms_recipient")
_, err = cw.twilio.Send(to, msg)
if err != nil {
logrus.WithError(err).Error("could not send sms")
return err
}
}
return nil
}
func watchFiles() error {
basedir := config.GetString("basedir")
if basedir == "" {
return errors.New("cannot download files to an empty base directory")
}
courses, err := internal.GetCourses(false)
if err != nil {
return internal.HandleAuthErr(err)
}
courseReps := upperMapKeys(Conf.CourseReplacements)
dl := files.NewDownloader(basedir)
for _, course := range courses {
if course.AccessRestrictedByDate {
continue
}
reps, ok := courseReps[course.CourseCode]
if !ok {
reps = Conf.Replacements
} else {
reps = append(Conf.Replacements, reps...)
}
dl.Download(course, reps)
}
dl.Wait()
return nil
}
func newWatchCmd(sflags *scheduleFlags) *cobra.Command {
var (
subject string
verbose bool
term = config.GetString("watch.term")
year = config.GetInt("watch.year")
smsNotify = config.GetBool("watch.sms_notify")
smsRecipient string
)
if term != "" {
sflags.term = term
}
if year != 0 {
sflags.year = year
}
c := &cobra.Command{
Use: "watch",
Short: "Watch for availability changes in a list of CRNs",
Long: "Watch for availability changes in a list of CRNs." +
"",
RunE: func(cmd *cobra.Command, args []string) error {
basecrns, err := stroiArr(args)
if err != nil {
return err
}
var duration time.Duration
duration, err = time.ParseDuration(config.GetString("watch.duration"))
if err != nil {
return err
}
crnWatch := &crnWatcher{
crns: basecrns,
subject: subject,
flags: *sflags,
verbose: verbose,
twilio: twilio.NewClient(
config.GetString("twilio.sid"),
config.GetString("twilio.token"),
),
}
crnWatch.twilio.SetSender(config.GetString("twilio.number"))
if !smsNotify {
crnWatch.twilio = nil
}
var watches = []watch.Watcher{crnWatch}
if config.GetBool("watch.files") {
watches = append(watches, watch.WatcherFunc(watchFiles))
}
for {
for _, wt := range watches {
go func(wt watch.Watcher) {
if err := wt.Watch(); err != nil {
log.Printf("Watch Error: %s\n", err.Error())
}
}(wt)
}
time.Sleep(duration)
// refresh config variables
if err = config.ReadConfigFile(); err != nil {
log.Printf("could not refresh config during 'watch': %v", err)
}
if config.GetString("watch.duration") != "" {
newdur, err := time.ParseDuration(config.GetString("watch.duration"))
if err != nil {
log.Printf("could not refresh duration: %v", err)
} else if newdur != 0 {
duration = newdur
}
}
}
// end RunE
},
}
flg := c.Flags()
flg.BoolVarP(&verbose, "verbose", "v", verbose, "print out any errors")
flg.StringVar(&subject, "subject", "", "check the CRNs for a specific subject")
flg.BoolVar(&smsNotify, "sms-notify", smsNotify, "notify users when classes are open using sms")
flg.StringVar(&smsRecipient, "sms-recipient", "", "number that will be notified via sms (see sms-notify)")
return c
}
func courseRow(crs school.Course, title bool, flags scheduleFlags) []string {
var (
timeStr = "TBD"
activity = "none"
days = ""
)
if c, ok := crs.(*ucm.Course); ok {
if c.Time.Start.Hour() != 0 && c.Time.End.Hour() != 0 {
timeStr = fmt.Sprintf("%s-%s",
c.Time.Start.Format("3:04pm"),
c.Time.End.Format("3:04pm"))
}
days = strjoin(c.Days, ",")
activity = c.Activity
}
seats := crs.SeatsOpen()
var open = strconv.Itoa(seats)
if !flags.NoColor {
if seats <= 0 {
open = term.Red(open)
} else {
open = term.Green(open)
}
}
if title {
return []string{
strconv.Itoa(crs.ID()),
cleanTitle(crs.Name()),
open,
activity,
"",
timeStr,
days,
}
}
return []string{
strconv.Itoa(crs.ID()),
"",
open,
activity,
timeStr,
days,
}
}
var mustAlsoRegex = regexp.MustCompile(`Must Also.*$`)
func cleanTitle(title string) string {
title = mustAlsoRegex.ReplaceAllString(title, "")
title = strings.Replace(title, "Class is fully online", ": Class is fully online", -1)
if len(title) > 175 {
title = title[:175]
}
return title
}
func stroiArr(arr []string) (ints []int, err error) {
ints = make([]int, len(arr))
for i, n := range arr {
ints[i], err = strconv.Atoi(n)
if err != nil {
return
}
}
return
}
func strjoin(list []time.Weekday, sep string) string {
strs := make([]string, len(list))
for i, s := range list {
strs[i] = s.String()[:3]
}
return strings.Join(strs, sep)
}
func courseAsDict(c *ucm.Course) map[string]interface{} {
m := make(map[string]interface{})
mapstructure.Decode(c, &m)
return m
}
| 24.019912 | 107 | 0.635166 |
e76cda2a62797d6965a188e394eed86e4f63327a
| 200 |
js
|
JavaScript
|
vite.config.js
|
raulshma/bitcoin-price-chart
|
810d75ada69296732ee3882b9248892046b9ad42
|
[
"MIT"
] | 5 |
2020-08-12T21:27:59.000Z
|
2022-02-02T12:51:37.000Z
|
vite.config.js
|
raulshma/bitcoin-price-chart
|
810d75ada69296732ee3882b9248892046b9ad42
|
[
"MIT"
] | null | null | null |
vite.config.js
|
raulshma/bitcoin-price-chart
|
810d75ada69296732ee3882b9248892046b9ad42
|
[
"MIT"
] | null | null | null |
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
base: '/bitcoin-price-chart/',
build: {
outDir: 'build',
},
plugins: [react()]
})
| 22.222222 | 40 | 0.66 |
9dd71fac75b849d02211ccd58050b9f05f9b57f2
| 3,086 |
swift
|
Swift
|
Sources/SwiftUIToolbox/Extensions/Publishers/Publishers+CombineLatestCollection.swift
|
devQQ/SwiftUIToolbox
|
c4286ea7fd19c24b92e7bb24cbe418a38b331dae
|
[
"MIT"
] | null | null | null |
Sources/SwiftUIToolbox/Extensions/Publishers/Publishers+CombineLatestCollection.swift
|
devQQ/SwiftUIToolbox
|
c4286ea7fd19c24b92e7bb24cbe418a38b331dae
|
[
"MIT"
] | null | null | null |
Sources/SwiftUIToolbox/Extensions/Publishers/Publishers+CombineLatestCollection.swift
|
devQQ/SwiftUIToolbox
|
c4286ea7fd19c24b92e7bb24cbe418a38b331dae
|
[
"MIT"
] | null | null | null |
//
// Publishers+CombineLatestCollection.swift
//
//
// Created by Q Trang on 8/1/20.
//
import Foundation
import Combine
extension Collection where Element: Publisher {
public func combineLatest(waitForAllPublishers wait: Bool = true) -> CombineLatestCollection<Self> {
CombineLatestCollection(self, wait: wait)
}
}
public struct CombineLatestCollection<Publishers>: Publisher where Publishers: Collection, Publishers.Element: Publisher {
public typealias Output = [Publishers.Element.Output]
public typealias Failure = Publishers.Element.Failure
private let publishers: Publishers
private let wait: Bool
public init(_ publishers: Publishers, wait: Bool = true) {
self.publishers = publishers
self.wait = wait
}
public func receive<S>(subscriber: S) where S : Subscriber, Self.Failure == S.Failure, Self.Output == S.Input {
let subscription = Subscription(subscriber: subscriber, publishers: publishers, wait: wait)
subscriber.receive(subscription: subscription)
}
}
extension CombineLatestCollection {
fileprivate final class Subscription<S: Subscriber>: Combine.Subscription where S.Failure == Failure, S.Input == Output {
private let subscribers: [AnyCancellable]
init(subscriber: S, publishers: Publishers, wait: Bool = true) {
let count = publishers.count
var outputs: [Publishers.Element.Output?] = Array(repeating: nil, count: count)
var completions = 0
var hasCompleted = false
let lock = NSLock()
subscribers = publishers.enumerated().map { index, publisher in
publisher.sink(receiveCompletion: { completion in
lock.lock()
defer { lock.unlock() }
guard case .finished = completion else {
subscriber.receive(completion: completion)
hasCompleted = true
return
}
completions += 1
guard completions == count else { return }
subscriber.receive(completion: completion)
hasCompleted = true
}) { value in
lock.lock()
defer { lock.unlock() }
guard !hasCompleted else { return }
outputs[index] = value
let values = outputs.compactMap { $0 }
guard values.count == count ||
!wait else { return }
_ = subscriber.receive(values)
}
}
}
func request(_ demand: Subscribers.Demand) {}
func cancel() {
subscribers.forEach { $0.cancel() }
}
}
}
| 33.912088 | 125 | 0.529488 |
05ed6f2f4a5b1e03f6a13209590ffe01035a3b08
| 625 |
rb
|
Ruby
|
app/models/jwt_token.rb
|
pucinsk/reactive-dashboard-tut
|
fd00842a394948186362b02b6ba19c409976ecb0
|
[
"MIT"
] | null | null | null |
app/models/jwt_token.rb
|
pucinsk/reactive-dashboard-tut
|
fd00842a394948186362b02b6ba19c409976ecb0
|
[
"MIT"
] | 8 |
2020-06-25T17:27:32.000Z
|
2022-02-27T05:44:30.000Z
|
app/models/jwt_token.rb
|
pucinsk/reactive-dashboard-tut
|
fd00842a394948186362b02b6ba19c409976ecb0
|
[
"MIT"
] | null | null | null |
class JwtToken
HMACK = 'HS256'.freeze
def initialize(account:)
@account = account
end
class << self
def decode(token)
JWT.decode(token, hmac_secret, true, algorithm: HMACK)[0]
rescue JWT::DecodeError
{}
end
def hmac_secret
Rails.application.credentials.hmac_secret
end
end
def token
@token = JWT.encode(payload, hmac_secret, HMACK)
end
private
attr_reader :account
def payload
{
account_id: account.id,
exp: expires_at.to_i
}
end
def expires_at
1.hour.from_now
end
def hmac_secret
self.class.hmac_secret
end
end
| 14.534884 | 63 | 0.648 |
b369bf82d3e5a4654a432992d63a19c5f5a4a02c
| 680 |
rb
|
Ruby
|
db/migrate/20140611205429_create_plans.rb
|
cooperative-humans/localorbit
|
7492489b20ea311b191c5b0f9a4d54680c5e3b6d
|
[
"MIT"
] | 16 |
2018-05-23T05:29:28.000Z
|
2021-09-09T03:52:50.000Z
|
db/migrate/20140611205429_create_plans.rb
|
cooperative-humans/localorbit
|
7492489b20ea311b191c5b0f9a4d54680c5e3b6d
|
[
"MIT"
] | 212 |
2018-05-18T20:57:07.000Z
|
2022-03-30T22:40:13.000Z
|
db/migrate/20140611205429_create_plans.rb
|
cooperative-humans/localorbit
|
7492489b20ea311b191c5b0f9a4d54680c5e3b6d
|
[
"MIT"
] | 10 |
2018-07-11T17:41:13.000Z
|
2020-08-20T12:52:53.000Z
|
class CreatePlans < ActiveRecord::Migration
class Plan < ActiveRecord::Base; end
def up
create_table :plans do |t|
t.string :name
t.boolean :discount_codes, default: false
t.boolean :cross_selling, default: false
t.boolean :custom_branding, default: false
t.boolean :automatic_payments, default: false
t.timestamps
end
Plan.create(name: "Start Up")
Plan.create(name: "Grow", cross_selling: true, discount_codes: true, custom_branding: true)
Plan.create(name: "Automate", cross_selling: true, discount_codes: true, custom_branding: true, automatic_payments: true)
end
def down
drop_table :plans
end
end
| 28.333333 | 125 | 0.701471 |
1356c6318f7666f0eb0f44ab2ca01ea86b17c25f
| 317 |
kt
|
Kotlin
|
src/main/kotlin/io/hirasawa/server/bancho/packets/UserPresenceSinglePacket.kt
|
cg0/Hirasawa-Project
|
6ad81ebbf603591c550480e94310cb33d7f94eef
|
[
"MIT"
] | 2 |
2020-04-18T02:23:04.000Z
|
2020-05-20T21:41:04.000Z
|
src/main/kotlin/io/hirasawa/server/bancho/packets/UserPresenceSinglePacket.kt
|
cg0/Hirasawa-Project
|
6ad81ebbf603591c550480e94310cb33d7f94eef
|
[
"MIT"
] | 126 |
2020-05-13T03:19:13.000Z
|
2022-02-28T00:12:18.000Z
|
src/main/kotlin/io/hirasawa/server/bancho/packets/UserPresenceSinglePacket.kt
|
cg0/Hirasawa-Project
|
6ad81ebbf603591c550480e94310cb33d7f94eef
|
[
"MIT"
] | null | null | null |
package io.hirasawa.server.bancho.packets
import io.hirasawa.server.bancho.chat.ChatChannel
import io.hirasawa.server.bancho.serialisation.BanchoIntListWriter
class UserPresenceSinglePacket(id: Int):
BanchoPacket(BanchoPacketType.BANCHO_USER_PRESENCE_SINGLE) {
init {
writer.writeInt(id)
}
}
| 28.818182 | 68 | 0.782334 |
898e25e85cb9c069009ddcae13fc9e10fb8a464e
| 329 |
kt
|
Kotlin
|
library/common/src/main/kotlin/com/fphoenixcorneae/ximalaya/common/router/main/MainRouterHelper.kt
|
FPhoenixCorneaE/Himalaya
|
6aef0358f1ad02fb5ad18ce4adfb549ea2e74c13
|
[
"Apache-2.0"
] | 1 |
2021-10-13T11:49:03.000Z
|
2021-10-13T11:49:03.000Z
|
library/common/src/main/kotlin/com/fphoenixcorneae/ximalaya/common/router/main/MainRouterHelper.kt
|
FPhoenixCorneaE/Himalaya
|
6aef0358f1ad02fb5ad18ce4adfb549ea2e74c13
|
[
"Apache-2.0"
] | null | null | null |
library/common/src/main/kotlin/com/fphoenixcorneae/ximalaya/common/router/main/MainRouterHelper.kt
|
FPhoenixCorneaE/Himalaya
|
6aef0358f1ad02fb5ad18ce4adfb549ea2e74c13
|
[
"Apache-2.0"
] | 1 |
2021-09-17T03:13:36.000Z
|
2021-09-17T03:13:36.000Z
|
package com.fphoenixcorneae.ximalaya.common.router.main
import com.didi.drouter.api.DRouter
import com.fphoenixcorneae.ximalaya.common.constant.Route
/**
* @desc:MainRouterHelper
* @date:2021/07/30 16:53
*/
object MainRouterHelper {
fun navigation() = kotlin.run {
DRouter.build(Route.Main.MAIN).start()
}
}
| 21.933333 | 57 | 0.729483 |
9014a471d3963d9eed527777863327aa115aa3a1
| 1,535 |
swift
|
Swift
|
Tests/TaskManager/Doubles/TaskSpy.swift
|
sgulseth/Tasker
|
b908b10199d3633b751db949f59d1fdb77cf11b5
|
[
"MIT"
] | 18 |
2019-08-14T07:54:14.000Z
|
2022-03-31T06:27:35.000Z
|
Tests/TaskManager/Doubles/TaskSpy.swift
|
sgulseth/Tasker
|
b908b10199d3633b751db949f59d1fdb77cf11b5
|
[
"MIT"
] | 2 |
2020-06-03T08:47:48.000Z
|
2020-06-06T14:17:16.000Z
|
Tests/TaskManager/Doubles/TaskSpy.swift
|
sgulseth/Tasker
|
b908b10199d3633b751db949f59d1fdb77cf11b5
|
[
"MIT"
] | 1 |
2020-06-02T21:53:36.000Z
|
2020-06-02T21:53:36.000Z
|
import Foundation
@testable import Tasker
var kTaskSpyCounter = AtomicInt()
class TaskSpy<T>: AnyTask<T> {
var executeCallCount: Int {
self.executeCallBackData.count
}
var executeCallBackData: SynchronizedArray<AnyResult> = []
override init(timeout: DispatchTimeInterval? = nil, execute: @escaping (@escaping CompletionCallback) -> Void) {
super.init(timeout: timeout, execute: execute)
kTaskSpyCounter.getAndIncrement()
}
convenience init(timeout: DispatchTimeInterval? = nil, execute: @escaping () -> TaskSpy.Result) {
self.init(timeout: timeout) { completion in
completion(execute())
}
}
convenience init(timeout: DispatchTimeInterval? = nil, execute: @escaping () -> T) {
self.init(timeout: timeout) { completion in
completion(.success(execute()))
}
}
// TODO: Uncomment when bug fixed: https://bugs.swift.org/browse/SR-8142
// convenience init<U: Task>(_ task: U) where U.SuccessValue == SuccessValue {
// self.init(timeout: task.timeout) { completion in
// task.execute(completion: completion)
// }
// }
deinit {
kTaskSpyCounter.getAndDecrement()
}
override func execute(completion: @escaping CompletionCallback) {
let wrappedCompletion: CompletionCallback = { [weak self] result in
self?.executeCallBackData.append(AnyResult(result))
completion(result)
}
self.executeThunk(wrappedCompletion)
}
}
| 31.326531 | 116 | 0.64886 |
bd918c68bfa21bfee9de81877b2cf2379f09365a
| 149 |
swift
|
Swift
|
DoTo/Utill/Storage/DBKeys.swift
|
shndrs/DoTo
|
1fcc2a88e4014e502aa72bd7248395566f824357
|
[
"Apache-2.0"
] | 2 |
2020-12-12T09:59:30.000Z
|
2021-01-23T07:31:50.000Z
|
DoTo/Utill/Storage/DBKeys.swift
|
shndrs/DoTo
|
1fcc2a88e4014e502aa72bd7248395566f824357
|
[
"Apache-2.0"
] | null | null | null |
DoTo/Utill/Storage/DBKeys.swift
|
shndrs/DoTo
|
1fcc2a88e4014e502aa72bd7248395566f824357
|
[
"Apache-2.0"
] | null | null | null |
//
// DBKeys.swift
// DoTo
//
// Created by Sahand Raeisi on 11/29/20.
//
import Foundation
enum DBKeys: String {
case todoList
}
| 9.933333 | 41 | 0.590604 |
c8f48d9c74a4f2473f4f8f662615b3822573123d
| 474 |
lua
|
Lua
|
model/wave.lua
|
locci/ProgramacaoParaJogosDigitais_Estrategia
|
5eff7bd3ac43a81ef569c180bd8165f11fe0ed4e
|
[
"MIT"
] | 2 |
2019-10-04T00:51:34.000Z
|
2019-10-24T22:16:30.000Z
|
model/wave.lua
|
locci/ProgramacaoParaJogosDigitais_Estrategia
|
5eff7bd3ac43a81ef569c180bd8165f11fe0ed4e
|
[
"MIT"
] | null | null | null |
model/wave.lua
|
locci/ProgramacaoParaJogosDigitais_Estrategia
|
5eff7bd3ac43a81ef569c180bd8165f11fe0ed4e
|
[
"MIT"
] | null | null | null |
local Wave = require 'common.class' ()
function Wave:_init(spawns)
self.spawns = spawns
self.delay = 3
self.left = nil
self.pending = 0
end
function Wave:start()
self.left = self.delay
end
function Wave:update(dt)
self.left = self.left - dt
if self.left <= 0 then
self.left = self.left + self.delay
self.pending = self.pending + 1
end
end
function Wave:poll()
local pending = self.pending
self.pending = 0
return pending
end
return Wave
| 15.290323 | 38 | 0.681435 |
7ffe8d53372253ef7c79103b3298346a603047c0
| 1,328 |
go
|
Go
|
pkg/tile/proxy_test.go
|
fafeitsch/Open-Traffic-Sandbox
|
5682995e1956bcec07736007070d295f2a15007b
|
[
"MIT"
] | null | null | null |
pkg/tile/proxy_test.go
|
fafeitsch/Open-Traffic-Sandbox
|
5682995e1956bcec07736007070d295f2a15007b
|
[
"MIT"
] | null | null | null |
pkg/tile/proxy_test.go
|
fafeitsch/Open-Traffic-Sandbox
|
5682995e1956bcec07736007070d295f2a15007b
|
[
"MIT"
] | null | null | null |
package tile
import (
"fmt"
"github.com/stretchr/testify/assert"
"net/http"
"net/http/httptest"
"net/url"
"testing"
)
func TestNewProxy(t *testing.T) {
t.Run("no redirect", func(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusOK)
_, _ = fmt.Fprintf(writer, "I am an osm tile (path: %s)", request.URL.Path)
}))
tileServer, _ := url.Parse(server.URL + "/osm-api/tiles/{z}/{x}/${y}.png")
defer server.Close()
proxy := NewProxy(tileServer, false)
recorder := httptest.NewRecorder()
request := httptest.NewRequest("GET", "/tile/8/652/332", nil)
proxy.ServeHTTP(recorder, request)
assert.Equal(t, "I am an osm tile (path: /osm-api/tiles/8/652/332.png)", recorder.Body.String())
})
t.Run("redirect", func(t *testing.T) {
tileServer, _ := url.Parse("https://example.com/osm-api/tiles/{z}/{x}/${y}.png")
proxy := NewProxy(tileServer, true)
recorder := httptest.NewRecorder()
request := httptest.NewRequest("GET", "/tile/8/652/332", nil)
proxy.ServeHTTP(recorder, request)
assert.Equal(t, http.StatusMovedPermanently, recorder.Code, "status code wrong")
assert.Equal(t, "https://example.com/osm-api/tiles/8/652/332.png", recorder.Header().Get("Location"), "location header wrong")
})
}
| 36.888889 | 128 | 0.685994 |
54720744bdc96f85b7b00ede8f55486c542f3dec
| 3,387 |
go
|
Go
|
lib/quotes/yahoo/yahoo.go
|
sboehler/knut
|
f5b754b08c9c0f97db3bb237c0fbac7deb33baa4
|
[
"Apache-2.0"
] | 42 |
2020-11-28T22:35:53.000Z
|
2022-03-05T19:15:44.000Z
|
lib/quotes/yahoo/yahoo.go
|
sboehler/knut
|
f5b754b08c9c0f97db3bb237c0fbac7deb33baa4
|
[
"Apache-2.0"
] | 5 |
2021-01-03T21:51:47.000Z
|
2021-11-22T13:53:51.000Z
|
lib/quotes/yahoo/yahoo.go
|
sboehler/knut
|
f5b754b08c9c0f97db3bb237c0fbac7deb33baa4
|
[
"Apache-2.0"
] | 7 |
2020-11-23T23:15:22.000Z
|
2022-02-20T12:08:31.000Z
|
// Copyright 2021 Silvio Böhler
//
// 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 yahoo
import (
"encoding/csv"
"fmt"
"io"
"net/http"
"net/url"
"path"
"strconv"
"time"
)
const yahooURL string = "https://query1.finance.yahoo.com/v7/finance/download"
// Quote represents a quote on a given day.
type Quote struct {
Date time.Time
Open float64
High float64
Low float64
Close float64
AdjClose float64
Volume int
}
// Client is a client for Yahoo! quotes.
type Client struct {
url string
}
// New creates a new client with the default URL.
func New() Client {
return Client{yahooURL}
}
// Fetch fetches a set of quotes
func (c *Client) Fetch(sym string, t0, t1 time.Time) ([]Quote, error) {
u, err := createURL(c.url, sym, t0, t1)
if err != nil {
return nil, err
}
resp, err := http.Get(u.String())
if err != nil {
return nil, err
}
defer resp.Body.Close()
return decodeResponse(resp.Body)
}
// createURL creates a URL for the given root URL and parameters.
func createURL(rootURL, sym string, t0, t1 time.Time) (*url.URL, error) {
u, err := url.Parse(rootURL)
if err != nil {
return u, err
}
u.Path = path.Join(u.Path, url.PathEscape(sym))
u.RawQuery = url.Values{
"events": {"history"},
"interval": {"1d"},
"period1": {fmt.Sprint(t0.Unix())},
"period2": {fmt.Sprint(t1.Unix())},
}.Encode()
return u, nil
}
// decodeResponse takes a reader for the response and returns
// the parsed quotes.
func decodeResponse(r io.ReadCloser) ([]Quote, error) {
var csvReader = csv.NewReader(r)
csvReader.FieldsPerRecord = 7
// skip header
if _, err := csvReader.Read(); err != nil {
return nil, err
}
// read lines
var res []Quote
for {
r, err := csvReader.Read()
if err == io.EOF {
return res, nil
}
if err != nil {
return nil, err
}
quote, ok, err := recordToQuote(r)
if err != nil {
return nil, err
}
if ok {
res = append(res, quote)
}
}
}
// recordToQuote decodes one line of the response CSV.
func recordToQuote(r []string) (Quote, bool, error) {
var (
quote Quote
err error
)
for _, item := range r {
if item == "null" {
return quote, false, nil
}
}
quote.Date, err = time.Parse("2006-01-02", r[0])
if err != nil {
return quote, false, err
}
quote.Open, err = strconv.ParseFloat(r[1], 64)
if err != nil {
return quote, false, err
}
quote.High, err = strconv.ParseFloat(r[2], 64)
if err != nil {
return quote, false, err
}
quote.Low, err = strconv.ParseFloat(r[3], 64)
if err != nil {
return quote, false, err
}
quote.Close, err = strconv.ParseFloat(r[4], 64)
if err != nil {
return quote, false, err
}
quote.AdjClose, err = strconv.ParseFloat(r[5], 64)
if err != nil {
return quote, false, err
}
quote.Volume, err = strconv.Atoi(r[6])
if err != nil {
return quote, false, err
}
return quote, true, nil
}
| 22.430464 | 78 | 0.656038 |
6bae5909d181b665bd19a51b80c815cfc6dda5ce
| 64 |
h
|
C
|
Pods/Headers/Public/FastttCamera/IFTTTDeviceOrientation.h
|
dgrlucky/PointLegend
|
523fdeba0b905f1ce8f89e843c52b269585e092d
|
[
"Apache-2.0"
] | null | null | null |
Pods/Headers/Public/FastttCamera/IFTTTDeviceOrientation.h
|
dgrlucky/PointLegend
|
523fdeba0b905f1ce8f89e843c52b269585e092d
|
[
"Apache-2.0"
] | null | null | null |
Pods/Headers/Public/FastttCamera/IFTTTDeviceOrientation.h
|
dgrlucky/PointLegend
|
523fdeba0b905f1ce8f89e843c52b269585e092d
|
[
"Apache-2.0"
] | null | null | null |
link ../../../FastttCamera/FastttCamera/IFTTTDeviceOrientation.h
| 64 | 64 | 0.796875 |
df26c709be5352acd24876c159a43ed82f32fdc2
| 2,195 |
rb
|
Ruby
|
lib/terjira/client/base.rb
|
potloc/terjira
|
250e9d1c3909f11f395350232edcf189924eeb88
|
[
"MIT"
] | 827 |
2016-11-23T11:58:38.000Z
|
2022-03-24T03:40:25.000Z
|
lib/terjira/client/base.rb
|
mdheller/terjira
|
96aca00f41278c5057141412831c6affb0b6f38e
|
[
"MIT"
] | 90 |
2016-12-18T21:22:03.000Z
|
2022-02-24T11:41:24.000Z
|
lib/terjira/client/base.rb
|
mdheller/terjira
|
96aca00f41278c5057141412831c6affb0b6f38e
|
[
"MIT"
] | 42 |
2016-12-19T14:58:37.000Z
|
2022-03-16T12:48:34.000Z
|
require_relative 'jql_builder'
require_relative 'auth_option_builder'
module Terjira
module Client
# Abstract class to delegate jira-ruby resource class
class Base
extend JQLBuilder
extend AuthOptionBuilder
DEFAULT_CACHE_SEC = 60
DEFAULT_API_PATH = '/rest/api/2/'.freeze
AGILE_API_PATH = '/rest/agile/1.0/'.freeze
class << self
delegate :build, to: :resource
def client
@client ||= JIRA::Client.new(build_auth_options)
end
def resource
client.send(class_name) if client.respond_to?(class_name)
end
def site_url
auth_options = build_auth_options
"#{auth_options[:site]}/#{auth_options[:context_path]}"
end
def username
client.options[:username]
end
def class_name
to_s.split('::').last
end
def cache(options = {})
options[:expiry] ||= DEFAULT_CACHE_SEC
@cache ||= Terjira::FileCache.new(class_name, expiry)
end
# define `#api_get(post, put, delete)` and `#agile_api_get(post, put, delete)`
{ DEFAULT_API_PATH => 'api_',
AGILE_API_PATH => 'agile_api_' }.each do |url_prefix, method_prefix|
[:get, :delete].each do |http_method|
method_name = "#{method_prefix}#{http_method}"
define_method(method_name) do |path, params = {}, headers = {}|
url = url_prefix + path
if params.present?
params.reject! { |_k, v| v.blank? }
url += "?#{URI.encode_www_form(params)}"
end
parse_body client.send(http_method, url, headers)
end
end
[:post, :put].each do |http_method|
method_name = "#{method_prefix}#{http_method}"
define_method(method_name) do |path, body = '', headers = {}|
url = url_prefix + path
parse_body client.send(http_method, url, body, headers)
end
end
end
def parse_body(response)
JSON.parse(response.body) if response.body.present?
end
end
end
end
end
| 29.266667 | 86 | 0.569021 |
86502ec9713367b4f1cb452d57f0f2214dee1027
| 18,390 |
rs
|
Rust
|
gui/src/rust/ide/src/double_representation/graph.rs
|
vitvakatu/enso
|
99053decd8790a7c533d56065d92548fcb512503
|
[
"Apache-2.0"
] | null | null | null |
gui/src/rust/ide/src/double_representation/graph.rs
|
vitvakatu/enso
|
99053decd8790a7c533d56065d92548fcb512503
|
[
"Apache-2.0"
] | null | null | null |
gui/src/rust/ide/src/double_representation/graph.rs
|
vitvakatu/enso
|
99053decd8790a7c533d56065d92548fcb512503
|
[
"Apache-2.0"
] | null | null | null |
//! Code for retrieving graph description from AST.
use crate::prelude::*;
use crate::double_representation::definition::DefinitionInfo;
use crate::double_representation::definition::DefinitionProvider;
use crate::double_representation::node;
use crate::double_representation::node::LocatedNode;
use crate::double_representation::node::NodeInfo;
use ast::Ast;
use ast::BlockLine;
use ast::known;
use utils::fail::FallibleResult;
use crate::double_representation::connection::Connection;
/// Graph uses the same `Id` as the definition which introduces the graph.
pub type Id = double_representation::definition::Id;
// ====================
// === LocationHint ===
// ====================
/// Describes the desired position of the node's line in the graph's code block.
#[derive(Clone,Copy,Debug)]
pub enum LocationHint {
/// Try placing this node's line before the line described by id.
Before(ast::Id),
/// Try placing this node's line after the line described by id.
After(ast::Id),
/// Try placing this node's line at the start of the graph's code block.
Start,
/// Try placing this node's line at the end of the graph's code block.
End,
}
// =================
// === GraphInfo ===
// =================
/// Description of the graph, based on information available in AST.
#[derive(Clone,Debug,Shrinkwrap)]
pub struct GraphInfo {
/// The definition providing this graph.
pub source:DefinitionInfo,
}
impl GraphInfo {
/// Look for a node with given id in the graph.
pub fn locate_node(&self, id:double_representation::node::Id) -> FallibleResult<LocatedNode> {
let lines = self.source.block_lines();
double_representation::node::locate(&lines, self.source.context_indent, id)
}
/// Describe graph of the given definition.
pub fn from_definition(source:DefinitionInfo) -> GraphInfo {
GraphInfo {source}
}
/// Gets the AST of this graph definition.
pub fn ast(&self) -> Ast {
self.source.ast.clone().into()
}
/// Gets all known nodes in this graph (does not include special pseudo-nodes like graph
/// inputs and outputs).
pub fn nodes(&self) -> Vec<NodeInfo> {
let ast = &self.source.ast;
let body = &ast.rarg;
if let Ok(body_block) = known::Block::try_new(body.clone()) {
let context_indent = self.source.indent();
let lines_iter = body_block.enumerate_non_empty_lines();
let nodes_iter = node::NodeIterator {lines_iter,context_indent};
nodes_iter.map(|n| n.node).collect()
} else if let Some(node) = node::NodeInfo::from_main_line_ast(body) {
// There's no way to attach a documentation comment to an inline node, it consists only
// of the main line.
vec![node]
} else {
// It should not be possible to have empty definition without any nodes but it is
// possible to represent such thing in AST. Anyway, it has no nodes.
vec![]
}
}
/// Gets the list of connections between the nodes in this graph.
pub fn connections(&self) -> Vec<Connection> {
double_representation::connection::list(&self.source.ast.rarg)
}
/// Adds a new node to this graph.
pub fn add_node
(&mut self, node:&NodeInfo, location_hint:LocationHint) -> FallibleResult {
let mut lines = self.source.block_lines();
let last_non_empty = || lines.iter().rposition(|line| line.elem.is_some());
let index = match location_hint {
LocationHint::Start => 0,
LocationHint::End => last_non_empty().map_or(lines.len(),|ix| ix + 1),
LocationHint::After(id) => self.locate_node(id)?.index.last() + 1,
LocationHint::Before(id) => self.locate_node(id)?.index.first(),
};
let elem = Some(node.ast().clone_ref());
let off = 0;
lines.insert(index,BlockLine{elem,off});
if let Some(documentation) = &node.documentation {
let elem = Some(documentation.ast().into());
let line = BlockLine {elem,off};
lines.insert(index,line);
}
self.source.set_block_lines(lines)
}
/// Locates a node with the given id.
pub fn find_node(&self,id:ast::Id) -> Option<NodeInfo> {
self.nodes().iter().find(|node| node.id() == id).cloned()
}
/// After removing last node, we want to insert a placeholder value for definition value.
/// This defines its AST. Currently it is just `Nothing`.
pub fn empty_graph_body() -> Ast {
Ast::cons(constants::keywords::NOTHING).with_new_id()
}
/// Removes the node from graph.
pub fn remove_node(&mut self, node_id:ast::Id) -> FallibleResult {
self.update_node(node_id, |_| None)
}
/// Sets a new state for the node. The id of the described node must denote already existing
/// node.
pub fn set_node(&mut self, node:&NodeInfo) -> FallibleResult {
self.update_node(node.id(), |_| Some(node.clone()))
}
/// Sets a new state for the node. The id of the described node must denote already existing
/// node.
pub fn update_node(&mut self, id:ast::Id, f:impl FnOnce(NodeInfo) -> Option<NodeInfo>) -> FallibleResult {
let LocatedNode{index,node} = self.locate_node(id)?;
let mut lines = self.source.block_lines();
if let Some(updated_node) = f(node) {
lines[index.main_line].elem = Some(updated_node.main_line.ast().clone_ref());
match (index.documentation_line, updated_node.documentation) {
(Some(old_comment_index),None) => {
lines.remove(old_comment_index);
}
(Some(old_comment_index),Some(new_comment)) =>
lines[old_comment_index] = new_comment.block_line(),
(None,Some(new_comment)) =>
lines.insert(index.main_line, new_comment.block_line()),
(None,None) => {},
}
} else {
lines.remove(index.main_line);
if let Some(doc_index) = index.documentation_line {
lines.remove(doc_index);
}
}
if lines.is_empty() {
self.source.set_body_ast(Self::empty_graph_body());
Ok(())
} else {
self.source.set_block_lines(lines)
}
// TODO tests for cases with comments involved
}
/// Sets expression of the given node.
pub fn edit_node(&mut self, node_id:ast::Id, new_expression:Ast) -> FallibleResult {
self.update_node(node_id, |mut node| {
node.set_expression(new_expression);
Some(node)
})
}
#[cfg(test)]
pub fn expect_code(&self, expected_code:impl Str) {
let code = self.source.ast.repr();
assert_eq!(code,expected_code.as_ref());
}
}
// =============
// === Tests ===
// =============
#[cfg(test)]
mod tests {
use super::*;
use crate::double_representation::definition::DefinitionName;
use crate::double_representation::definition::DefinitionProvider;
use crate::double_representation::module::get_definition;
use ast::HasRepr;
use ast::macros::DocumentationCommentInfo;
use ast::test_utils::expect_single_line;
use utils::test::ExpectTuple;
use wasm_bindgen_test::wasm_bindgen_test;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
/// Takes a program with main definition in root and returns main's graph.
fn main_graph(parser:&parser::Parser, program:impl Str) -> GraphInfo {
let module = parser.parse_module(program.into(), default()).unwrap();
let name = DefinitionName::new_plain("main");
let main = module.def_iter().find_by_name(&name).unwrap();
GraphInfo::from_definition(main.item)
}
fn find_graph(parser:&parser::Parser, program:impl Str, name:impl Str) -> GraphInfo {
let module = parser.parse_module(program.into(), default()).unwrap();
let crumbs = name.into().split(".").map(|name| {
DefinitionName::new_plain(name)
}).collect();
let id = Id{crumbs};
let definition = get_definition(&module, &id).unwrap();
GraphInfo::from_definition(definition)
}
#[wasm_bindgen_test]
fn detect_a_node() {
let mut parser = parser::Parser::new_or_panic();
// Each of these programs should have a `main` definition with a single `2+2` node.
let programs = vec![
"main = 2+2",
"main = \n 2+2",
"main = \n foo = 2+2",
"main = \n foo = 2+2\n bar b = 2+2", // `bar` is a definition, not a node
];
for program in programs {
let graph = main_graph(&mut parser, program);
let nodes = graph.nodes();
assert_eq!(nodes.len(), 1);
let node = &nodes[0];
assert_eq!(node.expression().repr(), "2+2");
let _ = node.id(); // just to make sure it is available
}
}
fn new_expression_node(parser:&parser::Parser, expression:&str) -> NodeInfo {
let node_ast = parser.parse(expression.to_string(), default()).unwrap();
let line_ast = expect_single_line(&node_ast).clone();
NodeInfo::from_main_line_ast(&line_ast).unwrap()
}
fn assert_all(nodes:&[NodeInfo], expected:&[NodeInfo]) {
assert_eq!(nodes.len(), expected.len());
for (left,right) in nodes.iter().zip(expected) {
assert_same(left,right)
}
}
fn assert_same(left:&NodeInfo, right:&NodeInfo) {
assert_eq!(left.id(), right.id());
assert_eq!( left.documentation.as_ref().map(DocumentationCommentInfo::to_string)
, right.documentation.as_ref().map(DocumentationCommentInfo::to_string));
assert_eq!(left.main_line.repr(), right.main_line.repr());
}
#[wasm_bindgen_test]
fn add_node_to_graph_with_single_line() {
let program = "main = print \"hello\"";
let parser = parser::Parser::new_or_panic();
let mut graph = main_graph(&parser, program);
let nodes = graph.nodes();
assert_eq!(nodes.len(), 1);
let initial_node = nodes[0].clone();
assert_eq!(initial_node.expression().repr(), "print \"hello\"");
let expr0 = "a + 2";
let expr1 = "b + 3";
let node_to_add0 = new_expression_node(&parser, expr0);
let node_to_add1 = new_expression_node(&parser, expr1);
graph.add_node(&node_to_add0,LocationHint::Start).unwrap();
assert_eq!(graph.nodes().len(), 2);
graph.add_node(&node_to_add1,LocationHint::Before(graph.nodes()[0].id())).unwrap();
let nodes = graph.nodes();
assert_all(nodes.as_slice(), &[node_to_add1, node_to_add0, initial_node]);
}
#[wasm_bindgen_test]
fn add_node_to_graph_with_multiple_lines() {
// TODO [dg] Also add test for binding node when it's possible to update its id.
let program = r#"main =
foo = node
foo a = not_node
print "hello""#;
let mut parser = parser::Parser::new_or_panic();
let mut graph = main_graph(&mut parser, program);
let node_to_add0 = new_expression_node(&mut parser, "4 + 4");
let node_to_add1 = new_expression_node(&mut parser, "a + b");
let node_to_add2 = new_expression_node(&mut parser, "x * x");
let node_to_add3 = new_expression_node(&mut parser, "x / x");
let node_to_add4 = new_expression_node(&mut parser, "2 - 2");
graph.add_node(&node_to_add0, LocationHint::Start).unwrap();
graph.add_node(&node_to_add1, LocationHint::Before(graph.nodes()[0].id())).unwrap();
graph.add_node(&node_to_add2, LocationHint::After(graph.nodes()[1].id())).unwrap();
graph.add_node(&node_to_add3, LocationHint::End).unwrap();
// Node 4 will be added later.
let nodes = graph.nodes();
assert_eq!(nodes.len(), 6);
assert_eq!(nodes[0].expression().repr(), "a + b");
assert_eq!(nodes[0].id(), node_to_add1.id());
// Sic: `node_to_add1` was added at index `0`.
assert_eq!(nodes[1].expression().repr(), "4 + 4");
assert_eq!(nodes[1].id(), node_to_add0.id());
assert_eq!(nodes[2].expression().repr(), "x * x");
assert_eq!(nodes[2].id(), node_to_add2.id());
assert_eq!(nodes[3].expression().repr(), "node");
assert_eq!(nodes[4].expression().repr(), "print \"hello\"");
assert_eq!(nodes[5].expression().repr(), "x / x");
assert_eq!(nodes[5].id(), node_to_add3.id());
let expected_code = r#"main =
a + b
4 + 4
x * x
foo = node
foo a = not_node
print "hello"
x / x"#;
graph.expect_code(expected_code);
let mut graph = find_graph(&mut parser, program, "main.foo");
assert_eq!(graph.nodes().len(), 1);
graph.add_node(&node_to_add4, LocationHint::Start).unwrap();
assert_eq!(graph.nodes().len(), 2);
assert_eq!(graph.nodes()[0].expression().repr(), "2 - 2");
assert_eq!(graph.nodes()[0].id(), node_to_add4.id());
assert_eq!(graph.nodes()[1].expression().repr(), "not_node");
}
#[wasm_bindgen_test]
fn add_node_to_graph_with_blank_line() {
// The trailing `foo` definition is necessary for the blank line after "node2" to be
// included in the `main` block. Otherwise, the block would end on "node2" and the blank
// line would be parented to the module.
let program = r"main =
node2
foo = 5";
let mut parser = parser::Parser::new_or_panic();
let mut graph = main_graph(&mut parser, program);
let id2 = graph.nodes()[0].id();
let node_to_add0 = new_expression_node(&mut parser, "node0");
let node_to_add1 = new_expression_node(&mut parser, "node1");
let node_to_add3 = new_expression_node(&mut parser, "node3");
let node_to_add4 = new_expression_node(&mut parser, "node4");
graph.add_node(&node_to_add0, LocationHint::Start).unwrap();
graph.add_node(&node_to_add1, LocationHint::Before(id2)).unwrap();
graph.add_node(&node_to_add3, LocationHint::After(id2)).unwrap();
graph.add_node(&node_to_add4, LocationHint::End).unwrap();
let expected_code = r"main =
node0
node1
node2
node3
node4
";
// `foo` is not part of expected code, as it belongs to module, not `main` graph.
graph.expect_code(expected_code);
}
#[wasm_bindgen_test]
fn multiple_node_graph() {
let mut parser = parser::Parser::new_or_panic();
let program = r"
main =
## Faux docstring
## Docstring 0
foo = node0
## Docstring 1
# disabled node1
foo a = not_node
## Docstring 2
node2
node3
";
// TODO [mwu]
// Add case like `Int.+ a = not_node` once https://github.com/enso-org/enso/issues/565 is fixed
let graph = main_graph(&mut parser, program);
let nodes = graph.nodes();
assert_eq!(nodes[0].documentation_text(), Some(" Docstring 0".into()));
assert_eq!(nodes[0].ast().repr(), "foo = node0");
assert_eq!(nodes[1].documentation_text(), Some(" Docstring 1".into()));
assert_eq!(nodes[1].ast().repr(), "# disabled node1");
assert_eq!(nodes[2].documentation_text(), Some(" Docstring 2".into()));
assert_eq!(nodes[2].ast().repr(), "node2");
assert_eq!(nodes[3].documentation_text(), None);
assert_eq!(nodes[3].ast().repr(), "node3");
assert_eq!(nodes.len(), 4);
}
#[wasm_bindgen_test]
fn removing_node_from_graph() {
let mut parser = parser::Parser::new_or_panic();
let program = r"
main =
foo = 2 + 2
bar = 3 + 17";
let mut graph = main_graph(&mut parser, program);
let nodes = graph.nodes();
assert_eq!(nodes.len(), 2);
assert_eq!(nodes[0].expression().repr(), "2 + 2");
assert_eq!(nodes[1].expression().repr(), "3 + 17");
graph.remove_node(nodes[0].id()).unwrap();
let nodes = graph.nodes();
assert_eq!(nodes.len(), 1);
assert_eq!(nodes[0].expression().repr(), "3 + 17");
let expected_code = "main =\n bar = 3 + 17";
graph.expect_code(expected_code);
assert!(graph.remove_node(uuid::Uuid::new_v4()).is_err());
graph.expect_code(expected_code);
}
#[wasm_bindgen_test]
fn removing_last_node_from_graph() {
let mut parser = parser::Parser::new_or_panic();
let program = r"
main =
foo = 2 + 2";
let mut graph = main_graph(&mut parser, program);
DEBUG!("aa");
let (node,) = graph.nodes().expect_tuple();
assert_eq!(node.expression().repr(), "2 + 2");
DEBUG!("vv");
graph.remove_node(node.id()).unwrap();
DEBUG!("zz");
let (node,) = graph.nodes().expect_tuple();
assert_eq!(node.expression().repr(), constants::keywords::NOTHING);
graph.expect_code("main = Nothing");
}
#[wasm_bindgen_test]
fn editing_nodes_expression_in_graph() {
let mut parser = parser::Parser::new_or_panic();
let program = r"
main =
foo = 2 + 2
bar = 3 + 17";
let new_expression = parser.parse("print \"HELLO\"".to_string(), default()).unwrap();
let new_expression = expect_single_line(&new_expression).clone();
let mut graph = main_graph(&mut parser, program);
let nodes = graph.nodes();
assert_eq!(nodes.len(), 2);
assert_eq!(nodes[0].expression().repr(), "2 + 2");
assert_eq!(nodes[1].expression().repr(), "3 + 17");
graph.edit_node(nodes[0].id(),new_expression).unwrap();
let nodes = graph.nodes();
assert_eq!(nodes.len(), 2);
assert_eq!(nodes[0].expression().repr(), "print \"HELLO\"");
assert_eq!(nodes[1].expression().repr(), "3 + 17");
let expected_code = r#"main =
foo = print "HELLO"
bar = 3 + 17"#;
graph.expect_code(expected_code);
assert!(graph.edit_node(uuid::Uuid::new_v4(), Ast::var("foo")).is_err());
graph.expect_code(expected_code);
}
}
| 37.302231 | 110 | 0.601958 |
330ecd444c0b51c103fe8429f61156a567b6cff4
| 3,574 |
py
|
Python
|
src/decorators/location_decorator.py
|
AAU-PSix/canary
|
93b07d23cd9380adc03a6aa1291a13eaa3b3008c
|
[
"MIT"
] | null | null | null |
src/decorators/location_decorator.py
|
AAU-PSix/canary
|
93b07d23cd9380adc03a6aa1291a13eaa3b3008c
|
[
"MIT"
] | null | null | null |
src/decorators/location_decorator.py
|
AAU-PSix/canary
|
93b07d23cd9380adc03a6aa1291a13eaa3b3008c
|
[
"MIT"
] | null | null | null |
from typing import List, Dict
from ts.c_syntax import CSyntax
from ts import Tree
from cfa import CFANode, CFA, CFAEdge
from cfa import LocalisedCFA, LocalisedNode
from .tweet_handler import TweetHandler
from .decoration_strategy import StandardDecorationStrategy, DecorationStrategy
from .conversion_strategy import ConversionStrategy
class LocationDecorator():
def __init__(
self,
tree: Tree,
conversion_strategy: ConversionStrategy = None,
tweet_handler: TweetHandler = None,
decoration_strategy: DecorationStrategy = None
) -> None:
self.tree: Tree = tree
self._syntax = CSyntax()
self.tweet_handler = tweet_handler if tweet_handler is not None else TweetHandler(self.tree)
self.decoration_strategy = decoration_strategy if decoration_strategy is not None else StandardDecorationStrategy(self.tweet_handler)
self.edge_converter = conversion_strategy if conversion_strategy is not None else ConversionStrategy()
def map_node_to_location(self, cfa: CFA[CFANode]) -> Dict[CFANode, str]:
location_tweets = self.tweet_handler.get_all_location_tweet_nodes(cfa)
result: Dict[CFANode, str] = dict()
for tweet in location_tweets:
location = self.tweet_handler.extract_location_text_from_tweet(tweet.node)
result[location] = tweet
return result
def decorate(self, cfa: CFA[CFANode]) -> LocalisedCFA:
localised_cfa: LocalisedCFA = self.convert_cfa_to_localised(cfa)
# Step 1: Seed locations at tweet
self.decoration_strategy.decorate_initial_locations(localised_cfa)
# Step 2: Propagate seeds downwards
frontier: List[LocalisedNode] = list()
visited: List[LocalisedNode] = list()
frontier.append(localised_cfa.root)
while len(frontier) > 0:
cfa_node = frontier.pop(-1)
location = cfa_node.location
visited.append(cfa_node)
for edge in localised_cfa.outgoing_edges(cfa_node):
self.decoration_strategy.decorate_frontier(frontier, visited, location, edge)
# Step 3: Fixes where TWEETS comes after construct
for cfa_node in localised_cfa.nodes:
# Case 1: Switch cases propagation
if self._syntax.is_switch_case(cfa_node.node):
outgoings = localised_cfa.outgoing(cfa_node)
# We can assume that each case is followed by a location tweet
cfa_node.location = outgoings[0].location
return localised_cfa
def convert_cfa_to_localised(self, cfa: CFA[CFANode]) -> LocalisedCFA:
# Step 1: Convert all CFANodes to Localised CFA Nodes (CFANode -> Localised CFA Node)
converted_nodes: Dict[CFANode, LocalisedNode] = dict()
for cfa_node in cfa.nodes:
converted_nodes[cfa_node] = LocalisedNode(cfa_node.node)
localised_cfa = LocalisedCFA(
converted_nodes[cfa.root]
)
# Step 2: Reconstruct all edges
converted_edges: List[CFAEdge[CFANode]] = list()
for cfa_node in cfa.nodes:
self.edge_converter.convert_edges(
cfa.outgoing_edges(cfa_node),
converted_edges,
localised_cfa,
converted_nodes
)
self.edge_converter.convert_edges(
cfa.ingoing_edges(cfa_node),
converted_edges,
localised_cfa,
converted_nodes
)
return localised_cfa
| 40.613636 | 141 | 0.665921 |
4a34b311c51fdd010d3e19ffc9940586213e4a46
| 222 |
js
|
JavaScript
|
SistCoopJefeCajaApp/src/main/webapp/scripts/filters/nospace.js
|
Softgreen/SistCoop
|
78a6c93fd82e4438eea157ca51410416672bc6b8
|
[
"Apache-2.0"
] | null | null | null |
SistCoopJefeCajaApp/src/main/webapp/scripts/filters/nospace.js
|
Softgreen/SistCoop
|
78a6c93fd82e4438eea157ca51410416672bc6b8
|
[
"Apache-2.0"
] | null | null | null |
SistCoopJefeCajaApp/src/main/webapp/scripts/filters/nospace.js
|
Softgreen/SistCoop
|
78a6c93fd82e4438eea157ca51410416672bc6b8
|
[
"Apache-2.0"
] | null | null | null |
define(['./module'], function (filters) {
'use strict';
filters.filter('nospace', function () {
return function (value) {
return (!value) ? '' : value.replace(/ /g, '');
};
});
});
| 22.2 | 59 | 0.481982 |
5efd0672d9053fa4e6bd2901e58a4d2d802a8d92
| 6,895 |
asm
|
Assembly
|
Tools/System/Minnow5DataManipulation.asm
|
jaredwhitney/os3
|
05e0cda4670da093cc720d0dccbfeb29e788fa0f
|
[
"MIT"
] | 5 |
2015-02-25T01:28:09.000Z
|
2021-05-22T09:03:04.000Z
|
Tools/System/Minnow5DataManipulation.asm
|
jaredwhitney/os3
|
05e0cda4670da093cc720d0dccbfeb29e788fa0f
|
[
"MIT"
] | 38 |
2015-02-10T18:37:11.000Z
|
2017-10-03T03:08:50.000Z
|
Tools/System/Minnow5DataManipulation.asm
|
jaredwhitney/os3
|
05e0cda4670da093cc720d0dccbfeb29e788fa0f
|
[
"MIT"
] | 2 |
2016-05-06T22:48:46.000Z
|
2017-01-12T19:28:49.000Z
|
Minnow5.appendDataBlock : ; qword buffer (file) in eax, returns eax=blockptr
methodTraceEnter
pusha
push eax ; interface setting
mov eax, [eax+0x0]
call Minnow5.setInterfaceSmart
pop eax
mov eax, [eax+0x4]
mov dword [.base], eax
call Minnow5.findFreeBlock ; find a free block
mov dword [.block], ebx
mov ebx, [Minnow5._dat] ; figure out what should point to it; make it do so
mov ecx, [.block]
call Minnow5.readBlock
mov edx, [ebx+Minnow5.Block_innerPointer]
cmp edx, null
jne .noInner
mov [ebx+Minnow5.Block_innerPointer], ecx
call Minnow5.writeBlock
jmp .doPlacementEnd
.noInner :
mov eax, edx
.loopGoOn :
call Minnow5.readBlock
cmp dword [ebx+Minnow5.Block_nextPointer], null
je .loopDone
mov eax, [ebx+Minnow5.Block_nextPointer]
jmp .loopGoOn
.loopDone :
mov [ebx+Minnow5.Block_nextPointer], ecx
call Minnow5.writeBlock
.doPlacementEnd :
mov eax, [Minnow5._dat] ; clear a buffer
mov ebx, 0x200
call Buffer.clear
mov dword [eax], "MINF" ; fill it with the proper headers
mov dword [eax+Minnow5.Block_signatureHigh], Minnow5.SIGNATURE_HIGH
mov dword [eax+Minnow5.Block_nextPointer], null
mov ecx, [.base]
mov dword [eax+Minnow5.Block_upperPointer], ecx
mov dword [eax+Minnow5.Block_type], Minnow5.BLOCK_TYPE_DATA
mov ebx, eax ; write it out to the disk
mov eax, [.block]
call Minnow5.writeBlock
popa
mov eax, [.block]
methodTraceLeave
ret
.base :
dd 0x0
.block :
dd 0x0
Minnow5.writeBuffer : ; eax = qword buffer (file), ebx = buffer (data), ecx = buffer size, edx = position in file
methodTraceEnter
pusha
mov [.file], eax
mov [.dataBuffer], ebx
mov [.buffersize], ecx
mov [.writePos], edx
push eax ; interface setting
mov eax, [eax+0x0]
call Minnow5.setInterfaceSmart
pop eax
mov eax, [eax+0x4]
; mov dword [.base], eax
mov ebx, [Minnow5._dat]
call Minnow5.readBlock
mov ecx, [ebx+Minnow5.Block_byteSize]
; mov [.oldsize], ecx
mov edx, [.buffersize]
add edx, [.writePos]
cmp edx, ecx
jbe .noSizeUp
mov dword [ebx+Minnow5.Block_byteSize], edx
.noSizeUp :
call Minnow5.writeBlock
cmp dword [ebx+Minnow5.Block_innerPointer], null
jne .notEmptyFile
mov eax, [.file]
call Minnow5.appendDataBlock
mov eax, [.file]
mov eax, [eax+0x4]
call Minnow5.readBlock
.notEmptyFile :
mov eax, [ebx+Minnow5.Block_innerPointer]
mov ecx, [.writePos]
shr ecx, 9 ; div by 0x200 (ecx is now the start sector)
push ecx
.goToPosLoop :
call Minnow5.readBlock
cmp ecx, 0
je .gotoPosDone
dec ecx
mov edx, [ebx+Minnow5.Block_nextPointer]
cmp edx, null
jne .noMake
mov eax, [.file]
call Minnow5.appendDataBlock
jmp .gtpmdone
.noMake :
mov eax, edx
.gtpmdone :
jmp .goToPosLoop
.gotoPosDone :
mov [.currentBlock], eax ; also already read into [ebx]
mov ecx, [.writePos]
pop edx
shl edx, 9
sub ecx, edx
mov [.startOffs], ecx
; ;
; Now that we know where to start, do the actual copying
; ;
mov ecx, 0x200-Minnow5.Block_data
sub ecx, [.startOffs]
add ebx, [.startOffs]
.innerLoop :
mov eax, [.currentBlock]
mov ebx, [Minnow5._dat]
call Minnow5.readBlock
cmp [.buffersize], ecx
jae .nosmod
mov ecx, [.buffersize]
.nosmod :
sub [.buffersize], ecx
mov eax, [.dataBuffer]
add dword [.dataBuffer], ecx
add ebx, Minnow5.Block_data
; copy from [eax] to [ebx]... size = ecx
.copyLoop :
mov dl, [eax]
mov [ebx], dl
add ebx, 1
add eax, 1
sub ecx, 1
cmp ecx, 0
jg .copyLoop
mov eax, [.currentBlock]
mov ebx, [Minnow5._dat]
call Minnow5.writeBlock
mov eax, [ebx+Minnow5.Block_nextPointer]
cmp eax, null
jne .noMake2
mov eax, [.file]
call Minnow5.appendDataBlock
.noMake2 :
mov [.currentBlock], eax
mov ecx, 0x200-Minnow5.Block_data
cmp dword [.buffersize], 0
jg .innerLoop
popa
methodTraceLeave
ret
.file :
dd 0x0
.startOffs :
dd 0x0
.dataBuffer :
dd 0x0
.buffersize :
dd 0x0
.writePos :
dd 0x0
.currentBlock :
dd 0x0
Minnow5.readBuffer : ; eax = qword buffer (file), ebx = buffer (data), ecx = buffer size, edx = position in file, ecx out = bytes read
methodTraceEnter
pusha
mov [.dataBuffer], ebx
mov [.buffersize], ecx
mov [.readPos], edx
push eax
mov eax, [eax+0x0]
call Minnow5.setInterfaceSmart
pop eax
mov eax, [eax+0x4]
mov ebx, [Minnow5._dat]
call Minnow5.readBlock
mov ecx, [ebx+Minnow5.Block_byteSize]
; mov [.filesize], ecx
; Check / correct actual read size... return if the offset is at or after the EOF
mov edx, [.buffersize]
add edx, [.readPos]
cmp ecx, edx
jae .nosizelimit
cmp ecx, [.readPos]
ja .readOffsetExistsInFile
mov dword [.bytesread], 0
jmp .readLoopDone
.readOffsetExistsInFile :
sub ecx, [.readPos]
mov [.buffersize], ecx
mov [.bytesread], ecx
.nosizelimit :
; Navigate to the read offset
mov eax, [ebx+Minnow5.Block_innerPointer]
mov ecx, [.readPos]
shr ecx, 9 ; div by 0x200 (ecx is now the start sector)
push ecx
.goToPosLoop :
call Minnow5.readBlock
cmp ecx, 0
je .gotoPosDone
dec ecx
mov eax, [ebx+Minnow5.Block_nextPointer]
jmp .goToPosLoop
.gotoPosDone : ; the first block has already been read into [ebx]
; Calculate the starting offset
mov ecx, [.readPos]
pop edx
shl edx, 9
sub ecx, edx
mov [.offs], ecx
; Figure out values for the first read (the offset one) then jump into the loop
mov ecx, [ebx+Minnow5.Block_nextPointer] ; ready next sector
mov [.next], ecx
mov ecx, 0x200-Minnow5.Block_data ; get read size
sub ecx, [.offs]
cmp [.buffersize], ecx ; fix read size if it should be an incomplete read
jge .startNoReadLimit
mov ecx, [.buffersize]
.startNoReadLimit :
sub [.buffersize], ecx
add ebx, [.offs]
jmp .readLoopEntryPoint
; Read / copy the actual data
.readLoop :
cmp dword [.buffersize], 0
jle .readLoopDone
mov ebx, [Minnow5._dat]
call Minnow5.readBlock
mov ecx, [ebx+Minnow5.Block_nextPointer]
mov [.next], ecx
mov ecx, 0x200-Minnow5.Block_data
cmp [.buffersize], ecx
jge .noReadLimit
mov ecx, [.buffersize]
.noReadLimit :
sub [.buffersize], ecx
.readLoopEntryPoint :
mov eax, [.dataBuffer]
add [.dataBuffer], ecx
add ebx, Minnow5.Block_data
; copy from [ebx] to [eax]... size = ecx
.copyLoop :
mov dl, [ebx]
mov [eax], dl
inc eax
inc ebx
dec ecx
cmp ecx, 0
jg .copyLoop
mov eax, [.next]
jmp .readLoop
.readLoopDone :
popa
mov ecx, [.bytesread]
methodTraceLeave
ret
.dataBuffer :
dd 0x0
.buffersize :
dd 0x0
.readPos :
dd 0x0
.bytesread :
dd 0x0
.offs :
dd 0x0
.next :
dd 0x0
| 20.893939 | 134 | 0.655112 |
229cd2247acd715c3b90c598230eafaa2756c9fe
| 2,355 |
html
|
HTML
|
src/app/material-component/chips/chips.component.html
|
pedrocabocalvet/digitalinvoice
|
f4661670f86f0643d5b85c16f62bb7b7166b0831
|
[
"MIT"
] | null | null | null |
src/app/material-component/chips/chips.component.html
|
pedrocabocalvet/digitalinvoice
|
f4661670f86f0643d5b85c16f62bb7b7166b0831
|
[
"MIT"
] | 8 |
2020-07-20T01:09:14.000Z
|
2022-03-02T07:55:47.000Z
|
src/app/material-component/chips/chips.component.html
|
odiazjs/gondolas-demo
|
7a381be98e3b1c8852f448ac4b602c6e4b42111a
|
[
"MIT"
] | 1 |
2022-02-09T05:58:32.000Z
|
2022-02-09T05:58:32.000Z
|
<mat-card>
<mat-card-content>
<mat-card-title>Basic Chips</mat-card-title>
<mat-card-subtitle><code><mat-chip></code>displays a list of values as individual, keyboard accessible, chips. <code class=""><a href="https://material.angular.io/components/chips/overview">Official Component</a></code></mat-card-subtitle>
<mat-chip-list>
<mat-chip>One fish</mat-chip>
<mat-chip>Two fish</mat-chip>
<mat-chip color="primary" selected="true">Primary fish</mat-chip>
<mat-chip color="accent" selected="true">Accent fish</mat-chip>
</mat-chip-list>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-content>
<mat-card-title>Chip input</mat-card-title>
<mat-card-subtitle>The MatChipInput directive can be used together with a chip-list to streamline the interaction between the two components. This directive adds chip-specific behaviors to the input element within for adding and removing chips. </mat-card-subtitle>
<mat-form-field class="demo-chip-list">
<mat-chip-list #chipList>
<mat-chip *ngFor="let fruit of fruits" [selectable]="selectable"
[removable]="removable" (removed)="remove(fruit)">
{{fruit.name}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip>
<input placeholder="New fruit..."
[matChipInputFor]="chipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
[matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)" />
</mat-chip-list>
</mat-form-field>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-content>
<mat-card-title>Stacked Chips</mat-card-title>
<mat-card-subtitle>You can also stack the chips if you want them on top of each other and/or use the
<code>(focus)</code> event to run custom code.</mat-card-subtitle>
<mat-chip-list class="mat-chip-list-stacked">
<mat-chip *ngFor="let aColor of availableColors"
(focus)="color = aColor.color" color="{{aColor.color}}" selected="true">
{{aColor.name}}
</mat-chip>
</mat-chip-list>
</mat-card-content>
</mat-card>
| 45.288462 | 270 | 0.610616 |
1db492d6637db3801e0d9228b5fcc7ad778f48f4
| 8,814 |
sql
|
SQL
|
lapg_db.sql
|
Demonicious/lapg
|
b7dac7baf2eeee612eeee2dddfa08c3285d45c58
|
[
"MIT"
] | null | null | null |
lapg_db.sql
|
Demonicious/lapg
|
b7dac7baf2eeee612eeee2dddfa08c3285d45c58
|
[
"MIT"
] | null | null | null |
lapg_db.sql
|
Demonicious/lapg
|
b7dac7baf2eeee612eeee2dddfa08c3285d45c58
|
[
"MIT"
] | null | null | null |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 14, 2019 at 03:22 PM
-- Server version: 5.7.26
-- PHP Version: 7.2.18
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
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: `lapg_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `access_keys`
--
DROP TABLE IF EXISTS `access_keys`;
CREATE TABLE IF NOT EXISTS `access_keys` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`access_key` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `access_keys`
--
INSERT INTO `access_keys` (`id`, `user_id`, `access_key`) VALUES
(1, 1, '8nq0lf7f7b91bc7');
-- --------------------------------------------------------
--
-- Table structure for table `addresses`
--
DROP TABLE IF EXISTS `addresses`;
CREATE TABLE IF NOT EXISTS `addresses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`address_1` text NOT NULL,
`address_2` text NOT NULL,
`zipcode` varchar(255) NOT NULL,
`city` varchar(255) NOT NULL,
`state` varchar(255) NOT NULL,
`country` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `addresses`
--
INSERT INTO `addresses` (`id`, `user_id`, `address_1`, `address_2`, `zipcode`, `city`, `state`, `country`) VALUES
(1, 1, 'Nexthon, 2nd Floor Haider Plaza, Prince Chowk', 'Gujrat, 50700', '50700', 'Gujrat', 'Punjab', 'Pakistan');
-- --------------------------------------------------------
--
-- Table structure for table `balance`
--
DROP TABLE IF EXISTS `balance`;
CREATE TABLE IF NOT EXISTS `balance` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`balance_held` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `balance`
--
INSERT INTO `balance` (`id`, `user_id`, `balance_held`) VALUES
(1, 1, 500);
-- --------------------------------------------------------
--
-- Table structure for table `merchant_info`
--
DROP TABLE IF EXISTS `merchant_info`;
CREATE TABLE IF NOT EXISTS `merchant_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`merchant_name` varchar(255) NOT NULL,
`merchant_desc` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `merchant_info`
--
INSERT INTO `merchant_info` (`id`, `user_id`, `merchant_name`, `merchant_desc`) VALUES
(1, 1, 'Demonicious', 'A Guy who Sells Things on the Internet.');
-- --------------------------------------------------------
--
-- Table structure for table `rates`
--
DROP TABLE IF EXISTS `rates`;
CREATE TABLE IF NOT EXISTS `rates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`currency` varchar(255) NOT NULL,
`rate` mediumint(9) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=841 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `rates`
--
INSERT INTO `rates` (`id`, `currency`, `rate`) VALUES
(673, 'AED', 4),
(674, 'AFN', 91),
(675, 'ALL', 122),
(676, 'AMD', 538),
(677, 'ANG', 2),
(678, 'AOA', 390),
(679, 'ARS', 47),
(680, 'AUD', 2),
(681, 'AWG', 2),
(682, 'AZN', 2),
(683, 'BAM', 2),
(684, 'BBD', 2),
(685, 'BDT', 95),
(686, 'BGN', 2),
(687, 'BHD', 0),
(688, 'BIF', 2083),
(689, 'BMD', 1),
(690, 'BND', 2),
(691, 'BOB', 8),
(692, 'BRL', 4),
(693, 'BSD', 1),
(694, 'BTC', 0),
(695, 'BTN', 77),
(696, 'BWP', 12),
(697, 'BYN', 2),
(698, 'BYR', 22124),
(699, 'BZD', 2),
(700, 'CAD', 1),
(701, 'CDF', 1879),
(702, 'CHF', 1),
(703, 'CLF', 0),
(704, 'CLP', 767),
(705, 'CNY', 8),
(706, 'COP', 3626),
(707, 'CRC', 655),
(708, 'CUC', 1),
(709, 'CUP', 30),
(710, 'CVE', 110),
(711, 'CZK', 26),
(712, 'DJF', 201),
(713, 'DKK', 7),
(714, 'DOP', 58),
(715, 'DZD', 135),
(716, 'EGP', 19),
(717, 'ERN', 17),
(718, 'ETB', 33),
(719, 'EUR', 1),
(720, 'FJD', 2),
(721, 'FKP', 1),
(722, 'GBP', 1),
(723, 'GEL', 3),
(724, 'GGP', 1),
(725, 'GHS', 6),
(726, 'GIP', 1),
(727, 'GMD', 56),
(728, 'GNF', 10418),
(729, 'GTQ', 9),
(730, 'GYD', 236),
(731, 'HKD', 9),
(732, 'HNL', 28),
(733, 'HRK', 7),
(734, 'HTG', 106),
(735, 'HUF', 326),
(736, 'IDR', 15810),
(737, 'ILS', 4),
(738, 'IMP', 1),
(739, 'INR', 77),
(740, 'IQD', 1343),
(741, 'IRR', 47526),
(742, 'ISK', 142),
(743, 'JEP', 1),
(744, 'JMD', 149),
(745, 'JOD', 1),
(746, 'JPY', 122),
(747, 'KES', 116),
(748, 'KGS', 79),
(749, 'KHR', 4608),
(750, 'KMF', 494),
(751, 'KPW', 1015),
(752, 'KRW', 1329),
(753, 'KWD', 0),
(754, 'KYD', 1),
(755, 'KZT', 434),
(756, 'LAK', 9800),
(757, 'LBP', 1706),
(758, 'LKR', 199),
(759, 'LRD', 225),
(760, 'LSL', 16),
(761, 'LTL', 3),
(762, 'LVL', 1),
(763, 'LYD', 2),
(764, 'MAD', 11),
(765, 'MDL', 20),
(766, 'MGA', 4089),
(767, 'MKD', 62),
(768, 'MMK', 1705),
(769, 'MNT', 2982),
(770, 'MOP', 9),
(771, 'MRO', 403),
(772, 'MUR', 40),
(773, 'MVR', 17),
(774, 'MWK', 853),
(775, 'MXN', 21),
(776, 'MYR', 5),
(777, 'MZN', 70),
(778, 'NAD', 16),
(779, 'NGN', 406),
(780, 'NIO', 38),
(781, 'NOK', 10),
(782, 'NPR', 124),
(783, 'NZD', 2),
(784, 'OMR', 0),
(785, 'PAB', 1),
(786, 'PEN', 4),
(787, 'PGK', 4),
(788, 'PHP', 58),
(789, 'PKR', 178),
(790, 'PLN', 4),
(791, 'PYG', 6818),
(792, 'QAR', 4),
(793, 'RON', 5),
(794, 'RSD', 118),
(795, 'RUB', 71),
(796, 'RWF', 1032),
(797, 'SAR', 4),
(798, 'SBD', 9),
(799, 'SCR', 15),
(800, 'SDG', 51),
(801, 'SEK', 11),
(802, 'SGD', 2),
(803, 'SHP', 1),
(804, 'SLL', 10102),
(805, 'SOS', 660),
(806, 'SRD', 8),
(807, 'STD', 24337),
(808, 'SVC', 10),
(809, 'SYP', 581),
(810, 'SZL', 16),
(811, 'THB', 35),
(812, 'TJS', 11),
(813, 'TMT', 4),
(814, 'TND', 3),
(815, 'TOP', 3),
(816, 'TRY', 6),
(817, 'TTD', 8),
(818, 'TWD', 35),
(819, 'TZS', 2596),
(820, 'UAH', 29),
(821, 'UGX', 4171),
(822, 'USD', 1),
(823, 'UYU', 40),
(824, 'UZS', 9688),
(825, 'VEF', 11),
(826, 'VND', 26229),
(827, 'VUV', 129),
(828, 'WST', 3),
(829, 'XAF', 658),
(830, 'XAG', 0),
(831, 'XAU', 0),
(832, 'XCD', 3),
(833, 'XDR', 1),
(834, 'XOF', 658),
(835, 'XPF', 120),
(836, 'YER', 283),
(837, 'ZAR', 16),
(838, 'ZMK', 10160),
(839, 'ZMW', 14),
(840, 'ZWL', 363);
-- --------------------------------------------------------
--
-- Table structure for table `settings`
--
DROP TABLE IF EXISTS `settings`;
CREATE TABLE IF NOT EXISTS `settings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`setting_name` varchar(255) NOT NULL,
`setting_value` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `settings`
--
INSERT INTO `settings` (`id`, `setting_name`, `setting_value`) VALUES
(1, 'master_key', '23f8dae3852859564f3c75425375ab1e2def1de1');
-- --------------------------------------------------------
--
-- Table structure for table `transactions`
--
DROP TABLE IF EXISTS `transactions`;
CREATE TABLE IF NOT EXISTS `transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`amount` int(11) NOT NULL,
`sent_to` varchar(255) NOT NULL,
`timestamp` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `transactions`
--
INSERT INTO `transactions` (`id`, `user_id`, `amount`, `sent_to`, `timestamp`) VALUES
(1, 1, 32, 'ali@haider.com', 1563115228);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`salt` varchar(255) NOT NULL,
`login_key` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`verified` varchar(255) NOT NULL,
`unique_address` varchar(255) NOT NULL,
`currency` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `salt`, `login_key`, `email`, `verified`, `unique_address`, `currency`) VALUES
(1, 'Mudassar Islam', '184c87a246338443bc78ba0fb7ca5b11', 'ba10122e669ce153530906543b4281a2', '35561f44bf5ea9d6db9d2560e75bcb29', 'demoncious@gmail.com', '1', 'yxdz-86b1a58f7efb751b3df6bf8de7ce94f00ddab292', 'pkr');
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 */;
| 23.31746 | 215 | 0.576923 |
0e3ef04f165323356e50379ed0a4a3878e30426c
| 704 |
html
|
HTML
|
mysite/mysite/templates/try_table_navigation.html
|
ScienceStacks/JViz
|
c8de23d90d49d4c9bc10da25f4a87d6f44aab138
|
[
"Artistic-2.0",
"Apache-2.0"
] | 31 |
2016-11-16T22:34:35.000Z
|
2022-03-22T22:16:11.000Z
|
mysite/mysite/templates/try_table_navigation.html
|
ScienceStacks/JViz
|
c8de23d90d49d4c9bc10da25f4a87d6f44aab138
|
[
"Artistic-2.0",
"Apache-2.0"
] | 6 |
2017-06-24T06:29:36.000Z
|
2022-01-23T06:30:01.000Z
|
mysite/mysite/templates/try_table_navigation.html
|
ScienceStacks/JViz
|
c8de23d90d49d4c9bc10da25f4a87d6f44aab138
|
[
"Artistic-2.0",
"Apache-2.0"
] | 4 |
2017-07-27T16:23:50.000Z
|
2022-03-12T06:36:13.000Z
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Try JQuery Table Navigation</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
<table id="mytable">
<tr>
<td><span><div class="data">60</div></span></td>
<td><span>$10000</span></td>
<td><span><div class="data">100%</div></span></td>
</tr>
<tr>
<td><span><div>60</div></span></td>
<td><span>$10000</span></td>
<td><span><div>100%</div></span></td>
</tr>
</table>
<p class="data">Click me!</p>
<script type ="text/javascript" src="try_table_navigation.js"> </script>
</body>
</html>
| 24.275862 | 93 | 0.545455 |
31a3321848c26a6c8abd18e7a974c63a0db3fddd
| 88 |
kt
|
Kotlin
|
app/src/main/java/org/cuieney/videolife/kotlin/common/okhttp/CookiesManager.kt
|
daimaren/CloudPlayer
|
b9240c27d70760c357bb88c4f7acd4e9c529d528
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | 2 |
2019-10-27T17:23:21.000Z
|
2021-03-30T03:01:38.000Z
|
app/src/main/java/org/cuieney/videolife/kotlin/common/okhttp/CookiesManager.kt
|
daimaren/CloudPlayer
|
b9240c27d70760c357bb88c4f7acd4e9c529d528
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null |
app/src/main/java/org/cuieney/videolife/kotlin/common/okhttp/CookiesManager.kt
|
daimaren/CloudPlayer
|
b9240c27d70760c357bb88c4f7acd4e9c529d528
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1 |
2018-02-11T07:56:10.000Z
|
2018-02-11T07:56:10.000Z
|
package org.cuieney.videolife.kotlin.common
/**
* Created by cuieney on 2017/6/5.
*/
| 14.666667 | 43 | 0.704545 |
c6e2672b4a1414d7ed4af9443c5afac1204713c8
| 103 |
rb
|
Ruby
|
test/dummy/db/seeds.rb
|
smashingboxes/cardboard_blog
|
2dc085a67c6410812cee6730788f9e6160d76196
|
[
"MIT"
] | null | null | null |
test/dummy/db/seeds.rb
|
smashingboxes/cardboard_blog
|
2dc085a67c6410812cee6730788f9e6160d76196
|
[
"MIT"
] | null | null | null |
test/dummy/db/seeds.rb
|
smashingboxes/cardboard_blog
|
2dc085a67c6410812cee6730788f9e6160d76196
|
[
"MIT"
] | null | null | null |
puts "Generating Admin User"
AdminUser.create(email: "michael@smashingboxes.com", password: "password")
| 51.5 | 74 | 0.796117 |
e0b2140d2ac3477b517fbc53ee4741f28fd8adb9
| 110 |
swift
|
Swift
|
Tools/Bridgy/Sources/Bridgy/main.swift
|
BatchLabs/Batch-iOS-SDK
|
17644488872e62ff09a9106592aecbf79c04e6e7
|
[
"MIT"
] | 10 |
2020-12-03T17:08:02.000Z
|
2022-03-16T16:22:45.000Z
|
Sources/Bridgy/main.swift
|
BatchLabs/Bridgy
|
65715a1953aea77b652bb2820367543fe8e36839
|
[
"MIT"
] | 6 |
2020-10-15T12:56:22.000Z
|
2022-02-18T14:12:49.000Z
|
Sources/Bridgy/main.swift
|
BatchLabs/Bridgy
|
65715a1953aea77b652bb2820367543fe8e36839
|
[
"MIT"
] | 3 |
2020-12-16T16:15:11.000Z
|
2021-12-22T15:03:00.000Z
|
import Darwin
do {
try CommandLine.run()
} catch {
print("Failed: \(error)")
exit(EXIT_FAILURE)
}
| 13.75 | 29 | 0.618182 |
0054999f05a72f2f5b8e15efb46540b8997b7201
| 3,547 |
sql
|
SQL
|
init.sql
|
julyerr/wenwo
|
57bc03350dd715a2c04f9a574f3952b14dfa06eb
|
[
"MIT"
] | 1 |
2018-08-05T03:28:39.000Z
|
2018-08-05T03:28:39.000Z
|
init.sql
|
julyerr/wenwo
|
57bc03350dd715a2c04f9a574f3952b14dfa06eb
|
[
"MIT"
] | null | null | null |
init.sql
|
julyerr/wenwo
|
57bc03350dd715a2c04f9a574f3952b14dfa06eb
|
[
"MIT"
] | null | null | null |
INSERT INTO `wenwo_admin_user` (`id`, `in_time`, `password`, `token`, `username`, `role_id`)
VALUES
(1, '2018-07-18 00:00:00', '$2a$10$Tudq82ap3RQ0oG8Ts/EL2.pPiwuWe.cS.EHnSbu30lie5fU76YaWS.', '70989be6-0e03-48fe-9153-1a60cbdbef3e', 'admin', 1);
INSERT INTO `wenwo_permission` (`id`, `name`, `pid`, `url`, `value`)
VALUES
(1, '主页', 0, '/admin/index', 'index'),
(2, '话题', 0, '/admin/topic/*', 'topic'),
(3, '话题删除', 2, '/admin/topic/delete', 'topic:delete'),
(4, '话题列表', 2, '/admin/topic/list', 'topic:list'),
(5, '评论', 0, '/admin/comment/*', 'comment'),
(6, '评论编辑', 5, '/admin/comment/edit', 'comment:edit'),
(7, '评论删除', 5, '/admin/comment/delete', 'comment:delete'),
(8, '评论列表', 5, '/admin/comment/list', 'comment:list'),
(9, '权限', 0, '/admin/security', 'security'),
(10, '后台用户列表', 9, '/admin/admin_user/list', 'admin_user:list'),
(11, '角色列表', 9, '/admin/role/list', 'role:list'),
(12, '权限列表', 9, '/admin/permission/list', 'permission:list'),
(13, '后台用户编辑', 9, '/admin/admin_user/edit', 'admin_user:edit'),
(14, '后台用户删除', 9, '/admin/admin_user/delete', 'admin_user:delete'),
(15, '角色编辑', 9, '/admin/role/edit', 'role:edit'),
(16, '角色删除', 9, '/admin/role/delete', 'role:delete'),
(17, '权限编辑', 9, '/admin/permission/edit', 'permission:edit'),
(18, '权限删除', 9, '/admin/permission/delete', 'permission:delete'),
(19, '用户', 0, '/admin/user/*', 'user'),
(20, '用户列表', 19, '/admin/user/list', 'user:list'),
(21, '用户禁用', 19, '/admin/user/block', 'user:block'),
(22, '删除用户', 19, '/admin/user/delete', 'user:delete'),
(27, '日志', 0, '/admin/log/*', 'log'),
(28, '日志列表', 27, '/admin/log/list', 'log:list'),
(30, '仪表盘', 1, '/admin/index', 'dashboard'),
(31, '话题加精', 2, '/admin/topic/good', 'topic:good'),
(32, '话题置顶', 2, '/admin/topic/top', 'topic:top'),
(33, '权限添加', 9, '/admin/permission/add', 'permission:add'),
(34, '话题编辑', 2, '/admin/topic/edit', 'topic:edit'),
(35, '后台用户', 0, '/admin/admin_user/*', 'adminUser'),
(36, '编辑', 35, '/admin/admin_user/edit', 'admin_user:edit'),
(37, '删除', 35, '/admin/admin_user/delete', 'admin_user:delete'),
(38, '添加', 35, '/admin/admin_user/add', 'admin_user:add'),
(40, '清除Redis缓存', 1, '/admin/clear', 'admin_index:clear'),
(41, '索引话题', 1, '/admin/indexedTopic', 'admin_index:indexedTopic'),
(43, '标签', 0, '/admin/tag/*', 'tag'),
(44, '列表', 43, '/admin/tag/list', 'tag:list'),
(45, '编辑', 43, '/admin/tag/edit', 'tag:edit'),
(46, '删除', 43, '/admin/tag/delete', 'tag:delete'),
(47, '索引标签', 1, '/admin/indexedTag', 'admin_index:indexedTag'),
(48, '编辑', 19, '/admin/user/edit', 'user:edit'),
(50, '角色删除', 9, '/admin/role/add', 'role:add');
INSERT INTO `wenwo_role` (`id`, `name`)
VALUES
(1, 'admin'),
(2, 'manager');
INSERT INTO `wenwo_role_permission` (`id`, `permission_id`, `role_id`)
VALUES
(2, 3, 23),
(4, 4, 23),
(5, 6, 23),
(7, 7, 23),
(9, 8, 23),
(21, 20, 23),
(23, 21, 23),
(25, 22, 23),
(27, 28, 23),
(29, 30, 23),
(30, 31, 23),
(32, 32, 23),
(35, 34, 23),
(233, 30, 1),
(234, 40, 1),
(235, 41, 1),
(236, 47, 1),
(237, 3, 1),
(238, 4, 1),
(239, 31, 1),
(240, 32, 1),
(241, 34, 1),
(242, 6, 1),
(243, 7, 1),
(244, 8, 1),
(245, 10, 1),
(246, 11, 1),
(247, 12, 1),
(248, 13, 1),
(249, 14, 1),
(250, 15, 1),
(251, 16, 1),
(252, 17, 1),
(253, 18, 1),
(254, 33, 1),
(255, 20, 1),
(256, 21, 1),
(257, 22, 1),
(258, 48, 1),
(259, 28, 1),
(260, 36, 1),
(261, 37, 1),
(262, 38, 1),
(263, 44, 1),
(264, 45, 1),
(265, 46, 1),
(266, 50, 1);
| 33.462264 | 146 | 0.541303 |
6704a7b7f5adce49dfc6d510bff86e380d092157
| 278 |
kt
|
Kotlin
|
kotaro/src/commonMain/kotlin/math/Vector3i.kt
|
Pengiie/kotarOld
|
b9f75232ae7d2ad815478307d0c731d0f1ce9bbd
|
[
"Apache-2.0"
] | null | null | null |
kotaro/src/commonMain/kotlin/math/Vector3i.kt
|
Pengiie/kotarOld
|
b9f75232ae7d2ad815478307d0c731d0f1ce9bbd
|
[
"Apache-2.0"
] | null | null | null |
kotaro/src/commonMain/kotlin/math/Vector3i.kt
|
Pengiie/kotarOld
|
b9f75232ae7d2ad815478307d0c731d0f1ce9bbd
|
[
"Apache-2.0"
] | null | null | null |
package dev.pengie.kotaro.math
class Vector3i(x: Int, y: Int, z: Int) : Vector3<Int>(x, y, z, ArithmeticInt) {
constructor() : this(0)
constructor(value: Int) : this(value, value, value)
override fun copy(x: Int, y: Int, z: Int): Vector3<Int> = Vector3i(x, y, z)
}
| 34.75 | 79 | 0.643885 |
0e3a1fa6911fb97236da1ed645fbe345fb0b5239
| 5,205 |
lua
|
Lua
|
lua/starfall/preprocessor.lua
|
Mijyuoon/starfall
|
f5faa0750c9b9f9848a9e68d0d7b1753210e9db0
|
[
"BSD-3-Clause"
] | null | null | null |
lua/starfall/preprocessor.lua
|
Mijyuoon/starfall
|
f5faa0750c9b9f9848a9e68d0d7b1753210e9db0
|
[
"BSD-3-Clause"
] | null | null | null |
lua/starfall/preprocessor.lua
|
Mijyuoon/starfall
|
f5faa0750c9b9f9848a9e68d0d7b1753210e9db0
|
[
"BSD-3-Clause"
] | 2 |
2021-04-20T14:50:10.000Z
|
2021-07-07T18:27:41.000Z
|
-------------------------------------------------------------------------------
-- SF Preprocessor.
-- Processes code for compile time directives.
-------------------------------------------------------------------------------
-- TODO: Make an @include-only parser
SF.Preprocessor = {}
SF.Preprocessor.directives = {}
--- Sets a global preprocessor directive.
-- @param directive The directive to set.
-- @param func The callback. Takes the directive arguments, the file name, and instance.data
function SF.Preprocessor.SetGlobalDirective(directive, func)
SF.Preprocessor.directives[directive] = func
end
local function FindComments( line )
local ret, count, pos, found = {}, 0, 1
repeat
found = line:find( '["%-%[%]]', pos )
if (found) then -- We found something
local oldpos = pos
local char = line:sub(found,found)
if char == "-" then
if line:sub(found,found+1) == "--" then
-- Comment beginning
if line:sub(found,found+3) == "--[[" then
-- Block Comment beginning
count = count + 1
ret[count] = {type = "start", pos = found}
pos = found + 4
else
-- Line comment beginning
count = count + 1
ret[count] = {type = "line", pos = found}
pos = found + 2
end
else
pos = found + 1
end
elseif char == "[" then
local level = line:sub(found+1):match("^(=*)")
if level then level = string.len(level) else level = 0 end
if line:sub(found+level+1, found+level+1) == "[" then
-- Block string start
count = count + 1
ret[count] = {type = "stringblock", pos = found, level = level}
pos = found + level + 2
else
pos = found + 1
end
elseif char == "]" then
local level = line:sub(found+1):match("^(=*)")
if level then level = string.len(level) else level = 0 end
if line:sub(found+level+1,found+level+1) == "]" then
-- Ending
count = count + 1
ret[count] = {type = "end", pos = found, level = level}
pos = found + level + 2
else
pos = found + 1
end
elseif char == "\"" then
if line:sub(found-1,found-1) == "\\" and line:sub(found-2,found-1) ~= "\\\\" then
-- Escaped character
pos = found+1
else
-- String
count = count + 1
ret[count] = {type = "string", pos = found}
pos = found + 1
end
end
if oldpos == pos then error("Regex found something, but nothing handled it") end
end
until not found
return ret, count
end
--- Parses a source file for directives.
-- @param filename The file name of the source code
-- @param source The source code to parse.
-- @param directives A table of additional directives to use.
-- @param data The data table passed to the directives.
function SF.Preprocessor.ParseDirectives(filename, source, directives, data)
local ending = nil
local endingLevel = nil
local str = source
while str ~= "" do
local line
line, str = string.match(str,"^([^\n]*)\n?(.*)$")
for _,comment in ipairs(FindComments(line)) do
if ending then
if comment.type == ending then
if endingLevel then
if comment.level and comment.level == endingLevel then
ending = nil
endingLevel = nil
end
else
ending = nil
end
end
elseif comment.type == "start" then
ending = "end"
elseif comment.type == "string" then
ending = "string"
elseif comment.type == "stringblock" then
ending = "end"
endingLevel = comment.level
elseif comment.type == "line" then
local directive, args = string.match(line,"--@([^ ]+)%s*(.*)$")
local func = directives[directive] or SF.Preprocessor.directives[directive]
if func then
func(args, filename, data)
end
end
end
if ending == "newline" then ending = nil end
end
end
local function directive_include(args, filename, data)
if not data.includes then data.includes = {} end
if not data.includes[filename] then data.includes[filename] = {} end
if args:sub(-4,-1) ~= ".txt" then
args = args .. ".txt"
end
local incl = data.includes[filename]
incl[#incl+1] = args
end
SF.Preprocessor.SetGlobalDirective("include", directive_include)
local function directive_exclude(args, filename, data)
if not data.excludes then data.excludes = {} end
if args:sub(-4,-1) ~= ".txt" then
args = args .. ".txt"
end
data.excludes[args] = true
end
SF.Preprocessor.SetGlobalDirective("exclude", directive_exclude)
local function directive_name(args, filename, data)
if not data.scriptnames then data.scriptnames = {} end
data.scriptnames[filename] = args
end
SF.Preprocessor.SetGlobalDirective("name", directive_name)
local function directive_sharedscreen(args, filename, data)
if not data.sharedscreen then data.sharedscreen = true end
end
SF.Preprocessor.SetGlobalDirective("sharedscreen", directive_sharedscreen)
local function directive_moonscript(args, filename, data)
if not data.moonscript then data.moonscript = true end
end
SF.Preprocessor.SetGlobalDirective("moonscript", directive_moonscript)
local function directive_nosandbox(args, filename, data)
if not data.nosandbox then data.nosandbox = true end
end
SF.Preprocessor.SetGlobalDirective("nosandbox", directive_nosandbox)
| 29.913793 | 92 | 0.640538 |
95bb40c2fdede4768fb90c9d98aab2c147822ec5
| 43,938 |
sql
|
SQL
|
app/database/scripts/wellsearch/wells_replication_stored_functions.sql
|
cedar-technologies/gwells
|
9023034698a9c25e5a49193242678c1aee3c6f4d
|
[
"Apache-2.0"
] | 1 |
2020-01-29T22:42:40.000Z
|
2020-01-29T22:42:40.000Z
|
app/database/scripts/wellsearch/wells_replication_stored_functions.sql
|
cedar-technologies/gwells
|
9023034698a9c25e5a49193242678c1aee3c6f4d
|
[
"Apache-2.0"
] | 1 |
2018-05-02T05:28:33.000Z
|
2018-05-09T15:58:07.000Z
|
app/database/scripts/wellsearch/wells_replication_stored_functions.sql
|
cedar-technologies/gwells
|
9023034698a9c25e5a49193242678c1aee3c6f4d
|
[
"Apache-2.0"
] | 1 |
2018-05-02T23:56:48.000Z
|
2018-05-02T23:56:48.000Z
|
/*
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.
*/
--
-- PostgreSQL script to create stored functions that replicate legacy
-- WELLS data from production Oracle Database, to the GWELLS application
-- database.
--
-- These stored functions will not be needed once we cut over
-- from legacy WELLS to the new GWELLS application.
--
-- DESCRIPTION
-- Define the SQL INSERT command that copies from the legacy WELLS table to a temporary
-- ETL or 'transformation' (i.e. *_xform) table using dynamic SQL to support the optional
-- SQL subset clause.
--
-- PARAMETERS
-- _subset_ind Boolean indicator flag: 'true' to append additional WHERE clause, limiting
-- the copy to a smaller subset
-- 'false' to copy ALL data
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION populate_xform(
_subset_ind boolean DEFAULT true) RETURNS void AS $$
DECLARE
xform_rows integer;
sql_stmt text;
subset_clause text := 'AND wells.well_tag_number between 100001 and 113567';
insert_sql text := 'INSERT INTO xform_well (
well_tag_number ,
well_id ,
well_guid ,
acceptance_status_code ,
owner_full_name ,
owner_mailing_address ,
owner_city ,
owner_postal_code ,
street_address ,
city ,
legal_lot ,
legal_plan ,
legal_district_lot ,
legal_block ,
legal_section ,
legal_township ,
legal_range ,
legal_pid ,
well_location_description ,
identification_plate_number ,
diameter ,
total_depth_drilled ,
finished_well_depth ,
static_water_level ,
well_cap_type ,
well_disinfected ,
well_yield ,
intended_water_use_code ,
land_district_code ,
province_state_code ,
well_class_code ,
well_subclass_guid ,
well_yield_unit_code ,
latitude ,
longitude ,
ground_elevation ,
well_orientation ,
other_drilling_method ,
drilling_method_code ,
ground_elevation_method_code ,
well_status_code ,
observation_well_number ,
obs_well_status_code ,
licenced_status_code ,
alternative_specifications_ind ,
construction_start_date ,
construction_end_date ,
alteration_start_date ,
alteration_end_date ,
decommission_start_date ,
decommission_end_date ,
drilling_company_guid ,
final_casing_stick_up ,
artesian_flow ,
artesian_pressure ,
bedrock_depth ,
water_supply_system_name ,
water_supply_system_well_name ,
well_identification_plate_attached,
ems ,
screen_intake_method_code ,
screen_type_code ,
screen_material_code ,
screen_opening_code ,
screen_bottom_code ,
utm_zone_code ,
utm_northing ,
utm_easting ,
utm_accuracy_code ,
bcgs_id ,
development_method_code ,
development_duration ,
surface_seal_method_code ,
surface_seal_material_code,
surface_seal_length ,
surface_seal_thickness ,
backfill_type ,
backfill_depth ,
liner_material_code ,
decommission_reason ,
decommission_method_code ,
sealant_material ,
backfill_material ,
decommission_details ,
comments ,
create_date ,
update_date ,
create_user ,
update_user)
SELECT
wells.well_tag_number ,
wells.well_id ,
gen_random_uuid() ,
wells.acceptance_status_code AS acceptance_status_code ,
concat_ws('' '', owner.giVEN_NAME,OWNER.SURNAME) AS owner_full_name ,
concat_ws('' '',OWNER.STREET_NUMBER,STREET_NAME) AS owner_mailing_address,
owner.city AS owner_city ,
owner.postal_code AS owner_postal_code ,
wells.site_street AS street_address ,
wells.site_area AS city ,
wells.lot_number AS legal_lot ,
wells.legal_plan AS legal_plan ,
wells.legal_district_lot AS legal_district_lot ,
wells.legal_block AS legal_block ,
wells.legal_section AS legal_section ,
wells.legal_township AS legal_township ,
wells.legal_range AS legal_range ,
to_char(wells.pid,''fm000000000'') AS legal_pid ,
wells.well_location AS well_location_description ,
wells.well_identification_plate_no AS identification_plate_number ,
wells.diameter AS diameter ,
wells.total_depth_drilled AS total_depth_drilled ,
wells.depth_well_drilled AS finished_well_depth ,
wells.water_depth ,
wells.type_of_well_cap ,
CASE wells.well_disinfected_ind
WHEN ''Y'' THEN TRUE
WHEN ''N'' THEN FALSE
ELSE FALSE
END AS well_disinfected ,
wells.yield_value AS well_yield ,
CASE wells.well_use_code
WHEN ''OTH'' THEN ''OTHER''
ELSE wells.well_use_code
END AS intended_water_use_code ,
wells.legal_land_district_code as land_district_code ,
CASE owner.province_state_code
WHEN ''WASH_STATE'' THEN ''WA''
ELSE owner.province_state_code
END AS province_state_code ,
wells.class_of_well_codclassified_by AS well_class_code ,
subclass.well_subclass_guid ,
CASE wells.yield_unit_code
WHEN ''USGM'' THEN ''USGPM''
ELSE wells.yield_unit_code
END AS well_yield_unit_code ,
wells.latitude ,
CASE
WHEN wells.longitude > 0 THEN wells.longitude * -1
ELSE wells.longitude
END AS longitude ,
wells.elevation AS ground_elevation ,
CASE wells.orientation_of_well_code
WHEN ''HORIZ'' THEN false
ELSE true
END AS well_orientation ,
null AS other_drilling_method, -- placeholder as it is brand new content
wells.drilling_method_code AS drilling_method_code, -- supersedes CONSTRUCTION_METHOD_CODE
wells.ground_elevation_method_code AS ground_elevation_method_code,
CASE wells.status_of_well_code
WHEN ''UNK'' THEN null -- ''OTHER''
ELSE wells.status_of_well_code
END AS well_status_code ,
to_char(wells.observation_well_number,''fm000'') AS observation_well_number,
CASE wells.ministry_observation_well_stat
WHEN ''Abandoned'' THEN ''Inactive''
ELSE wells.ministry_observation_well_stat
END AS obs_well_status_code,
wells.well_licence_general_status AS licenced_status_code ,
CASE wells.alternative_specifications_ind
WHEN ''N'' THEN false
WHEN ''Y'' THEN true
ELSE null
END AS alternative_specifications_ind ,
wells.construction_start_date AT TIME ZONE ''GMT'' ,
wells.construction_end_date AT TIME ZONE ''GMT'' ,
wells.alteration_start_date AT TIME ZONE ''GMT'' ,
wells.alteration_end_date AT TIME ZONE ''GMT'' ,
wells.closure_start_date AT TIME ZONE ''GMT'' ,
wells.closure_end_date AT TIME ZONE ''GMT'' ,
drilling_company.drilling_company_guid ,
wells.final_casing_stick_up ,
wells.artesian_flow_value ,
wells.artesian_pressure ,
wells.bedrock_depth ,
wells.water_supply_system_name ,
wells.water_supply_well_name ,
wells.where_plate_attached ,
wells.chemistry_site_id ,
wells.screen_intake_code ,
CASE wells.screen_type_code
WHEN ''UNK'' THEN null
ELSE wells.screen_type_code
END AS screen_type_code ,
CASE wells.screen_material_code
WHEN ''UNK'' THEN ''OTHER''
ELSE wells.screen_material_code
END AS screen_material_code ,
wells.screen_opening_code ,
wells.screen_bottom_code ,
wells.utm_zone_code ,
wells.utm_north ,
wells.utm_east ,
wells.utm_accuracy_code ,
wells.bcgs_id ,
wells.development_method_code ,
wells.development_hours ,
CASE wells.surface_seal_method_code
WHEN ''UNK'' THEN null
ELSE wells.surface_seal_method_code
END AS surface_seal_method_code ,
CASE wells.surface_seal_material_code
WHEN ''UNK'' THEN ''OTHER''
ELSE wells.surface_seal_material_code
END AS surface_seal_material_code ,
wells.surface_seal_depth ,
wells.surface_seal_thickness ,
wells.backfill_type ,
wells.backfill_depth ,
wells.liner_material_code AS liner_material_code ,
wells.closure_reason ,
wells.closure_method_code ,
wells.sealant_material ,
wells.backfill_material ,
wells.closure_details ,
wells.general_remarks ,
wells.when_created ,
COALESCE(wells.when_updated,wells.when_created) ,
wells.who_created ,
COALESCE(wells.who_updated,wells.who_created)
FROM wells.wells_wells wells LEFT OUTER JOIN wells.wells_owners owner ON owner.owner_id=wells.owner_id
LEFT OUTER JOIN drilling_company drilling_company ON UPPER(wells.driller_company_code)=UPPER(drilling_company.drilling_company_code)
LEFT OUTER JOIN well_subclass_code subclass ON UPPER(wells.subclass_of_well_classified_by)=UPPER(subclass.well_subclass_code)
AND subclass.well_class_code = wells.class_of_well_codclassified_by
WHERE wells.acceptance_status_code NOT IN (''PENDING'', ''REJECTED'', ''NEW'') ';
BEGIN
raise notice 'Starting populate_xform() procedure...';
DROP TABLE IF EXISTS xform_well;
CREATE unlogged TABLE IF NOT EXISTS xform_well (
well_tag_number integer,
well_id bigint,
well_guid uuid,
acceptance_status_code character varying(10),
owner_full_name character varying(200),
owner_mailing_address character varying(100),
owner_city character varying(100),
owner_postal_code character varying(10),
street_address character varying(100),
city character varying(50),
legal_lot character varying(10),
legal_plan character varying(20),
legal_district_lot character varying(20),
legal_block character varying(10),
legal_section character varying(10),
legal_township character varying(20),
legal_range character varying(10),
legal_pid character varying(9),
well_location_description character varying(500),
identification_plate_number integer,
diameter character varying(9),
total_depth_drilled numeric(7,2),
finished_well_depth numeric(7,2),
static_water_level numeric(7,2),
well_cap_type character varying(40),
well_disinfected boolean,
well_yield numeric(8,3),
intended_water_use_code character varying(10),
land_district_code character varying(10),
province_state_code character varying(10),
well_class_code character varying(10),
well_subclass_guid uuid,
well_yield_unit_code character varying(10),
latitude numeric(8,6),
longitude numeric(9,6),
ground_elevation numeric(10,2),
well_orientation boolean,
other_drilling_method character varying(50),
drilling_method_code character varying(10),
ground_elevation_method_code character varying(10),
well_status_code character varying(10),
observation_well_number character varying(3),
obs_well_status_code character varying(10),
licenced_status_code character varying(10),
alternative_specifications_ind boolean,
construction_start_date timestamp with time zone,
construction_end_date timestamp with time zone,
alteration_start_date timestamp with time zone,
alteration_end_date timestamp with time zone,
decommission_start_date timestamp with time zone,
decommission_end_date timestamp with time zone,
drilling_company_guid uuid,
final_casing_stick_up integer,
artesian_flow numeric(7,2),
artesian_pressure numeric(5,2),
bedrock_depth numeric(7,2),
well_identification_plate_attached character varying(500),
water_supply_system_name character varying(80),
water_supply_system_well_name character varying(80),
ems character varying(10),
screen_intake_method_code character varying(10),
screen_type_code character varying(10),
screen_material_code character varying(10),
screen_opening_code character varying(10),
screen_bottom_code character varying(10),
utm_zone_code character varying(10),
utm_northing integer,
utm_easting integer,
utm_accuracy_code character varying(10),
bcgs_id bigint,
development_method_code character varying(10),
development_duration integer,
yield_estimation_method_code character varying(10),
surface_seal_method_code character varying(10),
surface_seal_material_code character varying(10),
surface_seal_length numeric(5,2),
surface_seal_thickness numeric(7,2),
backfill_type character varying(250),
backfill_depth numeric(7,2),
liner_material_code character varying(10),
decommission_reason character varying(250),
decommission_method_code character varying(10),
sealant_material character varying(100),
backfill_material character varying(100),
decommission_details character varying(250),
comments character varying(255),
create_date timestamp with time zone,
update_date timestamp with time zone,
create_user character varying(30),
update_user character varying(30)
);
raise notice 'Created xform_well ETL table';
IF _subset_ind THEN
sql_stmt := insert_sql || ' ' || subset_clause;
ELSE
sql_stmt := insert_sql;
END IF;
raise notice '... transforming wells data (= ACCEPTED) via xform_well ETL table...';
EXECUTE sql_stmt;
SELECT count(*) from xform_well into xform_rows;
raise notice '... % rows loaded into the xform_well table', xform_rows;
raise notice 'Finished populate_xform() procedure.';
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION populate_xform (boolean) IS 'Load ETL Transform Table from legacy Oracle Database using Foreign Data Wrapper.';
-- DESCRIPTION
-- Define the SQL INSERT command that copies from the legacy WELLS_BCGS_NUMBERS table to
-- the analogous GWELLS lookup table (bcgs_number). Note that the BCGS table isn't strictly
-- a static lookup table as it will be updated with new BCGS mapsheets as they become
-- referenced from new wells in the system. This happens several times a year.
--
-- PARAMETERS
-- None
--
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION migrate_bcgs() RETURNS void AS $$
DECLARE
row_count integer;
BEGIN
raise notice '...importing wells_screens data';
INSERT INTO bcgs_number (
create_user, create_date, update_user, update_date, bcgs_id, bcgs_number
)
SELECT
who_created ,when_created ,who_updated ,when_updated, bcgs_id, bcgs_number
FROM WELLS.WELLS_BCGS_NUMBERS
ORDER BY BCGS_NUMBER;
raise notice '...BCGS data imported into the bcgs_number table';
SELECT count(*) from bcgs_number into row_count;
raise notice '% rows loaded into the bcgs_number table', row_count;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION migrate_bcgs () IS 'Load BCGS numbers from legacy Oracle Database using Foreign Data Wrapper.';
-- DESCRIPTION
-- Define the SQL INSERT command that copies from the temporary ETL or 'transformation'
-- (i.e. *_xform) table to the main GWELLS 'well' table.
--
-- PARAMETERS
-- None
--
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION populate_well() RETURNS void AS $$
DECLARE
row_count integer;
BEGIN
raise notice '... importing transformed WELLS data into the GWELLS main ''well'' table';
INSERT INTO well (
well_tag_number ,
well_guid ,
owner_full_name ,
owner_mailing_address ,
owner_city ,
owner_postal_code ,
street_address ,
city ,
legal_lot ,
legal_plan ,
legal_district_lot ,
legal_block ,
legal_section ,
legal_township ,
legal_range ,
land_district_code ,
legal_pid ,
well_location_description ,
identification_plate_number ,
diameter ,
total_depth_drilled ,
finished_well_depth ,
static_water_level ,
well_cap_type ,
well_disinfected ,
well_yield ,
intended_water_use_code ,
province_state_code ,
well_class_code ,
well_subclass_guid ,
well_yield_unit_code ,
latitude ,
longitude ,
ground_elevation ,
well_orientation ,
other_drilling_method ,
drilling_method_code ,
ground_elevation_method_code,
create_date ,
update_date ,
create_user ,
update_user ,
surface_seal_length ,
surface_seal_thickness ,
surface_seal_method_code ,
surface_seal_material_code ,
backfill_type ,
backfill_depth ,
liner_material_code ,
well_status_code ,
observation_well_number ,
obs_well_status_code ,
licenced_status_code ,
other_screen_bottom ,
other_screen_material ,
development_notes ,
water_quality_colour ,
water_quality_odour ,
alternative_specs_submitted ,
construction_start_date ,
construction_end_date ,
alteration_start_date ,
alteration_end_date ,
decommission_start_date ,
decommission_end_date ,
drilling_company_guid ,
final_casing_stick_up ,
artesian_flow ,
artesian_pressure ,
bedrock_depth ,
water_supply_system_name ,
water_supply_system_well_name,
well_identification_plate_attached,
ems ,
screen_intake_method_code,
screen_type_code ,
screen_material_code ,
screen_opening_code ,
screen_bottom_code ,
utm_zone_code ,
utm_northing ,
utm_easting ,
utm_accuracy_code ,
bcgs_id ,
development_method_code ,
development_hours ,
decommission_reason ,
decommission_method_code ,
sealant_material ,
backfill_material ,
decommission_details ,
comments
)
SELECT
xform.well_tag_number ,
gen_random_uuid() ,
COALESCE(xform.owner_full_name,' ') ,
COALESCE(xform.owner_mailing_address, ' ') ,
COALESCE(xform.owner_city, ' ') ,
COALESCE(xform.owner_postal_code , ' ') ,
COALESCE(xform.street_address , ' ') ,
COALESCE(xform.city , ' ') ,
COALESCE(xform.legal_lot , ' ') ,
COALESCE(xform.legal_plan , ' ') ,
COALESCE(xform.legal_district_lot, ' ') ,
COALESCE(xform.legal_block , ' ') ,
COALESCE(xform.legal_section , ' ') ,
COALESCE(xform.legal_township , ' ') ,
COALESCE(xform.legal_range , ' ') ,
xform.land_district_code ,
xform.legal_pid ,
COALESCE(xform.well_location_description,' '),
xform.identification_plate_number ,
COALESCE(xform.diameter, ' ') ,
xform.total_depth_drilled ,
xform.finished_well_depth ,
xform.static_water_level ,
xform.well_cap_type ,
xform.well_disinfected ,
xform.well_yield ,
xform.intended_water_use_code ,
COALESCE(xform.province_state_code,'OTHER') ,
xform.well_class_code ,
xform.well_subclass_guid ,
xform.well_yield_unit_code ,
xform.latitude ,
xform.longitude ,
xform.ground_elevation ,
xform.well_orientation ,
NULL ,
xform.drilling_method_code ,
xform.ground_elevation_method_code ,
xform.create_date ,
xform.update_date ,
xform.create_user ,
xform.update_user ,
xform.surface_seal_length ,
xform.surface_seal_thickness ,
xform.surface_seal_method_code ,
xform.surface_seal_material_code ,
xform.backfill_type ,
xform.backfill_depth ,
xform.liner_material_code ,
xform.well_status_code ,
xform.observation_well_number ,
xform.obs_well_status_code ,
xform.licenced_status_code ,
'' ,
'' ,
'' ,
'' ,
'' ,
false ,
xform.construction_start_date ,
xform.construction_end_date ,
xform.alteration_start_date ,
xform.alteration_end_date ,
xform.decommission_start_date ,
xform.decommission_end_date ,
xform.drilling_company_guid ,
xform.final_casing_stick_up ,
xform.artesian_flow ,
xform.artesian_pressure ,
xform.bedrock_depth ,
xform.water_supply_system_name ,
xform.water_supply_system_well_name ,
xform.well_identification_plate_attached,
xform.ems ,
xform.screen_intake_method_code ,
xform.screen_type_code ,
xform.screen_material_code ,
xform.screen_opening_code ,
xform.screen_bottom_code ,
xform.utm_zone_code ,
xform.utm_northing ,
xform.utm_easting ,
xform.utm_accuracy_code ,
xform.bcgs_id ,
xform.development_method_code ,
xform.development_duration ,
xform.decommission_reason ,
xform.decommission_method_code ,
xform.sealant_material ,
xform.backfill_material ,
xform.decommission_details ,
xform.comments
FROM xform_well xform;
raise notice '...xform data imported into the well table';
SELECT count(*) from well into row_count;
raise notice '% rows loaded into the well table', row_count;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION populate_well () IS 'Transfer from local XFORM ETL table into well.';
-- DESCRIPTION
-- Define the SQL INSERT command that copies the screen details from the legacy
-- database to the analogous GWELLS table (screen).
--
-- PARAMETERS
-- None
--
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION migrate_screens() RETURNS void AS $$
DECLARE
row_count integer;
BEGIN
raise notice '...importing wells_screens data';
INSERT INTO screen(
screen_guid ,
filing_number ,
well_tag_number ,
screen_from ,
screen_to ,
internal_diameter ,
screen_assembly_type_code ,
slot_size ,
create_date ,
update_date ,
create_user ,
update_user)
SELECT
gen_random_uuid() ,
null ,
xform.well_tag_number ,
screens.screen_from ,
screens.screen_to ,
screens.screen_internal_diameter,
CASE screens.screen_assembly_type_code
WHEN 'L' THEN 'LEAD'
WHEN 'K & Riser' THEN 'K_RISER'
ELSE screens.screen_assembly_type_code
END AS screen_assembly_type_code,
screens.screen_slot_size ,
screens.when_created ,
screens.when_updated ,
screens.who_created ,
screens.who_updated
FROM wells.wells_screens screens
INNER JOIN xform_well xform ON xform.well_id=screens.well_id;
raise notice '...wells_screens data imported';
SELECT count(*) from screen into row_count;
raise notice '% rows loaded into the screen table', row_count;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION migrate_screens () IS 'Load Screen details numbers, only for the wells that have been replicated.';
-- DESCRIPTION
-- Define the SQL INSERT command that copies the production data from the legacy
-- database to the analogous GWELLS table (production_data).
--
-- PARAMETERS
-- None
--
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION migrate_production() RETURNS void AS $$
DECLARE
row_count integer;
BEGIN
raise notice '...importing wells_production_data data';
INSERT INTO production_data(
production_data_guid ,
filing_number ,
well_tag_number ,
yield_estimation_method_code ,
yield_estimation_rate ,
yield_estimation_duration ,
well_yield_unit_code ,
static_level ,
drawdown ,
hydro_fracturing_performed ,
create_user, create_date ,
update_user, update_date
)
SELECT
gen_random_uuid() ,
null ,
xform.well_tag_number ,
CASE production_data.yield_estimated_method_code
WHEN 'UNK' THEN null
ELSE production_data.yield_estimated_method_code
END AS yield_estimation_method_code,
production_data.test_rate ,
production_data.test_duration ,
CASE production_data.test_rate_units_code
WHEN 'USGM' THEN 'USGPM'
ELSE production_data.test_rate_units_code
END AS well_yield_unit_code ,
production_data.static_level ,
production_data.net_drawdown ,
false ,
production_data.who_created, production_data.when_created,
COALESCE(production_data.who_updated,production_data.who_created) ,
COALESCE(production_data.when_updated,production_data.when_created)
FROM wells.wells_production_data production_data
INNER JOIN xform_well xform ON production_data.well_id=xform.well_id;
raise notice '...wells_production_data data imported';
SELECT count(*) from production_data into row_count;
raise notice '% rows loaded into the production_data table', row_count;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION migrate_production () IS 'Load Production Data, only for the wells that have been replicated.';
-- DESCRIPTION
-- Define the SQL INSERT command that copies the casings data from the legacy
-- database to the analogous GWELLS table (casing), referencing well tag number that
-- continues to be used in the new system (table join to the transformation table).
--
-- PARAMETERS
-- None
--
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION migrate_casings() RETURNS void AS $$
DECLARE
row_count integer;
BEGIN
raise notice '...importing wells_casings data';
INSERT INTO casing(
casing_guid ,
filing_number ,
well_tag_number ,
casing_from ,
casing_to ,
diameter ,
casing_material_code,
wall_thickness ,
drive_shoe ,
create_date, update_date, create_user, update_user
)
SELECT
gen_random_uuid() ,
null ,
xform.well_tag_number ,
casings.casing_from ,
casings.casing_to ,
casings.casing_size ,
CASE casings.casing_material_code
WHEN 'UNK' THEN null
ELSE casings.casing_material_code
END AS casing_material_code ,
casings.casing_wall ,
CASE casings.casing_drive_shoe_ind
WHEN '' THEN null
WHEN 'Y' THEN TRUE
WHEN 'N' THEN FALSE
END ,
casings.when_created, casings.when_updated, casings.who_created, casings.who_updated
FROM wells.wells_casings casings
INNER JOIN xform_well xform ON xform.well_id=casings.well_id;
raise notice '...wells_casings data imported';
SELECT count(*) from casing into row_count;
raise notice '% rows loaded into the casing table', row_count;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION migrate_casings () IS 'Load Casing details, only for the wells that have been replicated.';
-- DESCRIPTION
-- Define the SQL INSERT command that copies the perforation data from the legacy
-- database to the analogous GWELLS table (perforation), referencing well tag number that
-- continues to be used in the new system (table join to the transformation table).
--
-- NOTE: The legacy data has thousands of rows with 'empty' columns; these are
-- filtered out via the SQL WHERE clause.
--
-- PARAMETERS
-- None
--
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION migrate_perforations() RETURNS void AS $$
DECLARE
row_count integer;
BEGIN
raise notice '...importing wells_perforations data';
INSERT INTO perforation(
perforation_guid ,
well_tag_number ,
liner_thickness ,
liner_diameter ,
liner_from ,
liner_to ,
liner_perforation_from ,
liner_perforation_to ,
create_user, create_date, update_user, update_date
)
SELECT
gen_random_uuid() ,
xform.well_tag_number ,
perforations.liner_thickness ,
perforations.liner_diameter ,
perforations.liner_from ,
perforations.liner_to ,
perforations.liner_perforation_from,
perforations.liner_perforation_to ,
perforations.who_created, perforations.when_created, perforations.who_updated, perforations.when_updated
FROM wells.wells_perforations perforations
INNER JOIN xform_well xform ON perforations.well_id=xform.well_id
WHERE NOT (liner_from is null
AND liner_to IS NULL
AND liner_diameter IS NULL
AND liner_thickness IS NULL
AND liner_perforation_from IS NULL
AND liner_perforation_to IS NULL);
raise notice '...wells_perforations data imported';
SELECT count(*) from perforation into row_count;
raise notice '% rows loaded into the perforation table', row_count;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION migrate_perforations () IS 'Load BCGS numbers, only for the wells that have been replicated.';
-- DESCRIPTION
-- Define the SQL INSERT command that copies the aquifer linkages from the legacy
-- database to the analogous GWELLS table (aquifer_well), referencing well tag number that
-- continues to be used in the new system (table join to the transformation table).
--
-- PARAMETERS
-- None
--
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION migrate_aquifers() RETURNS void AS $$
DECLARE
row_count integer;
BEGIN
raise notice '...importing gw_aquifer_wells data';
INSERT INTO aquifer_well(
aquifer_well_guid,
aquifer_id,
well_tag_number,
create_user,create_date,update_user,update_date
)
SELECT
gen_random_uuid() ,
aws.aquifer_id ,
xform.well_tag_number,
aws.who_created ,
aws.when_created ,
coalesce(aws.who_updated, aws.who_created),
coalesce(aws.when_updated,aws.when_created)
FROM wells.gw_aquifer_wells aws INNER JOIN xform_well xform ON aws.well_id = xform.well_id;
raise notice '...gw_aquifer_well data imported';
SELECT count(*) from aquifer_well into row_count;
raise notice '% rows loaded into the aquifer_well table', row_count;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION migrate_aquifers () IS 'Load Aquifer Wells, only for the wells that have been replicated.';
-- DESCRIPTION
-- Define the SQL INSERT command that copies the lithology from the legacy
-- database to the analogous GWELLS table (lithology_description), referencing well tag
-- number that continues to be used in the new system (table join to the transformation
-- table).
--
-- NOTE: This copy also converts the flow units ('USGM'to 'USGPM').
-- PARAMETERS
-- None
--
-- RETURNS
-- None as this is a stored procedure
--
CREATE OR REPLACE FUNCTION migrate_lithology() RETURNS void AS $$
DECLARE
row_count integer;
BEGIN
raise notice '...importing wells_lithology_descriptions data';
INSERT INTO lithology_description(
lithology_description_guid ,
filing_number ,
well_tag_number ,
lithology_from ,
lithology_to ,
lithology_raw_data ,
lithology_description_code ,
lithology_material_code ,
lithology_hardness_code ,
lithology_colour_code ,
water_bearing_estimated_flow,
well_yield_unit_code ,
lithology_observation ,
lithology_sequence_number ,
create_user, create_date, update_user, update_date
)
SELECT
gen_random_uuid() ,
null ,
xform.well_tag_number ,
wld.lithology_from ,
wld.lithology_to ,
wld.lithology_raw_data ,
wld.lithology_code ,
wld.lithology_material_code ,
wld.relative_hardness_code ,
wld.lithology_colour_code ,
wld.water_bearing_estimated_flow ,
CASE wld.water_bearing_est_flw_unt_cd
WHEN 'USGM' THEN 'USGPM'
ELSE wld.water_bearing_est_flw_unt_cd
END AS well_yield_unit_code ,
wld.lithology_observation ,
wld.lithology_sequence_number ,
wld.who_created, wld.when_created, COALESCE(wld.who_updated, wld.who_created), COALESCE(wld.when_updated, wld.when_created)
FROM wells.wells_lithology_descriptions wld
INNER JOIN xform_well xform ON xform.well_id=wld.well_id
INNER JOIN wells.wells_wells wells ON wells.well_id=wld.well_id;
raise notice '...wells_lithology_descriptions data imported';
SELECT count(*) from lithology_description into row_count;
raise notice '% rows loaded into the lithology_description table', row_count;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION migrate_lithology () IS 'Load Lithology, only for the wells that have been replicated.';
-- DESCRIPTION
-- Define two driver stored procedures, grouping the SQL commands that runs the WELLS to
-- GWELLS replication, into two distinct steps. This does NOT include a refresh of the
-- static code tables; that is done only during the pipeline build and deploy.
--
-- This division (into two steps) of the WELLS to GWELLS replication, is required to work
-- around an intermittent postgresql bug; for more details see:
-- https://github.com/bcgov/gwells/wiki/Regular-Corruption-of-the-PostgreSQL-DB
--
-- There is the opportunity to run 'VACUUM FULL' to reclaim disk space, in between
-- these two steps.
--
-- These steps will succeed only if the static code tables are already populated.
--
-- NOTE: This procedure is meant to be run from the Database Pod, during scheduled nightly
-- replications or on an ad-hoc fashion. It is not part of a pipeline build or deployment.
--
-- USAGE
-- 1. If run from a terminal window on the postgresql pod (the $POSTGRESQL_* environment variables
-- are guaranteed to be set correctly on the pod). For example:
--
-- psql -t -d $POSTGRESQL_DATABASE -U $POSTGRESQL_USER -c 'SELECT db_replicate_step1(_subset_ind=>false);'
-- psql -t -d $POSTGRESQL_DATABASE -U $POSTGRESQL_USER -c 'SELECT db_replicate_step2;'
--
-- 2. If invoked remotely from a developer workstation, on the postgresql pod (the quotes and double-quotes
-- are required, and the pod name will vary with each deployment. For example:
--
-- oc exec postgresql-80-04n7h -- /bin/bash -c 'psql -t -d $POSTGRESQL_DATABASE -U $POSTGRESQL_USER -c "SELECT db_replicate_step1(_subset_ind=>false);"'
-- oc exec postgresql-80-04n7h -- /bin/bash -c 'psql -t -d $POSTGRESQL_DATABASE -U $POSTGRESQL_USER -c "SELECT db_replicate_step2"'
--
--
-- 3. If run on the local environment of a developer workstation, replace the password and username with the
-- local credentials, or ensure that the $POSTGRESQL_* environment variables are set correctly to point
-- to the local database. For example:
--
-- psql -d $POSTGRESQL_DATABASE -U $POSTGRESQL_USER -c 'SELECT db_replicate_step1(_subset_ind=>true);'
-- psql -d $POSTGRESQL_DATABASE -U $POSTGRESQL_USER -c 'SELECT db_replicate_step2;'
--
CREATE OR REPLACE FUNCTION db_replicate_step1(_subset_ind boolean default true) RETURNS void AS $$
BEGIN
raise notice 'Replicating WELLS to GWELLS.';
raise notice '.. step 1 (of 2)';
PERFORM populate_xform(_subset_ind);
TRUNCATE TABLE bcgs_number CASCADE;
PERFORM migrate_bcgs();
TRUNCATE TABLE well CASCADE;
PERFORM populate_well();
PERFORM migrate_screens();
PERFORM migrate_production();
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION db_replicate_step1 (boolean) IS 'SQL Driver script to run replication, without code table refresh (step 1).';
CREATE OR REPLACE FUNCTION db_replicate_step2 () RETURNS void AS $$
BEGIN
raise notice 'Replicating WELLS to GWELLS.';
raise notice '.. step 2 (of 2)';
PERFORM migrate_casings();
PERFORM migrate_perforations();
PERFORM migrate_aquifers();
PERFORM migrate_lithology();
DROP TABLE IF EXISTS xform_well;
raise notice 'Finished replicating WELLS to GWELLS.';
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION db_replicate_step2 () IS 'SQL Driver script to run replication, without code table refresh (step 2).';
| 42.411197 | 155 | 0.584414 |
0b39211e58c62524837539f8c02eb738f733141e
| 1,037 |
py
|
Python
|
GraphSAGE/fix.py
|
attre2vec/attre2vec
|
f36a2581f3d17887d6201a76624d4ced93d6503f
|
[
"MIT"
] | null | null | null |
GraphSAGE/fix.py
|
attre2vec/attre2vec
|
f36a2581f3d17887d6201a76624d4ced93d6503f
|
[
"MIT"
] | null | null | null |
GraphSAGE/fix.py
|
attre2vec/attre2vec
|
f36a2581f3d17887d6201a76624d4ced93d6503f
|
[
"MIT"
] | null | null | null |
import pickle
import networkx as nx
import numpy as np
import torch
for name in ('cora', 'citeseer', 'pubmed'):
with open(f'data/datasets/{name}.pkl', 'rb') as fin:
dataset = pickle.load(fin)
test_graph = dataset['original_graph']
e2i = dataset['edge2idx']
H = dataset['H']
node_fts = torch.zeros((test_graph.number_of_nodes(), 128))
for u, v in test_graph.edges():
ef = H[e2i[(u, v)]][3:-1]
node_fts[u] = ef[:128]
node_fts[v] = ef[128:]
train_nodes = []
for idx in range(dataset['num_datasets']):
tn = []
for u, v in dataset['Xy'][idx]['train']['X']:
if u not in tn:
tn.append(u)
if v not in tn:
tn.append(v)
train_nodes.append(tn)
nx.write_edgelist(test_graph, f'GraphSAGE/data/{name}.edgelist')
np.save(f'GraphSAGE/data/{name}-node-features', node_fts.numpy())
with open(f'GraphSAGE/data/{name}-train-nodes.pkl', 'wb') as fout:
pickle.dump(train_nodes, fout)
| 25.925 | 70 | 0.580521 |
041e19937a9136afc7671e70c9fc294e7170fc96
| 494 |
js
|
JavaScript
|
build/build-static.js
|
6thquake/taro-material
|
cca464154b056c7b3c8077002f9f9ced28a9ce31
|
[
"MIT"
] | 3 |
2019-03-15T09:53:35.000Z
|
2019-07-01T05:48:59.000Z
|
build/build-static.js
|
6thquake/taro-material
|
cca464154b056c7b3c8077002f9f9ced28a9ce31
|
[
"MIT"
] | null | null | null |
build/build-static.js
|
6thquake/taro-material
|
cca464154b056c7b3c8077002f9f9ced28a9ce31
|
[
"MIT"
] | 1 |
2022-01-12T06:17:24.000Z
|
2022-01-12T06:17:24.000Z
|
const ora = require('ora');
const fs = require('fs-extra');
const path = require('path');
const spinner = ora('copy h5 website to docs...');
spinner.start();
fs.emptyDirSync(path.resolve(__dirname, '../docs/h5'));
fs.copy(path.resolve(__dirname, '../dist'), path.resolve(__dirname, '../docs/h5'))
.then(() => {
spinner.stop();
})
.catch(err => console.error(err));
fs.copy(
path.resolve(__dirname, '../packages/taro-material/dist'),
path.resolve(__dirname, '../docs/h5'),
);
| 23.52381 | 82 | 0.637652 |
24ec54ed61287384aa5dfd670d77e1d7c9c600c7
| 1,333 |
swift
|
Swift
|
Quotes/Shared/Network/APIService.swift
|
SumitKr88/NetworkSample-SwiftUI-Combine
|
0f894716475cbf076806823f61e763576ea633b0
|
[
"MIT"
] | null | null | null |
Quotes/Shared/Network/APIService.swift
|
SumitKr88/NetworkSample-SwiftUI-Combine
|
0f894716475cbf076806823f61e763576ea633b0
|
[
"MIT"
] | null | null | null |
Quotes/Shared/Network/APIService.swift
|
SumitKr88/NetworkSample-SwiftUI-Combine
|
0f894716475cbf076806823f61e763576ea633b0
|
[
"MIT"
] | null | null | null |
//
// APIService.swift
// YoutubeRelica
//
// Created by Sumit Kumar on 06/02/22.
//
import Foundation
import Combine
protocol APIProtocol {
func publisher(for request: APIRequestBuilder) -> AnyPublisher<Data, APIError>
func publisher<T: Decodable>(for request: APIRequestBuilder,
decoder: JSONDecoder) -> AnyPublisher<T, APIError>
}
struct APIService: APIProtocol {
func publisher(for request: APIRequestBuilder) -> AnyPublisher<Data, APIError> {
URLSession.shared.dataTaskPublisher(for: request.urlRequest())
.subscribe(on: DispatchQueue.global(qos: .userInitiated))
.receive(on: DispatchQueue.main)
.mapError(APIError.network)
.map(\.data)
.eraseToAnyPublisher()
}
func publisher<T>(for request: APIRequestBuilder, decoder: JSONDecoder = JSONDecoder()) -> AnyPublisher<T, APIError> where T : Decodable {
URLSession.shared.dataTaskPublisher(for: request.urlRequest())
.subscribe(on: DispatchQueue.global(qos: .userInitiated))
.receive(on: DispatchQueue.main)
.mapError(APIError.network)
.map(\.data)
.decode(type: T.self, decoder: decoder)
.mapError(APIError.decoding)
.eraseToAnyPublisher()
}
}
| 32.512195 | 142 | 0.64066 |
5e74a6512a1f04c7a8b61443f26741dad247fa04
| 2,422 |
swift
|
Swift
|
ClearKeep/Modules/Home/Views/CkAvatarTopView.swift
|
telred-llc/clearkeep-ios
|
1d720ea8a0d03f3f2930281bba2e3478750ab11e
|
[
"Apache-2.0"
] | 1 |
2019-12-18T05:11:09.000Z
|
2019-12-18T05:11:09.000Z
|
ClearKeep/Modules/Home/Views/CkAvatarTopView.swift
|
mohsinalimat/clearkeep-ios
|
de52d19939effe7f4488e4db7efe809dc45e0770
|
[
"Apache-2.0"
] | null | null | null |
ClearKeep/Modules/Home/Views/CkAvatarTopView.swift
|
mohsinalimat/clearkeep-ios
|
de52d19939effe7f4488e4db7efe809dc45e0770
|
[
"Apache-2.0"
] | 1 |
2019-12-18T05:11:10.000Z
|
2019-12-18T05:11:10.000Z
|
//
// CkAvatarTopView.swift
// Riot
//
// Created by Hiếu Nguyễn on 12/29/18.
// Copyright © 2018 matrix.org. All rights reserved.
//
import UIKit
class CkAvatarTopView: MXKView {
@IBOutlet weak var imgAvatar: MXKImageView!
@IBOutlet weak var imgStatus: UIView!
class func instance() -> CkAvatarTopView? {
return UINib.init(
nibName: "CkAvatarTopView",
bundle: nil).instantiate(
withOwner: nil,
options: nil).first as? CkAvatarTopView
}
override func awakeFromNib() {
imgAvatar.layer.cornerRadius = (self.imgAvatar.bounds.width) / 2
imgAvatar.clipsToBounds = true
imgAvatar.autoresizingMask = [.flexibleWidth, .flexibleHeight, .flexibleBottomMargin, .flexibleRightMargin, .flexibleLeftMargin, .flexibleTopMargin]
imgAvatar.contentMode = UIView.ContentMode.scaleAspectFill
imgStatus.layer.cornerRadius = (self.imgStatus.bounds.width) / 2
imgStatus.layer.borderWidth = 1
imgStatus.layer.borderColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
}
func setAvatarImageUrl(urlString: String!, previewImage: UIImage?) {
imgAvatar.enableInMemoryCache = true
imgAvatar.setImageURI(
urlString,
withType: nil,
andImageOrientation: UIImageOrientation.up,
previewImage: previewImage,
mediaManager: nil)
}
func setAvatarUri(_ uri: String!, userId: String, session: MXSession!) {
let previewImage = AvatarGenerator.generateAvatar(forText: userId)
imgAvatar.enableInMemoryCache = true
imgAvatar.setImageURI(uri,
withType: nil,
andImageOrientation: UIImageOrientation.up,
toFitViewSize: imgAvatar.frame.size,
with: MXThumbnailingMethodCrop,
previewImage: previewImage,
mediaManager: session.mediaManager)
}
func setImage(image: UIImage?) {
imgAvatar.image = image
}
func setStatus(online: Bool) {
if online == true {
imgStatus.backgroundColor = CKColor.Misc.primaryGreenColor
} else {
imgStatus.backgroundColor = #colorLiteral(red: 0.501960814, green: 0.501960814, blue: 0.501960814, alpha: 1)
}
}
}
| 34.112676 | 156 | 0.618497 |
ddb8e2d17d8c58ead390a1a7f93ff15be8d0cbf1
| 474 |
go
|
Go
|
slide.go
|
emicklei/audiovisio
|
ad1f2ad35df6fce4274c18bd584224b89a0dccf1
|
[
"MIT"
] | null | null | null |
slide.go
|
emicklei/audiovisio
|
ad1f2ad35df6fce4274c18bd584224b89a0dccf1
|
[
"MIT"
] | null | null | null |
slide.go
|
emicklei/audiovisio
|
ad1f2ad35df6fce4274c18bd584224b89a0dccf1
|
[
"MIT"
] | null | null | null |
package audiovisio
type Slide struct {
ID string `yaml:"id"`
Title string `yaml:"title"`
Image string `yaml:"image"`
Sound string `yaml:"sound"`
PauseBeforeAudio int `yaml:"pause-before-audio"`
PauseAfterAudio int `yaml:"pause-after-audio"`
NextID string `yaml:"next"`
}
func (s Slide) withPauses(before, after int) Slide {
if s.PauseBeforeAudio == 0 {
s.PauseBeforeAudio = before
}
if s.PauseAfterAudio == 0 {
s.PauseAfterAudio = after
}
return s
}
| 19.75 | 52 | 0.698312 |
6b4244e507218150c003a95bd4e5d185980977dd
| 13,910 |
c
|
C
|
asp/tinet/asp_sample/echos6.c
|
h7ga40/gr_citrus
|
07d450b9cc857997c97519e962572b92501282d6
|
[
"MIT"
] | null | null | null |
asp/tinet/asp_sample/echos6.c
|
h7ga40/gr_citrus
|
07d450b9cc857997c97519e962572b92501282d6
|
[
"MIT"
] | null | null | null |
asp/tinet/asp_sample/echos6.c
|
h7ga40/gr_citrus
|
07d450b9cc857997c97519e962572b92501282d6
|
[
"MIT"
] | null | null | null |
/*
* TINET (TCP/IP Protocol Stack)
*
* Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
* Tomakomai National College of Technology, JAPAN
*
* 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
* によって公表されている GNU General Public License の Version 2 に記
* 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
* を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
* 利用と呼ぶ)することを無償で許諾する.
* (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
* 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
* スコード中に含まれていること.
* (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
* 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
* 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
* の無保証規定を掲載すること.
* (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
* 用できない形で再配布する場合には,次の条件を満たすこと.
* (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
* 作権表示,この利用条件および下記の無保証規定を掲載すること.
* (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
* 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
*
* 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
* よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
* 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
* 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
*
* @(#) $Id$
*/
/*
* IPv6、TCP ECHO サーバ、送受信タスク同一型
*/
#include <string.h>
#include <kernel.h>
#include <t_syslog.h>
#include "kernel_cfg.h"
#include "tinet_cfg.h"
#include <netinet/in.h>
#include <netinet/in_itron.h>
#include <netinet/tcp.h>
#include "echos6.h"
/*
* 外部関数の定義
*/
extern const char *itron_strerror (ER ercd);
/*
* 注意:
*
* BUF_SIZE は TCP の
* 送信ウインドウバッファサイズ + 受信ウインドウバッファサイズの
* 3/2 倍以上の大きさがなければ、デッドロックする可能性がある。
*/
#define BUF_SIZE ((TCP_ECHO_SRV_SWBUF_SIZE + \
TCP_ECHO_SRV_RWBUF_SIZE) * 3 / 2)
static T_IPV6EP dst;
#ifdef USE_TCP_NON_BLOCKING
static ER nblk_error = E_OK;
static ER_UINT nblk_slen = 0;
static ER_UINT nblk_rlen = 0;
#endif /* of #ifdef USE_TCP_NON_BLOCKING */
#ifndef USE_COPYSAVE_API
static uint8_t buffer[BUF_SIZE];
#endif /* of #ifndef USE_COPYSAVE_API */
/*
* TCP 送受信バッファ
*/
uint8_t tcp_echo_srv_swbuf[TCP_ECHO_SRV_SWBUF_SIZE];
uint8_t tcp_echo_srv_rwbuf[TCP_ECHO_SRV_RWBUF_SIZE];
#ifdef USE_TCP_NON_BLOCKING
/*
* ノンブロッキングコールのコールバック関数
*/
ER
callback_nblk_tcp_echo_srv (ID cepid, FN fncd, void *p_parblk)
{
ER error = E_OK;
switch (fncd) {
case TFN_TCP_ACP_CEP:
nblk_error = *(ER*)p_parblk;
syscall(sig_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
break;
case TFN_TCP_RCV_DAT:
if ((nblk_rlen = *(ER_UINT*)p_parblk) < 0)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) CBN] recv err: %s", itron_strerror(nblk_rlen));
syscall(sig_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
break;
case TFN_TCP_SND_DAT:
if ((nblk_slen = *(ER_UINT*)p_parblk) < 0)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) CBN] send err: %s", itron_strerror(nblk_slen));
syscall(sig_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
break;
case TFN_TCP_CLS_CEP:
if ((nblk_error = *(ER*)p_parblk) < 0)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) CBN] clse err: %s", itron_strerror(nblk_error));
syscall(sig_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
break;
case TFN_TCP_RCV_BUF:
if ((nblk_rlen = *(ER_UINT*)p_parblk) < 0)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) CBN] rbuf err: %s", itron_strerror(nblk_rlen));
syscall(sig_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
break;
case TFN_TCP_GET_BUF:
if ((nblk_slen = *(ER_UINT*)p_parblk) < 0)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) CBN] sbuf err: %s", itron_strerror(nblk_slen));
syscall(sig_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
break;
case TFN_TCP_CON_CEP:
case TFN_TCP_SND_OOB:
default:
error = E_PAR;
break;
}
return error;
}
#ifdef USE_COPYSAVE_API
void
tcp_echo_srv_task(intptr_t exinf)
{
ID tskid;
ER error = E_OK;
uint32_t total;
uint16_t rblen, sblen, rlen, slen, soff, count;
char *rbuf, *sbuf;
get_tid(&tskid);
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK):%d,%d] (copy save API) started.", tskid, (int_t)exinf);
while (true) {
if ((error = tcp6_acp_cep((int_t)exinf, TCP_ECHO_SRV_REPID, &dst, TMO_NBLK)) != E_WBLK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) ACP] error: %s", itron_strerror(error));
continue;
}
/* 相手から接続されるまで待つ。*/
syscall(wai_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
if (nblk_error == E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) ACP] connected from %s:%d", ipv62str(NULL, &dst.ipaddr), dst.portno);
else {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) ACP] error: %s", itron_strerror(nblk_error));
continue;
}
total = rlen = count = 0;
while (true) {
if ((error = tcp_rcv_buf((int_t)exinf, (void **)&rbuf, TMO_NBLK)) != E_WBLK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) RCV] error: %s", itron_strerror(error));
break;
}
/* 受信するまで待つ。*/
syscall(wai_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
if (nblk_rlen < 0) { /* エラー */
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) RCV] error: %s", itron_strerror(nblk_rlen));
break;
}
else if (nblk_rlen == 0) /* 受信終了 */
break;
rblen = (uint16_t)nblk_rlen;
/* バッファの残りにより、受信長を調整する。*/
if (rblen > BUF_SIZE - rlen)
rblen = BUF_SIZE - rlen;
total += rblen;
rlen = rblen;
count ++;
memcpy(buffer, rbuf, rblen);
if ((error = tcp_rel_buf((int_t)exinf, rlen)) < 0) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) REL] error: %s",
itron_strerror(error));
break;
}
soff = 0;
while (rlen > 0) {
if ((error = tcp_get_buf((int_t)exinf, (void **)&sbuf, TMO_NBLK)) != E_WBLK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) GET] error: %s",
itron_strerror(error));
goto err_fin;
}
/* 送信バッファの獲得が完了するまで待つ。*/
syscall(wai_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
if (nblk_slen < 0) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) GET] error: %s",
itron_strerror(nblk_slen));
goto err_fin;
}
else
/*syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) GET] len: %d", nblk_slen)*/;
sblen = (uint16_t)nblk_slen;
slen = sblen < rlen ? sblen : rlen;
memcpy(sbuf, buffer + soff, slen);
if ((error = tcp_snd_buf((int_t)exinf, slen)) != E_OK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) SND] error: %s",
itron_strerror(error));
goto err_fin;
}
/*syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) SND] len: %d", slen);*/
rlen -= slen;
soff += slen;
}
}
err_fin:
if ((error = tcp_sht_cep((int_t)exinf)) != E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) SHT] error: %s", itron_strerror(error));
if ((error = tcp_cls_cep((int_t)exinf, TMO_NBLK)) != E_WBLK)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) CLS] error: %s", itron_strerror(error));
/* 開放が完了するまで待つ。*/
syscall(wai_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) FIN] finished, total count: %d, len: %d", count, total);
}
}
#else /* of #ifdef USE_COPYSAVE_API */
void
tcp_echo_srv_task(intptr_t exinf)
{
ID tskid;
ER error;
uint32_t total;
uint16_t rlen, slen, soff, count;
get_tid(&tskid);
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK):%d,%d] started.", tskid, (int_t)exinf);
while (true) {
if ((error = tcp6_acp_cep((int_t)exinf, TCP_ECHO_SRV_REPID, &dst, TMO_NBLK)) != E_WBLK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) ACP] error: %s", itron_strerror(error));
continue;
}
/* 相手から接続されるまで待つ。*/
syscall(wai_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
if (nblk_error == E_OK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) ACP] connected from %s:%d",
ipv62str(NULL, &dst.ipaddr), dst.portno);
}
else {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) ACP] error: %s", itron_strerror(nblk_error));
continue;
}
count = total = 0;
while (true) {
if ((error = tcp_rcv_dat((int_t)exinf, buffer, BUF_SIZE - 1, TMO_NBLK)) != E_WBLK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) RCV] error: %s",
itron_strerror(error));
break;
}
/* 受信完了まで待つ。*/
syscall(wai_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
if (nblk_rlen < 0) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) RCV] error: %s",
itron_strerror(nblk_rlen));
break;
}
else if (nblk_rlen == 0)
break;
rlen = (uint16_t)nblk_rlen;
total += (uint32_t)nblk_rlen;
count ++;
soff = 0;
while (rlen > 0) {
if ((error = tcp_snd_dat((int_t)exinf, &buffer[soff], rlen, TMO_NBLK)) != E_WBLK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) SND] error: %s",
itron_strerror(error));
goto err_fin;
}
/* 送信完了まで待つ。*/
syscall(wai_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
if (nblk_slen < 0) {
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) SND] error: %s",
itron_strerror(nblk_slen));
goto err_fin;
}
else
/*syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) SND] len: %4d", nblk_slen)*/;
slen = (uint16_t)nblk_slen;
rlen -= slen;
soff += slen;
}
}
err_fin:
if ((error = tcp_sht_cep((int_t)exinf)) != E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) SHT] error: %s", itron_strerror(error));
if ((error = tcp_cls_cep((int_t)exinf, TMO_NBLK)) != E_WBLK)
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) CLS] error: %s", itron_strerror(error));
/* 開放が完了するまで待つ。*/
syscall(wai_sem(SEM_TCP_ECHO_SRV_NBLK_READY));
syslog(LOG_NOTICE, "[TCP ECHO SRV (NBLK) FIN] finished, total cnt: %d, len: %d", count, total);
}
}
#endif /* of #ifdef USE_COPYSAVE_API */
#else /* of #ifdef USE_TCP_NON_BLOCKING */
#ifdef USE_COPYSAVE_API
void
tcp_echo_srv_task(intptr_t exinf)
{
ID tskid;
ER_UINT rblen, sblen;
ER error = E_OK;
uint32_t total;
uint16_t rlen, slen, soff, count;
char *rbuf, *sbuf;
get_tid(&tskid);
syslog(LOG_NOTICE, "[TCP ECHO SRV:%d,%d] (copy save API) started.", tskid, (int_t)exinf);
while (true) {
if (tcp6_acp_cep((int_t)exinf, TCP_ECHO_SRV_REPID, &dst, TMO_FEVR) != E_OK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV ACP] error: %s", itron_strerror(error));
continue;
}
total = count = 0;
syslog(LOG_NOTICE, "[TCP ECHO SRV ACP] connected from %s:%d", ipv62str(NULL, &dst.ipaddr), dst.portno);
while (true) {
if ((rblen = tcp_rcv_buf((int_t)exinf, (void **)&rbuf, TMO_FEVR)) <= 0) {
if (rblen != E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV RCV] error: %s", itron_strerror(rblen));
break;
}
rlen = (uint16_t)rblen;
total += (uint32_t)rblen;
count ++;
soff = 0;
while (rlen > 0) {
if ((sblen = tcp_get_buf((int_t)exinf, (void **)&sbuf, TMO_FEVR)) < 0) {
syslog(LOG_NOTICE, "[TCP ECHO SRV GET] error: %s",
itron_strerror(sblen));
goto err_fin;
}
/*syslog(LOG_NOTICE, "[TCP ECHO SRV GET] len: %d", sblen);*/
slen = rlen < (uint16_t)sblen ? rlen : (uint16_t)sblen;
memcpy(sbuf, rbuf + soff, slen);
if ((error = tcp_snd_buf((int_t)exinf, slen)) != E_OK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV SND] error: %s",
itron_strerror(error));
goto err_fin;
}
/*syslog(LOG_NOTICE, "[TCP ECHO SRV SND] len: %d", slen);*/
rlen -= slen;
soff += slen;
}
if ((error = tcp_rel_buf((int_t)exinf, rblen)) < 0) {
syslog(LOG_NOTICE, "[TCP ECHO SRV REL] error: %s", itron_strerror(error));
break;
}
}
err_fin:
if ((error = tcp_sht_cep((int_t)exinf)) != E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV SHT] error: %s", itron_strerror(error));
if ((error = tcp_cls_cep((int_t)exinf, TMO_FEVR)) != E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV CLS] error: %s", itron_strerror(error));
syslog(LOG_NOTICE, "[TCP ECHO SRV FIN] finished, total cnt: %d, len: %d", count, total);
}
}
#else /* of #ifdef USE_COPYSAVE_API */
void
tcp_echo_srv_task(intptr_t exinf)
{
ID tskid;
ER_UINT rlen, slen;
ER error = E_OK;
uint16_t soff, count, total;
get_tid(&tskid);
syslog(LOG_NOTICE, "[TCP ECHO SRV:%d,%d] started.", tskid, (int_t)exinf);
while (true) {
if (tcp6_acp_cep((int_t)exinf, TCP_ECHO_SRV_REPID, &dst, TMO_FEVR) != E_OK) {
syslog(LOG_NOTICE, "[TCP ECHO SRV ACP] error: %s", itron_strerror(error));
continue;
}
total = count = 0;
syslog(LOG_NOTICE, "[TCP ECHO SRV ACP] connected from %s:%d",
ipv62str(NULL, &dst.ipaddr), dst.portno);
while (true) {
if ((rlen = tcp_rcv_dat((int_t)exinf, buffer, BUF_SIZE - 1, TMO_FEVR)) <= 0) {
if (rlen != E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV RCV] error: %s",
itron_strerror(rlen));
break;
}
/*syslog(LOG_NOTICE, "[TCP ECHO SRV RCV] count: %4d, len: %4d, data %02x -> %02x",
++ count, (uint16_t)rlen, *buffer, *(buffer + rlen - 1));*/
count ++;
total += (uint16_t)rlen;
soff = 0;
while (rlen > 0) {
if ((slen = tcp_snd_dat((int_t)exinf, &buffer[soff], rlen, TMO_FEVR)) < 0) {
syslog(LOG_NOTICE, "[TCP ECHO SRV SND] error: %s",
itron_strerror(slen));
goto err_fin;
}
/*syslog(LOG_NOTICE, "[TCP ECHO SRV SND] len: %d", slen);*/
rlen -= slen;
soff += (uint16_t)slen;
}
}
err_fin:
if ((error = tcp_sht_cep((int_t)exinf)) != E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV SHT] error: %s", itron_strerror(error));
if ((error = tcp_cls_cep((int_t)exinf, TMO_FEVR)) != E_OK)
syslog(LOG_NOTICE, "[TCP ECHO SRV CLS] error: %s", itron_strerror(error));
syslog(LOG_NOTICE, "[TCP ECHO SRV FIN] finished, total cnt: %d, len: %d", count, total);
}
}
#endif /* of #ifdef USE_COPYSAVE_API */
#endif /* of #ifdef USE_TCP_NON_BLOCKING */
| 28.504098 | 114 | 0.609777 |
cb8b3d39476b988461cc3bd81b209d2441d29158
| 2,859 |
go
|
Go
|
cmd/gopmctl/main.go
|
brettbuddin/gopm
|
c1f851755872a27f9f7e2f6a1ff8664b6198506d
|
[
"MIT"
] | null | null | null |
cmd/gopmctl/main.go
|
brettbuddin/gopm
|
c1f851755872a27f9f7e2f6a1ff8664b6198506d
|
[
"MIT"
] | null | null | null |
cmd/gopmctl/main.go
|
brettbuddin/gopm
|
c1f851755872a27f9f7e2f6a1ff8664b6198506d
|
[
"MIT"
] | null | null | null |
package main
import (
"fmt"
"os"
"strings"
"text/tabwriter"
"github.com/logrusorgru/aurora"
"github.com/spf13/cobra"
"github.com/stuartcarnie/gopm/config"
"github.com/stuartcarnie/gopm/rpc"
"google.golang.org/grpc"
)
type Control struct {
Configuration string
Address string
client rpc.GopmClient
}
var (
control = &Control{}
rootCmd = cobra.Command{
Use: "gopmctl",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return control.initializeClient()
},
}
)
func init() {
rootCmd.PersistentFlags().StringVarP(&control.Configuration, "config", "c", "", "Configuration file")
rootCmd.PersistentFlags().StringVar(&control.Address, "addr", "localhost:9002", "gopm server address")
rootCmd.AddCommand(&statusCmd)
rootCmd.AddCommand(&tailLogCmd)
rootCmd.AddCommand(&signalCmd)
rootCmd.AddCommand(&startCmd)
rootCmd.AddCommand(&stopCmd)
rootCmd.AddCommand(&reloadCmd)
rootCmd.AddCommand(&shutdownCmd)
rootCmd.AddCommand(&stopAllCmd)
rootCmd.AddCommand(&startAllCmd)
}
func main() {
if err := rootCmd.Execute(); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func (ctl *Control) initializeClient() error {
gc, err := grpc.Dial(ctl.getServerURL(), grpc.WithInsecure())
if err != nil {
return err
}
control.client = rpc.NewGopmClient(gc)
return nil
}
func (ctl *Control) getServerURL() string {
if ctl.Address != "" {
return ctl.Address
} else if _, err := os.Stat(ctl.Configuration); err == nil {
cfg := config.NewConfig()
_, _ = cfg.LoadPath(ctl.Configuration)
if cfg.GrpcServer != nil && cfg.GrpcServer.Address != "" {
return cfg.GrpcServer.Address
}
}
return "localhost:9002"
}
// other commands
func (ctl *Control) printProcessInfo(res *rpc.ProcessInfoResponse, processes map[string]bool) {
tw := tabwriter.NewWriter(os.Stdout, 20, 4, 5, ' ', 0)
state := func(s string) aurora.Value {
switch strings.ToUpper(s) {
case "RUNNING":
return aurora.Green(s)
case "BACKOFF", "FATAL":
return aurora.Red(s)
default:
return aurora.Yellow(s)
}
}
for _, pinfo := range res.Processes {
if ctl.inProcessMap(pinfo, processes) {
processName := pinfo.GetFullName()
_, _ = fmt.Fprintln(tw, strings.Join([]string{processName, state(pinfo.StateName).String(), pinfo.Description}, "\t"))
}
}
tw.Flush()
}
func (ctl *Control) inProcessMap(procInfo *rpc.ProcessInfo, processesMap map[string]bool) bool {
if len(processesMap) <= 0 {
return true
}
for procName := range processesMap {
if procName == procInfo.Name || procName == procInfo.GetFullName() {
return true
}
// check the wildcard '*'
pos := strings.Index(procName, ":")
if pos != -1 {
groupName := procName[0:pos]
programName := procName[pos+1:]
if programName == "*" && groupName == procInfo.Group {
return true
}
}
}
return false
}
| 23.056452 | 121 | 0.684855 |
adf4ad36ddafe7f08ece0e19b69af2bf4eb2694b
| 6,596 |
rs
|
Rust
|
src/render/renderer.rs
|
Akulen/wlroots-rs
|
820cab0fcef4e354b817f9bbf8b005922d6bea7d
|
[
"MIT"
] | null | null | null |
src/render/renderer.rs
|
Akulen/wlroots-rs
|
820cab0fcef4e354b817f9bbf8b005922d6bea7d
|
[
"MIT"
] | null | null | null |
src/render/renderer.rs
|
Akulen/wlroots-rs
|
820cab0fcef4e354b817f9bbf8b005922d6bea7d
|
[
"MIT"
] | null | null | null |
//! TODO Documentation
use std::time::Duration;
use libc::{c_float, c_int, c_void};
use {Area, Output, PixmanRegion};
use render::Texture;
use wlroots_sys::{wl_shm_format, wlr_backend, wlr_backend_get_egl, wlr_render_ellipse_with_matrix,
wlr_render_quad_with_matrix, wlr_render_rect, wlr_render_texture,
wlr_render_texture_with_matrix, wlr_renderer, wlr_renderer_begin,
wlr_renderer_clear, wlr_renderer_destroy, wlr_renderer_end,
wlr_texture_from_pixels, wlr_gles2_renderer_create};
/// A generic interface for rendering to the screen.
///
/// Note that it will technically be possible to have multiple renderers
/// at the same time.
#[derive(Debug)]
pub struct GenericRenderer {
renderer: *mut wlr_renderer
}
/// The state machine type that allows you to manipulate a screen and
/// its buffer.
///
/// When this structure is dropped it automatically calls wlr_renderer_end
/// and swaps the buffers.
#[derive(Debug)]
pub struct Renderer<'output> {
renderer: *mut wlr_renderer,
pub damage: Option<(PixmanRegion, Duration)>,
pub output: &'output mut Output
}
impl GenericRenderer {
/// Make a gles2 renderer.
pub(crate) unsafe fn gles2_renderer(backend: *mut wlr_backend) -> Self {
let egl = wlr_backend_get_egl(backend);
if egl.is_null() {
panic!("EGL not available for this backend");
}
let renderer = wlr_gles2_renderer_create(egl);
if renderer.is_null() {
panic!("Could not construct GLES2 renderer");
}
GenericRenderer { renderer }
}
/// Make the `Renderer` state machine type.
///
/// This automatically makes the given output the current output.
pub fn render<'output, T: Into<Option<(PixmanRegion, Duration)>>>
(&mut self,
output: &'output mut Output,
damage: T)
-> Renderer<'output> {
unsafe {
output.make_current();
let (width, height) = output.size();
wlr_renderer_begin(self.renderer, width, height);
Renderer { renderer: self.renderer,
damage: damage.into(),
output }
}
}
/// Create a texture using this renderer.
pub fn create_texture_from_pixels(&mut self,
format: wl_shm_format,
stride: u32,
width: u32,
height: u32,
data: &[u8])
-> Option<Texture> {
unsafe {
create_texture_from_pixels(self.renderer,
format,
stride,
width,
height,
data.as_ptr() as _)
}
}
pub(crate) unsafe fn as_ptr(&self) -> *mut wlr_renderer {
self.renderer
}
}
impl Drop for GenericRenderer {
fn drop(&mut self) {
unsafe { wlr_renderer_destroy(self.renderer) }
}
}
impl<'output> Renderer<'output> {
pub fn clear(&mut self, float: [f32; 4]) {
unsafe { wlr_renderer_clear(self.renderer, float.as_ptr()) }
}
/// Renders the requseted texture.
pub fn render_texture(&mut self,
texture: &Texture,
projection: [f32; 9],
x: c_int,
y: c_int,
alpha: c_float)
-> bool {
unsafe {
wlr_render_texture(self.renderer,
texture.as_ptr(),
projection.as_ptr(),
x,
y,
alpha)
}
}
/// Renders the requested texture using the provided matrix. A typical texture
/// rendering goes like so:
///
/// TODO FIXME Show how the typical rendering goes in Rust.
///
/// ```c
/// struct wlr_renderer *renderer;
/// struct wlr_texture *texture;
/// float projection[16];
/// float matrix[16];
/// wlr_texture_get_matrix(texture, &matrix, &projection, 123, 321);
/// wlr_render_texture_with_matrix(renderer, texture, &matrix);
/// ```
///
/// This will render the texture at <123, 321>.
pub fn render_texture_with_matrix(&mut self, texture: &Texture, matrix: [f32; 9]) -> bool {
// TODO FIXME Add alpha as param
unsafe {
wlr_render_texture_with_matrix(self.renderer, texture.as_ptr(), matrix.as_ptr(), 1.0)
}
}
/// Renders a solid quad in the specified color.
pub fn render_colored_quad(&mut self, color: [f32; 4], matrix: [f32; 9]) {
unsafe { wlr_render_quad_with_matrix(self.renderer, color.as_ptr(), matrix.as_ptr()) }
}
/// Renders a solid ellipse in the specified color.
pub fn render_colored_ellipse(&mut self, color: [f32; 4], matrix: [f32; 9]) {
unsafe { wlr_render_ellipse_with_matrix(self.renderer, color.as_ptr(), matrix.as_ptr()) }
}
/// Renders a solid rectangle in the specified color.
pub fn render_colored_rect(&mut self, area: Area, color: [f32; 4], matrix: [f32; 9]) {
unsafe { wlr_render_rect(self.renderer, &area.into(), color.as_ptr(), matrix.as_ptr()) }
}
}
impl<'output> Drop for Renderer<'output> {
fn drop(&mut self) {
unsafe {
wlr_renderer_end(self.renderer);
if let Some((mut damage, when)) = self.damage.take() {
self.output.swap_buffers(Some(when), Some(&mut damage));
} else {
self.output.swap_buffers(None, None);
}
}
}
}
unsafe fn create_texture_from_pixels(renderer: *mut wlr_renderer,
format: wl_shm_format,
stride: u32,
width: u32,
height: u32,
// TODO Slice of u8? It's a void*, hmm
data: *const c_void)
-> Option<Texture> {
let texture = wlr_texture_from_pixels(renderer, format, stride, width, height, data);
if texture.is_null() {
None
} else {
Some(Texture::from_ptr(texture))
}
}
| 35.462366 | 98 | 0.532292 |
0bcfb65f371793f7e6f494b825fee38b4329d334
| 7,098 |
js
|
JavaScript
|
src/parser.js
|
dragonhailstone/m42kup
|
d5561945a31c995e8b19d9c75ae2591ec3206bb9
|
[
"MIT"
] | null | null | null |
src/parser.js
|
dragonhailstone/m42kup
|
d5561945a31c995e8b19d9c75ae2591ec3206bb9
|
[
"MIT"
] | null | null | null |
src/parser.js
|
dragonhailstone/m42kup
|
d5561945a31c995e8b19d9c75ae2591ec3206bb9
|
[
"MIT"
] | null | null | null |
function input2pt(input) {
var levels = [],
stack = [];
function push(fragment) {
// normalize text
if (fragment.type == 'text'
&& stack.length
&& stack[stack.length - 1].type == 'text') {
var prepend = stack.pop();
fragment = {
type: 'text',
start: prepend.start,
end: fragment.end,
data: prepend.data + fragment.data
};
}
if (fragment.type == 'right boundary marker') {
var buf = [fragment], tmp;
while (true) {
tmp = stack.pop();
if (!tmp) throw new Error('No lbm found');
buf.unshift(tmp);
if (tmp.type == 'left boundary marker' && tmp.level == fragment.level) break;
}
var elementStart = buf[0].start,
elementEnd = buf[buf.length - 1].end;
fragment = {
type: 'element',
start: elementStart,
end: elementEnd,
data: input.substring(elementStart, elementEnd),
children: buf
};
}
if (fragment.type == 'right verbatim marker') {
var buf = [fragment], tmp;
while (true) {
tmp = stack.pop();
if (!tmp) throw new Error('No lvm found');
buf.unshift(tmp);
if (tmp.type == 'left verbatim marker' && tmp.level == fragment.level) break;
}
var verbatimStart = buf[0].start,
verbatimEnd = buf[buf.length - 1].end;
fragment = {
type: 'verbatim',
start: verbatimStart,
end: verbatimEnd,
data: input.substring(verbatimStart, verbatimEnd),
children: buf
};
}
stack.push(fragment);
}
// main loop
for (var cur = 0; cur < input.length;) {
if (input[cur] == '`') {
var lvmStart = cur;
for (cur++; cur < input.length; cur++) {
if (input[cur] != '<') break;
}
var lvmLevel = cur - lvmStart;
if (cur < input.length - 1
&& input[cur] == '.'
&& input[cur + 1] == '<') {
cur++;
}
var lvmEnd = cur;
push({
type: 'left verbatim marker',
start: lvmStart,
end: lvmEnd,
data: input.substring(lvmStart, lvmEnd),
level: lvmLevel
});
levels.push(-lvmLevel);
var rvmString = '>'.repeat(lvmLevel - 1) + '`';
var rvmIndex = input.indexOf(rvmString, cur);
var rvmFound = rvmIndex >= 0, rvmStart, rvmEnd;
if (rvmFound)
[rvmStart, rvmEnd] = [rvmIndex, rvmIndex + rvmString.length];
cur = rvmFound ? rvmEnd : input.length;
var textStart = lvmEnd,
textEnd = rvmFound ? rvmStart : cur;
push({
type: 'text',
start: textStart,
end: textEnd,
data: input.substring(textStart, textEnd)
});
if (rvmFound) {
push({
type: 'right verbatim marker',
start: rvmStart,
end: rvmEnd,
data: input.substring(rvmStart, rvmEnd),
level: rvmEnd - rvmStart
});
levels.pop();
}
} else if (input[cur] == '[') {
var lbmStart = cur;
for (cur++; cur < input.length; cur++) {
if (input[cur] != '<') break;
}
var lbmEnd = cur;
var currentLevel = levels[levels.length - 1] || 0;
if (lbmEnd - lbmStart < currentLevel) {
push({
type: 'text',
start: lbmStart,
end: lbmEnd,
data: input.substring(lbmStart, lbmEnd)
});
continue;
}
levels.push(lbmEnd - lbmStart);
push({
type: 'left boundary marker',
start: lbmStart,
end: lbmEnd,
data: input.substring(lbmStart, lbmEnd),
level: lbmEnd - lbmStart
});
// excludes: '(', '.', ':', '[', ']', '<', '`'
// this regex always matches something
var tagNameRegex = /^(?:(?:\*{1,3}|={1,6}|\${1,2}|;{1,3}|[!"#$%&')*+,\-\/;=>?@\\^_{|}~]|[a-z][a-z0-9]*)|)/i,
tagNameStart = cur,
tagNameEnd = tagNameStart + input.substring(tagNameStart)
.match(tagNameRegex)[0].length;
push({
type: 'tag name',
start: tagNameStart,
end: tagNameEnd,
data: input.substring(tagNameStart, tagNameEnd)
});
cur = tagNameEnd;
var separatorRegex = /^(?:[.]|)/i,
separatorStart = cur,
separatorEnd = separatorStart
+ input.substring(separatorStart)
.match(separatorRegex)[0].length;
push({
type: 'separator',
start: separatorStart,
end: separatorEnd,
data: input.substring(separatorStart, separatorEnd)
});
cur = separatorEnd;
} else if (input[cur] == '>' || input[cur] == ']') {
var currentLevel = levels[levels.length - 1] || 0;
var gtStart = cur;
for (; cur < input.length; cur++) {
if (input[cur] != '>') break;
}
var gtEnd = cur;
// >>... does not end with a ]
if (gtEnd == input.length || input[gtEnd] != ']') {
push({
type: 'text',
start: gtStart,
end: gtEnd,
data: input.substring(gtStart, gtEnd)
});
continue;
}
// invalid ]
if (currentLevel == 0) {
if (gtStart < gtEnd)
push({
type: 'text',
start: gtStart,
end: gtEnd,
data: input.substring(gtStart, gtEnd)
});
var mrbmStart = cur;
var mrbmEnd = ++cur;
push({
type: 'mismatched right boundary marker',
start: mrbmStart,
end: mrbmEnd,
data: input.substring(mrbmStart, mrbmEnd)
});
continue;
}
cur++;
// not enough level
if (cur - gtStart < currentLevel) {
push({
type: 'text',
start: gtStart,
end: cur,
data: input.substring(gtStart, cur)
});
continue;
}
// too much >
if (cur - gtStart > currentLevel) {
push({
type: 'text',
start: gtStart,
end: cur - currentLevel,
data: input.substring(gtStart, cur - currentLevel)
});
}
var rbmStart = cur - currentLevel,
rbmEnd = cur;
push({
type: 'right boundary marker',
start: rbmStart,
end: rbmEnd,
data: input.substring(rbmStart, rbmEnd),
level: rbmEnd - rbmStart
});
levels.pop();
} else /* none of '[', ']', '`', '>' */ {
// reduce text normalization overhead
var textStart = cur;
for (cur++; cur < input.length; cur++) {
if (['[', ']', '`', '>'].includes(input[cur])) break;
}
var textEnd = cur;
push({
type: 'text',
start: textStart,
end: textEnd,
data: input.substring(textStart, textEnd)
});
}
}
// close the unclosed
for (var i = levels.length - 1; i >= 0; i--) {
var type = levels[i] > 0
? 'right boundary marker'
: 'right verbatim marker';
var absLevel = levels[i] > 0
? levels[i] : -levels[i];
push({
type: type,
start: input.length,
end: input.length,
data: '',
level: absLevel
});
}
return stack;
}
function pt2ast(pt) {
function recurse(pt) {
var ast = pt.map(e => {
switch (e.type) {
case 'text':
return {
type: 'text',
text: e.data
};
case 'verbatim':
return {
type: 'text',
text: e.children[1].data
};
case 'element':
return {
type: 'element',
name: e.children[1].data,
code: e.data,
children: recurse(e.children.slice(3, -1))
};
case 'mismatched right boundary marker':
return {
type: 'error',
text: e.data
};
default:
throw new TypeError(`Unknown type: ${e.type}`);
}
});
return ast;
};
return recurse(pt);
}
module.exports = {
input2pt,
pt2ast
};
| 21.251497 | 111 | 0.554945 |
1169a25bc573d99ea6608a9d343386656f55b5fb
| 5,428 |
rs
|
Rust
|
src/matching.rs
|
Finnerale/druid-enum-switcher
|
8390a872272b421ad299043a784e36c52742151d
|
[
"MIT"
] | null | null | null |
src/matching.rs
|
Finnerale/druid-enum-switcher
|
8390a872272b421ad299043a784e36c52742151d
|
[
"MIT"
] | null | null | null |
src/matching.rs
|
Finnerale/druid-enum-switcher
|
8390a872272b421ad299043a784e36c52742151d
|
[
"MIT"
] | 1 |
2020-03-25T11:42:34.000Z
|
2020-03-25T11:42:34.000Z
|
use crate::test_enum::TestEnum;
use druid::{widget::prelude::*, WidgetPod};
pub struct TestEnumMatcher {
content_first: Option<WidgetPod<f64, Box<dyn Widget<f64>>>>,
first_added: bool,
content_second: Option<WidgetPod<f64, Box<dyn Widget<f64>>>>,
second_added: bool,
content_third: Option<WidgetPod<u64, Box<dyn Widget<u64>>>>,
third_added: bool,
}
impl TestEnumMatcher {
pub fn new() -> Self {
TestEnumMatcher {
content_first: None,
first_added: false,
content_second: None,
second_added: false,
content_third: None,
third_added: false,
}
}
pub fn match_first(mut self, content_first: impl Widget<f64> + 'static) -> Self {
self.content_first = Some(WidgetPod::new(Box::new(content_first)));
self
}
pub fn match_second(mut self, content_second: impl Widget<f64> + 'static) -> Self {
self.content_second = Some(WidgetPod::new(Box::new(content_second)));
self
}
pub fn match_third(mut self, content_third: impl Widget<u64> + 'static) -> Self {
self.content_third = Some(WidgetPod::new(Box::new(content_third)));
self
}
}
impl Widget<TestEnum> for TestEnumMatcher {
fn event(&mut self, ctx: &mut EventCtx, event: &Event, data: &mut TestEnum, env: &Env) {
match data {
TestEnum::First(value) => {
if let Some(content) = &mut self.content_first {
content.event(ctx, event, value, env);
}
}
TestEnum::Second(value) => {
if let Some(content) = &mut self.content_second {
content.event(ctx, event, value, env);
}
}
TestEnum::Third(value) => {
if let Some(content) = &mut self.content_third {
content.event(ctx, event, value, env);
}
}
}
}
fn lifecycle(&mut self, ctx: &mut LifeCycleCtx, event: &LifeCycle, data: &TestEnum, env: &Env) {
match data {
TestEnum::First(value) => {
if let Some(content) = &mut self.content_first {
content.lifecycle(ctx, event, value, env);
self.first_added = true;
}
}
TestEnum::Second(value) => {
if let Some(content) = &mut self.content_second {
content.lifecycle(ctx, event, value, env);
self.second_added = true;
}
}
TestEnum::Third(value) => {
if let Some(content) = &mut self.content_third {
content.lifecycle(ctx, event, value, env);
self.third_added = true;
}
}
}
}
fn update(&mut self, ctx: &mut UpdateCtx, _old_data: &TestEnum, data: &TestEnum, env: &Env) {
match data {
TestEnum::First(_) if !self.first_added => ctx.children_changed(),
TestEnum::Second(_) if !self.second_added => ctx.children_changed(),
TestEnum::Third(_) if !self.third_added => ctx.children_changed(),
TestEnum::First(value) => {
if let Some(content) = &mut self.content_first {
content.update(ctx, value, env);
}
}
TestEnum::Second(value) => {
if let Some(content) = &mut self.content_second {
content.update(ctx, value, env);
}
}
TestEnum::Third(value) => {
if let Some(content) = &mut self.content_third {
content.update(ctx, value, env);
}
}
}
}
fn layout(
&mut self,
ctx: &mut LayoutCtx,
bc: &BoxConstraints,
data: &TestEnum,
env: &Env,
) -> Size {
match data {
TestEnum::First(value) => {
if let Some(content) = &mut self.content_first {
content.layout(ctx, bc, value, env)
} else {
Size::ZERO
}
}
TestEnum::Second(value) => {
if let Some(content) = &mut self.content_second {
content.layout(ctx, bc, value, env)
} else {
Size::ZERO
}
}
TestEnum::Third(value) => {
if let Some(content) = &mut self.content_third {
content.layout(ctx, bc, value, env)
} else {
Size::ZERO
}
}
}
}
fn paint(&mut self, ctx: &mut PaintCtx, data: &TestEnum, env: &Env) {
match data {
TestEnum::First(value) => {
if let Some(content) = &mut self.content_first {
content.paint(ctx, value, env);
}
}
TestEnum::Second(value) => {
if let Some(content) = &mut self.content_second {
content.paint(ctx, value, env);
}
}
TestEnum::Third(value) => {
if let Some(content) = &mut self.content_third {
content.paint(ctx, value, env);
}
}
}
}
}
| 33.714286 | 100 | 0.481209 |
5c77f01a728cd2d68f516a63f8d3bec0bea595d2
| 979 |
h
|
C
|
Applications/HomeUIService/HSSetupStepDelegate-Protocol.h
|
lechium/iPhoneOS_12.1.1_Headers
|
aac688b174273dfcbade13bab104461f463db772
|
[
"MIT"
] | 12 |
2019-06-02T02:42:41.000Z
|
2021-04-13T07:22:20.000Z
|
Applications/HomeUIService/HSSetupStepDelegate-Protocol.h
|
lechium/iPhoneOS_12.1.1_Headers
|
aac688b174273dfcbade13bab104461f463db772
|
[
"MIT"
] | null | null | null |
Applications/HomeUIService/HSSetupStepDelegate-Protocol.h
|
lechium/iPhoneOS_12.1.1_Headers
|
aac688b174273dfcbade13bab104461f463db772
|
[
"MIT"
] | 3 |
2019-06-11T02:46:10.000Z
|
2019-12-21T14:58:16.000Z
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@class HFDiscoveredAccessory, HFSetupAccessoryResult, HMAccessorySetupCompletedInfo, NSError, NSSet;
@protocol HSSetupStepDelegate <NSObject>
- (void)retryPairingForSetupStep:(id <HSSetupStep>)arg1;
- (void)clearSetupResultForSetupStep:(id <HSSetupStep>)arg1;
- (void)setupStep:(id <HSSetupStep>)arg1 handleSetupResult:(HFSetupAccessoryResult *)arg2;
- (void)setupStep:(id <HSSetupStep>)arg1 didPairWithAccessories:(NSSet *)arg2 completedInfo:(HMAccessorySetupCompletedInfo *)arg3;
- (void)setupStep:(id <HSSetupStep>)arg1 didSelectDiscoveredAccessory:(HFDiscoveredAccessory *)arg2;
- (void)setupStep:(id <HSSetupStep>)arg1 didFailWithError:(NSError *)arg2;
- (void)setupStepDidFinish:(id <HSSetupStep>)arg1;
- (void)setupStepDidCancel:(id <HSSetupStep>)arg1;
- (void)setupStepDidChange:(id <HSSetupStep>)arg1;
@end
| 42.565217 | 130 | 0.774259 |
7fbd7067495888c3b2f5bb10c4fd93fde2bcdce2
| 1,567 |
rs
|
Rust
|
workspace/simple-http-server/src/api/response_buffers/header_response_buffers/mod.rs
|
lemonrock/simple-http-server
|
896967914efd7e67de9deea79e383d5e2d65f916
|
[
"MIT"
] | null | null | null |
workspace/simple-http-server/src/api/response_buffers/header_response_buffers/mod.rs
|
lemonrock/simple-http-server
|
896967914efd7e67de9deea79e383d5e2d65f916
|
[
"MIT"
] | null | null | null |
workspace/simple-http-server/src/api/response_buffers/header_response_buffers/mod.rs
|
lemonrock/simple-http-server
|
896967914efd7e67de9deea79e383d5e2d65f916
|
[
"MIT"
] | 1 |
2018-12-02T20:45:33.000Z
|
2018-12-02T20:45:33.000Z
|
// This file is part of simple-http-server. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/simple-http-server/master/COPYRIGHT. No part of simple-http-server, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2018 The developers of simple-http-server. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/simple-http-server/master/COPYRIGHT.
use super::*;
use super::super::header_domain::*;
use self::time::*;
pub(crate) mod time;
include!("AccessControlAllowHeadersHeaderResponseBuffer.rs");
include!("AccessControlAllowMethodsHeaderResponseBuffer.rs");
include!("AccessControlMaxAgeResponseBuffer.rs");
include!("AllowHeaderResponseBuffer.rs");
include!("CacheControlHeaderResponseBuffer.rs");
include!("ContentLengthHeaderResponseBuffer.rs");
include!("DateHeaderResponseBuffer.rs");
include!("DenyXFrameOptionsHeaderResponseBuffer.rs");
include!("EndOfHeadersHeaderResponseBuffer.rs");
include!("ETagHeaderResponseBuffer.rs");
include!("HeaderResponseBuffer.rs");
include!("LastModifiedHeaderResponseBuffer.rs");
include!("ModeBlockXXSSProtectionHeaderResponseBuffer.rs");
include!("NosniffXContentTypeOptionsHeaderResponseBuffer.rs");
include!("StatusLineHeaderResponseBuffer.rs");
include!("VaryHeaderResponseBuffer.rs");
include!("XRobotsTagHeaderResponseBuffer.rs");
| 52.233333 | 409 | 0.813657 |
9ad01184afea8c1e3ec504b4f92c918bf2350580
| 288 |
css
|
CSS
|
css/style.css
|
brandyraquel323/JavaScript-Timed-Quiz
|
2d83f8c6e7bb13146d0caf1b75f5a91ac4f347db
|
[
"ADSL"
] | null | null | null |
css/style.css
|
brandyraquel323/JavaScript-Timed-Quiz
|
2d83f8c6e7bb13146d0caf1b75f5a91ac4f347db
|
[
"ADSL"
] | null | null | null |
css/style.css
|
brandyraquel323/JavaScript-Timed-Quiz
|
2d83f8c6e7bb13146d0caf1b75f5a91ac4f347db
|
[
"ADSL"
] | null | null | null |
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
header {
justify-content: space-between;
flex-wrap: wrap;
padding: 20px 35px;
display: flex;
}
header h1 {
font-weight: bold;
font-size: 30px;
color: #fce138;
margin: 0;
}
| 13.714286 | 35 | 0.538194 |
fc85aba7f5f9cda58c3c4d3e57b565d98b8249b9
| 1,935 |
css
|
CSS
|
public/price/style.css
|
MisterSaidbek/trz-web
|
c3310de72624e5484720be722b07fb21a2be1b03
|
[
"MIT"
] | null | null | null |
public/price/style.css
|
MisterSaidbek/trz-web
|
c3310de72624e5484720be722b07fb21a2be1b03
|
[
"MIT"
] | null | null | null |
public/price/style.css
|
MisterSaidbek/trz-web
|
c3310de72624e5484720be722b07fb21a2be1b03
|
[
"MIT"
] | null | null | null |
* {
margin: 0;
padding: 0;
}
.container {
max-width: 1200px;
}
.price-title {
text-align: center;
border-bottom: 1px solid #707070;
}
.price-title h2 {
position: relative;
font-size: 36px;
text-transform: uppercase;
font-weight: bold;
}
.price-title h2::after {
content: "";
position: absolute;
z-index: 1;
width: 300px;
height: 4px;
background-color: #2696f8;
border-radius: 4px;
bottom: -25%;
left: 39%;
}
.price-list {
display: flex;
justify-content: center;
text-align: center;
font-family: "Segoe UI Italic";
padding: 50px 0;
color: #2696f8;
font-weight: 500;
}
.first {
font-family: 'Segoe UI Italic';
}
.buttons {
display: flex;
justify-content: center;
align-items: center;
margin: 25px 0;
}
.buttons #btn-1 {
background-color: #139eb5;
color: #ffffff;
text-decoration: none;
padding: 17px 15px;
height: 30px;
border-radius: 29px;
display: flex;
align-items: center;
justify-content: center;
text-transform: uppercase;
font-size: 16px;
font-weight: 500;
margin: 0 25px;
}
#btn-1 i {
padding-right: 3px;
}
.buttons #btn-2 {
background-color: #139eb5;
color: #ffffff;
text-decoration: none;
height: 30px;
border-radius: 29px;
display: flex;
align-items: center;
justify-content: center;
text-transform: uppercase;
font-size: 16px;
font-weight: 500;
margin: 0 25px;
padding: 17px 15px;
}
#btn-2 i {
padding-right: 3px;
}
.third:nth-child(1){
width:80%;
}
.third:nth-child(2){
width:5%;
}
.third:nth-child(3){
width:15%;
}
.third:nth-child(1){
width:80%;
}
.third:nth-child(2){
width:5%;
}
.third:nth-child(3){
width:15%;
}
th.third {
font-family: "Segoe UI Italic";
border: none;
border-bottom: 2px solid #2696f8;
}
#tdthird {
font-weight: bold;
}
| 16.260504 | 37 | 0.595866 |
613566f1930ebe099521b4a2749c9775c2ab7786
| 878 |
css
|
CSS
|
web/modules/custom/toolbar_tasks/css/toolbar.css
|
paulsheldrake/components
|
2f61eed760c8f38944db5d6e11a21e9c186aae5e
|
[
"MIT"
] | null | null | null |
web/modules/custom/toolbar_tasks/css/toolbar.css
|
paulsheldrake/components
|
2f61eed760c8f38944db5d6e11a21e9c186aae5e
|
[
"MIT"
] | null | null | null |
web/modules/custom/toolbar_tasks/css/toolbar.css
|
paulsheldrake/components
|
2f61eed760c8f38944db5d6e11a21e9c186aae5e
|
[
"MIT"
] | null | null | null |
.toolbar-bar .toolbar-icon-edit:before {
background-image: url(../images/pencil.svg);
}
.toolbar-item::-moz-selection {
background: transparent;
}
.toolbar-item::selection {
background: transparent;
}
.toolbar-menu-administration .tabs__items li {
margin-bottom: 0;
}
.toolbar-menu-administration .tabs__item:first-child .tabs__link {
border-bottom-left-radius: 0;
border-left: 0;
border-top-left-radius: 0;
}
.toolbar-menu-administration .tabs__item:last-child .tabs__link {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
.toolbar-menu-administration .tabs__link {
background: none;
color: #565656;
cursor: pointer;
font-size: 1em;
padding: 1em 1.3333em;
text-decoration: none;
}
.toolbar-menu-administration .tabs__link:active,
.toolbar-menu-administration .tabs__link.is-active {
background-color: transparent;
}
| 21.414634 | 66 | 0.725513 |
c34e8d465fd7724ea767d7527c6612a040dd6fe2
| 1,299 |
go
|
Go
|
parse.go
|
mkeeler/pointerstructure
|
f252a8fd71c835fa8c8ead2ce2cc3a91e214cf83
|
[
"MIT"
] | null | null | null |
parse.go
|
mkeeler/pointerstructure
|
f252a8fd71c835fa8c8ead2ce2cc3a91e214cf83
|
[
"MIT"
] | null | null | null |
parse.go
|
mkeeler/pointerstructure
|
f252a8fd71c835fa8c8ead2ce2cc3a91e214cf83
|
[
"MIT"
] | 1 |
2021-02-02T00:01:17.000Z
|
2021-02-02T00:01:17.000Z
|
package pointerstructure
import (
"fmt"
"strings"
)
// Parse parses a pointer from the input string. The input string
// is expected to follow the format specified by RFC 6901: '/'-separated
// parts. Each part can contain escape codes to contain '/' or '~'.
func Parse(input string) (*Pointer, error) {
// Special case the empty case
if input == "" {
return &Pointer{}, nil
}
// We expect the first character to be "/"
if input[0] != '/' {
return nil, fmt.Errorf(
"parse Go pointer %q: first char must be '/'", input)
}
// Trim out the first slash so we don't have to +1 every index
input = input[1:]
// Parse out all the parts
var parts []string
lastSlash := -1
for i, r := range input {
if r == '/' {
parts = append(parts, input[lastSlash+1:i])
lastSlash = i
}
}
// Add last part
parts = append(parts, input[lastSlash+1:])
// Process each part for string replacement
for i, p := range parts {
// Replace ~1 followed by ~0 as specified by the RFC
parts[i] = strings.Replace(
strings.Replace(p, "~1", "/", -1), "~0", "~", -1)
}
return &Pointer{Parts: parts}, nil
}
// MustParse is like Parse but panics if the input cannot be parsed.
func MustParse(input string) *Pointer {
p, err := Parse(input)
if err != nil {
panic(err)
}
return p
}
| 22.396552 | 72 | 0.640493 |
9e9dd5978796a3c1d073a35cdc2594060765692b
| 2,386 |
rs
|
Rust
|
src/tooling/reader.rs
|
deltapi/aoc2020-rs
|
770fc31e7ce9101a9073321d7c2d0aa016d12266
|
[
"MIT"
] | 1 |
2020-12-04T21:23:40.000Z
|
2020-12-04T21:23:40.000Z
|
src/tooling/reader.rs
|
deltapi/aoc2020-rs
|
770fc31e7ce9101a9073321d7c2d0aa016d12266
|
[
"MIT"
] | null | null | null |
src/tooling/reader.rs
|
deltapi/aoc2020-rs
|
770fc31e7ce9101a9073321d7c2d0aa016d12266
|
[
"MIT"
] | null | null | null |
use std::fs::File;
use std::io::{self, BufRead};
use std::path::Path;
pub fn read_file_to_vec(path: &str) -> Vec<usize> {
let mut entries = vec![];
if let Ok(lines) = read_lines(path) {
for line in lines {
if let Ok(ip) = line {
entries.push(ip.parse::<usize>().unwrap());
}
}
}
entries
}
pub fn read_file_to_vec_u64(path: &str) -> Vec<u64> {
let mut entries = vec![];
if let Ok(lines) = read_lines(path) {
for line in lines {
if let Ok(ip) = line {
entries.push(ip.parse::<u64>().unwrap());
}
}
}
entries
}
pub fn read_file_to_vec_of_string(path: &str) -> Vec<String> {
let mut entries = vec![];
if let Ok(lines) = read_lines(path) {
for line in lines {
if let Ok(ip) = line {
entries.push(ip);
}
}
}
entries
}
pub fn read_block_file_to_vec_of_string(path: &str) -> Vec<String> {
let mut entries = vec![];
if let Ok(lines) = read_lines(path) {
let mut entry = "".to_string();
for line in lines {
if let Ok(ip) = line {
match ip.as_str() {
"" => {
entries.push(entry);
entry = "".to_string();
}
_ => {
entry.push_str(" ");
entry.push_str(&ip);
}
}
}
}
entries.push(entry);
}
entries
}
pub fn read_block_file_to_vec_vec_of_string(path: &str) -> Vec<Vec<String>> {
let mut entries: Vec<Vec<String>> = vec![];
if let Ok(lines) = read_lines(path) {
let mut entry = vec![];
for line in lines {
if let Ok(ip) = line {
match ip.as_str() {
"" => {
entries.push(entry);
entry = vec![];
}
_ => {
entry.push(ip);
}
}
}
}
entries.push(entry);
}
entries
}
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
where
P: AsRef<Path>,
{
let file = File::open(filename)?;
Ok(io::BufReader::new(file).lines())
}
| 25.655914 | 77 | 0.436714 |
94fa12b751c90a9a5abc5e0c97255cecb157e034
| 471 |
swift
|
Swift
|
UnusedUserDefaultsKeyExmaple/UserDefaultsKeys.swift
|
funzin/UnusedUserDefaultsKeyExmaple
|
14a62bf596e435a56ead9ac396595af98e32ab6b
|
[
"MIT"
] | null | null | null |
UnusedUserDefaultsKeyExmaple/UserDefaultsKeys.swift
|
funzin/UnusedUserDefaultsKeyExmaple
|
14a62bf596e435a56ead9ac396595af98e32ab6b
|
[
"MIT"
] | null | null | null |
UnusedUserDefaultsKeyExmaple/UserDefaultsKeys.swift
|
funzin/UnusedUserDefaultsKeyExmaple
|
14a62bf596e435a56ead9ac396595af98e32ab6b
|
[
"MIT"
] | null | null | null |
//
// UserDefaultsKeys.swift
// UnusedUserDefaultsKey-Sample
//
// Created by nakazawa fumito on 2020/08/09.
// Copyright © 2020 nakazawa fumito. All rights reserved.
//
import Foundation
import SwiftyUserDefaults
extension DefaultsKeys {
var isHoge: DefaultsKey<Bool> { .init("is_hoge", defaultValue: false) }
var isFoo: DefaultsKey<Bool> { .init("is_foo", defaultValue: false) }
var isBar: DefaultsKey<Bool> { .init("is_bar", defaultValue: false) }
}
| 27.705882 | 75 | 0.717622 |
d41ad30cbc280b64cd74c7731ee0c30b394047c9
| 15,625 |
asm
|
Assembly
|
Library/Text/TextStorage/tsEC.asm
|
steakknife/pcgeos
|
95edd7fad36df400aba9bab1d56e154fc126044a
|
[
"Apache-2.0"
] | 504 |
2018-11-18T03:35:53.000Z
|
2022-03-29T01:02:51.000Z
|
Library/Text/TextStorage/tsEC.asm
|
steakknife/pcgeos
|
95edd7fad36df400aba9bab1d56e154fc126044a
|
[
"Apache-2.0"
] | 96 |
2018-11-19T21:06:50.000Z
|
2022-03-06T10:26:48.000Z
|
Library/Text/TextStorage/tsEC.asm
|
steakknife/pcgeos
|
95edd7fad36df400aba9bab1d56e154fc126044a
|
[
"Apache-2.0"
] | 73 |
2018-11-19T20:46:53.000Z
|
2022-03-29T00:59:26.000Z
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: tsEC.asm
AUTHOR: John Wedgwood, Nov 19, 1991
ROUTINES:
Name Description
---- -----------
TS_ECCheckParams Exported parameter checking routine
ECCheckTextReference Check a general text reference
ECCheckTextReferencePointer Check specific text references
ECCheckTextReferenceSegmentChunk
ECCheckTextReferenceBlockChunk
ECCheckTextReferenceBlock
ECCheckTextReferenceVMBlock
ECCheckTextReferenceDBItem
ECCheckTextReferenceHugeArray
ECCheckVisTextReplaceParameters Check VisTextReplaceParameters
ECSmallCheckVisTextReplaceParameters
REVISION HISTORY:
Name Date Description
---- ---- -----------
John 11/19/91 Initial revision
DESCRIPTION:
Error checking routines for the TextStorage module.
$Id: tsEC.asm,v 1.1 97/04/07 11:22:31 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextEC segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TS_ECCheckParams
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Exported routine to do parameter checking.
CALLED BY: VisTextReplace
PASS: *ds:si = Instance ptr
ss:bp = VisTextReplaceParameters
RETURN: nothing
DESTROYED: nothing (even flags are preserved)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TS_ECCheckParams proc far
uses di
.enter
pushf
mov di, TSV_CHECK_PARAMS ; di <- routine to call
call CallStorageHandler ; Call the ec routine
test ss:[bp].VTRP_flags, not mask VisTextReplaceFlags
ERROR_NZ VIS_TEXT_BAD_REPLACE_FLAGS
popf
.leave
ret
TS_ECCheckParams endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextReference
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check to make sure that a text reference is valid.
CALLED BY: ECCheckVisTextReplaceParameters
PASS: ss:bp = TextReference
*ds:si = Text instance
RETURN: nothing
DESTROYED: nothing (even flags are left intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextReference proc far
uses bx, bp
.enter
pushf
mov bx, ss:[bp].TR_type ; bx <- type
lea bp, ss:[bp].TR_ref ; ss:bp <- ptr to reference
push cs ; Far routines
call cs:checkTypeTable[bx] ; Call a routine...
popf
.leave
ret
ECCheckTextReference endp
checkTypeTable word \
offset cs:ECCheckTextReferencePointer, ; TRT_POINTER
offset cs:ECCheckTextReferenceSegmentChunk, ; TRT_SEGMENT_CHUNK
offset cs:ECCheckTextReferenceBlockChunk, ; TRT_BLOCK_CHUNK
offset cs:ECCheckTextReferenceBlock, ; TRT_BLOCK
offset cs:ECCheckTextReferenceVMBlock, ; TRT_VM_BLOCK
offset cs:ECCheckTextReferenceDBItem, ; TRT_DB_ITEM
offset cs:ECCheckTextReferenceHugeArray ; TRT_HUGE_ARRAY
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextReferencePointer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check a pointer reference to some text.
CALLED BY: ECCheckTextReference
PASS: *ds:si = Text instance
ss:bp = TextReferencePointer
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextReferencePointer proc far
class VisTextClass
uses ax, si, ds
.enter
pushf
;
; We need to make sure that if the text object is a small object
; the reference cannot be to text that is in the same block as the
; text object. The problem here is that making room for the text
; could cause the text chunk itself to move. The result is that the
; pointer might not be valid.
;
mov si, ds:[si]
add si, ds:[si].Vis_offset ; ds:si <- instance ptr
test ds:[si].VTI_storageFlags, mask VTSF_LARGE
jnz afterSegmentCheck
mov ax, ds
cmp ax, ss:[bp].TRP_pointer.segment
ERROR_Z CANNOT_USE_A_POINTER_TO_TEXT_IN_SAME_BLOCK_AS_TEXT_OBJECT
afterSegmentCheck:
;
; Make sure that the segment and offset are valid.
;
mov ds, ss:[bp].TRP_pointer.segment
mov si, ss:[bp].TRP_pointer.offset
EC_BOUNDS ds, si
popf
.leave
ret
ECCheckTextReferencePointer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextReferenceSegmentChunk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check a segment.chunk reference to some text.
CALLED BY: ECCheckTextReference
PASS: *ds:si = Text instance
ss:bp = TextReferenceSegmentChunk
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextReferenceSegmentChunk proc far
uses si, ds
.enter
mov ds, ss:[bp].TRSC_segment
mov si, ss:[bp].TRSC_chunk
call ECLMemValidateHandle
.leave
ret
ECCheckTextReferenceSegmentChunk endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextReferenceBlockChunk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check a block.chunk reference to some text.
CALLED BY: ECCheckTextReference
PASS: *ds:si = Text instance
ss:bp = TextReferenceBlockChunk
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextReferenceBlockChunk proc far
uses ax, bx, si, ds
.enter
pushf
mov bx, ss:[bp].TRBC_ref.handle
mov si, ss:[bp].TRBC_ref.chunk
call ObjLockObjBlock ; Lock the block
mov ds, ax ; *ds:si <- chunk
call ECLMemValidateHandle
call MemUnlock ; Release the block
popf
.leave
ret
ECCheckTextReferenceBlockChunk endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextReferenceBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check a block reference to some text.
CALLED BY: ECCheckTextReference
PASS: *ds:si = Text instance
ss:bp = TextReferenceBlock
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextReferenceBlock proc far
uses ax, bx, si, ds
.enter
pushf
mov bx, ss:[bp].TRB_handle
call MemLock ; ax <- block segment
mov ds, ax ; ds <- segment
clr si ; ds:si <- ptr to text
EC_BOUNDS ds, si
call MemUnlock ; Release the block
popf
.leave
ret
ECCheckTextReferenceBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextReferenceVMBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check a vm-block reference to some text.
CALLED BY: ECCheckTextReference
PASS: *ds:si = Text instance
ss:bp = TextReferenceVMBlock
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextReferenceVMBlock proc far
uses ax, bx
.enter
pushf
mov bx, ss:[bp].TRVMB_file
call ECVMCheckVMFile
mov ax, ss:[bp].TRVMB_block
call ECVMCheckVMBlockHandle
popf
.leave
ret
ECCheckTextReferenceVMBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextReferenceDBItem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check a dbItem reference to some text.
CALLED BY: ECCheckTextReference
PASS: *ds:si = Text instance
ss:bp = TextReferenceDBItem
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextReferenceDBItem proc far
uses ax, bx
.enter
pushf
mov bx, ss:[bp].TRDBI_file
call ECVMCheckVMFile
mov ax, ss:[bp].TRDBI_group
call ECVMCheckVMBlockHandle
;
; We don't have any way of checking the item right now.
;
popf
.leave
ret
ECCheckTextReferenceDBItem endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextReferenceHugeArray
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check a huge-array reference to some text.
CALLED BY: ECCheckTextReference
PASS: *ds:si = Text instance
ss:bp = TextReferenceHugeArray
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextReferenceHugeArray proc far
uses ax, bx, di
.enter
pushf
mov bx, ss:[bp].TRHA_file
call ECVMCheckVMFile
mov ax, ss:[bp].TRHA_array
call ECVMCheckVMBlockHandle
mov di, ax
call ECCheckHugeArray ; Check the huge array
popf
.leave
ret
ECCheckTextReferenceHugeArray endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckVisTextReplaceParameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check VisTextReplaceParameters to make sure they're valid.
CALLED BY: ECSmallCheckVisTextReplaceParameters,
ECLargeCheckVisTextReplaceParameters
PASS: ss:bp = VisTextReplaceParameters
*ds:si = Instance
dx.ax = Current number of bytes of text in the object
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckVisTextReplaceParameters proc far
uses ax, dx, bp
.enter
pushf
cmpdw dxax, ss:[bp].VTRP_range.VTR_start
ERROR_B POSITION_FOR_CHANGE_IS_BEYOND_END_OF_TEXT
cmpdw dxax, ss:[bp].VTRP_range.VTR_end
ERROR_B CANNOT_DELETE_PAST_END_OF_OBJECT
tstdw ss:[bp].VTRP_insCount
jz afterRefCheck
;
; There is text to be inserted, so check to make sure it's kosher.
;
lea bp, ss:[bp].VTRP_textReference
call ECCheckTextReference
afterRefCheck:
popf
.leave
ret
ECCheckVisTextReplaceParameters endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECSmallCheckVisTextReplaceParameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure that a VisTextReplaceParameters structure
is valid for a modification to a small text object.
CALLED BY: SmallReplaceText
PASS: *ds:si = Instance ptr
ss:bp = VisTextReplaceParameters
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECSmallCheckVisTextReplaceParameters proc far
class VisTextClass
uses ax, dx, di
.enter
pushf
;
; First check the high-words of the size/position parameters.
;
tst ss:[bp].VTRP_range.VTR_start.high
ERROR_NZ POSITION_HIGH_WORD_NON_ZERO_FOR_SMALL_TEXT_OBJECT
tst ss:[bp].VTRP_insCount.high
ERROR_NZ INSERTION_COUNT_HIGH_WORD_NON_ZERO_FOR_SMALL_TEXT_OBJECT
tst ss:[bp].VTRP_range.VTR_end.high
ERROR_NZ DELETION_COUNT_HIGH_WORD_NON_ZERO_FOR_SMALL_TEXT_OBJECT
;
; Now check the result against the maximum size.
;
mov di, ds:[si]
add di, ds:[di].Vis_offset ; ds:di <- instance ptr
mov dx, ds:[di].VTI_maxLength ; dx <- maximum allowed size
mov di, ds:[di].VTI_text
mov di, ds:[di] ; ds:di <- text chunk ptr
ChunkSizePtr ds, di, ax ; ax <- text size
DBCS < shr ax, 1 ; ax <- text length >
dec ax ; Don't count the null
push ax ; Save current size
add ax, ss:[bp].VTRP_insCount.low ; ax <- size after changes
sub ax, ss:[bp].VTRP_range.VTR_end.low
add ax, ss:[bp].VTRP_range.VTR_start.low
cmp ax, dx
ERROR_A SIZE_CHANGE_WOULD_EXCEED_MAXLENGTH
pop ax ; Restore current size
clr dx ; dx.ax <- current size
call ECCheckVisTextReplaceParameters
popf
.leave
ret
ECSmallCheckVisTextReplaceParameters endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECLargeCheckVisTextReplaceParameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure that a VisTextReplaceParameters structure
is valid for a modification to a large text object.
CALLED BY: LargeReplaceText
PASS: *ds:si = Instance ptr
ss:bp = VisTextReplaceParameters
RETURN: nothing
DESTROYED: nothing (even flags are intact)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECLargeCheckVisTextReplaceParameters proc far
uses ax, dx
.enter
pushf
call LargeGetTextSize ; dx.ax <- size of object
call ECCheckVisTextReplaceParameters
popf
.leave
ret
ECLargeCheckVisTextReplaceParameters endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckTextForInsert
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure that a block of text doesn't contain NULLs
CALLED BY: InsertFrom*
PASS: bp:si = Pointer to the text
cx = Number of bytes to check
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckTextForInsert proc far
ret
ECCheckTextForInsert endp
TextEC ends
| 25.95515 | 79 | 0.577024 |
b97d50986a7af31c223f00197c27106a0ee6d670
| 417 |
swift
|
Swift
|
Sources/App/LocalePatch.swift
|
colinrblake/nsdateformatter.com
|
997bcbbcb1246c224923679253fff38caed953bb
|
[
"MIT"
] | 199 |
2016-03-02T18:44:14.000Z
|
2022-01-04T16:09:09.000Z
|
Sources/App/LocalePatch.swift
|
colinrblake/nsdateformatter.com
|
997bcbbcb1246c224923679253fff38caed953bb
|
[
"MIT"
] | 28 |
2016-03-04T23:13:22.000Z
|
2022-02-18T20:53:12.000Z
|
Sources/App/LocalePatch.swift
|
colinrblake/nsdateformatter.com
|
997bcbbcb1246c224923679253fff38caed953bb
|
[
"MIT"
] | 31 |
2016-03-05T15:24:15.000Z
|
2022-02-18T19:26:40.000Z
|
import Foundation
import CoreFoundation
// workaround a swift/linux bug that prevents Locale.availableLocales from working on Linux.
// https://bugs.swift.org/browse/SR-3634
func availableLocales() -> [String] {
let cflocales = CFLocaleCopyAvailableLocaleIdentifiers()
var results: [String] = []
for obj in unsafeBitCast(cflocales, to: NSArray.self) {
results.append(obj as! String)
}
return results
}
| 29.785714 | 92 | 0.7506 |
9bc844ac3d51e0f42c9f45fe57df955cc5d5c611
| 47 |
js
|
JavaScript
|
examples/todos/src/components/Cleaner/index.js
|
sgrishchenko/readuz
|
2cfc888209d23a4548e14332bffd78de0bf77a34
|
[
"MIT"
] | 3 |
2019-03-05T20:57:54.000Z
|
2020-06-30T23:31:20.000Z
|
examples/todos/src/components/Cleaner/index.js
|
sgrishchenko/readuz
|
2cfc888209d23a4548e14332bffd78de0bf77a34
|
[
"MIT"
] | 4 |
2020-01-15T16:01:33.000Z
|
2021-09-01T11:15:15.000Z
|
examples/todos/src/components/Cleaner/index.js
|
sgrishchenko/readuz
|
2cfc888209d23a4548e14332bffd78de0bf77a34
|
[
"MIT"
] | 1 |
2019-07-23T12:07:34.000Z
|
2019-07-23T12:07:34.000Z
|
// @flow
export { Cleaner } from './Cleaner';
| 11.75 | 36 | 0.595745 |
ed4dbef78fe55718a0af5d4bb6815ae3c29ec424
| 226 |
swift
|
Swift
|
Mixed/Mixed/SwiftClass.swift
|
LionWY/Mixed
|
7773cae65fb4705c68f5a0cca417faed71788e7e
|
[
"MIT"
] | null | null | null |
Mixed/Mixed/SwiftClass.swift
|
LionWY/Mixed
|
7773cae65fb4705c68f5a0cca417faed71788e7e
|
[
"MIT"
] | null | null | null |
Mixed/Mixed/SwiftClass.swift
|
LionWY/Mixed
|
7773cae65fb4705c68f5a0cca417faed71788e7e
|
[
"MIT"
] | null | null | null |
//
// SwiftClass.swift
// Mixed
//
// Created by FOODING on 17/1/244.
// Copyright © 2017年 Noohle. All rights reserved.
//
import UIKit
class SwiftClass: NSObject {
func test() {
_ = OCClass()
}
}
| 11.894737 | 50 | 0.579646 |
b6481d47220974304a67323ae22f54739087638e
| 423 |
rb
|
Ruby
|
db/migrate/20170814220048_add_household_info_fields_to_snap_applications.rb
|
18F/michigan-benefits
|
7b4129d720cb5ce0975c9d792b8b40f5a4731117
|
[
"MIT"
] | null | null | null |
db/migrate/20170814220048_add_household_info_fields_to_snap_applications.rb
|
18F/michigan-benefits
|
7b4129d720cb5ce0975c9d792b8b40f5a4731117
|
[
"MIT"
] | null | null | null |
db/migrate/20170814220048_add_household_info_fields_to_snap_applications.rb
|
18F/michigan-benefits
|
7b4129d720cb5ce0975c9d792b8b40f5a4731117
|
[
"MIT"
] | 1 |
2021-02-14T11:18:36.000Z
|
2021-02-14T11:18:36.000Z
|
class AddHouseholdInfoFieldsToSnapApplications < ActiveRecord::Migration[5.1]
def change
add_column :snap_applications, :everyone_a_citizen, :boolean
add_column :snap_applications, :anyone_disabled, :boolean
add_column :snap_applications, :anyone_new_mom, :boolean
add_column :snap_applications, :anyone_in_college, :boolean
add_column :snap_applications, :anyone_living_elsewhere, :boolean
end
end
| 42.3 | 77 | 0.803783 |
b11946a0a1ea98704da0e4a841dd287d92544eb5
| 65 |
css
|
CSS
|
frontend/src/resources/views/pages/css/verify.css
|
ElkinCp5/MongoGraphic
|
2ad3aee23447a5a402ca928a865f664384c4517f
|
[
"MIT"
] | null | null | null |
frontend/src/resources/views/pages/css/verify.css
|
ElkinCp5/MongoGraphic
|
2ad3aee23447a5a402ca928a865f664384c4517f
|
[
"MIT"
] | null | null | null |
frontend/src/resources/views/pages/css/verify.css
|
ElkinCp5/MongoGraphic
|
2ad3aee23447a5a402ca928a865f664384c4517f
|
[
"MIT"
] | null | null | null |
.card-auth.verify button{
width: 40%;
margin: 0 10px;
}
| 10.833333 | 25 | 0.584615 |
28e4b26375de7d97c120c25e2e72ae8fe4d3db43
| 149 |
rb
|
Ruby
|
app/controllers/test_controller.rb
|
justinweiss/dgs_push_server
|
e407e208529e90e6b15950383b508183d54f3ff1
|
[
"MIT"
] | 2 |
2015-10-16T17:26:55.000Z
|
2015-12-23T00:04:23.000Z
|
app/controllers/test_controller.rb
|
justinweiss/dgs_push_server
|
e407e208529e90e6b15950383b508183d54f3ff1
|
[
"MIT"
] | null | null | null |
app/controllers/test_controller.rb
|
justinweiss/dgs_push_server
|
e407e208529e90e6b15950383b508183d54f3ff1
|
[
"MIT"
] | 1 |
2022-01-26T16:51:58.000Z
|
2022-01-26T16:51:58.000Z
|
class TestController < ApplicationController
def succeed
render :text => 'ok'
end
def fail
raise "Way to go, you broke it!"
end
end
| 14.9 | 44 | 0.671141 |
0618d58e149cd19dd5e525abdf942d1b914a09bb
| 17,088 |
rs
|
Rust
|
runtime/src/lib.rs
|
opensquare-network/opensquare
|
df9d1921a72644138a0fb8ceecbb565b98d16a61
|
[
"Apache-2.0"
] | 11 |
2020-08-27T00:44:11.000Z
|
2021-09-26T09:07:10.000Z
|
runtime/src/lib.rs
|
opensquare-network/opensquare
|
df9d1921a72644138a0fb8ceecbb565b98d16a61
|
[
"Apache-2.0"
] | 13 |
2020-08-16T04:53:51.000Z
|
2020-12-12T14:24:38.000Z
|
runtime/src/lib.rs
|
opensquare-network/opensquare
|
df9d1921a72644138a0fb8ceecbb565b98d16a61
|
[
"Apache-2.0"
] | 5 |
2020-10-07T14:23:20.000Z
|
2021-11-04T15:31:31.000Z
|
#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::traits::{BlakeTwo256, Block as BlockT, IdentityLookup, NumberFor, Saturating};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, Percent,
};
use sp_std::prelude::*;
use pallet_grandpa::fg_primitives;
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
// use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use frame_system::{EnsureOneOf, EnsureRoot, EnsureSignedBy};
// orml
use orml_currencies::BasicCurrencyAdapter;
// A few exports that help ease life for downstream crates.
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill};
pub use frame_support::{
construct_runtime, parameter_types,
traits::{KeyOwnerProofSystem, Randomness},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
IdentityFee, Weight,
},
StorageValue,
};
pub use pallet_balances::Call as BalancesCall;
pub use pallet_timestamp::Call as TimestampCall;
pub use opensquare_primitives::{
AccountId, AccountIndex, Amount, Balance, BlockNumber, CurrencyId, Hash, Index, Moment, Price,
Signature,
};
pub mod constants;
pub mod weights;
pub use constants::{currency::*, time::*};
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
pub grandpa: Grandpa,
// pub im_online: ImOnline,
}
}
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("opensquare"),
impl_name: create_runtime_str!("opensquare"),
authoring_version: 1,
spec_version: 1,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
};
/// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
NativeVersion {
runtime_version: VERSION,
can_author_with: Default::default(),
}
}
parameter_types! {
pub const BlockHashCount: BlockNumber = 2400;
/// We allow for 2 seconds of compute with a 6 second average block time.
pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
/// Assume 10% of weight for average on_initialize calls.
pub MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get()
.saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get();
pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
pub const Version: RuntimeVersion = VERSION;
}
// Configure FRAME pallets to include in runtime.
impl frame_system::Trait for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = ();
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
type Call = Call;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = IdentityLookup<AccountId>;
/// The index type for storing how many extrinsics an account has signed.
type Index = Index;
/// The index type for blocks.
type BlockNumber = BlockNumber;
/// The type for hashing blocks and tries.
type Hash = Hash;
/// The hashing algorithm used.
type Hashing = BlakeTwo256;
/// The header type.
type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// The ubiquitous event type.
type Event = Event;
/// The ubiquitous origin type.
type Origin = Origin;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
type BlockHashCount = BlockHashCount;
/// Maximum weight of each block.
type MaximumBlockWeight = MaximumBlockWeight;
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
/// The weight of the overhead invoked on the block import process, independent of the
/// extrinsics included in that block.
type BlockExecutionWeight = BlockExecutionWeight;
/// The base weight of any extrinsic processed by the runtime, independent of the
/// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...)
type ExtrinsicBaseWeight = ExtrinsicBaseWeight;
/// The maximum weight that a single extrinsic of `Normal` dispatch class can have,
/// idependent of the logic of that extrinsics. (Roughly max block weight - average on
/// initialize cost).
type MaximumExtrinsicWeight = MaximumExtrinsicWeight;
/// Maximum size of all encoded transactions (in bytes) that are allowed in one block.
type MaximumBlockLength = MaximumBlockLength;
/// Portion of the block weight that is available to all normal transactions.
type AvailableBlockRatio = AvailableBlockRatio;
/// Version of the runtime.
type Version = Version;
/// Converts a module to the index of the module in `construct_runtime!`.
///
/// This type is being generated by `construct_runtime!`.
type PalletInfo = PalletInfo;
/// What to do if a new account is created.
type OnNewAccount = ();
/// What to do if an account is fully reaped from the system.
type OnKilledAccount = ();
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = weights::frame_system::WeightInfo;
}
impl pallet_aura::Trait for Runtime {
type AuthorityId = AuraId;
}
impl pallet_grandpa::Trait for Runtime {
type Event = Event;
type Call = Call;
type KeyOwnerProofSystem = ();
type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;
type HandleEquivocation = ();
type WeightInfo = ();
}
parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
}
impl pallet_timestamp::Trait for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
type MinimumPeriod = MinimumPeriod;
type WeightInfo = weights::pallet_timestamp::WeightInfo;
}
parameter_types! {
pub const ExistentialDeposit: u128 = 500;
// For weight estimation, we assume that the most locks on an individual account will be 50.
// This number may need to be adjusted in the future if this assumption no longer holds true.
pub const MaxLocks: u32 = 50;
}
impl pallet_balances::Trait for Runtime {
type MaxLocks = MaxLocks;
/// The type for recording an account's balance.
type Balance = Balance;
/// The ubiquitous event type.
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = weights::pallet_balances::WeightInfo;
}
parameter_types! {
pub const TransactionByteFee: Balance = 1;
}
impl pallet_transaction_payment::Trait for Runtime {
type Currency = pallet_balances::Module<Runtime>;
type OnTransactionPayment = ();
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
type FeeMultiplierUpdate = ();
}
impl pallet_sudo::Trait for Runtime {
type Event = Event;
type Call = Call;
}
parameter_types! {
pub const GetNativeCurrencyId: CurrencyId = CurrencyId::OSN;
pub const GetStableCurrencyId: CurrencyId = CurrencyId::USDT;
}
impl orml_currencies::Trait for Runtime {
type Event = Event;
type MultiCurrency = Tokens;
type NativeCurrency = BasicCurrencyAdapter<Runtime, Balances, Amount, BlockNumber>;
type GetNativeCurrencyId = GetNativeCurrencyId;
type WeightInfo = ();
}
// orml
impl orml_tokens::Trait for Runtime {
type Event = Event;
type Balance = Balance;
type Amount = Amount;
type CurrencyId = CurrencyId;
type OnReceived = ();
type WeightInfo = ();
}
parameter_types! {
pub const MinimumCount: u32 = 1;
pub const ExpiresIn: Moment = 1000 * 60 * 60; // 60 mins
pub const OracleUnsignedPriority: TransactionPriority = TransactionPriority::max_value() - 10000;
pub RootOperatorAccountId: AccountId = root();
}
fn root() -> AccountId {
Sudo::key()
}
impl orml_oracle::Trait for Runtime {
type Event = Event;
type OnNewData = ();
type CombineData = orml_oracle::DefaultCombineData<Runtime, MinimumCount, ExpiresIn>;
type Time = Timestamp;
type OracleKey = CurrencyId;
type OracleValue = Price;
type RootOperatorAccountId = RootOperatorAccountId;
type WeightInfo = ();
}
type EnsureRootOrCouncil =
EnsureOneOf<AccountId, EnsureRoot<AccountId>, EnsureSignedBy<OsSystem, AccountId>>;
impl ospallet_system::Trait for Runtime {
type Event = Event;
}
parameter_types! {
pub const CouncilFee: Percent = Percent::from_percent(5);
pub CouncilAccount: AccountId = council(); // TODO tmp use a council function
}
fn council() -> AccountId {
OsSystem::tmp_council()[0].clone()
}
impl ospallet_bounties::Trait for Runtime {
type Event = Event;
type Currency = Currencies;
type CouncilOrigin = EnsureRootOrCouncil;
type CouncilAccount = CouncilAccount;
type CouncilFee = CouncilFee;
type DetermineBountyId = ospallet_bounties::SimpleBountyIdDeterminer<Runtime>;
type BountyResolved = ();
type ReputationBuilder = OsReputation;
type MiningPowerBuilder = OsMining;
}
impl ospallet_reputation::Trait for Runtime {
type Event = Event;
}
impl ospallet_mining::Trait for Runtime {
type Event = Event;
type Currency = Balances;
}
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = opensquare_primitives::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
Aura: pallet_aura::{Module, Config<T>, Inherent},
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
Balances: pallet_balances::{Module, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Module, Storage},
Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},
// oracle
Currencies: orml_currencies::{Module, Call, Event<T>},
Tokens: orml_tokens::{Module, Storage, Event<T>, Config<T>},
Oracle: orml_oracle::{Module, Storage, Call, Config<T>, Event<T>},
OsSystem: ospallet_system::{Module, Call, Config<T>, Storage, Event<T>},
OsBounties: ospallet_bounties::{Module, Call, Storage, Event<T>, Config<T>},
OsReputation: ospallet_reputation::{Module, Storage, Event<T>},
OsMining: ospallet_mining::{Module, Call, Storage, Event<T>},
}
);
/// The address format for describing accounts.
pub type Address = AccountId;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// A Block signed with a Justification
pub type SignedBlock = generic::SignedBlock<Block>;
/// BlockId type as expected by this runtime.
pub type BlockId = generic::BlockId<Block>;
/// The SignedExtension to the basic transaction logic.
pub type SignedExtra = (
frame_system::CheckSpecVersion<Runtime>,
frame_system::CheckTxVersion<Runtime>,
frame_system::CheckGenesis<Runtime>,
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllModules,
>;
impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
VERSION
}
fn execute_block(block: Block) {
Executive::execute_block(block)
}
fn initialize_block(header: &<Block as BlockT>::Header) {
Executive::initialize_block(header)
}
}
impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata {
Runtime::metadata().into()
}
}
impl sp_block_builder::BlockBuilder<Block> for Runtime {
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
Executive::apply_extrinsic(extrinsic)
}
fn finalize_block() -> <Block as BlockT>::Header {
Executive::finalize_block()
}
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
data.create_extrinsics()
}
fn check_inherents(
block: Block,
data: sp_inherents::InherentData,
) -> sp_inherents::CheckInherentsResult {
data.check_extrinsics(&block)
}
fn random_seed() -> <Block as BlockT>::Hash {
RandomnessCollectiveFlip::random_seed()
}
}
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
) -> TransactionValidity {
Executive::validate_transaction(source, tx)
}
}
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
fn offchain_worker(header: &<Block as BlockT>::Header) {
Executive::offchain_worker(header)
}
}
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> u64 {
Aura::slot_duration()
}
fn authorities() -> Vec<AuraId> {
Aura::authorities()
}
}
impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
SessionKeys::generate(seed)
}
fn decode_session_keys(
encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
SessionKeys::decode_into_raw_public_keys(&encoded)
}
}
impl fg_primitives::GrandpaApi<Block> for Runtime {
fn grandpa_authorities() -> GrandpaAuthorityList {
Grandpa::grandpa_authorities()
}
fn submit_report_equivocation_unsigned_extrinsic(
_equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash,
NumberFor<Block>,
>,
_key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,
) -> Option<()> {
None
}
fn generate_key_ownership_proof(
_set_id: fg_primitives::SetId,
_authority_id: GrandpaId,
) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {
// NOTE: this is the only implementation possible since we've
// defined our key owner proof type as a bottom type (i.e. a type
// with no values).
None
}
}
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
System::account_nonce(account)
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
fn query_info(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
}
}
| 34.313253 | 104 | 0.686973 |
70d384ec9375f38a303f0c21f18238d12b2a4037
| 890 |
swift
|
Swift
|
Sources/CollectionViewSection.SetBoundarySupplementaryItemsError.swift
|
Anvipo/AnKit
|
8077701f25a58a30163142c5c7e62e8b1532823c
|
[
"MIT"
] | 3 |
2021-11-11T10:18:49.000Z
|
2021-12-07T17:52:38.000Z
|
Sources/CollectionViewSection.SetBoundarySupplementaryItemsError.swift
|
Anvipo/AnKit
|
8077701f25a58a30163142c5c7e62e8b1532823c
|
[
"MIT"
] | null | null | null |
Sources/CollectionViewSection.SetBoundarySupplementaryItemsError.swift
|
Anvipo/AnKit
|
8077701f25a58a30163142c5c7e62e8b1532823c
|
[
"MIT"
] | null | null | null |
//
// CollectionViewSection.SetBoundarySupplementaryItemsError.swift
// AnKit
//
// Created by Anvipo on 20.10.2021.
//
import Foundation
public extension CollectionViewSection {
/// Error, which could occure in `CollectionViewSection` `set(boundarySupplementaryItems:)` method.
enum SetBoundarySupplementaryItemsError {
/// Specified boundary supplementary items are not unique by element kind.
case duplicateBoundarySupplementaryItemsByElementKind([CollectionViewBoundarySupplementaryItem])
}
}
extension CollectionViewSection.SetBoundarySupplementaryItemsError: LocalizedError {
public var errorDescription: String? {
switch self {
case let .duplicateBoundarySupplementaryItemsByElementKind(items):
return """
Specified boundary supplementary items are not unique by element kind.
Boundary supplementary items with same element kind: \(items).
"""
}
}
}
| 30.689655 | 100 | 0.792135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.