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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
751ce8dc2074564eb1b4ae3b003c20d575dbc7fd | 3,351 | cs | C# | src/Spear.Core/Domain/DResult.cs | jl632541832/spear | 1c0b5f44df2152468831cdc0f0137b39c85be5f8 | [
"Apache-2.0"
] | 51 | 2019-02-18T09:52:35.000Z | 2022-03-08T11:51:18.000Z | src/Spear.Core/Domain/DResult.cs | jl632541832/spear | 1c0b5f44df2152468831cdc0f0137b39c85be5f8 | [
"Apache-2.0"
] | null | null | null | src/Spear.Core/Domain/DResult.cs | jl632541832/spear | 1c0b5f44df2152468831cdc0f0137b39c85be5f8 | [
"Apache-2.0"
] | 22 | 2018-12-13T20:37:41.000Z | 2022-03-08T11:51:19.000Z | using System;
using System.Collections.Generic;
using System.Linq;
namespace Spear.Core
{
/// <summary> 基础数据结果类 </summary>
[Serializable]
public class DResult
{
/// <summary> 状态 </summary>
public bool Status => Code == 0;
/// <summary> 状态码 </summary>
public int Code { get; set; }
/// <summary> 错误消息 </summary>
public string Message { get; set; }
private DateTime _timestamp;
/// <summary> 时间戳 </summary>
public DateTime Timestamp
{
get => _timestamp == DateTime.MinValue ? DateTime.Now : _timestamp;
set => _timestamp = value;
}
public DResult() : this(string.Empty) { }
public DResult(string message, int code = 0)
{
Message = message;
Code = code;
}
/// <summary> 成功 </summary>
public static DResult Success => new DResult(string.Empty);
/// <summary> 错误的结果 </summary>
/// <param name="message"></param>
/// <param name="code"></param>
/// <returns></returns>
public static DResult Error(string message, int code = -1)
{
return new DResult(message, code);
}
public static DResult<T> Succ<T>(T data)
{
return new DResult<T>(data);
}
public static DResult<T> Error<T>(string message, int code = -1)
{
return new DResult<T>(message, code);
}
public static DResults<T> Succ<T>(IEnumerable<T> data, int count = -1)
{
return count < 0 ? new DResults<T>(data) : new DResults<T>(data, count);
}
public static DResults<T> Succ<T>(PagedList<T> data)
{
return new DResults<T>(data);
}
public static DResults<T> Errors<T>(string message, int code = -1)
{
return new DResults<T>(message, code);
}
}
[Serializable]
public class DResult<T> : DResult
{
/// <summary> 数据 </summary>
public T Data { get; set; }
public DResult() : this(default(T)) { }
public DResult(T data)
: base(string.Empty)
{
Data = data;
}
public DResult(string message, int code = -1)
: base(message, code)
{
}
}
[Serializable]
public class DResults<T> : DResult
{
/// <summary> 数据集合 </summary>
public IEnumerable<T> Data { get; set; }
/// <summary> 总数 </summary>
public int Total { get; set; }
/// <summary> 默认构造函数 </summary>
public DResults() : this(string.Empty) { }
public DResults(string message, int code = -1)
: base(message, code)
{
}
public DResults(IEnumerable<T> list)
: base(string.Empty)
{
var data = list as T[] ?? list.ToArray();
Data = data;
Total = data.Length;
}
public DResults(IEnumerable<T> list, int total)
: base(string.Empty)
{
Data = list;
Total = total;
}
public DResults(PagedList<T> list)
: base(string.Empty)
{
Data = list?.List ?? new T[] { };
Total = list?.Total ?? 0;
}
}
} | 26.179688 | 84 | 0.499552 |
ebc2a20266bf76d02c5d038e711f8d90da4393f9 | 4,870 | dart | Dart | dump/_test_page.dart | guchengxi1994/code-find | 0793f61643109250f01011eb500fb290e60accb6 | [
"MIT"
] | 1 | 2022-03-14T05:22:35.000Z | 2022-03-14T05:22:35.000Z | dump/_test_page.dart | guchengxi1994/a-cool-flutter-app | 0793f61643109250f01011eb500fb290e60accb6 | [
"MIT"
] | null | null | null | dump/_test_page.dart | guchengxi1994/a-cool-flutter-app | 0793f61643109250f01011eb500fb290e60accb6 | [
"MIT"
] | null | null | null | /*
* @Descripttion:
* @version:
* @Author: xiaoshuyui
* @email: guchengxi1994@qq.com
* @Date: 2022-01-30 21:46:56
* @LastEditors: xiaoshuyui
* @LastEditTime: 2022-04-14 22:06:27
*/
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:codind/entity/knowledge_entity.dart';
import 'package:codind/pages/_base_page.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import '_knowledge_preview_page.dart';
// ignore: must_be_immutable
class TestPage extends BasePage {
TestPage({Key? key, required String routeName})
: super(key: key, routeName: routeName);
@override
BasePageState<BasePage> getState() {
return _TestPageState();
}
}
class _TestPageState<T> extends BasePageState<TestPage> {
TextEditingController textEditingController = TextEditingController();
String _savedPath = "";
@override
baseBuild(BuildContext context) {
// return BaseMarkdownPreviewPage(
// from: DataFrom.asset,
// mdData: "assets/reserved_md_files/markdown_guide.md",
// );
String c1 = Color.fromARGB(255, 185, 194, 66).value.toRadixString(16);
String c2 = Color.fromARGB(255, 85, 185, 65).value.toRadixString(16);
print(c1);
print(c2);
// return Container(
// child: CoolSelectableIcon(
// mainPageCardData: MainPageCardData(
// endColor: c2, startColor: c1, titleTxt: "label.todos"),
// iconStr: "label.todos",
// ),
// );
// return CoolExpandedWidget(
// child: RadarAbilityChart(),
// );
// return KnowlegetPreviewPage(
// data: KnowledgeEntity(
// time: "2022年4月16日", title: "测试", summary: "测试测试测试测试测试测试", detail: """
// 国务院印发的《“十四五”数字经济发展规划》明确提出,鼓励个人利用社交软件、知识分享、音视频网站等新型平台就业创业,促进灵活就业、副业创新。一方面,灵活就业被看作是就业市场的“蓄水池”,为低收入者创造了更多的就业机会,对企业来说则是降本增效的方式。它也意味着对传统雇佣模式的挑战。另一方面,脱离了传统的雇佣模式,零工经济劳动者也面临着保障缺失、不稳定性增强和经济风险加大的困境。
// 去年7 月,多部委连续出台文件,要求加强对平台零工权益的保护,例如强化职业伤害保障,以出行、外卖、即时配送、同城货运等行业的平台企业为重点,组织开展试点。如何维护零工权益,正成为关注的焦点。
// """),
// );
return Scaffold(
appBar: AppBar(
title: const Text('File Saver'),
),
body: Column(
children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: textEditingController,
decoration: const InputDecoration(
labelText: "Name",
hintText: "Something",
border: OutlineInputBorder()),
),
),
),
ElevatedButton(
onPressed: () async {
if (!kIsWeb) {
if (Platform.isIOS ||
Platform.isAndroid ||
Platform.isMacOS) {
bool status = await Permission.storage.isGranted;
if (!status) await Permission.storage.request();
}
}
List<int> sheets = utf8.encode("测试数据");
Uint8List data = Uint8List.fromList(sheets);
},
child: const Text("Save File")),
if (!kIsWeb)
if (Platform.isAndroid || Platform.isIOS || Platform.isMacOS)
ElevatedButton(
onPressed: () async {
List<int> sheets = utf8.encode("测试数据");
Uint8List data = Uint8List.fromList(sheets);
// String path = await FileSaver.instance.saveAs(
// textEditingController.text == ""
// ? "File"
// : textEditingController.text,
// data,
// "custome123",
// type);
// print(path);
Directory appDocDir =
await getApplicationDocumentsDirectory();
String appDocPath = appDocDir.path;
try {
File _file = File(appDocPath + "/" + "test.file");
await _file.writeAsBytes(data);
} catch (e) {
print(e);
}
_savedPath = appDocPath + "/" + "test.file";
},
child: const Text("Generate Excel and Open Save As Dialog"),
),
ElevatedButton(
onPressed: () async {
if (_savedPath != "") {
File file = File(_savedPath);
var data = await file.readAsString();
print(data);
}
},
child: Text("测试"))
],
),
);
}
}
/// The hove page which hosts the calendar
| 31.830065 | 191 | 0.540657 |
404dcb8f01ac01551f34934e2daabf36aa4d316f | 332 | sql | SQL | databases/schemas/chat-plugins.sql | im-tofa/pokemon-showdown | d3d2bacf10881b6730bd7a29ffe9fc35417c87ee | [
"MIT"
] | 2,224 | 2015-01-01T00:45:23.000Z | 2019-11-06T18:09:25.000Z | databases/schemas/chat-plugins.sql | im-tofa/pokemon-showdown | d3d2bacf10881b6730bd7a29ffe9fc35417c87ee | [
"MIT"
] | 2,888 | 2015-01-01T17:12:11.000Z | 2019-11-06T12:17:51.000Z | databases/schemas/chat-plugins.sql | im-tofa/pokemon-showdown | d3d2bacf10881b6730bd7a29ffe9fc35417c87ee | [
"MIT"
] | 1,846 | 2015-01-01T00:33:44.000Z | 2019-11-05T16:14:37.000Z | -- Database schema for chat plugins
-- As per the design outlined at https://gist.github.com/AnnikaCodes/afa36fc8b17791be812eebbb22182426,
-- each table should be prefixed by the plugin name.
CREATE TABLE db_info (
key TEXT NOT NULL,
value TEXT NOT NULL,
PRIMARY KEY (key)
);
INSERT INTO db_info VALUES ('version', '1');
| 27.666667 | 102 | 0.737952 |
f0ff5806091977ae61acaf290b235424af9e13d6 | 8,456 | html | HTML | layouts/modelo 1.html | LuizinhoVI/TEMPLATES | 14bc7afbdab372e716e54d6699b07d2e354ea2d1 | [
"MIT"
] | 1 | 2021-09-14T22:04:16.000Z | 2021-09-14T22:04:16.000Z | layouts/modelo 1.html | LuizinhoVI/TEMPLATES | 14bc7afbdab372e716e54d6699b07d2e354ea2d1 | [
"MIT"
] | null | null | null | layouts/modelo 1.html | LuizinhoVI/TEMPLATES | 14bc7afbdab372e716e54d6699b07d2e354ea2d1 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<title>W3.CSS Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Karma">
<style>
body,
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: "Karma", sans-serif
}
.w3-bar-block .w3-bar-item {
padding: 20px
}
</style>
<body>
<!-- Sidebar (hidden by default) -->
<nav class="w3-sidebar w3-bar-block w3-card w3-top w3-xlarge w3-animate-left" style="display:none;z-index:2;width:40%;min-width:300px" id="mySidebar">
<a href="javascript:void(0)" onclick="w3_close()" class="w3-bar-item w3-button">Close Menu</a>
<a href="#food" onclick="w3_close()" class="w3-bar-item w3-button">Food</a>
<a href="#about" onclick="w3_close()" class="w3-bar-item w3-button">About</a>
</nav>
<!-- Top menu -->
<div class="w3-top">
<div class="w3-white w3-xlarge" style="max-width:1200px;margin:auto">
<div class="w3-button w3-padding-16 w3-left" onclick="w3_open()">☰</div>
<div class="w3-right w3-padding-16">Mail</div>
<div class="w3-center w3-padding-16">My Food</div>
</div>
</div>
<!-- !PAGE CONTENT! -->
<div class="w3-main w3-content w3-padding" style="max-width:1200px;margin-top:100px">
<!-- First Photo Grid-->
<div class="w3-row-padding w3-padding-16 w3-center" id="food">
<div class="w3-quarter">
<img src="/w3images/sandwich.jpg" alt="Sandwich" style="width:100%">
<h3>The Perfect Sandwich, A Real NYC Classic</h3>
<p>Just some random text, lorem ipsum text praesent tincidunt ipsum lipsum.</p>
</div>
<div class="w3-quarter">
<img src="/w3images/steak.jpg" alt="Steak" style="width:100%">
<h3>Let Me Tell You About This Steak</h3>
<p>Once again, some random text to lorem lorem lorem lorem ipsum text praesent tincidunt ipsum lipsum.</p>
</div>
<div class="w3-quarter">
<img src="/w3images/cherries.jpg" alt="Cherries" style="width:100%">
<h3>Cherries, interrupted</h3>
<p>Lorem ipsum text praesent tincidunt ipsum lipsum.</p>
<p>What else?</p>
</div>
<div class="w3-quarter">
<img src="/w3images/wine.jpg" alt="Pasta and Wine" style="width:100%">
<h3>Once Again, Robust Wine and Vegetable Pasta</h3>
<p>Lorem ipsum text praesent tincidunt ipsum lipsum.</p>
</div>
</div>
<!-- Second Photo Grid-->
<div class="w3-row-padding w3-padding-16 w3-center">
<div class="w3-quarter">
<img src="/w3images/popsicle.jpg" alt="Popsicle" style="width:100%">
<h3>All I Need Is a Popsicle</h3>
<p>Lorem ipsum text praesent tincidunt ipsum lipsum.</p>
</div>
<div class="w3-quarter">
<img src="/w3images/salmon.jpg" alt="Salmon" style="width:100%">
<h3>Salmon For Your Skin</h3>
<p>Once again, some random text to lorem lorem lorem lorem ipsum text praesent tincidunt ipsum lipsum.</p>
</div>
<div class="w3-quarter">
<img src="/w3images/sandwich.jpg" alt="Sandwich" style="width:100%">
<h3>The Perfect Sandwich, A Real Classic</h3>
<p>Just some random text, lorem ipsum text praesent tincidunt ipsum lipsum.</p>
</div>
<div class="w3-quarter">
<img src="/w3images/croissant.jpg" alt="Croissant" style="width:100%">
<h3>Le French</h3>
<p>Lorem lorem lorem lorem ipsum text praesent tincidunt ipsum lipsum.</p>
</div>
</div>
<!-- Pagination -->
<div class="w3-center w3-padding-32">
<div class="w3-bar">
<a href="#" class="w3-bar-item w3-button w3-hover-black">«</a>
<a href="#" class="w3-bar-item w3-black w3-button">1</a>
<a href="#" class="w3-bar-item w3-button w3-hover-black">2</a>
<a href="#" class="w3-bar-item w3-button w3-hover-black">3</a>
<a href="#" class="w3-bar-item w3-button w3-hover-black">4</a>
<a href="#" class="w3-bar-item w3-button w3-hover-black">»</a>
</div>
</div>
<hr id="about">
<!-- About Section -->
<div class="w3-container w3-padding-32 w3-center">
<h3>About Me, The Food Man</h3><br>
<img src="/w3images/chef.jpg" alt="Me" class="w3-image" style="display:block;margin:auto" width="800" height="533">
<div class="w3-padding-32">
<h4><b>I am Who I Am!</b></h4>
<h6><i>With Passion For Real, Good Food</i></h6>
<p>Just me, myself and I, exploring the universe of unknownment. I have a heart of love and an interest of lorem ipsum and mauris neque quam blog. I want to share my world with you. Praesent tincidunt sed tellus ut rutrum. Sed vitae justo
condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla. Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.</p>
</div>
</div>
<hr>
<!-- Footer -->
<footer class="w3-row-padding w3-padding-32">
<div class="w3-third">
<h3>FOOTER</h3>
<p>Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.</p>
<p>Powered by <a href="https://www.w3schools.com/w3css/default.asp" target="_blank">w3.css</a></p>
</div>
<div class="w3-third">
<h3>BLOG POSTS</h3>
<ul class="w3-ul w3-hoverable">
<li class="w3-padding-16">
<img src="/w3images/workshop.jpg" class="w3-left w3-margin-right" style="width:50px">
<span class="w3-large">Lorem</span><br>
<span>Sed mattis nunc</span>
</li>
<li class="w3-padding-16">
<img src="/w3images/gondol.jpg" class="w3-left w3-margin-right" style="width:50px">
<span class="w3-large">Ipsum</span><br>
<span>Praes tinci sed</span>
</li>
</ul>
</div>
<div class="w3-third w3-serif">
<h3>POPULAR TAGS</h3>
<p>
<span class="w3-tag w3-black w3-margin-bottom">Travel</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">New York</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Dinner</span>
<span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Salmon</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">France</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Drinks</span>
<span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Ideas</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Flavors</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Cuisine</span>
<span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Chicken</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Dressing</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Fried</span>
<span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Fish</span> <span class="w3-tag w3-dark-grey w3-small w3-margin-bottom">Duck</span>
</p>
</div>
</footer>
<!-- End page content -->
</div>
<script>
// Script to open and close sidebar
function w3_open() {
document.getElementById("mySidebar").style.display = "block";
}
function w3_close() {
document.getElementById("mySidebar").style.display = "none";
}
</script>
</body>
</html> | 48.878613 | 254 | 0.558065 |
224490ac7d41e937a66fc658befb5b76a94befd4 | 630 | swift | Swift | Pods/ImagePicker/Source/ImageGallery/ImageGalleryLayout.swift | RohanNagar/pilot-ios | 67a4395d19d4a7f7f2a549083adcf2eec08be55e | [
"MIT"
] | 2 | 2018-12-19T05:47:17.000Z | 2019-05-16T10:20:29.000Z | Pods/ImagePicker/Source/ImageGallery/ImageGalleryLayout.swift | RohanNagar/pilot-ios | 67a4395d19d4a7f7f2a549083adcf2eec08be55e | [
"MIT"
] | 39 | 2017-09-02T21:40:47.000Z | 2018-01-25T21:17:12.000Z | Pods/ImagePicker/Source/ImageGallery/ImageGalleryLayout.swift | RohanNagar/pilot-ios | 67a4395d19d4a7f7f2a549083adcf2eec08be55e | [
"MIT"
] | 1 | 2019-04-06T13:06:53.000Z | 2019-04-06T13:06:53.000Z | import UIKit
class ImageGalleryLayout: UICollectionViewFlowLayout {
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
guard let attributes = super.layoutAttributesForElements(in: rect) else {
return super.layoutAttributesForElements(in: rect)
}
var newAttributes = [UICollectionViewLayoutAttributes]()
for attribute in attributes {
// swiftlint:disable force_cast
let n = attribute.copy() as! UICollectionViewLayoutAttributes
n.transform = Helper.rotationTransform()
newAttributes.append(n)
}
return newAttributes
}
}
| 30 | 101 | 0.742857 |
8f917b2ea5043b80764843f082b5713342f9125c | 1,005 | dart | Dart | mobile/sn/lib/ui/widgets/comment/addcommentwidget.dart | ouldevloper/TMP_2mda_Project | a5f9657403ae196a75ea76d0837a435e6e34e4b3 | [
"MIT"
] | null | null | null | mobile/sn/lib/ui/widgets/comment/addcommentwidget.dart | ouldevloper/TMP_2mda_Project | a5f9657403ae196a75ea76d0837a435e6e34e4b3 | [
"MIT"
] | null | null | null | mobile/sn/lib/ui/widgets/comment/addcommentwidget.dart | ouldevloper/TMP_2mda_Project | a5f9657403ae196a75ea76d0837a435e6e34e4b3 | [
"MIT"
] | null | null | null | import 'package:flutter/material.dart';
class AddCommentWidget extends StatelessWidget {
final Function send;
final TextEditingController controller;
const AddCommentWidget({required this.send, required this.controller});
@override
Widget build(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(left: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20), topRight: Radius.circular(20)),
color: Colors.grey.shade300,
border: Border.all(width: 0, color: Colors.white),
),
child: TextField(
controller: controller,
decoration: InputDecoration(
hintText: "Tap Message ...",
border: InputBorder.none,
suffixIcon: IconButton(
onPressed: () {
send();
},
icon: Icon(Icons.send)))),
);
}
}
| 31.40625 | 73 | 0.602985 |
70837e386ef09b7a8b0efe782dcc3d56bc65a94f | 600 | sql | SQL | datacamp-master/intro-to-sql-for-data-science/03-aggregate-functions/04-a-note-on-arithmetic.sql | vitthal10/datacamp | 522d2b192656f7f6563bf6fc33471b048f1cf029 | [
"MIT"
] | 1 | 2021-01-31T20:51:10.000Z | 2021-01-31T20:51:10.000Z | 12intro-to-sql-for-data-science/03-aggregate-functions/04-a-note-on-arithmetic.sql | AndreasFerox/DataCamp | 41525d7252f574111f4929158da1498ee1e73a84 | [
"MIT"
] | null | null | null | 12intro-to-sql-for-data-science/03-aggregate-functions/04-a-note-on-arithmetic.sql | AndreasFerox/DataCamp | 41525d7252f574111f4929158da1498ee1e73a84 | [
"MIT"
] | 1 | 2021-08-08T05:09:52.000Z | 2021-08-08T05:09:52.000Z | /*
In addition to using aggregate functions, you can perform basic arithmetic with symbols like +, -, *, and /.
So, for example, this gives a result of 12:
SELECT (4 * 3);
However, the following gives a result of 1:
SELECT (4 / 3);
What's going on here?
SQL assumes that if you divide an integer by an integer, you want to get an integer back. So be careful when dividing!
If you want more precision when dividing, you can add decimal places to your numbers. For example,
SELECT (4.0 / 3.0) AS result;
gives you the result you would expect: 1.333.
What is the result of SELECT (10 / 3);?
*/
3 | 27.272727 | 118 | 0.718333 |
3bcd10104e610cd064501b26d78dcba2736e40ba | 1,056 | html | HTML | manuscript/page-122/body.html | marvindanig/boswells-life-of-johnson | bc005ae514b009bb519bef5df6b52ed136cf3e5c | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | manuscript/page-122/body.html | marvindanig/boswells-life-of-johnson | bc005ae514b009bb519bef5df6b52ed136cf3e5c | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | manuscript/page-122/body.html | marvindanig/boswells-life-of-johnson | bc005ae514b009bb519bef5df6b52ed136cf3e5c | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | <div class="leaf flex"><div class="inner justify"><p class="no-indent ">chimney-piece. It seized his attention so strongly, that, not being able to lay down the book till he had finished it, when he attempted to move, he found his arm totally benumbed. The rapidity with which this work was composed, is a wonderful circumstance. Johnson has been heard to say, 'I wrote forty-eight of the printed octavo pages of the Life of Savage at a sitting; but then I sat up all night.'</p><p class=" stretch-last-line ">It is remarkable, that in this biographical disquisition there appears a very strong symptom of Johnson's prejudice against players; a prejudice which may be attributed to the following causes: first, the imperfection of his organs, which were so defective that he was not susceptible of the fine impressions which theatrical excellence produces upon the generality of mankind; secondly, the cold rejection of his tragedy; and, lastly, the brilliant success of Garrick, who had been his pupil, who had come to London at the same</p></div> </div> | 1,056 | 1,056 | 0.783144 |
fb874697fda70620737b4a151f714ab3ba006154 | 268 | java | Java | byte-buddy-dep/src/main/java/net/bytebuddy/instrumentation/method/bytecode/stack/collection/package-info.java | cybernetics/byte-buddy | 6ff835577230c1a5e073159c8f5e906364cdea8d | [
"Apache-2.0"
] | 1 | 2019-04-22T08:48:44.000Z | 2019-04-22T08:48:44.000Z | byte-buddy-dep/src/main/java/net/bytebuddy/instrumentation/method/bytecode/stack/collection/package-info.java | cybernetics/byte-buddy | 6ff835577230c1a5e073159c8f5e906364cdea8d | [
"Apache-2.0"
] | null | null | null | byte-buddy-dep/src/main/java/net/bytebuddy/instrumentation/method/bytecode/stack/collection/package-info.java | cybernetics/byte-buddy | 6ff835577230c1a5e073159c8f5e906364cdea8d | [
"Apache-2.0"
] | null | null | null | /**
* This package is dedicated to creating {@link net.bytebuddy.instrumentation.method.bytecode.stack.StackManipulation}s
* that create collections or arrays from a given number of values.
*/
package net.bytebuddy.instrumentation.method.bytecode.stack.collection;
| 44.666667 | 119 | 0.80597 |
6831fcf52e38019871b1b8ecf3a4b1bfcdc4d068 | 1,872 | html | HTML | _publications/2022-covidcast.html | domoritz/lab-website | 32b61067d82df57b01c6455a483aabb7e6a076b2 | [
"Apache-2.0"
] | null | null | null | _publications/2022-covidcast.html | domoritz/lab-website | 32b61067d82df57b01c6455a483aabb7e6a076b2 | [
"Apache-2.0"
] | null | null | null | _publications/2022-covidcast.html | domoritz/lab-website | 32b61067d82df57b01c6455a483aabb7e6a076b2 | [
"Apache-2.0"
] | null | null | null | ---
layout: publication
year: 2022
title: "An open repository of real-time COVID-19 indicators"
highlight: true
authors:
- DELPHI Research Group
# - Alex Reinhart
# - Logan Brooks
# - Maria Jahja
# - Aaron Rumack
# - Jingjing Tang
# - et al.
doi: 10.1073/pnas.2111452118
type:
- Journal
venue: PNAS
venue_tags:
- PNAS
venue_url: https://www.pnas.org/
tags:
- Data Science
- Visualization
link: https://delphi.cmu.edu/covidcast/
pdf: "https://www.pnas.org/content/pnas/118/51/e2111452118.full.pdf"
---
The COVID-19 pandemic presented enormous data challenges in the United States.
Policy makers, epidemiological modelers, and health researchers all require
up-to-date data on the pandemic and relevant public behavior, ideally at fine
spatial and temporal resolution. The COVIDcast API is our attempt to fill this
need: Operational since April 2020, it provides open access to both traditional
public health surveillance signals (cases, deaths, and hospitalizations) and
many auxiliary indicators of COVID-19 activity, such as signals extracted from
deidentified medical claims data, massive online surveys, cell phone mobility
data, and internet search trends. These are available at a fine geographic
resolution (mostly at the county level) and are updated daily. The COVIDcast API
also tracks all revisions to historical data, allowing modelers to account for
the frequent revisions and backfill that are common for many public health data
sources. All of the data are available in a common format through the API and
accompanying R and Python software packages. This paper describes the data
sources and signals, and provides examples demonstrating that the auxiliary
signals in the COVIDcast API present information relevant to tracking COVID
activity, augmenting traditional public health reporting and empowering research
and decision-making.
| 40.695652 | 80 | 0.793803 |
a42623196c2de5bbe635019c2364ebcdca1fffa1 | 2,851 | swift | Swift | Sources/Swiftest/Foundation/Extensions/String/String+ContentParsing.swift | Appsaurus/Swiftest | 58eaccbc94351d7c7646c96a76f07cb77a613bde | [
"MIT"
] | 1 | 2019-04-25T08:05:07.000Z | 2019-04-25T08:05:07.000Z | Sources/Swiftest/Foundation/Extensions/String/String+ContentParsing.swift | Appsaurus/Swiftest | 58eaccbc94351d7c7646c96a76f07cb77a613bde | [
"MIT"
] | null | null | null | Sources/Swiftest/Foundation/Extensions/String/String+ContentParsing.swift | Appsaurus/Swiftest | 58eaccbc94351d7c7646c96a76f07cb77a613bde | [
"MIT"
] | null | null | null | //
// String+ContentParsing.swift
// Swiftest
//
// Created by Brian Strobach on 12/18/18.
//
#if canImport(Foundation)
import Foundation
extension String {
/// Swiftest: an array of all words in a string
///
/// "Swift is amazing".words() -> ["Swift", "is", "amazing"]
///
/// - Returns: The words contained in a string.
public func words() -> [String] {
// https://stackoverflow.com/questions/42822838
let chararacterSet = CharacterSet.whitespacesAndNewlines.union(.punctuationCharacters)
let comps = components(separatedBy: chararacterSet)
return comps.filter { !$0.isEmpty }
}
/// Swiftest: Array of strings separated by new lines.
///
/// "Hello\ntest".lines() -> ["Hello", "test"]
///
/// - Returns: Strings separated by new lines.
public func lines() -> [String] {
var result = [String]()
enumerateLines { line, _ in
result.append(line)
}
return result
}
#if !os(Linux)
public func tokenize() -> [String] {
let inputRange = fullIndexRange.toNSRange(self).cfRange
let flag = UInt(kCFStringTokenizerUnitWord)
let locale = CFLocaleCopyCurrent()
let tokenizer = CFStringTokenizerCreate( kCFAllocatorDefault, self as CFString?, inputRange, flag, locale)
var tokenType = CFStringTokenizerAdvanceToNextToken(tokenizer)
var tokens: [String] = []
while tokenType != CFStringTokenizerTokenType() {
let currentTokenRange = CFStringTokenizerGetCurrentTokenRange(tokenizer)
let substring = self.subString(currentTokenRange.nsRange)
tokens.append(substring)
tokenType = CFStringTokenizerAdvanceToNextToken(tokenizer)
}
return tokens
}
public func initials(_ count: Int? = nil) -> String {
let words = self.tokenize()
let intialsCount = count != nil ? min(count!, words.count) : words.count
var initials = ""
for word in words[0...intialsCount - 1] where !word.isEmpty {
initials.append(word.first!)
}
return initials
}
#endif
}
extension String {
public func wordCounts() -> [String: Int] {
var counts: [String: Int] = [:]
for word in self.words() {
counts[word] = (counts[word] ?? 0) + 1
}
return counts
}
}
extension Collection where Element == String {
public func wordCounts() -> [String: Int] {
var counts: [String: Int] = [:]
for element in self {
let elementCount = element.wordCounts()
for count in elementCount {
counts[count.key] = (counts[count.key] ?? 0) + count.value
}
}
return counts
}
}
#endif
| 29.391753 | 114 | 0.587513 |
83e1c0d7ef5c863bd46db1a4f8ac0b5457799095 | 2,743 | go | Go | pkg/paymentd/config/sql.go | wongak/paymentd | b3f3fbb80176bc882e6e7ca21b0e56aea81add64 | [
"Apache-2.0"
] | null | null | null | pkg/paymentd/config/sql.go | wongak/paymentd | b3f3fbb80176bc882e6e7ca21b0e56aea81add64 | [
"Apache-2.0"
] | null | null | null | pkg/paymentd/config/sql.go | wongak/paymentd | b3f3fbb80176bc882e6e7ca21b0e56aea81add64 | [
"Apache-2.0"
] | null | null | null | package config
import (
"database/sql"
"time"
)
const selectEntryCountByName = `
SELECT COUNT(*) FROM config
WHERE
name = ?
AND
last_change = (
SELECT MAX(last_change) FROM config AS mc
WHERE mc.name = name
)
`
const selectEntryByName = `
SELECT
c.name,
c.last_change,
c.value
FROM config AS c
WHERE
c.name = ?
AND
c.last_change = (
SELECT MAX(last_change) FROM config AS mc
WHERE mc.name = c.name
)
`
func readSingleEntry(row *sql.Row) (Entry, error) {
e := Entry{}
var ts int64
err := row.Scan(&e.Name, &ts, &e.Value)
if err != nil {
if err == sql.ErrNoRows {
return e, ErrEntryNotFound
}
return e, err
}
e.lastChange = time.Unix(0, ts)
return e, nil
}
// EntryByNameDB selects the current configuration entry for the given name
// If the name is not present, it returns nil
func EntryByNameDB(db *sql.DB, name string) (Entry, error) {
row := db.QueryRow(selectEntryByName, name)
return readSingleEntry(row)
}
// EntryByNameTx selects the current configuration entry for the given name
// If the name is not present, it returns nil
//
// This function should be used inside a (SQL-)transaction
func EntryByNameTx(db *sql.Tx, name string) (Entry, error) {
row := db.QueryRow(selectEntryByName, name)
return readSingleEntry(row)
}
const insertEntry = `
INSERT INTO config
(name, last_change, value)
VALUES
(?, ?, ?)
`
// InsertEntryDB inserts an entry
func InsertEntryDB(db *sql.DB, e Entry) error {
stmt, err := db.Prepare(insertEntry)
if err != nil {
return err
}
t := time.Now()
_, err = stmt.Exec(e.Name, t.UnixNano(), e.Value)
stmt.Close()
return err
}
// InsertConfigTx saves a config set
//
// This function should be used inside a (SQL-)transaction
func InsertConfigTx(db *sql.Tx, cfg Config) error {
stmt, err := db.Prepare(insertEntry)
if err != nil {
return err
}
t := time.Now()
for n, v := range cfg {
_, err = stmt.Exec(n, t.UnixNano(), v)
if err != nil {
stmt.Close()
return err
}
}
stmt.Close()
return nil
}
// InsertConfigIfNotPresentTx saves a config set if the names are not present
//
// This funtion should be used inside a (SQL-)transaction
func InsertConfigIfNotPresentTx(db *sql.Tx, cfg Config) error {
checkExists, err := db.Prepare(selectEntryCountByName)
if err != nil {
return err
}
defer checkExists.Close()
insert, err := db.Prepare(insertEntry)
if err != nil {
return err
}
defer insert.Close()
var exists *sql.Row
var numEntries int
t := time.Now()
for n, v := range cfg {
exists = checkExists.QueryRow(n)
err = exists.Scan(&numEntries)
if err != nil {
return err
}
if numEntries > 0 {
continue
}
_, err = insert.Exec(n, t.UnixNano(), v)
if err != nil {
return err
}
}
return nil
}
| 20.169118 | 77 | 0.678819 |
4b4c7d9b56826d0762d2a0f576f616dcb765bbb8 | 6,526 | go | Go | cmd/gitmirror/gitmirror_test.go | TheNagaPraneeth/build | cb8ca68240b96ca471f50d143f942f99e6807bbd | [
"BSD-3-Clause"
] | 552 | 2015-01-21T07:16:11.000Z | 2022-03-30T09:15:52.000Z | cmd/gitmirror/gitmirror_test.go | TheNagaPraneeth/build | cb8ca68240b96ca471f50d143f942f99e6807bbd | [
"BSD-3-Clause"
] | 41 | 2017-01-26T22:37:36.000Z | 2022-03-31T21:00:01.000Z | cmd/gitmirror/gitmirror_test.go | LaudateCorpus1/build-1 | 015a2a0c58f3fc64338578db6bb6b03627548d42 | [
"BSD-3-Clause"
] | 153 | 2015-02-13T16:01:53.000Z | 2022-03-16T15:42:24.000Z | // Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"golang.org/x/build/internal/envutil"
repospkg "golang.org/x/build/repos"
)
func TestHomepage(t *testing.T) {
tm := newTestMirror(t)
if body := tm.get("/"); !strings.Contains(body, "build") {
t.Errorf("expected body to contain \"build\", didn't: %q", body)
}
}
func TestDebugWatcher(t *testing.T) {
tm := newTestMirror(t)
tm.commit("hello world")
tm.loopOnce()
body := tm.get("/debug/watcher/build")
if substr := `watcher status for repo: "build"`; !strings.Contains(body, substr) {
t.Fatalf("GET /debug/watcher/build: want %q in body, got %s", substr, body)
}
if substr := "waiting"; !strings.Contains(body, substr) {
t.Fatalf("GET /debug/watcher/build: want %q in body, got %s", substr, body)
}
}
func TestArchive(t *testing.T) {
tm := newTestMirror(t)
// Start with a revision we know about.
tm.commit("hello world")
initialRev := strings.TrimSpace(tm.git(tm.gerrit, "rev-parse", "HEAD"))
tm.loopOnce() // fetch the commit.
tm.get("/build.tar.gz?rev=" + initialRev)
// Now test one we don't see yet. It will be fetched automatically.
tm.commit("round two")
secondRev := strings.TrimSpace(tm.git(tm.gerrit, "rev-parse", "HEAD"))
// As of writing, the git version installed on the builders has some kind
// of bug that prevents the "git fetch" this triggers from working. Skip.
if strings.HasPrefix(tm.git(tm.gerrit, "version"), "git version 2.11") {
t.Skip("known-buggy git version")
}
tm.get("/build.tar.gz?rev=" + secondRev)
// Pick it up normally and re-fetch it to make sure we don't get confused.
tm.loopOnce()
tm.get("/build.tar.gz?rev=" + secondRev)
}
func TestMirror(t *testing.T) {
tm := newTestMirror(t)
for i := 0; i < 2; i++ {
tm.commit(fmt.Sprintf("revision %v", i))
rev := tm.git(tm.gerrit, "rev-parse", "HEAD")
tm.loopOnce()
if githubRev := tm.git(tm.github, "rev-parse", "HEAD"); rev != githubRev {
t.Errorf("github HEAD is %v, want %v", githubRev, rev)
}
if csrRev := tm.git(tm.csr, "rev-parse", "HEAD"); rev != csrRev {
t.Errorf("csr HEAD is %v, want %v", csrRev, rev)
}
}
}
// Tests that mirroring an initially empty repository works. See golang/go#39597.
// The repository still has to exist.
func TestMirrorInitiallyEmpty(t *testing.T) {
tm := newTestMirror(t)
if err := tm.m.repos["build"].loopOnce(); err == nil {
t.Error("expected error mirroring empty repository, got none")
}
tm.commit("first commit")
tm.loopOnce()
rev := tm.git(tm.gerrit, "rev-parse", "HEAD")
if githubRev := tm.git(tm.github, "rev-parse", "HEAD"); rev != githubRev {
t.Errorf("github HEAD is %v, want %v", githubRev, rev)
}
}
type testMirror struct {
gerrit, github, csr string
m *gitMirror
server *httptest.Server
buildRepo *repo
t *testing.T
}
// newTestMirror returns a mirror configured to watch the "build" repository
// and mirror it to GitHub and CSR. All repositories are faked out with local
// versions created hermetically. The mirror is idle and must be pumped with
// loopOnce.
func newTestMirror(t *testing.T) *testMirror {
if _, err := exec.LookPath("git"); err != nil {
t.Skip("skipping; git not in PATH")
}
tm := &testMirror{
gerrit: t.TempDir(),
github: t.TempDir(),
csr: t.TempDir(),
m: &gitMirror{
mux: http.NewServeMux(),
cacheDir: t.TempDir(),
homeDir: t.TempDir(),
repos: map[string]*repo{},
mirrorGitHub: true,
mirrorCSR: true,
timeoutScale: 0,
},
t: t,
}
tm.m.mux.HandleFunc("/", tm.m.handleRoot)
tm.server = httptest.NewServer(tm.m.mux)
t.Cleanup(tm.server.Close)
// Write a git config with each of the relevant repositories replaced by a
// local version. The origin is non-bare so we can commit to it; the
// destinations are bare so we can push to them.
gitConfig := &bytes.Buffer{}
overrideRepo := func(fromURL, toDir string, bare bool) {
initArgs := []string{"init"}
if bare {
initArgs = append(initArgs, "--bare")
}
for _, args := range [][]string{
initArgs,
{"config", "user.name", "Gopher"},
{"config", "user.email", "gopher@golang.org"},
} {
cmd := exec.Command("git", args...)
envutil.SetDir(cmd, toDir)
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, out)
}
}
fmt.Fprintf(gitConfig, "[url %q]\n insteadOf = %v\n", toDir, fromURL)
}
overrideRepo("https://go.googlesource.com/build", tm.gerrit, false)
overrideRepo("git@github.com:golang/build.git", tm.github, true)
overrideRepo("https://source.developers.google.com/p/golang-org/r/build", tm.csr, true)
if err := os.MkdirAll(filepath.Join(tm.m.homeDir, ".config/git"), 0777); err != nil {
t.Fatal(err)
}
if err := ioutil.WriteFile(filepath.Join(tm.m.homeDir, ".config/git/config"), gitConfig.Bytes(), 0777); err != nil {
t.Fatal(err)
}
tm.buildRepo = tm.m.addRepo(&repospkg.Repo{
GoGerritProject: "build",
ImportPath: "golang.org/x/build",
MirrorToGitHub: true,
GitHubRepo: "golang/build",
MirrorToCSRProject: "golang-org",
})
if err := tm.buildRepo.init(); err != nil {
t.Fatal(err)
}
if err := tm.m.addMirrors(); err != nil {
t.Fatal(err)
}
return tm
}
func (tm *testMirror) loopOnce() {
tm.t.Helper()
if err := tm.buildRepo.loopOnce(); err != nil {
tm.t.Fatal(err)
}
}
func (tm *testMirror) commit(content string) {
tm.t.Helper()
if err := ioutil.WriteFile(filepath.Join(tm.gerrit, "README"), []byte(content), 0777); err != nil {
tm.t.Fatal(err)
}
tm.git(tm.gerrit, "add", ".")
tm.git(tm.gerrit, "commit", "-m", content)
}
func (tm *testMirror) git(dir string, args ...string) string {
tm.t.Helper()
cmd := exec.Command("git", args...)
envutil.SetDir(cmd, dir)
out, err := cmd.CombinedOutput()
if err != nil {
tm.t.Fatalf("git: %v, %s", err, out)
}
return string(out)
}
func (tm *testMirror) get(path string) string {
tm.t.Helper()
resp, err := http.Get(tm.server.URL + path)
if err != nil {
tm.t.Fatal(err)
}
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
tm.t.Fatal(err)
}
if resp.StatusCode != http.StatusOK {
tm.t.Fatalf("request for %q failed", path)
}
return string(body)
}
| 28.876106 | 117 | 0.646491 |
e3a1fab5990427e6c10332f7d0a9a49f4d04c535 | 335 | kt | Kotlin | src/main/kotlin/org/rust/lang/core/psi/ext/RsPatTupleStruct.kt | goncaloperes/intellij-rust | af31c6c717862562891bc5777e8571afc5a6be0a | [
"MIT"
] | 4,168 | 2015-11-28T19:55:12.000Z | 2022-03-31T18:47:12.000Z | src/main/kotlin/org/rust/lang/core/psi/ext/RsPatTupleStruct.kt | goncaloperes/intellij-rust | af31c6c717862562891bc5777e8571afc5a6be0a | [
"MIT"
] | 8,336 | 2015-11-28T11:40:22.000Z | 2022-03-31T15:56:54.000Z | src/main/kotlin/org/rust/lang/core/psi/ext/RsPatTupleStruct.kt | goncaloperes/intellij-rust | af31c6c717862562891bc5777e8571afc5a6be0a | [
"MIT"
] | 522 | 2015-11-28T17:17:39.000Z | 2022-03-07T07:09:06.000Z | /*
* Use of this source code is governed by the MIT license that can be
* found in the LICENSE file.
*/
package org.rust.lang.core.psi.ext
import org.rust.lang.core.psi.RsPatRest
import org.rust.lang.core.psi.RsPatTupleStruct
val RsPatTupleStruct.patRest: RsPatRest? get() = patList.firstOrNull { it is RsPatRest } as? RsPatRest
| 27.916667 | 102 | 0.761194 |
576df6f1affb446885e8c5b59cd49f20593e651a | 1,278 | go | Go | models/exact_match_session_baseable.go | microsoftgraph/msgraph-beta-sdk-go | aa0e88784f9ae169fe97d86df95e5a34e7ce401e | [
"MIT"
] | 4 | 2021-11-23T07:58:53.000Z | 2022-02-20T06:58:06.000Z | models/exact_match_session_baseable.go | microsoftgraph/msgraph-beta-sdk-go | aa0e88784f9ae169fe97d86df95e5a34e7ce401e | [
"MIT"
] | 28 | 2021-11-03T20:05:54.000Z | 2022-03-25T04:34:36.000Z | models/exact_match_session_baseable.go | microsoftgraph/msgraph-beta-sdk-go | aa0e88784f9ae169fe97d86df95e5a34e7ce401e | [
"MIT"
] | 2 | 2021-11-21T14:30:10.000Z | 2022-03-17T01:13:04.000Z | package models
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// ExactMatchSessionBaseable
type ExactMatchSessionBaseable interface {
ExactMatchJobBaseable
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
GetDataStoreId()(*string)
GetProcessingCompletionDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
GetRemainingBlockCount()(*int32)
GetRemainingJobCount()(*int32)
GetState()(*string)
GetTotalBlockCount()(*int32)
GetTotalJobCount()(*int32)
GetUploadCompletionDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
SetDataStoreId(value *string)()
SetProcessingCompletionDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)()
SetRemainingBlockCount(value *int32)()
SetRemainingJobCount(value *int32)()
SetState(value *string)()
SetTotalBlockCount(value *int32)()
SetTotalJobCount(value *int32)()
SetUploadCompletionDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)()
}
| 44.068966 | 128 | 0.823161 |
e8236c0f26dd94daac2c07213f92c252fa1d4708 | 3,319 | cpp | C++ | Legacy/TempSymbolTable.cpp | avinash-vk/mini-golang-compiler | 4d1c3096f8cde9097bb66184b740607150fe68fb | [
"MIT"
] | 4 | 2021-03-01T14:53:13.000Z | 2021-04-08T12:19:14.000Z | Legacy/TempSymbolTable.cpp | avinash-vk/mini-golang-compiler | 4d1c3096f8cde9097bb66184b740607150fe68fb | [
"MIT"
] | null | null | null | Legacy/TempSymbolTable.cpp | avinash-vk/mini-golang-compiler | 4d1c3096f8cde9097bb66184b740607150fe68fb | [
"MIT"
] | 2 | 2021-04-14T09:43:15.000Z | 2021-04-22T14:11:19.000Z | #include <bits/stdc++.h>
#include "SymbolTable.h"
using namespace std;
int curr_token_id=0;
struct SymbTab *first, *last;
struct SymbTab* Search(char lab[])
{
int i, flag = 0;
struct SymbTab *symbol_entry;
symbol_entry = first;
//printf("Inside Search, before loop");
for (i = 0; i < curr_token_id; i++)
{
//printf("Inside search loop\n");
//printf("%s %s\n",symbol_entry->symbol, lab);
if (strcmp(symbol_entry->symbol, lab) == 0)
{ return symbol_entry;
//printf("MATCH");
}
symbol_entry = symbol_entry->next;
}
return NULL;
};
void Insert(char symbol[], int line_no, char symbol_type[])
{
struct SymbTab* n;
// search for the symbol in the table
n = Search(symbol);
// if token already exists in the symbol table
if (n)
{
n->lines[n->line_count] = line_no;
n->line_count++;
}
else{
// If token does not exist in the table
struct SymbTab *symbol_entry;
symbol_entry = (SymbTab*) malloc(sizeof(struct SymbTab));
// Token Label as TK<NO>
string token_id = "TK_" + to_string(curr_token_id);
cout <<"type,size " << symbol_type << sizeof(symbol) << sizeof(symbol[0]) << endl;
symbol_entry->token_id = (char*)malloc(sizeof(char)*20);
symbol_entry->symbol_type = (char*)malloc(sizeof(char)*100);
symbol_entry->symbol = (char*)malloc(sizeof(char)*100);
strcpy(symbol_entry->token_id,(char *)token_id.c_str());
// Token read
strcpy(symbol_entry->symbol, symbol);
strcpy(symbol_entry->symbol_type,symbol_type);
// Updating line count
symbol_entry->lines[0] = line_no;
symbol_entry->line_count=1;
symbol_entry->next = NULL;
// Updating the HEAD and TAIL for the symbol table
if (curr_token_id == 0)
{
first = symbol_entry;
last = symbol_entry;
}
else
{
last->next = symbol_entry;
last = symbol_entry;
}
if(symbol_type=="T_IDENTIFIER"){
Identifier* new_identifier = (Identifier*)malloc(sizeof(Identifier));
new_identifier->data_type = 0;
symbol_entry->identifier = new_identifier;
}
else {
symbol_entry->identifier=NULL;
}
// Updating the next incoming token_id
curr_token_id++;
}
}
void Display()
{
int i;
struct SymbTab *symbol_entry;
symbol_entry = first;
for(int i=0;i<65;i++)
printf("-");
printf("\n LABEL\t | SYMBOL\t\t | SYMBOL_TYPE\t | ADDRESS\n");
for(int i=0;i<65;i++)
printf("-");
cout << endl;
for (i = 0; i < curr_token_id; i++)
{
printf(" %-8s | %-20s | %-20s | ", symbol_entry->token_id, symbol_entry->symbol,symbol_entry->symbol_type);
for (int i=0;i<symbol_entry->line_count;i++){
printf("%d,",symbol_entry->lines[i]);
}
printf("\n");
symbol_entry = symbol_entry->next;
}
for(int i=0;i<65;i++)
printf("-");
cout << endl;
} | 29.633929 | 116 | 0.53721 |
5205ab5ff715a70a18ce9a60556b6d5c34812b6e | 697 | go | Go | main.go | BearerPipelineTest/hub | 363513a0f822a8bde5b620e5de183702280d4ace | [
"MIT"
] | null | null | null | main.go | BearerPipelineTest/hub | 363513a0f822a8bde5b620e5de183702280d4ace | [
"MIT"
] | null | null | null | main.go | BearerPipelineTest/hub | 363513a0f822a8bde5b620e5de183702280d4ace | [
"MIT"
] | null | null | null | //go:build go1.8
// +build go1.8
package main
import (
"os"
"os/exec"
"syscall"
"github.com/github/hub/v2/commands"
"github.com/github/hub/v2/github"
"github.com/github/hub/v2/ui"
)
func main() {
defer github.CaptureCrash()
err := commands.CmdRunner.Execute(os.Args)
exitCode := handleError(err)
os.Exit(exitCode)
}
func handleError(err error) int {
if err == nil {
return 0
}
switch e := err.(type) {
case *exec.ExitError:
if status, ok := e.Sys().(syscall.WaitStatus); ok {
return status.ExitStatus()
}
return 1
case *commands.ErrHelp:
ui.Println(err)
return 0
default:
if errString := err.Error(); errString != "" {
ui.Errorln(err)
}
return 1
}
}
| 15.840909 | 53 | 0.651363 |
56cc9f15f094c93076d8898d85e0038044ec4141 | 7,424 | html | HTML | Login.html | gbrandon2/Landing | eec4cecd9570e54d2c794cebe85f2c1ae2046137 | [
"MIT"
] | null | null | null | Login.html | gbrandon2/Landing | eec4cecd9570e54d2c794cebe85f2c1ae2046137 | [
"MIT"
] | null | null | null | Login.html | gbrandon2/Landing | eec4cecd9570e54d2c794cebe85f2c1ae2046137 | [
"MIT"
] | null | null | null | <html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Landing Page - Start Bootstrap Theme</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet">
<link href="vendor/simple-line-icons/css/simple-line-icons.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
<!-- Custom styles for this template -->
<link href="css/landing-page.min.css" rel="stylesheet">
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-sm navbar-dark" style="background-color: #000000;">
<a class="navbar-brand" href="#">Health+</a>
<button class="navbar-toggler d-lg-none" type="button" data-toggle="collapse" data-target="#collapsibleNavId" aria-controls="collapsibleNavId"
aria-expanded="false" aria-label="Toggle navigation"></button>
<div class="collapse navbar-collapse right" id="collapsibleNavId">
<div class="input-group mb-auto">
<input type="text" class="form-control" placeholder="Busqueda rapida" aria-label="Recipient's username" aria-describedby="button-addon2">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" id="button-addon2"> <i class="fa fa-search"></i></button>
</div>
</div>
</div>
<ul class="navbar-nav">
<li class="nav-item dropdown active">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Sociedades
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="#">Eps's asociadas</a>
<a class="dropdown-item" href="#">Ips's asociadas</a>
</div>
</li>
<li class="nav-item active">
<a class="nav-link" href="index.html">Home</a>
</li>
</ul>
</nav>
<div class="container">
<h2 class="text-center" id="title">Health+</h2>
<hr>
<div class="row">
<div class="col-md-5">
<form role="form" method="post" action="#">
<fieldset>
<p class="text-uppercase pull-center"> SIGN UP.</p>
<div class="form-group">
<input type="text" name="username" id="username" class="form-control input-lg" placeholder="Name">
</div>
<div class="form-group">
<input type="text" name="username" id="username" class="form-control input-lg" placeholder="Last name">
</div>
<div class="form-group">
<input type="text" name="username" id="username" class="form-control input-lg" placeholder="CC">
</div>
<div class="form-group">
<input type="text" name="username" id="username" class="form-control input-lg" placeholder="Phone">
</div>
<div class="form-group">
<input type="text" name="username" id="username" class="form-control input-lg" placeholder="Genero">
</div>
<div class="form-group">
<input type="text" name="username" id="username" class="form-control input-lg" placeholder="Eps">
</div>
<div class="form-group">
<input type="email" name="email" id="email" class="form-control input-lg" placeholder="Email Address">
</div>
<div class="form-group">
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="Password">
</div>
<div class="form-group">
<input type="password" name="password2" id="password2" class="form-control input-lg" placeholder="Password2">
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input">
By Clicking register you're agree to our policy & terms
</label>
</div>
<div>
<input type="submit" class="btn btn-lg btn-primary value="Register">
</div>
</fieldset>
</form>
</div>
<div class="col-md-2">
<!-------null------>
</div>
<div class="col-md-5">
<form role="form">
<fieldset>
<p class="text-uppercase"> Login using your account: </p>
<div class="form-group">
<input type="email" name="username" id="username" class="form-control input-lg" placeholder="Email address">
</div>
<div class="form-group">
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="Password">
</div>
<div>
<input type="submit" class="btn btn-lg btn-primary value="Register">
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</html> | 56.671756 | 179 | 0.416756 |
59d86db49677fa0aac28876fc386414a343834be | 1,768 | cpp | C++ | src/ex3_interfaces/main.cpp | pumpkin-code/dsba-ads-lect10 | df8437383a89da391e7059523ca15141c8c2d984 | [
"BSD-3-Clause"
] | null | null | null | src/ex3_interfaces/main.cpp | pumpkin-code/dsba-ads-lect10 | df8437383a89da391e7059523ca15141c8c2d984 | [
"BSD-3-Clause"
] | 1 | 2020-04-15T21:27:36.000Z | 2020-04-15T21:32:46.000Z | src/ex3_interfaces/main.cpp | pumpkin-code/dsba-ads-lect10 | df8437383a89da391e7059523ca15141c8c2d984 | [
"BSD-3-Clause"
] | null | null | null | /*! \file main.cpp
* \author Sergey Shershakov
* \version 0.2
* \date 18.02.2020
*
* →
*/
#include <iostream>
#include <vector>
#include "person.h"
#include "mystring.h"
#include "safe_array.hpp"
using namespace std;
void demo1()
{
std::cout << " IStringable test\n\n";
Person john("John Doe");
Person* pJohn = &john;
//IStringable* psJohn = &john; // error: doesn't implement interface
Student mary("Mary Smith", 1921);
Person* pMary = &mary;
Student* p2Mary = &mary;
//IStringable* psMary = &mary; // error: doesn't implement interface
Professor bradley("Dr. Bradley", 41);
Person* pBradley = &bradley;
Professor* p2Bradley = &bradley;
IStringable* psBradley = &bradley;
std:string s = psBradley->getStrRepresentation();
std::cout << "Bradley's description: " << s << "\n";
}
// deletion with a ptr
void demo2()
{
std::cout << "\n\n Dynamic creation\n\n";
// dynamic creation
Professor* snape = new Professor("Severus Snape", 15);
IStringable* psSnape = snape;
std:string s = psSnape->getStrRepresentation();
std::cout << "Snape's description: " << s << "\n";
// delete psSnape; // ← prohibited!
delete snape;
}
// custom string
void demo3()
{
std::cout << "\n\n Custom string\n\n";
MyString str("My string");
IStringable* ps = &str;
std::cout << "Custom string: " << ps->getStrRepresentation();
}
// safearray
void demo4()
{
std::cout << "\n\n SafeArray\n\n";
SafeArray<double> arr{1.2, 2.3, 3.4, -1.01};
IStringable* ps = &arr;
std::cout << "Array string representation: " << ps->getStrRepresentation();
}
int main()
{
demo1();
demo2();
demo3();
demo4();
return 0;
}
| 20.321839 | 79 | 0.595023 |
90c4b9cbfb7a65965ae6f91e10e2d1e78d3060ed | 951 | py | Python | Dynamic Programming/32_chef_monocarp.py | Szymon-Budziak/ASD_exercises_solutions | 36ccbdae03a6c7e4ad141a2b7b01bef9353574ee | [
"MIT"
] | 7 | 2021-12-28T23:38:42.000Z | 2022-03-29T16:36:16.000Z | Dynamic Programming/32_chef_monocarp.py | Szymon-Budziak/ASD_exercises_solutions | 36ccbdae03a6c7e4ad141a2b7b01bef9353574ee | [
"MIT"
] | null | null | null | Dynamic Programming/32_chef_monocarp.py | Szymon-Budziak/ASD_exercises_solutions | 36ccbdae03a6c7e4ad141a2b7b01bef9353574ee | [
"MIT"
] | 4 | 2021-06-29T20:21:52.000Z | 2022-03-12T10:04:17.000Z | # Chef Monocarp has just put n dishes into an oven. He knows that the i-th dish has its optimal
# cooking time equal to ti minutes. At any positive integer minute T Monocarp can put no more than
# one dish out of the oven. If the i-th dish is put out at some minute T, then its unpleasant value
# is |T − t[i]| — the absolute difference between T and t[i]. Once the dish is out of the oven, it
# can't go back in. Monocarp should put all the dishes out of the oven. What is the minimum total
# unpleasant value Monocarp can obtain?
from math import inf
def chef_monocarp(n, T):
T.sort()
DP = [[inf] * (2 * n + 1) for _ in range(n + 1)]
for i in range(2 * n + 1):
DP[0][i] = 0
for i in range(1, n + 1):
for j in range(1, 2 * n + 1):
DP[i][j] = min(DP[i][j - 1], DP[i - 1][j - 1] + abs(T[i - 1] - j))
return DP[-1][-1]
n = 12
T = [4, 11, 12, 4, 10, 12, 9, 3, 4, 11, 10, 10]
print(chef_monocarp(n, T))
| 39.625 | 99 | 0.61409 |
453f911fbdf780f6df8bb0c8300b6b9ff5221d22 | 573 | swift | Swift | wallsync/wallsyncApp.swift | barelyhuman/wallsync | 4ea66d768ad648bf86555a2c7215462405caa1d2 | [
"MIT"
] | null | null | null | wallsync/wallsyncApp.swift | barelyhuman/wallsync | 4ea66d768ad648bf86555a2c7215462405caa1d2 | [
"MIT"
] | null | null | null | wallsync/wallsyncApp.swift | barelyhuman/wallsync | 4ea66d768ad648bf86555a2c7215462405caa1d2 | [
"MIT"
] | null | null | null | //
// wallsyncApp.swift
// wallsync
//
// Created by Reaper on 23/03/22.
//
import SwiftUI
@main
struct wallsyncApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.onAppear {
DispatchQueue.main.async {
NSApplication.shared.windows.forEach { window in
window.styleMask = [.titled, .closable, .miniaturizable]
}
}
}
}.windowStyle(HiddenTitleBarWindowStyle())
}
}
| 19.758621 | 84 | 0.474695 |
56d796b0b2cd2ac6f5724e5a8637327436a54116 | 8,545 | html | HTML | src/app/admin/header-sidebar/header-sidebar.component.html | buypolarbear/tokensale-dashboard | c1be41d5fb543901bb7426ca57daa7228a5d09cf | [
"MIT"
] | 16 | 2017-11-10T12:57:31.000Z | 2018-04-15T13:40:41.000Z | src/app/admin/header-sidebar/header-sidebar.component.html | buypolarbear/tokensale-dashboard | c1be41d5fb543901bb7426ca57daa7228a5d09cf | [
"MIT"
] | 3 | 2017-12-06T13:29:57.000Z | 2018-05-20T16:20:27.000Z | src/app/admin/header-sidebar/header-sidebar.component.html | buypolarbear/tokensale-dashboard | c1be41d5fb543901bb7426ca57daa7228a5d09cf | [
"MIT"
] | 28 | 2017-11-10T12:57:37.000Z | 2018-06-01T09:13:28.000Z | <!-- App Sidebar -->
<div class="sidebar-container box-shadow desktop-view" *ngIf="isOpenSidebar" @sideAmination>
<!-- Start Sidebar Toggle icon -->
<div class="toggleIcon desktop-view">
<i class="material-icons open" (click)="onToggleSidebar()" pTooltip="{{'hide' | translate}}" tooltipPosition="top" *ngIf="this.isOpenSidebar">keyboard_arrow_left</i>
</div><!-- End Sidebar Toggle icon -->
<div class="logo">
<img src="assets/img/logo_white.png"/>
</div>
<ul class="userProfile">
<li pTooltip="{{user?.email}}" tooltipPosition="right">
<a routerLinkActive="active" [routerLink]="settingsUrl">
<i class="material-icons">tag_faces</i>
<div>{{user?.email}}</div>
<div class="clearfix"></div>
</a>
<div class="clearfix"></div>
</li>
</ul>
<ul class="navbar-menu">
<li tooltipPosition="top">
<a [routerLink]="transactionHistoryUrl" routerLinkActive="active">
<i class="material-icons">history</i> <span>{{'transactionHistory' | translate}}</span>
</a>
</li>
<li tooltipPosition="top">
<a [routerLink]="sendUrl" routerLinkActive="active">
<i class="material-icons">send</i> <span>{{'send' | translate}}</span>
</a>
</li>
<li tooltipPosition="top">
<a [routerLink]="etherUrl" routerLinkActive="active">
<i class="material-icons">settings_ethernet</i> <span>{{'etherBalance' | translate}}</span>
</a>
</li>
<li tooltipPosition="top">
<a [routerLink]="tokenUrl" routerLinkActive="active">
<i class="material-icons">account_balance</i> <span>{{'tokenBalance' | translate}}</span>
</a>
</li>
<li tooltipPosition="top">
<a [routerLink]="addressInfoUrl" routerLinkActive="active">
<i class="material-icons">note_add</i> <span>{{'addressInfo' | translate}}</span>
</a>
</li>
<li>
<a [routerLink]="settingsUrl" class="settings" routerLinkActive="active" tooltipPosition="top">
<i class="material-icons">settings</i>
<span>{{'settings' | translate}}</span>
</a>
</li>
<li>
<a routerLinkActive="active" class="logout" (click)="logout()" tooltipPosition="top">
<i class="material-icons">power_settings_new</i>
<span>{{'logout' | translate}}</span>
</a>
</li>
</ul>
<div class="col-md-12 col-sm-12 col-xs-12 padding-left-10">
<div class="col-md-12 padding-left-0 padding-right-0">
<div class="logo-icons">
<img src="assets/img/ethereum_1.png" width="40"/>
</div>
<div class="value-count">
<div class="count-number">{{getProofTokensRaised(landing?.totalSupply)}} / 1,181,031 SYM</div>
<div class="count-label">Total Cap</div>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12 padding-left-0 padding-right-0">
<div class="logo-icons">
<img src="assets/img/ethereum_1.png" width="40"/>
</div>
<div class="value-count">
<div class="count-number">{{getTokenPrice()}}</div>
<div class="count-label">Token Price</div>
</div>
</div>
<div class="clearfix"></div>
</div>
<ul class="admin-profile navbar-menu">
<div class="language-dropdown">
<div class="language-select">
<app-language-selector></app-language-selector>
</div>
</div>
</ul>
</div><!-- End Sidebar -->
<!-- Start Sidebar Toggle icon -->
<div class="toggleIcon desktop-view">
<i class="material-icons close" (click)="onToggleSidebar()" pTooltip="{{'show' | translate}}" tooltipPosition="right" *ngIf="!this.isOpenSidebar">menu</i>
</div><!-- End Sidebar Toggle icon -->
<!-- App Mobile Sidebar -->
<div class="sidebar-container box-shadow mobile-view" *ngIf="isOpenMobileSidebar" @sideAmination>
<div class="toggleIcon mobile-view">
<i class="material-icons open" (click)="onMobileToggleSidebar()" *ngIf="this.isOpenMobileSidebar">keyboard_arrow_left</i>
</div><!-- End Sidebar Toggle icon -->
<div class="logo">
<img src="assets/img/logo_white.png"/>
</div>
<ul class="userProfile">
<li>
<a routerLinkActive="active" [routerLink]="settingsUrl" (click)="closeSidebar()">
<i class="material-icons">tag_faces</i>
<div title="{{user?.email}}">{{user?.email}}</div>
<div class="clearfix"></div>
</a>
<div class="clearfix"></div>
</li>
</ul>
<ul class="navbar-menu">
<li>
<a [routerLink]="transactionHistoryUrl" routerLinkActive="active" (click)="closeSidebar()">
<i class="material-icons">history</i> <span>{{'transactionHistory' | translate}}</span>
</a>
</li>
<li>
<a [routerLink]="sendUrl" routerLinkActive="active" (click)="closeSidebar()">
<i class="material-icons">send</i> <span>{{'send' | translate}}</span>
</a>
</li>
<li>
<a [routerLink]="etherUrl" routerLinkActive="active" (click)="closeSidebar()">
<i class="material-icons">settings_ethernet</i> <span>{{'etherBalance' | translate}}</span>
</a>
</li>
<li>
<a [routerLink]="tokenUrl" routerLinkActive="active" (click)="closeSidebar()">
<i class="material-icons">account_balance</i> <span>{{'tokenBalance' | translate}}</span>
</a>
</li>
<li>
<a [routerLink]="addressInfoUrl" routerLinkActive="active" (click)="closeSidebar()">
<i class="material-icons">note_add</i> <span>{{'addressInfo' | translate}}</span>
</a>
</li>
<li>
<a [routerLink]="settingsUrl" routerLinkActive="active" class="settings" (click)="closeSidebar()">
<i class="material-icons">settings</i>
<span>{{'settings' | translate}}</span>
</a>
</li>
<li>
<a routerLinkActive="active" class="logout" (click)="logout()">
<i class="material-icons">power_settings_new</i>
<span>{{'logout' | translate}}</span>
</a>
</li>
</ul>
<ul class="admin-profile navbar-menu">
<div class="language-dropdown">
<div class="language-select">
<app-language-selector></app-language-selector>
</div>
</div>
</ul>
</div><!-- End Mobile Sidebar -->
<!-- Start Sidebar Toggle icon -->
<div class="toggleIcon mobile-view">
<i class="material-icons close" (click)="onMobileToggleSidebar()" *ngIf="!this.isOpenMobileSidebar">menu</i>
</div><!-- End Sidebar Toggle icon -->
<!-- Start Header -->
<div [ngClass]="{'body-container':true,'sidePanelHide':!isOpenSidebar}" @slideDown>
<div class="header-container">
<ul class="progressbar">
<li (click)="currentRoute()" [ngClass]="{'twoTabActive':currentPath == 'wallet','AllTabActive':currentPath == 'buy-token'}">
<a [routerLink]="ethereumUrl" routerLinkActive="active">
<span>{{'getEthereum' | translate}}</span>
</a>
</li>
<li (click)="currentRoute();walletUrlEvent()" [ngClass]="{'twoTabActive':currentPath == 'wallet','AllTabActive':currentPath == 'buy-token'}">
<a [routerLink]="walletUrl" routerLinkActive="active">
<span>{{'sendEtheriumWallet' | translate}}</span>
</a>
</li>
<li (click)="currentRoute();buyTokensEvent()" [ngClass]="{'AllTabActive':currentPath == 'buy-token'}">
<a [routerLink]="buyTokens" routerLinkActive="active">
<span>{{'buyPrftTokens' | translate}}</span>
</a>
</li>
<li>
<a>
<div class="top-menu">
<a [routerLink]="etherUrl" pTooltip="{{'etherBalance' | translate}}" tooltipPosition="left" routerLinkActive="active">
<div *ngIf="loaderEther" class="button-loader"></div>
<span *ngIf="!loaderEther">{{etherBalance}} ETH</span>
</a>
<i class="material-icons" pTooltip="{{'refresh' | translate}}" tooltipPosition="right" (click)="loaderEther=true;checkAccountBalance(address)">refresh</i>
</div>
<div class="bottom-menu">
<a [routerLink]="tokenUrl" pTooltip="{{'tokenBalance' | translate}}" tooltipPosition="left" routerLinkActive="active">
<div *ngIf="loaderProof" class="button-loader"></div>
<span *ngIf="!loaderProof">{{tokenBalance}} SYM</span>
</a>
<i class="material-icons" pTooltip="{{'refresh' | translate}}" tooltipPosition="right" (click)="loaderProof=true;checkProofAccountBalance(address)">refresh</i>
</div>
</a>
</li>
</ul>
<div class="clearfix"></div>
</div>
</div>
<!-- End Header -->
| 36.517094 | 171 | 0.600585 |
0c7f6505f3c761471ae5694fae86033782a26f2a | 754 | html | HTML | src/pages/elements/element-headers.html | luckyluke007/specialevents-redesign | c0f2e5ff3676c7a701048dc94f229eb10610986d | [
"MIT"
] | null | null | null | src/pages/elements/element-headers.html | luckyluke007/specialevents-redesign | c0f2e5ff3676c7a701048dc94f229eb10610986d | [
"MIT"
] | 4 | 2020-09-06T22:29:18.000Z | 2021-05-10T08:02:59.000Z | src/pages/elements/element-headers.html | luckyluke007/specialevents-redesign | c0f2e5ff3676c7a701048dc94f229eb10610986d | [
"MIT"
] | null | null | null | ---
layout: viewer-components
---
<div class="docs-heading">Header</div>
<h1>h1. This is a very large header.</h1>
<h2>h2. This is a large header.</h2>
<h3>h3. This is a medium header.</h3>
<h4>h4. This is a moderate header.</h4>
<h5>h5. This is a small header.</h5>
<h6>h6. This is a tiny header.</h6>
<div class="docs-heading">Small Header Segments</div>
<h1>h1. This is a very large header <small>Small Add-On</small></h1>
<h2>h2. This is a large header <small>Small Add-On</small></h2>
<h3>h3. This is a medium header <small>Small Add-On</small></h3>
<h4>h4. This is a moderate header <small>Small Add-On</small></h4>
<h5>h5. This is a small header <small>Small Add-On</small></h5>
<h6>h6. This is a tiny header <small>Small Add-On</small></h6>
| 32.782609 | 68 | 0.680371 |
2f3653e8163c851da5b4f6d2267e850830dccef5 | 337 | java | Java | src/main/java/com/example/demo/Config.java | tq-jappy/java-app-playground | ab39e8c9f932e15ab4bc90ec4840d8ad1c8aa5c3 | [
"MIT"
] | null | null | null | src/main/java/com/example/demo/Config.java | tq-jappy/java-app-playground | ab39e8c9f932e15ab4bc90ec4840d8ad1c8aa5c3 | [
"MIT"
] | null | null | null | src/main/java/com/example/demo/Config.java | tq-jappy/java-app-playground | ab39e8c9f932e15ab4bc90ec4840d8ad1c8aa5c3 | [
"MIT"
] | null | null | null | package com.example.demo;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableJpaRepositories
@EnableTransactionManagement
public class Config {
}
| 25.923077 | 78 | 0.869436 |
f0e786dd48ee83d59c9013e403c5e58da44ee8cb | 7,596 | html | HTML | public/views/current.html | princess-essien/budgie | 1e99a7c48c48c32d3715d1b1d22f0ebdcc4fa01e | [
"MIT"
] | null | null | null | public/views/current.html | princess-essien/budgie | 1e99a7c48c48c32d3715d1b1d22f0ebdcc4fa01e | [
"MIT"
] | null | null | null | public/views/current.html | princess-essien/budgie | 1e99a7c48c48c32d3715d1b1d22f0ebdcc4fa01e | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<title>Budgie - A Budget Analysis App</title>
<meta charset="UTF-8"/>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!--Import Google Icon Font-->
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css" media="screen,projection"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<div class="card" ng-show="!isCurrentBudgetSet">
<div class="card-content cyan-text center-align text-darken-2">
<h5>You have no budget for this month. Let Budgie propose one for you.</h5>
<a class="waves-effect waves-light btn cyan darken-2" ng-click="proposeCurrentBudget()">Propose Budget</a>
<h5>Or create one manually:</h5>
<div style="padding:40px;">
<h5>Income:</h5>
<form class="col s10">
<div class="row">
<div class="input-field col s5">
<input id="new_income_item" type="text" ng-model="newIncomeItem" class="validate">
<label for="new_income-item" class="left-align">Item</label>
</div>
<div class="input-field col s3">
<input id="new_income_value" type="number" ng-model="newIncomeValue" class="validate">
<label for="new_income_value" class="left-align">Proposed income</label>
</div>
<div class="input-field col s3">
<select ng-model="newIncomeRepeat">
<option value="" disabled selected>Repeat</option>
<option value="true">Repeat each month</option>
<option value="false">Don't repeat</option>
</select>
<label>Repeat</label>
</div>
<div class="col s1" style="padding-top:20px;">
<a class="waves-effect waves-light btn cyan darken-2" ng-click="currentBudget.addIncome(newIncomeItem, newIncomeValue, newIncomeRepeat)">Add Income</a>
</div>
</div>
</form>
<table class="striped responsive">
<thead>
<tr>
<td data-field="income">Source</td>
<td data-field="proposed">Proposed inflow</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="(name, item) in currentBudget.income">
<td>{{ name }}</td>
<td>{{ item.proposed }}</td>
</tr>
</tbody>
</table>
</div>
<div style="padding:40px;">
<h5 class="heading">Expense:</h5>
<form class="col s10">
<div class="row">
<div class="input-field col s4">
<input id="new_expense_item" type="text" ng-model="newExpenseItem" class="validate">
<label for="new_expense-item" class="left-align">Item</label>
</div>
<div class="input-field col s3">
<input id="new_expense_value" type="number" ng-model="newExpenseValue" class="validate">
<label for="new_expense_value" class="left-align">Proposed expense</label>
</div>
<div class="input-field col s2">
<select ng-model="newExpenseRepeat">
<option value="" disabled selected>Repeat</option>
<option value="true">Repeat each month</option>
<option value="false">Don't repeat</option>
</select>
<label>Repeat</label>
</div>
<div class="input-field col s2">
<select ng-model="newExpensePriority">
<option value="" disabled selected>Priority</option>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
</select>
<label>Priority</label>
</div>
<div class="col s1" style="padding-top:20px;">
<a class="waves-effect waves-light btn cyan darken-2" ng-click="currentBudget.addExpense(newExpenseItem, newExpenseValue, newExpenseRepeat, newExpensePriority)">Add Expense</a>
</div>
</div>
</form>
<table class="striped responsive">
<thead>
<tr>
<td data-field="expense">Item</td>
<td data-field="proposed">Proposed expenditure</td>
<td data-field="priority">Priority</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="(name, item) in currentBudget.expense">
<td>{{ name }}</td>
<td>{{ item.proposed }}</td>
<td>{{ item.priority }}</td>
</tr>
</tbody>
</table>
</div>
<div style="padding:20px;">
<a class="waves-effect waves-light btn cyan darken-2" ng-click="saveCurrentBudget()">Add Budget</a>
</div>
</div>
</div>
<div class="card" ng-show="isCurrentBudgetSet">
<div class="card-content center-align cyan-text text-darken-2">
<h5 class="heading">Budget for {{ currentBudget.month + " " + currentBudget.year }}</h5>
<h5 class="heading">Income:</h5>
<table class="striped responsive">
<thead>
<tr>
<td data-field="income">Source</td>
<td data-field="proposed">Proposed inflow</td>
<td data-field="actual">Actual inflow</td>
<td data-field="variance">Variance</td>
<td data-field="varcent">Variance percentage</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="(name, item) in currentBudget.income">
<td>{{ name }}</td>
<td>{{ item.proposed | currency}}</td>
<td>{{ (item.actual | currency) || "-" }}</td>
<td>{{ (item.variance | currency) || "-" }}</td>
<td>{{ item.varcent + "%" || "-" }}</td>
</tr>
</tbody>
</table>
<h5 class="heading">Expense:</h5>
<table class="striped responsive">
<thead>
<tr>
<td data-field="expense">Item</td>
<td data-field="proposed">Proposed expenditure</td>
<td data-field="actual">Actual expenditure</td>
<td data-field="variance">Variance</td>
<td data-field="varcent">Variance percentage</td>
<td data-field="priority">Priority</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="(name, item) in currentBudget.expense">
<td>{{ name }}</td>
<td>{{ item.proposed | currency }}</td>
<td>{{ (item.actual | currency) || "-" }}</td>
<td>{{ (item.variance | currency) || "-" }}</td>
<td>{{ item.varcent + "%" || "-" }}</td>
<td>{{ item.priority || "-" }}</td>
</tr>
</tbody>
<table>
<h5 class="heading">Log Expenses:</h5>
<form class="col s10">
<div class="row">
<div class="input-field col s5">
<input id="expense_item" type="text" ng-model="expenseItem" class="validate">
<label for="expense_item" class="left-align">Item</label>
</div>
<div class="input-field col s5">
<input id="expense_value" type="number" ng-model="expenseValue" class="validate">
<label for="expense_value" class="left-align">Expenditure</label>
</div>
<div class="col s2" style="padding-top:20px;">
<a class="waves-effect waves-light btn cyan darken-2" ng-click="currentBudget.setActualExpense(expenseItem, expenseValue)">Update Expense</a>
</div>
</div>
</form>
<a class="waves-effect waves-light btn cyan darken-2" ng-click="saveCurrentBudget()">Save Budget</a>
</div>
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="../js/materialize.min.js"></script>
<script src="../js/budget.js"></script>
<script src="../js/current.js"></script>
</body>
</html> | 40.190476 | 184 | 0.59663 |
fb7037603b69acda2ce044a92d537416474d5e8f | 69 | java | Java | src/bgp/core/network/fsm/StateChangeListener.java | Nikheln/BGP-simulator | a65ab40958f17c32ee9807afd94bee09bc91992d | [
"MIT"
] | null | null | null | src/bgp/core/network/fsm/StateChangeListener.java | Nikheln/BGP-simulator | a65ab40958f17c32ee9807afd94bee09bc91992d | [
"MIT"
] | null | null | null | src/bgp/core/network/fsm/StateChangeListener.java | Nikheln/BGP-simulator | a65ab40958f17c32ee9807afd94bee09bc91992d | [
"MIT"
] | null | null | null | package bgp.core.network.fsm;
public class StateChangeListener {
}
| 11.5 | 34 | 0.782609 |
56b040d8faf6dee3740a288af5c1bf486b1c9e08 | 1,652 | html | HTML | css/css-fonts/font-display/font-display-feature-policy-01.tentative.html | ziransun/wpt | ab8f451eb39eb198584d547f5d965ef54df2a86a | [
"BSD-3-Clause"
] | 8 | 2019-04-09T21:13:05.000Z | 2021-11-23T17:25:18.000Z | css/css-fonts/font-display/font-display-feature-policy-01.tentative.html | ziransun/wpt | ab8f451eb39eb198584d547f5d965ef54df2a86a | [
"BSD-3-Clause"
] | 14 | 2019-03-18T20:11:48.000Z | 2019-04-23T22:41:46.000Z | css/css-fonts/font-display/font-display-feature-policy-01.tentative.html | ziransun/wpt | ab8f451eb39eb198584d547f5d965ef54df2a86a | [
"BSD-3-Clause"
] | 11 | 2019-04-12T01:20:16.000Z | 2021-11-23T17:25:02.000Z | <!DOCTYPE html>
<html class="reftest-wait">
<title>Test for font-display-late-swap feature policy behavior when set to reporting</title>
<link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md">
<link rel="match" href="font-display-feature-policy-01.tentative-ref.html">
<style>
</style>
<p>Tests if font-display is set to optional for each option except for when it is set to fallback</p>
<table id="container">
<tr>
<th>not-set</th>
<th>auto</th>
<th>block</th>
<th>swap</th>
<th>fallback</th>
<th>optional</th>
</tr>
</table>
<script>
const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional'];
const table = document.getElementById('container');
function makeFontFaceDeclaration(family, display) {
url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over
return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }';
}
window.onload = () => {
let tr = document.createElement('tr');
for (let display of fontDisplayValues) {
const family = display + '-face';
const rule = makeFontFaceDeclaration(family, display);
document.styleSheets[0].insertRule(rule, 0);
let td = document.createElement('td');
td.textContent = 'a';
td.style.fontFamily = family + ', Arial';
tr.appendChild(td);
}
table.appendChild(tr);
const timeoutMilliSec = 1500; // After the font is loaded
setTimeout(() => {
document.documentElement.classList.remove("reftest-wait");
}, timeoutMilliSec);
}
</script>
</html>
| 35.148936 | 119 | 0.657385 |
3fb2701e88db1409c4258627d988a161ac70cd60 | 3,289 | h | C | src/opts/SkMatrix_opts.h | Perspex/skia | e25fe5a294e9cee8f23207eef63fad6cffa9ced4 | [
"Apache-2.0"
] | 27 | 2016-04-27T01:02:03.000Z | 2021-12-13T08:53:19.000Z | src/opts/SkMatrix_opts.h | AvaloniaUI/skia | e25fe5a294e9cee8f23207eef63fad6cffa9ced4 | [
"Apache-2.0"
] | 2 | 2017-03-09T09:00:50.000Z | 2017-09-21T15:48:20.000Z | src/opts/SkMatrix_opts.h | AvaloniaUI/skia | e25fe5a294e9cee8f23207eef63fad6cffa9ced4 | [
"Apache-2.0"
] | 17 | 2016-04-27T02:06:39.000Z | 2019-12-18T08:07:00.000Z | /*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkMatrix_opts_DEFINED
#define SkMatrix_opts_DEFINED
#include "SkMatrix.h"
#include "SkNx.h"
namespace SK_OPTS_NS {
static void matrix_translate(const SkMatrix& m, SkPoint* dst, const SkPoint* src, int count) {
SkASSERT(m.getType() <= SkMatrix::kTranslate_Mask);
if (count > 0) {
SkScalar tx = m.getTranslateX();
SkScalar ty = m.getTranslateY();
if (count & 1) {
dst->fX = src->fX + tx;
dst->fY = src->fY + ty;
src += 1;
dst += 1;
}
Sk4s trans4(tx, ty, tx, ty);
count >>= 1;
if (count & 1) {
(Sk4s::Load(&src->fX) + trans4).store(&dst->fX);
src += 2;
dst += 2;
}
count >>= 1;
for (int i = 0; i < count; ++i) {
(Sk4s::Load(&src[0].fX) + trans4).store(&dst[0].fX);
(Sk4s::Load(&src[2].fX) + trans4).store(&dst[2].fX);
src += 4;
dst += 4;
}
}
}
static void matrix_scale_translate(const SkMatrix& m, SkPoint* dst, const SkPoint* src, int count) {
SkASSERT(m.getType() <= (SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask));
if (count > 0) {
SkScalar tx = m.getTranslateX();
SkScalar ty = m.getTranslateY();
SkScalar sx = m.getScaleX();
SkScalar sy = m.getScaleY();
if (count & 1) {
dst->fX = src->fX * sx + tx;
dst->fY = src->fY * sy + ty;
src += 1;
dst += 1;
}
Sk4s trans4(tx, ty, tx, ty);
Sk4s scale4(sx, sy, sx, sy);
count >>= 1;
if (count & 1) {
(Sk4s::Load(&src->fX) * scale4 + trans4).store(&dst->fX);
src += 2;
dst += 2;
}
count >>= 1;
for (int i = 0; i < count; ++i) {
(Sk4s::Load(&src[0].fX) * scale4 + trans4).store(&dst[0].fX);
(Sk4s::Load(&src[2].fX) * scale4 + trans4).store(&dst[2].fX);
src += 4;
dst += 4;
}
}
}
static void matrix_affine(const SkMatrix& m, SkPoint* dst, const SkPoint* src, int count) {
SkASSERT(m.getType() != SkMatrix::kPerspective_Mask);
if (count > 0) {
SkScalar tx = m.getTranslateX();
SkScalar ty = m.getTranslateY();
SkScalar sx = m.getScaleX();
SkScalar sy = m.getScaleY();
SkScalar kx = m.getSkewX();
SkScalar ky = m.getSkewY();
if (count & 1) {
dst->set(src->fX * sx + src->fY * kx + tx,
src->fX * ky + src->fY * sy + ty);
src += 1;
dst += 1;
}
Sk4s trans4(tx, ty, tx, ty);
Sk4s scale4(sx, sy, sx, sy);
Sk4s skew4(kx, ky, kx, ky); // applied to swizzle of src4
count >>= 1;
for (int i = 0; i < count; ++i) {
Sk4s src4 = Sk4s::Load(&src->fX);
Sk4s swz4(src[0].fY, src[0].fX, src[1].fY, src[1].fX); // need ABCD -> BADC
(src4 * scale4 + swz4 * skew4 + trans4).store(&dst->fX);
src += 2;
dst += 2;
}
}
}
} // namespace SK_OPTS_NS
#endif//SkMatrix_opts_DEFINED
| 30.738318 | 100 | 0.483126 |
ba2e3fb221268b6a926ad81a81cc466c6fd7ea36 | 3,769 | go | Go | pkg/operation/botanist/component/networkpolicies/peers_test.go | voelzmo/gardener | f731492e2e735377407bb453b1d264212b4be4df | [
"Apache-2.0"
] | 2,208 | 2018-01-10T14:00:56.000Z | 2022-03-29T17:36:02.000Z | pkg/operation/botanist/component/networkpolicies/peers_test.go | voelzmo/gardener | f731492e2e735377407bb453b1d264212b4be4df | [
"Apache-2.0"
] | 3,810 | 2018-01-12T16:09:31.000Z | 2022-03-31T15:39:23.000Z | pkg/operation/botanist/component/networkpolicies/peers_test.go | voelzmo/gardener | f731492e2e735377407bb453b1d264212b4be4df | [
"Apache-2.0"
] | 433 | 2018-01-10T13:43:42.000Z | 2022-03-30T13:13:07.000Z | // Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// 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 networkpolicies_test
import (
"net"
. "github.com/gardener/gardener/pkg/operation/botanist/component/networkpolicies"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
networkingv1 "k8s.io/api/networking/v1"
)
var _ = Describe("networkpolicies", func() {
var (
_, block8, _ = net.ParseCIDR("10.0.0.0/8")
_, block12, _ = net.ParseCIDR("172.16.0.0/12")
_, block16, _ = net.ParseCIDR("192.168.0.0/16")
_, carrierGradeBlock, _ = net.ParseCIDR("100.64.0.0/10")
)
Describe("#Private8BitBlock", func() {
It("should return the correct CIDR", func() {
Expect(Private8BitBlock()).To(Equal(block8))
})
})
Describe("#Private12BitBlock", func() {
It("should return the correct CIDR", func() {
Expect(Private12BitBlock()).To(Equal(block12))
})
})
Describe("#Private16BitBlock", func() {
It("should return the correct CIDR", func() {
Expect(Private16BitBlock()).To(Equal(block16))
})
})
Describe("#CarrierGradeNATBlock", func() {
It("should return the correct CIDR", func() {
Expect(CarrierGradeNATBlock()).To(Equal(carrierGradeBlock))
})
})
Describe("#AllPrivateNetworkBlocks", func() {
It("should contain correct CIDRs", func() {
Expect(AllPrivateNetworkBlocks()).To(ConsistOf(*block8, *block12, *block16, *carrierGradeBlock))
})
})
Describe("#ToNetworkPolicyPeersWithExceptions", func() {
It("should return correct result", func() {
result, err := ToNetworkPolicyPeersWithExceptions(
AllPrivateNetworkBlocks(),
"10.10.0.0/24",
"172.16.1.0/24",
"192.168.1.0/24",
"100.64.1.0/24",
)
Expect(err).NotTo(HaveOccurred())
Expect(result).To(ConsistOf([]networkingv1.NetworkPolicyPeer{
{
IPBlock: &networkingv1.IPBlock{
CIDR: "10.0.0.0/8",
Except: []string{"10.10.0.0/24"},
},
},
{
IPBlock: &networkingv1.IPBlock{
CIDR: "172.16.0.0/12",
Except: []string{"172.16.1.0/24"},
},
},
{
IPBlock: &networkingv1.IPBlock{
CIDR: "192.168.0.0/16",
Except: []string{"192.168.1.0/24"},
},
},
{
IPBlock: &networkingv1.IPBlock{
CIDR: "100.64.0.0/10",
Except: []string{"100.64.1.0/24"},
},
},
}))
})
It("should not have overlapping excepts", func() {
result, err := ToNetworkPolicyPeersWithExceptions(
AllPrivateNetworkBlocks(),
"192.167.0.0/16",
"192.168.0.0/16",
"10.10.0.0/24",
"10.0.0.0/8",
"100.64.0.0/10",
"172.16.0.0/12",
)
Expect(err).NotTo(HaveOccurred())
Expect(result).To(ConsistOf([]networkingv1.NetworkPolicyPeer{
{
IPBlock: &networkingv1.IPBlock{
CIDR: "10.0.0.0/8",
Except: []string{"10.10.0.0/24"},
},
},
{
IPBlock: &networkingv1.IPBlock{
CIDR: "172.16.0.0/12",
},
},
{
IPBlock: &networkingv1.IPBlock{
CIDR: "192.168.0.0/16",
},
},
{
IPBlock: &networkingv1.IPBlock{
CIDR: "100.64.0.0/10",
},
},
}))
})
})
})
| 26.542254 | 186 | 0.622977 |
20e0bea89d5c7f4db9c2757a19fdc0cb9c067308 | 1,603 | css | CSS | data/usercss/103069.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 118 | 2020-08-28T19:59:28.000Z | 2022-03-26T16:28:40.000Z | data/usercss/103069.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 38 | 2020-09-02T01:08:45.000Z | 2022-01-23T02:47:24.000Z | data/usercss/103069.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 21 | 2020-08-19T01:12:43.000Z | 2022-03-15T21:55:17.000Z | /* ==UserStyle==
@name Ecosia with Fixed Positioning
@namespace USO Archive
@author Lee Hyde
@description `Adds fixed positioning where appropriate for a more usable, eco-friendly search engine.`
@version 20151108.22.0
@license CC0-1.0
@preprocessor uso
==/UserStyle== */
/* Ecosia Fixed Positioning
*
* Author: ANubeOn
* Published: July 3rd, 2014
* Updated: November 8th, 2015
* Version: 1.1.0
*
*/
@-moz-document domain('www.ecosia.org')
{
/* Search Results */
div.result-wrapper div.search-header {
position: fixed !important;
background-attachment: fixed !important;
width: 100% !important;
z-index: 1002 !important;
}
div.result-wrapper div.navbar-row {
position: fixed !important;
top: 70px !important;
background-color: #ffffff !important;
z-index: 1001 !important;
}
div.result-wrapper div.container {
top: 115px !important;
}
/* Image Search Results */
div.image-results {
padding-top: 130px !important;
}
/* Maps */
#mapsFrame {
padding-top: 118px !important;
}
/* Settings */
div.settings-header {
position: fixed !important;
top: 0px !important;
background-attachment: fixed !important;
width: 100% !important;
z-index: 1002 !important;
}
body.js-settings div.container form.settings-form {
margin-top: 70px !important;
}
} | 22.9 | 105 | 0.568309 |
7532c9620cf8ac40fac9362a05a96819468a4938 | 1,600 | h | C | src/TlcStyle.h | technolescom/tlcstyle | 42a0cbbc10dc7f0f74692d39413d0752e3efc759 | [
"MIT"
] | null | null | null | src/TlcStyle.h | technolescom/tlcstyle | 42a0cbbc10dc7f0f74692d39413d0752e3efc759 | [
"MIT"
] | null | null | null | src/TlcStyle.h | technolescom/tlcstyle | 42a0cbbc10dc7f0f74692d39413d0752e3efc759 | [
"MIT"
] | null | null | null | /*******************************************************************************
*┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑*
*│ ▄▄▄█████▓ ██▓ ▄████▄ ██████ ▄▄▄█████▓▓██ ██▓ ██▓ ▓█████ │*
*│ ▓ ██▒ ▓▒▓██▒ ▒██▀ ▀█ ▒██ ▒ ▓ ██▒ ▓▒ ▒██ ██▒▓██▒ ▓█ ▀ │*
*│ ▒ ▓██░ ▒░▒██░ ▒▓█ ▄ ░ ▓██▄ ▒ ▓██░ ▒░ ▒██ ██░▒██░ ▒███ │*
*│ ░ ▓██▓ ░ ▒██░ ▒▓▓▄ ▄██▒ ▒ ██▒░ ▓██▓ ░ ░ ▐██▓░▒██░ ▒▓█ ▄ │*
*│ ▒██▒ ░ ░██████▒▒ ▓███▀ ░▒██████▒▒ ▒██▒ ░ ░ ██▒▓░░██████▒░▒████▒ │*
*│ ▒ ░░ ░ ▒░▓ ░░ ░▒ ▒ ░▒ ▒▓▒ ▒ ░ ▒ ░░ ██▒▒▒ ░ ▒░▓ ░░░ ▒░ ░ │*
*│ ░ ░ ░ ▒ ░ ░ ▒ ░ ░▒ ░ ░ ░ ▓██ ░▒░ ░ ░ ▒ ░ ░ ░ ░ │*
*│ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ▒ ░░ ░ ░ ░ │*
*│ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░ │*
*│ ░ © 2021 TechnoLesCom ░ ░ │*
*┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙*
******************************************************************************/
#pragma once
#include <QProxyStyle>
class TlcStyle : public QProxyStyle
{
Q_OBJECT
public:
explicit TlcStyle();
QPalette standardPalette() const override;
void polish( QPalette & palette ) override;
/*
void drawPrimitive( QStyle::PrimitiveElement element, const QStyleOption
* option, QPainter * painter, const QWidget * widget = nullptr ) const
override;
*/
private:
mutable QPalette m_standard_palette;
};
| 40 | 80 | 0.209375 |
75fd999aaee00497ba7e5d49389b4e3d8dc7c80f | 4,846 | cs | C# | PhoneCrypt/MainPage.xaml.cs | SpO2/wpVigenere | 386ee70e570b19b47cba0a63425ac44775c923b8 | [
"Apache-2.0"
] | null | null | null | PhoneCrypt/MainPage.xaml.cs | SpO2/wpVigenere | 386ee70e570b19b47cba0a63425ac44775c923b8 | [
"Apache-2.0"
] | null | null | null | PhoneCrypt/MainPage.xaml.cs | SpO2/wpVigenere | 386ee70e570b19b47cba0a63425ac44775c923b8 | [
"Apache-2.0"
] | null | null | null | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using PhoneCrypt;
using PhoneCrypt.Entities;
using PhoneCrypt.Repositories;
using System.Collections.ObjectModel;
using Windows.UI.Popups;
using PhoneCrypt.Views;
// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=391641
namespace PhoneCrypt
{
/// <summary>
/// Une page vide peut être utilisée seule ou constituer une page de destination au sein d'un frame.
/// </summary>
public sealed partial class MainPage : Page
{
private ObservableCollection<History> histories;
private HistoryRepository historyRepository;
private const String CONFIRM_DELETE_HISTORY = "Confirm History suppression ?";
private const String UICOMMAND_YES = "Yes";
private const String UICOMMAND_NO = "No";
public MainPage()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
this.historyRepository = new HistoryRepository();
}
/// <summary>
/// Invoqué lorsque cette page est sur le point d'être affichée dans un frame.
/// </summary>
/// <param name="e">Données d’événement décrivant la manière dont l’utilisateur a accédé à cette page.
/// Ce paramètre est généralement utilisé pour configurer la page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// TODO: préparer la page pour affichage ici.
// TODO: si votre application comporte plusieurs pages, assurez-vous que vous
// gérez le bouton Retour physique en vous inscrivant à l’événement
// Windows.Phone.UI.Input.HardwareButtons.BackPressed.
// Si vous utilisez le NavigationHelper fourni par certains modèles,
// cet événement est géré automatiquement.
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Encryption encryption = new Encryption(this.tbWord.Text, this.tbPassPhrase.Text);
History history;
this.tbResult.Text = encryption.encrypt();
if (this.tbResult.Text != "")
{
history = new History();
history.value = this.tbWord.Text;
history.password = this.tbPassPhrase.Text;
history.orientation = 0;
this.historyRepository.add(history);
Refresh_HistoryList();
}
}
private void Refresh_HistoryList()
{
if (histories != null)
{
histories.Clear();
}
histories = this.historyRepository.list;
listBoxobj.ItemsSource = histories;
}
private void Page_Loaded(object sender, RoutedEventArgs e)
{
Refresh_HistoryList();
}
private async void btnClearHistory_Click(object sender, RoutedEventArgs e)
{
if (histories.Count > 0)
{
MessageDialog msgDialog = new MessageDialog(CONFIRM_DELETE_HISTORY);
msgDialog.Commands.Add(new UICommand(UICOMMAND_NO, new UICommandInvokedHandler(Command)));
msgDialog.Commands.Add(new UICommand(UICOMMAND_YES, new UICommandInvokedHandler(Command)));
await msgDialog.ShowAsync();
}
}
private void Command(IUICommand command)
{
if (command.Label.Equals(UICOMMAND_YES))
{
historyRepository.deleteAll();
Refresh_HistoryList();
}
}
private void btnAboute_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(About));
}
private void btnDecrypt_Click(object sender, RoutedEventArgs e)
{
Encryption encryption = new Encryption(this.tbResultd.Text, this.tbPassPhrased.Text);
History history;
this.tbWordd.Text = encryption.decrypt();
if (this.tbWordd.Text != "")
{
history = new History();
history.value = this.tbResultd.Text;
history.password = this.tbPassPhrased.Text;
history.orientation = 1;
this.historyRepository.add(history);
Refresh_HistoryList();
}
}
}
}
| 35.372263 | 123 | 0.617416 |
dcc7b3658e3a5556c647f0ef801132de16ad61b2 | 206 | asm | Assembly | Final Assignment CSE331/Solution/4.asm | NazimKamolHasan/CSE331L-Section-1-Fall20-NSU | 2972b014959d4e67727e01edccacbf99e214c483 | [
"MIT"
] | null | null | null | Final Assignment CSE331/Solution/4.asm | NazimKamolHasan/CSE331L-Section-1-Fall20-NSU | 2972b014959d4e67727e01edccacbf99e214c483 | [
"MIT"
] | null | null | null | Final Assignment CSE331/Solution/4.asm | NazimKamolHasan/CSE331L-Section-1-Fall20-NSU | 2972b014959d4e67727e01edccacbf99e214c483 | [
"MIT"
] | null | null | null | .MODEL SMALL
.STACK 100H
.DATA
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
MOV AL,16
MOV CL,2
SHL AL,CL
MOV BL,AL
MOV AH,AL
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN | 11.444444 | 16 | 0.553398 |
f56603747024d15037f692ad50f10558b922c118 | 12,326 | cpp | C++ | Kits/UITK/UIStackPanel.cpp | acidburn0zzz/Xbox-GDK-Samples | 0a998ca467f923aa04bd124a5e5ca40fe16c386c | [
"MIT"
] | 1 | 2021-12-30T09:49:18.000Z | 2021-12-30T09:49:18.000Z | Kits/UITK/UIStackPanel.cpp | acidburn0zzz/Xbox-GDK-Samples | 0a998ca467f923aa04bd124a5e5ca40fe16c386c | [
"MIT"
] | null | null | null | Kits/UITK/UIStackPanel.cpp | acidburn0zzz/Xbox-GDK-Samples | 0a998ca467f923aa04bd124a5e5ca40fe16c386c | [
"MIT"
] | null | null | null | //--------------------------------------------------------------------------------------
// File: UIStackPanel.cpp
//
// Authored by: ATG
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-------------------------------------------------------------------------------------
#include "pch.h"
#include "UIStackPanel.h"
#include "UIKeywords.h"
NAMESPACE_ATG_UITK_BEGIN
INITIALIZE_CLASS_LOG_DEBUG(UIStackPanel);
/*virtual*/ bool UIStackPanel::HandleGlobalInputState(const UIInputState& inputState)
{
auto leftPressed = inputState.AnyDPLIsState(GamePad::ButtonStateTracker::PRESSED) ||
inputState.GetKeyboardKeys().IsKeyPressed(DirectX::Keyboard::Keys::Left);
auto rightPressed = inputState.AnyDPRIsState(GamePad::ButtonStateTracker::PRESSED) ||
inputState.GetKeyboardKeys().IsKeyPressed(DirectX::Keyboard::Keys::Right);
auto upPressed = inputState.AnyDPUIsState(GamePad::ButtonStateTracker::PRESSED) ||
inputState.GetKeyboardKeys().IsKeyPressed(DirectX::Keyboard::Keys::Up);
auto downPressed = inputState.AnyDPDIsState(GamePad::ButtonStateTracker::PRESSED) ||
inputState.GetKeyboardKeys().IsKeyPressed(DirectX::Keyboard::Keys::Down);
auto prevPressed = IsVertical(m_stackPanelDataProperties.stackingOrientation) ? upPressed : leftPressed;
auto nextPressed = IsVertical(m_stackPanelDataProperties.stackingOrientation) ? downPressed : rightPressed;
bool isMouse = false;
if (IsVertical(m_stackPanelDataProperties.stackingOrientation))
{
static int s_scrollWheelValue = 0;
if (inputState.GetMouseState().scrollWheelValue < s_scrollWheelValue)
{
isMouse = true;
nextPressed = true;
}
else if (inputState.GetMouseState().scrollWheelValue > s_scrollWheelValue)
{
isMouse = true;
prevPressed = true;
}
s_scrollWheelValue = inputState.GetMouseState().scrollWheelValue;
}
return (m_stackPanelDataProperties.maxVisibleItems > 0) ?
(prevPressed ? ShiftPrevious(isMouse) :
nextPressed ? ShiftNext(isMouse) :
false) :
false;
}
/*virtual*/ bool UIStackPanel::HandleInputEvent(const InputEvent& inputEvent)
{
if (inputEvent.m_inputEvent != InputEvent::InputStateChange)
{
return false;
}
return false;
}
void UIStackPanel::Update(float)
{
PIXScopedEvent(PIX_COLOR_DEFAULT, L"UIStackPanel_Update");
PIXSetMarker(PIX_COLOR_DEFAULT, L"StackPanel: %hs", GetID().AsCStr());
Vector2 stackOffsetSign = Vector2::Zero;
Vector2 stackOffsetPosition = Vector2::Zero;
Anchor positioningAndSizingAnchor{};
switch (GetOrientation())
{
case StackingOrientation::Down:
positioningAndSizingAnchor.Horizontal = m_stackPanelDataProperties.horizontalAlignmentAnchor;
positioningAndSizingAnchor.Vertical = VerticalAnchor::Top;
stackOffsetSign = DirectX::SimpleMath::Vector2(0.0f, 1.0f);
break;
case StackingOrientation::Up:
positioningAndSizingAnchor.Horizontal = m_stackPanelDataProperties.horizontalAlignmentAnchor;
positioningAndSizingAnchor.Vertical = VerticalAnchor::Bottom;
stackOffsetSign = DirectX::SimpleMath::Vector2(0.0f, -1.0f);
break;
case StackingOrientation::Left:
positioningAndSizingAnchor.Vertical = m_stackPanelDataProperties.verticalAlignmentAnchor;
positioningAndSizingAnchor.Horizontal = HorizontalAnchor::Right;
stackOffsetSign = DirectX::SimpleMath::Vector2(-1.0f, 0.0f);
break;
case StackingOrientation::Right:
positioningAndSizingAnchor.Vertical = m_stackPanelDataProperties.verticalAlignmentAnchor;
positioningAndSizingAnchor.Horizontal = HorizontalAnchor::Left;
stackOffsetSign = DirectX::SimpleMath::Vector2(1.0f, 0.0f);
break;
default:
throw std::exception("Invalid options");
}
auto numChildren = uint32_t(m_children.size());
if (numChildren != m_numChildren && numChildren > 0)
{
// numChildren changed, readjust slider if necessary
if (m_cachedSlider)
{
// 0 1 2 3 4 5 6 7 8 9 numChildren 10 maxVisibleItems 4
// 0 1 2 3 > 6 7 8 9 maxValue = 6
// range [0-6]
// 10 - 4 + 1 = 7 steps
uint32_t maxVisible = m_stackPanelDataProperties.maxVisibleItems;
uint32_t maxValue = uint32_t(numChildren) - maxVisible;
m_cachedSlider->ModifySliderRange(0.f, float(maxValue), maxValue + 1);
m_cachedSlider->SetSliderValue(0.f);
// resize slider to match number of visible children
if (IsVertical(m_stackPanelDataProperties.stackingOrientation))
{
// assumes all children are same height
auto childHeight = m_children.at(0)->GetRelativeSizeInRefUnits().y;
auto newHeight = childHeight * maxVisible + m_stackPanelDataProperties.elementPadding * (maxVisible - 1);
m_cachedSlider->SetHeight(newHeight);
}
else
{
// assumes all children are same width
auto childWidth = m_children.at(0)->GetRelativeSizeInRefUnits().x;
auto newWidth = childWidth * maxVisible + m_stackPanelDataProperties.elementPadding * (maxVisible - 1);
m_cachedSlider->SetWidth(newWidth);
}
}
m_numChildren = numChildren;
}
uint32_t maxVisible = m_stackPanelDataProperties.maxVisibleItems;
for (uint32_t i = 0; i < numChildren; ++i)
{
auto& child = m_children.at(i);
if(maxVisible > 0)
{
child->SetVisible(i >= m_startIndex && i <= GetEndIndex());
}
if (!child->IsVisible())
{
continue;
}
if (!IsStackPanelId(child->GetClassID()))
{
child->SetPositioningAnchor(positioningAndSizingAnchor);
child->SetSizingAnchor(positioningAndSizingAnchor);
}
child->SetRelativePositionInRefUnits(stackOffsetPosition);
auto size = child->GetRelativeSizeInRefUnits();
auto offset = stackOffsetSign * m_stackPanelDataProperties.elementPadding;
stackOffsetPosition += (offset + (stackOffsetSign * size));
}
if (m_cachedSlider)
{
m_cachedSlider->SetVisible(numChildren > maxVisible);
}
if (m_updateFocus != c_noUpdate)
{
m_uiManager.SetFocus(m_children.at(m_updateFocus));
m_updateFocus = c_noUpdate;
}
InvalidateRectangleCaches();
}
void UIStackPanel::Reset()
{
m_startIndex = 0;
for (auto& child : m_children)
{
child->SetVisible(false);
}
m_children.clear();
m_numChildren = 0;
}
void UIStackPanel::WireUpElements()
{
if (!m_cachedSlider)
{
m_cachedSlider = GetTypedSubElementById<UISlider>(m_stackPanelDataProperties.sliderSubElementId);
}
if (m_cachedSlider)
{
m_cachedSlider->CurrentValueState().AddListener([this](UISlider*)
{
m_startIndex = uint32_t(std::round(m_cachedSlider->GetCurrentValue()));
});
}
}
bool UIStackPanel::IsFocusedAtBeginning()
{
return m_children.at(m_startIndex)->IsFocused();
}
bool UIStackPanel::IsFocusedAtEnd()
{
auto& child = m_children;
auto maxVisible = m_stackPanelDataProperties.maxVisibleItems;
if (maxVisible > 0 && child.size() > maxVisible)
{
return child.at(GetEndIndex())->IsFocused();
}
else
{
return child.at(child.size() - 1)->IsFocused();
}
}
bool UIStackPanel::HasMorePreviousElements()
{
return m_startIndex > 0;
}
bool UIStackPanel::HasMoreNextElements()
{
// example: size 10 maxVisibleItems 4
// 0 1 2 3 start 0 + 4 = 4 < 10 true
// 2 3 4 5 start 2 + 4 = 6 < 10 true
// 5 6 7 8 start 5 + 4 = 9 < 10 true
// 6 7 8 9 start 6 + 4 = 10 < 10 false
return (GetEndIndex() + 1) < m_children.size();
}
bool UIStackPanel::ShiftPrevious(bool isMouse)
{
auto focusedAtBeginning = IsFocusedAtBeginning();
auto focusedAtEnd = IsFocusedAtEnd();
if ((isMouse || focusedAtBeginning) && HasMorePreviousElements())
{
m_startIndex -= 1;
auto endIndex = GetEndIndex();
UILOG_DEBUG("ShiftPrevious [%d-%d] (%d)", m_startIndex, endIndex, m_children.size());
if (focusedAtBeginning)
{
m_updateFocus = m_startIndex;
}
else if (focusedAtEnd)
{
m_updateFocus = endIndex;
}
if (m_cachedSlider && m_cachedSlider->IsVisible())
{
m_cachedSlider->SetSliderValue(float(m_startIndex));
}
return true;
}
return false;
}
bool UIStackPanel::ShiftNext(bool isMouse)
{
auto focusedAtBeginning = IsFocusedAtBeginning();
auto focusedAtEnd = IsFocusedAtEnd();
if ((isMouse || focusedAtEnd) && HasMoreNextElements())
{
m_startIndex += 1;
auto endIndex = GetEndIndex();
UILOG_DEBUG("ShiftNext [%d-%d] (%d)", m_startIndex, endIndex, m_children.size());
if (focusedAtBeginning)
{
m_updateFocus = m_startIndex;
}
else if (focusedAtEnd)
{
m_updateFocus = endIndex;
}
if (m_cachedSlider && m_cachedSlider->IsVisible())
{
m_cachedSlider->SetSliderValue(float(m_startIndex));
}
return true;
}
return false;
}
ENUM_LOOKUP_TABLE(StackingOrientation,
ID_ENUM_PAIR(UITK_VALUE(down), StackingOrientation::Down),
ID_ENUM_PAIR(UITK_VALUE(up), StackingOrientation::Up),
ID_ENUM_PAIR(UITK_VALUE(left), StackingOrientation::Left),
ID_ENUM_PAIR(UITK_VALUE(right), StackingOrientation::Right)
)
/*static*/ void UIStackPanelFactory::DeserializeDataProperties(
_In_ UIDataPtr data,
_Out_ StackPanelDataProperties& stackDataProperties)
{
ID classId;
data->GetTo(UITK_FIELD(classId), classId);
// the stacking direction of the stack
ID stackingOrientationID;
if (data->GetTo(UITK_FIELD(stackingOrientation), stackingOrientationID))
{
UIEnumLookup(stackingOrientationID, stackDataProperties.stackingOrientation);
}
else
{
// provide defaults for the various stacking classes
if (classId == UIStackPanel::VerticalStackPanelClassID())
{
stackDataProperties.stackingOrientation = StackPanelDataProperties::c_defaultVerticalStackingOrientation;
}
else
{
stackDataProperties.stackingOrientation = StackPanelDataProperties::c_defaultHorizontalStackingOrientation;
}
}
// Get the class id to determine the alignment strategy
if (classId == UIStackPanel::VerticalStackPanelClassID())
{
assert(UIStackPanel::IsVertical(stackDataProperties.stackingOrientation));
data->GetTo(UITK_FIELD(stackElementAlignment), stackDataProperties.verticalAlignmentAnchor);
}
else
{
assert(UIStackPanel::IsHorizontal(stackDataProperties.stackingOrientation));
data->GetTo(UITK_FIELD(stackElementAlignment), stackDataProperties.horizontalAlignmentAnchor);
}
// the spacing between stacked elements
data->GetTo(UITK_FIELD(stackElementPadding), stackDataProperties.elementPadding);
// number of visible elements
data->GetTo(UITK_FIELD(maxVisibleItems), stackDataProperties.maxVisibleItems);
// optional slider that shows when visible < num elements
stackDataProperties.sliderSubElementId = data->GetIfExists<ID>(
UITK_FIELD(sliderSubElementId), ID::Default);
}
NAMESPACE_ATG_UITK_END
| 33.585831 | 122 | 0.637758 |
39f1765db416d74919089dd17a1e6760c3a98dcc | 8,592 | java | Java | src/test/java/com/zoooohs/instagramclone/domain/like/service/LikeServiceTest.java | zoooo-hs/instagram-clone-be | 574745caf16aed3e6d1df322e2497d36ef1bd07f | [
"Apache-2.0"
] | 5 | 2022-02-08T01:01:35.000Z | 2022-02-24T10:25:21.000Z | src/test/java/com/zoooohs/instagramclone/domain/like/service/LikeServiceTest.java | zoooo-hs/instagram-clone-be | 574745caf16aed3e6d1df322e2497d36ef1bd07f | [
"Apache-2.0"
] | 3 | 2022-01-30T16:28:20.000Z | 2022-03-04T03:47:09.000Z | src/test/java/com/zoooohs/instagramclone/domain/like/service/LikeServiceTest.java | zoooo-hs/instagram-clone-be | 574745caf16aed3e6d1df322e2497d36ef1bd07f | [
"Apache-2.0"
] | null | null | null | package com.zoooohs.instagramclone.domain.like.service;
import com.zoooohs.instagramclone.domain.comment.entity.PostCommentEntity;
import com.zoooohs.instagramclone.domain.comment.repository.CommentRepository;
import com.zoooohs.instagramclone.domain.like.dto.CommentLikeDto;
import com.zoooohs.instagramclone.domain.like.dto.PostLikeDto;
import com.zoooohs.instagramclone.domain.like.entity.CommentLikeEntity;
import com.zoooohs.instagramclone.domain.like.entity.PostLikeEntity;
import com.zoooohs.instagramclone.domain.like.repository.CommentLikeRepository;
import com.zoooohs.instagramclone.domain.like.repository.LikeRepository;
import com.zoooohs.instagramclone.domain.like.repository.PostLikeRepository;
import com.zoooohs.instagramclone.domain.post.entity.PostEntity;
import com.zoooohs.instagramclone.domain.post.repository.PostRepository;
import com.zoooohs.instagramclone.domain.user.dto.UserDto;
import com.zoooohs.instagramclone.domain.user.entity.UserEntity;
import com.zoooohs.instagramclone.exception.ErrorCode;
import com.zoooohs.instagramclone.exception.ZooooException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import org.modelmapper.ModelMapper;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.BDDMockito.*;
@ExtendWith(MockitoExtension.class)
public class LikeServiceTest {
LikeService likeService;
@Mock
PostRepository postRepository;
@Mock
PostLikeRepository postLikeRepository;
@Mock
CommentRepository commentRepository;
@Mock
CommentLikeRepository commentLikeRepository;
@Mock
LikeRepository likeRepository;
@Spy
ModelMapper modelMapper;
private UserDto userDto;
private Long postId;
private PostLikeEntity postLikeEntity;
private PostEntity postEntity;
private Long commentId;
private PostCommentEntity commentEntity;
private CommentLikeEntity commentLikeEntity;
private UserEntity userEntity;
@BeforeEach
public void setUp() {
likeService = new LikeServiceImpl(postRepository, postLikeRepository, commentRepository, commentLikeRepository, modelMapper, likeRepository);
userDto = UserDto.builder().id(1L).build();
postId = 1L;
postEntity = PostEntity.builder().id(postId).build();
userEntity = UserEntity.builder().id(1L).build();
postLikeEntity = PostLikeEntity.builder().user(userEntity).post(postEntity).build();
postLikeEntity.setId(1L);
commentId = 1L;
commentEntity = PostCommentEntity.builder().post(postEntity).build();
commentEntity.setId(commentId);
commentLikeEntity = CommentLikeEntity.builder().comment(commentEntity).user(userEntity).build();
commentLikeEntity.setId(1L);
}
@MockitoSettings(strictness = Strictness.LENIENT)
@DisplayName("postId, userDto 입력 받아 like Entity 저장하고 like dto 반환하는 서비스 + postid, userId로 이미 like가 존재한다면 존재하는 like dto를 반환, 없을 경우에만 save 후 반환")
@Test
public void likePostTest() {
given(postRepository.findById(eq(postId))).willReturn(Optional.ofNullable(postEntity));
given(postLikeRepository.save(any(PostLikeEntity.class))).willReturn(postLikeEntity);
PostLikeDto actual = likeService.likePost(postId, userDto);
assertNotNull(actual.getId());
assertEquals(postId, actual.getPost().getId());
// unique key 테스트
given(postLikeRepository.findByPostIdAndUserId(eq(postId), eq(userDto.getId()))).willReturn(postLikeEntity);
try {
likeService.likePost(postId, userDto);
fail();
} catch (ZooooException e) {
assertEquals(ErrorCode.ALREADY_LIKED_POST, e.getErrorCode());
} catch (Exception e) {
fail();
}
}
@DisplayName("postId가 없을 경우 post not found 예외 쓰로우 테스트")
@Test
public void likeFailure404Test() {
try {
likeService.likePost(2L, userDto);
fail();
} catch (ZooooException e) {
assertEquals(ErrorCode.POST_NOT_FOUND, e.getErrorCode());
} catch (Exception e) {
fail();
}
}
@DisplayName("postid, userdto 받아 like entity 삭제 후 삭제된 id 반환")
@Test
public void unlikePostTest() {
given(postLikeRepository.findByPostIdAndUserId(eq(postId), eq(userDto.getId()))).willReturn(postLikeEntity);
Long actual = likeService.unlikePost(postId, userDto);
assertEquals(1L, actual);
}
@DisplayName("postid, userdto 에 맞는 like없을 경우 like not found 예외 쓰로우")
@Test
public void unlikePostFailure404Test() {
try {
likeService.unlikePost(2L, userDto);
} catch (ZooooException e) {
assertEquals(ErrorCode.LIKE_NOT_FOUND, e.getErrorCode());
} catch (Exception e) {
fail();
}
}
@MockitoSettings(strictness = Strictness.LENIENT)
@DisplayName("commentId, userDto 입력 받아 like entity save후 like dto 반환 + commentId, userId로 이미 like가 존재한다면 존재하는 like dto를 반환, 없을 경우에만 save 후 반환")
@Test
public void likeCommentTest() {
given(commentRepository.findById(eq(commentId))).willReturn(Optional.of(commentEntity));
given(commentLikeRepository.save(any(CommentLikeEntity.class))).willReturn(commentLikeEntity);
CommentLikeDto actual = likeService.likeComment(commentId, userDto);
assertNotNull(actual);
assertEquals(commentId, actual.getComment().getId());
given(commentLikeRepository.findByCommentIdAndUserId(eq(commentId), eq(userDto.getId()))).willReturn(commentLikeEntity);
try {
likeService.likeComment(commentId, userDto);
fail();
} catch (ZooooException e) {
assertEquals(ErrorCode.ALREADY_LIKED_COMMENT, e.getErrorCode());
} catch (Exception e) {
fail();
}
}
@DisplayName("commentId 만족하는 comment entity없을 경우 COMMENT_NOT_FOUND throw")
@Test
public void likeCommentFailure404Test() {
given(commentRepository.findById(eq(commentId))).willReturn(Optional.ofNullable(null));
try {
likeService.likeComment(commentId, userDto);
fail();
} catch (ZooooException e) {
assertEquals(ErrorCode.COMMENT_NOT_FOUND, e.getErrorCode());
} catch (Exception e) {
fail();
}
}
@DisplayName("commentId, userDto 입력 받아 commentId, userDto 일치하는 comment like 삭제 후 like id 반환.")
@Test
public void unlikeCommentTest() {
given(commentLikeRepository.findByCommentIdAndUserId(eq(commentId), eq(userDto.getId()))).willReturn(commentLikeEntity);
Long actual = likeService.unlikeComment(commentId, userDto);
assertEquals(commentLikeEntity.getId(), actual);
}
@DisplayName("commentId, userDto 입력 받아 commentId, userDto 일치하는 commetn like 없을 시 like not found throw")
@Test
public void unlikeCommentFailure404Test() {
given(commentLikeRepository.findByCommentIdAndUserId(eq(commentId), eq(userDto.getId()))).willReturn(null);
try {
likeService.unlikeComment(commentId, userDto);
fail();
} catch (ZooooException e) {
assertEquals(ErrorCode.LIKE_NOT_FOUND, e.getErrorCode());
} catch (Exception e) {
fail();
}
}
@DisplayName("likeId, userDto 입력 받아 likeId로 저장한 좋아요가 있으면 삭제 후 id 반환")
@Test
public void unlikeTest() {
Long likeId = 1L;
given(likeRepository.findByIdAndUserId(eq(likeId), eq(userDto.getId()))).willReturn(Optional.of(new CommentLikeEntity()));
Long actual = likeService.unlike(likeId, userDto);
assertEquals(likeId, actual);
}
@DisplayName("likeId, userDto 입력 받아 likeId로 저장한 좋아요가 없으면 LIKE NOT FOUND Throw")
@Test
public void unlikeFailure404Test() {
Long likeId = 1L;
given(likeRepository.findByIdAndUserId(eq(likeId), eq(userDto.getId()))).willThrow(new ZooooException(ErrorCode.LIKE_NOT_FOUND));
try {
likeService.unlike(likeId, userDto);
fail();
} catch (ZooooException e) {
assertEquals(ErrorCode.LIKE_NOT_FOUND, e.getErrorCode());
} catch (Exception e) {
fail();
}
}
}
| 37.194805 | 149 | 0.695298 |
d56ad4f6020ce7a2e95daea74802a0781d98c9cd | 56,214 | asm | Assembly | core/vice-3.3/src/lib/libx264/common/x86/mc-a2.asm | paulscottrobson/cxp-computer | b43f47d5e8232d3229c6522c9a02d53c1edd3a4d | [
"MIT"
] | 1 | 2021-07-05T05:25:39.000Z | 2021-07-05T05:25:39.000Z | third_party/vice-3.3/src/lib/libx264/common/x86/mc-a2.asm | xlar54/bmc64 | c73f91babaf9e9f75b5073c773bb50e8a8e43505 | [
"Apache-2.0"
] | 4 | 2019-06-18T14:45:35.000Z | 2019-06-22T17:18:22.000Z | third_party/vice-3.3/src/lib/libx264/common/x86/mc-a2.asm | xlar54/bmc64 | c73f91babaf9e9f75b5073c773bb50e8a8e43505 | [
"Apache-2.0"
] | 1 | 2021-05-14T11:13:44.000Z | 2021-05-14T11:13:44.000Z | ;*****************************************************************************
;* mc-a2.asm: x86 motion compensation
;*****************************************************************************
;* Copyright (C) 2005-2014 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Fiona Glaser <fiona@x264.com>
;* Holger Lubitz <holger@lubitz.org>
;* Mathieu Monnier <manao@melix.net>
;* Oskar Arvidsson <oskar@irock.se>
;*
;* This program is free software; you can redistribute it and/or modify
;* it under the terms of the GNU General Public License as published by
;* the Free Software Foundation; either version 2 of the License, or
;* (at your option) any later version.
;*
;* This program is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;* GNU General Public License for more details.
;*
;* You should have received a copy of the GNU General Public License
;* along with this program; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
;*
;* This program is also available under a commercial proprietary license.
;* For more information, contact us at licensing@x264.com.
;*****************************************************************************
%include "x86inc.asm"
%include "x86util.asm"
SECTION_RODATA 32
pw_1024: times 16 dw 1024
filt_mul20: times 32 db 20
filt_mul15: times 16 db 1, -5
filt_mul51: times 16 db -5, 1
hpel_shuf: times 2 db 0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15
deinterleave_shuf: times 2 db 0,2,4,6,8,10,12,14,1,3,5,7,9,11,13,15
%if HIGH_BIT_DEPTH
v210_mask: times 4 dq 0xc00ffc003ff003ff
v210_luma_shuf: times 2 db 1,2,4,5,6,7,9,10,12,13,14,15,12,13,14,15
v210_chroma_shuf: times 2 db 0,1,2,3,5,6,8,9,10,11,13,14,10,11,13,14
; vpermd indices {0,1,2,4,5,7,_,_} merged in the 3 lsb of each dword to save a register
v210_mult: dw 0x2000,0x7fff,0x0801,0x2000,0x7ffa,0x0800,0x7ffc,0x0800
dw 0x1ffd,0x7fff,0x07ff,0x2000,0x7fff,0x0800,0x7fff,0x0800
deinterleave_shuf32a: SHUFFLE_MASK_W 0,2,4,6,8,10,12,14
deinterleave_shuf32b: SHUFFLE_MASK_W 1,3,5,7,9,11,13,15
%else
deinterleave_rgb_shuf: db 0,3,6,9,1,4,7,10,2,5,8,11,-1,-1,-1,-1
db 0,4,8,12,1,5,9,13,2,6,10,14,-1,-1,-1,-1
deinterleave_shuf32a: db 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30
deinterleave_shuf32b: db 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31
%endif ; !HIGH_BIT_DEPTH
pd_16: times 4 dd 16
pd_0f: times 4 dd 0xffff
pad10: times 8 dw 10*PIXEL_MAX
pad20: times 8 dw 20*PIXEL_MAX
pad30: times 8 dw 30*PIXEL_MAX
depad: times 4 dd 32*20*PIXEL_MAX + 512
tap1: times 4 dw 1, -5
tap2: times 4 dw 20, 20
tap3: times 4 dw -5, 1
pw_0xc000: times 8 dw 0xc000
pw_31: times 8 dw 31
pd_4: times 4 dd 4
SECTION .text
cextern pb_0
cextern pw_1
cextern pw_8
cextern pw_16
cextern pw_32
cextern pw_512
cextern pw_00ff
cextern pw_3fff
cextern pw_pixel_max
cextern pw_0to15
cextern pd_ffff
%macro LOAD_ADD 4
movh %4, %3
movh %1, %2
punpcklbw %4, m0
punpcklbw %1, m0
paddw %1, %4
%endmacro
%macro LOAD_ADD_2 6
mova %5, %3
mova %1, %4
punpckhbw %6, %5, m0
punpcklbw %5, m0
punpckhbw %2, %1, m0
punpcklbw %1, m0
paddw %1, %5
paddw %2, %6
%endmacro
%macro FILT_V2 6
psubw %1, %2 ; a-b
psubw %4, %5
psubw %2, %3 ; b-c
psubw %5, %6
psllw %2, 2
psllw %5, 2
psubw %1, %2 ; a-5*b+4*c
psllw %3, 4
psubw %4, %5
psllw %6, 4
paddw %1, %3 ; a-5*b+20*c
paddw %4, %6
%endmacro
%macro FILT_H 3
psubw %1, %2 ; a-b
psraw %1, 2 ; (a-b)/4
psubw %1, %2 ; (a-b)/4-b
paddw %1, %3 ; (a-b)/4-b+c
psraw %1, 2 ; ((a-b)/4-b+c)/4
paddw %1, %3 ; ((a-b)/4-b+c)/4+c = (a-5*b+20*c)/16
%endmacro
%macro FILT_H2 6
psubw %1, %2
psubw %4, %5
psraw %1, 2
psraw %4, 2
psubw %1, %2
psubw %4, %5
paddw %1, %3
paddw %4, %6
psraw %1, 2
psraw %4, 2
paddw %1, %3
paddw %4, %6
%endmacro
%macro FILT_PACK 3-5
%if cpuflag(ssse3)
pmulhrsw %1, %3
pmulhrsw %2, %3
%else
paddw %1, %3
paddw %2, %3
%if %0 == 5
psubusw %1, %5
psubusw %2, %5
psrlw %1, %4
psrlw %2, %4
%else
psraw %1, %4
psraw %2, %4
%endif
%endif
%if HIGH_BIT_DEPTH == 0
packuswb %1, %2
%endif
%endmacro
;The hpel_filter routines use non-temporal writes for output.
;The following defines may be uncommented for testing.
;Doing the hpel_filter temporal may be a win if the last level cache
;is big enough (preliminary benching suggests on the order of 4* framesize).
;%define movntq movq
;%define movntps movaps
;%define sfence
%if HIGH_BIT_DEPTH
;-----------------------------------------------------------------------------
; void hpel_filter_v( uint16_t *dst, uint16_t *src, int16_t *buf, intptr_t stride, intptr_t width );
;-----------------------------------------------------------------------------
%macro HPEL_FILTER 0
cglobal hpel_filter_v, 5,6,11
FIX_STRIDES r3, r4
lea r5, [r1+r3]
sub r1, r3
sub r1, r3
%if num_mmregs > 8
mova m8, [pad10]
mova m9, [pad20]
mova m10, [pad30]
%define s10 m8
%define s20 m9
%define s30 m10
%else
%define s10 [pad10]
%define s20 [pad20]
%define s30 [pad30]
%endif
add r0, r4
add r2, r4
neg r4
mova m7, [pw_pixel_max]
pxor m0, m0
.loop:
mova m1, [r1]
mova m2, [r1+r3]
mova m3, [r1+r3*2]
mova m4, [r1+mmsize]
mova m5, [r1+r3+mmsize]
mova m6, [r1+r3*2+mmsize]
paddw m1, [r5+r3*2]
paddw m2, [r5+r3]
paddw m3, [r5]
paddw m4, [r5+r3*2+mmsize]
paddw m5, [r5+r3+mmsize]
paddw m6, [r5+mmsize]
add r1, 2*mmsize
add r5, 2*mmsize
FILT_V2 m1, m2, m3, m4, m5, m6
mova m6, [pw_16]
psubw m1, s20
psubw m4, s20
mova [r2+r4], m1
mova [r2+r4+mmsize], m4
paddw m1, s30
paddw m4, s30
FILT_PACK m1, m4, m6, 5, s10
CLIPW m1, m0, m7
CLIPW m4, m0, m7
mova [r0+r4], m1
mova [r0+r4+mmsize], m4
add r4, 2*mmsize
jl .loop
RET
;-----------------------------------------------------------------------------
; void hpel_filter_c( uint16_t *dst, int16_t *buf, intptr_t width );
;-----------------------------------------------------------------------------
cglobal hpel_filter_c, 3,3,10
add r2, r2
add r0, r2
add r1, r2
neg r2
mova m0, [tap1]
mova m7, [tap3]
%if num_mmregs > 8
mova m8, [tap2]
mova m9, [depad]
%define s1 m8
%define s2 m9
%else
%define s1 [tap2]
%define s2 [depad]
%endif
.loop:
movu m1, [r1+r2-4]
movu m2, [r1+r2-2]
mova m3, [r1+r2+0]
movu m4, [r1+r2+2]
movu m5, [r1+r2+4]
movu m6, [r1+r2+6]
pmaddwd m1, m0
pmaddwd m2, m0
pmaddwd m3, s1
pmaddwd m4, s1
pmaddwd m5, m7
pmaddwd m6, m7
paddd m1, s2
paddd m2, s2
paddd m3, m5
paddd m4, m6
paddd m1, m3
paddd m2, m4
psrad m1, 10
psrad m2, 10
pslld m2, 16
pand m1, [pd_0f]
por m1, m2
CLIPW m1, [pb_0], [pw_pixel_max]
mova [r0+r2], m1
add r2, mmsize
jl .loop
RET
;-----------------------------------------------------------------------------
; void hpel_filter_h( uint16_t *dst, uint16_t *src, intptr_t width );
;-----------------------------------------------------------------------------
cglobal hpel_filter_h, 3,4,8
%define src r1+r2
add r2, r2
add r0, r2
add r1, r2
neg r2
mova m0, [pw_pixel_max]
.loop:
movu m1, [src-4]
movu m2, [src-2]
mova m3, [src+0]
movu m6, [src+2]
movu m4, [src+4]
movu m5, [src+6]
paddw m3, m6 ; c0
paddw m2, m4 ; b0
paddw m1, m5 ; a0
%if mmsize == 16
movu m4, [src-4+mmsize]
movu m5, [src-2+mmsize]
%endif
movu m7, [src+4+mmsize]
movu m6, [src+6+mmsize]
paddw m5, m7 ; b1
paddw m4, m6 ; a1
movu m7, [src+2+mmsize]
mova m6, [src+0+mmsize]
paddw m6, m7 ; c1
FILT_H2 m1, m2, m3, m4, m5, m6
mova m7, [pw_1]
pxor m2, m2
FILT_PACK m1, m4, m7, 1
CLIPW m1, m2, m0
CLIPW m4, m2, m0
mova [r0+r2], m1
mova [r0+r2+mmsize], m4
add r2, mmsize*2
jl .loop
RET
%endmacro ; HPEL_FILTER
INIT_MMX mmx2
HPEL_FILTER
INIT_XMM sse2
HPEL_FILTER
%endif ; HIGH_BIT_DEPTH
%if HIGH_BIT_DEPTH == 0
%macro HPEL_V 1
;-----------------------------------------------------------------------------
; void hpel_filter_v( uint8_t *dst, uint8_t *src, int16_t *buf, intptr_t stride, intptr_t width );
;-----------------------------------------------------------------------------
cglobal hpel_filter_v, 5,6,%1
lea r5, [r1+r3]
sub r1, r3
sub r1, r3
add r0, r4
lea r2, [r2+r4*2]
neg r4
%if cpuflag(ssse3)
mova m0, [filt_mul15]
%else
pxor m0, m0
%endif
.loop:
%if cpuflag(ssse3)
mova m1, [r1]
mova m4, [r1+r3]
mova m2, [r5+r3*2]
mova m5, [r5+r3]
mova m3, [r1+r3*2]
mova m6, [r5]
SBUTTERFLY bw, 1, 4, 7
SBUTTERFLY bw, 2, 5, 7
SBUTTERFLY bw, 3, 6, 7
pmaddubsw m1, m0
pmaddubsw m4, m0
pmaddubsw m2, m0
pmaddubsw m5, m0
pmaddubsw m3, [filt_mul20]
pmaddubsw m6, [filt_mul20]
paddw m1, m2
paddw m4, m5
paddw m1, m3
paddw m4, m6
mova m7, [pw_1024]
%else
LOAD_ADD_2 m1, m4, [r1 ], [r5+r3*2], m6, m7 ; a0 / a1
LOAD_ADD_2 m2, m5, [r1+r3 ], [r5+r3 ], m6, m7 ; b0 / b1
LOAD_ADD m3, [r1+r3*2], [r5 ], m7 ; c0
LOAD_ADD m6, [r1+r3*2+mmsize/2], [r5+mmsize/2], m7 ; c1
FILT_V2 m1, m2, m3, m4, m5, m6
mova m7, [pw_16]
%endif
%if mmsize==32
mova [r2+r4*2], xm1
mova [r2+r4*2+mmsize/2], xm4
vextracti128 [r2+r4*2+mmsize], m1, 1
vextracti128 [r2+r4*2+mmsize*3/2], m4, 1
%else
mova [r2+r4*2], m1
mova [r2+r4*2+mmsize], m4
%endif
FILT_PACK m1, m4, m7, 5
movnta [r0+r4], m1
add r1, mmsize
add r5, mmsize
add r4, mmsize
jl .loop
RET
%endmacro
;-----------------------------------------------------------------------------
; void hpel_filter_c( uint8_t *dst, int16_t *buf, intptr_t width );
;-----------------------------------------------------------------------------
INIT_MMX mmx2
cglobal hpel_filter_c, 3,3
add r0, r2
lea r1, [r1+r2*2]
neg r2
%define src r1+r2*2
movq m7, [pw_32]
.loop:
movq m1, [src-4]
movq m2, [src-2]
movq m3, [src ]
movq m4, [src+4]
movq m5, [src+6]
paddw m3, [src+2] ; c0
paddw m2, m4 ; b0
paddw m1, m5 ; a0
movq m6, [src+8]
paddw m4, [src+14] ; a1
paddw m5, [src+12] ; b1
paddw m6, [src+10] ; c1
FILT_H2 m1, m2, m3, m4, m5, m6
FILT_PACK m1, m4, m7, 6
movntq [r0+r2], m1
add r2, 8
jl .loop
RET
;-----------------------------------------------------------------------------
; void hpel_filter_h( uint8_t *dst, uint8_t *src, intptr_t width );
;-----------------------------------------------------------------------------
INIT_MMX mmx2
cglobal hpel_filter_h, 3,3
add r0, r2
add r1, r2
neg r2
%define src r1+r2
pxor m0, m0
.loop:
movd m1, [src-2]
movd m2, [src-1]
movd m3, [src ]
movd m6, [src+1]
movd m4, [src+2]
movd m5, [src+3]
punpcklbw m1, m0
punpcklbw m2, m0
punpcklbw m3, m0
punpcklbw m6, m0
punpcklbw m4, m0
punpcklbw m5, m0
paddw m3, m6 ; c0
paddw m2, m4 ; b0
paddw m1, m5 ; a0
movd m7, [src+7]
movd m6, [src+6]
punpcklbw m7, m0
punpcklbw m6, m0
paddw m4, m7 ; c1
paddw m5, m6 ; b1
movd m7, [src+5]
movd m6, [src+4]
punpcklbw m7, m0
punpcklbw m6, m0
paddw m6, m7 ; a1
movq m7, [pw_1]
FILT_H2 m1, m2, m3, m4, m5, m6
FILT_PACK m1, m4, m7, 1
movntq [r0+r2], m1
add r2, 8
jl .loop
RET
%macro HPEL_C 0
;-----------------------------------------------------------------------------
; void hpel_filter_c( uint8_t *dst, int16_t *buf, intptr_t width );
;-----------------------------------------------------------------------------
cglobal hpel_filter_c, 3,3,9
add r0, r2
lea r1, [r1+r2*2]
neg r2
%define src r1+r2*2
%ifnidn cpuname, sse2
%if cpuflag(ssse3)
mova m7, [pw_512]
%else
mova m7, [pw_32]
%endif
%define pw_rnd m7
%elif ARCH_X86_64
mova m8, [pw_32]
%define pw_rnd m8
%else
%define pw_rnd [pw_32]
%endif
; This doesn't seem to be faster (with AVX) on Sandy Bridge or Bulldozer...
%if mmsize==32
.loop:
movu m4, [src-4]
movu m5, [src-2]
mova m6, [src+0]
movu m3, [src-4+mmsize]
movu m2, [src-2+mmsize]
mova m1, [src+0+mmsize]
paddw m4, [src+6]
paddw m5, [src+4]
paddw m6, [src+2]
paddw m3, [src+6+mmsize]
paddw m2, [src+4+mmsize]
paddw m1, [src+2+mmsize]
FILT_H2 m4, m5, m6, m3, m2, m1
%else
mova m0, [src-16]
mova m1, [src]
.loop:
mova m2, [src+16]
PALIGNR m4, m1, m0, 12, m7
PALIGNR m5, m1, m0, 14, m0
PALIGNR m0, m2, m1, 6, m7
paddw m4, m0
PALIGNR m0, m2, m1, 4, m7
paddw m5, m0
PALIGNR m6, m2, m1, 2, m7
paddw m6, m1
FILT_H m4, m5, m6
mova m0, m2
mova m5, m2
PALIGNR m2, m1, 12, m7
PALIGNR m5, m1, 14, m1
mova m1, [src+32]
PALIGNR m3, m1, m0, 6, m7
paddw m3, m2
PALIGNR m6, m1, m0, 4, m7
paddw m5, m6
PALIGNR m6, m1, m0, 2, m7
paddw m6, m0
FILT_H m3, m5, m6
%endif
FILT_PACK m4, m3, pw_rnd, 6
%if mmsize==32
vpermq m4, m4, q3120
%endif
movnta [r0+r2], m4
add r2, mmsize
jl .loop
RET
%endmacro
;-----------------------------------------------------------------------------
; void hpel_filter_h( uint8_t *dst, uint8_t *src, intptr_t width );
;-----------------------------------------------------------------------------
INIT_XMM sse2
cglobal hpel_filter_h, 3,3,8
add r0, r2
add r1, r2
neg r2
%define src r1+r2
pxor m0, m0
.loop:
movh m1, [src-2]
movh m2, [src-1]
movh m3, [src ]
movh m4, [src+1]
movh m5, [src+2]
movh m6, [src+3]
punpcklbw m1, m0
punpcklbw m2, m0
punpcklbw m3, m0
punpcklbw m4, m0
punpcklbw m5, m0
punpcklbw m6, m0
paddw m3, m4 ; c0
paddw m2, m5 ; b0
paddw m1, m6 ; a0
movh m4, [src+6]
movh m5, [src+7]
movh m6, [src+10]
movh m7, [src+11]
punpcklbw m4, m0
punpcklbw m5, m0
punpcklbw m6, m0
punpcklbw m7, m0
paddw m5, m6 ; b1
paddw m4, m7 ; a1
movh m6, [src+8]
movh m7, [src+9]
punpcklbw m6, m0
punpcklbw m7, m0
paddw m6, m7 ; c1
mova m7, [pw_1] ; FIXME xmm8
FILT_H2 m1, m2, m3, m4, m5, m6
FILT_PACK m1, m4, m7, 1
movntps [r0+r2], m1
add r2, 16
jl .loop
RET
;-----------------------------------------------------------------------------
; void hpel_filter_h( uint8_t *dst, uint8_t *src, intptr_t width );
;-----------------------------------------------------------------------------
%macro HPEL_H 0
cglobal hpel_filter_h, 3,3
add r0, r2
add r1, r2
neg r2
%define src r1+r2
mova m0, [src-16]
mova m1, [src]
mova m7, [pw_1024]
.loop:
mova m2, [src+16]
; Using unaligned loads instead of palignr is marginally slower on SB and significantly
; slower on Bulldozer, despite their fast load units -- even though it would let us avoid
; the repeated loads of constants for pmaddubsw.
palignr m3, m1, m0, 14
palignr m4, m1, m0, 15
palignr m0, m2, m1, 2
pmaddubsw m3, [filt_mul15]
pmaddubsw m4, [filt_mul15]
pmaddubsw m0, [filt_mul51]
palignr m5, m2, m1, 1
palignr m6, m2, m1, 3
paddw m3, m0
mova m0, m1
pmaddubsw m1, [filt_mul20]
pmaddubsw m5, [filt_mul20]
pmaddubsw m6, [filt_mul51]
paddw m3, m1
paddw m4, m5
paddw m4, m6
FILT_PACK m3, m4, m7, 5
pshufb m3, [hpel_shuf]
mova m1, m2
movntps [r0+r2], m3
add r2, 16
jl .loop
RET
%endmacro
INIT_MMX mmx2
HPEL_V 0
INIT_XMM sse2
HPEL_V 8
%if ARCH_X86_64 == 0
INIT_XMM sse2
HPEL_C
INIT_XMM ssse3
HPEL_C
HPEL_V 0
HPEL_H
INIT_XMM avx
HPEL_C
HPEL_V 0
HPEL_H
INIT_YMM avx2
HPEL_V 8
HPEL_C
INIT_YMM avx2
cglobal hpel_filter_h, 3,3,8
add r0, r2
add r1, r2
neg r2
%define src r1+r2
mova m5, [filt_mul15]
mova m6, [filt_mul20]
mova m7, [filt_mul51]
.loop:
movu m0, [src-2]
movu m1, [src-1]
movu m2, [src+2]
pmaddubsw m0, m5
pmaddubsw m1, m5
pmaddubsw m2, m7
paddw m0, m2
mova m2, [src+0]
movu m3, [src+1]
movu m4, [src+3]
pmaddubsw m2, m6
pmaddubsw m3, m6
pmaddubsw m4, m7
paddw m0, m2
paddw m1, m3
paddw m1, m4
mova m2, [pw_1024]
FILT_PACK m0, m1, m2, 5
pshufb m0, [hpel_shuf]
movnta [r0+r2], m0
add r2, mmsize
jl .loop
RET
%endif
%if ARCH_X86_64
%macro DO_FILT_V 5
;The optimum prefetch distance is difficult to determine in checkasm:
;any prefetch seems slower than not prefetching.
;In real use, the prefetch seems to be a slight win.
;+mmsize is picked somewhat arbitrarily here based on the fact that even one
;loop iteration is going to take longer than the prefetch.
prefetcht0 [r1+r2*2+mmsize]
%if cpuflag(ssse3)
mova m1, [r3]
mova m2, [r3+r2]
mova %3, [r3+r2*2]
mova m3, [r1]
mova %1, [r1+r2]
mova %2, [r1+r2*2]
punpckhbw m4, m1, m2
punpcklbw m1, m2
punpckhbw m2, %1, %2
punpcklbw %1, %2
punpckhbw %2, m3, %3
punpcklbw m3, %3
pmaddubsw m1, m12
pmaddubsw m4, m12
pmaddubsw %1, m0
pmaddubsw m2, m0
pmaddubsw m3, m14
pmaddubsw %2, m14
paddw m1, %1
paddw m4, m2
paddw m1, m3
paddw m4, %2
%else
LOAD_ADD_2 m1, m4, [r3 ], [r1+r2*2], m2, m5 ; a0 / a1
LOAD_ADD_2 m2, m5, [r3+r2 ], [r1+r2 ], m3, m6 ; b0 / b1
LOAD_ADD_2 m3, m6, [r3+r2*2], [r1 ], %3, %4 ; c0 / c1
packuswb %3, %4
FILT_V2 m1, m2, m3, m4, m5, m6
%endif
add r3, mmsize
add r1, mmsize
%if mmsize==32
vinserti128 %1, m1, xm4, 1
vperm2i128 %2, m1, m4, q0301
%else
mova %1, m1
mova %2, m4
%endif
FILT_PACK m1, m4, m15, 5
movntps [r8+r4+%5], m1
%endmacro
%macro FILT_C 3
%if mmsize==32
vperm2i128 m3, %2, %1, q0003
%endif
PALIGNR m1, %2, %1, (mmsize-4), m3
PALIGNR m2, %2, %1, (mmsize-2), m3
%if mmsize==32
vperm2i128 %1, %3, %2, q0003
%endif
PALIGNR m3, %3, %2, 4, %1
PALIGNR m4, %3, %2, 2, %1
paddw m3, m2
%if mmsize==32
mova m2, %1
%endif
mova %1, %3
PALIGNR %3, %3, %2, 6, m2
paddw m4, %2
paddw %3, m1
FILT_H %3, m3, m4
%endmacro
%macro DO_FILT_C 4
FILT_C %1, %2, %3
FILT_C %2, %1, %4
FILT_PACK %3, %4, m15, 6
%if mmsize==32
vpermq %3, %3, q3120
%endif
movntps [r5+r4], %3
%endmacro
%macro ADD8TO16 5
punpckhbw %3, %1, %5
punpcklbw %1, %5
punpcklbw %4, %2, %5
punpckhbw %2, %5
paddw %2, %3
paddw %1, %4
%endmacro
%macro DO_FILT_H 3
%if mmsize==32
vperm2i128 m3, %2, %1, q0003
%endif
PALIGNR m1, %2, %1, (mmsize-2), m3
PALIGNR m2, %2, %1, (mmsize-1), m3
%if mmsize==32
vperm2i128 m3, %3, %2, q0003
%endif
PALIGNR m4, %3, %2, 1 , m3
PALIGNR m5, %3, %2, 2 , m3
PALIGNR m6, %3, %2, 3 , m3
mova %1, %2
%if cpuflag(ssse3)
pmaddubsw m1, m12
pmaddubsw m2, m12
pmaddubsw %2, m14
pmaddubsw m4, m14
pmaddubsw m5, m0
pmaddubsw m6, m0
paddw m1, %2
paddw m2, m4
paddw m1, m5
paddw m2, m6
FILT_PACK m1, m2, m15, 5
pshufb m1, [hpel_shuf]
%else ; ssse3, avx
ADD8TO16 m1, m6, m12, m3, m0 ; a
ADD8TO16 m2, m5, m12, m3, m0 ; b
ADD8TO16 %2, m4, m12, m3, m0 ; c
FILT_V2 m1, m2, %2, m6, m5, m4
FILT_PACK m1, m6, m15, 5
%endif
movntps [r0+r4], m1
mova %2, %3
%endmacro
%macro HPEL 0
;-----------------------------------------------------------------------------
; void hpel_filter( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc,
; uint8_t *src, intptr_t stride, int width, int height )
;-----------------------------------------------------------------------------
cglobal hpel_filter, 7,9,16
mov r7, r3
sub r5d, mmsize
mov r8, r1
and r7, mmsize-1
sub r3, r7
add r0, r5
add r8, r5
add r7, r5
add r5, r2
mov r2, r4
neg r7
lea r1, [r3+r2]
sub r3, r2
sub r3, r2
mov r4, r7
%if cpuflag(ssse3)
mova m0, [filt_mul51]
mova m12, [filt_mul15]
mova m14, [filt_mul20]
mova m15, [pw_1024]
%else
pxor m0, m0
mova m15, [pw_16]
%endif
;ALIGN 16
.loopy:
; first filter_v
DO_FILT_V m8, m7, m13, m12, 0
;ALIGN 16
.loopx:
DO_FILT_V m6, m5, m11, m12, mmsize
.lastx:
%if cpuflag(ssse3)
psrlw m15, 1 ; pw_512
%else
paddw m15, m15 ; pw_32
%endif
DO_FILT_C m9, m8, m7, m6
%if cpuflag(ssse3)
paddw m15, m15 ; pw_1024
%else
psrlw m15, 1 ; pw_16
%endif
mova m7, m5
DO_FILT_H m10, m13, m11
add r4, mmsize
jl .loopx
cmp r4, mmsize
jl .lastx
; setup regs for next y
sub r4, r7
sub r4, r2
sub r1, r4
sub r3, r4
add r0, r2
add r8, r2
add r5, r2
mov r4, r7
sub r6d, 1
jg .loopy
sfence
RET
%endmacro
INIT_XMM sse2
HPEL
INIT_XMM ssse3
HPEL
INIT_XMM avx
HPEL
INIT_YMM avx2
HPEL
%endif ; ARCH_X86_64
%undef movntq
%undef movntps
%undef sfence
%endif ; !HIGH_BIT_DEPTH
;-----------------------------------------------------------------------------
; void plane_copy_core( pixel *dst, intptr_t i_dst,
; pixel *src, intptr_t i_src, int w, int h )
;-----------------------------------------------------------------------------
; assumes i_dst and w are multiples of 16, and i_dst>w
INIT_MMX
cglobal plane_copy_core_mmx2, 6,7
FIX_STRIDES r1, r3, r4d
%if HIGH_BIT_DEPTH == 0
movsxdifnidn r4, r4d
%endif
sub r1, r4
sub r3, r4
.loopy:
lea r6d, [r4-63]
.loopx:
prefetchnta [r2+256]
movq m0, [r2 ]
movq m1, [r2+ 8]
movntq [r0 ], m0
movntq [r0+ 8], m1
movq m2, [r2+16]
movq m3, [r2+24]
movntq [r0+16], m2
movntq [r0+24], m3
movq m4, [r2+32]
movq m5, [r2+40]
movntq [r0+32], m4
movntq [r0+40], m5
movq m6, [r2+48]
movq m7, [r2+56]
movntq [r0+48], m6
movntq [r0+56], m7
add r2, 64
add r0, 64
sub r6d, 64
jg .loopx
prefetchnta [r2+256]
add r6d, 63
jle .end16
.loop16:
movq m0, [r2 ]
movq m1, [r2+8]
movntq [r0 ], m0
movntq [r0+8], m1
add r2, 16
add r0, 16
sub r6d, 16
jg .loop16
.end16:
add r0, r1
add r2, r3
dec r5d
jg .loopy
sfence
emms
RET
%macro INTERLEAVE 4-5 ; dst, srcu, srcv, is_aligned, nt_hint
%if HIGH_BIT_DEPTH
%assign x 0
%rep 16/mmsize
mov%4 m0, [%2+(x/2)*mmsize]
mov%4 m1, [%3+(x/2)*mmsize]
punpckhwd m2, m0, m1
punpcklwd m0, m1
mov%5a [%1+(x+0)*mmsize], m0
mov%5a [%1+(x+1)*mmsize], m2
%assign x (x+2)
%endrep
%else
movq m0, [%2]
%if mmsize==16
%ifidn %4, a
punpcklbw m0, [%3]
%else
movq m1, [%3]
punpcklbw m0, m1
%endif
mov%5a [%1], m0
%else
movq m1, [%3]
punpckhbw m2, m0, m1
punpcklbw m0, m1
mov%5a [%1+0], m0
mov%5a [%1+8], m2
%endif
%endif ; HIGH_BIT_DEPTH
%endmacro
%macro DEINTERLEAVE 6 ; dstu, dstv, src, dstv==dstu+8, shuffle constant, is aligned
%if HIGH_BIT_DEPTH
%assign n 0
%rep 16/mmsize
mova m0, [%3+(n+0)*mmsize]
mova m1, [%3+(n+1)*mmsize]
psrld m2, m0, 16
psrld m3, m1, 16
pand m0, %5
pand m1, %5
packssdw m0, m1
packssdw m2, m3
mov%6 [%1+(n/2)*mmsize], m0
mov%6 [%2+(n/2)*mmsize], m2
%assign n (n+2)
%endrep
%else ; !HIGH_BIT_DEPTH
%if mmsize==16
mova m0, [%3]
%if cpuflag(ssse3)
pshufb m0, %5
%else
mova m1, m0
pand m0, %5
psrlw m1, 8
packuswb m0, m1
%endif
%if %4
mova [%1], m0
%else
movq [%1], m0
movhps [%2], m0
%endif
%else
mova m0, [%3]
mova m1, [%3+8]
mova m2, m0
mova m3, m1
pand m0, %5
pand m1, %5
psrlw m2, 8
psrlw m3, 8
packuswb m0, m1
packuswb m2, m3
mova [%1], m0
mova [%2], m2
%endif ; mmsize == 16
%endif ; HIGH_BIT_DEPTH
%endmacro
%macro PLANE_INTERLEAVE 0
;-----------------------------------------------------------------------------
; void plane_copy_interleave_core( uint8_t *dst, intptr_t i_dst,
; uint8_t *srcu, intptr_t i_srcu,
; uint8_t *srcv, intptr_t i_srcv, int w, int h )
;-----------------------------------------------------------------------------
; assumes i_dst and w are multiples of 16, and i_dst>2*w
cglobal plane_copy_interleave_core, 6,9
mov r6d, r6m
%if HIGH_BIT_DEPTH
FIX_STRIDES r1, r3, r5, r6d
movifnidn r1mp, r1
movifnidn r3mp, r3
mov r6m, r6d
%endif
lea r0, [r0+r6*2]
add r2, r6
add r4, r6
%if ARCH_X86_64
DECLARE_REG_TMP 7,8
%else
DECLARE_REG_TMP 1,3
%endif
mov t1, r1
shr t1, SIZEOF_PIXEL
sub t1, r6
mov t0d, r7m
.loopy:
mov r6d, r6m
neg r6
.prefetch:
prefetchnta [r2+r6]
prefetchnta [r4+r6]
add r6, 64
jl .prefetch
mov r6d, r6m
neg r6
.loopx:
INTERLEAVE r0+r6*2+ 0*SIZEOF_PIXEL, r2+r6+0*SIZEOF_PIXEL, r4+r6+0*SIZEOF_PIXEL, u, nt
INTERLEAVE r0+r6*2+16*SIZEOF_PIXEL, r2+r6+8*SIZEOF_PIXEL, r4+r6+8*SIZEOF_PIXEL, u, nt
add r6, 16*SIZEOF_PIXEL
jl .loopx
.pad:
%assign n 0
%rep SIZEOF_PIXEL
%if mmsize==8
movntq [r0+r6*2+(n+ 0)], m0
movntq [r0+r6*2+(n+ 8)], m0
movntq [r0+r6*2+(n+16)], m0
movntq [r0+r6*2+(n+24)], m0
%else
movntdq [r0+r6*2+(n+ 0)], m0
movntdq [r0+r6*2+(n+16)], m0
%endif
%assign n n+32
%endrep
add r6, 16*SIZEOF_PIXEL
cmp r6, t1
jl .pad
add r0, r1mp
add r2, r3mp
add r4, r5
dec t0d
jg .loopy
sfence
emms
RET
;-----------------------------------------------------------------------------
; void store_interleave_chroma( uint8_t *dst, intptr_t i_dst, uint8_t *srcu, uint8_t *srcv, int height )
;-----------------------------------------------------------------------------
cglobal store_interleave_chroma, 5,5
FIX_STRIDES r1
.loop:
INTERLEAVE r0+ 0, r2+ 0, r3+ 0, a
INTERLEAVE r0+r1, r2+FDEC_STRIDEB, r3+FDEC_STRIDEB, a
add r2, FDEC_STRIDEB*2
add r3, FDEC_STRIDEB*2
lea r0, [r0+r1*2]
sub r4d, 2
jg .loop
RET
%endmacro ; PLANE_INTERLEAVE
%macro DEINTERLEAVE_START 0
%if HIGH_BIT_DEPTH
mova m4, [pd_ffff]
%elif cpuflag(ssse3)
mova m4, [deinterleave_shuf]
%else
mova m4, [pw_00ff]
%endif ; HIGH_BIT_DEPTH
%endmacro
%macro PLANE_DEINTERLEAVE 0
;-----------------------------------------------------------------------------
; void plane_copy_deinterleave( pixel *dstu, intptr_t i_dstu,
; pixel *dstv, intptr_t i_dstv,
; pixel *src, intptr_t i_src, int w, int h )
;-----------------------------------------------------------------------------
cglobal plane_copy_deinterleave, 6,7
DEINTERLEAVE_START
mov r6d, r6m
FIX_STRIDES r1, r3, r5, r6d
%if HIGH_BIT_DEPTH
mov r6m, r6d
%endif
add r0, r6
add r2, r6
lea r4, [r4+r6*2]
.loopy:
mov r6d, r6m
neg r6
.loopx:
DEINTERLEAVE r0+r6+0*SIZEOF_PIXEL, r2+r6+0*SIZEOF_PIXEL, r4+r6*2+ 0*SIZEOF_PIXEL, 0, m4, u
DEINTERLEAVE r0+r6+8*SIZEOF_PIXEL, r2+r6+8*SIZEOF_PIXEL, r4+r6*2+16*SIZEOF_PIXEL, 0, m4, u
add r6, 16*SIZEOF_PIXEL
jl .loopx
add r0, r1
add r2, r3
add r4, r5
dec dword r7m
jg .loopy
RET
;-----------------------------------------------------------------------------
; void load_deinterleave_chroma_fenc( pixel *dst, pixel *src, intptr_t i_src, int height )
;-----------------------------------------------------------------------------
cglobal load_deinterleave_chroma_fenc, 4,4
DEINTERLEAVE_START
FIX_STRIDES r2
.loop:
DEINTERLEAVE r0+ 0, r0+FENC_STRIDEB*1/2, r1+ 0, 1, m4, a
DEINTERLEAVE r0+FENC_STRIDEB, r0+FENC_STRIDEB*3/2, r1+r2, 1, m4, a
add r0, FENC_STRIDEB*2
lea r1, [r1+r2*2]
sub r3d, 2
jg .loop
RET
;-----------------------------------------------------------------------------
; void load_deinterleave_chroma_fdec( pixel *dst, pixel *src, intptr_t i_src, int height )
;-----------------------------------------------------------------------------
cglobal load_deinterleave_chroma_fdec, 4,4
DEINTERLEAVE_START
FIX_STRIDES r2
.loop:
DEINTERLEAVE r0+ 0, r0+FDEC_STRIDEB*1/2, r1+ 0, 0, m4, a
DEINTERLEAVE r0+FDEC_STRIDEB, r0+FDEC_STRIDEB*3/2, r1+r2, 0, m4, a
add r0, FDEC_STRIDEB*2
lea r1, [r1+r2*2]
sub r3d, 2
jg .loop
RET
%endmacro ; PLANE_DEINTERLEAVE
%macro PLANE_DEINTERLEAVE_RGB_CORE 9 ; pw, i_dsta, i_dstb, i_dstc, i_src, w, h, tmp1, tmp2
%if cpuflag(ssse3)
mova m3, [deinterleave_rgb_shuf+(%1-3)*16]
%endif
%%loopy:
mov %8, r6
mov %9, %6
%%loopx:
movu m0, [%8]
movu m1, [%8+%1*mmsize/4]
%if cpuflag(ssse3)
pshufb m0, m3 ; b0 b1 b2 b3 g0 g1 g2 g3 r0 r1 r2 r3
pshufb m1, m3 ; b4 b5 b6 b7 g4 g5 g6 g7 r4 r5 r6 r7
%elif %1 == 3
psrldq m2, m0, 6
punpcklqdq m0, m1 ; b0 g0 r0 b1 g1 r1 __ __ b4 g4 r4 b5 g5 r5
psrldq m1, 6
punpcklqdq m2, m1 ; b2 g2 r2 b3 g3 r3 __ __ b6 g6 r6 b7 g7 r7
psrlq m3, m0, 24
psrlq m4, m2, 24
punpckhbw m1, m0, m3 ; b4 b5 g4 g5 r4 r5
punpcklbw m0, m3 ; b0 b1 g0 g1 r0 r1
punpckhbw m3, m2, m4 ; b6 b7 g6 g7 r6 r7
punpcklbw m2, m4 ; b2 b3 g2 g3 r2 r3
punpcklwd m0, m2 ; b0 b1 b2 b3 g0 g1 g2 g3 r0 r1 r2 r3
punpcklwd m1, m3 ; b4 b5 b6 b7 g4 g5 g6 g7 r4 r5 r6 r7
%else
pshufd m3, m0, q2301
pshufd m4, m1, q2301
punpckhbw m2, m0, m3 ; b2 b3 g2 g3 r2 r3
punpcklbw m0, m3 ; b0 b1 g0 g1 r0 r1
punpckhbw m3, m1, m4 ; b6 b7 g6 g7 r6 r7
punpcklbw m1, m4 ; b4 b5 g4 g5 r4 r5
punpcklwd m0, m2 ; b0 b1 b2 b3 g0 g1 g2 g3 r0 r1 r2 r3
punpcklwd m1, m3 ; b4 b5 b6 b7 g4 g5 g6 g7 r4 r5 r6 r7
%endif
punpckldq m2, m0, m1 ; b0 b1 b2 b3 b4 b5 b6 b7 g0 g1 g2 g3 g4 g5 g6 g7
punpckhdq m0, m1 ; r0 r1 r2 r3 r4 r5 r6 r7
movh [r0+%9], m2
movhps [r2+%9], m2
movh [r4+%9], m0
add %8, %1*mmsize/2
add %9, mmsize/2
jl %%loopx
add r0, %2
add r2, %3
add r4, %4
add r6, %5
dec %7d
jg %%loopy
%endmacro
%macro PLANE_DEINTERLEAVE_RGB 0
;-----------------------------------------------------------------------------
; void x264_plane_copy_deinterleave_rgb( pixel *dsta, intptr_t i_dsta,
; pixel *dstb, intptr_t i_dstb,
; pixel *dstc, intptr_t i_dstc,
; pixel *src, intptr_t i_src, int pw, int w, int h )
;-----------------------------------------------------------------------------
%if ARCH_X86_64
cglobal plane_copy_deinterleave_rgb, 8,12
%define %%args r1, r3, r5, r7, r8, r9, r10, r11
mov r8d, r9m
mov r9d, r10m
add r0, r8
add r2, r8
add r4, r8
neg r8
%else
cglobal plane_copy_deinterleave_rgb, 1,7
%define %%args r1m, r3m, r5m, r7m, r9m, r1, r3, r5
mov r1, r9m
mov r2, r2m
mov r4, r4m
mov r6, r6m
add r0, r1
add r2, r1
add r4, r1
neg r1
mov r9m, r1
mov r1, r10m
%endif
cmp dword r8m, 4
je .pw4
PLANE_DEINTERLEAVE_RGB_CORE 3, %%args ; BGR
jmp .ret
.pw4:
PLANE_DEINTERLEAVE_RGB_CORE 4, %%args ; BGRA
.ret:
REP_RET
%endmacro
%if HIGH_BIT_DEPTH == 0
INIT_XMM sse2
PLANE_DEINTERLEAVE_RGB
INIT_XMM ssse3
PLANE_DEINTERLEAVE_RGB
%endif ; !HIGH_BIT_DEPTH
%macro PLANE_DEINTERLEAVE_V210 0
;-----------------------------------------------------------------------------
; void x264_plane_copy_deinterleave_v210( uint16_t *dsty, intptr_t i_dsty,
; uint16_t *dstc, intptr_t i_dstc,
; uint32_t *src, intptr_t i_src, int w, int h )
;-----------------------------------------------------------------------------
%if ARCH_X86_64
cglobal plane_copy_deinterleave_v210, 8,10,7
%define src r8
%define org_w r9
%define h r7d
%else
cglobal plane_copy_deinterleave_v210, 7,7,7
%define src r4m
%define org_w r6m
%define h dword r7m
%endif
FIX_STRIDES r1, r3, r6d
shl r5, 2
add r0, r6
add r2, r6
neg r6
mov src, r4
mov org_w, r6
mova m2, [v210_mask]
mova m3, [v210_luma_shuf]
mova m4, [v210_chroma_shuf]
mova m5, [v210_mult] ; also functions as vpermd index for avx2
pshufd m6, m5, q1102
ALIGN 16
.loop:
movu m1, [r4]
pandn m0, m2, m1
pand m1, m2
pshufb m0, m3
pshufb m1, m4
pmulhrsw m0, m5 ; y0 y1 y2 y3 y4 y5 __ __
pmulhrsw m1, m6 ; u0 v0 u1 v1 u2 v2 __ __
%if mmsize == 32
vpermd m0, m5, m0
vpermd m1, m5, m1
%endif
movu [r0+r6], m0
movu [r2+r6], m1
add r4, mmsize
add r6, 3*mmsize/4
jl .loop
add r0, r1
add r2, r3
add src, r5
mov r4, src
mov r6, org_w
dec h
jg .loop
RET
%endmacro ; PLANE_DEINTERLEAVE_V210
%if HIGH_BIT_DEPTH
INIT_MMX mmx2
PLANE_INTERLEAVE
INIT_MMX mmx
PLANE_DEINTERLEAVE
INIT_XMM sse2
PLANE_INTERLEAVE
PLANE_DEINTERLEAVE
INIT_XMM ssse3
PLANE_DEINTERLEAVE_V210
INIT_XMM avx
PLANE_INTERLEAVE
PLANE_DEINTERLEAVE
PLANE_DEINTERLEAVE_V210
INIT_YMM avx2
PLANE_DEINTERLEAVE_V210
%else
INIT_MMX mmx2
PLANE_INTERLEAVE
INIT_MMX mmx
PLANE_DEINTERLEAVE
INIT_XMM sse2
PLANE_INTERLEAVE
PLANE_DEINTERLEAVE
INIT_XMM ssse3
PLANE_DEINTERLEAVE
%endif
; These functions are not general-use; not only do the SSE ones require aligned input,
; but they also will fail if given a non-mod16 size.
; memzero SSE will fail for non-mod128.
;-----------------------------------------------------------------------------
; void *memcpy_aligned( void *dst, const void *src, size_t n );
;-----------------------------------------------------------------------------
%macro MEMCPY 0
cglobal memcpy_aligned, 3,3
%if mmsize == 16
test r2d, 16
jz .copy2
mova m0, [r1+r2-16]
mova [r0+r2-16], m0
sub r2d, 16
.copy2:
%endif
test r2d, 2*mmsize
jz .copy4start
mova m0, [r1+r2-1*mmsize]
mova m1, [r1+r2-2*mmsize]
mova [r0+r2-1*mmsize], m0
mova [r0+r2-2*mmsize], m1
sub r2d, 2*mmsize
.copy4start:
test r2d, r2d
jz .ret
.copy4:
mova m0, [r1+r2-1*mmsize]
mova m1, [r1+r2-2*mmsize]
mova m2, [r1+r2-3*mmsize]
mova m3, [r1+r2-4*mmsize]
mova [r0+r2-1*mmsize], m0
mova [r0+r2-2*mmsize], m1
mova [r0+r2-3*mmsize], m2
mova [r0+r2-4*mmsize], m3
sub r2d, 4*mmsize
jg .copy4
.ret:
REP_RET
%endmacro
INIT_MMX mmx
MEMCPY
INIT_XMM sse
MEMCPY
;-----------------------------------------------------------------------------
; void *memzero_aligned( void *dst, size_t n );
;-----------------------------------------------------------------------------
%macro MEMZERO 1
cglobal memzero_aligned, 2,2
add r0, r1
neg r1
%if mmsize == 8
pxor m0, m0
%else
xorps m0, m0
%endif
.loop:
%assign i 0
%rep %1
mova [r0 + r1 + i], m0
%assign i i+mmsize
%endrep
add r1, mmsize*%1
jl .loop
RET
%endmacro
INIT_MMX mmx
MEMZERO 8
INIT_XMM sse
MEMZERO 8
INIT_YMM avx
MEMZERO 4
%if HIGH_BIT_DEPTH == 0
;-----------------------------------------------------------------------------
; void integral_init4h( uint16_t *sum, uint8_t *pix, intptr_t stride )
;-----------------------------------------------------------------------------
%macro INTEGRAL_INIT4H 0
cglobal integral_init4h, 3,4
lea r3, [r0+r2*2]
add r1, r2
neg r2
pxor m4, m4
.loop:
mova m0, [r1+r2]
%if mmsize==32
movu m1, [r1+r2+8]
%else
mova m1, [r1+r2+16]
palignr m1, m0, 8
%endif
mpsadbw m0, m4, 0
mpsadbw m1, m4, 0
paddw m0, [r0+r2*2]
paddw m1, [r0+r2*2+mmsize]
mova [r3+r2*2 ], m0
mova [r3+r2*2+mmsize], m1
add r2, mmsize
jl .loop
RET
%endmacro
INIT_XMM sse4
INTEGRAL_INIT4H
INIT_YMM avx2
INTEGRAL_INIT4H
%macro INTEGRAL_INIT8H 0
cglobal integral_init8h, 3,4
lea r3, [r0+r2*2]
add r1, r2
neg r2
pxor m4, m4
.loop:
mova m0, [r1+r2]
%if mmsize==32
movu m1, [r1+r2+8]
mpsadbw m2, m0, m4, 100100b
mpsadbw m3, m1, m4, 100100b
%else
mova m1, [r1+r2+16]
palignr m1, m0, 8
mpsadbw m2, m0, m4, 100b
mpsadbw m3, m1, m4, 100b
%endif
mpsadbw m0, m4, 0
mpsadbw m1, m4, 0
paddw m0, [r0+r2*2]
paddw m1, [r0+r2*2+mmsize]
paddw m0, m2
paddw m1, m3
mova [r3+r2*2 ], m0
mova [r3+r2*2+mmsize], m1
add r2, mmsize
jl .loop
RET
%endmacro
INIT_XMM sse4
INTEGRAL_INIT8H
INIT_XMM avx
INTEGRAL_INIT8H
INIT_YMM avx2
INTEGRAL_INIT8H
%endif ; !HIGH_BIT_DEPTH
%macro INTEGRAL_INIT_8V 0
;-----------------------------------------------------------------------------
; void integral_init8v( uint16_t *sum8, intptr_t stride )
;-----------------------------------------------------------------------------
cglobal integral_init8v, 3,3
add r1, r1
add r0, r1
lea r2, [r0+r1*8]
neg r1
.loop:
mova m0, [r2+r1]
mova m1, [r2+r1+mmsize]
psubw m0, [r0+r1]
psubw m1, [r0+r1+mmsize]
mova [r0+r1], m0
mova [r0+r1+mmsize], m1
add r1, 2*mmsize
jl .loop
RET
%endmacro
INIT_MMX mmx
INTEGRAL_INIT_8V
INIT_XMM sse2
INTEGRAL_INIT_8V
INIT_YMM avx2
INTEGRAL_INIT_8V
;-----------------------------------------------------------------------------
; void integral_init4v( uint16_t *sum8, uint16_t *sum4, intptr_t stride )
;-----------------------------------------------------------------------------
INIT_MMX mmx
cglobal integral_init4v, 3,5
shl r2, 1
lea r3, [r0+r2*4]
lea r4, [r0+r2*8]
mova m0, [r0+r2]
mova m4, [r4+r2]
.loop:
mova m1, m4
psubw m1, m0
mova m4, [r4+r2-8]
mova m0, [r0+r2-8]
paddw m1, m4
mova m3, [r3+r2-8]
psubw m1, m0
psubw m3, m0
mova [r0+r2-8], m1
mova [r1+r2-8], m3
sub r2, 8
jge .loop
RET
INIT_XMM sse2
cglobal integral_init4v, 3,5
shl r2, 1
add r0, r2
add r1, r2
lea r3, [r0+r2*4]
lea r4, [r0+r2*8]
neg r2
.loop:
mova m0, [r0+r2]
mova m1, [r4+r2]
mova m2, m0
mova m4, m1
shufpd m0, [r0+r2+16], 1
shufpd m1, [r4+r2+16], 1
paddw m0, m2
paddw m1, m4
mova m3, [r3+r2]
psubw m1, m0
psubw m3, m2
mova [r0+r2], m1
mova [r1+r2], m3
add r2, 16
jl .loop
RET
INIT_XMM ssse3
cglobal integral_init4v, 3,5
shl r2, 1
add r0, r2
add r1, r2
lea r3, [r0+r2*4]
lea r4, [r0+r2*8]
neg r2
.loop:
mova m2, [r0+r2]
mova m0, [r0+r2+16]
mova m4, [r4+r2]
mova m1, [r4+r2+16]
palignr m0, m2, 8
palignr m1, m4, 8
paddw m0, m2
paddw m1, m4
mova m3, [r3+r2]
psubw m1, m0
psubw m3, m2
mova [r0+r2], m1
mova [r1+r2], m3
add r2, 16
jl .loop
RET
INIT_YMM avx2
cglobal integral_init4v, 3,5
add r2, r2
add r0, r2
add r1, r2
lea r3, [r0+r2*4]
lea r4, [r0+r2*8]
neg r2
.loop:
mova m2, [r0+r2]
movu m1, [r4+r2+8]
paddw m0, m2, [r0+r2+8]
paddw m1, [r4+r2]
mova m3, [r3+r2]
psubw m1, m0
psubw m3, m2
mova [r0+r2], m1
mova [r1+r2], m3
add r2, 32
jl .loop
RET
%macro FILT8x4 7
mova %3, [r0+%7]
mova %4, [r0+r5+%7]
pavgb %3, %4
pavgb %4, [r0+r5*2+%7]
PALIGNR %1, %3, 1, m6
PALIGNR %2, %4, 1, m6
%if cpuflag(xop)
pavgb %1, %3
pavgb %2, %4
%else
pavgb %1, %3
pavgb %2, %4
psrlw %5, %1, 8
psrlw %6, %2, 8
pand %1, m7
pand %2, m7
%endif
%endmacro
%macro FILT32x4U 4
mova m1, [r0+r5]
pavgb m0, m1, [r0]
movu m3, [r0+r5+1]
pavgb m2, m3, [r0+1]
pavgb m1, [r0+r5*2]
pavgb m3, [r0+r5*2+1]
pavgb m0, m2
pavgb m1, m3
mova m3, [r0+r5+mmsize]
pavgb m2, m3, [r0+mmsize]
movu m5, [r0+r5+1+mmsize]
pavgb m4, m5, [r0+1+mmsize]
pavgb m3, [r0+r5*2+mmsize]
pavgb m5, [r0+r5*2+1+mmsize]
pavgb m2, m4
pavgb m3, m5
pshufb m0, m7
pshufb m1, m7
pshufb m2, m7
pshufb m3, m7
punpckhqdq m4, m0, m2
punpcklqdq m0, m0, m2
punpckhqdq m5, m1, m3
punpcklqdq m2, m1, m3
vpermq m0, m0, q3120
vpermq m1, m4, q3120
vpermq m2, m2, q3120
vpermq m3, m5, q3120
mova [%1], m0
mova [%2], m1
mova [%3], m2
mova [%4], m3
%endmacro
%macro FILT16x2 4
mova m3, [r0+%4+mmsize]
mova m2, [r0+%4]
pavgb m3, [r0+%4+r5+mmsize]
pavgb m2, [r0+%4+r5]
PALIGNR %1, m3, 1, m6
pavgb %1, m3
PALIGNR m3, m2, 1, m6
pavgb m3, m2
%if cpuflag(xop)
vpperm m5, m3, %1, m7
vpperm m3, m3, %1, m6
%else
psrlw m5, m3, 8
psrlw m4, %1, 8
pand m3, m7
pand %1, m7
packuswb m3, %1
packuswb m5, m4
%endif
mova [%2], m3
mova [%3], m5
mova %1, m2
%endmacro
%macro FILT8x2U 3
mova m3, [r0+%3+8]
mova m2, [r0+%3]
pavgb m3, [r0+%3+r5+8]
pavgb m2, [r0+%3+r5]
mova m1, [r0+%3+9]
mova m0, [r0+%3+1]
pavgb m1, [r0+%3+r5+9]
pavgb m0, [r0+%3+r5+1]
pavgb m1, m3
pavgb m0, m2
psrlw m3, m1, 8
psrlw m2, m0, 8
pand m1, m7
pand m0, m7
packuswb m0, m1
packuswb m2, m3
mova [%1], m0
mova [%2], m2
%endmacro
%macro FILT8xU 3
mova m3, [r0+%3+8]
mova m2, [r0+%3]
pavgw m3, [r0+%3+r5+8]
pavgw m2, [r0+%3+r5]
movu m1, [r0+%3+10]
movu m0, [r0+%3+2]
pavgw m1, [r0+%3+r5+10]
pavgw m0, [r0+%3+r5+2]
pavgw m1, m3
pavgw m0, m2
psrld m3, m1, 16
psrld m2, m0, 16
pand m1, m7
pand m0, m7
packssdw m0, m1
packssdw m2, m3
movu [%1], m0
mova [%2], m2
%endmacro
%macro FILT8xA 4
mova m3, [r0+%4+mmsize]
mova m2, [r0+%4]
pavgw m3, [r0+%4+r5+mmsize]
pavgw m2, [r0+%4+r5]
PALIGNR %1, m3, 2, m6
pavgw %1, m3
PALIGNR m3, m2, 2, m6
pavgw m3, m2
%if cpuflag(xop)
vpperm m5, m3, %1, m7
vpperm m3, m3, %1, m6
%else
psrld m5, m3, 16
psrld m4, %1, 16
pand m3, m7
pand %1, m7
packssdw m3, %1
packssdw m5, m4
%endif
mova [%2], m3
mova [%3], m5
mova %1, m2
%endmacro
;-----------------------------------------------------------------------------
; void frame_init_lowres_core( uint8_t *src0, uint8_t *dst0, uint8_t *dsth, uint8_t *dstv, uint8_t *dstc,
; intptr_t src_stride, intptr_t dst_stride, int width, int height )
;-----------------------------------------------------------------------------
%macro FRAME_INIT_LOWRES 0
cglobal frame_init_lowres_core, 6,7,(12-4*(BIT_DEPTH/9)) ; 8 for HIGH_BIT_DEPTH, 12 otherwise
%if HIGH_BIT_DEPTH
shl dword r6m, 1
FIX_STRIDES r5
shl dword r7m, 1
%endif
%if mmsize >= 16
add dword r7m, mmsize-1
and dword r7m, ~(mmsize-1)
%endif
; src += 2*(height-1)*stride + 2*width
mov r6d, r8m
dec r6d
imul r6d, r5d
add r6d, r7m
lea r0, [r0+r6*2]
; dst += (height-1)*stride + width
mov r6d, r8m
dec r6d
imul r6d, r6m
add r6d, r7m
add r1, r6
add r2, r6
add r3, r6
add r4, r6
; gap = stride - width
mov r6d, r6m
sub r6d, r7m
PUSH r6
%define dst_gap [rsp+gprsize]
mov r6d, r5d
sub r6d, r7m
shl r6d, 1
PUSH r6
%define src_gap [rsp]
%if HIGH_BIT_DEPTH
%if cpuflag(xop)
mova m6, [deinterleave_shuf32a]
mova m7, [deinterleave_shuf32b]
%else
pcmpeqw m7, m7
psrld m7, 16
%endif
.vloop:
mov r6d, r7m
%ifnidn cpuname, mmx2
mova m0, [r0]
mova m1, [r0+r5]
pavgw m0, m1
pavgw m1, [r0+r5*2]
%endif
.hloop:
sub r0, mmsize*2
sub r1, mmsize
sub r2, mmsize
sub r3, mmsize
sub r4, mmsize
%ifidn cpuname, mmx2
FILT8xU r1, r2, 0
FILT8xU r3, r4, r5
%else
FILT8xA m0, r1, r2, 0
FILT8xA m1, r3, r4, r5
%endif
sub r6d, mmsize
jg .hloop
%else ; !HIGH_BIT_DEPTH
%if cpuflag(avx2)
mova m7, [deinterleave_shuf]
%elif cpuflag(xop)
mova m6, [deinterleave_shuf32a]
mova m7, [deinterleave_shuf32b]
%else
pcmpeqb m7, m7
psrlw m7, 8
%endif
.vloop:
mov r6d, r7m
%ifnidn cpuname, mmx2
%if mmsize <= 16
mova m0, [r0]
mova m1, [r0+r5]
pavgb m0, m1
pavgb m1, [r0+r5*2]
%endif
%endif
.hloop:
sub r0, mmsize*2
sub r1, mmsize
sub r2, mmsize
sub r3, mmsize
sub r4, mmsize
%if mmsize==32
FILT32x4U r1, r2, r3, r4
%elifdef m8
FILT8x4 m0, m1, m2, m3, m10, m11, mmsize
mova m8, m0
mova m9, m1
FILT8x4 m2, m3, m0, m1, m4, m5, 0
%if cpuflag(xop)
vpperm m4, m2, m8, m7
vpperm m2, m2, m8, m6
vpperm m5, m3, m9, m7
vpperm m3, m3, m9, m6
%else
packuswb m2, m8
packuswb m3, m9
packuswb m4, m10
packuswb m5, m11
%endif
mova [r1], m2
mova [r2], m4
mova [r3], m3
mova [r4], m5
%elifidn cpuname, mmx2
FILT8x2U r1, r2, 0
FILT8x2U r3, r4, r5
%else
FILT16x2 m0, r1, r2, 0
FILT16x2 m1, r3, r4, r5
%endif
sub r6d, mmsize
jg .hloop
%endif ; HIGH_BIT_DEPTH
.skip:
mov r6, dst_gap
sub r0, src_gap
sub r1, r6
sub r2, r6
sub r3, r6
sub r4, r6
dec dword r8m
jg .vloop
ADD rsp, 2*gprsize
emms
RET
%endmacro ; FRAME_INIT_LOWRES
INIT_MMX mmx2
FRAME_INIT_LOWRES
%if ARCH_X86_64 == 0
INIT_MMX cache32, mmx2
FRAME_INIT_LOWRES
%endif
INIT_XMM sse2
FRAME_INIT_LOWRES
INIT_XMM ssse3
FRAME_INIT_LOWRES
INIT_XMM avx
FRAME_INIT_LOWRES
INIT_XMM xop
FRAME_INIT_LOWRES
%if HIGH_BIT_DEPTH==0
INIT_YMM avx2
FRAME_INIT_LOWRES
%endif
;-----------------------------------------------------------------------------
; void mbtree_propagate_cost( int *dst, uint16_t *propagate_in, uint16_t *intra_costs,
; uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len )
;-----------------------------------------------------------------------------
%macro MBTREE 0
cglobal mbtree_propagate_cost, 6,6,7
movss m6, [r5]
mov r5d, r6m
lea r0, [r0+r5*2]
add r5d, r5d
add r1, r5
add r2, r5
add r3, r5
add r4, r5
neg r5
pxor m4, m4
shufps m6, m6, 0
mova m5, [pw_3fff]
.loop:
movq m2, [r2+r5] ; intra
movq m0, [r4+r5] ; invq
movq m3, [r3+r5] ; inter
movq m1, [r1+r5] ; prop
pand m3, m5
pminsw m3, m2
punpcklwd m2, m4
punpcklwd m0, m4
pmaddwd m0, m2
punpcklwd m1, m4
punpcklwd m3, m4
%if cpuflag(fma4)
cvtdq2ps m0, m0
cvtdq2ps m1, m1
fmaddps m0, m0, m6, m1
cvtdq2ps m1, m2
psubd m2, m3
cvtdq2ps m2, m2
rcpps m3, m1
mulps m1, m3
mulps m0, m2
addps m2, m3, m3
fnmaddps m3, m1, m3, m2
mulps m0, m3
%else
cvtdq2ps m0, m0
mulps m0, m6 ; intra*invq*fps_factor>>8
cvtdq2ps m1, m1 ; prop
addps m0, m1 ; prop + (intra*invq*fps_factor>>8)
cvtdq2ps m1, m2 ; intra
psubd m2, m3 ; intra - inter
cvtdq2ps m2, m2 ; intra - inter
rcpps m3, m1 ; 1 / intra 1st approximation
mulps m1, m3 ; intra * (1/intra 1st approx)
mulps m1, m3 ; intra * (1/intra 1st approx)^2
mulps m0, m2 ; (prop + (intra*invq*fps_factor>>8)) * (intra - inter)
addps m3, m3 ; 2 * (1/intra 1st approx)
subps m3, m1 ; 2nd approximation for 1/intra
mulps m0, m3 ; / intra
%endif
cvtps2dq m0, m0
packssdw m0, m0
movh [r0+r5], m0
add r5, 8
jl .loop
RET
%endmacro
INIT_XMM sse2
MBTREE
; Bulldozer only has a 128-bit float unit, so the AVX version of this function is actually slower.
INIT_XMM fma4
MBTREE
%macro INT16_UNPACK 1
punpckhwd xm4, xm%1, xm7
punpcklwd xm%1, xm7
vinsertf128 m%1, m%1, xm4, 1
%endmacro
; FIXME: align loads to 16 bytes
%macro MBTREE_AVX 1
cglobal mbtree_propagate_cost, 6,6,%1
vbroadcastss m6, [r5]
mov r5d, r6m
lea r0, [r0+r5*2]
add r5d, r5d
add r1, r5
add r2, r5
add r3, r5
add r4, r5
neg r5
mova xm5, [pw_3fff]
%if notcpuflag(avx2)
pxor xm7, xm7
%endif
.loop:
%if cpuflag(avx2)
pmovzxwd m0, [r2+r5] ; intra
pmovzxwd m1, [r4+r5] ; invq
pmovzxwd m2, [r1+r5] ; prop
pand xm3, xm5, [r3+r5] ; inter
pmovzxwd m3, xm3
pminsd m3, m0
pmaddwd m1, m0
psubd m4, m0, m3
cvtdq2ps m0, m0
cvtdq2ps m1, m1
cvtdq2ps m2, m2
cvtdq2ps m4, m4
fmaddps m1, m1, m6, m2
rcpps m3, m0
mulps m2, m0, m3
mulps m1, m4
addps m4, m3, m3
fnmaddps m4, m2, m3, m4
mulps m1, m4
%else
movu xm0, [r2+r5]
movu xm1, [r4+r5]
movu xm2, [r1+r5]
pand xm3, xm5, [r3+r5]
pminsw xm3, xm0
INT16_UNPACK 0
INT16_UNPACK 1
INT16_UNPACK 2
INT16_UNPACK 3
cvtdq2ps m0, m0
cvtdq2ps m1, m1
cvtdq2ps m2, m2
cvtdq2ps m3, m3
mulps m1, m0
subps m4, m0, m3
mulps m1, m6 ; intra*invq*fps_factor>>8
addps m1, m2 ; prop + (intra*invq*fps_factor>>8)
rcpps m3, m0 ; 1 / intra 1st approximation
mulps m2, m0, m3 ; intra * (1/intra 1st approx)
mulps m2, m3 ; intra * (1/intra 1st approx)^2
mulps m1, m4 ; (prop + (intra*invq*fps_factor>>8)) * (intra - inter)
addps m3, m3 ; 2 * (1/intra 1st approx)
subps m3, m2 ; 2nd approximation for 1/intra
mulps m1, m3 ; / intra
%endif
vcvtps2dq m1, m1
vextractf128 xm2, m1, 1
packssdw xm1, xm2
mova [r0+r5], xm1
add r5, 16
jl .loop
RET
%endmacro
INIT_YMM avx
MBTREE_AVX 8
INIT_YMM avx2,fma3
MBTREE_AVX 7
%macro MBTREE_PROPAGATE_LIST 0
;-----------------------------------------------------------------------------
; void mbtree_propagate_list_internal( int16_t (*mvs)[2], int *propagate_amount, uint16_t *lowres_costs,
; int16_t *output, int bipred_weight, int mb_y, int len )
;-----------------------------------------------------------------------------
cglobal mbtree_propagate_list_internal, 4,6,8
movh m6, [pw_0to15] ; mb_x
movd m7, r5m
pshuflw m7, m7, 0
punpcklwd m6, m7 ; 0 y 1 y 2 y 3 y
movd m7, r4m
SPLATW m7, m7 ; bipred_weight
psllw m7, 9 ; bipred_weight << 9
mov r5d, r6m
xor r4d, r4d
.loop:
mova m3, [r1+r4*2]
movu m4, [r2+r4*2]
mova m5, [pw_0xc000]
pand m4, m5
pcmpeqw m4, m5
pmulhrsw m5, m3, m7 ; propagate_amount = (propagate_amount * bipred_weight + 32) >> 6
%if cpuflag(avx)
pblendvb m5, m3, m5, m4
%else
pand m5, m4
pandn m4, m3
por m5, m4 ; if( lists_used == 3 )
; propagate_amount = (propagate_amount * bipred_weight + 32) >> 6
%endif
movu m0, [r0+r4*4] ; x,y
movu m1, [r0+r4*4+mmsize]
psraw m2, m0, 5
psraw m3, m1, 5
mova m4, [pd_4]
paddw m2, m6 ; {mbx, mby} = ({x,y}>>5)+{h->mb.i_mb_x,h->mb.i_mb_y}
paddw m6, m4 ; {mbx, mby} += {4, 0}
paddw m3, m6 ; {mbx, mby} = ({x,y}>>5)+{h->mb.i_mb_x,h->mb.i_mb_y}
paddw m6, m4 ; {mbx, mby} += {4, 0}
mova [r3+mmsize*0], m2
mova [r3+mmsize*1], m3
mova m3, [pw_31]
pand m0, m3 ; x &= 31
pand m1, m3 ; y &= 31
packuswb m0, m1
psrlw m1, m0, 3
pand m0, m3 ; x
SWAP 1, 3
pandn m1, m3 ; y premultiplied by (1<<5) for later use of pmulhrsw
mova m3, [pw_32]
psubw m3, m0 ; 32 - x
mova m4, [pw_1024]
psubw m4, m1 ; (32 - y) << 5
pmullw m2, m3, m4 ; idx0weight = (32-y)*(32-x) << 5
pmullw m4, m0 ; idx1weight = (32-y)*x << 5
pmullw m0, m1 ; idx3weight = y*x << 5
pmullw m1, m3 ; idx2weight = y*(32-x) << 5
; avoid overflow in the input to pmulhrsw
psrlw m3, m2, 15
psubw m2, m3 ; idx0weight -= (idx0weight == 32768)
pmulhrsw m2, m5 ; idx0weight * propagate_amount + 512 >> 10
pmulhrsw m4, m5 ; idx1weight * propagate_amount + 512 >> 10
pmulhrsw m1, m5 ; idx2weight * propagate_amount + 512 >> 10
pmulhrsw m0, m5 ; idx3weight * propagate_amount + 512 >> 10
SBUTTERFLY wd, 2, 4, 3
SBUTTERFLY wd, 1, 0, 3
mova [r3+mmsize*2], m2
mova [r3+mmsize*3], m4
mova [r3+mmsize*4], m1
mova [r3+mmsize*5], m0
add r4d, mmsize/2
add r3, mmsize*6
cmp r4d, r5d
jl .loop
REP_RET
%endmacro
INIT_XMM ssse3
MBTREE_PROPAGATE_LIST
INIT_XMM avx
MBTREE_PROPAGATE_LIST
| 25.174205 | 105 | 0.505675 |
2909511eeecb194318ac281664cd568d7b07b8e2 | 6,448 | py | Python | 04_CNN/VGG/VGGNet.py | fioletflying/tensorflowcook | 10b9feaf0db780f94ace4a9e019b163999b6c38e | [
"MIT"
] | null | null | null | 04_CNN/VGG/VGGNet.py | fioletflying/tensorflowcook | 10b9feaf0db780f94ace4a9e019b163999b6c38e | [
"MIT"
] | null | null | null | 04_CNN/VGG/VGGNet.py | fioletflying/tensorflowcook | 10b9feaf0db780f94ace4a9e019b163999b6c38e | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @author : Feifei
# @IDE : Pycharm
# @file : VGGNet.py
# @time : 2019/5/22 16:27
# @info : 实现VGG16的版本
from datetime import datetime
import math
import time
import tensorflow as tf
def conv_op(input_op,name,kh,kw,n_out,dh,dw,p):
'''
:param input_op: 输入的tensor
:param name: 本层的名字
:param kh: kernel 的heiht
:param kw: kernel 的width
:param n_out: 输出的通道数
:param dh: 步长的高
:param dw: 步长的宽
:param p: 参数列表
:return:
'''
# 获取输入通道数
n_in = input_op.get_shape()[-1].value
# 在这个命名范围开始创建
with tf.name_scope(name) as scope:
# 创建变量kernel
# 初始化使用xavier 算法
kernel = tf.get_variable(scope + "w",
shape = [kh,kw,n_in,n_out],
dtype=tf.float32,
initializer=tf.contrib.layers.xavier_initializer_conv2d())
conv = tf.nn.conv2d(input_op,kernel,(1,dh,dw,1),padding='SAME')
bias_init_val = tf.constant(0.0,shape=[n_out],dtype = tf.float32)
biases = tf.Variable(bias_init_val,trainable=True,name='b')
z = tf.nn.bias_add(conv,biases)
activation = tf.nn.relu(z,name=scope)
p+= [kernel,biases]
return activation
def fc_op(input_op,name,n_out,p):
'''
:param input_op: 输入的tensor
:param name: 本层的名字
:param n_out: 输出的通道数
:param p: 参数列表
:return:
'''
# 获取输入通道数
n_in = input_op.get_shape()[-1].value
with tf.name_scope(name) as scope:
kernel = tf.get_variable(scope + "w",
shape=[n_in,n_out],
dtype=tf.float32,
initializer=tf.contrib.layers.xavier_initializer())
biases = tf.Variable(tf.constant(0.1,shape=[n_out],
dtype=tf.float32),name ='b')
"""
1. tf.nn.relu激活函数不必多数:
传入tf.nn.relu()的参数,是:tensor和weights卷积后+biases
2. tf.nn.relu_layer():
def relu_layer(x, weights, biases, name=None): ]
Computes Relu(x * weight + biases)
"""
activation = tf.nn.relu_layer(input_op,kernel,biases,name = scope)
p+=[kernel,biases]
return activation
def mpool_op(input_op,name,kh,kw,dh,dw):
return tf.nn.max_pool(input_op,
ksize=[1,kh,kw,1],
strides=[1,dh,dw,1],
padding='SAME',
name=name)
def inference_op(input_op,keep_prob):
p = []
conv1_1 = conv_op(input_op, name="conv1_1", kh=3, kw=3, n_out=64, dh=1, dw=1, p=p)
conv1_2 = conv_op(conv1_1, name="conv1_2", kh=3, kw=3, n_out=64, dh=1, dw=1, p=p)
pool1 = mpool_op(conv1_2, name="maxpool1",kh=2, kw=2, dh=2, dw=2)
conv2_1 = conv_op(pool1, name="conv2_1", kh=3, kw=3, n_out=128, dh=1, dw=1, p=p)
conv2_2 = conv_op(conv2_1, name="conv2_2", kh=3, kw=3, n_out=128, dh=1, dw=1, p=p)
pool2 = mpool_op(conv2_2, name="maxpoo12", kh=2, kw=2, dh=2, dw=2)
conv3_1 = conv_op(pool2, name="conv3_1", kh=3, kw=3, n_out=256, dh=1, dw=1, p=p)
conv3_2 = conv_op(conv3_1, name="conv3_2", kh=3, kw=3, n_out=256, dh=1, dw=1, p=p)
conv3_3 = conv_op(conv3_2, name="conv3_3", kh=3, kw=3, n_out=256, dh=1, dw=1, p=p)
pool3 = mpool_op(conv3_3, name="maxpoo13", kh=2, kw=2, dh=2, dw=2)
conv4_1 = conv_op(pool3, name="conv4_1", kh=3, kw=3, n_out=512, dh=1, dw=1, p=p)
conv4_2 = conv_op(conv4_1, name="conv4_2", kh=3, kw=3, n_out=512, dh=1, dw=1, p=p)
conv4_3 = conv_op(conv4_2, name="conv4_3", kh=3, kw=3, n_out=512, dh=1, dw=1, p=p)
pool4 = mpool_op(conv4_3, name="maxpoo13", kh=2, kw=2, dh=2, dw=2)
conv5_1 = conv_op(pool4, name="conv5_1", kh=3, kw=3, n_out=512, dh=1, dw=1, p=p)
conv5_2 = conv_op(conv5_1, name="conv5_2", kh=3, kw=3, n_out=512, dh=1, dw=1, p=p)
conv5_3 = conv_op(conv5_2, name="conv5_3", kh=3, kw=3, n_out=512, dh=1, dw=1, p=p)
pool5 = mpool_op(conv5_3, name="maxpoo14", kh=2, kw=2, dh=2, dw=2)
shp = pool5.get_shape()
flattened_shape = shp[1].value * shp[2].value * shp[3].value
resh1 = tf.reshape(pool5,[-1,flattened_shape],name="resh1")
fc6 = fc_op(resh1,name="fc6",n_out=4096,p=p)
fc6_drop = tf.nn.dropout(fc6,keep_prob,name="fc6_drop")
fc7 = fc_op(fc6_drop,name="fc7",n_out=4096,p=p)
fc7_drop = tf.nn.dropout(fc7,keep_prob,name="fc7_drop")
fc8 = fc_op(fc7_drop,name="fc8",n_out=1000,p=p)
softmax = tf.nn.softmax(fc8)
predictions = tf.argmax(softmax,1)
return predictions,softmax,fc8,p
'''
session: Tensorflow Session
target: 需要测评的运算的操作
info_string:名称
'''
def time_tensorflow_run(session,target,feed,info_string):
num_steps_burn_in = 10
total_duraion = 0.0
total_duraion_squared = 0.0
for i in range(num_batches + num_steps_burn_in):
start_time = time.time()
_ = session.run(target,feed_dict=feed)
duration = time.time() - start_time
if i >= num_steps_burn_in:
if not i % 10:
print('%s:step %d,duration = %.3f'%
(datetime.now(),i-num_steps_burn_in,duration))
total_duraion += duration
total_duraion_squared += duration * duration
mn = total_duraion / num_batches
vr = total_duraion_squared / num_batches-mn*mn
sd = math.sqrt(vr)
print('%s:%s across %d steps, %.3f +/- %.3f sec / batch'%
(datetime.now(),info_string,num_batches,mn,sd))
def run_benchmark():
with tf.Graph().as_default():
image_size = 224
images = tf.Variable(tf.random_normal([batch_size,
image_size,
image_size,3],
dtype=tf.float32,
stddev=1e-1))
keep_prob = tf.placeholder(tf.float32)
predictions,softmax,fc8,p = inference_op(images,keep_prob)
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
time_tensorflow_run(sess,predictions,{keep_prob:1.0},"Forward")
objective = tf.nn.l2_loss(fc8)
grad = tf.gradients(objective,p)
time_tensorflow_run(sess,grad,{keep_prob:0.5},"Forward-backward")
batch_size = 32
num_batches = 100
run_benchmark()
| 31.920792 | 90 | 0.573821 |
2f26dc9721a20ef28b453f39864d2530a50e38da | 542 | java | Java | core/src/main/java/com/mh/simplerpc/service/ServiceMessage.java | MrHadess/simplerpc | 0d0ffe2d290262503613ca63e4a6b980c5ac1748 | [
"MIT"
] | null | null | null | core/src/main/java/com/mh/simplerpc/service/ServiceMessage.java | MrHadess/simplerpc | 0d0ffe2d290262503613ca63e4a6b980c5ac1748 | [
"MIT"
] | 3 | 2020-03-18T07:50:18.000Z | 2022-01-04T16:39:33.000Z | core/src/main/java/com/mh/simplerpc/service/ServiceMessage.java | MrHadess/simplerpc | 0d0ffe2d290262503613ca63e4a6b980c5ac1748 | [
"MIT"
] | null | null | null | /*
*
* Copyright (c) 2019 MrHadess
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* */
package com.mh.simplerpc.service;
import io.netty.channel.ChannelHandlerContext;
public interface ServiceMessage {
// 连接成功 取得 channel 对象
/**
* @return confirm connect state
*
* */
boolean connectSuccess(ServiceControl serviceControl,ChannelHandlerContext channelHandlerContext);
// 存在一客户端断开连接
void disconnect(String channelID);
}
| 21.68 | 102 | 0.714022 |
b267f690a5bddd84a9465bbf0a31f0a52e4aa7d7 | 6,357 | swift | Swift | JinsokuGenerator.swift | PocketSwift/JinsokuGenerator | 48e91bc441b48ebf2a9863a413ec3b880ce2f35f | [
"MIT"
] | 5 | 2017-10-31T15:24:11.000Z | 2018-01-25T16:57:30.000Z | JinsokuGenerator.swift | PocketSwift/JinsokuGenerator | 48e91bc441b48ebf2a9863a413ec3b880ce2f35f | [
"MIT"
] | null | null | null | JinsokuGenerator.swift | PocketSwift/JinsokuGenerator | 48e91bc441b48ebf2a9863a413ec3b880ce2f35f | [
"MIT"
] | null | null | null | import Foundation
import Files
public final class JinsokuGenerator {
static var nameKey = "-n"
static var templateFolderName = "Templates"
static let templateFolderKey = "-tf"
static var outputFolderName = "Output"
static let moduleFolderKey = "-of"
static var componentFolderName = "Viper"
static let componentFolderKey = "-c"
static var placeholder = "FirstModule"
static let placeholderKey = "-ph"
static let helperKey = "--help"
private var argumentsDictionary: [String: String] = [JinsokuGenerator.nameKey: "",
JinsokuGenerator.componentFolderKey: JinsokuGenerator.componentFolderName,
JinsokuGenerator.templateFolderKey: JinsokuGenerator.templateFolderName,
JinsokuGenerator.moduleFolderKey: JinsokuGenerator.outputFolderName,
JinsokuGenerator.placeholderKey: JinsokuGenerator.placeholder
]
private let arguments: [String]
public init(arguments: [String] = CommandLine.arguments) {
self.arguments = arguments
}
func configureParams() throws {
let keys = stride(from: 1, to: arguments.count, by: 2).map { arguments[$0] }
let values = stride(from: 2, to: arguments.count, by: 2).map { arguments[$0] }
for key in keys {
switch key {
case JinsokuGenerator.helperKey:
try printHelp()
case key where argumentsDictionary.keys.contains(key):
guard let index = keys.index(of: key) else {
throw Error.noArgumentsDefined
}
argumentsDictionary[key] = values[index]
default:
throw Error.noArgumentsDefined
}
}
guard let name = argumentsDictionary[JinsokuGenerator.nameKey] else { throw Error.missingFileName }
if name.count == 0 { print("pete") }
}
func printHelp() throws {
print("""
\t INPUT:
\t =====
\t-n Select the name for the module. This parameter is mandatory.
\t It changes the placeholder in your template
\t-tf Select the name for the Templates folder. By default is "Templates"
\t-of Name For Output Folder. By default is "Output"
\t-c Component selected in templates folder. By default is "Viper"
\t-ph PlaceHolder in your Template. By default is "FirstModule"
\t OUTPUT
\t ======
\tYour module selected(-c) in templates folder(-tf) is created in your output folder (-of).
\tThe placeholder(-ph) is replaced for your selected name(-nk).
""")
throw Error.showHelper
}
public func run() throws {
try configureParams()
guard arguments.count != 1 && arguments.count % 2 != 0 else {
throw Error.missingFileName
}
// The first argument is the execution path
guard let componentName = argumentsDictionary[JinsokuGenerator.nameKey] else { throw Error.missingFileName }
guard let templateModule = argumentsDictionary[JinsokuGenerator.componentFolderKey] else { throw Error.noTemplates }
let moduleFolder : Folder
do {
moduleFolder = try createRootModule()
} catch {
throw Error.failedToCreateModuleFolder
}
do {
try readDocument(suffix: componentName, templateModule: templateModule, moduleFolder: moduleFolder)
} catch {
throw Error.noTemplates
}
}
func createRootModule() throws -> Folder {
let moduleFolder = try Folder.current.createSubfolderIfNeeded(withName: JinsokuGenerator.outputFolderName)
return moduleFolder
}
func readDocument(suffix: String, templateModule: String, moduleFolder: Folder) throws {
print("🙆♂️ Templete Module --> \(templateModule)")
let templateFolder: Folder
do {
guard let templateFolderName = argumentsDictionary[JinsokuGenerator.templateFolderKey] else { throw Error.noTemplateFolderFinded }
templateFolder = try Folder.current.subfolder(atPath: "\(templateFolderName)/\(templateModule)")
} catch {
throw Error.noTemplateFolderFinded
}
let folder = try moduleFolder.createSubfolderIfNeeded(withName: suffix)
try folder.empty()
for file in templateFolder.files {
try duplicate(file, withPrefix: suffix, inFolder: folder)
}
try templateFolder.makeSubfolderSequence(recursive: true).forEach { subFolder in
let subFolderPath = subFolder.path
let last = subFolder.path.components(separatedBy: templateFolder.path).last ?? ""
let subFolderPathDifference = last
print ("📁 added folder --> \(subFolder.name)")
for file in subFolder.files {
try duplicate(file, withPrefix: suffix, inFolder: try folder.createSubfolderIfNeeded(withName: subFolderPathDifference))
}
}
}
func duplicate(_ file: File, withPrefix prefix: String, inFolder folder:Folder) throws {
guard let placeholder = argumentsDictionary[JinsokuGenerator.placeholderKey] else { throw Error.noTemplateFolderFinded }
let modifiedFile = try folder.createFile(named: "\(file.name.replacingOccurrences(of: placeholder, with: prefix))")
print(" 📦 Generated \(modifiedFile.name)")
let documentAsString = try file.readAsString()
try modifiedFile.write(string: documentAsString.replacingOccurrences(of: placeholder, with: prefix))
}
}
public extension JinsokuGenerator {
enum Error: Swift.Error {
case missingFileName
case failedToCreateFile
case failedToCreateModuleFolder
case noTemplates
case noTemplateFolderFinded
case showHelper
case noArgumentsDefined
}
}
/// run script
let tool = JinsokuGenerator()
do {
try tool.run()
} catch JinsokuGenerator.Error.showHelper{
} catch {
print("Whoops! An error occurred: \(error)")
}
| 39.981132 | 143 | 0.619947 |
ab17668d1b82fbdaadbca52333cce94de5d2896c | 601 | cs | C# | Datatables.AspNetCore/NameConvention/CamelCaseResponseNameConvention.cs | emonarafat/Apical.DataTables.AspNet.AspNetCore | 307c02a7d186795b5840937271b4fa6358ce9e75 | [
"MIT"
] | 1 | 2021-04-15T21:46:19.000Z | 2021-04-15T21:46:19.000Z | Datatables.AspNetCore/NameConvention/CamelCaseResponseNameConvention.cs | emonarafat/Apical.DataTables.AspNet.AspNetCore | 307c02a7d186795b5840937271b4fa6358ce9e75 | [
"MIT"
] | null | null | null | Datatables.AspNetCore/NameConvention/CamelCaseResponseNameConvention.cs | emonarafat/Apical.DataTables.AspNet.AspNetCore | 307c02a7d186795b5840937271b4fa6358ce9e75 | [
"MIT"
] | null | null | null | namespace Datatables.AspNetCore.NameConvention
{
/// <summary>
/// Represents CamelCase response naming convention for DataTables.AspNet.AspNetCore.
/// </summary>
public class CamelCaseResponseNameConvention : Core.NameConvention.IResponseNameConvention
{
public string Draw { get { return "draw"; } }
public string TotalRecords { get { return "recordsTotal"; } }
public string TotalRecordsFiltered { get { return "recordsFiltered"; } }
public string Data { get { return "data"; } }
public string Error { get { return "error"; } }
}
}
| 40.066667 | 94 | 0.668885 |
83faf86b26385c2a846de4030ddc8e939f27cc85 | 2,236 | java | Java | core/src/main/java/com/bbva/kltt/apirest/core/generator/output/language/OutputLanguageInfoValues.java | BBVA-CIB/APIRestGenerator | f3b28638b1d9ed98145bdd47c425cf5ac970941f | [
"Apache-2.0"
] | 5 | 2017-01-09T20:44:24.000Z | 2020-12-09T17:44:21.000Z | core/src/main/java/com/bbva/kltt/apirest/core/generator/output/language/OutputLanguageInfoValues.java | BBVA-CIB/APIRestGenerator | f3b28638b1d9ed98145bdd47c425cf5ac970941f | [
"Apache-2.0"
] | null | null | null | core/src/main/java/com/bbva/kltt/apirest/core/generator/output/language/OutputLanguageInfoValues.java | BBVA-CIB/APIRestGenerator | f3b28638b1d9ed98145bdd47c425cf5ac970941f | [
"Apache-2.0"
] | null | null | null | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.bbva.kltt.apirest.core.generator.output.language;
import com.bbva.kltt.apirest.core.parsed_info.ParsedInfoHandler;
/**
* ------------------------------------------------
* @author Francisco Manuel Benitez Chico
* ------------------------------------------------
*/
public class OutputLanguageInfoValues extends OutputLanguageBase implements IOutputLanguageInfoValues
{
/**
* Public constructor
* @param parsedInfoHandler with the parsed information handler
*/
public OutputLanguageInfoValues(final ParsedInfoHandler parsedInfoHandler)
{
super(parsedInfoHandler) ;
}
@Override
public String getTitle()
{
return this.getParsedInfoHandler().getInfoValues().getTitle() ;
}
@Override
public String getDescription()
{
return this.getParsedInfoHandler().getInfoValues().getDescription() ;
}
@Override
public String getVersion()
{
return this.getParsedInfoHandler().getInfoValues().getVersion() ;
}
@Override
public String getContactName()
{
return this.getParsedInfoHandler().getInfoValues().getContactValues().getName() ;
}
@Override
public String getContactEmail()
{
return this.getParsedInfoHandler().getInfoValues().getContactValues().getEmail() ;
}
@Override
public String getContactUrl()
{
return this.getParsedInfoHandler().getInfoValues().getContactValues().getUrl() ;
}
}
| 29.421053 | 102 | 0.696333 |
813582f2f9170b923fd64a05ad396d4b7603b771 | 1,969 | go | Go | requests/client/wrapper.go | wcmitchell/uhc-auth-proxy | 13803238e04e094f898d5556220c3c05422118fd | [
"Apache-2.0"
] | null | null | null | requests/client/wrapper.go | wcmitchell/uhc-auth-proxy | 13803238e04e094f898d5556220c3c05422118fd | [
"Apache-2.0"
] | null | null | null | requests/client/wrapper.go | wcmitchell/uhc-auth-proxy | 13803238e04e094f898d5556220c3c05422118fd | [
"Apache-2.0"
] | null | null | null | package client
import (
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/spf13/viper"
)
var (
client = &http.Client{
Timeout: viper.GetDuration("TIMEOUT_SECONDS") * time.Second,
}
requestTimes = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "uhc_auth_proxy_request_time",
Help: "Time spent waiting per request per url",
Buckets: []float64{
10,
100,
1000,
},
}, []string{"url"})
)
// HTTPWrapper manages the headers and auth required to speak
// with the auth service. It also provides a convenience method
// to get the bytes from a request.
type HTTPWrapper struct{}
// Wrapper provides a convenience method for getting bytes from
// a http request
type Wrapper interface {
Do(req *http.Request, label string, cluster_id string, authorization_token string) ([]byte, error)
}
// AddHeaders sets the client headers, including the auth token
func (c *HTTPWrapper) AddHeaders(req *http.Request, cluster_id string, authorization_token string) {
req.Header.Add("Authorization", fmt.Sprintf("AccessToken %s:%s", cluster_id, authorization_token))
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
}
// Do is a convenience wrapper that returns the response bytes
func (c *HTTPWrapper) Do(req *http.Request, label string, cluster_id string, authorization_token string) ([]byte, error) {
c.AddHeaders(req, cluster_id, authorization_token)
start := time.Now()
resp, err := client.Do(req)
requestTimes.With(prometheus.Labels{"url": label}).Observe(time.Since(start).Seconds())
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode >= 400 {
return nil, fmt.Errorf("request to %s failed: %d %s", req.URL.String(), resp.StatusCode, resp.Status)
}
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return b, nil
}
| 28.128571 | 122 | 0.726765 |
2951d48ba68880368d57f1c2c885c999a6e77e3e | 2,094 | go | Go | topology/probes/k8s/pod.go | ofirZelig/skydive | 0ed5bda8f3776d8658701490a9c76b31d8372172 | [
"Apache-2.0"
] | null | null | null | topology/probes/k8s/pod.go | ofirZelig/skydive | 0ed5bda8f3776d8658701490a9c76b31d8372172 | [
"Apache-2.0"
] | null | null | null | topology/probes/k8s/pod.go | ofirZelig/skydive | 0ed5bda8f3776d8658701490a9c76b31d8372172 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (C) 2017 Red Hat, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package k8s
import (
"fmt"
"github.com/mohae/deepcopy"
"github.com/skydive-project/skydive/topology/graph"
"k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
)
type podHandler struct {
graph.DefaultGraphListener
graph *graph.Graph
cache *ResourceCache
}
func (h *podHandler) Dump(obj interface{}) string {
pod := obj.(*v1.Pod)
return fmt.Sprintf("pod{Namespace: %s, Name: %s}", pod.Namespace, pod.Name)
}
func (h *podHandler) Map(obj interface{}) (graph.Identifier, graph.Metadata) {
// we make a copy of pod before modifaying the pod object so
// that don't interfere with the container subprobe
pod := deepcopy.Copy(obj).(*v1.Pod)
pod.Spec.Containers = nil
m := NewMetadataFields(&pod.ObjectMeta)
m.SetField("Node", pod.Spec.NodeName)
podIP := pod.Status.PodIP
if podIP != "" {
m.SetField("IP", podIP)
}
reason := string(pod.Status.Phase)
if pod.Status.Reason != "" {
reason = pod.Status.Reason
}
m.SetField("Status", reason)
return graph.Identifier(pod.GetUID()), NewMetadata(Manager, "pod", m, pod, pod.Name)
}
func newPodProbe(client interface{}, g *graph.Graph) Subprobe {
return NewResourceCache(client.(*kubernetes.Clientset).CoreV1().RESTClient(), &v1.Pod{}, "pods", g, &podHandler{graph: g})
}
| 29.083333 | 123 | 0.718243 |
14088399f8416d13a8ec32afd8d167fd0096803f | 201 | asm | Assembly | libsrc/_DEVELOPMENT/adt/p_queue/c/sdcc_iy/p_queue_empty_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/p_queue/c/sdcc_iy/p_queue_empty_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/p_queue/c/sdcc_iy/p_queue_empty_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; int p_queue_empty_fastcall(p_queue_t *q)
SECTION code_adt_p_queue
PUBLIC _p_queue_empty_fastcall
defc _p_queue_empty_fastcall = asm_p_queue_empty
INCLUDE "adt/p_queue/z80/asm_p_queue_empty.asm"
| 18.272727 | 48 | 0.850746 |
e30dff5bf46ee0063f6ce428b79eee849a93797c | 1,955 | swift | Swift | Sources/CanaryProto/DefaultValueWrapper.swift | BinaryParadise/Canary | d1a9a131bac347f605fed51ff4a2c07bd3af4661 | [
"MIT"
] | null | null | null | Sources/CanaryProto/DefaultValueWrapper.swift | BinaryParadise/Canary | d1a9a131bac347f605fed51ff4a2c07bd3af4661 | [
"MIT"
] | null | null | null | Sources/CanaryProto/DefaultValueWrapper.swift | BinaryParadise/Canary | d1a9a131bac347f605fed51ff4a2c07bd3af4661 | [
"MIT"
] | null | null | null | //
// DefaultValueWrapper.swift
//
//
// Created by Rake Yang on 2021/6/23.
//
import Foundation
/**
# 使用 Property Wrapper 为 Codable 解码设定默认值
- 原文链接 https://onevcat.com/2020/11/codable-default/
- 我只是个代码搬运工
# 这样做的优点
- 不用为每个类去重写 init(from:) 方法去设置默认值,减少了大量了每个类型添加这么一坨 CodingKeys 和 init(from:)方法,减少重复工作
*/
public protocol DefaultValue {
associatedtype Value: Codable
static var defaultValue: Value { get }
}
@propertyWrapper
public struct Default<T: DefaultValue> {
public var wrappedValue: T.Value
public init(wrappedValue: T.Value) {
self.wrappedValue = wrappedValue
}
}
extension Default: Codable {
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
wrappedValue = (try? container.decode(T.Value.self)) ?? T.defaultValue
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(wrappedValue)
}
}
extension KeyedDecodingContainer {
func decode<T>( _ type: Default<T>.Type, forKey key: Key) throws -> Default<T> where T: DefaultValue {
try decodeIfPresent(type, forKey: key) ?? Default(wrappedValue: T.defaultValue)
}
}
public extension Bool {
enum False: DefaultValue {
public static let defaultValue = false
}
enum True: DefaultValue {
public static let defaultValue = true
}
}
public extension Int {
enum Zero: DefaultValue {
public static let defaultValue = 0
}
}
public extension Int64 {
enum Zero: DefaultValue {
public static let defaultValue = 0
}
}
public extension String {
enum Empty: DefaultValue {
public static let defaultValue = ""
}
}
public extension Default {
typealias True = Default<Bool.True>
typealias False = Default<Bool.False>
typealias Zero = Default<Int.Zero>
typealias Empty = Default<String.Empty>
}
| 23.554217 | 106 | 0.675703 |
c1648126dfe9028c8af866adc03640725aacacd8 | 1,165 | rs | Rust | cli/src/macros.rs | furiosa-ai/tract | 5e022c5411a26cd9a33c595d3773567fe1037982 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1 | 2020-08-17T09:26:51.000Z | 2020-08-17T09:26:51.000Z | cli/src/macros.rs | furiosa-ai/tract | 5e022c5411a26cd9a33c595d3773567fe1037982 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | cli/src/macros.rs | furiosa-ai/tract | 5e022c5411a26cd9a33c595d3773567fe1037982 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1 | 2020-08-17T09:27:41.000Z | 2020-08-17T09:27:41.000Z | #[macro_export]
macro_rules! dispatch_model {
($model: expr, $expr: expr) => {
if let Some(m) = $model.downcast_ref::<tract_hir::prelude::InferenceModel>() {
$expr(m)
} else if let Some(m) = $model.downcast_ref::<TypedModel>() {
$expr(m)
} else if let Some(m) = $model.downcast_ref::<PulsedModel>() {
$expr(m)
} else {
unreachable!()
}
};
}
#[macro_export]
macro_rules! dispatch_model_no_pulse {
($model: expr, $expr: expr) => {
if let Some(m) = $model.downcast_ref::<InferenceModel>() {
$expr(m)
} else if let Some(m) = $model.downcast_ref::<TypedModel>() {
$expr(m)
} else {
bail!("Pulse model are unsupported here")
}
};
}
#[macro_export]
macro_rules! dispatch_model_mut_no_pulse {
($model: expr, $expr: expr) => {
if let Some(m) = $model.downcast_mut::<InferenceModel>() {
$expr(m)
} else if let Some(m) = $model.downcast_mut::<TypedModel>() {
$expr(m)
} else {
bail!("Pulse model are unsupported here")
}
};
}
| 28.414634 | 86 | 0.523605 |
2f1a75a078f9d0c662adc0f6367eed08fd03dec1 | 7,805 | cs | C# | Mtblib/Graph/Component/MGraph.cs | Yalibuda/Mtblib | 075450a98930b37949fc76f729bf98375d5324ee | [
"MIT",
"X11",
"Unlicense"
] | null | null | null | Mtblib/Graph/Component/MGraph.cs | Yalibuda/Mtblib | 075450a98930b37949fc76f729bf98375d5324ee | [
"MIT",
"X11",
"Unlicense"
] | null | null | null | Mtblib/Graph/Component/MGraph.cs | Yalibuda/Mtblib | 075450a98930b37949fc76f729bf98375d5324ee | [
"MIT",
"X11",
"Unlicense"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mtb;
using Mtblib.Tools;
namespace Mtblib.Graph.Component
{
/// <summary>
/// Minitab Graph 基本設定
/// </summary>
public abstract class MGraph : IDisposable
{
protected Mtb.Project _proj;
protected Mtb.Worksheet _ws;
public MGraph(Mtb.Project proj, Mtb.Worksheet ws)
{
_proj = proj;
_ws = ws;
ALineLst = new List<Annotation.Line>();
AMarkerLst = new List<Annotation.Marker>();
ARectLst = new List<Annotation.Rectangle>();
ATextLst = new List<Annotation.Textbox>();
FootnoteLst = new List<Footnote>();
Title = new Title();
ShowDefaultFootnote = false;
ShowDefaultSubTitle = false;
ShowPersonalSubTitle = false;
ShowSeparateSubTitle = false;
DataRegion = new Region.DataRegion();
FigureRegion = new Region.FigureRegion();
GraphRegion = new Region.GraphRegion();
Legend = new Region.Legend();
WTitle = null;
GraphPath = null;
CommandPath = null;
}
/// <summary>
/// 指定或取得 Session folder 上的標題
/// </summary>
public string WTitle { set; get; }
/// <summary>
/// 指定或取得圖形儲存路徑(位置+檔名+副檔名),副檔名可以是 JPG, JPEG, MGF.
/// </summary>
public string GraphPath { set; get; }
/// <summary>
/// 指定或取得 Minitab script 儲存路徑(位置+檔名)
/// </summary>
public string CommandPath { set; get; }
public List<Annotation.Line> ALineLst { set; get; }
public List<Annotation.Marker> AMarkerLst { set; get; }
public List<Annotation.Rectangle> ARectLst { set; get; }
public List<Annotation.Textbox> ATextLst { set; get; }
/// <summary>
/// 圖形上的標題
/// </summary>
public Title Title { set; get; }
/// <summary>
/// 註解
/// </summary>
public List<Footnote> FootnoteLst { set; get; }
/// <summary>
/// 指定或取得是否要顯示預設的註腳
/// </summary>
public bool ShowDefaultFootnote { set; get; }
/// <summary>
/// 指定或取得是否要顯示預設的標題 * 已於 Title 物件中執行
/// </summary>
//public bool ShowDefaultTitle { set; get; }
/// <summary>
/// 指定或取得是否要顯示預設的子標題
/// </summary>
public bool ShowDefaultSubTitle { set; get; }
/// <summary>
/// 指定或取得是否要顯示個人註腳
/// </summary>
public bool ShowPersonalSubTitle { set; get; }
/// <summary>
/// 指定或取得是否要顯示 Panel 分群註腳
/// </summary>
public bool ShowSeparateSubTitle { set; get; }
public Region.DataRegion DataRegion { set; get; }
public Region.FigureRegion FigureRegion { set; get; }
public Region.GraphRegion GraphRegion { set; get; }
public Region.Legend Legend { set; get; }
/// <summary>
/// 取得 Chart option 的指令碼 (GSave, WTitle)
/// </summary>
/// <returns></returns>
public virtual string GetOptionCommand()
{
StringBuilder cmnd = new StringBuilder();
if (GraphPath != null)
{
if (MtbTools.VerifyGraphPath(GraphPath))
{
cmnd.AppendFormat(" GSave \"{0}\";\r\n", GraphPath);
System.Text.RegularExpressions.Regex regex =
new System.Text.RegularExpressions.Regex(@".*?\.(mgf|png|gif|bmp|tif|emf)$", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
if (regex.IsMatch(GraphPath))
{
System.Text.RegularExpressions.Match m = regex.Match(GraphPath);
string f = m.Groups[1].ToString().ToUpper();
switch (f)
{
case "PNG":
f = "PNGH";
break;
case "BMP":
f = "BMPH";
break;
default:
break;
}
cmnd.AppendLine(string.Format(" {0};", f));
}
else
{
cmnd.AppendLine(" JPEG;");
}
cmnd.AppendLine(" Replace;");
}
}
if (WTitle != null)
{
cmnd.AppendFormat(" Wtitle \"{0}\";\r\n", WTitle);
}
return cmnd.ToString();
}
/// <summary>
/// 取得 Region 的指令碼(Graph, Data, Figure)
/// </summary>
/// <returns></returns>
public virtual string GetRegionCommand()
{
StringBuilder cmnd = new StringBuilder();
if (GraphRegion != null)
{
cmnd.Append(GraphRegion.GetCommand());
}
if (DataRegion != null)
{
cmnd.Append(DataRegion.GetCommand());
}
if (FigureRegion != null)
{
cmnd.Append(FigureRegion.GetCommand());
}
return cmnd.ToString();
}
/// <summary>
/// 取得 Annotation 指令碼 (Line, Mark, Rectangle, TextBox 等)
/// </summary>
/// <returns></returns>
public virtual string GetAnnotationCommand()
{
StringBuilder cmnd = new StringBuilder();
foreach (Footnote footnote in FootnoteLst)
{
cmnd.Append(footnote.GetCommand());
}
foreach (Component.Annotation.Line line in ALineLst)
{
cmnd.Append(line.GetCommand());
}
foreach (Component.Annotation.Marker marker in AMarkerLst)
{
cmnd.Append(marker.GetCommand());
}
foreach (Component.Annotation.Rectangle rect in ARectLst)
{
cmnd.Append(rect.GetCommand());
}
foreach (Component.Annotation.Textbox tbox in ATextLst)
{
cmnd.Append(tbox.GetCommand());
}
cmnd.Append(Title.GetCommand());
if (!ShowDefaultFootnote) cmnd.AppendLine("Nodf;");
if (!ShowDefaultSubTitle) cmnd.AppendLine("Nods;");
if (!ShowPersonalSubTitle) cmnd.AppendLine("Nope;");
if (!ShowSeparateSubTitle) cmnd.AppendLine("Nose;");
cmnd.AppendLine("Nosf;");
cmnd.AppendLine("Noxf;");
return cmnd.ToString();
}
/// <summary>
/// 取得 Data option 指令碼,繪製特定條件的資料
/// </summary>
/// <returns></returns>
public virtual string GetDataOptionCommand()
{
throw new NotImplementedException();
}
public abstract void SetDefault();
protected abstract string DefaultCommand();
public Func<string> GetCommand { set; get; }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// Free other state (managed objects).
}
// Free your own state (unmanaged objects).
// Set large fields to null.
GC.Collect();
_proj = null;
_ws = null;
}
~MGraph()
{
Dispose(false);
}
}
}
| 32.520833 | 157 | 0.483664 |
b47d73ccd5a22c810c344b986aa7e8e789146735 | 1,370 | kt | Kotlin | src/main/java/cz/encircled/cli/finance/command/DescribeCategoryCommand.kt | encircled/cli-finance | 1cf215cfc614d2952ebf7fa79b17aa284bebcb3e | [
"Apache-2.0"
] | null | null | null | src/main/java/cz/encircled/cli/finance/command/DescribeCategoryCommand.kt | encircled/cli-finance | 1cf215cfc614d2952ebf7fa79b17aa284bebcb3e | [
"Apache-2.0"
] | null | null | null | src/main/java/cz/encircled/cli/finance/command/DescribeCategoryCommand.kt | encircled/cli-finance | 1cf215cfc614d2952ebf7fa79b17aa284bebcb3e | [
"Apache-2.0"
] | null | null | null | package cz.encircled.cli.finance.command
import cz.encircled.cli.finance.FinanceContext
import cz.encircled.cli.finance.InputCommand
import cz.encircled.cli.finance.model.TransactionEntry
class DescribeCategoryCommand : FinanceCommand {
override fun requiredArgs(): List<String> = listOf("c")
override fun doExec(context: FinanceContext, inputCommand: InputCommand): Any {
val category = inputCommand.namedArgs["c"]!!
return if (inputCommand.namedArgs.containsKey("g")) {
val min = inputCommand.namedArgs["g"]!!.toInt()
context.dataSet.filter { it.category == category }
.groupBy({ getSubCat(it, min) }, { it.amount })
.map { Pair(it.key, it.value.sumByDouble { amount -> amount.toDouble() }) }
.sortedBy { it.second }
} else {
context.dataSet.filter { it.category == category }
}
}
private fun getSubCat(it: TransactionEntry, min: Int): String {
return if (it.transactionNote.isEmpty()) {
it.customNote.substring(0, Math.min(it.customNote.length, min))
} else it.transactionNote.substring(0, Math.min(it.transactionNote.length, min))
}
override fun help(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
} | 39.142857 | 107 | 0.645255 |
42a2c66a0ec914d433f1c7d169b0b6f80fb59dc4 | 527 | sql | SQL | _src/05/com_folio_v1.2.1/admin/sql/install.mysql.utf8.sql | paullewallencom/joomla-978-1-7821-6837-9 | c4fd3bb922f557e2e786774b648da0d89377f1c4 | [
"Apache-2.0"
] | null | null | null | _src/05/com_folio_v1.2.1/admin/sql/install.mysql.utf8.sql | paullewallencom/joomla-978-1-7821-6837-9 | c4fd3bb922f557e2e786774b648da0d89377f1c4 | [
"Apache-2.0"
] | null | null | null | _src/05/com_folio_v1.2.1/admin/sql/install.mysql.utf8.sql | paullewallencom/joomla-978-1-7821-6837-9 | c4fd3bb922f557e2e786774b648da0d89377f1c4 | [
"Apache-2.0"
] | null | null | null | CREATE TABLE IF NOT EXISTS `#__folio` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(250) NOT NULL DEFAULT '',
`alias` varchar(255) NOT NULL DEFAULT '',
`catid` int(11) NOT NULL DEFAULT '0',
`state` tinyint(1) NOT NULL default '0',
`image` varchar(255) NOT NULL,
`company` varchar(250) NOT NULL DEFAULT '',
`phone` varchar(12) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL,
`description` TEXT,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; | 40.538462 | 55 | 0.662239 |
0bb359c0063eabf93dde9edd2cfba9793f40a71e | 1,581 | html | HTML | schedule/templates/site_base.html | westphahl/django-scheduler | ac52eb54145fbd1d585f6ba7e14beb45ac91e0ca | [
"BSD-3-Clause"
] | 1 | 2019-03-30T13:47:48.000Z | 2019-03-30T13:47:48.000Z | schedule/templates/site_base.html | westphahl/django-scheduler | ac52eb54145fbd1d585f6ba7e14beb45ac91e0ca | [
"BSD-3-Clause"
] | 7 | 2015-03-31T03:58:41.000Z | 2017-01-10T21:03:16.000Z | schedule/templates/site_base.html | westphahl/django-scheduler | ac52eb54145fbd1d585f6ba7e14beb45ac91e0ca | [
"BSD-3-Clause"
] | 2 | 2017-05-02T08:38:55.000Z | 2018-02-03T19:14:11.000Z | {% load i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}" xml:lang="{{ LANGUAGE_CODE }}" lang="{{ LANGUAGE_CODE }}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{% if site_name %}{{ site_name }} : {% endif %}{% block head_title %}{% endblock %}</title>
<!--[if IE]><style>
div {
zoom: 1; /* trigger hasLayout */
}
</style><![endif]-->
{% if LANGUAGE_BIDI %}
<style type="text/css" media="screen">
div.right_panel {
float: left; /* hotfix for sidebar */
}
</style>
{% endif %}
{% block extra_head %}
{% endblock %}
</head>
<body>
<h3 id="demo">This is a demo of a django-schedule calendar</h3>
<p style="clear:both">
<div id="body">
{% if messages %}
<ul id="messages">
{% for message in messages %}
<li id="message_{{ forloop.counter }}"><a href="#" onclick="$('#message_{{ forloop.counter }}').fadeOut(); return false;"><small>{% trans "clear" %}</small></a> {{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% block body %}
{% endblock %}
</div>
<div id="footer">{% block footer %}{% endblock %}</div>
</body>
</html>
| 35.133333 | 199 | 0.477546 |
d5b890fa7842279bfefac59e9bdd10728b0fde89 | 3,871 | dart | Dart | rive_animations/custom_controller/lib/app/screens/myapp/widgets/my_animation.dart | fredgrott/flutter_design_and_arch_rosetta | a44d23f6c5980404cfc5d26e35ac2a781686e06f | [
"BSD-3-Clause"
] | 6 | 2021-06-08T20:23:46.000Z | 2021-08-30T05:58:00.000Z | rive_animations/custom_controller/lib/app/screens/myapp/widgets/my_animation.dart | fredgrott/flutter_design_and_arch_rosetta | a44d23f6c5980404cfc5d26e35ac2a781686e06f | [
"BSD-3-Clause"
] | null | null | null | rive_animations/custom_controller/lib/app/screens/myapp/widgets/my_animation.dart | fredgrott/flutter_design_and_arch_rosetta | a44d23f6c5980404cfc5d26e35ac2a781686e06f | [
"BSD-3-Clause"
] | 1 | 2021-07-24T13:55:53.000Z | 2021-07-24T13:55:53.000Z | // Copyright 2021 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
import 'package:custom_controller/app/shared/app_globals.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:rive/rive.dart';
class CompletingAnimation extends SimpleAnimation {
CompletingAnimation(String animationName, {required double mix})
: super(animationName, mix: mix);
/// Tracks whether the animation should enter a paused state at the end of the
/// current animation cycle
bool _pause = false;
bool get pause => _pause;
set pause(bool value) {
_pause = value;
// Start immediately if un-paused
if (!value) {
isActive = true;
}
}
/// Pauses at the end of an animation loop if _pause is true
void _pauseAtEndOfAnimation() {
// Calculate the start time of the animation, which may not be 0 if work
// area is enabled
final start =
instance!.animation.enableWorkArea ? instance!.animation.workStart : 0;
// Calculate the frame the animation is currently on
final currentFrame = (instance!.time - start) * instance!.animation.fps;
// If the animation is within the window of a single frame, pause
if (currentFrame <= 1) {
isActive = false;
}
}
@override
void apply(RuntimeArtboard artboard, double elapsedSeconds) {
// Apply the animation to the artboard with the appropriate level of mix
instance!.animation.apply(instance!.time, coreContext: artboard, mix: mix);
// If pause has been requested, try to pause
if (_pause) {
_pauseAtEndOfAnimation();
}
// If false, the animation has ended (it doesn't loop)
if (!instance!.advance(elapsedSeconds)) {
isActive = false;
}
}
}
class MyAnimation extends StatefulWidget {
@override
_MyAnimationState createState() => _MyAnimationState();
}
class _MyAnimationState extends State<MyAnimation> {
late CompletingAnimation _wipersAnimation;
// Is the bounce animation paused
var _isPaused = false;
@override
void initState() {
_loadRiveFile();
super.initState();
}
Future _loadRiveFile() async {
// Load your Rive data
final bytes = await byteAssets.load(riveFileName);
// Create a RiveFile from the binary data
RiveFile file;
if (bytes.buffer.lengthInBytes.isFinite) {
file = RiveFile.import(bytes);
final Artboard artboard = file.mainArtboard;
// Idle plays continuously so we can use a SimpleAnimation
artboard.addController(SimpleAnimation('idle'));
// Bouncing can be paused and we want it to play to the end of the bounce
// animation when complete, so let's use our custom controller
artboard.addController(
_wipersAnimation = CompletingAnimation('windshield_wipers', mix: 0),
);
// Wrapped in setState so the widget knows the artboard is ready to play
setState(() => myArtboard = artboard);
} else {
throw PlatformException(code: "rive asset loading problem");
}
}
/// Sets the level of bounciness
void _pause() =>
setState(() => _wipersAnimation.pause = _isPaused = !_isPaused);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Flexible(
flex: 3,
// ignore: unnecessary_null_comparison
child: myArtboard != null ? Rive(artboard: myArtboard) : Container(),
),
Flexible(
// ignore: avoid_redundant_argument_values
flex: 1,
child: ElevatedButton(
onPressed: _pause,
child: Text(_isPaused ? 'Play' : 'Pause'),
),
),
],
);
}
} | 30.242188 | 80 | 0.670369 |
707abad49373d061163453c3e54612030d6670fb | 2,001 | cshtml | C# | samples/customization/Sample_Customization_DataAccess/ISV1.web/Areas/Core/Views/Shared/AddCriteria.cshtml | ggagnaux/Sage300-SDK | acf159f25c39b3886d71c4d1d99d755c4846b340 | [
"MIT"
] | 21 | 2016-08-02T18:40:17.000Z | 2022-02-22T12:23:57.000Z | samples/customization/Sample_Customization_DataAccess/ISV1.web/Areas/Core/Views/Shared/AddCriteria.cshtml | ggagnaux/Sage300-SDK | acf159f25c39b3886d71c4d1d99d755c4846b340 | [
"MIT"
] | 10 | 2017-01-06T16:40:12.000Z | 2021-03-10T00:15:52.000Z | samples/customization/Sample_Customization_DataAccess/ISV1.web/Areas/Core/Views/Shared/AddCriteria.cshtml | ggagnaux/Sage300-SDK | acf159f25c39b3886d71c4d1d99d755c4846b340 | [
"MIT"
] | 67 | 2016-07-22T18:59:41.000Z | 2022-02-23T12:50:46.000Z | @*
The MIT License (MIT)
Copyright (c) 1994-2018 The Sage Group plc or its licensors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*@
@using Sage.CA.SBS.ERP.Sage300.Common.Resources
@using Sage.CA.SBS.ERP.Sage300.Common.Web.HtmlHelperExtension
<div class="container_popUp">
<div id="divOperator" class="grid_7 alpha">
@Html.KoSageDropDownList("OperatorDropdown1", null, new { @id = "OperatorDropdown1" })
</div>
<div class="clear-fix"></div>
<div id="divValue" class="grid_7 alpha pad_top_0 pad_bot_05">
@Html.KoSageDropDownList("ValueDropDown1", null, new { @id = "ValueDropDown1", @class = "clsValueDropDown1" })
@Html.SageTextBox("ValueTextBox1", null, new { @id = "ValueTextBox1" })
</div>
<div class="clear-fix"></div>
<div class="mar_top_1">
@Html.KoSageButton("setCriteria", null, new { @class = "btn-primary right", @value = CommonResx.OK, @id = "setCriteria" })
</div>
</div>
| 47.642857 | 130 | 0.723138 |
3d521388ffae94f39251a1705e63477c4fbca69a | 2,053 | lua | Lua | ports/lang/terra-devel/files/patch-src_terralib.lua | MallocBSD/custom-ports | 2a97403d4f90075e37d8008080cfd72ea77bd904 | [
"BSD-2-Clause"
] | 6 | 2016-02-06T11:49:05.000Z | 2017-11-22T01:35:06.000Z | ports/lang/terra-devel/files/patch-src_terralib.lua | MallocBSD/custom-ports | 2a97403d4f90075e37d8008080cfd72ea77bd904 | [
"BSD-2-Clause"
] | null | null | null | ports/lang/terra-devel/files/patch-src_terralib.lua | MallocBSD/custom-ports | 2a97403d4f90075e37d8008080cfd72ea77bd904 | [
"BSD-2-Clause"
] | null | null | null | --- src/terralib.lua.orig 2017-10-17 06:05:35 UTC
+++ src/terralib.lua
@@ -3366,12 +3366,12 @@ function terra.includecstring(code,cargs
local args = terra.newlist {"-O3","-Wno-deprecated","-resource-dir",clangresourcedirectory}
target = target or terra.nativetarget
- if (target == terra.nativetarget and ffi.os == "Linux") or (target.Triple and target.Triple:match("linux")) then
- args:insert("-internal-isystem")
+ if (target == terra.nativetarget and (ffi.os == "Linux" or ffi.os == "BSD")) or (target.Triple and target.Triple:match("linux")) then
+ args:insert( ffi.os == "BSD" and "-isystem" or "-internal-isystem")
args:insert(clangresourcedirectory.."/include")
end
for _,path in ipairs(terra.systemincludes) do
- args:insert("-internal-isystem")
+ args:insert( ffi.os == "BSD" and "-isystem" or "-internal-isystem")
args:insert(path)
end
@@ -3397,6 +3397,7 @@ function terra.includecstring(code,cargs
addtogeneral(macros)
setmetatable(general,mt)
setmetatable(tagged,mt)
+ for _,v in ipairs(args) do print( v ) end
return general,tagged,macros
end
function terra.includec(fname,cargs,target)
@@ -4015,6 +4016,7 @@ end
terra.cudahome = os.getenv("CUDA_HOME") or (ffi.os == "Windows" and os.getenv("CUDA_PATH")) or "/usr/local/cuda"
terra.cudalibpaths = ({ OSX = {driver = "/usr/local/cuda/lib/libcuda.dylib", runtime = "$CUDA_HOME/lib/libcudart.dylib", nvvm = "$CUDA_HOME/nvvm/lib/libnvvm.dylib"};
Linux = {driver = "libcuda.so", runtime = "$CUDA_HOME/lib64/libcudart.so", nvvm = "$CUDA_HOME/nvvm/lib64/libnvvm.so"};
+ BSD = {driver = "libcuda.so", runtime = "$CUDA_HOME/lib64/libcudart.so", nvvm = "$CUDA_HOME/nvvm/lib64/libnvvm.so"};
Windows = {driver = "nvcuda.dll", runtime = "$CUDA_HOME\\bin\\cudart64_*.dll", nvvm = "$CUDA_HOME\\nvvm\\bin\\nvvm64_*.dll"}; })[ffi.os]
for name,path in pairs(terra.cudalibpaths) do
path = path:gsub("%$CUDA_HOME",terra.cudahome)
| 58.657143 | 168 | 0.650268 |
29a717cc683df3c28bd2558845d418da591ad709 | 4,164 | go | Go | webpage/http_client.go | polyrabbit/web-image-fs | 170d6d9c80b5b9651514eac428170948614983b9 | [
"MIT"
] | null | null | null | webpage/http_client.go | polyrabbit/web-image-fs | 170d6d9c80b5b9651514eac428170948614983b9 | [
"MIT"
] | null | null | null | webpage/http_client.go | polyrabbit/web-image-fs | 170d6d9c80b5b9651514eac428170948614983b9 | [
"MIT"
] | null | null | null | package webpage
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/PuerkitoBio/goquery"
"github.com/sirupsen/logrus"
)
const ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36"
type HTTPClient struct {
client *http.Client
}
func NewHTTPClient(timeoutSeconds time.Duration) *HTTPClient {
return &HTTPClient{
client: &http.Client{
Timeout: timeoutSeconds,
},
}
}
func (c *HTTPClient) Parse(ctx context.Context, absURL string) ([]DomNode, error) {
resp, err := c.Fetch(ctx, http.MethodGet, absURL)
if err != nil {
return nil, fmt.Errorf("http GET: %w", err)
}
defer resp.Body.Close()
// Load the HTML document
doc, err := goquery.NewDocumentFromReader(resp.Body)
if err != nil {
return nil, fmt.Errorf("goquery.NewDocumentFromReader: %w", err)
}
var doms []DomNode
// First, find all images
doc.Find("img[src]").Each(func(i int, s *goquery.Selection) {
if imgPath, exists := s.Attr("src"); exists && imgPath != "" {
if strings.HasPrefix(imgPath, "data:") { // TODO: should support base64-encoded image
return
}
imgURL, err := c.URLJoin(absURL, imgPath)
if err != nil {
logrus.WithError(err).WithField("path", imgPath).Debug("Failed to join image url")
return
}
var (
contentLength int
contentType string
)
if header, err := c.MetaInfo(ctx, imgURL); err == nil {
contentLength, _ = strconv.Atoi(header.Get("Content-Length"))
contentType = header.Get("Content-Type")
} else {
logrus.WithError(err).WithField("path", imgPath).Debug("Failed to get image header")
}
imgNode := ImageNode{
// TODO: fix duplicated names
LinkNode: LinkNode{
Name: s.AttrOr("alt", ""),
// FIXME: parent path is missing
SelfLink: imgURL,
},
Size: uint64(contentLength),
ContentType: contentType,
}
if imgNode.FileName() != "" {
doms = append(doms, &imgNode)
}
}
})
// Then, find all links/directories
doc.Find("a[href]").Each(func(i int, s *goquery.Selection) {
if linkPath, exists := s.Attr("href"); exists && linkPath != "" {
if strings.HasPrefix(linkPath, "#") || strings.HasPrefix(linkPath, "javascript:") {
return
}
linkURL, err := c.URLJoin(absURL, linkPath)
if err != nil {
logrus.WithError(err).WithField("path", linkPath).Debug("Failed to join link url")
return
}
linkNode := LinkNode{
// TODO: fix duplicated names
Name: s.Text(),
SelfLink: linkURL,
}
if linkNode.FileName() != "" {
doms = append(doms, &linkNode)
}
}
})
return doms, nil
}
// GetInfo uses http HEAD method to get meta info in advance
func (c *HTTPClient) MetaInfo(ctx context.Context, absURL string) (http.Header, error) {
resp, err := c.Fetch(ctx, http.MethodHead, absURL)
if err != nil {
return nil, fmt.Errorf("http HEAD: %w", err)
}
defer resp.Body.Close()
return resp.Header, nil
}
func (c *HTTPClient) Download(ctx context.Context, absURL string) ([]byte, error) {
resp, err := c.Fetch(ctx, http.MethodGet, absURL)
if err != nil {
return nil, fmt.Errorf("http GET: %w", err)
}
defer resp.Body.Close()
return ioutil.ReadAll(resp.Body)
}
func (c *HTTPClient) Fetch(ctx context.Context, method, absURL string) (*http.Response, error) {
logrus.WithField("url", absURL).WithField("method", method).Debug("HTTPClient fetch")
req, err := http.NewRequestWithContext(ctx, method, absURL, nil)
if err != nil {
return nil, fmt.Errorf("http.NewRequestWithContext: %w", err)
}
req.Header.Set("User-Agent", ua)
resp, err := c.client.Do(req)
if err != nil {
return nil, fmt.Errorf("http client Do: %w", err)
}
if resp.StatusCode != 200 {
return nil, NewHTTPError(resp)
}
return resp, nil
}
func (c *HTTPClient) URLJoin(base, relativePath string) (string, error) {
uBase, err := url.Parse(base)
if err != nil {
return "", fmt.Errorf("parse base url: %w", err)
}
uRef, err := url.Parse(relativePath)
if err != nil {
return "", fmt.Errorf("parse relative path: %w", err)
}
return uBase.ResolveReference(uRef).String(), nil
}
| 27.576159 | 133 | 0.65586 |
040741722ea82fcd0964ba4f1b8c748737c4a387 | 499 | js | JavaScript | test/terminate.js | obsyr/scratch_gpio | 4a5c2d8c72da6d04f6a0f33b85295650d6656eab | [
"MIT"
] | 1 | 2019-02-16T10:28:45.000Z | 2019-02-16T10:28:45.000Z | test/terminate.js | obsyr/scratch_gpio | 4a5c2d8c72da6d04f6a0f33b85295650d6656eab | [
"MIT"
] | 2 | 2018-09-07T07:17:57.000Z | 2020-01-06T10:02:48.000Z | test/terminate.js | obsyr/scratch_gpio | 4a5c2d8c72da6d04f6a0f33b85295650d6656eab | [
"MIT"
] | 3 | 2018-08-17T20:11:30.000Z | 2018-09-13T13:40:45.000Z | 'use strict';
var pigpio = require('../'),
Gpio = pigpio.Gpio,
led = new Gpio(17, {mode: Gpio.OUTPUT});
led.digitalWrite(1);
setTimeout(function () {
pigpio.terminate();
// Creating a new Gpio object should automatically re-initialize
// the pigpio library.
led = new Gpio(17, {mode: Gpio.OUTPUT});
// If the pigpio library was not re-initialized calling digitalWrite will
// result in an excption. See https://github.com/fivdi/pigpio/issues/34
led.digitalWrite(0);
}, 500);
| 23.761905 | 75 | 0.685371 |
1521bae67ad912c7bb7f727b0198af7073288ca5 | 88 | ps1 | PowerShell | TestArtifacts/SingleTest.tests.ps1 | omiossec/Operation-Validation-Framework | 99e173d5a4cdda6ec8e1b2f966eea282b21f67df | [
"MIT"
] | 242 | 2015-11-06T15:42:45.000Z | 2022-03-25T12:49:59.000Z | TestArtifacts/SingleTest.tests.ps1 | omiossec/Operation-Validation-Framework | 99e173d5a4cdda6ec8e1b2f966eea282b21f67df | [
"MIT"
] | 36 | 2015-11-11T22:11:05.000Z | 2022-03-04T21:26:31.000Z | TestArtifacts/SingleTest.tests.ps1 | omiossec/Operation-Validation-Framework | 99e173d5a4cdda6ec8e1b2f966eea282b21f67df | [
"MIT"
] | 54 | 2015-11-10T05:07:32.000Z | 2022-02-25T02:36:48.000Z |
Describe 'Single Test' {
it 'should work' {
$true | should be $true
}
} | 14.666667 | 31 | 0.522727 |
cb562b91272cba519279aa7a96bca95a728ed8e7 | 3,085 | c | C | src/components/tl/ucp/tl_ucp.c | karasevb/ucc | ad58aec00ab9300b3e2bf450896c665a12448930 | [
"BSD-3-Clause"
] | null | null | null | src/components/tl/ucp/tl_ucp.c | karasevb/ucc | ad58aec00ab9300b3e2bf450896c665a12448930 | [
"BSD-3-Clause"
] | null | null | null | src/components/tl/ucp/tl_ucp.c | karasevb/ucc | ad58aec00ab9300b3e2bf450896c665a12448930 | [
"BSD-3-Clause"
] | null | null | null | /**
* Copyright (C) Mellanox Technologies Ltd. 2020. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
#include "tl_ucp.h"
#include "utils/ucc_malloc.h"
#include "components/mc/base/ucc_mc_base.h"
ucc_status_t ucc_tl_ucp_get_lib_attr(const ucc_base_lib_t *lib, ucc_base_attr_t *base_attr);
ucc_status_t ucc_tl_ucp_get_context_attr(const ucc_base_context_t *context, ucc_base_attr_t *base_attr);
static ucc_config_field_t ucc_tl_ucp_lib_config_table[] = {
{"", "", NULL, ucc_offsetof(ucc_tl_ucp_lib_config_t, super),
UCC_CONFIG_TYPE_TABLE(ucc_tl_lib_config_table)},
{NULL}
};
static ucs_config_field_t ucc_tl_ucp_context_config_table[] = {
{"", "", NULL, ucc_offsetof(ucc_tl_ucp_context_config_t, super),
UCC_CONFIG_TYPE_TABLE(ucc_tl_context_config_table)},
{"PRECONNECT", "1024",
"Threshold that defines the number of ranks in the UCC team/context "
"below which the team/context enpoints will be preconnected during "
"corresponding team/context create call",
ucc_offsetof(ucc_tl_ucp_context_config_t, preconnect),
UCC_CONFIG_TYPE_UINT},
{"NPOLLS", "10",
"Number of ucp progress polling cycles for p2p requests testing",
ucc_offsetof(ucc_tl_ucp_context_config_t, n_polls),
UCC_CONFIG_TYPE_UINT},
{"BARRIER_KN_RADIX", "4",
"Radix of the recursive-knomial barrier algorithm",
ucc_offsetof(ucc_tl_ucp_context_config_t, kn_barrier_radix),
UCC_CONFIG_TYPE_UINT},
{"OOB_NPOLLS", "20",
"Number of polling cycles for oob allgather request",
ucc_offsetof(ucc_tl_ucp_context_config_t, oob_npolls),
UCC_CONFIG_TYPE_UINT},
{NULL}};
UCC_CLASS_DEFINE_NEW_FUNC(ucc_tl_ucp_lib_t, ucc_base_lib_t,
const ucc_base_lib_params_t *,
const ucc_base_config_t *);
UCC_CLASS_DEFINE_DELETE_FUNC(ucc_tl_ucp_lib_t, ucc_base_lib_t);
UCC_CLASS_DEFINE_NEW_FUNC(ucc_tl_ucp_context_t, ucc_base_context_t,
const ucc_base_context_params_t *,
const ucc_base_config_t *);
UCC_CLASS_DEFINE_DELETE_FUNC(ucc_tl_ucp_context_t, ucc_base_context_t);
UCC_CLASS_DEFINE_NEW_FUNC(ucc_tl_ucp_team_t, ucc_base_team_t,
ucc_base_context_t *, const ucc_base_team_params_t *);
ucc_status_t ucc_tl_ucp_team_create_test(ucc_base_team_t *tl_team);
ucc_status_t ucc_tl_ucp_team_destroy(ucc_base_team_t *tl_team);
ucc_status_t ucc_tl_ucp_coll_init(ucc_base_coll_op_args_t *coll_args,
ucc_base_team_t *team,
ucc_coll_task_t **task);
UCC_TL_IFACE_DECLARE(ucp, UCP);
ucs_memory_type_t ucc_memtype_to_ucs[UCC_MEMORY_TYPE_LAST+1] = {
[UCC_MEMORY_TYPE_HOST] = UCS_MEMORY_TYPE_HOST,
[UCC_MEMORY_TYPE_CUDA] = UCS_MEMORY_TYPE_CUDA,
[UCC_MEMORY_TYPE_CUDA_MANAGED] = UCS_MEMORY_TYPE_CUDA_MANAGED,
[UCC_MEMORY_TYPE_ROCM] = UCS_MEMORY_TYPE_ROCM,
[UCC_MEMORY_TYPE_ROCM_MANAGED] = UCS_MEMORY_TYPE_ROCM_MANAGED,
[UCC_MEMORY_TYPE_UNKNOWN] = UCS_MEMORY_TYPE_UNKNOWN
};
| 38.5625 | 104 | 0.731605 |
1300ae3d1d9051a266918f8bd8fe6d57fda6feda | 2,028 | sql | SQL | book_shop/begin.sql | StanislavRyzhkov/book_shop | 664850f6fb814093839a2b39ee8146814713f16c | [
"Apache-2.0"
] | null | null | null | book_shop/begin.sql | StanislavRyzhkov/book_shop | 664850f6fb814093839a2b39ee8146814713f16c | [
"Apache-2.0"
] | null | null | null | book_shop/begin.sql | StanislavRyzhkov/book_shop | 664850f6fb814093839a2b39ee8146814713f16c | [
"Apache-2.0"
] | 1 | 2020-05-07T22:11:09.000Z | 2020-05-07T22:11:09.000Z |
create table if not exists app_origin(
id bigserial not null constraint app_origin_pkey primary key,
name varchar(255) not null
);
alter table app_origin owner to clyde;
create table if not exists app_style(
id bigserial not null constraint app_style_pkey primary key,
name varchar(255) not null
);
alter table app_style owner to clyde;
create table if not exists app_genre(
id bigserial not null constraint app_genre_pkey primary key,
name varchar(255) not null
);
alter table app_genre owner to clyde;
create table if not exists app_book
(
id bigserial not null constraint app_book_pkey primary key,
title varchar(255) not null,
author varchar(255) not null,
price int not null,
vendor_code varchar(255) not null constraint uk_app_book_vendor_code unique,
origin_id bigint not null constraint fk_book_app_origin references app_origin,
style_id bigint not null constraint fk_book_app_style references app_style,
genre_id bigint not null constraint fk_book_app_genre references app_genre
);
alter table app_book owner to clyde;
create table if not exists app_user(
id bigserial not null constraint app_user_pkey primary key,
user_uuid varchar(255) not null,
username varchar(255),
email varchar(255),
passwordHash varchar(255),
role varchar(255),
address varchar(255),
phone_number varchar(255)
);
alter table app_user owner to clyde;
create table if not exists app_order_item(
amount int not null,
status varchar(32) not null,
book_id bigint not null constraint fk_order_app_book references app_book,
user_id bigint not null constraint fk_order_app_user references app_user,
constraint app_order_pkey primary key(book_id, user_id)
);
alter table app_order_item owner to clyde;
create table if not exists app_key_element(
id bigserial not null constraint app_key_element_pkey primary key,
element smallint not null,
element_index smallint not null
);
alter table app_key_element owner to clyde;
| 30.727273 | 82 | 0.771696 |
c8b9217093c1b09be4c330c580b070e181133bf4 | 64 | sql | SQL | db/schema.sql | Kooki-eByte/Forage | 2b94b07e0255189f17fe7d9c554f0bef1f305557 | [
"MIT"
] | 1 | 2020-09-24T02:17:06.000Z | 2020-09-24T02:17:06.000Z | db/schema.sql | ddsteig/Forage | a8bef8b11cd2ce7b003fe40ad7008d03bbb60ef3 | [
"MIT"
] | 22 | 2020-09-24T23:32:13.000Z | 2020-10-08T00:58:18.000Z | db/schema.sql | Kooki-eByte/Fantastic-Three | 2b94b07e0255189f17fe7d9c554f0bef1f305557 | [
"MIT"
] | 2 | 2020-10-01T22:53:09.000Z | 2020-10-02T00:58:26.000Z | DROP DATABASE IF EXISTS meal_plan;
CREATE DATABASE meal_plan;
| 12.8 | 34 | 0.8125 |
598103ac8c87b134aa26de8e292ea46a5d304438 | 991 | swift | Swift | kdRemedio/Controllers/MedicineSelection/UBSMedicineSelectionTableViewController.swift | HelioMesquita/medicine | 866aca3f9ac3ea59de9e8625db67041c6283dc7a | [
"MIT"
] | null | null | null | kdRemedio/Controllers/MedicineSelection/UBSMedicineSelectionTableViewController.swift | HelioMesquita/medicine | 866aca3f9ac3ea59de9e8625db67041c6283dc7a | [
"MIT"
] | null | null | null | kdRemedio/Controllers/MedicineSelection/UBSMedicineSelectionTableViewController.swift | HelioMesquita/medicine | 866aca3f9ac3ea59de9e8625db67041c6283dc7a | [
"MIT"
] | null | null | null | import UIKit
class UBSMedicineSelectionTableViewController: UITableViewController {
var list: [UbsMedicine] = []
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return list.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! UBSSelectionCell
cell.accessoryType = .disclosureIndicator
cell.setCell(ubsMedicine: list[indexPath.row])
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
guard let viewController = R.storyboard.main.reservation() else { return }
viewController.ubsMedicine = list[indexPath.row]
viewController.navigationItem.title = "Selecione"
navigationController?.pushViewController(viewController, animated: true)
}
}
| 38.115385 | 107 | 0.767911 |
c8aff6c3dcf8e2830f13d44265d60fad91017ab4 | 9,039 | asm | Assembly | Cameras/GRID (2019)/InjectableGenericCameraSystem/Interceptor.asm | ghostinthecamera/IGCS-GITC | d46db76d1b49384bb81e01765b9a0056f593da9c | [
"BSD-2-Clause"
] | 42 | 2019-04-21T22:05:43.000Z | 2022-03-29T18:18:31.000Z | Cameras/GRID (2019)/InjectableGenericCameraSystem/Interceptor.asm | ghostinthecamera/IGCS-GITC | d46db76d1b49384bb81e01765b9a0056f593da9c | [
"BSD-2-Clause"
] | 13 | 2019-07-26T18:21:26.000Z | 2021-06-28T21:27:39.000Z | Cameras/GRID (2019)/InjectableGenericCameraSystem/Interceptor.asm | ghostinthecamera/IGCS-GITC | d46db76d1b49384bb81e01765b9a0056f593da9c | [
"BSD-2-Clause"
] | 8 | 2019-08-08T17:06:16.000Z | 2022-03-29T18:20:06.000Z | ;////////////////////////////////////////////////////////////////////////////////////////////////////////
;// Part of Injectable Generic Camera System
;// Copyright(c) 2020, Frans Bouma
;// All rights reserved.
;// https://github.com/FransBouma/InjectableGenericCameraSystem
;//
;// Redistribution and use in source and binary forms, with or without
;// modification, are permitted provided that the following conditions are met :
;//
;// * Redistributions of source code must retain the above copyright notice, this
;// list of conditions and the following disclaimer.
;//
;// * Redistributions in binary form must reproduce the above copyright notice,
;// this list of conditions and the following disclaimer in the documentation
;// and / or other materials provided with the distribution.
;//
;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;// DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
;// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;// DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;// OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;////////////////////////////////////////////////////////////////////////////////////////////////////////
;---------------------------------------------------------------
; Game specific asm file to intercept execution flow to obtain addresses, prevent writes etc.
;---------------------------------------------------------------
;---------------------------------------------------------------
; Public definitions so the linker knows which names are present in this file
PUBLIC cameraStructInterceptor
PUBLIC timestopReadInterceptor
PUBLIC fovReadInterceptor
PUBLIC lodSettingInterceptor
;---------------------------------------------------------------
;---------------------------------------------------------------
; Externs which are used and set by the system. Read / write these
; values in asm to communicate with the system
EXTERN g_cameraEnabled: byte
EXTERN g_cameraStructAddress: qword
EXTERN g_timestopStructAddress: qword
EXTERN _timestopAbsolute: qword
;---------------------------------------------------------------
;---------------------------------------------------------------
; Own externs, defined in InterceptorHelper.cpp
EXTERN _cameraStructInterceptionContinue: qword
EXTERN _timestopReadInterceptionContinue: qword
EXTERN _fovReadInterceptionContinue: qword
EXTERN _lodSettingInterceptionContinue: qword
.data
.code
cameraStructInterceptor PROC
;for IGCS Camera: 41 0F 11 86 ?? ?? ?? ?? 41 0F 11 8E ?? ?? ?? ?? E8 ?? ?? ?? ?? 0F B6 84 24
;Grid_dx12.exe+A2C7C5 - 48 8D 4C 24 40 - lea rcx,[rsp+40]
;Grid_dx12.exe+A2C7CA - E8 D1E5FDFF - call Grid_dx12.exe+A0ADA0
;Grid_dx12.exe+A2C7CF - 0F28 84 24 20010000 - movaps xmm0,[rsp+00000120]
;Grid_dx12.exe+A2C7D7 - 49 8D 8E 60010000 - lea rcx,[r14+00000160]
;Grid_dx12.exe+A2C7DE - 0F28 8C 24 30010000 - movaps xmm1,[rsp+00000130]
;Grid_dx12.exe+A2C7E6 - 48 8D 94 24 40010000 - lea rdx,[rsp+00000140]
;Grid_dx12.exe+A2C7EE - 41 0F11 86 40010000 - movups [r14+00000140],xmm0 <<coords/inject here
;Grid_dx12.exe+A2C7F6 - 41 0F11 8E 50010000 - movups [r14+00000150],xmm1 <<quaternion
;Grid_dx12.exe+A2C7FE - E8 4DCCE2FF - call Grid_dx12.exe+859450 <<<return here
;Grid_dx12.exe+A2C803 - 0FB6 84 24 B0010000 - movzx eax,byte ptr [rsp+000001B0]
;Grid_dx12.exe+A2C80B - 41 88 86 D0010000 - mov [r14+000001D0],al
;Grid_dx12.exe+A2C812 - 0FB6 84 24 B1010000 - movzx eax,byte ptr [rsp+000001B1]
;Grid_dx12.exe+A2C81A - 41 88 86 D1010000 - mov [r14+000001D1],al
;Grid_dx12.exe+A2C821 - 0FB6 84 24 B2010000 - movzx eax,byte ptr [rsp+000001B2]
;Grid_dx12.exe+A2C829 - 41 88 86 D2010000 - mov [r14+000001D2],al
mov [g_cameraStructAddress], r14
cmp byte ptr [g_cameraEnabled],1
je exit
movups [r14+00000140h],xmm0
movups [r14+00000150h],xmm1
exit:
jmp qword ptr [_cameraStructInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above.
cameraStructInterceptor ENDP
timestopReadInterceptor PROC
;Grid_dx12.exe+1EF132 - 74 0D - je Grid_dx12.exe+1EF141
;Grid_dx12.exe+1EF134 - 0F57 C9 - xorps xmm1,xmm1
;Grid_dx12.exe+1EF137 - E8 44249500 - call Grid_dx12.exe+B41580
;Grid_dx12.exe+1EF13C - E9 C9010000 - jmp Grid_dx12.exe+1EF30A
;Grid_dx12.exe+1EF141 - F3 0F10 4B 54 - movss xmm1,[rbx+54] <<< inject here
;Grid_dx12.exe+1EF146 - 48 8B 4B 58 - mov rcx,[rbx+58]
;Grid_dx12.exe+1EF14A - E8 31249500 - call Grid_dx12.exe+B41580
;Grid_dx12.exe+1EF14F - E9 B6010000 - jmp Grid_dx12.exe+1EF30A <<<return here
;Grid_dx12.exe+1EF154 - F3 0F10 43 18 - movss xmm0,[rbx+18]
;Grid_dx12.exe+1EF159 - 0F2E C6 - ucomiss xmm0,xmm6
mov [g_timestopStructAddress], rbx
movss xmm1, dword ptr [rbx+54h]
mov rcx,[rbx+58h]
call [_timestopAbsolute]
exit:
jmp qword ptr [_timestopReadInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above.
timestopReadInterceptor ENDP
fovReadInterceptor PROC
;Grid_dx12.exe+859472 - 89 41 28 - mov [rcx+28],eax
;Grid_dx12.exe+859475 - 8B 42 2C - mov eax,[rdx+2C]
;Grid_dx12.exe+859478 - 89 41 2C - mov [rcx+2C],eax
;Grid_dx12.exe+85947B - 8B 42 30 - mov eax,[rdx+30]
;Grid_dx12.exe+85947E - 89 41 30 - mov [rcx+30],eax <<<<inject here
;Grid_dx12.exe+859481 - 8B 42 34 - mov eax,[rdx+34]
;Grid_dx12.exe+859484 - 89 41 34 - mov [rcx+34],eax <<hfov write
;Grid_dx12.exe+859487 - 8B 42 38 - mov eax,[rdx+38]
;Grid_dx12.exe+85948A - 89 41 38 - mov [rcx+38],eax <<vfov write
;Grid_dx12.exe+85948D - 8B 42 3C - mov eax,[rdx+3C] <<< return here
;Grid_dx12.exe+859490 - 89 41 3C - mov [rcx+3C],eax
;Grid_dx12.exe+859493 - 8B 42 40 - mov eax,[rdx+40]
;Grid_dx12.exe+859496 - 89 41 40 - mov [rcx+40],eax
;Grid_dx12.exe+859499 - 8B 42 44 - mov eax,[rdx+44]
;Grid_dx12.exe+85949C - 89 41 44 - mov [rcx+44],eax
;Grid_dx12.exe+85949F - 8B 42 48 - mov eax,[rdx+48]
;Grid_dx12.exe+8594A2 - 89 41 48 - mov [rcx+48],eax
cmp byte ptr [g_cameraEnabled],0
je exit
push rbx
lea rbx,[rcx-160h]
cmp rbx, [g_cameraStructAddress]
pop rbx
jne exit
mov dword ptr [rcx+30h],eax
mov eax, dword ptr [rdx+34h]
;mov dword ptr [rcx+34h],eax
mov eax,dword ptr [rdx+38h]
;mov dword ptr [rcx+38h],eax
jmp exitreturn
exit:
mov dword ptr [rcx+30h],eax
mov eax, dword ptr [rdx+34h]
mov dword ptr [rcx+34h],eax
mov eax,dword ptr [rdx+38h]
mov dword ptr [rcx+38h],eax
exitreturn:
jmp qword ptr [_fovReadInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above.
fovReadInterceptor ENDP
lodSettingInterceptor PROC
;Grid_dx12.exe+A70D03 - 42 80 7C 00 18 00 - cmp byte ptr [rax+r8+18],00 { 0 }
;Grid_dx12.exe+A70D09 - 0F84 E4000000 - je Grid_dx12.exe+A70DF3
;Grid_dx12.exe+A70D0F - F3 41 0F10 86 48090000 - movss xmm0,[r14+00000948]
;Grid_dx12.exe+A70D18 - B0 01 - mov al,01 { 1 }
;Grid_dx12.exe+A70D1A - F3 41 0F11 86 4C090000 - movss [r14+0000094C],xmm0
;Grid_dx12.exe+A70D23 - 41 88 86 A00A0000 - mov [r14+00000AA0],al << inject here
;Grid_dx12.exe+A70D2A - 41 89 96 9C0A0000 - mov [r14+00000A9C],edx <<< change to mov 0x0
;Grid_dx12.exe+A70D31 - 84 C0 - test al,al <<< return here
;Grid_dx12.exe+A70D33 - 0F84 B5010000 - je Grid_dx12.exe+A70EEE
;Grid_dx12.exe+A70D39 - 49 8B 46 40 - mov rax,[r14+40]
;Grid_dx12.exe+A70D3D - 4C 8B A0 88000000 - mov r12,[rax+00000088]
;Grid_dx12.exe+A70D44 - 4D 85 E4 - test r12,r12
;Grid_dx12.exe+A70D47 - 0F84 99010000 - je Grid_dx12.exe+A70EE6
;Grid_dx12.exe+A70D4D - 48 8B 81 58010000 - mov rax,[rcx+00000158]
;Grid_dx12.exe+A70D54 - 45 33 FF - xor r15d,r15d
;Grid_dx12.exe+A70D57 - 48 2B 81 50010000 - sub rax,[rcx+00000150]
cmp byte ptr [g_cameraEnabled],1
je writelod
mov byte ptr [r14+00000AA0h],al
mov dword ptr [r14+00000A9Ch],edx
jmp exit
writelod:
mov byte ptr [r14+00000AA0h],al
mov dword ptr [r14+00000A9Ch],00000000
exit:
jmp qword ptr [_lodSettingInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above.
lodSettingInterceptor ENDP
END | 51.357955 | 149 | 0.650293 |
9f303cbbc1a1cc6e64724bc10ad6cf891d4859ca | 106 | dart | Dart | test/dynamic_animation_test.dart | MrHeer/dynamic_animation | 8a48b08297c26a41bdb4ef14f573a52dfc5f9216 | [
"BSD-3-Clause"
] | null | null | null | test/dynamic_animation_test.dart | MrHeer/dynamic_animation | 8a48b08297c26a41bdb4ef14f573a52dfc5f9216 | [
"BSD-3-Clause"
] | null | null | null | test/dynamic_animation_test.dart | MrHeer/dynamic_animation | 8a48b08297c26a41bdb4ef14f573a52dfc5f9216 | [
"BSD-3-Clause"
] | null | null | null | import 'package:flutter_test/flutter_test.dart';
void main() {
test('test dynamicAnimateTo', () {});
}
| 17.666667 | 48 | 0.688679 |
cd0312a48456ba5b971038b08dc69739ba91d39e | 2,098 | dart | Dart | test/build_agent_test.dart | sowderca/azure_devops_sdk | 1ef1b3b5f72dca3d5075d211f97196caa99494ad | [
"MIT"
] | 2 | 2019-10-07T12:30:29.000Z | 2021-03-19T11:49:53.000Z | test/build_agent_test.dart | sowderca/azure_devops_sdk | 1ef1b3b5f72dca3d5075d211f97196caa99494ad | [
"MIT"
] | null | null | null | test/build_agent_test.dart | sowderca/azure_devops_sdk | 1ef1b3b5f72dca3d5075d211f97196caa99494ad | [
"MIT"
] | null | null | null | import 'package:azure_devops_sdk/api.dart';
import 'package:test/test.dart';
// tests for BuildAgent
void main() {
var instance = BuildAgent();
group('test BuildAgent', () {
// String buildDirectory (default value: null)
test('to test the property `buildDirectory`', () async {
// TODO
});
// XamlBuildControllerReference controller (default value: null)
test('to test the property `controller`', () async {
// TODO
});
// DateTime createdDate (default value: null)
test('to test the property `createdDate`', () async {
// TODO
});
// String description (default value: null)
test('to test the property `description`', () async {
// TODO
});
// bool enabled (default value: null)
test('to test the property `enabled`', () async {
// TODO
});
// int id (default value: null)
test('to test the property `id`', () async {
// TODO
});
// String messageQueueUrl (default value: null)
test('to test the property `messageQueueUrl`', () async {
// TODO
});
// String name (default value: null)
test('to test the property `name`', () async {
// TODO
});
// String reservedForBuild (default value: null)
test('to test the property `reservedForBuild`', () async {
// TODO
});
// XamlBuildServerReference server (default value: null)
test('to test the property `server`', () async {
// TODO
});
// String status (default value: null)
test('to test the property `status`', () async {
// TODO
});
// String statusMessage (default value: null)
test('to test the property `statusMessage`', () async {
// TODO
});
// DateTime updatedDate (default value: null)
test('to test the property `updatedDate`', () async {
// TODO
});
// String uri (default value: null)
test('to test the property `uri`', () async {
// TODO
});
// String url (default value: null)
test('to test the property `url`', () async {
// TODO
});
});
}
| 23.840909 | 68 | 0.57674 |
256cc6a4a30802a7115f609aefe58ff020fe04ba | 5,607 | html | HTML | coverage/lcov-report/index.html | XUMUMI/vue-carousel-3d | 09f3519b9f9b311a067f3a3d03f901fe2a6235da | [
"MIT"
] | 926 | 2017-02-18T01:29:40.000Z | 2022-03-08T15:15:52.000Z | coverage/lcov-report/index.html | XUMUMI/vue-carousel-3d | 09f3519b9f9b311a067f3a3d03f901fe2a6235da | [
"MIT"
] | 166 | 2017-02-21T18:25:32.000Z | 2022-03-31T03:32:48.000Z | coverage/lcov-report/index.html | XUMUMI/vue-carousel-3d | 09f3519b9f9b311a067f3a3d03f901fe2a6235da | [
"MIT"
] | 233 | 2017-02-18T06:30:16.000Z | 2022-03-29T11:56:10.000Z |
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>All files</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">69.27% </span>
<span class="quiet">Statements</span>
<span class='fraction'>142/205</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">51.66% </span>
<span class="quiet">Branches</span>
<span class='fraction'>78/151</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">78.46% </span>
<span class="quiet">Functions</span>
<span class='fraction'>51/65</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">68.66% </span>
<span class="quiet">Lines</span>
<span class='fraction'>138/201</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
</div>
<div class='status-line medium'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file medium" data-value="src/carousel-3d"><a href="src/carousel-3d/index.html">src/carousel-3d</a></td>
<td data-value="66.47" class="pic medium">
<div class="chart"><div class="cover-fill" style="width: 66%"></div><div class="cover-empty" style="width: 34%"></div></div>
</td>
<td data-value="66.47" class="pct medium">66.47%</td>
<td data-value="173" class="abs medium">115/173</td>
<td data-value="51.11" class="pct medium">51.11%</td>
<td data-value="135" class="abs medium">69/135</td>
<td data-value="75" class="pct medium">75%</td>
<td data-value="48" class="abs medium">36/48</td>
<td data-value="66.08" class="pct medium">66.08%</td>
<td data-value="171" class="abs medium">113/171</td>
</tr>
<tr>
<td class="file high" data-value="src/carousel-3d/mixins"><a href="src/carousel-3d/mixins/index.html">src/carousel-3d/mixins</a></td>
<td data-value="80" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 80%"></div><div class="cover-empty" style="width: 20%"></div></div>
</td>
<td data-value="80" class="pct high">80%</td>
<td data-value="15" class="abs high">12/15</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="12" class="abs medium">6/12</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="6" class="abs high">5/6</td>
<td data-value="80" class="pct high">80%</td>
<td data-value="15" class="abs high">12/15</td>
</tr>
<tr>
<td class="file high" data-value="tests/unit"><a href="tests/unit/index.html">tests/unit</a></td>
<td data-value="88.24" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 88%"></div><div class="cover-empty" style="width: 12%"></div></div>
</td>
<td data-value="88.24" class="pct high">88.24%</td>
<td data-value="17" class="abs high">15/17</td>
<td data-value="75" class="pct medium">75%</td>
<td data-value="4" class="abs medium">3/4</td>
<td data-value="90.91" class="pct high">90.91%</td>
<td data-value="11" class="abs high">10/11</td>
<td data-value="86.67" class="pct high">86.67%</td>
<td data-value="15" class="abs high">13/15</td>
</tr>
</tbody>
</table>
</div>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
at Mon Sep 28 2020 03:52:52 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>
| 40.05 | 138 | 0.57339 |
51c3d4df09a052ecaa9914c801451178a4001a21 | 1,248 | ps1 | PowerShell | chocolatey-visualstudio.extension/extensions/Get-VisualStudioInstallerHealth.ps1 | isanych/ChocolateyPackages | 0e0e7abe8214eb2be8c666ceb725be3f9a72cc3f | [
"MIT"
] | null | null | null | chocolatey-visualstudio.extension/extensions/Get-VisualStudioInstallerHealth.ps1 | isanych/ChocolateyPackages | 0e0e7abe8214eb2be8c666ceb725be3f9a72cc3f | [
"MIT"
] | null | null | null | chocolatey-visualstudio.extension/extensions/Get-VisualStudioInstallerHealth.ps1 | isanych/ChocolateyPackages | 0e0e7abe8214eb2be8c666ceb725be3f9a72cc3f | [
"MIT"
] | null | null | null | function Get-VisualStudioInstallerHealth
{
<#
.SYNOPSIS
Checks the Visual Studio Installer for signs of corruption.
.DESCRIPTION
This function returns an object containing the health status
of the Visual Studio Installer, checking for the existence
of a few files observed missing after a failed Installer update.
.OUTPUTS
A System.Management.Automation.PSObject with the following properties:
Path (System.String)
IsHealthy (System.Boolean)
MissingFiles (System.String[])
#>
[CmdletBinding()]
Param
(
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] [string] $Path
)
Process
{
if ($Path -like '*.exe')
{
$dirPath = Split-Path -Path $Path
}
else
{
$dirPath = $Path
}
$expectedFiles = @('vs_installer.exe', 'vs_installershell.exe', 'node.dll', 'ffmpeg.dll')
$missingFiles = $expectedFiles | Where-Object { -not (Test-Path (Join-Path -Path $dirPath -ChildPath $_))}
$obj = New-Object -TypeName PSObject -Property @{
Path = $Path
IsHealthy = ($missingFiles | Measure-Object).Count -eq 0
MissingFiles = $missingFiles
}
Write-Output $obj
}
}
| 27.733333 | 114 | 0.640224 |
90357cc8608f8e38a7e233cd1ce01b12b08ba728 | 207 | sql | SQL | 54_restaurantInfo/solution.sql | code-signal/code-signal-arcade-databases | f85efe2ede2dd2721216c89e0c9e765a7f5ca000 | [
"MIT"
] | 3 | 2021-03-13T16:16:52.000Z | 2021-11-25T01:04:01.000Z | 54_restaurantInfo/solution.sql | code-signal/code-signal-arcade-databases | f85efe2ede2dd2721216c89e0c9e765a7f5ca000 | [
"MIT"
] | null | null | null | 54_restaurantInfo/solution.sql | code-signal/code-signal-arcade-databases | f85efe2ede2dd2721216c89e0c9e765a7f5ca000 | [
"MIT"
] | 6 | 2020-05-13T15:42:39.000Z | 2022-03-14T19:36:50.000Z | CREATE PROCEDURE restaurantInfo()
BEGIN
ALTER TABLE restaurants
ADD COLUMN description VARCHAR(100) DEFAULT 'TBD',
ADD COLUMN active INT DEFAULT 1;
SELECT * FROM restaurants ORDER BY id;
END | 25.875 | 54 | 0.743961 |
9c1fdbee4be5e2e62edc3ed4cf20ae1ef2088102 | 1,086 | cpp | C++ | Escape/src/AssetManager.cpp | iampixelized/Tetris | e6acb3a2e7126a7cb775b7ec4edbd875510d5564 | [
"BSD-2-Clause"
] | 1 | 2019-07-29T05:32:51.000Z | 2019-07-29T05:32:51.000Z | Escape/src/AssetManager.cpp | iampixelized/Tetris | e6acb3a2e7126a7cb775b7ec4edbd875510d5564 | [
"BSD-2-Clause"
] | null | null | null | Escape/src/AssetManager.cpp | iampixelized/Tetris | e6acb3a2e7126a7cb775b7ec4edbd875510d5564 | [
"BSD-2-Clause"
] | 1 | 2020-01-07T04:51:54.000Z | 2020-01-07T04:51:54.000Z | #include "AssetManager.hpp"
namespace esc
{
void AssetManager::addAsset(const string &aname, IAsset*a)
{
a_container.insert(pair<string, IAssetType>(aname, IAssetType(a)));
}
bool AssetManager::removeAsset(const string &aname)
{
if (!isAsset(aname))
return false;
a_container.erase(aname);
return true;
}
IAsset * AssetManager::getAsset(const string &aname)
{
return (!isAsset(aname)) ? nullptr : a_container[aname].get();
}
bool AssetManager::addResourceToAsset(const string &aname, const string &oname, const string & path)
{
if (!isAsset(aname))
return false;
return a_container[aname].get()->loadFromFile(oname, path);
}
bool AssetManager::removeResourceToAsset(const string & aname, const string & oname)
{
if (!isAsset(aname))
return false;
return a_container[aname].get()->deleteFromAssetLibrary(oname);
}
void AssetManager::clear()
{
a_container.clear();
}
bool AssetManager::isAsset(const string & aname)
{
auto iter = a_container.find(aname);
if (iter == a_container.end())
return false;
return true;
}
} | 20.111111 | 101 | 0.701657 |
352eb21c0d04def4fa7409a73457c8f129f227f0 | 65 | swift | Swift | example/ios/File.swift | williamhaley/react-native-images-to-video | 10e25827923cbda46397a6d5265c81a3d062d3d1 | [
"MIT"
] | 2 | 2021-02-09T03:54:44.000Z | 2021-06-26T08:01:48.000Z | example/ios/File.swift | williamhaley/react-native-images-to-video | 10e25827923cbda46397a6d5265c81a3d062d3d1 | [
"MIT"
] | null | null | null | example/ios/File.swift | williamhaley/react-native-images-to-video | 10e25827923cbda46397a6d5265c81a3d062d3d1 | [
"MIT"
] | 2 | 2021-02-09T03:42:51.000Z | 2021-03-02T12:12:50.000Z | //
// File.swift
// ImagesToVideoExample
//
import Foundation
| 9.285714 | 24 | 0.692308 |
8a36fc43886ec924f27507fd9b2f0195a2a01be4 | 75 | sql | SQL | coral-trino/src/test/resources/product_test_cases_expected/runAggregatesWithGroupByOrdinal_expected.sql | NobiGo/coral | a662f800b761de50a67cb7d98c2c25bb5b78014a | [
"BSD-2-Clause"
] | 387 | 2020-03-19T19:37:55.000Z | 2022-03-31T00:14:48.000Z | coral-trino/src/test/resources/product_test_cases_expected/runAggregatesWithGroupByOrdinal_expected.sql | NobiGo/coral | a662f800b761de50a67cb7d98c2c25bb5b78014a | [
"BSD-2-Clause"
] | 127 | 2020-06-30T01:14:11.000Z | 2022-03-25T21:20:18.000Z | coral-trino/src/test/resources/product_test_cases_expected/runAggregatesWithGroupByOrdinal_expected.sql | NobiGo/coral | a662f800b761de50a67cb7d98c2c25bb5b78014a | [
"BSD-2-Clause"
] | 104 | 2020-03-19T19:28:45.000Z | 2022-03-28T02:40:21.000Z | select `n_regionkey`, count(*), sum(`n_nationkey`)
from `nation`
group by 1 | 25 | 50 | 0.72 |
c0df8458a65840e974b17d366f0d8fc405c3f4a5 | 2,457 | swift | Swift | ExponeaSDK/ExponeaSDKTests/Specs/Models/ConfigurationSpec.swift | Negenii/exponea-ios-sdk | 65c7e33cebf44382ebc453a06c2b68b01c038fef | [
"MIT"
] | null | null | null | ExponeaSDK/ExponeaSDKTests/Specs/Models/ConfigurationSpec.swift | Negenii/exponea-ios-sdk | 65c7e33cebf44382ebc453a06c2b68b01c038fef | [
"MIT"
] | null | null | null | ExponeaSDK/ExponeaSDKTests/Specs/Models/ConfigurationSpec.swift | Negenii/exponea-ios-sdk | 65c7e33cebf44382ebc453a06c2b68b01c038fef | [
"MIT"
] | 1 | 2018-08-21T08:51:35.000Z | 2018-08-21T08:51:35.000Z | //
// ConfigurationSpec.swift
// ExponeaSDKTests
//
// Created by Dominik Hádl on 18/04/2018.
// Copyright © 2018 Exponea. All rights reserved.
//
import Foundation
import Quick
import Nimble
@testable import ExponeaSDK
class ConfigurationSpec: QuickSpec {
override func spec() {
describe("A Configuration") {
context("that is parsed from valid plist", {
it("should get created correctly with project token", closure: {
do {
let bundle = Bundle(for: ConfigurationSpec.self)
let filePath = bundle.path(forResource: "config_valid", ofType: "plist")
let fileUrl = URL(fileURLWithPath: filePath ?? "")
let data = try Data(contentsOf: fileUrl)
let config = try PropertyListDecoder().decode(Configuration.self, from: data)
expect(config.projectToken).to(equal("testToken"))
expect(config.projectMapping).to(beNil())
} catch {
XCTFail("Failed to load test data - \(error)")
}
})
it("should get created correctly with project mapping", closure: {
do {
let bundle = Bundle(for: ConfigurationSpec.self)
let filePath = bundle.path(forResource: "config_valid2", ofType: "plist")
let fileUrl = URL(fileURLWithPath: filePath ?? "")
let data = try Data(contentsOf: fileUrl)
let config = try PropertyListDecoder().decode(Configuration.self, from: data)
let mapping: [EventType: [String]] = [
.install: ["testToken1"],
.customEvent: ["testToken2", "testToken3"],
.payment: ["paymentToken"]
]
expect(config.projectMapping).to(equal(mapping))
expect(config.projectToken).to(beNil())
} catch {
XCTFail("Failed to load test data - \(error)")
}
})
})
context("that is parsed from an invalid plist", {
it("should fail to get created", closure: {
})
})
}
}
}
| 37.8 | 101 | 0.4884 |
7a524db9ad582b587e859e81a58c083952931f44 | 1,710 | asm | Assembly | programs/oeis/001/A001539.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/001/A001539.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/001/A001539.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A001539: a(n) = (4*n+1)*(4*n+3).
; 3,35,99,195,323,483,675,899,1155,1443,1763,2115,2499,2915,3363,3843,4355,4899,5475,6083,6723,7395,8099,8835,9603,10403,11235,12099,12995,13923,14883,15875,16899,17955,19043,20163,21315,22499,23715,24963,26243,27555,28899,30275,31683,33123,34595,36099,37635,39203,40803,42435,44099,45795,47523,49283,51075,52899,54755,56643,58563,60515,62499,64515,66563,68643,70755,72899,75075,77283,79523,81795,84099,86435,88803,91203,93635,96099,98595,101123,103683,106275,108899,111555,114243,116963,119715,122499,125315,128163,131043,133955,136899,139875,142883,145923,148995,152099,155235,158403,161603,164835,168099,171395,174723,178083,181475,184899,188355,191843,195363,198915,202499,206115,209763,213443,217155,220899,224675,228483,232323,236195,240099,244035,248003,252003,256035,260099,264195,268323,272483,276675,280899,285155,289443,293763,298115,302499,306915,311363,315843,320355,324899,329475,334083,338723,343395,348099,352835,357603,362403,367235,372099,376995,381923,386883,391875,396899,401955,407043,412163,417315,422499,427715,432963,438243,443555,448899,454275,459683,465123,470595,476099,481635,487203,492803,498435,504099,509795,515523,521283,527075,532899,538755,544643,550563,556515,562499,568515,574563,580643,586755,592899,599075,605283,611523,617795,624099,630435,636803,643203,649635,656099,662595,669123,675683,682275,688899,695555,702243,708963,715715,722499,729315,736163,743043,749955,756899,763875,770883,777923,784995,792099,799235,806403,813603,820835,828099,835395,842723,850083,857475,864899,872355,879843,887363,894915,902499,910115,917763,925443,933155,940899,948675,956483,964323,972195,980099,988035,996003
sub $1,$0
bin $1,2
mul $1,32
add $1,3
| 213.75 | 1,635 | 0.830409 |
f533134fb497b25d0fef0afd8fe3027ff036b509 | 834 | cc | C++ | extensions/shell/browser/shell_app_view_guest_delegate.cc | Ron423c/chromium | 2edf7b980065b648f8b2a6e52193d83832fe36b7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 575 | 2015-06-18T23:58:20.000Z | 2022-03-23T09:32:39.000Z | extensions/shell/browser/shell_app_view_guest_delegate.cc | Ron423c/chromium | 2edf7b980065b648f8b2a6e52193d83832fe36b7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | extensions/shell/browser/shell_app_view_guest_delegate.cc | Yannic/chromium | ab32e8aacb08c9fce0dc4bf09eec456ba46e3710 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 52 | 2015-07-14T10:40:50.000Z | 2022-03-15T01:11:49.000Z | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "extensions/shell/browser/shell_app_view_guest_delegate.h"
#include "extensions/shell/browser/shell_app_delegate.h"
namespace extensions {
ShellAppViewGuestDelegate::ShellAppViewGuestDelegate() {
}
ShellAppViewGuestDelegate::~ShellAppViewGuestDelegate() {
}
bool ShellAppViewGuestDelegate::HandleContextMenu(
content::WebContents* web_contents,
const content::ContextMenuParams& params) {
// Eat the context menu request, as AppShell doesn't show context menus.
return true;
}
AppDelegate* ShellAppViewGuestDelegate::CreateAppDelegate(
content::WebContents* web_contents) {
return new ShellAppDelegate();
}
} // namespace extensions
| 27.8 | 74 | 0.785372 |
975b64f4a596d46e75fabdc6a18015cce7585f89 | 3,000 | lua | Lua | src/program/ps/ps.lua | peahonen/snabb | 4b0c18beb86223414fcdbf0dc9e9f5fa5aaa2179 | [
"Apache-2.0"
] | 1,657 | 2016-04-01T09:04:47.000Z | 2022-03-31T18:25:24.000Z | src/program/ps/ps.lua | peahonen/snabb | 4b0c18beb86223414fcdbf0dc9e9f5fa5aaa2179 | [
"Apache-2.0"
] | 700 | 2016-04-19T17:59:51.000Z | 2020-01-13T13:03:35.000Z | src/program/ps/ps.lua | peahonen/snabb | 4b0c18beb86223414fcdbf0dc9e9f5fa5aaa2179 | [
"Apache-2.0"
] | 180 | 2016-04-04T15:04:23.000Z | 2022-02-16T23:15:33.000Z | -- Use of this source code is governed by the Apache 2.0 license; see COPYING.
module(..., package.seeall)
local S = require("syscall")
local app = require("core.app")
local common = require("program.config.common")
local lib = require("core.lib")
local shm = require("core.shm")
local basename, dirname = lib.basename, lib.dirname
local function usage (code)
local f = code == 0 and io.stdout or io.stderr
f:write(require("program.ps.README_inc"))
main.exit(code)
end
local function parse_args (args)
local opt = {}
function opt.h (arg) usage(0) end
args = lib.dogetopt(args, opt, "h", {help='h'})
if #args ~= 0 then usage(1) end
end
function appname_resolver()
local instances = {}
for name, pid in pairs(app.enumerate_named_programs()) do
instances[pid] = name
end
return function (pid) return instances[pid] end
end
function is_worker (pid)
return shm.exists("/"..pid.."/group")
end
local function is_addressable (pid)
local socket = assert(S.socket("unix", "stream"))
local tail = pid.."/config-leader-socket"
local by_name = S.t.sockaddr_un(shm.root..'/by-name/'..tail)
local by_pid = S.t.sockaddr_un(shm.root..'/'..tail)
if socket:connect(by_name) or socket:connect(by_pid) then
socket:close()
return true
end
return false
end
function get_manager_pid (pid)
local fq = shm.root.."/"..pid.."/group"
local path = S.readlink(fq)
return basename(dirname(path))
end
local function compute_snabb_instances()
-- Produces set of snabb instances, excluding this one.
local whichname = appname_resolver()
local pids = {}
local my_pid = S.getpid()
for _, name in ipairs(shm.children("/")) do
-- This could fail as the name could be for example "by-name"
local p = tonumber(name)
local name = whichname(p)
if p and p ~= my_pid then
local instance = {pid=p, name=name}
if is_worker(p) then
instance.leader = get_manager_pid(p)
end
if is_addressable(p) then
instance.addressable = true
local descr = common.call_leader(p, 'describe', {})
instance.schema = descr.native_schema
end
table.insert(pids, instance)
end
end
table.sort(pids, function(a, b)
return tonumber(a.pid) < tonumber(b.pid)
end)
return pids
end
function run (args)
parse_args(args)
local instances = compute_snabb_instances()
for _, instance in ipairs(instances) do
-- Check instance is a worker.
if instance.leader then
io.write(" \\- "..instance.pid.." worker for "..instance.leader)
else
io.write(instance.pid)
if instance.name then
io.write("\t["..instance.name.."]")
end
end
if instance.addressable then
io.write(" *")
end
if instance.schema then
io.write(" [schema: "..instance.schema.."]")
end
io.write("\n")
end
main.exit(0)
end
| 28.037383 | 78 | 0.633333 |
e42df8aa04cf3bb120322ae3f530e8334f4a215c | 1,505 | go | Go | modules/host/mdm/mdm.go | Prometeus-Network/sia-fork | cc1321da6d1d0e8a4b4c4ea34427963c0c3d9377 | [
"MIT"
] | null | null | null | modules/host/mdm/mdm.go | Prometeus-Network/sia-fork | cc1321da6d1d0e8a4b4c4ea34427963c0c3d9377 | [
"MIT"
] | null | null | null | modules/host/mdm/mdm.go | Prometeus-Network/sia-fork | cc1321da6d1d0e8a4b4c4ea34427963c0c3d9377 | [
"MIT"
] | null | null | null | package mdm
import (
"gitlab.com/NebulousLabs/Sia/crypto"
"gitlab.com/NebulousLabs/Sia/types"
"gitlab.com/NebulousLabs/threadgroup"
)
// StorageObligation defines the minimal interface a StorageObligation needs to
// implement to be used by the mdm.
type StorageObligation interface {
Locked() bool
Update(sectorsRemoved, sectorsGained []crypto.Hash, gainedSectorData [][]byte) error
}
// Host defines the minimal interface a Host needs to
// implement to be used by the mdm.
type Host interface {
BlockHeight() types.BlockHeight
ReadSector(sectorRoot crypto.Hash) ([]byte, error)
}
// MDM (Merklized Data Machine) is a virtual machine that executes instructions
// on the data in a Sia file contract. The file contract tracks the size and
// Merkle root of the underlying data, which the MDM will update when running
// instructions that modify the file contract data. Each instruction can
// optionally produce a cryptographic proof that the instruction was executed
// honestly. Every instruction has an execution cost, and instructions are
// batched into atomic sets called 'programs' that are either entirely applied
// or are not applied at all.
type MDM struct {
host Host
tg threadgroup.ThreadGroup
}
// New creates a new MDM.
func New(h Host) *MDM {
return &MDM{
host: h,
}
}
// Stop will stop the MDM and wait for all of the spawned programs to stop
// executing while also preventing new programs from being started.
func (mdm *MDM) Stop() error {
return mdm.tg.Stop()
}
| 31.354167 | 85 | 0.760797 |
28bc6ee3f9257564f5e194e755d476831bfc0fd3 | 5,568 | hpp | C++ | util/matching_debug_info.hpp | aaronbenz/osrm-backend | 758d4023050d1f49971f919cea872a2276dafe14 | [
"BSD-2-Clause"
] | 1 | 2021-03-06T05:07:44.000Z | 2021-03-06T05:07:44.000Z | util/matching_debug_info.hpp | aaronbenz/osrm-backend | 758d4023050d1f49971f919cea872a2276dafe14 | [
"BSD-2-Clause"
] | null | null | null | util/matching_debug_info.hpp | aaronbenz/osrm-backend | 758d4023050d1f49971f919cea872a2276dafe14 | [
"BSD-2-Clause"
] | null | null | null | /*
Copyright (c) 2015, Project OSRM contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MATCHING_DEBUG_INFO_HPP
#define MATCHING_DEBUG_INFO_HPP
#include "json_logger.hpp"
#include "json_util.hpp"
#include "../data_structures/hidden_markov_model.hpp"
#include <osrm/coordinate.hpp>
// Provides the debug interface for introspection tools
struct MatchingDebugInfo
{
MatchingDebugInfo(const osrm::json::Logger *logger) : logger(logger)
{
if (logger)
{
object = &logger->map->at("matching");
}
}
template <class CandidateLists> void initialize(const CandidateLists &candidates_list)
{
// json logger not enabled
if (!logger)
{
return;
}
osrm::json::Array states;
for (auto &elem : candidates_list)
{
osrm::json::Array timestamps;
for (auto &elem_s : elem)
{
osrm::json::Object state;
state.values["transitions"] = osrm::json::Array();
state.values["coordinate"] =
osrm::json::make_array(elem_s.phantom_node.location.lat / COORDINATE_PRECISION,
elem_s.phantom_node.location.lon / COORDINATE_PRECISION);
state.values["viterbi"] =
osrm::json::clamp_float(osrm::matching::IMPOSSIBLE_LOG_PROB);
state.values["pruned"] = 0u;
timestamps.values.push_back(state);
}
states.values.push_back(timestamps);
}
osrm::json::get(*object, "states") = states;
}
void add_transition_info(const unsigned prev_t,
const unsigned current_t,
const unsigned prev_state,
const unsigned current_state,
const double prev_viterbi,
const double emission_pr,
const double transition_pr,
const double network_distance,
const double haversine_distance)
{
// json logger not enabled
if (!logger)
{
return;
}
osrm::json::Object transistion;
transistion.values["to"] = osrm::json::make_array(current_t, current_state);
transistion.values["properties"] = osrm::json::make_array(
osrm::json::clamp_float(prev_viterbi), osrm::json::clamp_float(emission_pr),
osrm::json::clamp_float(transition_pr), network_distance, haversine_distance);
osrm::json::get(*object, "states", prev_t, prev_state, "transitions")
.get<mapbox::util::recursive_wrapper<osrm::json::Array>>()
.get()
.values.push_back(transistion);
}
void set_viterbi(const std::vector<std::vector<double>> &viterbi,
const std::vector<std::vector<bool>> &pruned,
const std::vector<std::vector<bool>> &suspicious)
{
// json logger not enabled
if (!logger)
{
return;
}
for (auto t = 0u; t < viterbi.size(); t++)
{
for (auto s_prime = 0u; s_prime < viterbi[t].size(); ++s_prime)
{
osrm::json::get(*object, "states", t, s_prime, "viterbi") =
osrm::json::clamp_float(viterbi[t][s_prime]);
osrm::json::get(*object, "states", t, s_prime, "pruned") =
static_cast<unsigned>(pruned[t][s_prime]);
osrm::json::get(*object, "states", t, s_prime, "suspicious") =
static_cast<unsigned>(suspicious[t][s_prime]);
}
}
}
void add_chosen(const unsigned t, const unsigned s)
{
// json logger not enabled
if (!logger)
{
return;
}
osrm::json::get(*object, "states", t, s, "chosen") = true;
}
void add_breakage(const std::vector<bool> &breakage)
{
// json logger not enabled
if (!logger)
{
return;
}
osrm::json::get(*object, "breakage") = osrm::json::make_array(breakage);
}
const osrm::json::Logger *logger;
osrm::json::Value *object;
};
#endif // MATCHING_DEBUG_INFO_HPP
| 35.692308 | 100 | 0.601293 |
e710426b926cdf8be015548664bc99b427dadc6e | 2,624 | js | JavaScript | juego-web/js/States/Map.js | DainWs/WebGame | 55ef69f3b6729edb99961e76e6e2f967199f7c00 | [
"CC0-1.0"
] | null | null | null | juego-web/js/States/Map.js | DainWs/WebGame | 55ef69f3b6729edb99961e76e6e2f967199f7c00 | [
"CC0-1.0"
] | null | null | null | juego-web/js/States/Map.js | DainWs/WebGame | 55ef69f3b6729edb99961e76e6e2f967199f7c00 | [
"CC0-1.0"
] | null | null | null | function Map(objectJSON) {
this.position = new Point(0, 0);
this.updatedPosition = new Point(0, 0);
this.widthOnTiles = parseInt(objectJSON.width);
this.heightOnTiles = parseInt(objectJSON.height);
this.widthOfTiles = parseInt(objectJSON.tilewidth);
this.heightOfTiles = parseInt(objectJSON.tileheight);
this.palettes = [];
this.startPalettes(objectJSON.tilesets);
this.layers = [];
this.startLayers(objectJSON.layers);
console.log("starting map.")
this.startGrating();
}
Map.prototype.startPalettes = function(layersData) {
for (var i = 0; i < layersData.length; i++) {
this.palettes.push(new Palette(layersData[i]));
}
}
Map.prototype.startLayers = function(layersData) {
for (var i = 0; i < layersData.length; i++) {
switch(layersData[i].type) {
case "tilelayer":
this.layers.push(new Layers(layersData[i], i - 100, this.widthOfTiles, this.heightOfTiles, this.palettes));
break;
case "objectgroup":
break;
}
}
}
Map.prototype.startGrating = function() {
var mapWidthOnPixels = this.widthOnTiles * this.widthOfTiles;
var mapHeightOnPixels = this.heightOnTiles * this.heightOfTiles;
var html = "";
for (var ct = 0; ct < this.layers.length; ct++) {
for (var t = 0; t < this.layers[ct].tiles.length; t++) {
if(this.layers[ct].tiles[t] == null) {
continue;
}
var currentTile = this.layers[ct].tiles[t];
html += currentTile.html;
}
}
document.getElementById("map").innerHTML = html;
for (var ct = 0; ct < this.layers.length; ct++) {
for (var t = 0; t < this.layers[ct].tiles.length; t++) {
if(this.layers[ct].tiles[t] == null) {
continue;
}
var currentTile = this.layers[ct].tiles[t];
currentTile.applyStyle();
}
}
document.getElementsByTagName("body")[0].style.overflow = "hidden";
}
Map.prototype.update = function(tempLog, playerPositionPx) {
this.position.x = playerPositionPx.x;
this.position.y = playerPositionPx.y;
}
Map.prototype.draw = function() {
for(var c = 0; c < this.layers.length; c++) {
for(var i = 0; i < this.layers[c].tiles.length; i++) {
this.layers[c].tiles[i].move(this.position.x, this.position.y);
}
}
} | 30.511628 | 124 | 0.550305 |
b173ddf934e7cd7802c47197e3bfe9a98a9536ed | 4,772 | h | C | includes/mathematica++/connector.h | DominikLindorfer/mathematicapp | ce9de342501d803ccd115533d19c7e3ace51e475 | [
"BSD-2-Clause-FreeBSD"
] | 8 | 2019-10-04T16:27:33.000Z | 2022-01-30T22:28:51.000Z | includes/mathematica++/connector.h | DominikLindorfer/mathematicapp | ce9de342501d803ccd115533d19c7e3ace51e475 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | includes/mathematica++/connector.h | DominikLindorfer/mathematicapp | ce9de342501d803ccd115533d19c7e3ace51e475 | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2020-02-22T03:33:50.000Z | 2020-09-17T07:10:21.000Z | /*
* Copyright (c) 2018, Sunanda Bose (Neel Basu) (neel.basu.z@gmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#ifndef MATHEMATICAPP_CONNECTOR_H
#define MATHEMATICAPP_CONNECTOR_H
#include <vector>
#include <string>
#include <stack>
#include <complex>
#include <boost/variant.hpp>
#include "tokens.h"
#include "accessor.h"
#include <boost/shared_ptr.hpp>
namespace mathematica{
namespace driver{
namespace io{
struct connection;
}
}
}
namespace mathematica{
struct m;
namespace detail{
struct scope;
}
/**
* mathematica::connector shell(argc, argv);
* mathematica::value result1 = shell.function("N", 1L).function("Sin", 1L).integer(3.14).end().pull().next();
* mathematica::value result2 = shell.function("Round", 1L).function("N", 1L).function("Exp", 1L).integer(2).end().pull().next();
* mathematica::value result3 = shell.function("FactorInteger", 1L).integer(210).end().pull().next();
* mathematica::value result4 = shell.function("Import", 1L).str("/home/neel/projects/senschedule/build/SenSchedule.m").end().pull().next();
*/
class connector: public mathematica::wrapper{
// connector(boost::shared_ptr<mathematica::driver::ws::connection> connection);
std::string _last;
boost::shared_ptr<detail::scope> _root;
boost::shared_ptr<detail::scope> _current;
public:
struct storage{
friend wrapper& operator<<(mathematica::connector::storage storage, const mathematica::m& expr);
// friend wrapper& operator<<(mathematica::connector::storage storage, const mathematica::value& val);
connector& _conn;
std::string _name;
storage(connector& conn, const std::string& name);
connector& conn();
private:
void set_key(const std::string& key);
};
struct local_scope{
connector& _conn;
local_scope(connector& conn);
local_scope(const local_scope& other);
/**
* end()'s current scope
*/
~local_scope();
};
public:
connector();
connector(boost::shared_ptr<mathematica::driver::io::connection> connection);
connector(int argc, char** argv);
connector(const std::string& argv);
std::string name() const;
public:
typedef boost::shared_ptr<mathematica::connector> ptr;
~connector();
public:
void initialize();
public:
/**
* moving results of a computation will lead to hiding of the actual mathematica returned object. Rather it will return a reference to a saved object. which can be referred or loaded latter.
* shell.save() << SomeMathematicaFunctionCall("that", "returns", "large", "output");
*/
storage save(const std::string& name=""){
return storage(*this, name);
}
/**
* Returns a reference to the stored object. This reference can be pussed to the next mathematica input
*/
mathematica::m ref(const std::string& name) const;
/**
* fetches a saved object from storage symbol table, which is in mathematica
*/
mathematica::value load(const std::string& name="");
std::string last_key() const;
mathematica::m last() const;
public:
std::string begin(const std::string& name="");
std::string end(bool delete_all = true);
/**
* creates a scoped object that end()'s the scope inits descructor
*/
local_scope scoped(const std::string& name="");
public:
void unset(const std::string& name);
};
}
#endif // MATHEMATICAPP_CONNECTOR_H
| 36.151515 | 194 | 0.6886 |
afb27d6b9c2ac18351f86e9c8a3fc52b3e5fe6ab | 11,412 | html | HTML | docs/html/examples_2002-notification-creation_2main_8cpp.html | TS7-development/jsonrpc | 0902b50302dde6fbf169613b66a042672872b11e | [
"BSL-1.0"
] | 1 | 2021-11-15T08:51:42.000Z | 2021-11-15T08:51:42.000Z | docs/html/examples_2002-notification-creation_2main_8cpp.html | TS7-development/jsonrpc | 0902b50302dde6fbf169613b66a042672872b11e | [
"BSL-1.0"
] | null | null | null | docs/html/examples_2002-notification-creation_2main_8cpp.html | TS7-development/jsonrpc | 0902b50302dde6fbf169613b66a042672872b11e | [
"BSL-1.0"
] | null | null | null | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>JSON RPC: examples/002-notification-creation/main.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">JSON RPC
 <span id="projectnumber">1.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d28a4824dc47e487b107a5db32ef43c4.html">examples</a></li><li class="navelem"><a class="el" href="dir_194c748f85c58dd16183a776282a5923.html">002-notification-creation</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">main.cpp File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <cstdint></code><br />
<code>#include <iostream></code><br />
<code>#include <<a class="el" href="notification_8hpp_source.html">jsonrpc/notification.hpp</a>></code><br />
<code>#include <<a class="el" href="notification__handler_8hpp_source.html">jsonrpc/notification_handler.hpp</a>></code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for main.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="examples_2002-notification-creation_2main_8cpp__incl.png" border="0" usemap="#aexamples_2002-notification-creation_2main_8cpp" alt=""/></div>
<map name="aexamples_2002-notification-creation_2main_8cpp" id="aexamples_2002-notification-creation_2main_8cpp">
<area shape="rect" title=" " alt="" coords="956,5,1148,47"/>
<area shape="rect" title=" " alt="" coords="1087,707,1153,733"/>
<area shape="rect" title=" " alt="" coords="1320,102,1400,129"/>
<area shape="rect" href="notification_8hpp.html" title=" " alt="" coords="585,102,759,129"/>
<area shape="rect" href="notification__handler_8hpp.html" title=" " alt="" coords="784,95,931,136"/>
<area shape="rect" href="parameter_8hpp.html" title=" " alt="" coords="619,184,736,211"/>
<area shape="rect" href="util_8hpp.html" title=" " alt="" coords="420,259,516,285"/>
<area shape="rect" title=" " alt="" coords="669,259,744,285"/>
<area shape="rect" title=" " alt="" coords="555,632,613,659"/>
<area shape="rect" href="error_2error_8hpp.html" title=" " alt="" coords="735,408,849,435"/>
<area shape="rect" href="errorcodes_8hpp.html" title=" " alt="" coords="733,483,851,509"/>
<area shape="rect" href="maybe__failed_8hpp.html" title=" " alt="" coords="945,483,1084,509"/>
<area shape="rect" title=" " alt="" coords="771,557,832,584"/>
<area shape="rect" title=" " alt="" coords="856,557,923,584"/>
<area shape="rect" title=" " alt="" coords="947,557,1082,584"/>
<area shape="rect" title=" " alt="" coords="243,707,360,733"/>
<area shape="rect" href="asjson_8hpp.html" title=" " alt="" coords="363,557,493,584"/>
<area shape="rect" href="jsontype_8hpp.html" title=" " alt="" coords="375,632,481,659"/>
<area shape="rect" href="always__false_8hpp.html" title=" " alt="" coords="211,632,346,659"/>
<area shape="rect" title=" " alt="" coords="1158,557,1245,584"/>
<area shape="rect" title=" " alt="" coords="398,333,538,360"/>
<area shape="rect" href="fromjson_8hpp.html" title=" " alt="" coords="266,333,374,360"/>
<area shape="rect" href="remove__cref_8hpp.html" title=" " alt="" coords="100,333,231,360"/>
<area shape="rect" title=" " alt="" coords="94,408,186,435"/>
</map>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a2458967d974100b5d7776f7fc9ac44ca"><td class="memItemLeft" align="right" valign="top">using </td><td class="memItemRight" valign="bottom"><a class="el" href="examples_2002-notification-creation_2main_8cpp.html#a2458967d974100b5d7776f7fc9ac44ca">NotificationFailure</a> = ts7::jsonrpc::util::maybe_failed< void, ts7::jsonrpc::util::ErrorCode ></td></tr>
<tr class="separator:a2458967d974100b5d7776f7fc9ac44ca"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae5deb94e749eff8acc0bdb22c62fdd72"><td class="memItemLeft" align="right" valign="top"><a class="el" href="examples_2002-notification-creation_2main_8cpp.html#a2458967d974100b5d7776f7fc9ac44ca">NotificationFailure</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="examples_2002-notification-creation_2main_8cpp.html#ae5deb94e749eff8acc0bdb22c62fdd72">test_callback</a> (std::uint32_t code, std::string message)</td></tr>
<tr class="separator:ae5deb94e749eff8acc0bdb22c62fdd72"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="examples_2002-notification-creation_2main_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="a2458967d974100b5d7776f7fc9ac44ca"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2458967d974100b5d7776f7fc9ac44ca">◆ </a></span>NotificationFailure</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">using <a class="el" href="examples_2002-notification-creation_2main_8cpp.html#a2458967d974100b5d7776f7fc9ac44ca">NotificationFailure</a> = ts7::jsonrpc::util::maybe_failed<void, ts7::jsonrpc::util::ErrorCode></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="examples_2002-notification-creation_2main_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.png" border="0" usemap="#aexamples_2002-notification-creation_2main_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph" alt=""/></div>
<map name="aexamples_2002-notification-creation_2main_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph" id="aexamples_2002-notification-creation_2main_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph">
<area shape="rect" title=" " alt="" coords="5,5,60,32"/>
<area shape="rect" href="examples_2002-notification-creation_2main_8cpp.html#ae5deb94e749eff8acc0bdb22c62fdd72" title=" " alt="" coords="108,5,216,32"/>
</map>
</div>
</div>
</div>
<a id="ae5deb94e749eff8acc0bdb22c62fdd72"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae5deb94e749eff8acc0bdb22c62fdd72">◆ </a></span>test_callback()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="examples_2002-notification-creation_2main_8cpp.html#a2458967d974100b5d7776f7fc9ac44ca">NotificationFailure</a> test_callback </td>
<td>(</td>
<td class="paramtype">std::uint32_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::string </td>
<td class="paramname"><em>message</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="examples_2002-notification-creation_2main_8cpp_ae5deb94e749eff8acc0bdb22c62fdd72_icgraph.png" border="0" usemap="#aexamples_2002-notification-creation_2main_8cpp_ae5deb94e749eff8acc0bdb22c62fdd72_icgraph" alt=""/></div>
<map name="aexamples_2002-notification-creation_2main_8cpp_ae5deb94e749eff8acc0bdb22c62fdd72_icgraph" id="aexamples_2002-notification-creation_2main_8cpp_ae5deb94e749eff8acc0bdb22c62fdd72_icgraph">
<area shape="rect" title=" " alt="" coords="108,5,216,32"/>
<area shape="rect" href="examples_2002-notification-creation_2main_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4" title=" " alt="" coords="5,5,60,32"/>
</map>
</div>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
| 54.342857 | 463 | 0.701367 |
27077cd256d222c59a2ad73444d411a3863f8041 | 425 | c | C | tests/vec.c | eomain/libcx | c67e627124aa3079086b81fe213d6615bc2f184d | [
"BSD-2-Clause"
] | 1 | 2021-06-30T19:41:38.000Z | 2021-06-30T19:41:38.000Z | tests/vec.c | eomain/libcx | c67e627124aa3079086b81fe213d6615bc2f184d | [
"BSD-2-Clause"
] | null | null | null | tests/vec.c | eomain/libcx | c67e627124aa3079086b81fe213d6615bc2f184d | [
"BSD-2-Clause"
] | null | null | null |
#include "libcx/vec.h"
int main()
{
// Create a new vec
vec a = vec();
// An array of data
char *const fruits[] = {
"apple", "banana", "cherry"
};
// Copy array into vec
copy(a, fruits);
// Create another vec
vec b = vec();
// Copy compound literal
copy(b, ((char *const []){"x", "y", "z"}));
// Append vec b to a
append(a, b);
// Display values as a string
debug("%s", a);
destroy(a);
destroy(b);
}
| 14.655172 | 44 | 0.564706 |
31774fcb88fc2cb9d9f7d6b83ec79df20191c28e | 1,956 | go | Go | bot/messageprovider/rocketchat/rocketchat.go | thebigb/go-MusicBot | 8a04debefdb2a624c0167dbab7f279e69dce8875 | [
"MIT"
] | null | null | null | bot/messageprovider/rocketchat/rocketchat.go | thebigb/go-MusicBot | 8a04debefdb2a624c0167dbab7f279e69dce8875 | [
"MIT"
] | null | null | null | bot/messageprovider/rocketchat/rocketchat.go | thebigb/go-MusicBot | 8a04debefdb2a624c0167dbab7f279e69dce8875 | [
"MIT"
] | null | null | null | package rocketchat
import (
"fmt"
"github.com/svenwiltink/go-musicbot/bot"
"github.com/svenwiltink/rocketchatgo"
"log"
)
type MessageProvider struct {
session *rocketchatgo.Session
msgChannel chan bot.Message
Config *bot.Config
}
func (p *MessageProvider) GetMessageChannel() chan bot.Message {
return p.msgChannel
}
func (p *MessageProvider) SendReplyToMessage(message bot.Message, reply string) error {
return p.session.SendMessage(message.Target, reply)
}
func (p *MessageProvider) BroadcastMessage(message string) error {
channel := p.session.GetChannelByName(p.Config.Rocketchat.Channel)
if channel == nil {
return fmt.Errorf("unable to find channel %s", p.Config.Rocketchat.Channel)
}
return p.session.SendMessage(channel.ID, message)
}
func (p *MessageProvider) Start() error {
session, err := rocketchatgo.NewClient(p.Config.Rocketchat.Server, p.Config.Rocketchat.Ssl)
if err != nil {
return err
}
p.session = session
err = p.session.Login(p.Config.Rocketchat.Username, "", p.Config.Rocketchat.Pass)
if err != nil {
return err
}
p.session.AddHandler(p.onMessageCreate)
return err
}
func (p *MessageProvider) onMessageCreate(session *rocketchatgo.Session, event *rocketchatgo.MessageCreateEvent) {
if session.GetUserID() == event.Message.Sender.ID {
return
}
channel := p.session.GetChannelById(event.Message.ChannelID)
if channel == nil {
log.Printf("Unable to find channel with id %s, for message %+v", event.Message.ChannelID, event.Message)
return
}
msg := bot.Message{
Target: event.Message.ChannelID,
Message: event.Message.Message,
IsPrivate: channel.Type == rocketchatgo.RoomTypeDirect,
Sender: bot.Sender{
Name: event.Message.Sender.Username,
NickName: event.Message.Sender.Name,
},
}
p.msgChannel <- msg
}
func New(config *bot.Config) *MessageProvider {
return &MessageProvider{
msgChannel: make(chan bot.Message),
Config: config,
}
}
| 23.011765 | 114 | 0.731595 |
565145fba77e2cd6e8d3b969cdb434b12c453571 | 2,257 | go | Go | shim/elixir/elixir.go | googlegenomics/ga4gh-identity | 2d29ae5ad1109db6e593062a8289a4900fd0b432 | [
"Apache-2.0"
] | 1 | 2019-07-31T15:31:27.000Z | 2019-07-31T15:31:27.000Z | shim/elixir/elixir.go | googlegenomics/ga4gh-identity | 2d29ae5ad1109db6e593062a8289a4900fd0b432 | [
"Apache-2.0"
] | 5 | 2018-09-15T23:38:02.000Z | 2018-12-07T19:08:07.000Z | shim/elixir/elixir.go | googlegenomics/ga4gh-identity | 2d29ae5ad1109db6e593062a8289a4900fd0b432 | [
"Apache-2.0"
] | 2 | 2018-08-30T15:07:23.000Z | 2018-11-19T15:03:22.000Z | // Copyright 2018 Google LLC
//
// 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
//
// https://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 elixir provides a ga4gh.Shim implementation for translating ELIXIR
// identities into GA4GH identities.
package elixir
import (
"context"
"fmt"
oidc "github.com/coreos/go-oidc"
ga4gh "github.com/googlegenomics/ga4gh-identity"
)
const (
issuer = "https://login.elixir-czech.org/oidc/"
)
// Shim is a ga4gh.Shim that converts ELIXIR identities into GA4GH identities.
type Shim struct {
verifier *oidc.IDTokenVerifier
}
// NewShim creates a new Shim with the provided OIDC client ID. If the tokens
// passed to this shim do not have an audience claim with a value equal to the
// clientID value then they will be rejected.
func NewShim(ctx context.Context, clientID string) (*Shim, error) {
return newShim(ctx, &oidc.Config{
ClientID: clientID,
})
}
func newShim(ctx context.Context, config *oidc.Config) (*Shim, error) {
provider, err := oidc.NewProvider(ctx, issuer)
if err != nil {
return nil, fmt.Errorf("creating provider: %v", err)
}
return &Shim{
verifier: provider.Verifier(config),
}, nil
}
// Shim implements the ga4gh.Shim interface.
func (s *Shim) Shim(ctx context.Context, auth string) (*ga4gh.Identity, error) {
token, err := s.verifier.Verify(ctx, auth)
if err != nil {
return nil, fmt.Errorf("verifying token: %v", err)
}
var claims struct {
BonaFide *string `json:"bona_fide_status"`
}
if err := token.Claims(&claims); err != nil {
return nil, fmt.Errorf("getting claims: %v", err)
}
id := ga4gh.Identity{
Issuer: token.Issuer,
Subject: token.Subject,
}
if claims.BonaFide != nil {
id.BonaFide = []ga4gh.BoolValue{
{
Value: true,
Source: issuer,
},
}
}
return &id, nil
}
| 26.869048 | 80 | 0.709349 |
0ebde6126a8b2983e5272972d5da6742e2718eb9 | 11,102 | ts | TypeScript | apto-ui-lib/src/lib/radio/radio.component.ts | aptotude/Apto-UI | b8d24e7ec8f476e09a97a66274d027672472d247 | [
"MIT"
] | null | null | null | apto-ui-lib/src/lib/radio/radio.component.ts | aptotude/Apto-UI | b8d24e7ec8f476e09a97a66274d027672472d247 | [
"MIT"
] | 1 | 2018-11-27T22:40:04.000Z | 2018-11-27T22:40:04.000Z | apto-ui-lib/src/lib/radio/radio.component.ts | aptotude/apto-ui | b8d24e7ec8f476e09a97a66274d027672472d247 | [
"MIT"
] | null | null | null | import {
AfterContentInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChildren,
Directive,
ElementRef,
EventEmitter,
forwardRef,
Input,
OnInit,
Optional,
Output,
QueryList,
ViewChild,
ViewEncapsulation,
OnDestroy,
} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
import { coerceBooleanProperty } from '../utils';
import {
HasTabIndex,
mixinDisabled,
CanDisable,
mixinTabIndex,
HasTabIndexCtor,
CanDisableCtor
} from '../core';
import { UniqueSelectionDispatcher } from './unique-selection-dispatcher';
let nextUniqueId = 0;
export const APTO_RADIO_GROUP_CONTROL_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => AptoRadioGroupDirective),
multi: true
};
export class AptoRadioChange {
constructor(
public source: AptoRadioButtonComponent,
public value: any) {}
}
export class AptoRadioGroupBase { }
export const _AptoRadioGroupMixinBase: CanDisableCtor & typeof AptoRadioGroupBase =
mixinDisabled(AptoRadioGroupBase);
/**
* A group of radio buttons. May contain one or more `<mat-radio-button>` elements.
*/
@Directive({
selector: '[apto-radio-group],apto-radio-group',
providers: [APTO_RADIO_GROUP_CONTROL_VALUE_ACCESSOR],
host: {
'role': 'radiogroup',
'class': 'AptoRadioGroup',
}
})
export class AptoRadioGroupDirective extends _AptoRadioGroupMixinBase
implements AfterContentInit, ControlValueAccessor, CanDisable {
private _value: any = null;
private _name = `AptoRadioGroup-${nextUniqueId++}`;
private _selected: AptoRadioButtonComponent | null = null;
private _isInitialized = false;
private _disabled = false;
private _required = false;
@Input()
get name(): string { return this._name; }
set name(value: string) {
this._name = value;
this._updateRadioButtonNames();
}
@Input()
get value(): any { return this._value; }
set value(newValue: any) {
if (this._value !== newValue) {
this._value = newValue;
this._updateSelectedRadioFromValue();
this._checkSelectedRadioButton();
}
}
@Input()
get selected() { return this._selected; }
set selected(selected: AptoRadioButtonComponent | null) {
this._selected = selected;
this.value = selected ? selected.value : null;
this._checkSelectedRadioButton();
}
@Input('disabled')
get disabled(): boolean { return this._disabled; }
set disabled(value) {
this._disabled = coerceBooleanProperty(value);
this._markRadiosForCheck();
}
@Input()
get required(): boolean { return this._required; }
set required(value: boolean) {
this._required = coerceBooleanProperty(value);
this._markRadiosForCheck();
}
@Output() readonly change: EventEmitter<AptoRadioChange> = new EventEmitter<AptoRadioChange>();
@ContentChildren(
forwardRef(() => AptoRadioButtonComponent),
{ descendants: true }) _radios: QueryList<AptoRadioButtonComponent>;
constructor(private _changeDetectorRef: ChangeDetectorRef) {
super();
}
public _checkSelectedRadioButton(): void {
if (this._selected && !this._selected.checked) {
this._selected.checked = true;
}
}
public ngAfterContentInit(): void {
this._isInitialized = true;
}
public _touch(): void {
if (this.onTouched) {
this.onTouched();
}
}
public _emitChangeEvent(): void {
if (this._isInitialized) {
this.change.emit(new AptoRadioChange(this._selected!, this._value));
}
}
public _controlValueAccessorChangeFn: (value: any) => void = () => {};
public onTouched: () => any = () => {};
public _markRadiosForCheck(): void {
if (this._radios) {
this._radios.forEach(radio => radio._markForCheck());
}
}
// Implemented as part of ControlValueAccessor.
public writeValue(value: any): void {
this.value = value;
this._changeDetectorRef.markForCheck();
}
// Implemented as part of ControlValueAccessor.
public registerOnChange(fn: (value: any) => void): void {
this._controlValueAccessorChangeFn = fn;
}
// Implemented as part of ControlValueAccessor.
public registerOnTouched(fn: any): void {
this.onTouched = fn;
}
// Implemented as part of ControlValueAccessor.
public setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
this._changeDetectorRef.markForCheck();
}
private _updateRadioButtonNames(): void {
if (this._radios) {
this._radios.forEach(radio => {
radio.name = this.name;
});
}
}
private _updateSelectedRadioFromValue(): void {
const isAlreadySelected = this._selected !== null && this._selected.value === this._value;
if (this._radios && !isAlreadySelected) {
this._selected = null;
this._radios.forEach(radio => {
radio.checked = this.value === radio.value;
if (radio.checked) {
this._selected = radio;
}
});
}
}
}
export class AptoRadioButtonBase {
disabled: boolean;
}
export const _AptoRadioButtonMixinBase:
HasTabIndexCtor & typeof AptoRadioButtonBase =
mixinTabIndex(AptoRadioButtonBase);
@Component({
selector: 'apto-radio-button',
templateUrl: 'radio.html',
styleUrls: ['radio.scss'],
host: {
'class': 'AptoRadioButton',
'[class.AptoRadioButton--checked]': 'checked',
'[class.AptoRadioButton--disabled]': 'disabled',
'[class.AptoRadioButton--block]': 'block',
'[attr.id]': 'id',
'[attr.tabindex]': 'null',
'(focus)': '_inputElement.nativeElement.focus()'
},
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class AptoRadioButtonComponent extends _AptoRadioButtonMixinBase
implements OnInit, OnDestroy, HasTabIndex {
private _uniqueId = `AptoRadioButton-${++nextUniqueId}`;
public radioGroup: AptoRadioGroupDirective;
private _checked = false;
private _disabled = false;
private _required = false;
private _value: any = null;
private _block = false;
@Input() public tabIndex: number;
@Input() id: string = this._uniqueId;
@Input() name: string;
@Input('aria-label') ariaLabel: string;
@Input('aria-labelledby') ariaLabelledby: string;
@Input('aria-describedby') ariaDescribedby: string;
@Input()
get checked(): boolean { return this._checked; }
set checked(value: boolean) {
const newCheckedState = coerceBooleanProperty(value);
if (this._checked !== newCheckedState) {
this._checked = newCheckedState;
if (newCheckedState && this.radioGroup && this.radioGroup.value !== this.value) {
this.radioGroup.selected = this;
} else if (!newCheckedState && this.radioGroup && this.radioGroup.value === this.value) {
this.radioGroup.selected = null;
}
if (newCheckedState) {
this._radioDispatcher.notify(this.id, this.name);
}
this._changeDetectorRef.markForCheck();
}
}
@Input()
get value(): any { return this._value; }
set value(value: any) {
if (this._value !== value) {
this._value = value;
if (this.radioGroup !== null) {
if (!this.checked) {
this.checked = this.radioGroup.value === value;
}
if (this.checked) {
this.radioGroup.selected = this;
}
}
}
}
@Input()
get disabled(): boolean {
return this._disabled || (this.radioGroup !== null && this.radioGroup.disabled);
}
set disabled(value: boolean) {
const newDisabledState = coerceBooleanProperty(value);
if (this._disabled !== newDisabledState) {
this._disabled = newDisabledState;
this._changeDetectorRef.markForCheck();
}
}
@Input()
get block() { return this._block; }
set block(value: boolean) {
this._block = coerceBooleanProperty(value);
}
@Input()
get required(): boolean {
return this._required || (this.radioGroup && this.radioGroup.required);
}
set required(value: boolean) {
this._required = coerceBooleanProperty(value);
}
@Output() readonly change: EventEmitter<AptoRadioChange> =
new EventEmitter<AptoRadioChange>();
@ViewChild('input') public _inputElement: ElementRef;
constructor(
@Optional() radioGroup: AptoRadioGroupDirective,
private _changeDetectorRef: ChangeDetectorRef,
private _radioDispatcher: UniqueSelectionDispatcher
) {
super();
this.radioGroup = radioGroup;
this._removeUniqueSelectionListener =
_radioDispatcher.listen((id: string, name: string) => {
if (id !== this.id && name === this.name) {
this.checked = false;
}
});
}
public ngOnInit(): void {
if (this.radioGroup) {
this.checked = this.radioGroup.value === this._value;
this.name = this.radioGroup.name;
}
}
public ngOnDestroy(): void {
this._removeUniqueSelectionListener();
}
public get inputId(): string {
return `${this.id || this._uniqueId}-input`;
}
public focus(): void {
this._inputElement.nativeElement.focus();
}
public _markForCheck(): void {
this._changeDetectorRef.markForCheck();
}
public _onInputClick(event: Event): void {
event.stopPropagation();
}
public _onInputChange(event: Event): void {
event.stopPropagation();
const groupValueChanged = this.radioGroup && this.value !== this.radioGroup.value;
this.checked = true;
this._emitChangeEvent();
if (this.radioGroup) {
this.radioGroup._controlValueAccessorChangeFn(this.value);
this.radioGroup._touch();
if (groupValueChanged) {
this.radioGroup._emitChangeEvent();
}
}
}
private _removeUniqueSelectionListener: () => void = () => {};
private _emitChangeEvent(): void {
this.change.emit(new AptoRadioChange(this, this._value));
}
}
| 30.668508 | 105 | 0.59755 |
41d9f48f155f96062248c53bba7278572d73c2e0 | 279 | h | C | Remote TLSR8368 SDK/8367_lighting/8367_lighting_V1.0.0/vendor/light/user_pwm.h | dckiller51/esphome-yeelight-led-screen-light-bar | d98441fa033dbe0c1425b4472c5cb53bb4959fc3 | [
"Apache-2.0"
] | 14 | 2021-04-26T21:11:30.000Z | 2022-01-26T13:42:53.000Z | Remote TLSR8368 SDK/8367_lighting/8367_lighting_V1.0.0/vendor/light/user_pwm.h | dckiller51/esphome-yeelight-led-screen-light-bar | d98441fa033dbe0c1425b4472c5cb53bb4959fc3 | [
"Apache-2.0"
] | 1 | 2021-09-01T13:21:15.000Z | 2021-09-02T21:06:39.000Z | Remote TLSR8368 SDK/8367_lighting/8367_lighting_V1.0.0/vendor/light_beacon/user_pwm.h | dckiller51/esphome-yeelight-led-screen-light-bar | d98441fa033dbe0c1425b4472c5cb53bb4959fc3 | [
"Apache-2.0"
] | 2 | 2021-12-14T01:26:50.000Z | 2022-02-13T21:44:13.000Z | #pragma once
#include "../../drivers.h"
void PWM_MaxFqeSet(PWM_TypeDef pwmNumber,unsigned short MaxValue,unsigned short Fqe);
void PWM_DutyValueSet(PWM_TypeDef pwmNumber,unsigned short value);
void user_PWMInit(PWM_TypeDef pwmNumber,unsigned short MaxValue,unsigned short Fqe);
| 39.857143 | 85 | 0.824373 |
c6fcf57c964e1b4034a5e3fb2afe2578d95992a7 | 1,049 | sql | SQL | Dane.Export.Indicators/MsSql/CreateDB-DaneGeih_Table-AreaInactivos.sql | enriqueescobar-askida/Kinito.Revolution | a79bc947cc876bbcba6205e38302ab130a8b7cfb | [
"MIT"
] | 1 | 2020-01-07T01:36:49.000Z | 2020-01-07T01:36:49.000Z | Dane.Export.Indicators/MsSql/CreateDB-DaneGeih_Table-AreaInactivos.sql | enriqueescobar-askida/Kinito.Revolution | a79bc947cc876bbcba6205e38302ab130a8b7cfb | [
"MIT"
] | null | null | null | Dane.Export.Indicators/MsSql/CreateDB-DaneGeih_Table-AreaInactivos.sql | enriqueescobar-askida/Kinito.Revolution | a79bc947cc876bbcba6205e38302ab130a8b7cfb | [
"MIT"
] | null | null | null | USE [DaneGeih]
GO
/****** Object: Table [dbo].[AreaInactivos] Script Date: 6/15/2017 12:36:02 AM ******/
DROP TABLE [dbo].[AreaInactivos]
GO
/****** Object: Table [dbo].[AreaInactivos] Script Date: 6/15/2017 12:36:02 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AreaInactivos](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Directorio] [bigint] NOT NULL,
[Secuencia_p] [int] NOT NULL,
[Month] [smallint] NOT NULL,
[Year] [int] NOT NULL,
[Quarter] [nchar](2) NOT NULL,
[Orden] [int] NOT NULL,
[Hogar] [int] NOT NULL,
[Regis] [int] NOT NULL,
[Area] [int] NOT NULL,
[P7430] [int] NOT NULL,
[P7440] [int] NULL,
[P7450] [int] NULL,
[P7450s1] [varchar](20) NULL,
[P7460] [int] NULL,
[P7470] [int] NULL,
[P7472] [int] NOT NULL,
[P7472s1] [int] NULL,
[P7454] [int] NULL,
[P7456] [int] NULL,
[P7458s1] [varchar](48) NULL,
[P7458] [int] NULL,
[P7452] [int] NULL,
[Ini] [smallint] NOT NULL,
[Mes] [nchar](2) NOT NULL,
[Depto] [nchar](2) NOT NULL,
[Fex_c_2011] [real] NOT NULL
) ON [PRIMARY]
GO
| 22.319149 | 90 | 0.624404 |
59b17faaa6585075d44a223376d5379758736009 | 2,142 | asm | Assembly | system.asm | palisv/x16-racer | 9f05a43faf5fdab807ab141b4ddc9e41f1986db1 | [
"MIT"
] | null | null | null | system.asm | palisv/x16-racer | 9f05a43faf5fdab807ab141b4ddc9e41f1986db1 | [
"MIT"
] | null | null | null | system.asm | palisv/x16-racer | 9f05a43faf5fdab807ab141b4ddc9e41f1986db1 | [
"MIT"
] | null | null | null | .ifndef SYSTEM_ASM
SYSTEM_ASM=1
.include "system.inc"
.include "vera.inc"
;=================================================
;=================================================
;
; Random number generation
;
;-------------------------------------------------
;
; This random number generation routine is based
; on a linear feedback shift register, or LFSR.
; It's a common technique for generating complex
; sequences of values.
;
; This specific implementation is based on:
; https://wiki.nesdev.com/w/index.php/Random_number_generator/Linear_feedback_shift_register_(advanced)
;
;=================================================
; sys_rand
; Generate an 8-bit random number.
;-------------------------------------------------
; INPUTS: Sys_rand_mem
;
;-------------------------------------------------
; MODIFIES: A, X, Sys_rand_mem
;
sys_rand:
ldx #8
lda Sys_rand_mem
: asl
rol Sys_rand_mem+1
rol Sys_rand_mem+2
bcc :+
eor #$1B
: dex
bne :--
sta Sys_rand_mem
cmp #0
rts
;=================================================
; sys_wait_one_frame
; Wait for a new frame
;-------------------------------------------------
; INPUTS: (none)
;
;-------------------------------------------------
; MODIFIES: A, X, Sys_frame
;
sys_wait_one_frame:
lda #1
jsr sys_wait_for_frame
rts
;=================================================
; sys_wait_for_frame
; Wait for a new frame
;-------------------------------------------------
; INPUTS: A number of frames to wait
;
;-------------------------------------------------
; MODIFIES: A, X, Sys_frame
;
sys_wait_for_frame:
clc
adc Sys_frame
tax
SYS_SET_IRQ sys_inc_frame
cli
; Tight loop until next frame
: cpx Sys_frame
bne :-
sei
rts
;=================================================
; sys_inc_frame
; Increment a value when a new frame arrives
;-------------------------------------------------
; INPUTS: (none)
;
;-------------------------------------------------
; MODIFIES: New_frame
;
sys_inc_frame:
inc Sys_frame
VERA_END_IRQ
SYS_END_IRQ
.endif ; SYSTEM_ASM | 22.082474 | 103 | 0.439309 |
eecf28e68ec94e8b6ec472bed5ba3424292b0eb4 | 2,019 | cs | C# | src/Controls/src/Core/PlatformConfiguration/macOSSpecific/Page.cs | abod1944/maui | 00df9c13a8939b58ac1b55ab861211ff3d3007db | [
"MIT"
] | 1 | 2022-03-24T03:01:39.000Z | 2022-03-24T03:01:39.000Z | src/Controls/src/Core/PlatformConfiguration/macOSSpecific/Page.cs | abod1944/maui | 00df9c13a8939b58ac1b55ab861211ff3d3007db | [
"MIT"
] | null | null | null | src/Controls/src/Core/PlatformConfiguration/macOSSpecific/Page.cs | abod1944/maui | 00df9c13a8939b58ac1b55ab861211ff3d3007db | [
"MIT"
] | null | null | null | namespace Microsoft.Maui.Controls.PlatformConfiguration.macOSSpecific
{
using FormsElement = Maui.Controls.Page;
/// <include file="../../../../docs/Microsoft.Maui.Controls.PlatformConfiguration.macOSSpecific/Page.xml" path="Type[@FullName='Microsoft.Maui.Controls.PlatformConfiguration.macOSSpecific.Page']/Docs" />
public static class Page
{
#region TabsStyle
/// <include file="../../../../docs/Microsoft.Maui.Controls.PlatformConfiguration.macOSSpecific/Page.xml" path="//Member[@MemberName='TabOrderProperty']/Docs" />
public static readonly BindableProperty TabOrderProperty = BindableProperty.Create("TabOrder", typeof(VisualElement[]), typeof(Page), null);
/// <include file="../../../../docs/Microsoft.Maui.Controls.PlatformConfiguration.macOSSpecific/Page.xml" path="//Member[@MemberName='GetTabOrder'][1]/Docs" />
public static VisualElement[] GetTabOrder(BindableObject element)
{
return (VisualElement[])element.GetValue(TabOrderProperty);
}
/// <include file="../../../../docs/Microsoft.Maui.Controls.PlatformConfiguration.macOSSpecific/Page.xml" path="//Member[@MemberName='SetTabOrder'][1]/Docs" />
public static void SetTabOrder(BindableObject element, params VisualElement[] value)
{
element.SetValue(TabOrderProperty, value);
}
/// <include file="../../../../docs/Microsoft.Maui.Controls.PlatformConfiguration.macOSSpecific/Page.xml" path="//Member[@MemberName='GetTabOrder'][2]/Docs" />
public static VisualElement[] GetTabOrder(this IPlatformElementConfiguration<macOS, FormsElement> config)
{
return GetTabOrder(config.Element);
}
/// <include file="../../../../docs/Microsoft.Maui.Controls.PlatformConfiguration.macOSSpecific/Page.xml" path="//Member[@MemberName='SetTabOrder'][2]/Docs" />
public static IPlatformElementConfiguration<macOS, FormsElement> SetTabOrder(this IPlatformElementConfiguration<macOS, FormsElement> config, params VisualElement[] value)
{
SetTabOrder(config.Element, value);
return config;
}
#endregion
}
}
| 51.769231 | 204 | 0.7474 |
dcb87225b53705ab6453d4b7e0654f9ed42df324 | 566 | dart | Dart | lib/floating_action_button/action_button.dart | OliviaAlter/prototype_ui_mk2 | 7e7f73ad097d980390c858f214e89c1794519f90 | [
"MIT"
] | null | null | null | lib/floating_action_button/action_button.dart | OliviaAlter/prototype_ui_mk2 | 7e7f73ad097d980390c858f214e89c1794519f90 | [
"MIT"
] | null | null | null | lib/floating_action_button/action_button.dart | OliviaAlter/prototype_ui_mk2 | 7e7f73ad097d980390c858f214e89c1794519f90 | [
"MIT"
] | null | null | null | import 'package:flutter/material.dart';
class ActionButton extends StatelessWidget {
const ActionButton({Key? key, this.onPressed, required this.icon}) : super(key: key);
final VoidCallback? onPressed;
final Icon icon;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Material(
shape: const CircleBorder(),
clipBehavior: Clip.antiAlias,
color: theme.colorScheme.primary,
elevation: 4.0,
child: IconButton(
onPressed: onPressed,
icon: icon,
),
);
}
} | 24.608696 | 87 | 0.664311 |
27fb0f8fa91755b63b00691f27bf3fcbca90a4be | 237 | dart | Dart | lib/src/cache/cache_item.dart | CoreLine-agency/flutter_requery | 70c7887901c010a26f224f59622f6a4efe0a86f2 | [
"MIT"
] | 26 | 2021-10-16T21:23:52.000Z | 2022-03-29T00:15:05.000Z | lib/src/cache/cache_item.dart | mislavlukach/flutter_query | e96a62b4b8a24bf3060759aab97d7148023fb2c4 | [
"MIT"
] | 2 | 2021-12-21T12:59:02.000Z | 2022-01-29T20:44:01.000Z | lib/src/cache/cache_item.dart | mislavlukach/flutter_query | e96a62b4b8a24bf3060759aab97d7148023fb2c4 | [
"MIT"
] | 2 | 2022-01-01T10:09:20.000Z | 2022-03-11T09:10:34.000Z | import 'package:flutter_requery/src/cache/cache_item_subscriber.dart';
class CacheItem<T> {
List<CacheItemSubscriber> subscribers;
dynamic key;
T? data;
CacheItem({
required this.subscribers,
required this.key,
});
}
| 18.230769 | 70 | 0.725738 |
1217dbbdae3bbee8324a4693e932372c006f76a2 | 3,154 | dart | Dart | lib/home/widget/buildCards.dart | Aleynaesr/flutter-ask-to-doctor-ui | 22cbdad3730953769852a64a7ac8a84c942bde4e | [
"MIT"
] | 1 | 2022-02-28T19:04:48.000Z | 2022-02-28T19:04:48.000Z | lib/home/widget/buildCards.dart | Aleynaesr/flutter-ask-to-doctor-ui | 22cbdad3730953769852a64a7ac8a84c942bde4e | [
"MIT"
] | null | null | null | lib/home/widget/buildCards.dart | Aleynaesr/flutter-ask-to-doctor-ui | 22cbdad3730953769852a64a7ac8a84c942bde4e | [
"MIT"
] | null | null | null | import 'package:ask_app_ui/utils/constant.dart';
import 'package:flutter/material.dart';
Widget buildCards() {
return Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: white,
shadowColor:primary,
onPrimary: primary,
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
minimumSize: Size(180, 115),
),
onPressed: () {},
child: Column(
children: const [
Icon(Icons.question_answer, size: iconSize,),
Text("Ask a Doctor", style: TextStyle(color:iconTextColor, fontSize: 17) )
],),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: white,
shadowColor: primary,
onPrimary: primary,
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
minimumSize: Size(180, 115), //////// HERE
),
onPressed: () {},
child: Column(
children: const [
Icon(Icons.call, size: iconSize,),
Text("Emergency Call", style: TextStyle(color:iconTextColor, fontSize: 17) )
],),
)
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: white,
shadowColor: primary,
onPrimary: primary,
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
minimumSize: Size(180, 115), //////// HERE
),
onPressed: () {},
child: Column(
children: const [
Icon(Icons.local_hospital, size: iconSize,),
Text("New Appointment", style: TextStyle(color:iconTextColor, fontSize: 17) )
],),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary:white,
shadowColor: primary,
onPrimary: primary,
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
minimumSize: Size(180, 115),
),
onPressed: () {},
child: Column(
children: const [
Icon(Icons.assignment_ind, size: iconSize,),
Text("Special Visit", style: TextStyle(color:iconTextColor, fontSize: 17) )
],),
)
],)
],
);
}
| 33.2 | 94 | 0.501902 |
dab2b318be689a2f37fcffd9123fdca852924143 | 3,699 | kt | Kotlin | mpp-library/features/chat/src/commonMain/kotlin/org/example/mpp/ChatScreen.kt | Alex009/interactive-story | c86502229bb521ad4511f2f6560d404250cd854c | [
"Apache-2.0"
] | null | null | null | mpp-library/features/chat/src/commonMain/kotlin/org/example/mpp/ChatScreen.kt | Alex009/interactive-story | c86502229bb521ad4511f2f6560d404250cd854c | [
"Apache-2.0"
] | null | null | null | mpp-library/features/chat/src/commonMain/kotlin/org/example/mpp/ChatScreen.kt | Alex009/interactive-story | c86502229bb521ad4511f2f6560d404250cd854c | [
"Apache-2.0"
] | 1 | 2020-10-05T16:37:24.000Z | 2020-10-05T16:37:24.000Z | package org.example.mpp
import dev.icerock.moko.mvvm.dispatcher.EventsDispatcher
import dev.icerock.moko.mvvm.livedata.map
import dev.icerock.moko.parcelize.Parcelable
import dev.icerock.moko.parcelize.Parcelize
import dev.icerock.moko.units.TableUnitItem
import dev.icerock.moko.widgets.ListWidget
import dev.icerock.moko.widgets.clickable
import dev.icerock.moko.widgets.container
import dev.icerock.moko.widgets.core.Theme
import dev.icerock.moko.widgets.list
import dev.icerock.moko.widgets.screen.Args
import dev.icerock.moko.widgets.screen.WidgetScreen
import dev.icerock.moko.widgets.screen.getViewModel
import dev.icerock.moko.widgets.screen.listen
import dev.icerock.moko.widgets.screen.navigation.NavigationBar
import dev.icerock.moko.widgets.screen.navigation.NavigationItem
import dev.icerock.moko.widgets.style.view.WidgetSize
import org.example.mpp.entity.Message
import org.example.mpp.units.InputImageUnit
import org.example.mpp.units.InputMessageUnit
import org.example.mpp.units.OutputImageUnit
import org.example.mpp.units.OutputMessageUnit
class ChatScreen(
private val theme: Theme,
private val chatCategory: ListWidget.Category,
private val createViewModel: (
EventsDispatcher<ChatViewModel.EventsListener>
) -> ChatViewModel
) : WidgetScreen<Args.Parcel<ChatScreen.Args>>(), ChatViewModel.EventsListener, NavigationItem {
override fun createContentWidget() = with(theme) {
val viewModel: ChatViewModel = getViewModel {
createViewModel(createEventsDispatcher())
}
viewModel.eventsDispatcher.listen(
this@ChatScreen,
this@ChatScreen
)
val clickableChild = container(size = WidgetSize.AsParent) {
top {
theme.clickable(
child = list(
category = chatCategory,
size = WidgetSize.AsParent,
items = viewModel.messagesLiveData.map { messageList ->
messageList.mapIndexed { id, message ->
createMessageUnit(
message = message,
id = (messageList.size - id).toLong(),
onClick = viewModel::onTap
) as TableUnitItem
}
},
id = Ids.List
),
onClick = { viewModel.onTap() }
)
}
}
return@with theme.clickable(
child = clickableChild,
onClick = { viewModel.onTap() }
)
}
private fun createMessageUnit(message: Message, id: Long, onClick: () -> Unit): TableUnitItem {
return when {
message.isRight && message.image.isNullOrEmpty() -> {
OutputMessageUnit(theme = theme, itemData = message, id = id, onClick = onClick)
}
!message.isRight && message.image.isNullOrEmpty() -> {
InputMessageUnit(theme = theme, itemData = message, id = id, onClick = onClick)
}
message.isRight && !message.image.isNullOrEmpty() -> {
OutputImageUnit(theme = theme, itemData = message, id = id, onClick = onClick)
}
else -> {
InputImageUnit(theme = theme, itemData = message, id = id, onClick = onClick)
}
}
}
override val navigationBar: NavigationBar = NavigationBar.None
object Ids {
object List : ListWidget.Id
}
@Parcelize
data class Args(val contentId: Int) : Parcelable
}
| 37.744898 | 99 | 0.610976 |
8037cdb68a9acd6fce754ace67ffbb3eb9791ede | 2,337 | java | Java | src/main/java/simplycmd/fabricated_agriculture/fish/pondies/PondieEntityModel.java | SimplyCmd/Fabricated-Agriculture | 5180ca538c23b5e7523422015a5dce1374b52f57 | [
"MIT"
] | null | null | null | src/main/java/simplycmd/fabricated_agriculture/fish/pondies/PondieEntityModel.java | SimplyCmd/Fabricated-Agriculture | 5180ca538c23b5e7523422015a5dce1374b52f57 | [
"MIT"
] | null | null | null | src/main/java/simplycmd/fabricated_agriculture/fish/pondies/PondieEntityModel.java | SimplyCmd/Fabricated-Agriculture | 5180ca538c23b5e7523422015a5dce1374b52f57 | [
"MIT"
] | null | null | null | package simplycmd.fabricated_agriculture.fish.pondies;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.CodEntityModel;
import net.minecraft.entity.Entity;
import net.fabricmc.api.EnvType;
import net.minecraft.client.model.ModelData;
import net.minecraft.client.model.ModelPartBuilder;
import net.minecraft.client.model.ModelPartData;
import net.minecraft.client.model.ModelTransform;
import net.minecraft.client.model.TexturedModelData;
import net.minecraft.client.render.entity.model.EntityModelPartNames;
@Environment(EnvType.CLIENT)
public class PondieEntityModel<T extends Entity> extends CodEntityModel<T> {
public PondieEntityModel(ModelPart root) {
super(root);
}
public static TexturedModelData getTexturedModelData() {
ModelData modelData = new ModelData();
ModelPartData modelPartData = modelData.getRoot();
modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create().uv(2, 2).cuboid(-1.0f, -2.0f, 0.0f, 2.0f, 4.0f, 5.0f), ModelTransform.pivot(0.0f, 22.0f, 0.0f));
modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create().uv(11, 0).cuboid(-1.0f, -2.0f, -3.0f, 2.0f, 4.0f, 3.0f), ModelTransform.pivot(0.0f, 22.0f, 0.0f));
modelPartData.addChild(EntityModelPartNames.NOSE, ModelPartBuilder.create().uv(0, 0).cuboid(-1.0f, -2.0f, -1.0f, 2.0f, 3.0f, 1.0f), ModelTransform.pivot(0.0f, 22.0f, -3.0f));
modelPartData.addChild(EntityModelPartNames.RIGHT_FIN, ModelPartBuilder.create().uv(22, 1).cuboid(-2.0f, 0.0f, -1.0f, 2.0f, 0.0f, 2.0f), ModelTransform.of(-1.0f, 23.0f, 0.0f, 0.0f, 0.0f, -0.7853982f));
modelPartData.addChild(EntityModelPartNames.LEFT_FIN, ModelPartBuilder.create().uv(22, 4).cuboid(0.0f, 0.0f, -1.0f, 2.0f, 0.0f, 2.0f), ModelTransform.of(1.0f, 23.0f, 0.0f, 0.0f, 0.0f, 0.7853982f));
modelPartData.addChild(EntityModelPartNames.TAIL_FIN, ModelPartBuilder.create().uv(22, 3).cuboid(0.0f, -2.0f, 0.0f, 0.0f, 4.0f, 4.0f), ModelTransform.pivot(0.0f, 22.0f, 5.0f));
modelPartData.addChild(EntityModelPartNames.TOP_FIN, ModelPartBuilder.create().uv(20, -6).cuboid(0.0f, -1.0f, -2.0f, 0.0f, 1.0f, 6.0f), ModelTransform.pivot(0.0f, 20.0f, 0.0f));
return TexturedModelData.of(modelData, 32, 32);
}
}
| 68.735294 | 209 | 0.731707 |
b362881e06dfaa78a583c8127e02981f8b25a54c | 114 | sql | SQL | szamologep-core/src/main/resources/calc.sql | Csaki95/AF1_Calculator | 67596eb5a7585c7aca5764b75bb642a03b085975 | [
"MIT"
] | null | null | null | szamologep-core/src/main/resources/calc.sql | Csaki95/AF1_Calculator | 67596eb5a7585c7aca5764b75bb642a03b085975 | [
"MIT"
] | null | null | null | szamologep-core/src/main/resources/calc.sql | Csaki95/AF1_Calculator | 67596eb5a7585c7aca5764b75bb642a03b085975 | [
"MIT"
] | null | null | null | CREATE TABLE IF NOT EXISTS calc(
id integer PRIMARY KEY AUTOINCREMENT,
num1 text,
num2 text,
sign text
);
| 16.285714 | 39 | 0.719298 |
80332a26c428f94fe6e70bb848917c040eca4eda | 2,489 | java | Java | GamePanel.java | jonlim19/FlappyBird_Clone | aefc093cd3fef0a713691e5835cc504519a280d4 | [
"BSD-3-Clause"
] | null | null | null | GamePanel.java | jonlim19/FlappyBird_Clone | aefc093cd3fef0a713691e5835cc504519a280d4 | [
"BSD-3-Clause"
] | null | null | null | GamePanel.java | jonlim19/FlappyBird_Clone | aefc093cd3fef0a713691e5835cc504519a280d4 | [
"BSD-3-Clause"
] | null | null | null | import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
public class GamePanel extends JPanel implements KeyListener {
private boolean running = true;
private int pressedKey;
private Bird bird = new Bird(new Rectangle(50, 250, 50, 50));
private Pillar pillar = new Pillar(bird);
private JPanel background;
public static int screenWidth;
public static int screenHeight;
public GamePanel(){
background = new JPanel();
setBackground(Color.lightGray);
screenWidth = background.getWidth();
screenHeight = background.getHeight();
addKeyListener(this);
setFocusable(true);
setPreferredSize(new Dimension(600,600));
GameLoop gameLoop = new GameLoop();
new Thread(gameLoop).start();
}
class GameLoop extends Thread { // Gameloopfor udpdating all with 60 FPS
private static final int FPS = 60;
private static final long maxLoopTime = 1000 / FPS;
@Override
public void run() {
long timestamp;
long oldTimestamp;
while (running == true) {
oldTimestamp = System.currentTimeMillis();
timestamp = System.currentTimeMillis();
updateGameObjects();
updateScreen();
if (timestamp - oldTimestamp <= maxLoopTime) {
try {
Thread.sleep(maxLoopTime - (timestamp - oldTimestamp));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
public void updateGameObjects() {
bird.BirdMovement();
if(bird.isJump()==true){
bird.BirdJump();
bird.setJump(false);
}
}
public void updateScreen() { // repaint Screen
super.repaint();
}
public void paintComponent(Graphics g){
super.paintComponent(g);
bird.colourBird(g);
}
@Override
public void keyTyped(KeyEvent keyEvent) {
}
@Override
public void keyPressed(KeyEvent event) {
pressedKey = event.getKeyCode();
if(pressedKey== KeyEvent.VK_UP){
bird.setJump(true);
}
}
@Override
public void keyReleased(KeyEvent keyEvent) {
}
}
| 27.054348 | 80 | 0.552431 |
a93a1e3a6d2839cd2af3347c787d165c10834494 | 2,300 | lua | Lua | xdg/neovim/lua/plugins/lint/config.lua | chaoticmurder/dotfiles | a3ff0d918885c525301ff296246018643be004f8 | [
"MIT"
] | null | null | null | xdg/neovim/lua/plugins/lint/config.lua | chaoticmurder/dotfiles | a3ff0d918885c525301ff296246018643be004f8 | [
"MIT"
] | null | null | null | xdg/neovim/lua/plugins/lint/config.lua | chaoticmurder/dotfiles | a3ff0d918885c525301ff296246018643be004f8 | [
"MIT"
] | null | null | null | local has_ls, ls = pcall(require, 'null-ls')
local log = require('log')
if not has_ls then
log.error('Tried loading plugin ... unsuccessfully ‼', 'null-ls')
return has_ls
end
local prettier = ls.builtins.formatting.prettier.with({
command = vim.fn.expand('./node_modules/.bin/prettier'),
args = {
'--stdin-filepath', '$FILENAME',
'--tab-width', '3',
'--no-semi',
'--single-quote',
'--jsx-single-quote',
},
filetypes = {
'html',
'css',
'scss',
'markdown',
'javascript',
'javascript.jsx',
'javascriptreact',
'json',
'typescript',
'typescript.tsx',
'typescriptreact',
'vue',
'svelte',
'yaml',
}})
local eslint_diagnostics = ls.builtins.diagnostics.eslint.with({
command = vim.fn.expand('./node_modules/.bin/eslint_d'),
args = {
'-f',
'json',
'--config', './eslint.config.js',
'--stdin',
'--stdin-filename', '$FILENAME',
},
filetypes = {
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'vue',
},
})
local eslint_codeactions = ls.builtins.code_actions.eslint.with({
command = vim.fn.expand('./node_modules/.bin/eslint_d'),
args = {
'-f',
'json',
'--config', './eslint.config.js',
'--stdin',
'--stdin-filename', '$FILENAME',
},
filetypes = {
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'vue',
},
})
local stylua = ls.builtins.formatting.stylua.with({
})
local vale = ls.builtins.diagnostics.vale.with({
'markdown',
'tex',
})
local hadolint = ls.builtins.diagnostics.hadolint.with({
command = 'podman',
args = {
'run',
'--rm',
'-iv',
vim.loop.cwd() .. ':' .. vim.loop.cwd(),
'docker.io/hadolint/hadolint',
'hadolint',
'--no-fail',
'--format=json',
'$FILENAME',
},
})
ls.setup({
debounce = 250,
default_timeout = 5000,
diagnostics_format = '#{m}',
on_attach = require('plugins.lspconfig.on_attach'),
root_dir = vim.loop.cwd,
sources = {
eslint_codeactions,
eslint_diagnostics,
hadolint,
prettier,
-- stylua,
-- vale,
}
})
| 18.253968 | 68 | 0.54 |
7f580f5191cdfde1a735c0c768cdfa0a8c5eaae2 | 800 | asm | Assembly | src/videoPorts/disk_load.asm | 9176324/WriteYourOwnOS | dd5856302f73e8b5de19c20ce18e04aa7a970d7b | [
"MIT"
] | 17 | 2015-05-29T08:59:30.000Z | 2020-09-22T11:19:15.000Z | src/kernelVanilla/disk_load.asm | geekskool/WriteYourOwnOS | dd5856302f73e8b5de19c20ce18e04aa7a970d7b | [
"MIT"
] | null | null | null | src/kernelVanilla/disk_load.asm | geekskool/WriteYourOwnOS | dd5856302f73e8b5de19c20ce18e04aa7a970d7b | [
"MIT"
] | 5 | 2016-05-29T19:17:20.000Z | 2019-11-13T09:58:19.000Z | disk_load:
push dx ; Store DX on stack so later we can recall
; how many sectors were request to be read!
mov ah, 0x02 ; BIOS read sector function
mov al, dh ; READ dh sectors
mov ch, 0x00 ; select cylinder 0
mov dh, 0x00 ; select head 0
mov cl, 0x02 ; start reading from 2nd sector (after boot sector)
int 0x13 ; BIOS interrupt
jc disk_error
pop dx ; pop dx from the stack
cmp dh, al
jne disk_error ; generate disk error if AL(sectors read) != DH(Expected number of sectors)
ret
disk_error: ; disk_error label
mov bx, [DISK_ERROR_MSG] ; push the error message
call print_string ; print_string is the helper to print string stored in [BX]
jmp $ ; jump forever
DISK_ERROR_MSG:
db 'Disk read Error!', 0
| 29.62963 | 93 | 0.65875 |
ef81f498fcc1c50a1f2c285a77e7836ffd186838 | 806 | sql | SQL | IS675/HW04/Questions(5,7,8,11,13)/Question_5_Query1.sql | T-R0D/Past-Courses | 0edc83a7bf09515f0d01d23a26df2ff90c0f458a | [
"MIT"
] | 7 | 2017-03-13T17:32:26.000Z | 2021-09-27T16:51:22.000Z | IS675/HW04/Questions(5,7,8,11,13)/Question_5_Query1.sql | T-R0D/Past-Courses | 0edc83a7bf09515f0d01d23a26df2ff90c0f458a | [
"MIT"
] | 1 | 2021-05-29T19:54:02.000Z | 2021-05-29T19:54:52.000Z | IS675/HW04/Questions(5,7,8,11,13)/Question_5_Query1.sql | T-R0D/Past-Courses | 0edc83a7bf09515f0d01d23a26df2ff90c0f458a | [
"MIT"
] | 25 | 2016-10-18T03:31:44.000Z | 2020-12-29T13:23:10.000Z | -- 5. What is the average EstMaterialCostPerSqFt, and EstLaborCostPerSqFt for all tasks completed two years ago?
-- What was the largest and smallest of those
-- values? Round the result to two digits after the decimal point. Result table:
SELECT
ROUND(AVG(EstMaterialCost/SquareFeet),2) 'Average EstMaterialCostPerSqFt',
ROUND(MAX(EstMaterialCost/SquareFeet),2) 'Largest EstMaterialCostPerSqFt',
ROUND(MIN(EstMaterialCost/SquareFeet),2) 'Smallest EstMaterialCostPerSqFt',
ROUND(AVG(EstLaborCost/SquareFeet),2) 'Average EstLaborCostPerSqFt',
ROUND(MAX(EstLaborCost/SquareFeet),2) 'Largest EstLaborCostPerSqFt',
ROUND(MIN(EstLaborCost/SquareFeet),2) 'Smallest EstLaborCostPerSqFt'
FROM
JobTask
WHERE
DateCompleted is not NULL AND
DATEDIFF(YEAR, DateCompleted, GETDATE()) = 2;
| 50.375 | 114 | 0.782878 |
fb201d88f1b31f9c78e0cc7f8de811089d636217 | 3,068 | c | C | platforms/portable/vec_math/vec_add_const_sat_c32.c | vnerozin/cimlib | c8f44c30dcb240e183dedd2e26b0aff59801ee63 | [
"MIT"
] | 3 | 2017-03-17T11:54:27.000Z | 2021-07-11T11:59:38.000Z | platforms/portable/vec_math/vec_add_const_sat_c32.c | vnerozin/cimlib | c8f44c30dcb240e183dedd2e26b0aff59801ee63 | [
"MIT"
] | null | null | null | platforms/portable/vec_math/vec_add_const_sat_c32.c | vnerozin/cimlib | c8f44c30dcb240e183dedd2e26b0aff59801ee63 | [
"MIT"
] | null | null | null | /*******************************************************************************
* Copyright (c) 2017 Vasiliy Nerozin
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MIT license. See LICENSE.md for details.
******************************************************************************/
/* -----------------------------------------------------------------------------
* Includes
* ---------------------------------------------------------------------------*/
#include "cimlib.h" /* Library header */
/* -----------------------------------------------------------------------------
* Exported functions
* ---------------------------------------------------------------------------*/
/*******************************************************************************
* This function calculates by element addition of vector with constant,
* 32 bit complex, result is with saturation control.
*
* @param[out] pY Pointer to output vector, 32 bit complex.
* @param[in] len Vector length.
* @param[in] pX Pointer to input vector, 32 bit complex.
* @param[in] cnst Constant, 32 bit complex.
******************************************************************************/
void vec_add_const_sat_c32(cint32_t *pY, int len, const cint32_t *pX,
cint32_t cnst)
{
int n;
int64_t re, im;
int32_t cnst_re, cnst_im;
cnst_re = cnst.re;
cnst_im = cnst.im;
for (n = 0; n < len; n++) {
re = (int64_t)pX[n].re + cnst_re;
im = (int64_t)pX[n].im + cnst_im;
CIMLIB_SAT_INT(re, INT32_MAX, re);
CIMLIB_SAT_INT(im, INT32_MAX, im);
pY[n].re = (int32_t)re;
pY[n].im = (int32_t)im;
}
}
#if (CIMLIB_BUILD_TEST == 1)
/* Simplify macroses for fixed radix */
#define RADIX (28)
#define CONST(X) CIMLIB_CONST_S32(X, RADIX)
#define CONST_CPLX(RE, IM) CIMLIB_CONST_C32(RE, IM, RADIX)
/*******************************************************************************
* This function tests 'vec_add_const_sat_c32' function. Returns 'true' if
* validation is successfully done, 'false' - otherwise
******************************************************************************/
bool test_vec_add_const_sat_c32(void)
{
cint32_t y[4];
static cint32_t cnst = CONST_CPLX(5.0, -7.0);
static cint32_t x[4] = {
CONST_CPLX(2.1, -1.0),
CONST_CPLX(-5.0, 7.0),
CONST_CPLX(-5.6, 3.001),
CONST_CPLX(3.14, -1.0)
};
static cint32_t res[4] = {
{CONST(7.1), INT32_MIN},
CONST_CPLX(0.0, 0.0),
CONST_CPLX(-0.6, -3.999),
{INT32_MAX, INT32_MIN}
};
bool flOk = true;
/* Call 'vec_add_const_sat_c32' function */
vec_add_const_sat_c32(y, 4, x, cnst);
/* Check the correctness of the result */
TEST_LIBS_CHECK_RES_CPLX(y, res, 4, flOk);
return flOk;
}
#endif /* (CIMLIB_BUILD_TEST == 1) */
| 34.088889 | 82 | 0.434485 |
8017ed133a9ea150f8db3d4b4f1913d5b67b4834 | 4,475 | lua | Lua | src/utils/utilsFunc.lua | kingbuffalo/skynet | 2260d3c4db107b844661e4e7c46fd258fafe13f2 | [
"MIT"
] | null | null | null | src/utils/utilsFunc.lua | kingbuffalo/skynet | 2260d3c4db107b844661e4e7c46fd258fafe13f2 | [
"MIT"
] | null | null | null | src/utils/utilsFunc.lua | kingbuffalo/skynet | 2260d3c4db107b844661e4e7c46fd258fafe13f2 | [
"MIT"
] | null | null | null | local M = {}
local string=string
local math=math
local e_range=1.7182
function M.getLnV(base,max,cv)
local tw = max-base
local w = cv-base
local ev = w/tw * e_range
local er = math.log(ev+1)
return er * tw + base
end
function M.string_split(str,sep)
local t = {}
local p = string.format("([^%s]+)",sep)
string.gsub(str,p,function(c)t[#t+1]=c end)
return t
end
function M.getBleedEff(mb,cb,v)
local ev = cb/mb
local er = math.sqrt(ev)
return er * mb * v
end
function M.getSqrtVPer(base,max,cv)
local tw = max-base
local w = cv-base
local ev = w/tw
local er = math.sqrt(ev)
return er * tw + base
end
function M.getIntV(base,max,cv)
return math.floor(M.getSqrtVPer(base,max,cv))
end
function M.indexOf(arr,value)
for i, v in ipairs( arr ) do
if v==value then return i end
end
return -1
end
--取打乱的数值数组
local randomCache = {}
function M.genRandomArry( size )
for i=1, size do
randomCache[i] = i
end
local r
local random = math.random
for i=2, size do
r = random(1,i)
randomCache[i], randomCache[r] = randomCache[r], randomCache[i]
end
randomCache[size + 1] = nil
return randomCache
end
function M.getCallStack(name)
local strT = {name}
local startLevel = 2
local maxLevel = 100
for level = startLevel, maxLevel do
local info = debug.getinfo( level, "nSl" )
if info == nil then break end
if info.currentline > 0 then
strT[#strT+1] = string.format("[ line : %-4d ] %-20s :: %s", info.currentline, info.name or "", info.source or "" )
end
end
return table.concat(strT,"\n")
end
function M.printTable(t)
local serpent = require("utils.serpent")
print(serpent.block(t))
end
function M.printCallStack(name)
local str = M.getCallStack(name)
print(str)
end
-- 判断utf8字符byte长度
-- 0xxxxxxx - 1 byte
-- 110yxxxx - 192, 2 byte
-- 1110yyyy - 225, 3 byte
-- 11110zzz - 240, 4 byte
local function chsize(char)
if not char then return 0,0 end
if char >= 252 then return 6,2 end
if char >= 248 then return 5,2 end
if char >= 240 then return 4,2 end
if char >= 225 then return 3,2 end
if char >= 192 then return 2,2 end
return 1,1
end
-- 计算utf8字符串字符数, 各种字符都按一个字符计算
-- -- 例如utf8len("1你好") => 3
function M.utf8len(str)
local len = 0
local currentIndex = 1
while currentIndex <= #str do
local char = string.byte(str, currentIndex)
currentIndex = currentIndex + chsize(char)
len = len +1
end
return len
end
-- 截取utf8 字符串
-- str:utf8要截取的字符串
-- startChar:startChar开始字符下标,从1开始
-- numChars:numChars要截取的字符长度
function M.utf8sub(str, startChar, numChars)
local startIndex = 1
while startChar > 1 do
local char = string.byte(str, startIndex)
startIndex = startIndex + chsize(char)
startChar = startChar - 1
end
local currentIndex = startIndex
while numChars > 0 and currentIndex <= #str do
local char = string.byte(str, currentIndex)
currentIndex = currentIndex + chsize(char)
numChars = numChars -1
end
return str:sub(startIndex, currentIndex - 1)
end
--认为utf8字符长度为2
--ascii字符长度为1
--字符串长度
function M.utf82_ascii1_len(str)
local len = 0
local currentIndex = 1
while currentIndex <= #str do
local char = string.byte(str, currentIndex)
local size,clen = chsize(char)
currentIndex = currentIndex + size
len = len + clen
end
return len
end
--认为utf8字符长度为2
--ascii字符长度为1
--字符串长度
function M.utf82_ascii1_sub(str, startChar, numChars)
local startIndex = 1
while startChar > 1 do
local char = string.byte(str, startIndex)
startIndex = startIndex + chsize(char)
startChar = startChar - 1
end
local currentIndex = startIndex
while numChars > 0 and currentIndex <= #str do
local char = string.byte(str, currentIndex)
local size,len = chsize(char)
currentIndex = currentIndex + size
numChars = numChars - len
end
return str:sub(startIndex, currentIndex - 1)
end
--如果没有找到,则找到比cmpFunc最小的那个的位置数
function M.bSearch(arr,cmpFunc)
local left = 1
local right = #arr
local mid = (left+right)//2
while(left <= right) do
mid = (left+right)//2
local cmpRet = cmpFunc(arr[mid])
if cmpRet == -1 then
left = mid + 1
elseif cmpRet == 1 then
right = mid - 1
else
return mid
end
end
return mid
end
function M.forEver(timeout,func,...)
local function f(...)
local skynet = require "skynet"
skynet.timeout(timeout,f)
func(...)
end
f(...)
end
return M
| 21.936275 | 120 | 0.664804 |
2a3d489026d4e1d16de5022cad79d13ed4b5c59d | 8,716 | java | Java | envs/se/src/test/java/io/astefanutti/metrics/cdi/se/ExceptionMeteredMethodBeanTest.java | cchacin/metrics-cdi | 97349f8294bcc246df368d5cb3ff5efaabd915a1 | [
"Apache-2.0"
] | null | null | null | envs/se/src/test/java/io/astefanutti/metrics/cdi/se/ExceptionMeteredMethodBeanTest.java | cchacin/metrics-cdi | 97349f8294bcc246df368d5cb3ff5efaabd915a1 | [
"Apache-2.0"
] | null | null | null | envs/se/src/test/java/io/astefanutti/metrics/cdi/se/ExceptionMeteredMethodBeanTest.java | cchacin/metrics-cdi | 97349f8294bcc246df368d5cb3ff5efaabd915a1 | [
"Apache-2.0"
] | null | null | null | /**
* Copyright (C) 2013 Antonin Stefanutti (antonin.stefanutti@gmail.com)
*
* 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 io.astefanutti.metrics.cdi.se;
import com.codahale.metrics.Meter;
import com.codahale.metrics.MetricRegistry;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import io.astefanutti.metrics.cdi.MetricsExtension;
import io.astefanutti.metrics.cdi.se.util.MetricsUtil;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
@RunWith(Arquillian.class)
public class ExceptionMeteredMethodBeanTest {
private final static String[] METER_NAMES = {"illegalArgumentExceptionMeteredMethod", "exceptionMeteredMethod"};
private final static AtomicLong[] METER_COUNTS = {new AtomicLong(), new AtomicLong()};
private Set<String> absoluteMetricNames() {
return MetricsUtil.absoluteMetricNames(ExceptionMeteredMethodBean.class, METER_NAMES);
}
private static String absoluteMetricName(int index) {
return MetricsUtil.absoluteMetricName(ExceptionMeteredMethodBean.class, METER_NAMES[index]);
}
@Deployment
public static Archive<?> createTestArchive() {
return ShrinkWrap.create(JavaArchive.class)
// Test bean
.addClass(ExceptionMeteredMethodBean.class)
// Metrics CDI extension
.addPackage(MetricsExtension.class.getPackage())
// Bean archive deployment descriptor
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Inject
private MetricRegistry registry;
@Inject
private ExceptionMeteredMethodBean bean;
@Test
@InSequence(1)
public void callExceptionMeteredMethodsOnceWithoutThrowing() {
assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames())));
Runnable runnableThatDoesNoThrowExceptions = new Runnable() {
@Override
public void run() {
}
};
// Call the metered methods and assert they haven't been marked
bean.illegalArgumentExceptionMeteredMethod(runnableThatDoesNoThrowExceptions);
bean.exceptionMeteredMethod(runnableThatDoesNoThrowExceptions);
assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(0)).getCount(), is(equalTo(METER_COUNTS[0].get())));
assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(1)).getCount(), is(equalTo(METER_COUNTS[1].get())));
}
@Test
@InSequence(2)
public void callExceptionMeteredMethodOnceWithThrowingExpectedException() {
assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames())));
final RuntimeException exception = new IllegalArgumentException("message");
Runnable runnableThatThrowsIllegalArgumentException = new Runnable() {
@Override
public void run() {
throw exception;
}
};
try {
// Call the metered method and assert it's been marked and that the original exception has been rethrown
bean.illegalArgumentExceptionMeteredMethod(runnableThatThrowsIllegalArgumentException);
fail("No exception has been re-thrown!");
} catch (RuntimeException cause) {
assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(0)).getCount(), is(equalTo(METER_COUNTS[0].incrementAndGet())));
assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(1)).getCount(), is(equalTo(METER_COUNTS[1].get())));
assertSame("Exception thrown is incorrect", cause, exception);
}
}
@Test
@InSequence(3)
public void callExceptionMeteredMethodOnceWithThrowingNonExpectedException() {
assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames())));
final RuntimeException exception = new IllegalStateException("message");
Runnable runnableThatThrowsIllegalStateException = new Runnable() {
@Override
public void run() {
throw exception;
}
};
try {
// Call the metered method and assert it hasn't been marked and that the original exception has been rethrown
bean.illegalArgumentExceptionMeteredMethod(runnableThatThrowsIllegalStateException);
fail("No exception has been re-thrown!");
} catch (RuntimeException cause) {
assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(0)).getCount(), is(equalTo(METER_COUNTS[0].get())));
assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(1)).getCount(), is(equalTo(METER_COUNTS[1].get())));
assertSame("Exception thrown is incorrect", cause, exception);
}
}
@Test
@InSequence(4)
public void callExceptionMeteredMethodOnceWithThrowingInstanceOfExpectedException() {
assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames())));
final RuntimeException exception = new IllegalStateException("message");
Runnable runnableThatThrowsIllegalStateException = new Runnable() {
@Override
public void run() {
throw exception;
}
};
try {
// Call the metered method and assert it's been marked and that the original exception has been rethrown
bean.exceptionMeteredMethod(runnableThatThrowsIllegalStateException);
fail("No exception has been re-thrown!");
} catch (RuntimeException cause) {
assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames())));
assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(0)).getCount(), is(equalTo(METER_COUNTS[0].get())));
assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(1)).getCount(), is(equalTo(METER_COUNTS[1].incrementAndGet())));
assertSame("Exception thrown is incorrect", cause, exception);
}
}
@Test
@InSequence(5)
public void removeMeterFromRegistry() {
assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames())));
Meter meter = registry.getMeters().get(absoluteMetricName(0));
// Remove the meter from metrics registry
registry.remove(absoluteMetricName(0));
final RuntimeException exception = new IllegalArgumentException("message");
Runnable runnableThatThrowsIllegalArgumentException = new Runnable() {
@Override
public void run() {
throw exception;
}
};
try {
// Call the metered method and assert an exception is thrown
bean.illegalArgumentExceptionMeteredMethod(runnableThatThrowsIllegalArgumentException);
fail("No exception has been re-thrown!");
} catch (RuntimeException cause) {
assertThat(cause, is(instanceOf(IllegalStateException.class)));
assertThat(cause.getMessage(), is(equalTo("No meter with name [" + absoluteMetricName(0) + "] found in registry [" + registry + "]")));
// Make sure that the meter hasn't been marked
assertThat("Meter count is incorrect", meter.getCount(), is(equalTo(METER_COUNTS[0].get())));
}
}
} | 44.697436 | 159 | 0.693552 |
6d6e2f1d170bf3939ff27d4179cba96566675538 | 3,602 | cs | C# | Factory/Migrations/FactoryContextModelSnapshot.cs | JTSkelton/Factory.Solution | a8f7d839c3df94fcb7ba4433bc461cc7c2a90f6e | [
"MIT"
] | null | null | null | Factory/Migrations/FactoryContextModelSnapshot.cs | JTSkelton/Factory.Solution | a8f7d839c3df94fcb7ba4433bc461cc7c2a90f6e | [
"MIT"
] | null | null | null | Factory/Migrations/FactoryContextModelSnapshot.cs | JTSkelton/Factory.Solution | a8f7d839c3df94fcb7ba4433bc461cc7c2a90f6e | [
"MIT"
] | null | null | null | // <auto-generated />
using Factory.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Factory.Migrations
{
[DbContext(typeof(FactoryContext))]
partial class FactoryContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.0");
modelBuilder.Entity("Factory.Models.Engineer", b =>
{
b.Property<int>("EngineerId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("Age")
.HasColumnType("int");
b.Property<string>("EngineerName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("EngineerId");
b.ToTable("Engineers");
});
modelBuilder.Entity("Factory.Models.EngineerMachiens", b =>
{
b.Property<int>("EngineerMachiensId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("EngineerId")
.HasColumnType("int");
b.Property<int>("MachienId")
.HasColumnType("int");
b.HasKey("EngineerMachiensId");
b.HasIndex("EngineerId");
b.HasIndex("MachienId");
b.ToTable("EngineerMachiens");
});
modelBuilder.Entity("Factory.Models.Machien", b =>
{
b.Property<int>("MachienId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("EngineerId")
.HasColumnType("int");
b.Property<string>("MachienName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("MachienId");
b.ToTable("Machiens");
});
modelBuilder.Entity("Factory.Models.EngineerMachiens", b =>
{
b.HasOne("Factory.Models.Engineer", "Engineers")
.WithMany("JoinEntities")
.HasForeignKey("EngineerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Factory.Models.Machien", "Machiens")
.WithMany("JoinEntities")
.HasForeignKey("MachienId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Engineers");
b.Navigation("Machiens");
});
modelBuilder.Entity("Factory.Models.Engineer", b =>
{
b.Navigation("JoinEntities");
});
modelBuilder.Entity("Factory.Models.Machien", b =>
{
b.Navigation("JoinEntities");
});
#pragma warning restore 612, 618
}
}
}
| 33.045872 | 73 | 0.475569 |