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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
add1c97f15588a21555c79c9cd533f0b9b72b033 | 2,397 | dart | Dart | lib/src/model/generated/MailProxy.dart | InterNetX/dart-domainrobot-sdk | 5d27966d9b124117250bf4c8d586679b6653b261 | [
"MIT"
] | 1 | 2020-03-13T08:57:26.000Z | 2020-03-13T08:57:26.000Z | lib/src/model/generated/MailProxy.dart | InterNetX/dart-domainrobot-sdk | 5d27966d9b124117250bf4c8d586679b6653b261 | [
"MIT"
] | 4 | 2019-11-21T10:33:37.000Z | 2020-06-05T08:19:58.000Z | lib/src/model/generated/MailProxy.dart | InterNetX/dart-domainrobot-sdk | 5d27966d9b124117250bf4c8d586679b6653b261 | [
"MIT"
] | 3 | 2019-11-21T20:35:02.000Z | 2020-03-19T11:24:36.000Z | import 'package:json_annotation/json_annotation.dart';
import 'BasicUser.dart';
import 'MailList.dart';
import 'ProtectionConstants.dart';
import 'SpamPolicy.dart';
part 'MailProxy.g.dart';
@JsonSerializable(includeIfNull: false, explicitToJson: true)
class MailProxy {
/// The domain of the mail exchange to backup
String domain;
/// The idn version of the domain.
String idn;
/// The date of the creation
DateTime created;
/// The date of the last updated
DateTime updated;
/// The owner of the entry
BasicUser owner;
/// The last updater of the entry
BasicUser updater;
/// The hostname of the target mailserver
String target;
/// email address of the administrator
String admin;
/// The protection level
ProtectionConstants protection;
/// The grey listing policy
bool greylisting;
/// The virus options to use
String virus;
//enum virusEnum { DISABLED, QUARANTINE, DISCARD, ACCEPT, };
/// The banned files options to use
String bannedFiles;
//enum bannedFilesEnum { DISABLED, QUARANTINE, DISCARD, ACCEPT, };
/// The mail header options to use
String header;
//enum headerEnum { DISABLED, QUARANTINE, DISCARD, ACCEPT, };
/// The spam policy options
SpamPolicy spam;
/// The white listed email addresses
MailList whitelist;
/// The black listed email addresses
MailList blacklist;
/// The exculded listed email addresses
MailList excludelist;
MailProxy({
this.domain,
this.idn,
this.created,
this.updated,
this.owner,
this.updater,
this.target,
this.admin,
this.protection,
this.greylisting,
this.virus,
this.bannedFiles,
this.header,
this.spam,
this.whitelist,
this.blacklist,
this.excludelist,
});
@override
String toString() {
return 'MailProxy[domain=$domain, idn=$idn, created=$created, updated=$updated, owner=$owner, updater=$updater, target=$target, admin=$admin, protection=$protection, greylisting=$greylisting, virus=$virus, bannedFiles=$bannedFiles, header=$header, spam=$spam, whitelist=$whitelist, blacklist=$blacklist, excludelist=$excludelist, ]';
}
///
/// Json to Location object
///
factory MailProxy.fromJson(Map<String, dynamic> json) =>
_$MailProxyFromJson(json);
///
/// Location object to json
///
Map<String, dynamic> toJson() => _$MailProxyToJson(this);
}
| 24.459184 | 337 | 0.692532 |
bc91b5fd085c71bfed15d9328970d2c694382a78 | 54 | sql | SQL | lancamentos-api/src/main/resources/db/migration/V12__add_column_attachment_tb_launch.sql | brunocesaromax/lancamentos-api | 1263751c0513c520d37893fac0d40fdc9dee43a4 | [
"MIT"
] | null | null | null | lancamentos-api/src/main/resources/db/migration/V12__add_column_attachment_tb_launch.sql | brunocesaromax/lancamentos-api | 1263751c0513c520d37893fac0d40fdc9dee43a4 | [
"MIT"
] | 18 | 2020-09-07T21:57:23.000Z | 2022-03-02T10:07:27.000Z | lancamentos-api/src/main/resources/db/migration/V12__add_column_attachment_tb_launch.sql | brunocesaromax/lancamentos-api | 1263751c0513c520d37893fac0d40fdc9dee43a4 | [
"MIT"
] | null | null | null | alter table launch add column attachment varchar(200); | 54 | 54 | 0.833333 |
a1fbeb15d54f66429bb1899fad8f0b23d474d6e6 | 55 | h | C | apps/bare-expo/ios/Pods/Headers/Public/Flipper-Folly/folly/portability/Dirent.h | scribendy/expo | 42300cfb3fc53a436e670e7461873bfdc6da0d95 | [
"Apache-2.0",
"MIT"
] | 186 | 2018-12-19T04:08:39.000Z | 2022-03-18T15:37:30.000Z | ios/Pods/Headers/Public/Flipper-Folly/folly/portability/Dirent.h | AkashSarkar/react-native-message-toast | 77bc7de5a5975a252b910dca760cb9ff360cee35 | [
"MIT"
] | 160 | 2017-12-11T17:33:54.000Z | 2021-09-02T09:56:38.000Z | ios/Pods/Headers/Public/Flipper-Folly/folly/portability/Dirent.h | AkashSarkar/react-native-message-toast | 77bc7de5a5975a252b910dca760cb9ff360cee35 | [
"MIT"
] | 43 | 2017-12-10T21:39:06.000Z | 2021-03-20T19:40:03.000Z | ../../../../../Flipper-Folly/folly/portability/Dirent.h | 55 | 55 | 0.636364 |
7443766ef266e88201180f7681545cf75230bb5d | 2,651 | html | HTML | about.html | benliu1130/benliu1130.github.io | b5bbaf4e65afd384672cc010211a8db44c088230 | [
"CC-BY-3.0"
] | null | null | null | about.html | benliu1130/benliu1130.github.io | b5bbaf4e65afd384672cc010211a8db44c088230 | [
"CC-BY-3.0"
] | null | null | null | about.html | benliu1130/benliu1130.github.io | b5bbaf4e65afd384672cc010211a8db44c088230 | [
"CC-BY-3.0"
] | null | null | null | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content="Wei-Ming Liu" />
<meta name="keywords" content="Wei-Ming Liu,weiming" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Wei-Ming Liu's Home Page</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="container">
<div id="header"><div id="logo"><a href="index.html">Wei-Ming Liu's Home Page</a></div>
<div id="slogan"><br/></div></div>
<div id="header_menu">
<a href="index.html">Home</a> |
<a href="about.html">About Me</a> |
<a href="projects.html">My Projects</a> |
<a href="contact.html">Contact</a>
</div>
<div id="main" class="main_no_sidebar">
<div id="text" class="text_no_sidebar">
<br/>
<p>I was born in 1978 at Tainan, a peaceful city in southern Taiwan. Since both my parents were teachers, they have very high expectation on me. Therefore I studied very hard in my childhood and teenage.</p>
<p>Finally, I got admission from National Taiwan University, the best university in Taiwan. I decided to major in Electrical Engineering because the electronic industry in Taiwan was booming at that time.</p>
<p>After I graduated, I worked as an IC designer in <a href="https://www.holtek.com" target="_blank">Holtek Semiconductor Inc.</a>. Later I became a field application engineer, where my social skill was improved through communication with customers. Gradually I found my passion in coding and I made up my mind to become a software engineer.</p>
<p>Later I got admission from University of Southern California. Since I heard that the school is tough and my undergraduate major is not computer-related, I worried that I had no sufficient knowledge to survive there. Therefore I went to <a href="http://www.callutheran.edu" target="_blank">California Lutheran University</a> to study Computer Science first. Later I went to University of Southern California, where I really enjoy the courses. At that time I am especially fond of gaming, computer graphics, and multimedia.</p>
</div>
</div>
<div id="footer_menu"><a href="index.html">Home</a> | <a href="about.html">About Me</a> | <a href="projects.html">My Projects</a> | <a href="resume.html">Resume</a> | <a href="contact.html">Contact</a></div>
<div id="footer">Copyright 2009 Your Website. Design by <a href="http://www.ondieting.co.uk/">On Dieting</a>.</div>
</div>
<noscript/>
</body>
</html>
| 75.742857 | 529 | 0.718597 |
4a808e6113303c13a6bdddd89ce9841334d73c1c | 3,501 | html | HTML | bin/views/chart.scala.html | Ugne/HttpRequestWithPlay | bd087690d991cc7249793466fef32830a2765d7d | [
"Apache-2.0"
] | null | null | null | bin/views/chart.scala.html | Ugne/HttpRequestWithPlay | bd087690d991cc7249793466fef32830a2765d7d | [
"Apache-2.0"
] | null | null | null | bin/views/chart.scala.html | Ugne/HttpRequestWithPlay | bd087690d991cc7249793466fef32830a2765d7d | [
"Apache-2.0"
] | null | null | null | @(form: Form[ChartForm], currencies: List[EnCurrencyItem], exchangeRates: ExchangeRates)
@main("Currency rate chart") {
<div class="container" style="padding-top: 15px; padding-bottom: 15px;">
@helper.form(action = routes.CurrencyRateChartController.getData(), 'id -> "chartForm") {
<div style="display:table; margin: 0 auto;">
<div class="form-group">
<span class="label label-danger"></span>
<div class='input-group date datepicker' style="width: 300px;">
<input type='text' class="form-control app-date-from" name='@form("dateFrom").name' value='@form("dateFrom").value' placeholder="Date from..."/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="form-group">
<span class="label label-danger"></span>
<div class='input-group date datepicker' style="width: 300px;">
<input type='text' class="form-control app-date-to" name='@form("dateTo").name' value='@form("dateTo").value' placeholder="Date to..."/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<script type="text/javascript">
$(function () {
$('.datepicker').datetimepicker({
format: 'YYYY-MM-DD'
});
});
</script>
<span class="label label-danger"></span>
<div class="form-group">
<select class="selectpicker" data-live-search="true" data-width="300" name="@form("currency").name">
<option data-hidden="true" value="">Choose currency...</option>
@for(currency <- currencies){
<option value="@currency.getCurrency" @(if(currency.getCurrency.equals(form("currency").value)) "selected")>@currency.getDescription</option>
}
</select>
</div>
<div class="form-group">
<button id="app-get-chart" type="submit" class="btn btn-primary" style="width: 150px;">Show chart</button>
</div>
</div>
}
@if(flash.get("error") != null){
<div class="alert alert-danger">@flash.get("error")</div>
}
@if(!exchangeRates.getExchangeRates().isEmpty()){
<div>
<canvas id="myChart"></canvas>
</div>
<script type="text/javascript">
var currency = "@exchangeRates.getExchangeRates().get(0).getCurrency() Currency rate statistics (@exchangeRates.getExchangeRates().get(0).getUnit())";
var dates = [];
var rates = [];
@for(item <- exchangeRates.getExchangeRates()){
dates.push("@item.getDate()");
rates.push(@item.getRate());
}
var data = {
labels: dates,
datasets: [
{
label: currency,
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: rates
}
]
};
var ctx = document.getElementById("myChart").getContext("2d");
var myLineChart = Chart.Line(ctx, {
data: data,
responsive: true
});
</script>
}
</div>
}
| 40.709302 | 164 | 0.54413 |
9ce2cdb7c96f0f2b2b7841b88675ee55797fefaa | 2,996 | ps1 | PowerShell | PowerShell/sql-perfmon.ps1 | reubensultana/DBAScripts | 5ffae3a1d46bd72aae0cc390c16d8a888fe58928 | [
"MIT"
] | 2 | 2021-11-12T13:22:47.000Z | 2022-03-04T09:33:47.000Z | PowerShell/sql-perfmon.ps1 | reubensultana/DBAScripts | 5ffae3a1d46bd72aae0cc390c16d8a888fe58928 | [
"MIT"
] | null | null | null | PowerShell/sql-perfmon.ps1 | reubensultana/DBAScripts | 5ffae3a1d46bd72aae0cc390c16d8a888fe58928 | [
"MIT"
] | 2 | 2018-11-23T18:12:44.000Z | 2020-10-12T05:50:23.000Z | <#
.SYNOPSIS
Collect counters required for SQL Server Performance Monitoring and log as CSV.
.DESCRIPTION
Collect counters required for SQL Server Performance Monitoring and log as CSV.
Default log file location is C:\TEMP\sql-perfmon_yyyyMMddHHmmss.csv.
Counters are collected at 1 second intervals for 1 hour or 3600 seconds.
No support or warranty is supplied or inferred.
Use at your own risk.
.PARAMETER DestinationFolder
Location where the output file will be saved. The default is "C:\TEMP"
.PARAMETER MaxSamples
Specifies the number of samples to get from each counter. The default is 1 sample.
.PARAMETER SampleInterval
Specifies the time between samples in seconds. The minimum value is 1 second and the default value is 1 hour (3600 seconds).
.INPUTS
Parameters above.
.OUTPUTS
None.
.NOTES
Version: 1.0
Creation Date: May 1, 2015
Modified Date: June 17, 2016
Author: Justin Henriksen ( http://justinhenriksen.wordpress.com )
Version: 1.1
Modified Date: June 08, 2017
Author: Reuben Sultana ( http://reubensultana.com )
#>
param([String]$DestinationFolder = 'C:\Temp\',
[int32]$SampleInterval = 1,
[int32]$MaxSamples = 3600
)
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force
$ErrorActionPreference = "Stop"
$VerbosePreference = "Continue"
# NOTE: Counter names MUST be exact otherwise it won't work
$counters = @(
"\Memory\Available MBytes",
"\PhysicalDisk(_Total)\Avg. Disk sec/Read",
"\PhysicalDisk(_Total)\Avg. Disk sec/Write",
"\PhysicalDisk(_Total)\Disk Reads/sec",
"\PhysicalDisk(_Total)\Disk Writes/sec",
"\PhysicalDisk(1 L:)\Avg. Disk sec/Read",
"\PhysicalDisk(1 L:)\Avg. Disk sec/Write",
"\PhysicalDisk(1 L:)\Disk Reads/sec",
"\PhysicalDisk(1 L:)\Disk Writes/sec",
"\PhysicalDisk(2 S:)\Avg. Disk sec/Read",
"\PhysicalDisk(2 S:)\Avg. Disk sec/Write",
"\PhysicalDisk(2 S:)\Disk Reads/sec",
"\PhysicalDisk(2 S:)\Disk Writes/sec",
"\Processor(_Total)\% Processor Time",
"\SQLServer:General Statistics\User Connections",
"\SQLServer:Memory Manager\Memory Grants Pending",
"\SQLServer:SQL Statistics\Batch Requests/sec",
"\SQLServer:SQL Statistics\SQL Compilations/sec",
"\SQLServer:SQL Statistics\SQL Re-compilations/sec",
"\System\Processor Queue Length"
)
$FileName = "sql-perfmon_$(Get-Date -f "yyyyMMddHHmmss")"
$FileExtension = "csv"
if (Test-Path $DestinationFolder) {
Clear-Host
Write-Output "Collecting counters..."
Write-Output "Press Ctrl+C to exit."
$FilePath = $DestinationFolder + $FileName + "." + $FileExtension
try {
Get-Counter -Counter $counters -SampleInterval $SampleInterval -MaxSamples $MaxSamples |
Export-Counter -FileFormat $FileExtension -Path $FilePath -Force
}
catch {
Clear-Host
Write-Warning "Could not start collection for specified counters"
}
}
| 30.262626 | 128 | 0.69259 |
ddf14296ed25c59450479e20e1349ba9791d826c | 345 | sql | SQL | Affinity Group DOQL/connections_in_past_60_days.sql | device42/DOQL_scripts_examples | 55cdf3868768cb4f609011575b1051d7a69c19c5 | [
"Apache-2.0"
] | 7 | 2017-10-25T13:54:18.000Z | 2022-01-25T16:16:53.000Z | Affinity Group DOQL/connections_in_past_60_days.sql | dino-D42/DOQL_scripts_examples | 6ccb2dbecafb26c9dde7627968c3ea572bfb144a | [
"Apache-2.0"
] | 2 | 2018-11-19T18:17:35.000Z | 2020-10-09T19:38:53.000Z | Affinity Group DOQL/connections_in_past_60_days.sql | dino-D42/DOQL_scripts_examples | 6ccb2dbecafb26c9dde7627968c3ea572bfb144a | [
"Apache-2.0"
] | 6 | 2018-10-18T14:39:08.000Z | 2021-04-15T19:06:01.000Z | /*Include connections up to 60 days*/
select * from view_affinity_dependency_data_v1
where family(listener_ip) <> 6 and listener_ip <> '::1' and listener_ip <> '127.0.0.1' and listener_service_topology_status <> 3 and client_service_topology_status <> 3 and date_part('day', now() :: timestamp - client_connection_last_found :: timestamp) <= 60; | 115 | 260 | 0.765217 |
12f3a1e8fb39e8ac9cf1fc1c05f5b2975286724f | 39,341 | html | HTML | index.html | pt-generator/generator | 2229a85194e4309675437df1ae3b4e3d3b99ce46 | [
"MIT"
] | 8 | 2018-05-06T23:02:46.000Z | 2021-12-20T01:21:46.000Z | index.html | pt-generator/generator | 2229a85194e4309675437df1ae3b4e3d3b99ce46 | [
"MIT"
] | 5 | 2021-02-24T09:29:36.000Z | 2021-02-24T09:47:08.000Z | index.html | pt-generator/generator | 2229a85194e4309675437df1ae3b4e3d3b99ce46 | [
"MIT"
] | 2 | 2021-02-03T23:48:30.000Z | 2021-09-06T03:05:50.000Z | <!DOCTYPE html>
<html xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml" class="oneezy">
<head>
<title>Profit Trailer Settings Generator</title>
<meta name="description" content="Profit Trailer Settings Generator">
<meta name="keywords" content="Crypto Bot, Crypto Trading Bot, Profit Trailer Settings, PT Settings">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<!-- <meta name="google-site-verification" content=""> -->
<link rel="canonical" href="https://www.pt-settings/index.html">
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="180x180" href="images/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="images/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/icons/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="images/icons/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="images/icons/mstile-144x144.png">
<meta name="theme-color" content="#ff9900">
<!-- FACESPACE -->
<meta property="og:site_name" content="Profit Trailer Settings Generator" />
<meta property="og:url" content="https://oneezy.github.io/wwwPT/dist/index.html" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Generator | Profit Trailer Settings" />
<meta property="og:description" content="Profit Trailer Settings Generator." />
<meta property="og:image" content="https://raw.githubusercontent.com/oneezy/wwwPT/master/dist/images/social/01.png" />
<!-- build:css css/styles.min.css -->
<link rel="stylesheet" href="css/theme.css">
<link rel="stylesheet" href="css/style.css">
<!-- endbuild -->
</head>
<body class="flex-vertical">
<header class="mdc-toolbar mdc-toolbar--fixed mdc-toolbar--waterfall mdc-toolbar--flexible-space-maximized">
<div class="mdc-toolbar__row toolbar-primary">
<!-- Left -->
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<a href="#" class="material-icons mdc-toolbar__menu-icon">menu</a>
<span class="mdc-toolbar__title">PT Generator</span>
</section>
<!-- Right -->
<section class="mdc-toolbar__section mdc-toolbar__section--align-end" role="toolbar">
<a href="#" class="material-icons mdc-toolbar__icon" aria-label="Download" alt="Download">favorite</a>
<a href="#" class="material-icons mdc-toolbar__icon" aria-label="Print this page" alt="Print this page">print</a>
<a href="#" class="material-icons mdc-toolbar__icon toggle" aria-label="More" alt="More">more_vert</a>
</section>
</div>
<!--
<div class="mdc-toolbar__row toolbar-secondary">
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<a href="#" class="material-icons mdc-toolbar__menu-icon">dashboard</a>
</section>
<section class="mdc-toolbar__section mdc-toolbar__section--align-end" role="toolbar">
<a href="#" class="material-icons mdc-toolbar__menu-icon">code</a>
<a href="#" class="material-icons mdc-toolbar__menu-icon">dashboard</a>
<a href="#" class="material-icons mdc-toolbar__menu-icon">color_lens</a>
</section>
</div> -->
</header>
<main class="flex-vertical container mdc-toolbar-fixed-adjust">
<!-- Code
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<article class="flex-vertical flex-1 code">
<section class="flex-horizontal between-between code-wrapper">
<!-- Application
************************************************* -->
<div class="flex-1 code-container">
<code id="applicationFile" class="code-bg"
sheetsu="https://sheetsu.com/apis/v1.0su/56041bc9dd90"
sheetsu-sheet="application">
<pre><span><b class="code-key">{{codeKEY}}</b><i class="code-equal"> = </i><span class="code-value" data-bind="{{inputID}}">{{codeVALUE}}</span></span></pre>
</code>
<!-- Copy All -->
<button class="mdc-fab mini-fab material-icons" aria-label="content_copy">
<div data-clipboard data-clipboard-target="#applicationFile">
<span class="mdc-fab__icon">
content_copy
</span>
</div>
</button>
</div>
<!-- Configuration
************************************************* -->
<div class="flex-1 code-container">
<code id="configurationFile" class="code-bg"
sheetsu="https://sheetsu.com/apis/v1.0su/4533392909a5"
sheetsu-sheet="configuration">
<pre><span><b class="code-key">{{codeKEY}}</b><i class="code-equal"> = </i><span class="code-value" data-bind="{{inputID}}">{{codeVALUE}}</span></span></pre>
</code>
<!-- Copy All -->
<button class="mdc-fab mini-fab material-icons" aria-label="content_copy">
<div data-clipboard data-clipboard-target="#configurationFile">
<span class="mdc-fab__icon">
content_copy
</span>
</div>
</button>
</div>
<!-- Pairs
************************************************* -->
<div class="flex-1 code-container">
<code id="pairsFile" class="code-bg"
sheetsu="https://sheetsu.com/apis/v1.0su/1abfbd1a79aa"
sheetsu-sheet="pairs">
<pre><span><b class="code-key">{{codeKEY}}</b><i class="code-equal"> = </i><span class="code-value" data-bind="{{inputID}}">{{codeVALUE}}</span></span></pre>
</code>
<!-- Copy All -->
<button class="mdc-fab mini-fab material-icons" aria-label="content_copy">
<div data-clipboard data-clipboard-target="#pairsFile">
<span class="mdc-fab__icon">
content_copy
</span>
</div>
</button>
</div>
<!-- DCA
************************************************* -->
<div class="flex-1 code-container">
<code id="dcaFile" class="code-bg"
sheetsu="https://sheetsu.com/apis/v1.0su/faf07152c388"
sheetsu-sheet="dca">
<pre><span><b class="code-key">{{codeKEY}}</b><i class="code-equal"> = </i><span class="code-value" data-bind="{{inputID}}">{{codeVALUE}}</span></span></pre>
</code>
<!-- Copy All -->
<button class="mdc-fab mini-fab material-icons" aria-label="content_copy">
<div data-clipboard data-clipboard-target="#dcaFile">
<span class="mdc-fab__icon">
content_copy
</span>
</div>
</button>
</div>
<!-- Indicators
************************************************* -->
<div class="flex-1 code-container">
<code id="indicatorsFile" class="code-bg"
sheetsu="https://sheetsu.com/apis/v1.0su/f53e6b048232"
sheetsu-sheet="indicators">
<pre><span><b class="code-key">{{codeKEY}}</b><i class="code-equal"> = </i><span class="code-value" data-bind="{{inputID}}">{{codeVALUE}}</span></span></pre>
</code>
<!-- Copy All -->
<button class="mdc-fab mini-fab material-icons" aria-label="content_copy">
<div data-clipboard data-clipboard-target="#indicatorsFile">
<span class="mdc-fab__icon">
content_copy
</span>
</div>
</button>
</div>
</section>
</article>
<!-- Controls
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<article class="flex-vertical flex-2 controls">
<section class="flex-horizontal controls-wrapper">
<!-- Application
************************************************* -->
<div class="mdc-list mdc-list--two-line mdc-list--avatar-list flex-1"
data-count
data-count--checked=".checked"
data-count--total=".total"
data-count--percent=".percent"
data-count--chart=".chart">
<!-- Accordion Button -->
<div class="mdc-list-item" data-mdc-auto-init="MDCRipple">
<span class="mdc-list-item__graphic" role="presentation">
<img class="material-icons" aria-hidden="true" src="images/icon-application.svg" alt="Profit Trailer Application">
</span>
<div class="flex-vertical between-stretch stats-container">
<!-- List Text -->
<div class="flex-horizontal between-base">
<h3 class="mdc-list-item__text">Application</h3>
<section class="mdc-list-item__secondary-text">
<span class="checked">0</span>
<span> of </span>
<span class="total">0</span>
</section>
</div>
<!-- List Chart -->
<div class="chart"></div>
</div>
<div class="mdc-list-item__meta percent">0</div>
</div>
<!-- Category Items -->
<nav class="custom-scrollbar"
sheetsu="https://sheetsu.com/apis/v1.0su/56041bc9dd90"
sheetsu-sheet="application">
<section>
<div data-form
data-wrapper--if="{{wrapperIF}}"
data-wrapper--init="{{wrapperINIT}}"
data-wrapper--class="{{wrapperCLASS}}"
data-input--type="{{inputTYPE}}"
data-input--id="{{inputID}}"
data-input--name="{{inputNAME}}"
data-input--autocomplete="{{inputAUTO}}"
data-input--min="{{inputMIN}}"
data-input--max="{{inputMAX}}"
data-input--step="{{inputSTEP}}"
data-input--value="{{inputVALUE}}"
data-input--aria="{{inputARIA}}"
data-input--checked="{{inputCHECKED}}"
data-input--required="{{inputREQUIRED}}"
data-input--disabled="{{inputDISABLED}}"
data-label--text="{{labelTEXT}}"
data-label--icon="{{labelICON}}"
data-message--text="{{messageTEXT}}"
data-message--class="{{messageCLASS}}">
</div>
</section>
</nav>
</div>
<!-- Configuration
************************************************* -->
<div class="mdc-list mdc-list--two-line mdc-list--avatar-list flex-1"
data-count
data-count--checked=".checked"
data-count--total=".total"
data-count--percent=".percent"
data-count--chart=".chart">
<!-- Accordion Button -->
<div class="mdc-list-item" data-mdc-auto-init="MDCRipple">
<span class="mdc-list-item__graphic" role="presentation">
<img class="material-icons" aria-hidden="true" src="images/icon-configuration.svg" alt="Profit Trailer Configuration">
</span>
<div class="flex-vertical between-stretch stats-container">
<!-- List Text -->
<div class="flex-horizontal between-base">
<h3 class="mdc-list-item__text">Configuration</h3>
<section class="mdc-list-item__secondary-text">
<span class="checked">0</span>
<span> of </span>
<span class="total">0</span>
</section>
</div>
<!-- List Chart -->
<div class="chart"></div>
</div>
<div class="mdc-list-item__meta percent">0</div>
</div>
<!-- Category Items -->
<nav class="custom-scrollbar"
sheetsu="https://sheetsu.com/apis/v1.0su/4533392909a5"
sheetsu-sheet="configuration">
<section>
<div data-form
data-wrapper--if="{{wrapperIF}}"
data-wrapper--init="{{wrapperINIT}}"
data-wrapper--class="{{wrapperCLASS}}"
data-input--type="{{inputTYPE}}"
data-input--id="{{inputID}}"
data-input--name="{{inputNAME}}"
data-input--autocomplete="{{inputAUTO}}"
data-input--min="{{inputMIN}}"
data-input--max="{{inputMAX}}"
data-input--step="{{inputSTEP}}"
data-input--value="{{inputVALUE}}"
data-input--aria="{{inputARIA}}"
data-input--checked="{{inputCHECKED}}"
data-input--required="{{inputREQUIRED}}"
data-input--disabled="{{inputDISABLED}}"
data-label--text="{{labelTEXT}}"
data-label--icon="{{labelICON}}"
data-message--text="{{messageTEXT}}"
data-message--class="{{messageCLASS}}">
</div>
</section>
</nav>
</div>
<!-- Pairs
************************************************* -->
<div class="mdc-list mdc-list--two-line mdc-list--avatar-list flex-1"
data-count
data-count--checked=".checked"
data-count--total=".total"
data-count--percent=".percent"
data-count--chart=".chart">
<!-- Accordion Button -->
<div class="mdc-list-item" data-mdc-auto-init="MDCRipple">
<span class="mdc-list-item__graphic" role="presentation">
<img class="material-icons" aria-hidden="true" src="images/icon-pairs.svg" alt="Profit Trailer Pairs">
</span>
<div class="flex-vertical between-stretch stats-container">
<!-- List Text -->
<div class="flex-horizontal between-base">
<h3 class="mdc-list-item__text">Pairs</h3>
<section class="mdc-list-item__secondary-text">
<span class="checked">0</span>
<span> of </span>
<span class="total">0</span>
</section>
</div>
<!-- List Chart -->
<div class="chart"></div>
</div>
<div class="mdc-list-item__meta percent">0</div>
</div>
<!-- Category Items -->
<nav class="custom-scrollbar"
sheetsu="https://sheetsu.com/apis/v1.0su/1abfbd1a79aa"
sheetsu-sheet="pairs">
<section>
<div data-form
data-wrapper--if="{{wrapperIF}}"
data-wrapper--init="{{wrapperINIT}}"
data-wrapper--class="{{wrapperCLASS}}"
data-input--type="{{inputTYPE}}"
data-input--id="{{inputID}}"
data-input--name="{{inputNAME}}"
data-input--autocomplete="{{inputAUTO}}"
data-input--min="{{inputMIN}}"
data-input--max="{{inputMAX}}"
data-input--step="{{inputSTEP}}"
data-input--value="{{inputVALUE}}"
data-input--aria="{{inputARIA}}"
data-input--checked="{{inputCHECKED}}"
data-input--required="{{inputREQUIRED}}"
data-input--disabled="{{inputDISABLED}}"
data-label--text="{{labelTEXT}}"
data-label--icon="{{labelICON}}"
data-message--text="{{messageTEXT}}"
data-message--class="{{messageCLASS}}">
</div>
</section>
</nav>
</div>
<!-- DCA
************************************************* -->
<div class="mdc-list mdc-list--two-line mdc-list--avatar-list flex-1"
data-count
data-count--checked=".checked"
data-count--total=".total"
data-count--percent=".percent"
data-count--chart=".chart">
<!-- Accordion Button -->
<div class="mdc-list-item" data-mdc-auto-init="MDCRipple">
<span class="mdc-list-item__graphic" role="presentation">
<img class="material-icons" aria-hidden="true" src="images/icon-dca.svg" alt="Profit Trailer DCA">
</span>
<div class="flex-vertical between-stretch stats-container">
<!-- List Text -->
<div class="flex-horizontal between-base">
<h3 class="mdc-list-item__text">DCA</h3>
<section class="mdc-list-item__secondary-text">
<span class="checked">0</span>
<span> of </span>
<span class="total">0</span>
</section>
</div>
<!-- List Chart -->
<div class="chart"></div>
</div>
<div class="mdc-list-item__meta percent">0</div>
</div>
<!-- Category Items -->
<nav class="custom-scrollbar"
sheetsu="https://sheetsu.com/apis/v1.0su/faf07152c388"
sheetsu-sheet="dca">
<section>
<div data-form
data-wrapper--if="{{wrapperIF}}"
data-wrapper--init="{{wrapperINIT}}"
data-wrapper--class="{{wrapperCLASS}}"
data-input--type="{{inputTYPE}}"
data-input--id="{{inputID}}"
data-input--name="{{inputNAME}}"
data-input--autocomplete="{{inputAUTO}}"
data-input--min="{{inputMIN}}"
data-input--max="{{inputMAX}}"
data-input--step="{{inputSTEP}}"
data-input--value="{{inputVALUE}}"
data-input--aria="{{inputARIA}}"
data-input--checked="{{inputCHECKED}}"
data-input--required="{{inputREQUIRED}}"
data-input--disabled="{{inputDISABLED}}"
data-label--text="{{labelTEXT}}"
data-label--icon="{{labelICON}}"
data-message--text="{{messageTEXT}}"
data-message--class="{{messageCLASS}}">
</div>
</section>
</nav>
</div>
<!-- Indicators
************************************************* -->
<div class="mdc-list mdc-list--two-line mdc-list--avatar-list flex-1"
data-count
data-count--checked=".checked"
data-count--total=".total"
data-count--percent=".percent"
data-count--chart=".chart">
<!-- Accordion Button -->
<div class="mdc-list-item" data-mdc-auto-init="MDCRipple">
<span class="mdc-list-item__graphic" role="presentation">
<img class="material-icons" aria-hidden="true" src="images/icon-indicators.svg" alt="Profit Trailer Indicators">
</span>
<div class="flex-vertical between-stretch stats-container">
<!-- List Text -->
<div class="flex-horizontal between-base">
<h3 class="mdc-list-item__text">Indicators</h3>
<section class="mdc-list-item__secondary-text">
<span class="checked">0</span>
<span> of </span>
<span class="total">0</span>
</section>
</div>
<!-- List Chart -->
<div class="chart"></div>
</div>
<div class="mdc-list-item__meta percent">0</div>
</div>
<!-- Category Items -->
<nav class="custom-scrollbar"
sheetsu="https://sheetsu.com/apis/v1.0su/f53e6b048232"
sheetsu-sheet="indicators">
<section>
<div data-form
data-wrapper--if="{{wrapperIF}}"
data-wrapper--init="{{wrapperINIT}}"
data-wrapper--class="{{wrapperCLASS}}"
data-input--type="{{inputTYPE}}"
data-input--id="{{inputID}}"
data-input--name="{{inputNAME}}"
data-input--autocomplete="{{inputAUTO}}"
data-input--min="{{inputMIN}}"
data-input--max="{{inputMAX}}"
data-input--step="{{inputSTEP}}"
data-input--value="{{inputVALUE}}"
data-input--aria="{{inputARIA}}"
data-input--checked="{{inputCHECKED}}"
data-input--required="{{inputREQUIRED}}"
data-input--disabled="{{inputDISABLED}}"
data-label--text="{{labelTEXT}}"
data-label--icon="{{labelICON}}"
data-message--text="{{messageTEXT}}"
data-message--class="{{messageCLASS}}">
</div>
</section>
</nav>
</div>
</section>
</article>
</main>
<!-- FAB
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- <button class="mdc-fab copy-btn" data-clipboard-target="#the-code" id="show-snackbar">
<i class="material-icons">content_copy</i>
</button> -->
<section class="fab-wrapper">
<button class="mdc-fab" id="show-snackbar">
<i class="material-icons">add</i>
</button>
<nav class="reveal-container flex-vertical">
<!-- Save Template -->
<div class="reveal-item flex-horizontal end-center">
<span class="item-label">Save Template</span>
<button class="mdc-fab mini-fab">
<i class="material-icons">save</i>
</button>
</div>
<!-- Download Zip -->
<div class="reveal-item flex-horizontal end-center">
<span class="item-label">Download Zip</span>
<button data-download class="mdc-fab mini-fab download-zip">
<i class="material-icons">file_download</i>
</button>
</div>
<!-- Copy File -->
<div class="reveal-item flex-horizontal end-center">
<span class="item-label">Copy File</span>
<!-- Copy All -->
<button class="mdc-fab mini-fab material-icons" aria-label="content_copy">
<div data-clipboard data-clipboard-target="#applicationFile">
<span class="mdc-fab__icon">
content_copy
</span>
</div>
</button>
</div>
</nav>
</section>
<!-- Snackbars -->
<!-- <div id="mdc-js-snackbar" data-mdc-auto-init="MDCSnackbar"
class="mdc-snackbar demo-hidden"
aria-live="assertive"
aria-atomic="true"
aria-hidden="true">
<div class="mdc-snackbar__text"></div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-snackbar__action-button"></button>
</div>
</div> -->
<!-- Libraries -->
<script src="https://load.sheetsu.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script src="https://unpkg.com/material-components-web@0.31.0/dist/material-components-web.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.12/clipboard.min.js"></script>
<script src="https://fastcdn.org/FileSaver.js/1.1.20151003/FileSaver.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.4/jszip.min.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/enquire.js/2.1.6/enquire.min.js"></script> -->
<!-- Data Functions -->
<!-- MDC Components (Dynamic) -->
<script>
/* Text Input
***********************************/
function mdcFORMS() {
// Update Textfield
$('[data-form]').each(function (){
// Wrapper
var wrapperIF = $(this).data("wrapper--if");
var wrapperINIT = $(this).data("wrapper--init");
var wrapperCLASS = $(this).data("wrapper--class");
// Input
var inputTYPE = $(this).data("input--type");
var inputID = $(this).data("input--id");
var inputNAME = $(this).data("input--name");
var inputAUTO = $(this).data("input--autocomplete");
var inputMIN = $(this).data("input--min");
var inputMAX = $(this).data("input--max");
var inputSTEP = $(this).data("input--step");
var inputVALUE = $(this).data("input--value");
var inputARIA = $(this).data("input--aria");
var inputCHECKED = $(this).data("input--checked");
var inputREQUIRED = $(this).data("input--required");
var inputDISABLED = $(this).data("input--disabled");
// Label
var labelTEXT = $(this).data("label--text");
var labelICON = $(this).data("label--icon");
// Message
var messageTEXT = $(this).data("message--text");
var messageCLASS = $(this).data("message--class");
/* TEMPLATES
***********************************************************************************/
/* Text Fields
****************************/
var mdcTEXTFIELD = `
<div class="${ wrapperCLASS }" data-mdc-auto-init="${ wrapperINIT }">
<input type="${ inputTYPE }"
id="${ inputID }"
class="mdc-text-field__input"
autocomplete="${ inputAUTO }"
min="${ inputMIN }"
max="${ inputMAX }"
aria-controls="${ inputARIA }"
value="${ inputVALUE }"
data-bind="${ inputID }"
${ inputCHECKED }
${ inputREQUIRED }
${ inputDISABLED }>
<div class="mdc-line-ripple"></div>
<label class="mdc-text-field__label" for="${ inputID }">${ labelTEXT }</label>
<i class="material-icons mdc-text-field__label">${ labelICON }</i>
</div>
<p id="${ inputARIA }" class="mdc-text-field-helper-text ${ messageCLASS }" style="display: block;" aria-hidden="true">${ messageTEXT }</p>
`;
/* Text Box
****************************/
var mdcTEXTBOX = `
<div class="${ wrapperCLASS }" data-mdc-auto-init="${ wrapperINIT }">
<input type="${ inputTYPE }"
id="${ inputID }"
class="mdc-text-field__input"
autocomplete="${ inputAUTO }"
min="${ inputMIN }"
max="${ inputMAX }"
aria-controls="${ inputARIA }"
value="${ inputVALUE }"
data-bind="${ inputID }"
${ inputCHECKED }
${ inputREQUIRED }
${ inputDISABLED }>
<div class="mdc-line-ripple"></div>
<label class="mdc-text-field__label" for="${ inputID }">${ labelTEXT }</label>
<i class="material-icons mdc-text-field__icon">${ labelICON }</i>
</div>
<p id="${ inputARIA }" class="mdc-text-field-helper-text ${ messageCLASS }" style="display: block;" aria-hidden="true">${ messageTEXT }</p>
`;
/* Text Outline
****************************/
var mdcTEXTOUTLINE = `
<div class="${ wrapperCLASS }" data-mdc-auto-init="${ wrapperINIT }">
<i class="material-icons mdc-text-field__icon">${ labelICON }</i>
<input type="${ inputTYPE }"
id="${ inputID }"
class="mdc-text-field__input"
autocomplete="${ inputAUTO }"
min="${ inputMIN }"
max="${ inputMAX }"
aria-controls="${ inputARIA }"
value="${ inputVALUE }"
data-bind="${ inputID }"
${ inputCHECKED }
${ inputREQUIRED }
${ inputDISABLED }>
<label class="mdc-text-field__label" for="${ inputID }">${ labelTEXT }</label>
<div class="mdc-text-field__outline">
<svg>
<path class="mdc-text-field__outline-path" d="M84.533,1h79.267a4,4 0 0 1 4,4v35.6a4,4 0 0 1 -4,4h-158.6a4,4 0 0 1 -4,-4v-35.6a4,4 0 0 1 4,-4h5.8"></path>
</svg>
</div>
<div class="mdc-text-field__idle-outline"></div>
</div>
<p id="${ inputARIA }" class="mdc-text-field-helper-text ${ messageCLASS }" style="display: block;" aria-hidden="true">${ messageTEXT }</p>
`;
/* Textareas
****************************/
var mdcTEXTAREA = `
<div class="${ wrapperCLASS }" data-mdc-auto-init="${ wrapperINIT }">
<textarea id="${ inputID }"
class="mdc-text-field__input"
rows="4"
cols="40"
value="${ inputVALUE }"
data-bind="${ inputID }"
${ inputREQUIRED }
${ inputDISABLED }>${ inputVALUE }</textarea>
<label class="mdc-text-field__label" for="${ inputID }">${ labelTEXT }</label>
</div>
`;
/* Sliders
****************************/
var mdcSLIDER = `
<div>
<h5>${ labelTEXT }</h5>
<div class="${ wrapperCLASS }"
tabindex="0"
role="slider"
aria-valuemin="${ inputMIN }"
aria-valuemax="${ inputMAX }"
aria-valuenow="${ inputVALUE }"
data-step="${ inputSTEP }"
aria-label="${ labelTEXT }"
aria-${ inputDISABLED }
id="${ inputID }"
data-bind="${ inputID }"
data-mdc-auto-init="${ wrapperINIT }">
<div class="mdc-slider__track-container">
<div class="mdc-slider__track"></div>
<div class="mdc-slider__track-marker-container"></div>
</div>
<div class="mdc-slider__thumb-container">
<div class="mdc-slider__pin">
<span class="mdc-slider__pin-value-marker"></span>
</div>
<svg class="mdc-slider__thumb" width="21" height="21">
<circle cx="10.5" cy="10.5" r="7.875"></circle>
</svg>
<div class="mdc-slider__focus-ring"></div>
</div>
</div>
</div>
`;
/* Switches
****************************/
var mdcSWITCH = `
<div class="mdc-form-field">
<div class="${ wrapperCLASS }">
<input type="checkbox"
id="${ inputID }"
class="mdc-switch__native-control"
data-bind="${ inputID }"
value="${ inputVALUE }"
${ inputCHECKED }
${ inputDISABLED }>
<div class="mdc-switch__background">
<div class="mdc-switch__knob"></div>
</div>
</div>
<label for="${ inputID }">${ labelTEXT }</label>
</div>
`;
/* Radio Buttons
****************************/
var mdcRADIO = `
<div class="mdc-form-field" data-mdc-auto-init="${ wrapperINIT }">
<div class="${ wrapperCLASS }">
<input type="${ inputTYPE }"
id="${ inputID }"
name="${ inputNAME }"
class="mdc-radio__native-control"
value="${ inputVALUE }"
data-bind="${ inputID }"
${ inputCHECKED }
${ inputREQUIRED }
${ inputDISABLED }>
<div class="mdc-radio__background">
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
</div>
<label for="${ inputID }">${ labelTEXT }</label>
</div>
`;
/* Checkboxes
****************************/
var mdcCHECKBOX = `
<div class="mdc-form-field" data-mdc-auto-init="${ wrapperINIT }">
<div class="${ wrapperCLASS }">
<input type="${ inputTYPE }"
id="${ inputID }"
class="mdc-checkbox__native-control"
value="${ inputVALUE }"
data-bind="${ inputID }"
${ inputCHECKED }
${ inputREQUIRED }
${ inputDISABLED }>
<div class="mdc-checkbox__background">
<svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
<path class="mdc-checkbox__checkmark-path" fill="none" stroke="white" d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
</svg>
<div class="mdc-checkbox__mixedmark"></div>
</div>
</div>
<label for="${ inputID }">${ labelTEXT }</label>
</div>
`;
this.className = '';
/* Input
***********************************/
// Textfields
if (inputTYPE == "text" && wrapperIF !== "MDCTextFieldBox" && wrapperIF !== "MDCTextFieldOutlined" && wrapperIF !== "MDCTextFieldTextarea") {
$(this).append(mdcTEXTFIELD);
}
// Text Box
if (inputTYPE == "text" && wrapperIF == "MDCTextFieldBox") {
$(this).append(mdcTEXTBOX);
}
// Text Outline
if (inputTYPE == "text" && wrapperIF == "MDCTextFieldOutlined") {
$(this).append(mdcTEXTOUTLINE);
}
// Textareas
else if (inputTYPE == "text" && wrapperIF == "MDCTextFieldTextarea") {
$(this).append(mdcTEXTAREA);
}
// Sliders
else if (inputTYPE == "slider") {
$(this).append(mdcSLIDER);
// $('[role]').each(function (){
// // Continuous Slider
// var sliderELEMENT = $(this);
// var sliderVALUE = $("#continuous-slider-value");
// var slider = new mdc.slider.MDCSlider(sliderELEMENT);
// slider.listen('MDCSlider:input', function() {
// sliderVALUE.textContent = slider.value;
// });
// });
}
// Switches
else if (inputTYPE == "switch") {
$(this).append(mdcSWITCH);
}
// Radios
else if (inputTYPE == "radio") {
$(this).append(mdcRADIO);
}
// Checkboxes
else if (inputTYPE == "checkbox") {
$(this).append(mdcCHECKBOX);
}
});
}
/* Data Titles
***********************************/
function dataTITLE() {
// Update Title
$('[data-title]').each(function (){
// Title
var dataTITLE = $(this).data("title");
var templateTITLE = `<h3>${ dataTITLE }</h3>`
$(this).prepend(templateTITLE);
});
}
</script>
<script src="https://rawgit.com/oneezy/oneezy-js/master/app/components/mdc-tabs/mdc-tabs.js"></script>
<script src="https://rawgit.com/oneezy/oneezy-js/master/app/components/data-accordion/data-accordion.js"></script>
<script src="https://rawgit.com/oneezy/oneezy-js/master/app/components/data-clipboard/data-clipboard.js"></script>
<script src="https://rawgit.com/oneezy/oneezy-js/master/app/components/data-count/data-count.js"></script>
<script src="https://rawgit.com/oneezy/oneezy-js/master/app/components/data-bind/data-bind.js"></script>
<!-- build:js js/scripts.min.js -->
<script src="js/downloadfile.js"></script>
<script src="js/script.js"></script>
<!-- endbuild -->
</body>
</html> | 40.39117 | 179 | 0.453191 |
f2c73b2c616846d75b398611aee763ea23550773 | 2,173 | dart | Dart | lib/backlog_alternate_app.dart | jparound30/flutter2_sample | 8002d7c2695a2c82574360bf6432e269bbd30467 | [
"MIT"
] | null | null | null | lib/backlog_alternate_app.dart | jparound30/flutter2_sample | 8002d7c2695a2c82574360bf6432e269bbd30467 | [
"MIT"
] | null | null | null | lib/backlog_alternate_app.dart | jparound30/flutter2_sample | 8002d7c2695a2c82574360bf6432e269bbd30467 | [
"MIT"
] | 1 | 2021-04-10T02:19:16.000Z | 2021-04-10T02:19:16.000Z | import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'env_vars.dart';
import 'providers/credential_info.dart';
import 'views/screens/launch_screen.dart';
class BacklogAlternateApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
print("START: " + defaultTargetPlatform.toString());
// PaginatedDataTableのヘッダ行部分の背景色を設定
var dataTableThemeData = ThemeData.dark().dataTableTheme.copyWith(
headingRowColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
return Theme.of(context).colorScheme.primary.withOpacity(0.18);
},
),
);
// Naviratorでの遷移時のアニメーションを指定(flutter/packages/flutter/lib/src/material/page_transitions_theme.dart)
const Map<TargetPlatform, PageTransitionsBuilder> _defaultBuilders = <TargetPlatform, PageTransitionsBuilder>{
TargetPlatform.android: CupertinoPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.linux: CupertinoPageTransitionsBuilder(),
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.windows: CupertinoPageTransitionsBuilder(),
};
return ChangeNotifierProvider<CredentialInfo>(
create: (_) {
if (EnvVars.apiKey.isNotEmpty && EnvVars.spaceName.isNotEmpty) {
return CredentialInfo(
space: EnvVars.spaceName, apiKey: EnvVars.apiKey);
}
return CredentialInfo();
},
child: MaterialApp(
title: 'Backlog Alternate',
theme: ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.blue,
// textTheme: GoogleFonts.mPlus1pTextTheme(),
textTheme: GoogleFonts.notoSansTextTheme(),
dataTableTheme: dataTableThemeData,
pageTransitionsTheme: PageTransitionsTheme(builders: _defaultBuilders)
),
home: LaunchScreen(),
debugShowCheckedModeBanner: false,
),
);
}
}
| 37.465517 | 114 | 0.704096 |
c39def4970581cc9ff75fd2d78b3a5969970796e | 6,952 | swift | Swift | Clock/Clock/Stopwatch/View/Stopwatch/StopwatchScrollView.swift | kaden-kykim/CICCC-iOS-Clock-App | 4ba0dd8f2509f8d5270f1d579f5638f9f2d8a4f8 | [
"MIT"
] | 3 | 2020-05-29T21:19:47.000Z | 2020-10-03T08:42:33.000Z | Clock/Clock/Stopwatch/View/Stopwatch/StopwatchScrollView.swift | kaden-kykim/CICCC-iOS-Clock-App | 4ba0dd8f2509f8d5270f1d579f5638f9f2d8a4f8 | [
"MIT"
] | 2 | 2020-05-29T01:06:01.000Z | 2020-05-29T01:58:00.000Z | Clock/Clock/Stopwatch/View/Stopwatch/StopwatchScrollView.swift | kaden-kykim/CICCC-iOS-Clock-App | 4ba0dd8f2509f8d5270f1d579f5638f9f2d8a4f8 | [
"MIT"
] | 5 | 2020-05-28T05:05:52.000Z | 2020-05-29T19:11:34.000Z | //
// StopwatchScrollViewController.swift
// Clock
//
// Created by Kaden Kim on 2020-06-06.
// Copyright © 2020 CICCC. All rights reserved.
//
import UIKit
class StopwatchScrollView: UIScrollView, UIScrollViewDelegate {
private(set) var scrollViewSize: CGSize!
lazy var digitalStopwatchLabel: StopwatchDigitalLabel? = nil
lazy var analogClockView: AnalogClockView? = nil
lazy var pagesStackView: UIStackView? = nil
override init(frame: CGRect) {
super.init(frame: frame)
let safeAreaSize = UIDevice.current.safeAreaSize!
scrollViewSize = CGSize(width: safeAreaSize.width, height: safeAreaSize.height * 0.491)
setupScrollViewProperties()
setupPagesStackView(setupDigitalViewPage(), setupAnalogViewPage())
setupPageControl()
}
func setDigitalStopwatchInAnalogLabelText(_ stopwatchText: String) {
analogClockView?.digitalStopwatchInAnalogLabel.text = stopwatchText
}
func setMainHandAngle(_ radian: CGFloat) {
CALayer.performWithoutAnimation {
analogClockView?.mainAnalogClockFace.mainHandLayer?.backgroundColor = UIColor.mainTintColor.cgColor
analogClockView?.mainAnalogClockFace.mainHandLayer?.transform = CATransform3DMakeRotation(radian, 0, 0, 1)
}
}
func setLapHandAngle(_ radian: CGFloat) {
CALayer.performWithoutAnimation {
analogClockView?.mainAnalogClockFace.lapHandLayer?.backgroundColor = UIColor.analogClockLapHandColor.cgColor
analogClockView?.mainAnalogClockFace.lapHandLayer?.transform = CATransform3DMakeRotation(radian, 0, 0, 1)
}
}
func setSubHandAngle(_ radian: CGFloat) {
CALayer.performWithoutAnimation {
analogClockView?.subAnalogClockFace.handLayer?.backgroundColor = UIColor.mainTintColor.cgColor
analogClockView?.subAnalogClockFace.handLayer?.transform = CATransform3DMakeRotation(radian, 0, 0, 1)
}
}
func updateConstraintForDigitalStopwatch(_ moreThan8Chars: Bool) {
if moreThan8Chars {
self.digitalStopwatchLabelLeadingConstraintWith12?.isActive = false
self.digitalStopwatchLabelTrailingConstraintWith12?.isActive = false
self.digitalStopwatchLabelLeadingConstraintWith4?.isActive = true
self.digitalStopwatchLabelTrailingConstraintWith4?.isActive = true
} else {
self.digitalStopwatchLabelLeadingConstraintWith4?.isActive = false
self.digitalStopwatchLabelTrailingConstraintWith4?.isActive = false
self.digitalStopwatchLabelLeadingConstraintWith12?.isActive = true
self.digitalStopwatchLabelTrailingConstraintWith12?.isActive = true
}
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView.bounds.width != 0 {
pageControl.currentPage = Int(round(scrollView.contentOffset.x / scrollView.bounds.width))
}
}
func reloadAnalogClockView() {
pagesStackView?.removeFromSuperview()
setupPagesStackView(setupDigitalViewPage(), setupAnalogViewPage())
}
@objc private func pageControlTapped(sender: UIPageControl) {
UIView.animate(withDuration: 0.33) { [weak self] in
guard let self = self else { return }
self.contentOffset.x = CGFloat(sender.currentPage * Int(self.bounds.width))
}
}
private func setupScrollViewProperties() {
translatesAutoresizingMaskIntoConstraints = false
showsHorizontalScrollIndicator = false
isPagingEnabled = true
delegate = self
}
private func setupPagesStackView(_ digitalView: UIView, _ analogView: UIView) {
pagesStackView = HorizontalStackView(arrangedSubviews: [digitalView, analogView], distribution: .equalSpacing)
addSubview(pagesStackView!)
pagesStackView!.matchParent()
}
private var digitalStopwatchLabelLeadingConstraintWith4: NSLayoutConstraint?
private var digitalStopwatchLabelLeadingConstraintWith12: NSLayoutConstraint?
private var digitalStopwatchLabelTrailingConstraintWith4: NSLayoutConstraint?
private var digitalStopwatchLabelTrailingConstraintWith12: NSLayoutConstraint?
private func setupDigitalViewPage() -> UIView {
let digitalView = UIView()
digitalView.translatesAutoresizingMaskIntoConstraints = false
digitalView.constraintWidth(equalToConstant: scrollViewSize.width, heightEqualToConstant: scrollViewSize.height)
digitalStopwatchLabel = StopwatchDigitalLabel()
digitalView.addSubview(digitalStopwatchLabel!)
digitalStopwatchLabel?.centerYAnchor.constraint(equalTo: digitalView.centerYAnchor).isActive = true
digitalStopwatchLabelLeadingConstraintWith4 = digitalStopwatchLabel?.leadingAnchor.constraint(equalTo: digitalView.leadingAnchor, constant: 4)
digitalStopwatchLabelLeadingConstraintWith12 = digitalStopwatchLabel?.leadingAnchor.constraint(equalTo: digitalView.leadingAnchor, constant: 12)
digitalStopwatchLabelTrailingConstraintWith4 = digitalStopwatchLabel?.trailingAnchor.constraint(equalTo: digitalView.trailingAnchor, constant: -4)
digitalStopwatchLabelTrailingConstraintWith12 = digitalStopwatchLabel?.trailingAnchor.constraint(equalTo: digitalView.trailingAnchor, constant: -12)
digitalStopwatchLabelLeadingConstraintWith12?.isActive = true
digitalStopwatchLabelTrailingConstraintWith12?.isActive = true
return digitalView
}
private func setupAnalogViewPage() -> UIView {
let analogView = UIView()
analogView.translatesAutoresizingMaskIntoConstraints = false
analogView.constraintWidth(equalToConstant: scrollViewSize.width, heightEqualToConstant: scrollViewSize.height)
let analogClockViewSize = CGSize(width: self.scrollViewSize.height * 0.9, height: self.scrollViewSize.height * 0.9)
analogClockView = AnalogClockView(size: analogClockViewSize)
analogView.addSubview(analogClockView!)
analogClockView?.constraintWidth(equalToConstant: analogClockViewSize.width, heightEqualToConstant: analogClockViewSize.height)
analogClockView?.centerXYin(analogView)
return analogView
}
lazy var pageControl = UIPageControl()
private func setupPageControl() {
pageControl.translatesAutoresizingMaskIntoConstraints = false
pageControl.numberOfPages = 2
pageControl.currentPage = 0
pageControl.pageIndicatorTintColor = .pageIndicatorColor
pageControl.currentPageIndicatorTintColor = .white
pageControl.addTarget(self, action: #selector(pageControlTapped(sender:)), for: .valueChanged)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| 45.437908 | 156 | 0.72756 |
d199e8ad5d50cfc125b8d14211534b477ae31c74 | 218 | rs | Rust | ru_strlen.rs | andersonhsporto/RUST-libft | cfc1fd2d3a6534bcbd858885cd8dfd65a601ef04 | [
"MIT"
] | null | null | null | ru_strlen.rs | andersonhsporto/RUST-libft | cfc1fd2d3a6534bcbd858885cd8dfd65a601ef04 | [
"MIT"
] | null | null | null | ru_strlen.rs | andersonhsporto/RUST-libft | cfc1fd2d3a6534bcbd858885cd8dfd65a601ef04 | [
"MIT"
] | null | null | null | fn ru_strlen(str: String) -> usize {
let mut index = 0;
for _c in str.chars() {
index += 1;
}
{ return index;}
}
// fn main() {
// let teste2 = ru_strlen("teste".to_string());
// println!("{}", teste2);
// }
| 15.571429 | 48 | 0.550459 |
df9937162c91295ab78101bda7da9da973b354b3 | 1,828 | ts | TypeScript | src/data-structures/bloom-filter/BloomFilter.ts | bluewaitor/typescript-data-structure | 1577db621425e95df8fbaec3d97a2b16c1f63426 | [
"MIT"
] | 1 | 2018-07-18T06:58:16.000Z | 2018-07-18T06:58:16.000Z | src/data-structures/bloom-filter/BloomFilter.ts | bluewaitor/typescript-data-structure | 1577db621425e95df8fbaec3d97a2b16c1f63426 | [
"MIT"
] | null | null | null | src/data-structures/bloom-filter/BloomFilter.ts | bluewaitor/typescript-data-structure | 1577db621425e95df8fbaec3d97a2b16c1f63426 | [
"MIT"
] | null | null | null | export class BloomFilter {
size: number;
storage: {
getValue: Function;
setValue: Function;
};
constructor(size = 100) {
this.size = size;
this.storage = this.createStore(size);
}
createStore(size) {
const storage = [];
for (let i = 0; i < size; i += 1) {
storage.push(false);
}
const storageInterface = {
getValue(index) {
return storage[index];
},
setValue(index) {
storage[index] = true;
}
};
return storageInterface;
}
hash1(item) {
let hash = 0;
for (let charIndex = 0; charIndex < item.length; charIndex += 1) {
const char = item.charCodeAt(charIndex);
hash = (hash << 5) + hash + char;
hash &= hash;
hash = Math.abs(hash);
}
return hash % this.size;
}
hash2(item) {
let hash = 5381;
for (let charIndex = 0; charIndex < item.length; charIndex += 1) {
const char = item.charCodeAt(charIndex);
hash = (hash << 5) + hash + char;
}
return Math.abs(hash % this.size);
}
hash3(item) {
let hash = 0;
for (let charIndex = 0; charIndex < item.length; charIndex += 1) {
const char = item.charCodeAt(charIndex);
hash = (hash << 5) - hash;
hash += char;
hash &= hash;
}
return Math.abs(hash % this.size);
}
getHashValues(item) {
return [this.hash1(item), this.hash2(item), this.hash3(item)];
}
insert(item) {
const hashValues = this.getHashValues(item);
hashValues.forEach(val => this.storage.setValue(val));
}
mayContain(item) {
const hashValues = this.getHashValues(item);
for (let hashIndex = 0; hashIndex < hashValues.length; hashIndex += 1) {
if (!this.storage.getValue(hashValues[hashIndex])) {
return false;
}
}
return true;
}
}
| 20.539326 | 76 | 0.570569 |
5443edf57414bc8520d5d773d479f6059b776e34 | 967 | go | Go | internal/common/helper/game-helper/game.go | lgbya/goleaf_games_server | c4bfba848747fb3846c277c2fa43198789d6d5bb | [
"Apache-2.0"
] | 1 | 2020-08-19T09:52:26.000Z | 2020-08-19T09:52:26.000Z | internal/common/helper/game-helper/game.go | lgbya/goleaf_games_server | c4bfba848747fb3846c277c2fa43198789d6d5bb | [
"Apache-2.0"
] | null | null | null | internal/common/helper/game-helper/game.go | lgbya/goleaf_games_server | c4bfba848747fb3846c277c2fa43198789d6d5bb | [
"Apache-2.0"
] | null | null | null | package gamehelper
import (
"server/internal/gate/protocol"
"server/internal/model"
"github.com/name5566/leaf/gate"
)
func CheckLogin(agent gate.Agent) (*model.User, bool) {
if userAgent, ok := agent.UserData().(*model.Agent); ok {
user, found := new(model.User).Uid2User(userAgent.ID)
return user, found
}
return &model.User{}, false
}
func User2MUserList(lUser map[int]*model.User) map[int]protocol.M_UserInfo {
mUsers := make(map[int]protocol.M_UserInfo)
//告诉前端游戏开始
for _, user := range lUser {
mUsers[user.Uid] = protocol.M_UserInfo{
Uid: user.Uid,
Name: user.Name,
}
}
return mUsers
}
func CheckInRoom(agent gate.Agent) (*model.User, *model.Room) {
userAgent, ok := agent.UserData().(*model.Agent)
if !ok {
return nil, nil
}
user, ok := new(model.User).Uid2User(userAgent.ID)
if !ok {
return nil, nil
}
room, ok := new(model.Room).RoomId2Room(user.Game.InRoomId)
if !ok {
return nil, nil
}
return user, room
}
| 19.34 | 76 | 0.681489 |
acf44b54c3ba4781b88f903e24375908e5dd6d4e | 638 | cpp | C++ | source/pkgsrc/devel/rapidsvn/patches/patch-src_listener.cpp | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 1 | 2021-11-20T22:46:39.000Z | 2021-11-20T22:46:39.000Z | source/pkgsrc/devel/rapidsvn/patches/patch-src_listener.cpp | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | source/pkgsrc/devel/rapidsvn/patches/patch-src_listener.cpp | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | $NetBSD: patch-src_listener.cpp,v 1.1 2016/07/16 03:32:32 markd Exp $
Dont do things the old 2.6 way
--- src/listener.cpp.orig 2012-06-28 06:39:35.000000000 +0000
+++ src/listener.cpp
@@ -167,7 +167,7 @@ public:
wxMutexLocker lock(mutex);
wxString localCertFile = wxFileSelector(
_("Select Certificate File"), wxT(""), wxT(""), wxT(""),
- wxT("*.*"), wxOPEN | wxFILE_MUST_EXIST, parent);
+ wxT("*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST, parent);
LocalToUtf8(localCertFile, certFile);
dataReceived = !localCertFile.empty();
| 39.875 | 88 | 0.575235 |
810cd07fe09490ad5f5ec97541916de6dd803255 | 1,564 | go | Go | amass/handlers/handlers.go | Ergotu/Amass | a2c87e55798febe54a33f29bb5ba07cf1af61daa | [
"Apache-2.0"
] | 1 | 2020-01-12T12:43:40.000Z | 2020-01-12T12:43:40.000Z | amass/handlers/handlers.go | Ergotu/Amass | a2c87e55798febe54a33f29bb5ba07cf1af61daa | [
"Apache-2.0"
] | null | null | null | amass/handlers/handlers.go | Ergotu/Amass | a2c87e55798febe54a33f29bb5ba07cf1af61daa | [
"Apache-2.0"
] | 1 | 2021-08-14T18:04:48.000Z | 2021-08-14T18:04:48.000Z | // Copyright 2017 Jeff Foley. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package handlers
import (
"fmt"
"net"
)
const (
OptDomain = "domain"
OptCNAME = "cname"
OptA = "a"
OptAAAA = "aaaa"
OptPTR = "ptr"
OptSRV = "service"
OptNS = "ns"
OptMX = "mx"
OptInfrastructure = "infrastructure"
)
type DataHandler interface {
fmt.Stringer
InsertDomain(domain, tag, source string) error
InsertCNAME(name, domain, target, tdomain, tag, source string) error
InsertA(name, domain, addr, tag, source string) error
InsertAAAA(name, domain, addr, tag, source string) error
InsertPTR(name, domain, target, tag, source string) error
InsertSRV(name, domain, service, target, tag, source string) error
InsertNS(name, domain, target, tdomain, tag, source string) error
InsertMX(name, domain, target, tdomain, tag, source string) error
InsertInfrastructure(addr string, asn int, cidr *net.IPNet, desc string) error
}
type JSONFileFormat struct {
Type string `json:"type"`
Name string `json:"name"`
Domain string `json:"domain"`
Service string `json:"service"`
TargetName string `json:"target_name"`
TargetDomain string `json:"target_domain"`
Address string `json:"addr"`
ASN int `json:"asn"`
CIDR string `json:"cidr"`
Description string `json:"desc"`
Tag string `json:"tag"`
Source string `json:"source"`
}
| 26.508475 | 97 | 0.650895 |
4aded87a8619bcdc2383bd242847489bea87e86f | 620 | cs | C# | Lib/xUnit/XunitLight.Silverlight/Source/Xunit/Sdk/Exceptions/EqualException.cs | mizbrodin/moq4 | cb3f57efc15a395328501bc3552ae3e817459120 | [
"BSD-3-Clause"
] | null | null | null | Lib/xUnit/XunitLight.Silverlight/Source/Xunit/Sdk/Exceptions/EqualException.cs | mizbrodin/moq4 | cb3f57efc15a395328501bc3552ae3e817459120 | [
"BSD-3-Clause"
] | null | null | null | Lib/xUnit/XunitLight.Silverlight/Source/Xunit/Sdk/Exceptions/EqualException.cs | mizbrodin/moq4 | cb3f57efc15a395328501bc3552ae3e817459120 | [
"BSD-3-Clause"
] | 1 | 2021-11-24T09:21:11.000Z | 2021-11-24T09:21:11.000Z | namespace Xunit.Sdk
{
/// <summary>
/// Exception thrown when two values are unexpectedly not equal.
/// </summary>
public class EqualException : AssertActualExpectedException
{
/// <summary>
/// Creates a new instance of the <see cref="EqualException"/> class.
/// </summary>
/// <param name="expected">The expected object value</param>
/// <param name="actual">The actual object value</param>
public EqualException(object expected,
object actual)
: base(expected, actual, "Assert.Equal() Failure") {}
}
} | 36.470588 | 77 | 0.590323 |
b7c6c3150fca77d7d331ffc40cab256bf4fc5a72 | 1,768 | dart | Dart | lib/core/services/key_storage/key_storage_service_impl.dart | mayankgenie/provider_architecture | bfe20db49e4802e4c8ad04ae1954d67cfe6d72a8 | [
"MIT"
] | null | null | null | lib/core/services/key_storage/key_storage_service_impl.dart | mayankgenie/provider_architecture | bfe20db49e4802e4c8ad04ae1954d67cfe6d72a8 | [
"MIT"
] | null | null | null | lib/core/services/key_storage/key_storage_service_impl.dart | mayankgenie/provider_architecture | bfe20db49e4802e4c8ad04ae1954d67cfe6d72a8 | [
"MIT"
] | 1 | 2019-10-19T07:32:58.000Z | 2019-10-19T07:32:58.000Z | import 'package:provider_start/core/services/key_storage/key_storage_service.dart';
import 'package:shared_preferences/shared_preferences.dart';
/// Service that is responsible for storing/retrieving data in/from
/// local storage using the [SharedPreferences] package.
class KeyStorageServiceImpl implements KeyStorageService {
static const loggedin_key = 'hasLoggedIn';
static const night_mode_key = 'nightMode';
static KeyStorageServiceImpl _instance;
static SharedPreferences _preferences;
static Future<KeyStorageServiceImpl> getInstance() async {
if (_instance == null) {
_instance = KeyStorageServiceImpl();
}
if (_preferences == null) {
_preferences = await SharedPreferences.getInstance();
}
return _instance;
}
@override
bool get hasLoggedIn => _getFromDisk(loggedin_key) ?? false;
set hasLoggedIn(bool value) => _saveToDisk(loggedin_key, value);
@override
bool get nightMode => _getFromDisk(night_mode_key) ?? false;
set nightMode(bool value) => _saveToDisk(night_mode_key, value);
dynamic _getFromDisk(String key) {
final value = _preferences.get(key);
print('(TRACE) LocalStorageService:_getFromDisk. key: $key value: $value');
return value;
}
void _saveToDisk<T>(String key, T content) {
print('(TRACE) LocalStorageService:_saveToDisk. key: $key value: $content');
if (content is String) {
_preferences.setString(key, content);
}
if (content is bool) {
_preferences.setBool(key, content);
}
if (content is int) {
_preferences.setInt(key, content);
}
if (content is double) {
_preferences.setDouble(key, content);
}
if (content is List<String>) {
_preferences.setStringList(key, content);
}
}
}
| 29.966102 | 83 | 0.70871 |
0958b0e7b5712933debcb5bab7a94a54b0da9af8 | 7,572 | ps1 | PowerShell | examples/templates/scripts/Wallpaper Scaling/Wallpaper Scaling.ps1 | pkhabazi/IntuneWAC | 43edcf31d6f38b73b755479d6bca0cd3033ad80c | [
"MIT"
] | null | null | null | examples/templates/scripts/Wallpaper Scaling/Wallpaper Scaling.ps1 | pkhabazi/IntuneWAC | 43edcf31d6f38b73b755479d6bca0cd3033ad80c | [
"MIT"
] | null | null | null | examples/templates/scripts/Wallpaper Scaling/Wallpaper Scaling.ps1 | pkhabazi/IntuneWAC | 43edcf31d6f38b73b755479d6bca0cd3033ad80c | [
"MIT"
] | null | null | null | #region Config
$AppName = "Set-WallpaperStyle"
$client = "<%=$PLASTER_PARAM_ClientName%>"
$logPath = "$env:ProgramData\$client\logs"
$logFile = "$logPath\$appName.log"
#endregion
#region Functions
function Set-ComputerRegistryValues {
param (
[Parameter(Mandatory = $true)]
[array]$RegistryInstance
)
try {
foreach ($key in $RegistryInstance) {
$keyPath = "HKLM:\$($key.Path)"
if (!(Test-Path $keyPath)) {
Write-Host "Registry path : $keyPath not found. Creating now." -ForegroundColor Green
New-Item -Path $key.Path -Force | Out-Null
Write-Host "Creating item property: $($key.Name)" -ForegroundColor Green
New-ItemProperty -Path $keyPath -Name $key.Name -Value $key.Value -PropertyType $key.Type -Force
}
else {
Write-Host "Creating item property: $($key.Name)" -ForegroundColor Green
New-ItemProperty -Path $keyPath -Name $key.Name -Value $key.Value -PropertyType $key.Type -Force
}
}
}
catch {
Throw $_.Exception.Message
}
}
function Set-RegistryValueForAllUsers {
<#
.SYNOPSIS
This function uses Active Setup to create a "seeder" key which creates or modifies a user-based registry value
for all users on a computer. If the key path doesn't exist to the value, it will automatically create the key and add the value.
.EXAMPLE
PS> Set-RegistryValueForAllUsers -RegistryInstance @{'Name' = 'Setting'; 'Type' = 'String'; 'Value' = 'someval'; 'Path' = 'SOFTWARE\Microsoft\Windows\Something'}
This example would modify the string registry value 'Type' in the path 'SOFTWARE\Microsoft\Windows\Something' to 'someval'
for every user registry hive.
.PARAMETER RegistryInstance
A hash table containing key names of 'Name' designating the registry value name, 'Type' to designate the type
of registry value which can be 'String,Binary,Dword,ExpandString or MultiString', 'Value' which is the value itself of the
registry value and 'Path' designating the parent registry key the registry value is in.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[array]$RegistryInstance
)
try {
New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS | Out-Null
## Change the registry values for the currently logged on user. Each logged on user SID is under HKEY_USERS
$LoggedOnSids = $(Get-ChildItem HKU: | Where-Object { $_.Name -match 'S-\d-\d+-(\d+-){1,14}\d+$' } | foreach-object { $_.Name })
Write-Verbose "Found $($LoggedOnSids.Count) logged on user SIDs"
foreach ($sid in $LoggedOnSids) {
Write-Host "Loading the user registry hive for the logged on SID $sid" -ForegroundColor Green
foreach ($instance in $RegistryInstance) {
## Create the key path if it doesn't exist
if (!(Test-Path "HKU:\$sid\$($instance.Path)")) {
New-Item -Path "HKU:\$sid\$($instance.Path | Split-Path -Parent)" -Name ($instance.Path | Split-Path -Leaf) -Force
}
## Create (or modify) the value specified in the param
Set-ItemProperty -Path "HKU:\$sid\$($instance.Path)" -Name $instance.Name -Value $instance.Value -Type $instance.Type -Force
}
}
## Create the Active Setup registry key so that the reg add cmd will get ran for each user
## logging into the machine.
## http://www.itninja.com/blog/view/an-active-setup-primer
Write-Host "Setting Active Setup registry value to apply to all other users" -ForegroundColor Green
foreach ($instance in $RegistryInstance) {
## Generate a unique value (usually a GUID) to use for Active Setup
$Guid = $instance.Guid
$ActiveSetupRegParentPath = 'HKLM:\Software\Microsoft\Active Setup\Installed Components'
## Create the GUID registry key under the Active Setup key
$ActiveSetupRegPath = "HKLM:\Software\Microsoft\Active Setup\Installed Components\$Guid"
if (!(Test-Path -Path "$ActiveSetupRegPath")) {
New-Item -Path $ActiveSetupRegParentPath -Name $Guid -Force
}
Write-Verbose "Using registry path '$ActiveSetupRegPath'"
## Convert the registry value type to one that reg.exe can understand. This will be the
## type of value that's created for the value we want to set for all users
switch ($instance.Type) {
'String' {
$RegValueType = 'REG_SZ'
}
'Dword' {
$RegValueType = 'REG_DWORD'
}
'Binary' {
$RegValueType = 'REG_BINARY'
}
'ExpandString' {
$RegValueType = 'REG_EXPAND_SZ'
}
'MultiString' {
$RegValueType = 'REG_MULTI_SZ'
}
default {
throw "Registry type '$($instance.Type)' not recognized"
}
}
## Build the registry value to use for Active Setup which is the command to create the registry value in all user hives
$ActiveSetupValue = "reg add `"{0}`" /v {1} /t {2} /d {3} /f" -f "HKCU\$($instance.Path)", $instance.Name, $RegValueType, $instance.Value
Write-Verbose -Message "Active setup value is '$ActiveSetupValue'"
## Create the necessary Active Setup registry values
Set-ItemProperty -Path $ActiveSetupRegPath -Name '(Default)' -Value 'Active Setup Test' -Force
Set-ItemProperty -Path $ActiveSetupRegPath -Name 'Version' -Value '1' -Force
Set-ItemProperty -Path $ActiveSetupRegPath -Name 'StubPath' -Value $ActiveSetupValue -Force
}
}
catch {
Throw -Message $_.Exception.Message
}
}
#endregion
#region Logging
if (!(Test-Path -Path $logPath)) {
New-Item -Path $logPath -ItemType Directory -Force | Out-Null
}
$errorOccurred = $false
Start-Transcript -Path $logFile -ErrorAction SilentlyContinue -Force
#endregion
#region Keys
$hklmKeys = $null
$hkcuKeys = @(
[PSCustomObject]@{
Guid = "{687af3cf-7032-424a-8e5a-7ab17ee08a38}" #set a random guid for each property
Name = "WallpaperStyle"
Type = "String" #String, ExpandString, Binary, DWord, MultiString, QWord, Unknown
Value = "6"
Path = "Control Panel\Desktop"
}
)
#endregion
#region Process
try {
if ($hklmKeys) {
Write-Host "Seting HKLM registry keys.." -ForegroundColor Green
Set-ComputerRegistryValues -RegistryInstance $hklmKeys
Write-Host "========"
}
if ($hkcuKeys) {
Write-Host "Seting HKCU registry keys.." -ForegroundColor Green
Set-RegistryValueForAllUsers -RegistryInstance $hkcuKeys
Write-Host "========"
}
}
catch {
$errorOccurred = $true
throw $_.Exception.Message
}
finally {
if (!($errorOccurred)) {
Write-Host "Configuration completed successfully."
}
Stop-Transcript -ErrorAction SilentlyContinue
}
if (!($errorOccurred)) {
Write-Host "Configuration completed successfully."
}
#endregion
| 45.341317 | 170 | 0.600766 |
9c316a36daeb1d5b43b67b6baa6ae18a939691c6 | 2,445 | js | JavaScript | reciever/server.js | ukmadlz/nodejs-observability | aba60bb35e37331b5202fdeac1c945f9817cf1d7 | [
"MIT"
] | null | null | null | reciever/server.js | ukmadlz/nodejs-observability | aba60bb35e37331b5202fdeac1c945f9817cf1d7 | [
"MIT"
] | null | null | null | reciever/server.js | ukmadlz/nodejs-observability | aba60bb35e37331b5202fdeac1c945f9817cf1d7 | [
"MIT"
] | 1 | 2020-09-12T13:59:01.000Z | 2020-09-12T13:59:01.000Z | 'use strict';
require('dotenv').config();
const express = require('express');
const amqp = require('amqplib');
const winston = require('winston');
const LogzioWinstonTransport = require('winston-logzio');
const opentracing = require('opentracing');
const initTracer = require('jaeger-client').initTracer;
// Logger
const logzioWinstonTransport = new LogzioWinstonTransport({
name: 'winston_logzio',
token: process.env.SHIPPING_TOKEN,
host: `${process.env.LISTENER_URI}:5015`,
});
const logger = winston.createLogger({
transports: [
new winston.transports.Console(),
logzioWinstonTransport,
]
});
// Jaeger
const config = {
serviceName: 'nodejs-image-save.reciever',
reporter: {
collectorEndpoint: 'http://jaegercollector:14268/api/traces',
logSpans: true,
},
sampler: {
type: 'const',
param: 1
}
};
const options = {
tags: {
'nodejs-image-save.reciever.version': '0.0.0',
},
logger,
};
const tracer = initTracer(config, options);
// Constants
const PORT = 8080;
const HOST = '0.0.0.0';
const Q = 'tasks';
// App
const app = express();
// The request
app.get('/', async (req, res) => {
const httpSpan = tracer.startSpan("http_request");
httpSpan.addTags({
[opentracing.Tags.SPAN_KIND]: opentracing.Tags.SPAN_KIND_MESSAGING_PRODUCER,
[opentracing.Tags.HTTP_METHOD]: req.method,
[opentracing.Tags.HTTP_URL]: req.path
});
logger.debug('Image request recieved.');
const { imageUrl } = req.query;
res.on("finish", () => {
httpSpan.setTag(opentracing.Tags.HTTP_STATUS_CODE, res.statusCode);
httpSpan.finish();
});
const enqueueSpan = tracer.startSpan("enqueue", {
childOf: httpSpan
});
const traceContext = {};
tracer.inject(enqueueSpan, opentracing.FORMAT_TEXT_MAP, traceContext);
// Queue
try {
const connection = await amqp.connect('amqp://rabbitmq');
const channel = await connection.createChannel();
await channel.assertQueue(Q, { durable: true });
await channel.sendToQueue(Q, Buffer.from(JSON.stringify({ imageUrl, trace: traceContext })), {
contentType: 'application/json',
persistent: true
});
logger.info('Sent to queue');
} catch (e) {
enqueueSpan.setTag(opentracing.Tags.ERROR, true).log({ error: e });
logger.error(e);
} finally {
enqueueSpan.finish();
res.send(`Image ${imageUrl} saved`);
}
});
app.listen(PORT, HOST);
logger.info(`Running on http://${HOST}:${PORT}`); | 26.868132 | 99 | 0.675665 |
8601b5ad9976e0cb8cb55fef7b88795b8cc612e0 | 3,008 | go | Go | completers/black_completer/cmd/root.go | iandol/carapace-bin | d34776cbb37c79da3048f76fd5d7c5b2bc85bf39 | [
"MIT"
] | null | null | null | completers/black_completer/cmd/root.go | iandol/carapace-bin | d34776cbb37c79da3048f76fd5d7c5b2bc85bf39 | [
"MIT"
] | 6 | 2020-08-26T23:03:31.000Z | 2020-08-29T07:33:16.000Z | completers/black_completer/cmd/root.go | rsteube/carapace-completers | 1833feeff611b2859ddfb6f20988d12a90a1b3e7 | [
"MIT"
] | null | null | null | package cmd
import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "black",
Short: "The uncompromising code formatter",
Long: "https://github.com/psf/black",
Run: func(cmd *cobra.Command, args []string) {},
}
func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()
rootCmd.Flags().Bool("check", false, "Don't write the files back , just return the status.")
rootCmd.Flags().StringP("code", "c", "", "Format the code passed in as a string.")
rootCmd.Flags().Bool("color", false, "Show colored diff")
rootCmd.Flags().String("config", "", "Read configuration from FILE path.")
rootCmd.Flags().Bool("diff", false, "Don't write the files back, just output a diff for each file on stdout.")
rootCmd.Flags().String("exclude", "", "A regular expression that matches files and directories that should be excluded.")
rootCmd.Flags().String("extend-exclude", "", "Like --exclude, but adds additional files and directories on top of the excluded ones.")
rootCmd.Flags().Bool("fast", false, "Skip temporary sanity checks.")
rootCmd.Flags().String("force-exclude", "", "Like --exclude, but files and directories matching this regex will be excluded.")
rootCmd.Flags().BoolP("help", "h", false, "Show this message and exit.")
rootCmd.Flags().String("include", "", "A regular expression that matches files and directories that should be included.")
rootCmd.Flags().Bool("ipynb", false, "Format all input files like Jupyter Notebooks")
rootCmd.Flags().StringP("line-length", "l", "", "How many characters per line to allow.")
rootCmd.Flags().Bool("no-color", false, "Do not show colored diff")
rootCmd.Flags().Bool("pyi", false, "Format all input files like typing stubs regardless of file extension ")
rootCmd.Flags().BoolP("quiet", "q", false, "Don't emit non-error messages to stderr.")
rootCmd.Flags().String("required-version", "", "Require a specific version of Black to be running.")
rootCmd.Flags().Bool("safe", false, "Do not skip temporary sanity checks.")
rootCmd.Flags().BoolP("skip-magic-trailing-comma", "C", false, "Don't use trailing commas as a reason to split lines.")
rootCmd.Flags().BoolP("skip-string-normalization", "S", false, "Don't normalize string quotes or prefixes.")
rootCmd.Flags().String("stdin-filename", "", "The name of the file when passing it through stdin.")
rootCmd.Flags().StringP("target-version", "t", "", "Python versions that should be supported by Black's output.")
rootCmd.Flags().BoolP("verbose", "v", false, "Also emit messages to stderr about files that were not changed.")
rootCmd.Flags().Bool("version", false, "Show the version and exit.")
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"config": carapace.ActionValues(),
"target-version": carapace.ActionValues("py27", "py33", "py34", "py35", "py36", "py37", "py38", "py39", "py310"),
})
carapace.Gen(rootCmd).PositionalAnyCompletion(
carapace.ActionFiles(),
)
}
| 54.690909 | 135 | 0.708444 |
b14d4f934d00afa374b234d20cf0b1dc7c873f6c | 3,548 | c | C | ds/netapi/svcdlls/srvsvc/server/conn.c | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | ds/netapi/svcdlls/srvsvc/server/conn.c | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | ds/netapi/svcdlls/srvsvc/server/conn.c | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | /*++
Copyright (c) 1991-1992 Microsoft Corporation
Module Name:
Conn.c
Abstract:
This module contains support for the Connection catagory of APIs for
the NT server service.
Author:
David Treadwell (davidtr) 23-Feb-1991
Revision History:
--*/
#include "srvsvcp.h"
NET_API_STATUS NET_API_FUNCTION
NetrConnectionEnum (
IN LPTSTR ServerName,
IN LPTSTR Qualifier,
IN LPCONNECT_ENUM_STRUCT InfoStruct,
IN DWORD PreferredMaximumLength,
OUT LPDWORD TotalEntries,
IN OUT LPDWORD ResumeHandle OPTIONAL
)
/*++
Routine Description:
This routine communicates with the server FSD to implement the
NetConnectionEnum function.
Arguments:
None.
Return Value:
NET_API_STATUS - NO_ERROR or reason for failure.
--*/
{
NET_API_STATUS error;
PSERVER_REQUEST_PACKET srp;
ServerName;
//
// validate incomming string lengths
//
if(Qualifier!=NULL && StringCchLength(Qualifier,1024,NULL) != S_OK) {
return ERROR_INVALID_PARAMETER;
}
//
// Make sure that the level is valid. Since it is an unsigned
// value, it can never be less than 0.
//
if ( InfoStruct->Level > 1 ) {
return ERROR_INVALID_LEVEL;
}
//
// The qualifier cannot be null or can it be a null string
//
if ( Qualifier == NULL || *Qualifier == L'\0' ||
InfoStruct->ConnectInfo.Level1 == NULL ) {
return ERROR_INVALID_PARAMETER;
}
//
// Make sure that the caller is allowed to get connection
// information in the server.
//
error = SsCheckAccess(
&SsConnectionSecurityObject,
SRVSVC_CONNECTION_INFO_GET
);
if ( error != NO_ERROR ) {
return ERROR_ACCESS_DENIED;
}
//
// Set up the input parameters in the request buffer.
//
srp = SsAllocateSrp( );
if ( srp == NULL ) {
return ERROR_NOT_ENOUGH_MEMORY;
}
srp->Level = InfoStruct->Level;
#ifdef UNICODE
RtlInitUnicodeString( &srp->Name1, Qualifier );
#else
{
OEM_STRING ansiString;
NTSTATUS status;
NetpInitOemString( &ansiString, Qualifier );
status = RtlOemStringToUnicodeString( &srp->Name1, &ansiString, TRUE );
SS_ASSERT( NT_SUCCESS(status) );
}
#endif
if ( ARGUMENT_PRESENT( ResumeHandle ) ) {
srp->Parameters.Get.ResumeHandle = *ResumeHandle;
} else {
srp->Parameters.Get.ResumeHandle = 0;
}
//
// Get the data from the server. This routine will allocate the
// return buffer and handle the case where PreferredMaximumLength ==
// -1.
//
error = SsServerFsControlGetInfo(
FSCTL_SRV_NET_CONNECTION_ENUM,
srp,
(PVOID *)&InfoStruct->ConnectInfo.Level1->Buffer,
PreferredMaximumLength
);
//
// Set up return information.
//
InfoStruct->ConnectInfo.Level1->EntriesRead =
srp->Parameters.Get.EntriesRead;
*TotalEntries = srp->Parameters.Get.TotalEntries;
if ( srp->Parameters.Get.EntriesRead > 0 &&
ARGUMENT_PRESENT( ResumeHandle ) ) {
*ResumeHandle = srp->Parameters.Get.ResumeHandle;
}
#ifndef UNICODE
RtlFreeUnicodeString( &srp->Name1 );
#endif
SsFreeSrp( srp );
return error;
} // NetrConnectionEnum
| 21.901235 | 80 | 0.59611 |
1c1b9109069f8d3625053396d4943ac388390c3c | 221 | sql | SQL | core/store/migrate/migrations/0079_vrf_v2_fields.sql | solidity-external-tests/chainlink | c3c190e60fd2d119336fa1412b304644631cce01 | [
"MIT"
] | 2 | 2021-01-09T02:07:31.000Z | 2022-03-14T08:43:38.000Z | core/store/migrate/migrations/0079_vrf_v2_fields.sql | solidity-external-tests/chainlink | c3c190e60fd2d119336fa1412b304644631cce01 | [
"MIT"
] | 86 | 2021-06-15T04:27:56.000Z | 2022-02-14T10:18:23.000Z | core/store/migrate/migrations/0079_vrf_v2_fields.sql | solidity-external-tests/chainlink | c3c190e60fd2d119336fa1412b304644631cce01 | [
"MIT"
] | 2 | 2021-11-21T22:14:21.000Z | 2022-01-31T23:12:32.000Z | -- +goose Up
ALTER TABLE vrf_specs
ADD COLUMN from_address bytea,
ADD COLUMN poll_period bigint NOT NULL DEFAULT 0;
-- +goose Down
ALTER TABLE vrf_specs
DROP COLUMN from_address,
DROP COLUMN poll_period;
| 22.1 | 53 | 0.742081 |
49a7baecb8266c474c810bb3bbda8ce0ce5044e5 | 366 | html | HTML | live-examples/html-examples/input/file.html | AugustinusVonHippo/interactive-examples | 544fd3e08f6ea07e66ea66608d5cbafbb8e972a6 | [
"CC0-1.0"
] | 1 | 2021-05-06T12:56:50.000Z | 2021-05-06T12:56:50.000Z | live-examples/html-examples/input/file.html | AugustinusVonHippo/interactive-examples | 544fd3e08f6ea07e66ea66608d5cbafbb8e972a6 | [
"CC0-1.0"
] | null | null | null | live-examples/html-examples/input/file.html | AugustinusVonHippo/interactive-examples | 544fd3e08f6ea07e66ea66608d5cbafbb8e972a6 | [
"CC0-1.0"
] | null | null | null | <fieldset>
<legend>Profile</legend>
<div>
<label for="name">Display name:</label>
<input type="text" id="name" name="name"/>
</div>
<div>
<label for="avatar">Profile picture:</label>
<input type="file"
id="avatar" name="avatar"
accept="image/png, image/jpeg" />
</div>
</fieldset>
| 21.529412 | 52 | 0.516393 |
2692a680b92d5c2cafa0f4873ae37196fb0194f2 | 1,523 | lua | Lua | test.lua | BixData/lua-ads1015 | d33780cd4946b7e904342e60510f2e967a938610 | [
"MIT"
] | 1 | 2020-10-21T10:31:05.000Z | 2020-10-21T10:31:05.000Z | test.lua | BixData/lua-ads1015 | d33780cd4946b7e904342e60510f2e967a938610 | [
"MIT"
] | null | null | null | test.lua | BixData/lua-ads1015 | d33780cd4946b7e904342e60510f2e967a938610 | [
"MIT"
] | 1 | 2020-10-21T10:31:12.000Z | 2020-10-21T10:31:12.000Z | print('Begin test')
local ads1015 = require 'ads1015'
local periphery = require 'periphery'
-- ============================================================================
-- Mini test framework
-- ============================================================================
local failures = 0
local function assertEquals(expected,actual,message)
message = message or string.format('Expected %s but got %s', tostring(expected), tostring(actual))
assert(actual==expected, message)
end
local function it(message, testFn)
local status, err = pcall(testFn)
if status then
print(string.format('✓ %s', message))
else
print(string.format('✖ %s', message))
print(string.format(' FAILED: %s', err))
failures = failures + 1
end
end
-- ============================================================================
-- ads1015 module
-- ============================================================================
it('readSingleValue() works', function()
local i2c = periphery.I2C('/dev/i2c-1')
local device = 0x48
local channel = 0
local gain = 1
local dataRate = nil
local value = ads1015.readSingleValue(i2c, device, channel, gain, dataRate)
end)
it('readContinuous() works', function()
local i2c = periphery.I2C('/dev/i2c-1')
local device = 0x48
local channel = 0
local gain = 1
local dataRate = nil
local value = ads1015.startContinuous(i2c, device, channel, gain, dataRate)
value = ads1015.readContinuousValue(i2c, device)
ads1015.stopContinuous(i2c, device)
end)
| 29.288462 | 100 | 0.558109 |
21e249c98c34bf549a0c02b41402868d8412f9f0 | 392 | html | HTML | docs/genesis/42/4/index.html | mgwalker/kjv | 307cd82835997b90a8c2ceaffb4d1e8e280fc5ec | [
"0BSD"
] | null | null | null | docs/genesis/42/4/index.html | mgwalker/kjv | 307cd82835997b90a8c2ceaffb4d1e8e280fc5ec | [
"0BSD"
] | null | null | null | docs/genesis/42/4/index.html | mgwalker/kjv | 307cd82835997b90a8c2ceaffb4d1e8e280fc5ec | [
"0BSD"
] | null | null | null | <html lang="en">
<head>
<title>Genesis 42:4</title>
<link rel="stylesheet" href="../../../verse.css">
</head>
<body>
<div id="container">
<div id="wrapper">
<div id="metadata">Genesis 42:4</div>
<div id="verse">But Benjamin, Joseph's brother, Jacob sent not with his brethren; for he said, Lest peradventure mischief befall him.</div>
</div>
</div>
</body>
</html> | 28 | 145 | 0.622449 |
5694b0be2819107083357588d973187fb241b52f | 2,007 | go | Go | pkg/core/authn/info_test.go | SkygearIO/skygear-server | f4c76580359f5b849504aa3d854b87510667740b | [
"Apache-2.0"
] | 425 | 2016-04-10T23:26:05.000Z | 2022-01-26T08:42:13.000Z | pkg/core/authn/info_test.go | SkygearIO/skygear-server | f4c76580359f5b849504aa3d854b87510667740b | [
"Apache-2.0"
] | 1,117 | 2016-03-23T12:34:01.000Z | 2021-06-16T21:44:18.000Z | pkg/core/authn/info_test.go | SkygearIO/skygear-server | f4c76580359f5b849504aa3d854b87510667740b | [
"Apache-2.0"
] | 101 | 2016-03-19T02:10:42.000Z | 2022-01-26T08:42:14.000Z | package authn_test
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/skygeario/skygear-server/pkg/core/authn"
. "github.com/smartystreets/goconvey/convey"
)
func TestAuthnInfo(t *testing.T) {
Convey("AuthnInfo", t, func() {
Convey("should round-trip to/from HTTP headers correctly", func() {
rw := httptest.NewRecorder()
Convey("no auth", func() {
var i *authn.Info
i.PopulateHeaders(rw)
So(rw.Header(), ShouldResemble, http.Header{})
r := &http.Request{Header: rw.Header()}
ii, err := authn.ParseHeaders(r)
So(err, ShouldBeNil)
So(ii, ShouldResemble, i)
})
Convey("invalid auth", func() {
var i *authn.Info = &authn.Info{
IsValid: false,
}
i.PopulateHeaders(rw)
So(rw.Header(), ShouldResemble, http.Header{
"X-Skygear-Session-Valid": []string{"false"},
})
r := &http.Request{Header: rw.Header()}
ii, err := authn.ParseHeaders(r)
So(err, ShouldBeNil)
So(ii, ShouldResemble, i)
})
Convey("valid auth", func() {
var i *authn.Info = &authn.Info{
IsValid: true,
UserID: "user-id",
UserVerified: true,
UserDisabled: false,
UserAnonymous: true,
SessionACR: "http://schemas.openid.net/pape/policies/2007/06/multi-factor",
SessionAMR: []string{"pwd", "mfa", "otp"},
}
i.PopulateHeaders(rw)
So(rw.Header(), ShouldResemble, http.Header{
"X-Skygear-Session-Valid": []string{"true"},
"X-Skygear-User-Id": []string{"user-id"},
"X-Skygear-User-Verified": []string{"true"},
"X-Skygear-User-Disabled": []string{"false"},
"X-Skygear-User-Anonymous": []string{"true"},
"X-Skygear-Session-Acr": []string{"http://schemas.openid.net/pape/policies/2007/06/multi-factor"},
"X-Skygear-Session-Amr": []string{"pwd mfa otp"},
})
r := &http.Request{Header: rw.Header()}
ii, err := authn.ParseHeaders(r)
So(err, ShouldBeNil)
So(ii, ShouldResemble, i)
})
})
})
}
| 26.76 | 106 | 0.609865 |
59b9df1f325df05ab3e5d8977034e117953a89cb | 1,078 | ps1 | PowerShell | powershell/excel-azure-apps.ps1 | ammarsajid/devops-automation | d98783597996f565e447a29bc12f2cfb05287c67 | [
"MIT"
] | 1 | 2022-03-08T16:10:22.000Z | 2022-03-08T16:10:22.000Z | powershell/excel-azure-apps.ps1 | ammarsajid/devops-automation | d98783597996f565e447a29bc12f2cfb05287c67 | [
"MIT"
] | null | null | null | powershell/excel-azure-apps.ps1 | ammarsajid/devops-automation | d98783597996f565e447a29bc12f2cfb05287c67 | [
"MIT"
] | null | null | null | Login-AzureRmAccount
$subscriptionId = "123xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx4"
Select-AzureRmSubscription -SubscriptionID $subscriptionId
$Excel = New-Object -ComObject Excel.Application
$Excel.Visible = $True
$chartType = "microsoft.office.interop.excel.xlChartType" -as [type]
# after closing excel pop up
$workbook = $excel.workbooks.add()
$workbook.WorkSheets.item(1).Name = "Subscription1"
$Worksheet = $workbook.WorkSheets.Item("Subscription1")
$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlWorkbookDefault
# columns names and numbers
$x = 2
$Worksheet.cells.item(1,1) = "SiteName"
$Worksheet.cells.item(1,2) = "State"
$Worksheet.cells.item(1,3) = "HostNames"
$webapps = Get-AzureRmWebApp
foreach ($webapp in $webapps)
{
$Worksheet.cells.item($x,1) = $webapp.SiteName
$Worksheet.cells.item($x,2) = $webapp.State
#$Worksheet.cells.item($x,3) = $webapp.HostNames
For ($i=0; $i -le $webapp.HostNames.Count; $i++)
{
$Worksheet.cells.item($x,3+$i) = $webapp.HostNames[$i]
}
$x++
}
$range = $Worksheet.usedRange
$range.EntireColumn.AutoFit() | 30.8 | 81 | 0.733766 |
7473b68fa347cd329a2a1d5e14a132e7b1c3a8d7 | 1,797 | swift | Swift | ScrollViewAutolayoutTutorial/ScrollViewAutolayoutTutorial/View/Button.swift | viniciusbonemer/Tutorial-ScrollView-AutoLayout-FinalProject | 677f02f5e1b62cac4cbdf78352b9b48af126cfb2 | [
"MIT"
] | null | null | null | ScrollViewAutolayoutTutorial/ScrollViewAutolayoutTutorial/View/Button.swift | viniciusbonemer/Tutorial-ScrollView-AutoLayout-FinalProject | 677f02f5e1b62cac4cbdf78352b9b48af126cfb2 | [
"MIT"
] | null | null | null | ScrollViewAutolayoutTutorial/ScrollViewAutolayoutTutorial/View/Button.swift | viniciusbonemer/Tutorial-ScrollView-AutoLayout-FinalProject | 677f02f5e1b62cac4cbdf78352b9b48af126cfb2 | [
"MIT"
] | null | null | null | //
// Button.swift
// ScrollViewAutolayoutTutorial
//
// Created by Vinícius Bonemer on 21/09/2018.
// Copyright © 2018 Vinícius Bonemer. All rights reserved.
//
import UIKit
/**
Uma subclessa de UIButton
Fornece um jeito fácil de inicializar um novo Button e excolher o seu type
*/
class Button: UIButton {
/**
O tipo do Button
Quando essa propriedade muda, ela atualiza os aspectos visuais do Button para ficar de acordo com esse type
*/
var type: CustomType = .rectangle {
willSet {
switch newValue {
case .rectangle:
backgroundColor = .buttonRed
setTitleColor(.white, for: .normal)
case .text:
backgroundColor = .clear
setTitleColor(.buttonRed, for: .normal)
}
}
}
/**
Cria um `Button` com type `Button.CustomType.rectangle`
*/
init() {
super.init(frame: .zero)
layer.cornerRadius = 8.0
backgroundColor = .buttonRed
setTitle("Button", for: .normal)
titleLabel?.font = UIFont.systemFont(ofSize: 24)
titleLabel?.textAlignment = .center
setTitleColor(.white, for: .normal)
setTitleColor(.pressedButton, for: .highlighted)
}
/**
Cria um `Button` com type `Button.CustomType.rectangle` e bota seu título
- Parameter title: The title of the button
*/
convenience init(title: String) {
self.init()
setTitle(title, for: .normal)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension Button {
/**
Tipods possíveis para o botão
*/
enum CustomType {
case rectangle, text
}
}
| 24.283784 | 112 | 0.589316 |
6cd39a5d99c2d7e55e14ff185e35e6a15c96acef | 4,066 | go | Go | internal/extractor/image/cache.go | crazy-max/undock | 5e2d0923e59ea1bbf1819adc985a76b6a1201d80 | [
"MIT"
] | 78 | 2022-01-24T13:34:50.000Z | 2022-03-31T15:58:02.000Z | internal/extractor/image/cache.go | crazy-max/undock | 5e2d0923e59ea1bbf1819adc985a76b6a1201d80 | [
"MIT"
] | 5 | 2022-01-26T14:17:54.000Z | 2022-03-28T12:48:27.000Z | internal/extractor/image/cache.go | crazy-max/undock | 5e2d0923e59ea1bbf1819adc985a76b6a1201d80 | [
"MIT"
] | 6 | 2022-01-25T01:05:46.000Z | 2022-03-12T06:42:08.000Z | package image
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"path/filepath"
"strings"
"github.com/containers/image/v5/copy"
"github.com/containers/image/v5/docker"
"github.com/containers/image/v5/signature"
"github.com/containers/image/v5/transports/alltransports"
"github.com/containers/image/v5/types"
dockercli "github.com/crazy-max/undock/pkg/docker"
"github.com/crazy-max/undock/pkg/image"
"github.com/pkg/errors"
"github.com/rs/zerolog"
)
func (c *Client) cacheSource(src string) ([]byte, string, error) {
srcCtx, srcObj, err := c.srcCtx(src, c.cli.Insecure)
if err != nil {
return nil, "", errors.Wrap(err, "cannot create source context")
}
srcRef, err := srcObj.Reference()
if err != nil {
return nil, "", errors.Wrapf(err, "cannot parse reference '%s'", srcObj.String())
}
var cacheDigest string
switch srcObj.Scheme() {
case "docker":
dockerImg, err := image.Parse(strings.TrimPrefix(src, "docker://"))
if err != nil {
return nil, "", err
}
dockerRef, err := image.Reference(dockerImg.String())
if err != nil {
return nil, "", errors.Wrap(err, "cannot parse docker reference")
}
if dgst, err := docker.GetDigest(c.ctx, srcCtx, dockerRef); err == nil {
cacheDigest = srcObj.Scheme() + "-" + dgst.Encoded()
} else {
return nil, "", errors.Wrap(err, "cannot get docker reference digest")
}
case "docker-daemon":
dcli, err := dockercli.New(c.ctx)
if err != nil {
return nil, "", err
}
if img, err := dcli.ImageInspectWithRaw(strings.TrimPrefix(src, "docker-daemon://")); err == nil {
cacheDigest = srcObj.Scheme() + "-" + strings.TrimPrefix(img.ID, "sha256:")
} else {
return nil, "", err
}
default:
// TODO: Find a proper way to create a cache fingerprint. Best effort atm with transport.
srcHash := sha256.New()
srcHash.Write([]byte(srcRef.StringWithinTransport()))
cacheDigest = srcObj.Scheme() + "-" + hex.EncodeToString(srcHash.Sum(nil))
}
cachedir := filepath.Join(c.cli.CacheDir, cacheDigest)
c.logger.Info().Msgf("Computed cache digest %s", cacheDigest)
dstRef, err := alltransports.ParseImageName(fmt.Sprintf("oci:%s", cachedir))
if err != nil {
return nil, "", errors.Wrapf(err, "invalid oci cache folder %s", cachedir)
}
dstCtx, err := c.dstCtx(cachedir)
if err != nil {
return nil, "", err
}
imageSelection := copy.CopySystemImage
if c.cli.All {
imageSelection = copy.CopyAllImages
}
policyContext, err := signature.NewPolicyContext(&signature.Policy{Default: []signature.PolicyRequirement{signature.NewPRInsecureAcceptAnything()}})
if err != nil {
return nil, "", err
}
defer policyContext.Destroy() //nolint:errcheck
manblob, err := copy.Image(c.ctx, policyContext, dstRef, srcRef, ©.Options{
ReportWriter: &progressWriter{logger: c.logger},
SourceCtx: srcCtx,
DestinationCtx: dstCtx,
ImageListSelection: imageSelection,
OptimizeDestinationImageAlreadyExists: true,
})
return manblob, cachedir, err
}
func (c *Client) srcCtx(name string, insecure bool) (*types.SystemContext, *Source, error) {
sysCtx := &types.SystemContext{
DockerDaemonInsecureSkipTLSVerify: insecure,
DockerInsecureSkipTLSVerify: types.NewOptionalBool(insecure),
DockerRegistryUserAgent: c.meta.UserAgent,
OSChoice: c.platform.OS,
ArchitectureChoice: c.platform.Architecture,
VariantChoice: c.platform.Variant,
BlobInfoCacheDir: filepath.Join(c.cli.CacheDir, "blobs"),
}
return sysCtx, NewSource(name), nil
}
func (c *Client) dstCtx(name string) (*types.SystemContext, error) {
return &types.SystemContext{
DirForceDecompress: true,
BlobInfoCacheDir: filepath.Join(c.cli.CacheDir, "blobs"),
}, nil
}
type progressWriter struct {
logger zerolog.Logger
writer io.Writer
}
func (w *progressWriter) Write(p []byte) (n int, err error) {
w.logger.Info().Msgf("%s", strings.TrimSpace(string(p)))
return len(p), nil
}
| 31.765625 | 149 | 0.671176 |
2f0559c0ed1a6820c15eb04feba1f35ee25d3e4a | 444 | php | PHP | config/web.php | houzhy/Laravel-bookmall | 40158347a8563bf250d34b07dcbca0c2f8b4eb81 | [
"MIT"
] | 1 | 2017-12-21T06:05:57.000Z | 2017-12-21T06:05:57.000Z | config/web.php | houzhy/Laravel-bookmall | 40158347a8563bf250d34b07dcbca0c2f8b4eb81 | [
"MIT"
] | null | null | null | config/web.php | houzhy/Laravel-bookmall | 40158347a8563bf250d34b07dcbca0c2f8b4eb81 | [
"MIT"
] | null | null | null | <?php return array (
'web_title' => 'phpclass博客',
'web_count' => '数据库设计',
'web_status' => '1',
'seo_title' => '--政延的博客, 总结经验, 收集资料, 针对php后台技术',
'keywords' => 'php,laravel,thinkphp,yii,mysql,redis,mongdb,socket',
'description' => '政延的博客, 总结经验, 收集资料, 针对php,laravel,thinkphp,yii,mysql,redis,mongdb,socket后台技术收集整理',
'copyright' => 'Design by phpclass <a href="http://www.phpclass.top/" target="_blank">http://www.phpclass.top</a>',
); | 49.333333 | 117 | 0.666667 |
8f6c47200cff3dc57c47520b5103fcaf2634821c | 1,770 | lua | Lua | Lua/Game/MainUI/MainUISkillBtnView.lua | husheng0/UnityMMO | efeb13265f76374127af940e865f1d49e7ada846 | [
"MIT"
] | 1 | 2019-11-14T06:11:28.000Z | 2019-11-14T06:11:28.000Z | Lua/Game/MainUI/MainUISkillBtnView.lua | husheng0/UnityMMO | efeb13265f76374127af940e865f1d49e7ada846 | [
"MIT"
] | null | null | null | Lua/Game/MainUI/MainUISkillBtnView.lua | husheng0/UnityMMO | efeb13265f76374127af940e865f1d49e7ada846 | [
"MIT"
] | null | null | null | local MainUISkillBtnView = BaseClass()
function MainUISkillBtnView:DefaultVar( )
return {
UIConfig = {
prefab_path = "Assets/AssetBundleRes/ui/mainui/MainUISkillBtnView.prefab",
canvas_name = "MainUI",
components = {
-- {UI.HideOtherView},
{UI.DelayDestroy, {delay_time=5}},
},
},
}
end
function MainUISkillBtnView:OnLoad( )
local names = {
"correct:obj","skill_3:obj","skill_4:obj","jump","skill_1:obj","skill_2:obj","attack:obj",
}
UI.GetChildren(self, self.transform, names)
self:AddEvents()
self:UpdateView()
end
function MainUISkillBtnView:AddEvents( )
local on_click = function ( click_btn )
if click_btn == self.correct_obj then
SceneMgr.Instance:CorrectMainRolePos()
elseif click_btn == self.skill_1_obj then
CS.UnityMMO.GameInput.GetInstance():SetKeyUp(CS.UnityEngine.KeyCode.I, true)
elseif click_btn == self.skill_2_obj then
CS.UnityMMO.GameInput.GetInstance():SetKeyUp(CS.UnityEngine.KeyCode.O, true)
elseif click_btn == self.skill_3_obj then
CS.UnityMMO.GameInput.GetInstance():SetKeyUp(CS.UnityEngine.KeyCode.K, true)
elseif click_btn == self.skill_4_obj then
CS.UnityMMO.GameInput.GetInstance():SetKeyUp(CS.UnityEngine.KeyCode.L, true)
elseif click_btn == self.attack_obj then
CS.UnityMMO.GameInput.GetInstance():SetKeyUp(CS.UnityEngine.KeyCode.J, true)
end
end
UIHelper.BindClickEvent(self.correct_obj, on_click)
UIHelper.BindClickEvent(self.skill_1_obj, on_click)
UIHelper.BindClickEvent(self.skill_2_obj, on_click)
UIHelper.BindClickEvent(self.skill_3_obj, on_click)
UIHelper.BindClickEvent(self.skill_4_obj, on_click)
UIHelper.BindClickEvent(self.attack_obj, on_click)
end
function MainUISkillBtnView:UpdateView( )
end
return MainUISkillBtnView | 31.607143 | 92 | 0.756497 |
8e81d7ea4481e1b4645953c7973fa977c3d2c9e2 | 216 | lua | Lua | src/triggers/spawn_facing.lua | bbb651/Loenn | 06039945ad6b0d0b91a90fbfd8d66d06769106ff | [
"MIT"
] | 52 | 2019-07-11T22:15:21.000Z | 2022-03-26T23:42:38.000Z | src/triggers/spawn_facing.lua | bbb651/Loenn | 06039945ad6b0d0b91a90fbfd8d66d06769106ff | [
"MIT"
] | 16 | 2020-01-23T02:30:45.000Z | 2022-02-20T03:59:14.000Z | src/triggers/spawn_facing.lua | bbb651/Loenn | 06039945ad6b0d0b91a90fbfd8d66d06769106ff | [
"MIT"
] | 10 | 2019-08-11T20:17:05.000Z | 2021-12-22T23:15:10.000Z | -- TODO Editing options: facing
local spawnFacing = {}
spawnFacing.name = "spawnFacingTrigger"
spawnFacing.placements = {
name = "spawn_facing",
data = {
facing = "Right"
}
}
return spawnFacing | 16.615385 | 39 | 0.657407 |
859afddae3008f9278804b7550e32baf545c1e0a | 5,124 | js | JavaScript | docusaurus-plugin-openapi/src/theme/ApiRequestBodyTable/index.js | ren-forks/docusaurus-plugin-openapi | ec658617f70f661ab6e5edf8dbe6d95f0981b0e3 | [
"MIT"
] | null | null | null | docusaurus-plugin-openapi/src/theme/ApiRequestBodyTable/index.js | ren-forks/docusaurus-plugin-openapi | ec658617f70f661ab6e5edf8dbe6d95f0981b0e3 | [
"MIT"
] | null | null | null | docusaurus-plugin-openapi/src/theme/ApiRequestBodyTable/index.js | ren-forks/docusaurus-plugin-openapi | ec658617f70f661ab6e5edf8dbe6d95f0981b0e3 | [
"MIT"
] | null | null | null | import React from "react";
import MD from "react-markdown/with-html";
import styles from "./styles.module.css";
function parseFinalSchema(schema) {
if (schema.$ref) {
return schema.$ref.replace("#/components/schemas/", "") + " (circular)";
}
if (schema.format) {
return schema.format;
}
if (schema.type === "object") {
return schema.xml?.name || schema.type;
}
return schema.title || schema.type;
}
function getSchemaName(schema) {
if (schema.type === "array") {
return parseFinalSchema(schema.items) + "[]";
}
return parseFinalSchema(schema);
}
function Row({ name, schema, required }) {
return (
<tr>
<td>
<code>{name}</code>
<span style={{ opacity: "0.6" }}> {getSchemaName(schema)}</span>
{!required && (
<>
{<span style={{ opacity: "0.6" }}> — </span>}
<strong
style={{
fontSize: "var(--ifm-code-font-size)",
color: "var(--openapi-code-blue)",
}}
>
{" "}
OPTIONAL
</strong>
</>
)}
{schema.description && (
<div className={styles.description}>
<MD
escapeHtml={false}
className="table-markdown"
source={schema.description}
/>
</div>
)}
<Rows schema={schema} />
</td>
</tr>
);
}
function Rows({ schema }) {
// object
if (schema.properties !== undefined) {
return (
<table
style={{
display: "table",
marginTop: "var(--ifm-table-cell-padding)",
marginBottom: "0px",
}}
>
<tbody>
{Object.keys(schema.properties).map((key) => {
return (
<Row
key={key}
name={key}
schema={schema.properties[key]}
required={schema.required?.includes(key)}
/>
);
})}
</tbody>
</table>
);
}
// array
if (schema.items !== undefined) {
return <Rows schema={schema.items} />;
}
// primitive
return null;
}
function RowsRoot({ schema }) {
// object
if (schema.properties !== undefined) {
return (
<>
{Object.keys(schema.properties).map((key) => {
return (
<Row
key={key}
name={key}
schema={schema.properties[key]}
required={schema.required?.includes(key)}
/>
);
})}
</>
);
}
// array
if (schema.items !== undefined) {
return <Rows schema={schema.items} />;
}
// primitive
return (
<tr>
<td>
<span style={{ opacity: "0.6" }}> {schema.type}</span>
{schema.description && (
<div className={styles.description}>
<MD
escapeHtml={false}
className="table-markdown"
source={schema.description}
/>
</div>
)}
</td>
</tr>
);
}
function RequestBodyTable({ body, title }) {
if (body === undefined) {
return null;
}
console.log(body);
// NOTE: We just pick a random content-type.
// How common is it to have multiple?
const randomFirstKey = Object.keys(body.content)[0];
let firstBody = body.content[randomFirstKey].schema;
// we don't show the table if there is no properties to show
if (Object.keys(firstBody.properties || {}).length === 0) {
return null;
}
if (firstBody.properties.params) {
firstBody = firstBody.properties.params;
}
if (firstBody.properties.result) {
firstBody = firstBody.properties.result;
}
return (
<>
<h3>Request</h3>
<table style={{ display: "table" }}>
<thead>
<tr>
<th style={{ textAlign: "left" }}>
{title + " "}
{/* {body.required && (
<>
{
<span style={{ opacity: "0.6", fontWeight: "normal" }}>
{" "}
—{" "}
</span>
}
<strong
style={{
fontSize: "var(--ifm-code-font-size)",
color: "var(--openapi-required)",
}}
>
{" "}
REQUIRED
</strong>
</>
)} */}
<div style={{ fontWeight: "normal" }}>
<MD
className="table-markdown"
escapeHtml={false}
source={body.description}
/>
</div>
</th>
</tr>
</thead>
<tbody>
<RowsRoot schema={firstBody} />
{Object.keys(firstBody.properties).length === 0 ? (
<tr>
<td>No parameters.</td>
</tr>
) : (
""
)}
</tbody>
</table>
</>
);
}
export default RequestBodyTable;
| 23.18552 | 76 | 0.443404 |
3c450cf66bd32fa72ea80dffa5c503ab2fa45701 | 12,942 | dart | Dart | lib/utils/util.dart | sadaks-me/simply_schedule | 3d5dcf436b74284c259a1368c2c9ce1a1cca3ec3 | [
"Unlicense"
] | 1 | 2022-01-22T08:27:02.000Z | 2022-01-22T08:27:02.000Z | lib/utils/util.dart | sadaks-me/simply_schedule | 3d5dcf436b74284c259a1368c2c9ce1a1cca3ec3 | [
"Unlicense"
] | null | null | null | lib/utils/util.dart | sadaks-me/simply_schedule | 3d5dcf436b74284c259a1368c2c9ce1a1cca3ec3 | [
"Unlicense"
] | null | null | null | import 'dart:convert';
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart'
hide AndroidOptions;
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:googleapis/calendar/v3.dart' as cal;
import 'package:googleapis_auth/auth_io.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import 'package:ical/serializer.dart';
import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart';
import 'package:pigment/pigment.dart';
import 'package:schedule/models/event_info.dart';
import 'package:schedule/screens/home_screen.dart';
import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import '../secrets.dart';
import 'calendar_client.dart';
var credBox = Hive.box('credential_box');
var eventBox = Hive.box('event_box');
var _clientID = ClientId(
Platform.isAndroid ? Secret.ANDROID_CLIENT_ID : Secret.IOS_CLIENT_ID, "");
const _scopes = [cal.CalendarApi.calendarScope];
extension TimeOfDayExtension on TimeOfDay {
TimeOfDay plusMinutes(int minutes) {
if (minutes == 0) {
return this;
} else {
int mofd = hour * 60 + minute;
int newMofd = ((minutes % 1440) + mofd + 1440) % 1440;
if (mofd == newMofd) {
return this;
} else {
int newHour = newMofd ~/ 60;
int newMinute = newMofd % 60;
return TimeOfDay(hour: newHour, minute: newMinute);
}
}
}
TimeOfDay roundMinutes() {
if (minute < 30) {
return replacing(hour: hour, minute: 30);
} else {
return replacing(hour: hour + 1, minute: 0);
}
}
}
Future clientLogin() async {
await clientViaUserConsent(_clientID, _scopes, openBrowser)
.then((client) async {
client.credentialUpdates.listen((AccessCredentials credentials) {
credBox.put("credentials", jsonEncode(credentialsToJson(credentials)));
});
credBox.put(
"credentials", jsonEncode(credentialsToJson(client.credentials)));
CalendarClient.calendar = cal.CalendarApi(client);
if (Platform.isAndroid && mBrowser.isOpened()) {
await mBrowser.close();
} else {
await closeWebView();
}
Get.off(() => const HomeScreen());
});
}
Map<String, dynamic> credentialsToJson(AccessCredentials credentials) => {
'accessToken': credentials.accessToken.toJson(),
if (credentials.refreshToken != null)
'refreshToken': credentials.refreshToken,
'idToken': credentials.idToken,
'scopes': credentials.scopes,
};
AccessCredentials credentialsFromJson(Map<String, dynamic> credentials) {
List<String> scopes = [];
credentials["scopes"].forEach((s) => scopes.add(s));
return AccessCredentials(AccessToken.fromJson(credentials["accessToken"]),
credentials["refreshToken"], scopes,
idToken: credentials["idToken"]);
}
Future<AuthClient> getRefreshedClient(AccessCredentials credentials) async {
AccessCredentials newCredentials =
await refreshCredentials(_clientID, credentials, http.Client());
return authenticatedClient(http.Client(), newCredentials);
}
void launchUrl(String url) async {
if (await canLaunch(url)) {
await launch(url,
webOnlyWindowName: "Google Calendar",
enableDomStorage: true,
enableJavaScript: true,
statusBarBrightness: Brightness.dark,
forceSafariVC: true,
forceWebView: true,
headers: {
"User-Agent":
"Mozilla / 5.0(Linux; Android 9; LG - H870 Build / PKQ1 .190522 .001) AppleWebKit / 537.36(KHTML, like Gecko) Version / 4.0 Chrome / 83.0 .4103 .106 Mobile Safari / 537.36"
});
} else {
throw 'Could not launch $url';
}
}
void openBrowser(String url) async {
if (Platform.isAndroid) {
if (mBrowser.isOpened()) await mBrowser.close();
mBrowser.addMenuItems([]);
await mBrowser.open(
url: Uri.tryParse(url)!,
options: ChromeSafariBrowserClassOptions(
android: AndroidChromeCustomTabsOptions(
showTitle: false,
addDefaultShareMenuItem: false,
enableUrlBarHiding: true,
toolbarBackgroundColor: Colors.black),
));
} else {
if (await canLaunch(url)) {
await launch(url,
webOnlyWindowName: "Google Calendar",
enableDomStorage: true,
enableJavaScript: true,
statusBarBrightness: Brightness.dark,
forceSafariVC: true,
forceWebView: true,
headers: {
"User-Agent":
"Mozilla / 5.0(Linux; Android 9; LG - H870 Build / PKQ1 .190522 .001) AppleWebKit / 537.36(KHTML, like Gecko) Version / 4.0 Chrome / 83.0 .4103 .106 Mobile Safari / 537.36"
});
} else {
throw 'Could not launch $url';
}
}
}
ChromeSafariBrowser mBrowser = MyChromeSafariBrowser();
class MyChromeSafariBrowser extends ChromeSafariBrowser {
@override
void onOpened() {
debugPrint("ChromeSafari browser opened");
}
@override
void onCompletedInitialLoad() {
debugPrint("ChromeSafari browser initial load completed");
}
@override
void onClosed() {
debugPrint("ChromeSafari browser closed");
}
}
void generateIcs(EventInfo eventInfo) async {
String tempDir = (await getTemporaryDirectory()).path;
final File file = File('$tempDir/invite.ics');
await file.writeAsString(createIcs(eventInfo));
await Share.shareFiles([file.path], subject: eventInfo.title);
}
String createIcs(EventInfo eventInfo) {
formatDateTime(DateTime dt) => dt.isUtc
? DateFormat("yyyyMMdd'T'HHmmss'Z'").format(dt)
: DateFormat("yyyyMMdd'T'HHmmss").format(dt);
var out = StringBuffer()
..writecrlf('BEGIN:VCALENDAR')
..writecrlf('PRODID:-//Google Inc//Google Calendar 70.9054//EN')
..writecrlf('VERSION:2.0')
..writecrlf('CALSCALE:GREGORIAN')
..writecrlf('METHOD:REQUEST')
..writecrlf('BEGIN:VEVENT')
..writecrlf(
'DTSTART:${formatDateTime(DateTime.fromMillisecondsSinceEpoch(eventInfo.startTimeInEpoch))}')
..writecrlf(
'DTEND:${formatDateTime(DateTime.fromMillisecondsSinceEpoch(eventInfo.endTimeInEpoch))}')
..writecrlf('DTSTAMP:${formatDateTime(DateTime.now())}')
..writecrlf(
'ORGANIZER;CN=${eventInfo.organizerEmail}:mailto:${eventInfo.organizerEmail}')
..writecrlf('UID:${eventInfo.iCalUid}')
..writecrlf('X-GOOGLE-CONFERENCE:${eventInfo.meetLink}')
..writecrlf('CREATED:${formatDateTime(DateTime.now())}')
..writecrlf('DESCRIPTION:Join: ${eventInfo.meetLink}\n\n')
..writecrlf('LAST-MODIFIED:${formatDateTime(DateTime.now())}')
..writecrlf('LOCATION:${eventInfo.location}')
..writecrlf('SEQUENCE:0')
..writecrlf('STATUS:${eventInfo.status.toUpperCase()}')
..writecrlf('SUMMARY:${eventInfo.title}')
..writecrlf('TRANSP:OPAQUE')
..writecrlf('END:VEVENT')
..writecrlf('END:VCALENDAR');
debugPrint(out.toString());
return out.toString();
}
var inputDecoration = InputDecoration(
filled: true,
fillColor: Colors.white10,
disabledBorder: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(color: Colors.white24, width: 1),
),
enabledBorder: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(color: Colors.white24, width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(color: Pigment.fromString('#9b77cf'), width: 1),
),
errorBorder: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(color: Colors.redAccent, width: 1),
),
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
),
contentPadding: const EdgeInsets.only(left: 10, right: 10),
errorStyle: const TextStyle(
fontSize: 12,
color: Colors.redAccent,
),
);
class Utils {
static ThemeData appTheme = ThemeData(
visualDensity: VisualDensity.adaptivePlatformDensity,
primarySwatch: Colors.blue,
primaryColor: Pigment.fromString('#11142b'),
backgroundColor: Pigment.fromString('#11142b'),
secondaryHeaderColor: Pigment.fromString('#5186ec'),
appBarTheme: const AppBarTheme(backgroundColor: Colors.black),
colorScheme:
ColorScheme.fromSwatch(accentColor: Pigment.fromString('#9b77cf')),
scaffoldBackgroundColor: Pigment.fromString('#181f25'),
fontFamily: GoogleFonts.rubik().fontFamily);
static ThemeData pickerTheme = appTheme.copyWith(
colorScheme: ColorScheme.light(
primary: Pigment.fromString('#9b77cf'), // header background color
onPrimary: Colors.white, // header text color
onSurface: Colors.black, // body text color
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
primary: Pigment.fromString('#5186ec'), // button text color
),
),
);
}
class Fonts {
//Match pubspec font weights
static const FontWeight fontWeightBook = FontWeight.w300;
static const FontWeight fontWeightMedium = FontWeight.w500;
static const FontWeight fontWeightBold = FontWeight.w700;
static const FontWeight fontWeightExtraBold = FontWeight.w900;
static TextStyle display1({
double? size = 30,
FontWeight weight = Fonts.fontWeightBold,
Color? colour = Colors.white,
double letterSpacing = 0,
}) =>
TextStyle(
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
static TextStyle display2({
double size = 26,
FontWeight weight = Fonts.fontWeightBold,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
static TextStyle display3({
double size = 23,
FontWeight weight = Fonts.fontWeightBold,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
static TextStyle display4({
double size = 20,
FontWeight weight = Fonts.fontWeightBold,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
static TextStyle display5({
double size = 18,
FontWeight weight = Fonts.fontWeightBold,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
static TextStyle title({
double size = 16,
FontWeight weight = Fonts.fontWeightBold,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
TextDecoration? decoration,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
decoration: decoration);
static TextStyle subtitle({
double size = 14,
FontWeight weight = Fonts.fontWeightMedium,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
static TextStyle body1({
double size = 13,
FontWeight weight = Fonts.fontWeightBook,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
static TextStyle body2({
double size = 12,
FontWeight weight = Fonts.fontWeightBook,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
static TextStyle caption({
double size = 11,
FontWeight weight = Fonts.fontWeightMedium,
Color? colour = Colors.white,
double? letterSpacing,
double? height,
}) =>
TextStyle(
height: height,
fontSize: size,
fontWeight: weight,
color: colour,
letterSpacing: letterSpacing,
);
}
| 30.814286 | 188 | 0.663576 |
05f0c7b19262ba461c1e819d3ced8c2e60a920a9 | 30,967 | html | HTML | documentation/classes/cordovasqliteconnectorconfiguration.html | margarito/angular2-cordova-sqlite-orm | d8cc37aba79940adea989aaa9a34621de04a5373 | [
"MIT"
] | 5 | 2017-08-16T07:48:17.000Z | 2018-07-13T08:49:35.000Z | documentation/classes/cordovasqliteconnectorconfiguration.html | margarito/angular2-cordova-sqlite-orm | d8cc37aba79940adea989aaa9a34621de04a5373 | [
"MIT"
] | 2 | 2018-03-10T10:24:44.000Z | 2018-08-01T15:40:05.000Z | documentation/classes/cordovasqliteconnectorconfiguration.html | margarito/angular2-cordova-sqlite-orm | d8cc37aba79940adea989aaa9a34621de04a5373 | [
"MIT"
] | 3 | 2017-10-16T14:17:41.000Z | 2018-10-11T14:38:15.000Z | <!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>CordovaSqliteConnectorConfiguration | ng-db-helper</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">ng-db-helper</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="cordovasqliteconnectorconfiguration.html">CordovaSqliteConnectorConfiguration</a>
</li>
</ul>
<h1>Class CordovaSqliteConnectorConfiguration</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>class</dt>
<dd><p><code>CordovaSqliteConnectorConfiguration</code></p>
</dd>
<dt>description</dt>
<dd><p>This class is a default configuration for connector <a href="cordovasqliteconnector.html">CordovaSqliteConnector</a>
it provides config key to add copy informations.</p>
<ul>
<li><code>dbName</code> : filename for database on target device, default value is <code>'database.db'</code>,</li>
<li><code>doCopyDb</code> : flag to create database by copy, other configurations provides source informations, default value is false,</li>
<li><code>sourceDbName</code> : the db name to copy from the project files, default value is <code>'www/assets/'</code>,</li>
<li><code>sourceDbPath</code> : path to the db relative to the root of the project, default is <code>'database.db'</code>,</li>
<li><code>location</code> : see <code>cordova-sqlite-storage</code> location parameter on database open method, default is <code>'location'</code>,</li>
<li><code>initDatamodel</code> : function called on model initialization, if you add your custom logic, part of previous configuration will
not be needed, method signature: <code>(dataModel: DataModel, db: SQLiteDatabase) => Observable<any></code></li>
<li><code>upgradeDataModel</code> : this function is the function to replace to manage model migration, see the method signature:
<code>(dataModel: DataModel, db: SQLiteDatabase, oldVarsion: number) => Observable<any></code>. New data model share the new
version number and old version is passed too. DataModel object is generated from annotation and the version putted from the
configuration, all is here to write migration script.</li>
</ul>
</dd>
<dt>example</dt>
<dd><pre><code class="lang-typescript"><span class="hljs-keyword">const</span> config = <span class="hljs-keyword">new</span> CordovaSqliteConnectorConfiguration();
<span class="hljs-comment">// configure db name on device</span>
config.dbName = app.sqlite;
<span class="hljs-comment">// configure the database to copy from</span>
config.sourceDbName = db.sqlite;
<span class="hljs-comment">// configure the path to the database</span>
config.sourceDbPath = <span class="hljs-string">'www/assets/db/'</span>;
<span class="hljs-comment">// turn on db init by copy</span>
config.doCopyDb = <span class="hljs-literal">true</span>;
<span class="hljs-comment">// add config to connector</span>
<span class="hljs-keyword">const</span> connector = CordovaSqliteConnector(config);
<span class="hljs-comment">// add your connector to module configuration</span>
</code></pre>
</dd>
<dt>author</dt>
<dd><p>Olivier Margarit</p>
</dd>
<dt>since</dt>
<dd><p>0.1</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">CordovaSqliteConnectorConfiguration</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section tsd-is-external">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#dbname" class="tsd-kind-icon">db<wbr>Name</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#docopydb" class="tsd-kind-icon">do<wbr>Copy<wbr>Db</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#location" class="tsd-kind-icon">location</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#sourcedbname" class="tsd-kind-icon">source<wbr>DbName</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#sourcedbpath" class="tsd-kind-icon">source<wbr>DbPath</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-external">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#createtables" class="tsd-kind-icon">create<wbr>Tables</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#droptables" class="tsd-kind-icon">drop<wbr>Tables</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#initdatamodel" class="tsd-kind-icon">init<wbr>Data<wbr>Model</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="cordovasqliteconnectorconfiguration.html#upgradedatamodel" class="tsd-kind-icon">upgrade<wbr>Data<wbr>Model</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-external">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="dbname" class="tsd-anchor"></a>
<h3>db<wbr>Name</h3>
<div class="tsd-signature tsd-kind-icon">db<wbr>Name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "database.db"</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L53">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:53</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>property</dt>
<dd><p>{string} dbName file name of the database on the device</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="docopydb" class="tsd-anchor"></a>
<h3>do<wbr>Copy<wbr>Db</h3>
<div class="tsd-signature tsd-kind-icon">do<wbr>Copy<wbr>Db<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L78">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:78</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>property</dt>
<dd><p>{boolean} doCopyDb activate database initialisation by copy. if propert is false (default value)
database would be initialise by generated script using the datamodel generated with model annotations</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="location" class="tsd-anchor"></a>
<h3>location</h3>
<div class="tsd-signature tsd-kind-icon">location<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "default"</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L71">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:71</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>property</dt>
<dd><p>{string} location config for cordova-sqlite-storage (see cordova plugin documentation)</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="sourcedbname" class="tsd-anchor"></a>
<h3>source<wbr>DbName</h3>
<div class="tsd-signature tsd-kind-icon">source<wbr>DbName<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = this.dbName</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L59">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:59</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>property</dt>
<dd><p>{string} sourceDbName file name of the database to copy on the device</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="sourcedbpath" class="tsd-anchor"></a>
<h3>source<wbr>DbPath</h3>
<div class="tsd-signature tsd-kind-icon">source<wbr>DbPath<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "www/assets/"</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L65">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:65</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>property</dt>
<dd><p>{string} sourceDbPath file path of the database oto copy the device</p>
</dd>
</dl>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-external">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-external">
<a name="createtables" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagPrivate">Private</span> create<wbr>Tables</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-external">
<li class="tsd-signature tsd-kind-icon">create<wbr>Tables<span class="tsd-signature-symbol">(</span>dataModel<span class="tsd-signature-symbol">: </span><a href="datamodel.html" class="tsd-signature-type">DataModel</a>, db<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, doDrop<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L120">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:120</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>method</dt>
<dd><p>createTables create table linked to datamodel (not table alteration)</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>dataModel: <a href="datamodel.html" class="tsd-signature-type">DataModel</a></h5>
<div class="tsd-comment tsd-typography">
<p>model generated be model annotations</p>
</div>
</li>
<li>
<h5>db: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>@see cordova-sqlite-storage</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> doDrop: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></h5>
<div class="tsd-comment tsd-typography">
<p>drop table to allow recreation of database</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4>
<p>observable to subscribe during async operation</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-external">
<a name="droptables" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagPrivate">Private</span> drop<wbr>Tables</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-external">
<li class="tsd-signature tsd-kind-icon">drop<wbr>Tables<span class="tsd-signature-symbol">(</span>dataModel<span class="tsd-signature-symbol">: </span><a href="datamodel.html" class="tsd-signature-type">DataModel</a>, db<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L149">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:149</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>method</dt>
<dd><p>createTables create table linked to datamodel (not table alteration)</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>dataModel: <a href="datamodel.html" class="tsd-signature-type">DataModel</a></h5>
<div class="tsd-comment tsd-typography">
<p>model generated be model annotations</p>
</div>
</li>
<li>
<h5>db: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>@see cordova-sqlite-storage</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4>
<p>observable to subscribe during async operation</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="initdatamodel" class="tsd-anchor"></a>
<h3>init<wbr>Data<wbr>Model</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">init<wbr>Data<wbr>Model<span class="tsd-signature-symbol">(</span>dataModel<span class="tsd-signature-symbol">: </span><a href="datamodel.html" class="tsd-signature-type">DataModel</a>, db<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L90">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:90</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>method</dt>
<dd><p>initDataModel is called if database need to be initialized.
You can override this method if you need to add your logic</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>dataModel: <a href="datamodel.html" class="tsd-signature-type">DataModel</a></h5>
<div class="tsd-comment tsd-typography">
<p>model generated be model annotations</p>
</div>
</li>
<li>
<h5>db: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>@see cordova-sqlite-storage</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4>
<p>observable to subscribe during async operation</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="upgradedatamodel" class="tsd-anchor"></a>
<h3>upgrade<wbr>Data<wbr>Model</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">upgrade<wbr>Data<wbr>Model<span class="tsd-signature-symbol">(</span>dataModel<span class="tsd-signature-symbol">: </span><a href="datamodel.html" class="tsd-signature-type">DataModel</a>, db<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/margarito/ng-db-helper/blob/e02f13c/lib/connectors/configurations/cordova-sqlite-connector-configuration.ts#L106">lib/connectors/configurations/cordova-sqlite-connector-configuration.ts:106</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>method</dt>
<dd><p>upgradeDataModel is called if version should be upgrade.
Default script create new table but does not alter existing table.
You can override this method to add your own logic like alteration
and let script create new table by calling super.</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>dataModel: <a href="datamodel.html" class="tsd-signature-type">DataModel</a></h5>
<div class="tsd-comment tsd-typography">
<p>model generated be model annotations</p>
</div>
</li>
<li>
<h5>db: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>@see cordova-sqlite-storage</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4>
<p>observable to subscribe during async operation</p>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html" class="tsd-kind-icon">Cordova<wbr>Sqlite<wbr>Connector<wbr>Configuration</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#dbname" class="tsd-kind-icon">db<wbr>Name</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#docopydb" class="tsd-kind-icon">do<wbr>Copy<wbr>Db</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#location" class="tsd-kind-icon">location</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#sourcedbname" class="tsd-kind-icon">source<wbr>DbName</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#sourcedbpath" class="tsd-kind-icon">source<wbr>DbPath</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#createtables" class="tsd-kind-icon">create<wbr>Tables</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#droptables" class="tsd-kind-icon">drop<wbr>Tables</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#initdatamodel" class="tsd-kind-icon">init<wbr>Data<wbr>Model</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="cordovasqliteconnectorconfiguration.html#upgradedatamodel" class="tsd-kind-icon">upgrade<wbr>Data<wbr>Model</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html> | 58.428302 | 692 | 0.665095 |
aebd0230a6b3682f2966b7270ffbbdcb443e1543 | 265 | kt | Kotlin | asion-search/asion-search-web/src/test/java/org/asion/search/YtxDemoWebTestApplication.kt | search-cloud/spring-boot-cloud-microservices-docker | 7e09a4b3ff04548e34b5e04ead054e8de674eb70 | [
"Apache-2.0"
] | null | null | null | asion-search/asion-search-web/src/test/java/org/asion/search/YtxDemoWebTestApplication.kt | search-cloud/spring-boot-cloud-microservices-docker | 7e09a4b3ff04548e34b5e04ead054e8de674eb70 | [
"Apache-2.0"
] | 1 | 2018-05-11T07:48:00.000Z | 2018-05-11T07:48:00.000Z | asion-search/asion-search-web/src/test/java/org/asion/search/YtxDemoWebTestApplication.kt | search-cloud/spring-boot-cloud-microservices-docker | 7e09a4b3ff04548e34b5e04ead054e8de674eb70 | [
"Apache-2.0"
] | null | null | null | package org.asion.search
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
@EnableAutoConfiguration
@ComponentScan("org.asion.search.controller")
open class YtxDemoWebTestApplication
| 29.444444 | 69 | 0.879245 |
811e0be8d2512dc5f70c12a9432abe35dd1dc169 | 3,344 | go | Go | golang/patterns/behavioral/command/command.go | Tamplier2911/gof-design-patterns | 78a8327a71d401c46fa791ed0a81d2ca338f4705 | [
"MIT"
] | 2 | 2021-12-23T13:33:32.000Z | 2021-12-23T19:10:27.000Z | golang/patterns/behavioral/command/command.go | Tamplier2911/gof-design-patterns | 78a8327a71d401c46fa791ed0a81d2ca338f4705 | [
"MIT"
] | null | null | null | golang/patterns/behavioral/command/command.go | Tamplier2911/gof-design-patterns | 78a8327a71d401c46fa791ed0a81d2ca338f4705 | [
"MIT"
] | null | null | null | package command
import (
"fmt"
)
// Command: creates objects that encapsulate actions and parameters.
//
// Motivation:
// helps to pass as parameters certain actions that are called in response to other actions.
// when we need to ensure the execution of the request queue, as well as their possible cancellation.
// when we want to support logging of changes as a result of requests.
//
func Command() {
fmt.Println("\nCommand")
// init user
user := NewUser("user", "example@email.com")
// init receiver
receiver := NewBankAccount(user)
// init commands
deposit := NewDeposit(receiver, 1000)
withdraw := NewWithdraw(receiver, 500)
// init invoker
invoker := NewTerminal()
fmt.Printf("balance before deposit: %d\n", receiver.balance)
// invoke commands
invoker.SetCommand(deposit)
invoker.Run()
fmt.Printf("balance after deposit: %d\n", receiver.balance)
invoker.SetCommand(withdraw)
invoker.Run()
fmt.Printf("balance after withdraw: %d\n", receiver.balance)
invoker.Cancel()
fmt.Printf("balance after withdraw undo: %d\n", receiver.balance)
}
// -- Command Abstraction
// Operation - represents Command Abstraction.
type Operation interface {
Execute()
Undo()
}
// -- Concreate Command
// Deposit - represents Concreate Command.
type Deposit struct {
account *BankAccount
amount int
isCompete bool
}
// NewDeposit - creates new instance of Deposit.
func NewDeposit(acc *BankAccount, amount int) *Deposit {
return &Deposit{acc, amount, false}
}
// Execute - executes command.
func (d *Deposit) Execute() {
d.account.balance += d.amount
d.isCompete = true
}
// Undo - undoes command execution.
func (d *Deposit) Undo() {
if d.isCompete && d.account.balance-d.amount >= 0 {
d.account.balance -= d.amount
d.isCompete = false
}
}
// Withdraw - represents Concreate Command
type Withdraw struct {
account *BankAccount
amount int
isCompete bool
}
// NewWithdraw - creates new instance of Withdraw.
func NewWithdraw(acc *BankAccount, amount int) *Withdraw {
return &Withdraw{acc, amount, false}
}
// Execute - executes command.
func (d *Withdraw) Execute() {
if d.account.balance-d.amount >= 0 {
d.account.balance -= d.amount
d.isCompete = true
}
}
// Undo - undoes command execution.
func (d *Withdraw) Undo() {
if d.isCompete {
d.account.balance += d.amount
d.isCompete = false
}
}
// -- Receiver
// Account - represents
type BankAccount struct {
user *User
balance int
}
// NewBankAccount - creates new instance of BankAccount.
func NewBankAccount(u *User) *BankAccount {
return &BankAccount{u, 0}
}
// -- Invoker
// Terminal - represents invoker.
type Terminal struct {
operation Operation
}
// NewTerminal - creates new instance of terminal.
func NewTerminal() *Terminal {
return &Terminal{nil}
}
// SetCommand - sets terminal command.
func (t *Terminal) SetCommand(o Operation) {
t.operation = o
}
// Run - runs terminal command.
func (t *Terminal) Run() {
if t.operation != nil {
t.operation.Execute()
}
}
// Cancel - cancels terminal command.
func (t *Terminal) Cancel() {
if t.operation != nil {
t.operation.Undo()
}
}
// -- Auxiliary types
// User - represents user entity.
type User struct {
name, email string
}
// NewUser - creates new instance of user.
func NewUser(name, email string) *User {
return &User{name, email}
}
| 20.266667 | 101 | 0.703648 |
9310c956e95ba55ecc6a6fa8233b184cdf6cd21c | 11,660 | dart | Dart | lib/src/plugin.dart | tang4595/flutter_photo_manager | 3c8b61eac8eb656bc1a27f68a0255aa1e8d6ba78 | [
"Apache-2.0"
] | null | null | null | lib/src/plugin.dart | tang4595/flutter_photo_manager | 3c8b61eac8eb656bc1a27f68a0255aa1e8d6ba78 | [
"Apache-2.0"
] | null | null | null | lib/src/plugin.dart | tang4595/flutter_photo_manager | 3c8b61eac8eb656bc1a27f68a0255aa1e8d6ba78 | [
"Apache-2.0"
] | null | null | null | import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photo_manager/src/utils/convert_utils.dart';
/// Any method of this class is not recommended to be called directly outside the library.
class Plugin with BasePlugin, IosPlugin, AndroidPlugin {
static Plugin _plugin;
/// Any method of this class is not recommended to be called directly outside the library.
factory Plugin() {
_plugin ??= Plugin._();
return _plugin;
}
Plugin._();
/// [type] 0 : all , 1: image ,2 video
Future<List<AssetPathEntity>> getAllGalleryList({
int type = 0,
bool hasAll = true,
FilterOptionGroup optionGroup,
bool onlyAll,
}) async {
final result = await _channel.invokeMethod("getGalleryList", {
"type": type,
"hasAll": hasAll,
"onlyAll": onlyAll,
"option": optionGroup.toMap(),
});
if (result == null) {
return [];
}
return ConvertUtils.convertPath(
result,
type: type,
optionGroup: optionGroup,
);
}
/// request permission.
Future<bool> requestPermission() async {
return (await _channel.invokeMethod("requestPermission")) == 1;
}
/// Use pagination to get album content.
Future<List<AssetEntity>> getAssetWithGalleryIdPaged(
String id, {
int page = 0,
int pageCount = 15,
int type = 0,
FilterOptionGroup optionGroup,
}) async {
final result = await _channel.invokeMethod("getAssetWithGalleryId", {
"id": id,
"page": page,
"pageCount": pageCount,
"type": type,
"option": optionGroup.toMap(),
});
return ConvertUtils.convertToAssetList(result);
}
/// Asset in the specified range.
Future<List<AssetEntity>> getAssetWithRange(
String id, {
int typeInt,
int start,
int end,
FilterOptionGroup optionGroup,
}) async {
final Map map = await _channel.invokeMethod("getAssetListWithRange", {
"galleryId": id,
"type": typeInt,
"start": start,
"end": end,
"option": optionGroup.toMap(),
});
return ConvertUtils.convertToAssetList(map);
}
/// Get thumb of asset id.
Future<Uint8List> getThumb({
@required String id,
@required ThumbOption option,
}) {
return _channel.invokeMethod("getThumb", {
"id": id,
"option": option.toMap(),
});
}
Future<Uint8List> getOriginBytes(String id) async {
return _channel.invokeMethod("getOriginBytes", {"id": id});
}
Future<void> releaseCache() async {
await _channel.invokeMethod("releaseMemCache");
}
Future<String> getFullFile(String id, {bool isOrigin}) async {
return _channel.invokeMethod("getFullFile", {
"id": id,
"isOrigin": isOrigin,
});
}
Future<void> setLog(bool isLog) async {
await _channel.invokeMethod("log", isLog);
}
void openSetting() {
_channel.invokeMethod("openSetting");
}
Future<Map> fetchPathProperties(
String id, int type, FilterOptionGroup optionGroup) async {
return _channel.invokeMethod(
"fetchPathProperties",
{
"id": id,
"timestamp": 0,
"type": type,
"option": optionGroup.toMap(),
},
);
}
void notifyChange({bool start}) {
_channel.invokeMethod("notify", {
"notify": start,
});
}
Future<void> forceOldApi() async {
await _channel.invokeMethod("forceOldApi");
}
Future<bool> deleteWithId(String id) async {
final ids = await deleteWithIds([id]);
return ids.contains(id);
}
Future<List<String>> deleteWithIds(List<String> ids) async {
final List<dynamic> deleted =
(await _channel.invokeMethod("deleteWithIds", {"ids": ids}));
return deleted.cast<String>();
}
Future<AssetEntity> saveImage(Uint8List uint8list,
{String title, String desc = ""}) async {
title ??= "image_${DateTime.now().millisecondsSinceEpoch / 1000}";
final result = await _channel.invokeMethod(
"saveImage",
{
"image": uint8list,
"title": title,
"desc": desc,
},
);
return ConvertUtils.convertToAsset(result);
}
Future<AssetEntity> saveImageWithPath(String path,
{String title, String desc = ""}) async {
final file = File(path);
if (!file.existsSync()) {
assert(file.existsSync(), "file must exists");
return null;
}
title ??= "image_${DateTime.now().millisecondsSinceEpoch / 1000}.jpg";
final result = await _channel.invokeMethod(
"saveImageWithPath",
{
"path": path,
"title": title,
"desc": desc,
},
);
return ConvertUtils.convertToAsset(result);
}
Future<AssetEntity> saveVideo(
File file, {
String title,
String desc = "",
}) async {
if (!file.existsSync()) {
assert(file.existsSync(), "file must exists");
return null;
}
final result = await _channel.invokeMethod(
"saveVideo",
{
"path": file.absolute.path,
"title": title,
"desc": desc,
},
);
return ConvertUtils.convertToAsset(result);
}
Future<bool> assetExistsWithId(String id) {
return _channel.invokeMethod("assetExists", {"id": id});
}
Future<String> getSystemVersion() async {
return _channel.invokeMethod("systemVersion");
}
Future<LatLng> getLatLngAsync(AssetEntity assetEntity) async {
if (Platform.isAndroid) {
final version = int.parse(await getSystemVersion());
if (version >= 29) {
final map = await _channel
.invokeMethod("getLatLngAndroidQ", {"id": assetEntity.id});
if (map is Map) {
/// 将返回的数据传入map
return LatLng()
..latitude = map["lat"]
..longitude = map["lng"];
}
}
}
return LatLng()
..latitude = assetEntity.latitude
..longitude = assetEntity.longitude;
}
Future<bool> cacheOriginBytes(bool cache) {
return _channel.invokeMethod("cacheOriginBytes");
}
Future<String> getTitleAsync(AssetEntity assetEntity) async {
assert(Platform.isAndroid || Platform.isIOS || Platform.isMacOS);
if (Platform.isAndroid) {
return assetEntity.title;
}
if (Platform.isIOS || Platform.isMacOS) {
return _channel.invokeMethod("getTitleAsync", {"id": assetEntity.id});
}
return "";
}
Future<String> getMediaUrl(AssetEntity assetEntity) {
return _channel.invokeMethod("getMediaUrl", {
"id": assetEntity.id,
"type": assetEntity.typeInt,
});
}
Future<List<AssetPathEntity>> getSubPathEntities(
AssetPathEntity pathEntity) async {
final result = await _channel.invokeMethod("getSubPath", {
"id": pathEntity.id,
"type": pathEntity.type.value,
"albumType": pathEntity.albumType,
"option": pathEntity.filterOption.toMap(),
});
final items = result["list"];
return ConvertUtils.convertPath(
items,
type: pathEntity.typeInt,
optionGroup: pathEntity.filterOption,
);
}
Future<AssetEntity> copyAssetToGallery(
AssetEntity asset, AssetPathEntity pathEntity) async {
if (pathEntity.isAll) {
assert(pathEntity.isAll,
"You don't need to copy the asset into the album containing all the pictures.");
return null;
}
final result = await _channel.invokeMethod("copyAsset", {
"assetId": asset.id,
"galleryId": pathEntity.id,
});
if (result == null) {
return null;
}
return ConvertUtils.convertToAsset(result);
}
Future<bool> iosDeleteCollection(AssetPathEntity path) async {
final result = await _channel.invokeMethod("deleteAlbum", {
"id": path.id,
"type": path.albumType,
});
if (result["errorMsg"] != null) {
print(result["errorMsg"]);
return false;
}
return true;
}
Future<bool> favoriteAsset(String id, bool favorite) {
return _channel.invokeMethod("favoriteAsset", {
"id": id,
"favorite": favorite,
});
}
Future<bool> androidRemoveNoExistsAssets() {
return _channel.invokeMethod("removeNoExistsAssets");
}
Future getPropertiesFromAssetEntity(String id) async {
return _channel.invokeMethod('getPropertiesFromAssetEntity', {"id": id});
}
Future ignorePermissionCheck(bool ignore) async {
await _channel.invokeMethod('ignorePermissionCheck', {'ignore': ignore});
}
Future clearFileCache() async {
await _channel.invokeMethod('clearFileCache');
}
Future<void> cancelCacheRequests() async {
await _channel.invokeMethod('cancelCacheRequests');
}
Future<void> requestCacheAssetsThumb(
List<String> ids, ThumbOption option) async {
assert(ids != null);
assert(ids.isNotEmpty);
assert(option != null);
await _channel.invokeMethod('requestCacheAssetsThumb', {
'ids': ids,
'option': option.toMap(),
});
}
}
mixin BasePlugin {
final MethodChannel _channel = MethodChannel('top.kikt/photo_manager');
}
mixin IosPlugin on BasePlugin {
Future<AssetPathEntity> iosCreateFolder(
String name, bool isRoot, AssetPathEntity parent) async {
final map = {
"name": name,
"isRoot": isRoot,
};
if (!isRoot && parent != null) {
map["folderId"] = parent.id;
}
final result = await _channel.invokeMethod(
"createFolder",
map,
);
if (result == null) {
return null;
}
if (result["errorMsg"] != null) {
print("errorMsg");
return null;
}
return AssetPathEntity()
..id = result["id"]
..name = name
..isAll = false
..assetCount = 0
..albumType = 2;
}
Future<AssetPathEntity> iosCreateAlbum(
String name, bool isRoot, AssetPathEntity parent) async {
final map = {
"name": name,
"isRoot": isRoot,
};
if (!isRoot && parent != null) {
map["folderId"] = parent.id;
}
final result = await _channel.invokeMethod(
"createAlbum",
map,
);
if (result == null) {
return null;
}
if (result["errorMsg"] != null) {
print("errorMsg");
return null;
}
return AssetPathEntity()
..id = result["id"]
..name = name
..isAll = false
..assetCount = 0
..albumType = 1;
}
Future<bool> iosRemoveInAlbum(
List<AssetEntity> entities, AssetPathEntity path) async {
final result = await _channel.invokeMethod(
"removeInAlbum",
{
"assetId": entities.map((e) => e.id).toList(),
"pathId": path.id,
},
);
if (result["msg"] != null) {
print("cannot remove, cause by: ${result["msg"]}");
return false;
}
return true;
}
Future<int> getAssetLength({
String assetId,
}) async {
return _channel.invokeMethod("getAssetLength", {
"assetId": assetId,
}).then((value) {
if (value == null) return 0;
return value;
});
}
Future<double> calculateAssetSimilarity({
String assetIdA,
String assetIdB,
}) {
return _channel.invokeMethod("calculateAssetSimilarity", {
"assetIdA": assetIdA,
"assetIdB": assetIdB,
}).then((value) {
if (value == null) return 0;
return value;
});
}
}
mixin AndroidPlugin on BasePlugin {
Future<bool> androidMoveAssetToPath(
AssetEntity entity, AssetPathEntity target) async {
final result = await _channel.invokeMethod("moveAssetToPath", {
"assetId": entity.id,
"albumId": target.id,
});
print(result);
return true;
}
}
| 24.547368 | 92 | 0.621098 |
33de89f594b2815c181913b1096e6a5d7165b9bf | 404 | swift | Swift | Simplified/Catalog/NYPLCatalogs+SE.swift | ettore/Simplified-iOS | b01a121b40e45ddb850dfc4bd0f486151f57e00c | [
"Apache-2.0"
] | 26 | 2016-09-24T05:27:15.000Z | 2022-03-24T09:12:31.000Z | Simplified/Catalog/NYPLCatalogs+SE.swift | ettore/Simplified-iOS | b01a121b40e45ddb850dfc4bd0f486151f57e00c | [
"Apache-2.0"
] | 570 | 2016-08-11T18:46:07.000Z | 2022-03-21T16:32:07.000Z | Simplified/Catalog/NYPLCatalogs+SE.swift | ettore/Simplified-iOS | b01a121b40e45ddb850dfc4bd0f486151f57e00c | [
"Apache-2.0"
] | 35 | 2016-08-15T19:49:52.000Z | 2021-11-15T04:10:12.000Z | //
// NYPLCatalogNavigationController+SE.swift
// Simplified
//
// Created by Ettore Pasquini on 9/14/20.
// Copyright © 2020 NYPL Labs. All rights reserved.
//
import Foundation
extension NYPLCatalogNavigationController {
@objc func didSignOut() {
}
}
extension NYPLCatalogFeedViewController {
@objc func shouldLoad() -> Bool {
return NYPLSettings.shared.userHasSeenWelcomeScreen
}
}
| 19.238095 | 55 | 0.737624 |
4ae3862f8f9b989ef7d8bb9984119bf96ec8b7f1 | 5,872 | cs | C# | iTunesConverter/iTunesConverter/Program.cs | playmer/MusicOrganization | c1fd93a614fe3f66f68150c85bc1f63bc2e6b009 | [
"MIT"
] | null | null | null | iTunesConverter/iTunesConverter/Program.cs | playmer/MusicOrganization | c1fd93a614fe3f66f68150c85bc1f63bc2e6b009 | [
"MIT"
] | null | null | null | iTunesConverter/iTunesConverter/Program.cs | playmer/MusicOrganization | c1fd93a614fe3f66f68150c85bc1f63bc2e6b009 | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace iTunesConverter
{
class Track
{
public Track()
{
mId = 0;
mName = "";
mKind = "";
mFileType = "";
mLocation = "";
}
public System.UInt64 mId;
public string mName;
public string mKind;
public string mFileType;
public string mLocation;
}
class Playlist
{
public Playlist()
{
mName = "";
mTracks = new List<Track>();
}
public string mName;
public List<Track> mTracks;
}
class iTunesHandler
{
private Dictionary<System.UInt64, Track> mTracks;
private Dictionary<string, Playlist> mPlaylists;
private string mMusicLibrary;
public iTunesHandler(string aFile)
{
mTracks = new Dictionary<System.UInt64, Track>();
mPlaylists = new Dictionary<string, Playlist>();
XmlDocument doc = new XmlDocument();
doc.Load(aFile);
XmlElement plist = doc.DocumentElement;
XmlNodeList nodes = plist.GetElementsByTagName("dict"); // You can also use XPath here
HandleDictionary(nodes.Item(0));
}
private void HandleTrack(XmlNode aKey, XmlNode aValue)
{
if (aValue.HasChildNodes)
{
var track = new Track();
var nodes = aValue.ChildNodes;
var size = nodes.Count;
var halfSize = size / 2;
for (int i = 0; i < halfSize; ++i)
{
var keyIndex = i * 2;
var valueIndex = keyIndex + 1;
var key = nodes[i * 2];
var value = nodes[i * 2 + 1];
switch (key.InnerText)
{
case "Track ID":
{
System.UInt64.TryParse(value.InnerText, out track.mId);
break;
}
case "Kind":
{
track.mKind = value.InnerText;
break;
}
case "Location":
{
track.mLocation = Uri.UnescapeDataString(value.InnerText);
track.mFileType = Path.GetExtension(track.mLocation);
break;
}
case "Name":
{
track.mName = value.InnerText;
break;
}
}
}
mTracks.Add(track.mId, track);
}
}
private void HandleTracks(XmlNode aNode)
{
if (aNode.HasChildNodes)
{
var nodes = aNode.ChildNodes;
var size = nodes.Count;
var halfSize = size / 2;
for (int i = 0; i < halfSize; ++i)
{
var keyIndex = i * 2;
var valueIndex = keyIndex + 1;
var key = nodes[i * 2];
var value = nodes[i * 2 + 1];
HandleTrack(key, value);
}
}
}
private void HandlePlaylist(XmlNode aNode)
{
if (aNode.HasChildNodes)
{
var playlist = new Playlist();
playlist.mName = "";
var nodes = aNode.ChildNodes;
var size = nodes.Count;
var halfSize = size / 2;
for (int i = 0; i < halfSize; ++i)
{
var keyIndex = i * 2;
var valueIndex = keyIndex + 1;
var key = nodes[i * 2];
var value = nodes[i * 2 + 1];
switch (key.InnerText)
{
case "Name":
{
playlist.mName = value.InnerText;
break;
}
case "Visible":
{
if (value.Name == "false")
{
return;
}
break;
}
case "Playlist Items":
{
var playlistItems = value.ChildNodes;
var playlistSize = value.ChildNodes.Count;
for (int j = 0; j < playlistSize; ++j)
{
var itemId = playlistItems[j].ChildNodes[1];
System.UInt64 trackId;
if (true == System.UInt64.TryParse(itemId.InnerText, out trackId))
{
playlist.mTracks.Add(mTracks[trackId]);
}
else
{
}
}
break;
}
}
}
while (mPlaylists.ContainsKey(playlist.mName))
{
playlist.mName += "_DuplicatePlaylistName";
}
mPlaylists.Add(playlist.mName, playlist);
}
}
private void HandlePlaylists(XmlNode aNode)
{
if (aNode.HasChildNodes)
{
var nodes = aNode.ChildNodes;
var size = nodes.Count;
//var halfSize = size / 2;
for (int i = 0; i < size; ++i)
{
var value = nodes[i];
HandlePlaylist(value);
}
}
}
void HandleTopLevel(XmlNode aKey, XmlNode aValue)
{
switch (aKey.InnerText)
{
case "Tracks":
{
HandleTracks(aValue);
break;
}
case "Playlists":
{
HandlePlaylists(aValue);
break;
}
case "Music Folder":
{
mMusicLibrary = aValue.InnerText;
break;
}
}
}
private void HandleDictionary(XmlNode node)
{
if (node.HasChildNodes)
{
var nodes = node.ChildNodes;
var size = nodes.Count;
var halfSize = size / 2;
for (int i = 0; i < halfSize; ++i)
{
var keyIndex = i * 2;
var valueIndex = keyIndex + 1;
var key = nodes[i * 2];
var value = nodes[i * 2 + 1];
HandleTopLevel(key, value);
}
}
}
}
class Program
{
static void Main(string[] args)
{
var itunes = new iTunesHandler("D:/Music/iTunes/iTunes Library.xml");
}
}
}
| 20.749117 | 92 | 0.482459 |
2920842990a2ac6947617be54f51212a53375e37 | 1,483 | py | Python | pods_lister.py | rafaelcaricio/kube-pods-lister | 97fec89ef71ac16605960dd1077c6547b84376b2 | [
"MIT"
] | null | null | null | pods_lister.py | rafaelcaricio/kube-pods-lister | 97fec89ef71ac16605960dd1077c6547b84376b2 | [
"MIT"
] | null | null | null | pods_lister.py | rafaelcaricio/kube-pods-lister | 97fec89ef71ac16605960dd1077c6547b84376b2 | [
"MIT"
] | null | null | null | import os
import sys
import signal
import logging
import time
import click
from kubernetes.config import new_client_from_config, load_incluster_config
from kubernetes.config.config_exception import ConfigException
from kubernetes import client
logger = logging.getLogger('pod_lister')
RUNNING = True
def stop_app(s, f):
global RUNNING
RUNNING = False
logger.info("Stopping app...")
@click.command()
@click.option('--config', default='', help="Kubernetes Config file")
@click.option('--context', default=None, help="Kubernetes Context to use")
@click.option('--debug', is_flag=True, help="Debug mode")
def main(config, context, debug):
logging.basicConfig(level=debug and logging.DEBUG or logging.INFO)
try:
api_client = load_incluster_config()
logger.info("Using in cluster config.")
except ConfigException:
config = config or os.path.abspath(os.path.expanduser('~/.kube/config'))
logger.info("Using config file: {}".format(config))
api_client = new_client_from_config(config_file=config)
signal.signal(signal.SIGTERM, stop_app)
logger.info("Starting app...")
core_api = client.CoreV1Api(api_client=api_client)
while RUNNING:
result = core_api.list_pod_for_all_namespaces(watch=False)
for i in result.items:
print("%s\t%s\t%s" %
(i.status.pod_ip, i.metadata.namespace, i.metadata.name))
time.sleep(3)
if __name__ == '__main__':
main()
| 27.462963 | 80 | 0.701281 |
55bff0fb5ee0d912c9da4557da8590bce932e07b | 147 | sql | SQL | flink-streaming-web/src/main/resources/sql/2022-1-3_job_config_add_col_auto_restore.sql | ljc2008110/flink-streaming-platform-web | fe9db077e156b5d16a1ff8f0f908be2cd7d7f29d | [
"MIT"
] | 1 | 2022-02-10T05:41:41.000Z | 2022-02-10T05:41:41.000Z | flink-streaming-web/src/main/resources/sql/2022-1-3_job_config_add_col_auto_restore.sql | ljc2008110/flink-streaming-platform-web | fe9db077e156b5d16a1ff8f0f908be2cd7d7f29d | [
"MIT"
] | null | null | null | flink-streaming-web/src/main/resources/sql/2022-1-3_job_config_add_col_auto_restore.sql | ljc2008110/flink-streaming-platform-web | fe9db077e156b5d16a1ff8f0f908be2cd7d7f29d | [
"MIT"
] | null | null | null | ALTER TABLE `flink_web`.`job_config`
ADD COLUMN `auto_restore` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '自动备份/恢复savepoint,1:开启 0: 关闭' AFTER `editor`;
| 49 | 109 | 0.761905 |
8091bc1c7dffd8502b7b3d579d925c42c41ae9bc | 14,096 | java | Java | src/org/sosy_lab/cpachecker/core/algorithm/UndefinedFunctionCollectorAlgorithm.java | prokopk1n/cpachecker-1 | c2e1a6a0a7dddb896153e54458003edc9afeef11 | [
"Apache-2.0"
] | 16 | 2015-01-19T15:52:14.000Z | 2015-11-30T14:12:31.000Z | src/org/sosy_lab/cpachecker/core/algorithm/UndefinedFunctionCollectorAlgorithm.java | teodorov/cpachecker | 16e37b76c5b9e3d203992c6c7bf96b64da6fbae1 | [
"Apache-2.0"
] | null | null | null | src/org/sosy_lab/cpachecker/core/algorithm/UndefinedFunctionCollectorAlgorithm.java | teodorov/cpachecker | 16e37b76c5b9e3d203992c6c7bf96b64da6fbae1 | [
"Apache-2.0"
] | 18 | 2015-02-17T19:22:41.000Z | 2015-11-24T09:12:39.000Z | // This file is part of CPAchecker,
// a tool for configurable software verification:
// https://cpachecker.sosy-lab.org
//
// SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.sosy_lab.cpachecker.core.algorithm;
import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.regex.Pattern;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.sosy_lab.common.ShutdownNotifier;
import org.sosy_lab.common.configuration.Configuration;
import org.sosy_lab.common.configuration.FileOption;
import org.sosy_lab.common.configuration.InvalidConfigurationException;
import org.sosy_lab.common.configuration.Option;
import org.sosy_lab.common.configuration.Options;
import org.sosy_lab.common.io.IO;
import org.sosy_lab.common.log.LogManager;
import org.sosy_lab.cpachecker.cfa.CFA;
import org.sosy_lab.cpachecker.cfa.ast.AExpression;
import org.sosy_lab.cpachecker.cfa.ast.AFunctionCall;
import org.sosy_lab.cpachecker.cfa.ast.AFunctionDeclaration;
import org.sosy_lab.cpachecker.cfa.ast.AIdExpression;
import org.sosy_lab.cpachecker.cfa.model.AStatementEdge;
import org.sosy_lab.cpachecker.cfa.model.CFAEdge;
import org.sosy_lab.cpachecker.cfa.model.CFAEdgeType;
import org.sosy_lab.cpachecker.cfa.model.CFANode;
import org.sosy_lab.cpachecker.cfa.types.IAFunctionType;
import org.sosy_lab.cpachecker.cfa.types.Type;
import org.sosy_lab.cpachecker.cfa.types.c.CBasicType;
import org.sosy_lab.cpachecker.cfa.types.c.CCompositeType;
import org.sosy_lab.cpachecker.cfa.types.c.CElaboratedType;
import org.sosy_lab.cpachecker.cfa.types.c.CEnumType;
import org.sosy_lab.cpachecker.cfa.types.c.CPointerType;
import org.sosy_lab.cpachecker.cfa.types.c.CSimpleType;
import org.sosy_lab.cpachecker.cfa.types.c.CType;
import org.sosy_lab.cpachecker.cfa.types.c.CTypedefType;
import org.sosy_lab.cpachecker.cfa.types.c.CVoidType;
import org.sosy_lab.cpachecker.core.CPAcheckerResult.Result;
import org.sosy_lab.cpachecker.core.interfaces.Statistics;
import org.sosy_lab.cpachecker.core.interfaces.StatisticsProvider;
import org.sosy_lab.cpachecker.core.reachedset.ReachedSet;
import org.sosy_lab.cpachecker.core.reachedset.UnmodifiableReachedSet;
import org.sosy_lab.cpachecker.util.CFAUtils;
import org.sosy_lab.cpachecker.util.Pair;
import org.sosy_lab.cpachecker.util.StandardFunctions;
@Options(prefix = "undefinedFunctionsCollector")
public class UndefinedFunctionCollectorAlgorithm
implements Algorithm, StatisticsProvider, Statistics {
private static final String ASSUME_FUNCTION_NAME = "__VERIFIER_assume";
private static final String NONDET_FUNCTION_PREFIX = "__VERIFIER_nondet_";
private static final String ASSUME_FUNCTION_DECL = "void " + ASSUME_FUNCTION_NAME + "(int);\n";
@Option(secure = true, description = "export undefined functions as C file")
@FileOption(FileOption.Type.OUTPUT_FILE)
private Path stubsFile = Path.of("stubs.c");
@Option(secure = true, description = "Set of functions that should be ignored")
private Set<String> allowedFunctions =
ImmutableSet.of(
// General
"__assert_fail",
// Float
"__finite",
"__fpclassify",
"__fpclassifyf",
"__fpclassifyl",
"__isinf",
"__isinff",
"__isnan",
"__isnanf",
"__signbit",
"__signbitf");
@Option(secure = true, description = "Ignore functions that are defined by C11")
private boolean allowC11Functions = true;
@Option(
secure = true,
description = "Ignore functions that are defined by GNU C and not by C11/POSIX")
private boolean allowGnuCFunctions = true;
@Option(secure = true, description = "Ignore functions that are defined by POSIX")
private boolean allowPosixFunctions = true;
@Option(secure = true, description = "Memory-allocation function that will be used in stubs")
private String externAllocFunction = "external_alloc";
@Option(
secure = true,
description = "Regexp matching function names that are allowed to be undefined")
private Pattern allowedFunctionsRegexp = Pattern.compile("^(__VERIFIER|pthread)_[a-zA-Z0-9_]*");
@Option(secure = true, description = "Regexp matching function names that need not be declared")
private Pattern allowedUndeclaredFunctionsRegexp = Pattern.compile("^__builtin_[a-zA-Z0-9_]*");
private final LogManager logger;
private final ShutdownNotifier shutdownNotifier;
private final CFA cfa;
private final Map<String, AFunctionDeclaration> undefinedfFunctions = new HashMap<>();
private final Set<String> undeclaredFunctions = new HashSet<>();
private final String odmFunctionDecl = "void *" + externAllocFunction + "(void);\n";
public UndefinedFunctionCollectorAlgorithm(
Configuration config, LogManager pLogger, ShutdownNotifier pShutdownNotifier, CFA pCfa)
throws InvalidConfigurationException {
config.inject(this);
logger = pLogger;
shutdownNotifier = pShutdownNotifier;
cfa = pCfa;
}
@Override
public AlgorithmStatus run(ReachedSet pReachedSet) throws InterruptedException {
collectUndefinedFunctions();
return AlgorithmStatus.NO_PROPERTY_CHECKED;
}
private void collectUndefinedFunctions() throws InterruptedException {
for (CFANode node : cfa.getAllNodes()) {
shutdownNotifier.shutdownIfNecessary();
for (CFAEdge edge : CFAUtils.leavingEdges(node)) {
if (edge.getEdgeType() == CFAEdgeType.StatementEdge) {
final AStatementEdge stmtEdge = (AStatementEdge) edge;
if (stmtEdge.getStatement() instanceof AFunctionCall) {
collectUndefinedFunction((AFunctionCall) stmtEdge.getStatement());
}
}
}
}
}
private void collectUndefinedFunction(AFunctionCall call) {
final AFunctionDeclaration functionDecl = call.getFunctionCallExpression().getDeclaration();
if (functionDecl == null) {
AExpression functionName = call.getFunctionCallExpression().getFunctionNameExpression();
if (functionName instanceof AIdExpression) {
// no declaration, but regular function call (no function pointer)
String name = ((AIdExpression) functionName).getName();
logger.log(Level.FINE, "Call to undeclared function", name, "found.");
undeclaredFunctions.add(name);
}
} else {
// a call to an undefined function
if (!cfa.getAllFunctionNames().contains(functionDecl.getName())) {
undefinedfFunctions.put(functionDecl.getName(), functionDecl);
}
}
}
@Override
public void printStatistics(PrintStream pOut, Result pResult, UnmodifiableReachedSet pReached) {
pOut.println("Total undefined functions called: " + undefinedfFunctions.size());
pOut.println(
"Non-standard undefined functions called: "
+ (undefinedfFunctions.size()
- undefinedfFunctions.keySet().stream().filter(this::skipFunction).count()));
pOut.println("Total undeclared functions called: " + undeclaredFunctions.size());
pOut.println(
"Non-standard undeclared functions called: "
+ undeclaredFunctions
.stream()
.filter(name -> !allowedUndeclaredFunctionsRegexp.matcher(name).matches())
.count());
}
@Override
public void writeOutputFiles(Result pResult, UnmodifiableReachedSet pReached) {
if (stubsFile != null) {
try (Writer w = IO.openOutputFile(stubsFile, Charset.defaultCharset())) {
for (Map.Entry<String, AFunctionDeclaration> k :
new TreeMap<>(undefinedfFunctions).entrySet()) {
printFunction(k.getKey(), k.getValue(), w);
}
} catch (IOException e) {
logger.logUserException(Level.WARNING, e, "Could not write stubs to the file");
}
}
}
private boolean skipFunction(String name) {
return allowedFunctions.contains(name)
|| (allowC11Functions && StandardFunctions.C11_ALL_FUNCTIONS.contains(name))
|| (allowGnuCFunctions && StandardFunctions.GNUC_ALL_FUNCTIONS.contains(name))
|| (allowPosixFunctions && StandardFunctions.POSIX_ALL_FUNCTIONS.contains(name))
|| allowedFunctionsRegexp.matcher(name).matches()
|| allowedUndeclaredFunctionsRegexp.matcher(name).matches();
}
private void printFunction(String name, AFunctionDeclaration f, Writer w) throws IOException {
if (skipFunction(name)) {
logger.log(Level.FINE, " Skip function: " + name);
w.write("// Skip function: " + name + "\n\n");
} else {
w.write("// Function: " + name + "\n");
w.write("// with type: " + f.getType() + "\n");
Type rt = f.getType().getReturnType();
w.write("// with return type: " + rt + "\n");
StringBuilder buf = new StringBuilder();
StringBuilder prepend = new StringBuilder();
boolean couldBeHandled = printType(" ", prepend, buf, (CType) rt);
if (couldBeHandled) {
w.write(prepend.toString());
w.write(getSignature(name, f.getType()) + " {\n");
w.write(buf.toString());
w.write("}\n\n");
} else {
w.write("// ignored because stub could not be generated\n\n");
}
}
}
private String getSignature(String name, IAFunctionType type) {
StringBuilder res = new StringBuilder().append(name).append("(");
int i = 0;
for (Type pt : type.getParameters()) {
if (i == 0) {
res.append(pt.toASTString("arg" + i));
} else {
res.append(", ").append(pt.toASTString("arg" + i));
}
i++;
}
if (type.takesVarArgs()) {
if (i != 0) {
res.append(", ");
}
res.append("...");
}
res.append(")");
return type.getReturnType().toASTString(res.toString());
}
private boolean printType(String indent, StringBuilder prepend, StringBuilder buf, CType rt) {
boolean couldBeHandled = true;
if (rt instanceof CVoidType) {
buf.append(indent + "// Void type\n");
buf.append(indent + "return;\n");
} else if (rt instanceof CPointerType) {
buf.append(indent + "// Pointer type\n");
prepend.append(odmFunctionDecl);
buf.append(indent + "return (" + rt.toASTString("") + ")" + externAllocFunction + "();\n");
} else if (rt instanceof CSimpleType) {
CSimpleType ct = (CSimpleType) rt;
Pair<String, String> pair = convertType(ct);
String nondetFunc = NONDET_FUNCTION_PREFIX + pair.getSecond();
prepend.append(pair.getFirst() + " " + nondetFunc + "(void);\n");
buf.append(indent + "// Simple type\n");
buf.append(indent + "return " + nondetFunc + "();\n");
} else if (rt instanceof CEnumType) {
buf.append(indent + "// Enum type\n");
String nondetFunc = NONDET_FUNCTION_PREFIX + "int";
prepend.append("int " + nondetFunc + "(void);\n");
buf.append(indent + "return " + nondetFunc + "();\n");
} else if (rt instanceof CCompositeType) {
buf.append(indent + "// Composite type\n");
prepend.append(odmFunctionDecl);
// We can not use rt.toASTString(), as it produces full definition with all fields
buf.append(indent + rt + " *tmp" + " = (" + rt + "*)" + externAllocFunction + "();\n");
prepend.append(ASSUME_FUNCTION_DECL);
buf.append(indent + ASSUME_FUNCTION_NAME + "(tmp != 0);\n");
buf.append(indent + "return *tmp;\n");
} else if (rt instanceof CElaboratedType) {
CType real = ((CElaboratedType) rt).getRealType();
if (real == null) {
couldBeHandled = false;
} else {
couldBeHandled = printType(indent, prepend, buf, real);
}
} else if (rt instanceof CTypedefType) {
buf.append(indent + "// Typedef type\n");
CTypedefType tt = (CTypedefType) rt;
CType real = tt.getRealType();
buf.append(indent + "// Real type: " + real + "\n");
couldBeHandled = printType(indent, prepend, buf, real);
} else {
throw new AssertionError(
"Unexpected type '" + rt + "' of class " + rt.getClass().getSimpleName());
}
return couldBeHandled;
}
// Copied from SV-COMP rules:
// bool, char, int, float, double, loff_t, long,
// pchar, pointer, pthread_t, sector_t, short,
// size_t, u32, uchar, uint, ulong, unsigned, ushort
private Pair<String, String> convertType(CSimpleType ct) {
CBasicType bt = ct.getType();
if (bt == CBasicType.BOOL) {
return Pair.of("bool", "bool");
} else if (bt == CBasicType.CHAR) {
if (ct.isUnsigned()) {
return Pair.of("unsigned char", "uchar");
} else {
return Pair.of("char", "char");
}
} else if (bt == CBasicType.DOUBLE) {
return Pair.of("double", "double");
} else if (bt == CBasicType.FLOAT) {
return Pair.of("float", "float");
} else if (bt == CBasicType.INT || bt == CBasicType.UNSPECIFIED) {
if (ct.isShort()) {
if (ct.isUnsigned()) {
return Pair.of("unsigned short", "ushort");
} else {
return Pair.of("short", "short");
}
} else if (ct.isLong() || ct.isLongLong()) {
if (ct.isUnsigned()) {
return Pair.of("unsigned long", "ulong");
} else {
return Pair.of("long", "long");
}
} else {
if (ct.isUnsigned()) {
return Pair.of("unsigned int", "uint");
} else {
return Pair.of("int", "int");
}
}
} else {
throw new RuntimeException("Unknown type " + ct);
}
}
@Override
public @Nullable String getName() {
return "UndefinedFunctionCollectorAlgorithm";
}
@Override
public void collectStatistics(Collection<Statistics> pStatsCollection) {
pStatsCollection.add(this);
}
}
| 39.374302 | 98 | 0.674872 |
5e451151d3b80fb008e76d3b9c4818ee57c90c53 | 2,138 | dart | Dart | lib/ActiveChats.dart | kbujak/Projekt-BAI | d8e788c2cb26a431bbda0074a33792da0d0e8f0f | [
"CC-BY-3.0"
] | null | null | null | lib/ActiveChats.dart | kbujak/Projekt-BAI | d8e788c2cb26a431bbda0074a33792da0d0e8f0f | [
"CC-BY-3.0"
] | null | null | null | lib/ActiveChats.dart | kbujak/Projekt-BAI | d8e788c2cb26a431bbda0074a33792da0d0e8f0f | [
"CC-BY-3.0"
] | null | null | null | import 'package:flutter/material.dart';
import 'firestore/Repository.dart';
import 'firestore/AuthService.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'Utils/ChatWidgetHelper.dart';
class ActiveChatsWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() => ActiveChatsState();
}
class ActiveChatsState extends State<ActiveChatsWidget> {
FirebaseUser user;
@override
void initState() {
authService.getCurrentUser().then((firebaseUser) {
setState(() {
user = firebaseUser;
});
});
}
@override
Widget build(BuildContext context) {
return user == null ?
MaterialApp(
title: "ActiveChats",
home: Scaffold(
appBar: AppBar(
title: Text("Active chats"),
backgroundColor: Color.fromRGBO(0, 135, 147, 1.0),
),
body: Text("User not authenticated"),
)
)
:
MaterialApp(
title: "ActiveChats",
home: Scaffold(
appBar: AppBar(
title: Text("Active chats"),
backgroundColor: Color.fromRGBO(0, 135, 147, 1.0),
),
body: Container(
padding: EdgeInsets.only(top: 10),
child: Column(
children: <Widget>[
Text(
"Chat rooms you participate",
style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 2.0)
),
createChatsUI(
user,
repository.getChatsByParticipatory(user.uid),
"You haven't parcipated in any chat"
),
SizedBox(height: 15),
Text(
"Chat rooms you created",
style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 2.0)
),
createChatsUI(user,
repository.getChatsByCreator(user.uid),
"You haven't created in any chat"
),
],
),
),
)
);
}
} | 28.131579 | 88 | 0.52058 |
8842ab09e9eb648f123c184da94cb1c06f42758f | 7,694 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_513.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_513.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_513.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xf14a, %rax
nop
nop
sub %r12, %r12
mov $0x6162636465666768, %rsi
movq %rsi, %xmm7
movups %xmm7, (%rax)
nop
nop
nop
cmp $64861, %r14
lea addresses_A_ht+0xf486, %r12
sub %rdi, %rdi
and $0xffffffffffffffc0, %r12
vmovaps (%r12), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rdx
nop
add $37598, %r14
lea addresses_A_ht+0x148f6, %rsi
lea addresses_UC_ht+0x598e, %rdi
nop
nop
sub %r9, %r9
mov $62, %rcx
rep movsq
nop
nop
nop
nop
xor $43948, %r12
lea addresses_normal_ht+0x119ea, %r9
cmp $46955, %rdi
movb $0x61, (%r9)
nop
nop
dec %r12
lea addresses_WC_ht+0x98e, %rdx
nop
nop
nop
nop
sub %r9, %r9
movl $0x61626364, (%rdx)
nop
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_WT_ht+0x1ce31, %rax
nop
nop
sub %rsi, %rsi
movb $0x61, (%rax)
cmp %rdx, %rdx
lea addresses_normal_ht+0x558e, %rcx
nop
inc %rsi
vmovups (%rcx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rdi
nop
nop
nop
nop
nop
sub %rdx, %rdx
lea addresses_WC_ht+0x98e, %rcx
nop
nop
nop
nop
add $22564, %rdi
mov $0x6162636465666768, %rax
movq %rax, %xmm3
movups %xmm3, (%rcx)
nop
sub %r12, %r12
lea addresses_WC_ht+0x1cd8e, %rsi
lea addresses_WC_ht+0xc98e, %rdi
nop
nop
inc %r12
mov $65, %rcx
rep movsl
xor $58582, %rax
lea addresses_D_ht+0x3d8e, %rdx
nop
mfence
mov $0x6162636465666768, %r14
movq %r14, (%rdx)
nop
nop
xor %rdi, %rdi
lea addresses_WC_ht+0x198e, %r12
nop
nop
nop
nop
xor %r14, %r14
mov (%r12), %rsi
cmp $48515, %rcx
lea addresses_D_ht+0x1778e, %rdx
nop
lfence
mov (%rdx), %di
nop
nop
nop
cmp %r12, %r12
lea addresses_WC_ht+0x9f0e, %r12
clflush (%r12)
nop
nop
nop
add %rsi, %rsi
movw $0x6162, (%r12)
xor %r12, %r12
lea addresses_A_ht+0xc58e, %rsi
lea addresses_WT_ht+0x1a43, %rdi
inc %r12
mov $62, %rcx
rep movsw
nop
and %r14, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r9
push %rax
push %rbx
push %rcx
push %rdi
// Store
lea addresses_PSE+0x98e, %rax
cmp $49347, %rcx
movw $0x5152, (%rax)
// Exception!!!
nop
nop
mov (0), %rax
nop
nop
nop
nop
dec %r12
// Faulty Load
lea addresses_UC+0x1318e, %r12
nop
nop
nop
nop
add %r9, %r9
mov (%r12), %r10
lea oracles, %rax
and $0xff, %r10
shlq $12, %r10
mov (%rax,%r10,1), %r10
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_PSE'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 3, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 9, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 11, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 35.293578 | 2,999 | 0.654796 |
8068b8333f2ec70e282d389a69116c8f4de07744 | 5,544 | java | Java | src/test/java/com/tiernebre/zone_blitz/user/repository/UserSecurityQuestionJooqRepositoryIntegrationTests.java | Tiernebre/tailgate | 5912e65485f7a1d8aac7769994e1f77b1882945d | [
"MIT"
] | null | null | null | src/test/java/com/tiernebre/zone_blitz/user/repository/UserSecurityQuestionJooqRepositoryIntegrationTests.java | Tiernebre/tailgate | 5912e65485f7a1d8aac7769994e1f77b1882945d | [
"MIT"
] | null | null | null | src/test/java/com/tiernebre/zone_blitz/user/repository/UserSecurityQuestionJooqRepositoryIntegrationTests.java | Tiernebre/tailgate | 5912e65485f7a1d8aac7769994e1f77b1882945d | [
"MIT"
] | null | null | null | package com.tiernebre.zone_blitz.user.repository;
import com.tiernebre.zone_blitz.jooq.tables.records.PasswordResetTokenRecord;
import com.tiernebre.zone_blitz.jooq.tables.records.UserSecurityQuestionRecord;
import com.tiernebre.zone_blitz.jooq.tables.records.UserRecord;
import com.tiernebre.zone_blitz.test.AbstractIntegrationTestingSuite;
import com.tiernebre.zone_blitz.token.password_reset.PasswordResetTokenConfigurationProperties;
import com.tiernebre.zone_blitz.token.password_reset.PasswordResetTokenRecordPool;
import com.tiernebre.zone_blitz.user.UserRecordPool;
import org.apache.commons.collections4.MapUtils;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import static org.junit.Assert.assertTrue;
public class UserSecurityQuestionJooqRepositoryIntegrationTests extends AbstractIntegrationTestingSuite {
@Autowired
private UserSecurityQuestionJooqRepository userSecurityQuestionJooqRepository;
@Autowired
private UserRecordPool userRecordPool;
@Autowired
private PasswordResetTokenRecordPool passwordResetTokenRecordPool;
@Autowired
private PasswordResetTokenConfigurationProperties passwordResetTokenConfigurationProperties;
@Nested
@DisplayName("getAnswersForEmailAndResetToken")
public class GetAnswersForEmailAndResetTokenTests {
@Test
@DisplayName("returns the security question answers if the email and reset token are legitimate")
void returnsTheSecurityQuestionAnswersIfTheEmailAndResetTokenAreLegitimate() {
UserRecord user = userRecordPool.createAndSaveOneWithSecurityQuestion();
Set<String> originalAnswers = userRecordPool
.getSecurityQuestionForUserWithId(user.getId())
.stream()
.map(UserSecurityQuestionRecord::getAnswer)
.collect(Collectors.toSet());
UUID resetToken = passwordResetTokenRecordPool.createAndSaveOneForUser(user).getToken();
Map<Long, String> foundAnswers = userSecurityQuestionJooqRepository.getAnswersForEmailAndResetToken(user.getEmail(), resetToken);
assertTrue(MapUtils.isNotEmpty(foundAnswers));
assertTrue(originalAnswers.containsAll(foundAnswers.values()));
}
@Test
@DisplayName("returns an empty set if the email is not legit")
void returnsAnEmptySetIfTheEmailIsNotLegit() {
UserRecord user = userRecordPool.createAndSaveOneWithSecurityQuestion();
UUID resetToken = passwordResetTokenRecordPool.createAndSaveOneForUser(user).getToken();
Map<Long, String> answers = userSecurityQuestionJooqRepository.getAnswersForEmailAndResetToken(UUID.randomUUID().toString(), resetToken);
assertTrue(MapUtils.isEmpty(answers));
}
@Test
@DisplayName("returns an empty set if the user has no password reset token tied to them")
void returnsAnEmptySetIfTheUserHasNoPasswordResetTokenTiedToThem() {
UserRecord user = userRecordPool.createAndSaveOneWithSecurityQuestion();
Map<Long, String> answers = userSecurityQuestionJooqRepository.getAnswersForEmailAndResetToken(user.getEmail(), UUID.randomUUID());
assertTrue(MapUtils.isEmpty(answers));
}
@Test
@DisplayName("returns an empty set if the password reset token is not legit")
void returnsAnEmptySetIfThePasswordResetTokenIsNotLegit() {
UserRecord user = userRecordPool.createAndSaveOneWithSecurityQuestion();
passwordResetTokenRecordPool.createAndSaveOneForUser(user);
Map<Long, String> answers = userSecurityQuestionJooqRepository.getAnswersForEmailAndResetToken(user.getEmail(), UUID.randomUUID());
assertTrue(MapUtils.isEmpty(answers));
}
@Test
@DisplayName("returns an empty set if the password reset token and email are not legit")
void returnsAnEmptySetIfThePasswordResetTokenAndEmailAreNotLegit() {
UserRecord user = userRecordPool.createAndSaveOneWithSecurityQuestion();
passwordResetTokenRecordPool.createAndSaveOneForUser(user);
Map<Long, String> answers = userSecurityQuestionJooqRepository.getAnswersForEmailAndResetToken(UUID.randomUUID().toString(), UUID.randomUUID());
assertTrue(MapUtils.isEmpty(answers));
}
@Test
@DisplayName("returns an empty set if the password reset token is expired")
void returnsAnEmptySetIfThePasswordResetTokenIsExpired() {
UserRecord originalUser = userRecordPool.createAndSaveOneWithSecurityQuestion();
PasswordResetTokenRecord resetToken = passwordResetTokenRecordPool.createAndSaveOneForUser(originalUser);
resetToken.setCreatedAt(
LocalDateTime
.now()
.minusMinutes(passwordResetTokenConfigurationProperties.getExpirationWindowInMinutes())
.minusSeconds(1)
);
resetToken.store();
Map<Long, String> answers = userSecurityQuestionJooqRepository.getAnswersForEmailAndResetToken(originalUser.getEmail(), resetToken.getToken());
assertTrue(MapUtils.isEmpty(answers));
}
}
}
| 51.813084 | 156 | 0.737915 |
c3061f37daf151bf564f2c29ee9726ba15dba075 | 3,839 | sql | SQL | Projects/EyeDiabetes/Queries/bhr_cohort.sql | endeavourhealth-discovery/DiscoveryQueryLibrary | 7f8573df1bf44e073b793aab69e32600161ba02d | [
"Apache-2.0"
] | null | null | null | Projects/EyeDiabetes/Queries/bhr_cohort.sql | endeavourhealth-discovery/DiscoveryQueryLibrary | 7f8573df1bf44e073b793aab69e32600161ba02d | [
"Apache-2.0"
] | null | null | null | Projects/EyeDiabetes/Queries/bhr_cohort.sql | endeavourhealth-discovery/DiscoveryQueryLibrary | 7f8573df1bf44e073b793aab69e32600161ba02d | [
"Apache-2.0"
] | null | null | null | use data_extracts;
drop procedure if exists buildCohortForEye;
DELIMITER //
CREATE PROCEDURE buildCohortForEye ()
BEGIN
drop table if exists cohort;
drop table if exists cohort_tmp;
call addCodesToCodeset (212, 'C100.,C1000,C1001,C100z,C101.,C101y,C101z,C102.,C1020,C1021,C102z,C103.,C103y,C103z,C104.,C1040,C1041,C104y,C104z,C105.,C1050,C1051,C105y,C105z,C106.,C1060,C1061,66AJ1,C106y,C106z,C107.,C1070,C1071,C1072,C1073,C1074,C107y,C107z,C108.,C1084,C108A,C108B,C108C,C108D,C108E,C108F,C108G,C108H,C108J,C108y,C108z,C109.,C1099,C109A,C109B,C109C,C109D,C109E,C109F,C109G,C109H,C10A.,C10A0,C10A1,C10A2,C10A3,C10A4,C10A5,C10A6,C10A7,C10AW,C10AX,C10B.,C10B0,C10J.,C10J0,C10P.,C10P0,C10P1,C10y.,C10y0,C10y1,C10yy,C10yz,C10z.,C10z0,C10z1,C10zy,C10zz,C11y0,Cyu2.,Cyu20,Cyu21,Cyu22,Cyu23,L1805,L1806,L1807,L180X,Lyu29,PKyP.,X008t,X40J7,X40J8,X40J9,X40Ja,X40Jb,X40JK,X40JN,X40JR,X40JV,X40JW,X40JX,Xa3ee,Xaagd,Xaage,Xaagf,XaCJ2,XaJlN,XaJUH,XE10E,XE10F,XE10G,XE10H,XE10I,XE128,XE12A,XE12C,XE12G,XE12K,XE12M,XM1Qx,C10..,C1010,C1011,C1030,C1031,C1080,C1081,C1082,C1083,C1085,C1086,C1087,C1088,C1089,C1090,C1091,C1092,C1093,C1094,C1095,C1096,C1097,C109J,C109K,C10C.,C10D.,C10E.,C10E0,C10E1,C10E2,C10E3,C10E4,C10E5,C10E6,C10E7,C10E8,C10E9,C10EA,C10EB,C10EC,C10ED,C10EE,C10EF,C10EG,C10EH,C10EJ,C10EK,C10EL,C10EM,C10EN,C10EP,C10EQ,C10ER,C10F.,C10F0,C10F1,C10F2,C10F3,C10F4,C10F5,C10F6,C10F7,C10F9,C10FA,C10FB,C10FC,C10FD,C10FE,C10FF,C10FG,C10FH,C10FJ,C10FK,C10FL,C10FM,C10FN,C10FP,C10FQ,C10FR,C10FS,C10G.,C10G0,C10H.,C10H0,C10M.,C10M0,C10N.,C10N0,C10N1,X40J4,X40J5,X40J6,X40JA,X40JB,X40JC,X40JG,X40JI,X40JJ,X40JO,X40JS,X40JY,X40JZ,Xa4g7,XaELP,XaELQ,XaEnn,XaEno,XaEnp,XaEnq,XaF04,XaF05,XaFm8,XaFmA,XaFmK,XaFmL,XaFmM,XaFn7,XaFn8,XaFn9,XaFWG,XaFWI,XaIrf,XaIzM,XaIzN,XaIzQ,XaIzR,XaJlL,XaJlM,XaJlQ,XaJlR,XaJQp,XaJSr,XaJUI,XaKyW,XaKyX,XaMzI,XaOPt,XaOPu,XM1Xk,XSETe,XSETH,XSETK,XSETp,', null);
create table cohort_tmp as
SELECT distinct o.patient_id from enterprise_pi.observation o
join enterprise_pi.organization org on org.id = o.organization_id
join data_extracts.code_set_codes r on r.read2_concept_id = o.original_code
where r.code_set_id = 212
and org.ods_code in ('F82001','F82002','F82003','F82005','F82006','F82007','F82008','F82009','F82011','F82012','F82014','F82016','F82018','F82019','F82021','F82023','F82025','F82028','F82030','F82034','F82039','F82040','F82042','F82045','F82051','F82053','F82055','F82604','F82607','F82609','F82610','F82612','F82619','F82624','F82625','F82627','F82630','F82634','F82638','F82639','F82642','F82647','F82648','F82649','F82650','F82660','F82661','F82670','F82674','F82675','F82676','F82677','F82679','F82686','F86008','F86009','F86010','F86020','F86022','F86023','F86028','F86032','F86034','F86040','F86042','F86060','F86064','F86066','F86081','F86083','F86085','F86087','F86612','F86624','F86637','F86641','F86642','F86652','F86691','F86692','F86698','F86702','F86703','F86731','Y00090','Y00312','Y00918','Y01719','Y01795','Y02575','Y02973','Y02987','F82010','F82015','F82017','F82027','F82031','F82033','F82038','F82663','F82678','F86007','Y01280');
-- and (org.parent_organization_id in (4978692,2,9792782) or org.ods_code in ('F82003','F82010','F82015','F82017','F82027','F82031','F82033','F82038','F82663','F82678','F86007','Y01280') );
create table cohort as
SELECT p.id as 'patient_id', p.nhs_number as 'group_by' from data_extracts.cohort_tmp c
join enterprise_pi.episode_of_care e on e.patient_id = c.patient_id
join enterprise_pi.patient p on p.id = c.patient_id
where
p.date_of_death IS NULL
and e.registration_type_id = 2
and e.date_registered <= now()
and (e.date_registered_end > now() or e.date_registered_end IS NULL)
and DATEDIFF(NOW(), p.date_of_birth) / 365.25 >= 12;
drop table cohort_tmp;
alter table cohort add index groupByIdx (group_by);
END//
DELIMITER ;
| 98.435897 | 1,689 | 0.762959 |
26333cb449503ea55fb80589ef48f1c89e1a78c6 | 1,651 | java | Java | Mage.Sets/src/mage/cards/t/TormentorsTrident.java | jumpinjackie/mage | d60f4872394e8d9d2162f400368fa360a84b83dd | [
"MIT"
] | 1 | 2022-01-25T23:14:44.000Z | 2022-01-25T23:14:44.000Z | Mage.Sets/src/mage/cards/t/TormentorsTrident.java | Alex-Vasile/mage | c667458198a3d19e05d759920d082552896b72d6 | [
"MIT"
] | null | null | null | Mage.Sets/src/mage/cards/t/TormentorsTrident.java | Alex-Vasile/mage | c667458198a3d19e05d759920d082552896b72d6 | [
"MIT"
] | null | null | null |
package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.combat.AttacksIfAbleAttachedEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
/**
*
* @author noxx
*/
public final class TormentorsTrident extends CardImpl {
public TormentorsTrident(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature gets +3/+0 and attacks each turn if able.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(3, 0));
Effect effect = new AttacksIfAbleAttachedEffect(Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT);
effect.setText("and attacks each combat if able");
ability.addEffect(effect);
this.addAbility(ability);
// Equip {3}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3), false));
}
private TormentorsTrident(final TormentorsTrident card) {
super(card);
}
@Override
public TormentorsTrident copy() {
return new TormentorsTrident(this);
}
}
| 31.75 | 111 | 0.748637 |
80d9f197a121f048a7f8a64472f6a0b1cb89de53 | 771 | java | Java | core/src/main/java/org/woelker/jimix/core/HttpRequest.java | qq254080862/jimix | 93dfcebb5fab73746892f3494caf75882e0077c7 | [
"Apache-2.0"
] | 19 | 2015-05-07T11:09:41.000Z | 2021-03-01T10:58:03.000Z | core/src/main/java/org/woelker/jimix/core/HttpRequest.java | qq254080862/jimix | 93dfcebb5fab73746892f3494caf75882e0077c7 | [
"Apache-2.0"
] | 4 | 2015-08-07T11:59:14.000Z | 2018-10-26T16:14:30.000Z | core/src/main/java/org/woelker/jimix/core/HttpRequest.java | qq254080862/jimix | 93dfcebb5fab73746892f3494caf75882e0077c7 | [
"Apache-2.0"
] | 5 | 2015-08-07T10:40:12.000Z | 2018-09-25T19:51:02.000Z | package org.woelker.jimix.core;
import java.io.IOException;
import java.io.OutputStream;
public interface HttpRequest {
public static int STATUS_NOT_FOUND = 404;
public String getMethod();
public String getPathInfo();
public String getRequestURI();
public String getQueryString();
public void setContentType(String contentType);
public OutputStream getOutputStream() throws IOException;
public void sendError(int errorStatus) throws IOException;
public void sendRedirect(String url) throws IOException;
public void setAttribute(String key, Object attribute);
public Object getAttribute(String key);
public void setHeader(String header, String value);
public void setStatus(int i) throws IOException;
}
| 21.416667 | 62 | 0.749676 |
2a2df7ffde4a316486cd56cae1f8735ae9d5df49 | 2,741 | java | Java | model/src/main/java/com/hotel/model/mapper/PackageImageMapper.java | 345632699/springboot-security-jwt | febf5674ce139466d0e6ad86139f8a7d8cc04c9c | [
"MIT"
] | 3 | 2020-06-05T17:30:51.000Z | 2020-10-22T05:34:41.000Z | model/src/main/java/com/hotel/model/mapper/PackageImageMapper.java | 345632699/springboot-security-jwt | febf5674ce139466d0e6ad86139f8a7d8cc04c9c | [
"MIT"
] | null | null | null | model/src/main/java/com/hotel/model/mapper/PackageImageMapper.java | 345632699/springboot-security-jwt | febf5674ce139466d0e6ad86139f8a7d8cc04c9c | [
"MIT"
] | null | null | null | package com.hotel.model.mapper;
import com.hotel.model.PackageImage;
import com.hotel.model.PackageImageExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface PackageImageMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int countByExample(PackageImageExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int deleteByExample(PackageImageExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int insert(PackageImage record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int insertSelective(PackageImage record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
List<PackageImage> selectByExample(PackageImageExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
PackageImage selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int updateByExampleSelective(@Param("record") PackageImage record, @Param("example") PackageImageExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int updateByExample(@Param("record") PackageImage record, @Param("example") PackageImageExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(PackageImage record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table package_image
*
* @mbggenerated
*/
int updateByPrimaryKey(PackageImage record);
} | 28.552083 | 118 | 0.681868 |
724c2ad898b2fbfddd6bd6d82917f8b570c1e872 | 716 | sql | SQL | sql_test/easy/lt196_deleteDuplicate.sql | PatrickChenSe/codeTest | db58537ca37178377a2d875a3de2af4e336dffa2 | [
"Apache-2.0"
] | null | null | null | sql_test/easy/lt196_deleteDuplicate.sql | PatrickChenSe/codeTest | db58537ca37178377a2d875a3de2af4e336dffa2 | [
"Apache-2.0"
] | 11 | 2020-12-02T18:45:02.000Z | 2022-03-02T07:38:12.000Z | sql_test/easy/lt196_deleteDuplicate.sql | PatrickChenSe/codeTest | db58537ca37178377a2d875a3de2af4e336dffa2 | [
"Apache-2.0"
] | null | null | null | Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.
+----+------------------+
| Id | Email |
+----+------------------+
| 1 | john@example.com |
| 2 | bob@example.com |
| 3 | john@example.com |
+----+------------------+
Id is the primary key column for this table.
For example, after running your query, the above Person table should have the following rows:
+----+------------------+
| Id | Email |
+----+------------------+
| 1 | john@example.com |
| 2 | bob@example.com |
+----+------------------+
自关联,然后id比较
DELETE p1 FROM Person p1,
Person p2
WHERE
p1.Email = p2.Email AND p1.Id > p2.Id | 25.571429 | 133 | 0.52095 |
17281db28f287c2b48cd9a32f023bf988a6bfaf4 | 128 | swift | Swift | Tests/LinuxMain.swift | danibachar/StarscreamQOS | 1be88bc8f016d0e66770a20f218cf9e2b84a1251 | [
"MIT"
] | 1 | 2021-05-12T05:44:01.000Z | 2021-05-12T05:44:01.000Z | Tests/LinuxMain.swift | danibachar/StarscreamQOS | 1be88bc8f016d0e66770a20f218cf9e2b84a1251 | [
"MIT"
] | null | null | null | Tests/LinuxMain.swift | danibachar/StarscreamQOS | 1be88bc8f016d0e66770a20f218cf9e2b84a1251 | [
"MIT"
] | null | null | null | import XCTest
import StarscreamQOSTests
var tests = [XCTestCaseEntry]()
tests += StarscreamQOSTests.allTests()
XCTMain(tests)
| 16 | 38 | 0.796875 |
bd69a5a769cc63892207b7dfe57573b1a780c6ae | 4,871 | sql | SQL | db/sql/src/main/resources/org/kuali/rice/rice-sql/initial-db/sql/mysql/KREW_USR_OPTN_T.sql | iu-uits-es/rice | efa98ec305cf3e89c448ab641bd89f0f3bafb2a6 | [
"ECL-2.0"
] | 2 | 2017-02-14T20:40:21.000Z | 2018-12-05T18:45:26.000Z | db/sql/src/main/resources/org/kuali/rice/rice-sql/initial-db/sql/mysql/KREW_USR_OPTN_T.sql | iu-uits-es/rice | efa98ec305cf3e89c448ab641bd89f0f3bafb2a6 | [
"ECL-2.0"
] | 10 | 2015-10-12T18:58:39.000Z | 2020-11-11T20:17:04.000Z | db/sql/src/main/resources/org/kuali/rice/rice-sql/initial-db/sql/mysql/KREW_USR_OPTN_T.sql | iu-uits-es/rice | efa98ec305cf3e89c448ab641bd89f0f3bafb2a6 | [
"ECL-2.0"
] | null | null | null | --
-- Copyright 2005-2014 The Kuali Foundation
--
-- Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
--
-- 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.
--
TRUNCATE TABLE KREW_USR_OPTN_T
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','ACTION_LIST_SIZE_NEW','10',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','ACTION_REQUESTED_COL_SHOW_NEW','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VER_NBR)
VALUES ('admin','APP_DOC_STATUS_COL_SHOW_NEW',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','CLEAR_FYI_COL_SHOW_NEW','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','CURRENT_NODE_COL_SHOW_NEW','no',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DATE_CREATED_COL_SHOW_NEW','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DELEGATOR_COL_SHOW_NEW','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DELEGATOR_FILTER','Secondary Delegators on Action List Page',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_A','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_C','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_D','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_E','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_F','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_I','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_P','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_R','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_S','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COLOR_X','white',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOCUMENT_STATUS_COL_SHOW_NEW','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','DOC_TYPE_COL_SHOW_NEW','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','EMAIL_NOTIFICATION','immediate',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','EMAIL_NOTIFY_PRIMARY','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','EMAIL_NOTIFY_SECONDARY','no',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VER_NBR)
VALUES ('admin','INITIATOR_COL_SHOW_NEW',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','LAST_APPROVED_DATE_COL_SHOW_NEW','no',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','NOTIFY_ACKNOWLEDGE','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','NOTIFY_APPROVE','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','NOTIFY_COMPLETE','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','NOTIFY_FYI','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','OPEN_ITEMS_NEW_WINDOW','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','PRIMARY_DELEGATE_FILTER','Primary Delegates on Action List Page',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','REFRESH_RATE','15',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','TITLE_COL_SHOW_NEW','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','USE_OUT_BOX','yes',1)
/
INSERT INTO KREW_USR_OPTN_T (PRNCPL_ID,PRSN_OPTN_ID,VAL,VER_NBR)
VALUES ('admin','WORKGROUP_REQUEST_COL_SHOW_NEW','yes',1)
/
| 39.282258 | 86 | 0.780127 |
a3887c23fe3ead7e5b233431aa8fbc57668a38cf | 217 | lua | Lua | resources/words/nei.lua | terrabythia/alfabeter | da422481ba223ebc6c4ded63fed8f75605193d44 | [
"MIT"
] | null | null | null | resources/words/nei.lua | terrabythia/alfabeter | da422481ba223ebc6c4ded63fed8f75605193d44 | [
"MIT"
] | null | null | null | resources/words/nei.lua | terrabythia/alfabeter | da422481ba223ebc6c4ded63fed8f75605193d44 | [
"MIT"
] | null | null | null | return {'neigen','neiging','neigem','neisse','neil','neijenhuis','neijmeijer','neijts','neijman','neijndorff','neijnens','neijzen','neijssen','neig','neigde','neigden','neigend','neigingen','neigt','neigende','neils'} | 217 | 217 | 0.700461 |
19c6b6e49954ff746298e5012fa8f1651fd24063 | 345 | kt | Kotlin | src/main/kotlin/jsonblob/core/compression/compressor/BlobCompressor.kt | tburch/jsonblob | a38ae796acc90217fbdeb2dc215432f2eb4a09cd | [
"Apache-2.0"
] | 222 | 2015-01-09T06:59:53.000Z | 2022-03-24T07:37:30.000Z | src/main/kotlin/jsonblob/core/compression/compressor/BlobCompressor.kt | tburch/jsonblob | a38ae796acc90217fbdeb2dc215432f2eb4a09cd | [
"Apache-2.0"
] | 72 | 2015-01-07T16:04:03.000Z | 2022-01-13T15:28:04.000Z | src/main/kotlin/jsonblob/core/compression/compressor/BlobCompressor.kt | tburch/jsonblob | a38ae796acc90217fbdeb2dc215432f2eb4a09cd | [
"Apache-2.0"
] | 69 | 2015-01-07T14:03:16.000Z | 2022-03-23T16:50:31.000Z | package jsonblob.core.compression.compressor
import java.io.InputStream
import java.io.OutputStream
interface BlobCompressor {
fun handles(fileExtension: String) : Boolean
fun getFileExtension() : String
fun getInputStream(inputStream: InputStream) : InputStream
fun getOutputStream(outputStream: OutputStream) : OutputStream
} | 31.363636 | 66 | 0.797101 |
5df0a30f3739875d94237c56d9f7b452d0650884 | 3,019 | go | Go | password.go | darkwyrm/goeznacl | f858410b607ea95137bd142a700e6f8f5244f89d | [
"MIT"
] | null | null | null | password.go | darkwyrm/goeznacl | f858410b607ea95137bd142a700e6f8f5244f89d | [
"MIT"
] | null | null | null | password.go | darkwyrm/goeznacl | f858410b607ea95137bd142a700e6f8f5244f89d | [
"MIT"
] | null | null | null | package goeznacl
import (
"crypto/rand"
"crypto/subtle"
"encoding/base64"
"errors"
"fmt"
"strings"
"golang.org/x/crypto/argon2"
)
// HashPassword turns a string into an Argon2 password hash. Set extra_strong to true if you're
// feeling particularly paranoid.
func HashPassword(password string, extra_strong bool) string {
var argonRAM, argonIterations, argonSaltLength, argonKeyLength uint32
var argonThreads uint8
if extra_strong {
// LUDICROUS SPEED! GO!
argonRAM = 1073741824 // 1GB of RAM
argonIterations = 10
argonThreads = 8
argonSaltLength = 24
argonKeyLength = 48
} else {
argonRAM = 65536 // 64MB of RAM
argonIterations = 3
argonThreads = 4
argonSaltLength = 16
argonKeyLength = 32
}
salt := make([]byte, argonSaltLength)
_, err := rand.Read(salt)
if err != nil {
return ""
}
passhash := argon2.IDKey([]byte(password), salt, argonIterations, argonRAM, argonThreads,
argonKeyLength)
// Although base85 encoding is used wherever possible, base64 is used here because of a
// potential collision: base85 uses the $ character and argon2 hash strings use it as a
// field delimiter. Not a huge deal here as the difference is just a few bytes.
passString := fmt.Sprintf("$argon2id$v=%d$m=%d,t=%d,p=%d$%s$%s",
argon2.Version, argonRAM, argonIterations, argonThreads,
base64.RawStdEncoding.EncodeToString(salt),
base64.RawStdEncoding.EncodeToString(passhash))
return passString
}
// VerifyPasswordHash takes a password and the Argon2 hash to verify against, gets the parameters
// from the hash, applies them to the supplied password, and returns whether or not they match and
// if something went wrong
func VerifyPasswordHash(password string, hashPass string) (bool, error) {
splitValues := strings.Split(hashPass, "$")
if len(splitValues) != 6 {
return false, errors.New("invalid argon hash string")
}
var version int
_, err := fmt.Sscanf(splitValues[2], "v=%d", &version)
if err != nil {
return false, err
}
if version != argon2.Version {
return false, errors.New("unsupported argon version")
}
var ramUsage, iterations uint32
var parallelism uint8
_, err = fmt.Sscanf(splitValues[3], "m=%d,t=%d,p=%d", &ramUsage, &iterations, ¶llelism)
if err != nil {
return false, err
}
var salt []byte
salt, err = base64.RawStdEncoding.DecodeString(splitValues[4])
if err != nil {
return false, err
}
var savedHash []byte
savedHash, err = base64.RawStdEncoding.DecodeString(splitValues[5])
if err != nil {
return false, err
}
passhash := argon2.IDKey([]byte(password), salt, iterations, ramUsage, parallelism,
uint32(len(savedHash)))
return (subtle.ConstantTimeCompare(passhash, savedHash) == 1), nil
}
// IsArgonHash checks to see if the string passed is an Argon2id password hash
func IsArgonHash(hashstr string) (bool, error) {
if !strings.HasPrefix(hashstr, "$argon2id") {
return false, errors.New("bad prefix")
}
if len(hashstr) > 128 {
return false, errors.New("hash too long")
}
return true, nil
}
| 27.953704 | 98 | 0.722093 |
800b0a7f6947131051faa121f74b9843ce18473d | 77,287 | java | Java | src/main/java/com/github/fluorumlabs/dtrack/api/VulnerabilityApi.java | fluorumlabs/dtrack-maven-plugin | 892dac85a87f82b39f0b3406b65ac96ed0c10cb4 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/fluorumlabs/dtrack/api/VulnerabilityApi.java | fluorumlabs/dtrack-maven-plugin | 892dac85a87f82b39f0b3406b65ac96ed0c10cb4 | [
"Apache-2.0"
] | 38 | 2021-06-03T07:33:33.000Z | 2022-03-29T10:17:01.000Z | src/main/java/com/github/fluorumlabs/dtrack/api/VulnerabilityApi.java | fluorumlabs/dtrack-maven-plugin | 892dac85a87f82b39f0b3406b65ac96ed0c10cb4 | [
"Apache-2.0"
] | 1 | 2021-11-02T10:10:23.000Z | 2021-11-02T10:10:23.000Z | /*
* Copyright 2021 Artem Godin.
*
* 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.
*/
/*
* Dependency-Track API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 4.2.1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.github.fluorumlabs.dtrack.api;
import com.github.fluorumlabs.dtrack.ApiCallback;
import com.github.fluorumlabs.dtrack.ApiClient;
import com.github.fluorumlabs.dtrack.ApiException;
import com.github.fluorumlabs.dtrack.ApiResponse;
import com.github.fluorumlabs.dtrack.Configuration;
import com.github.fluorumlabs.dtrack.Pair;
import com.github.fluorumlabs.dtrack.ProgressRequestBody;
import com.github.fluorumlabs.dtrack.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import com.github.fluorumlabs.dtrack.model.Project;
import com.github.fluorumlabs.dtrack.model.Vulnerability;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class VulnerabilityApi {
private ApiClient apiClient;
public VulnerabilityApi() {
this(Configuration.getDefaultApiClient());
}
public VulnerabilityApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for assignVulnerability
* @param source The vulnerability source (required)
* @param vulnId The vulnId (required)
* @param component The UUID of the component (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call assignVulnerabilityCall(String source, String vulnId, String component, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/source/{source}/vuln/{vulnId}/component/{component}"
.replaceAll("\\{" + "source" + "\\}", apiClient.escapeString(source.toString()))
.replaceAll("\\{" + "vulnId" + "\\}", apiClient.escapeString(vulnId.toString()))
.replaceAll("\\{" + "component" + "\\}", apiClient.escapeString(component.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call assignVulnerabilityValidateBeforeCall(String source, String vulnId, String component, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'source' is set
if (source == null) {
throw new ApiException("Missing the required parameter 'source' when calling assignVulnerability(Async)");
}
// verify the required parameter 'vulnId' is set
if (vulnId == null) {
throw new ApiException("Missing the required parameter 'vulnId' when calling assignVulnerability(Async)");
}
// verify the required parameter 'component' is set
if (component == null) {
throw new ApiException("Missing the required parameter 'component' when calling assignVulnerability(Async)");
}
com.squareup.okhttp.Call call = assignVulnerabilityCall(source, vulnId, component, progressListener, progressRequestListener);
return call;
}
/**
* Assigns a vulnerability to a component
*
* @param source The vulnerability source (required)
* @param vulnId The vulnId (required)
* @param component The UUID of the component (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void assignVulnerability(String source, String vulnId, String component) throws ApiException {
assignVulnerabilityWithHttpInfo(source, vulnId, component);
}
/**
* Assigns a vulnerability to a component
*
* @param source The vulnerability source (required)
* @param vulnId The vulnId (required)
* @param component The UUID of the component (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> assignVulnerabilityWithHttpInfo(String source, String vulnId, String component) throws ApiException {
com.squareup.okhttp.Call call = assignVulnerabilityValidateBeforeCall(source, vulnId, component, null, null);
return apiClient.execute(call);
}
/**
* Assigns a vulnerability to a component (asynchronously)
*
* @param source The vulnerability source (required)
* @param vulnId The vulnId (required)
* @param component The UUID of the component (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call assignVulnerabilityAsync(String source, String vulnId, String component, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = assignVulnerabilityValidateBeforeCall(source, vulnId, component, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for assignVulnerability1
* @param uuid The UUID of the vulnerability (required)
* @param component The UUID of the component (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call assignVulnerability1Call(String uuid, String component, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/{uuid}/component/{component}"
.replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString()))
.replaceAll("\\{" + "component" + "\\}", apiClient.escapeString(component.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call assignVulnerability1ValidateBeforeCall(String uuid, String component, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'uuid' is set
if (uuid == null) {
throw new ApiException("Missing the required parameter 'uuid' when calling assignVulnerability1(Async)");
}
// verify the required parameter 'component' is set
if (component == null) {
throw new ApiException("Missing the required parameter 'component' when calling assignVulnerability1(Async)");
}
com.squareup.okhttp.Call call = assignVulnerability1Call(uuid, component, progressListener, progressRequestListener);
return call;
}
/**
* Assigns a vulnerability to a component
*
* @param uuid The UUID of the vulnerability (required)
* @param component The UUID of the component (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void assignVulnerability1(String uuid, String component) throws ApiException {
assignVulnerability1WithHttpInfo(uuid, component);
}
/**
* Assigns a vulnerability to a component
*
* @param uuid The UUID of the vulnerability (required)
* @param component The UUID of the component (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> assignVulnerability1WithHttpInfo(String uuid, String component) throws ApiException {
com.squareup.okhttp.Call call = assignVulnerability1ValidateBeforeCall(uuid, component, null, null);
return apiClient.execute(call);
}
/**
* Assigns a vulnerability to a component (asynchronously)
*
* @param uuid The UUID of the vulnerability (required)
* @param component The UUID of the component (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call assignVulnerability1Async(String uuid, String component, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = assignVulnerability1ValidateBeforeCall(uuid, component, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for createVulnerability
* @param body (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call createVulnerabilityCall(Vulnerability body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
String localVarPath = "/v1/vulnerability";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call createVulnerabilityValidateBeforeCall(Vulnerability body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = createVulnerabilityCall(body, progressListener, progressRequestListener);
return call;
}
/**
* Creates a new vulnerability
*
* @param body (optional)
* @return Vulnerability
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Vulnerability createVulnerability(Vulnerability body) throws ApiException {
ApiResponse<Vulnerability> resp = createVulnerabilityWithHttpInfo(body);
return resp.getData();
}
/**
* Creates a new vulnerability
*
* @param body (optional)
* @return ApiResponse<Vulnerability>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Vulnerability> createVulnerabilityWithHttpInfo(Vulnerability body) throws ApiException {
com.squareup.okhttp.Call call = createVulnerabilityValidateBeforeCall(body, null, null);
Type localVarReturnType = new TypeToken<Vulnerability>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Creates a new vulnerability (asynchronously)
*
* @param body (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call createVulnerabilityAsync(Vulnerability body, final ApiCallback<Vulnerability> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = createVulnerabilityValidateBeforeCall(body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<Vulnerability>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getAffectedProject
* @param source (required)
* @param vuln (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getAffectedProjectCall(String source, String vuln, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/source/{source}/vuln/{vuln}/projects"
.replaceAll("\\{" + "source" + "\\}", apiClient.escapeString(source.toString()))
.replaceAll("\\{" + "vuln" + "\\}", apiClient.escapeString(vuln.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getAffectedProjectValidateBeforeCall(String source, String vuln, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'source' is set
if (source == null) {
throw new ApiException("Missing the required parameter 'source' when calling getAffectedProject(Async)");
}
// verify the required parameter 'vuln' is set
if (vuln == null) {
throw new ApiException("Missing the required parameter 'vuln' when calling getAffectedProject(Async)");
}
com.squareup.okhttp.Call call = getAffectedProjectCall(source, vuln, progressListener, progressRequestListener);
return call;
}
/**
* Returns a list of all projects affected by a specific vulnerability
*
* @param source (required)
* @param vuln (required)
* @return List<Project>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List<Project> getAffectedProject(String source, String vuln) throws ApiException {
ApiResponse<List<Project>> resp = getAffectedProjectWithHttpInfo(source, vuln);
return resp.getData();
}
/**
* Returns a list of all projects affected by a specific vulnerability
*
* @param source (required)
* @param vuln (required)
* @return ApiResponse<List<Project>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Project>> getAffectedProjectWithHttpInfo(String source, String vuln) throws ApiException {
com.squareup.okhttp.Call call = getAffectedProjectValidateBeforeCall(source, vuln, null, null);
Type localVarReturnType = new TypeToken<List<Project>>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Returns a list of all projects affected by a specific vulnerability (asynchronously)
*
* @param source (required)
* @param vuln (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getAffectedProjectAsync(String source, String vuln, final ApiCallback<List<Project>> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getAffectedProjectValidateBeforeCall(source, vuln, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<List<Project>>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getAllVulnerabilities
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getAllVulnerabilitiesCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getAllVulnerabilitiesValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = getAllVulnerabilitiesCall(progressListener, progressRequestListener);
return call;
}
/**
* Returns a list of all vulnerabilities
*
* @return List<Vulnerability>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List<Vulnerability> getAllVulnerabilities() throws ApiException {
ApiResponse<List<Vulnerability>> resp = getAllVulnerabilitiesWithHttpInfo();
return resp.getData();
}
/**
* Returns a list of all vulnerabilities
*
* @return ApiResponse<List<Vulnerability>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Vulnerability>> getAllVulnerabilitiesWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = getAllVulnerabilitiesValidateBeforeCall(null, null);
Type localVarReturnType = new TypeToken<List<Vulnerability>>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Returns a list of all vulnerabilities (asynchronously)
*
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getAllVulnerabilitiesAsync(final ApiCallback<List<Vulnerability>> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getAllVulnerabilitiesValidateBeforeCall(progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<List<Vulnerability>>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getVulnerabilitiesByComponent
* @param uuid (required)
* @param suppressed Optionally includes suppressed vulnerabilities (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getVulnerabilitiesByComponentCall(String uuid, Boolean suppressed, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/component/{uuid}"
.replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
if (suppressed != null)
localVarQueryParams.addAll(apiClient.parameterToPair("suppressed", suppressed));
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getVulnerabilitiesByComponentValidateBeforeCall(String uuid, Boolean suppressed, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'uuid' is set
if (uuid == null) {
throw new ApiException("Missing the required parameter 'uuid' when calling getVulnerabilitiesByComponent(Async)");
}
com.squareup.okhttp.Call call = getVulnerabilitiesByComponentCall(uuid, suppressed, progressListener, progressRequestListener);
return call;
}
/**
* Returns a list of all vulnerabilities for a specific component
*
* @param uuid (required)
* @param suppressed Optionally includes suppressed vulnerabilities (optional)
* @return List<Vulnerability>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List<Vulnerability> getVulnerabilitiesByComponent(String uuid, Boolean suppressed) throws ApiException {
ApiResponse<List<Vulnerability>> resp = getVulnerabilitiesByComponentWithHttpInfo(uuid, suppressed);
return resp.getData();
}
/**
* Returns a list of all vulnerabilities for a specific component
*
* @param uuid (required)
* @param suppressed Optionally includes suppressed vulnerabilities (optional)
* @return ApiResponse<List<Vulnerability>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Vulnerability>> getVulnerabilitiesByComponentWithHttpInfo(String uuid, Boolean suppressed) throws ApiException {
com.squareup.okhttp.Call call = getVulnerabilitiesByComponentValidateBeforeCall(uuid, suppressed, null, null);
Type localVarReturnType = new TypeToken<List<Vulnerability>>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Returns a list of all vulnerabilities for a specific component (asynchronously)
*
* @param uuid (required)
* @param suppressed Optionally includes suppressed vulnerabilities (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getVulnerabilitiesByComponentAsync(String uuid, Boolean suppressed, final ApiCallback<List<Vulnerability>> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getVulnerabilitiesByComponentValidateBeforeCall(uuid, suppressed, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<List<Vulnerability>>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getVulnerabilitiesByProject
* @param uuid (required)
* @param suppressed Optionally includes suppressed vulnerabilities (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getVulnerabilitiesByProjectCall(String uuid, Boolean suppressed, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/project/{uuid}"
.replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
if (suppressed != null)
localVarQueryParams.addAll(apiClient.parameterToPair("suppressed", suppressed));
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getVulnerabilitiesByProjectValidateBeforeCall(String uuid, Boolean suppressed, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'uuid' is set
if (uuid == null) {
throw new ApiException("Missing the required parameter 'uuid' when calling getVulnerabilitiesByProject(Async)");
}
com.squareup.okhttp.Call call = getVulnerabilitiesByProjectCall(uuid, suppressed, progressListener, progressRequestListener);
return call;
}
/**
* Returns a list of all vulnerabilities for a specific project
*
* @param uuid (required)
* @param suppressed Optionally includes suppressed vulnerabilities (optional)
* @return List<Vulnerability>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List<Vulnerability> getVulnerabilitiesByProject(String uuid, Boolean suppressed) throws ApiException {
ApiResponse<List<Vulnerability>> resp = getVulnerabilitiesByProjectWithHttpInfo(uuid, suppressed);
return resp.getData();
}
/**
* Returns a list of all vulnerabilities for a specific project
*
* @param uuid (required)
* @param suppressed Optionally includes suppressed vulnerabilities (optional)
* @return ApiResponse<List<Vulnerability>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Vulnerability>> getVulnerabilitiesByProjectWithHttpInfo(String uuid, Boolean suppressed) throws ApiException {
com.squareup.okhttp.Call call = getVulnerabilitiesByProjectValidateBeforeCall(uuid, suppressed, null, null);
Type localVarReturnType = new TypeToken<List<Vulnerability>>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Returns a list of all vulnerabilities for a specific project (asynchronously)
*
* @param uuid (required)
* @param suppressed Optionally includes suppressed vulnerabilities (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getVulnerabilitiesByProjectAsync(String uuid, Boolean suppressed, final ApiCallback<List<Vulnerability>> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getVulnerabilitiesByProjectValidateBeforeCall(uuid, suppressed, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<List<Vulnerability>>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getVulnerabilityByUuid
* @param uuid The UUID of the vulnerability (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getVulnerabilityByUuidCall(String uuid, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/{uuid}"
.replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getVulnerabilityByUuidValidateBeforeCall(String uuid, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'uuid' is set
if (uuid == null) {
throw new ApiException("Missing the required parameter 'uuid' when calling getVulnerabilityByUuid(Async)");
}
com.squareup.okhttp.Call call = getVulnerabilityByUuidCall(uuid, progressListener, progressRequestListener);
return call;
}
/**
* Returns a specific vulnerability
*
* @param uuid The UUID of the vulnerability (required)
* @return Vulnerability
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Vulnerability getVulnerabilityByUuid(String uuid) throws ApiException {
ApiResponse<Vulnerability> resp = getVulnerabilityByUuidWithHttpInfo(uuid);
return resp.getData();
}
/**
* Returns a specific vulnerability
*
* @param uuid The UUID of the vulnerability (required)
* @return ApiResponse<Vulnerability>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Vulnerability> getVulnerabilityByUuidWithHttpInfo(String uuid) throws ApiException {
com.squareup.okhttp.Call call = getVulnerabilityByUuidValidateBeforeCall(uuid, null, null);
Type localVarReturnType = new TypeToken<Vulnerability>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Returns a specific vulnerability (asynchronously)
*
* @param uuid The UUID of the vulnerability (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getVulnerabilityByUuidAsync(String uuid, final ApiCallback<Vulnerability> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getVulnerabilityByUuidValidateBeforeCall(uuid, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<Vulnerability>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getVulnerabilityByVulnId
* @param source (required)
* @param vuln (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getVulnerabilityByVulnIdCall(String source, String vuln, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/source/{source}/vuln/{vuln}"
.replaceAll("\\{" + "source" + "\\}", apiClient.escapeString(source.toString()))
.replaceAll("\\{" + "vuln" + "\\}", apiClient.escapeString(vuln.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getVulnerabilityByVulnIdValidateBeforeCall(String source, String vuln, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'source' is set
if (source == null) {
throw new ApiException("Missing the required parameter 'source' when calling getVulnerabilityByVulnId(Async)");
}
// verify the required parameter 'vuln' is set
if (vuln == null) {
throw new ApiException("Missing the required parameter 'vuln' when calling getVulnerabilityByVulnId(Async)");
}
com.squareup.okhttp.Call call = getVulnerabilityByVulnIdCall(source, vuln, progressListener, progressRequestListener);
return call;
}
/**
* Returns a specific vulnerability
*
* @param source (required)
* @param vuln (required)
* @return Vulnerability
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Vulnerability getVulnerabilityByVulnId(String source, String vuln) throws ApiException {
ApiResponse<Vulnerability> resp = getVulnerabilityByVulnIdWithHttpInfo(source, vuln);
return resp.getData();
}
/**
* Returns a specific vulnerability
*
* @param source (required)
* @param vuln (required)
* @return ApiResponse<Vulnerability>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Vulnerability> getVulnerabilityByVulnIdWithHttpInfo(String source, String vuln) throws ApiException {
com.squareup.okhttp.Call call = getVulnerabilityByVulnIdValidateBeforeCall(source, vuln, null, null);
Type localVarReturnType = new TypeToken<Vulnerability>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Returns a specific vulnerability (asynchronously)
*
* @param source (required)
* @param vuln (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getVulnerabilityByVulnIdAsync(String source, String vuln, final ApiCallback<Vulnerability> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getVulnerabilityByVulnIdValidateBeforeCall(source, vuln, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<Vulnerability>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for unassignVulnerability
* @param source The vulnerability source (required)
* @param vulnId The vulnId (required)
* @param component The UUID of the component (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call unassignVulnerabilityCall(String source, String vulnId, String component, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/source/{source}/vuln/{vulnId}/component/{component}"
.replaceAll("\\{" + "source" + "\\}", apiClient.escapeString(source.toString()))
.replaceAll("\\{" + "vulnId" + "\\}", apiClient.escapeString(vulnId.toString()))
.replaceAll("\\{" + "component" + "\\}", apiClient.escapeString(component.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call unassignVulnerabilityValidateBeforeCall(String source, String vulnId, String component, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'source' is set
if (source == null) {
throw new ApiException("Missing the required parameter 'source' when calling unassignVulnerability(Async)");
}
// verify the required parameter 'vulnId' is set
if (vulnId == null) {
throw new ApiException("Missing the required parameter 'vulnId' when calling unassignVulnerability(Async)");
}
// verify the required parameter 'component' is set
if (component == null) {
throw new ApiException("Missing the required parameter 'component' when calling unassignVulnerability(Async)");
}
com.squareup.okhttp.Call call = unassignVulnerabilityCall(source, vulnId, component, progressListener, progressRequestListener);
return call;
}
/**
* Removes assignment of a vulnerability from a component
*
* @param source The vulnerability source (required)
* @param vulnId The vulnId (required)
* @param component The UUID of the component (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void unassignVulnerability(String source, String vulnId, String component) throws ApiException {
unassignVulnerabilityWithHttpInfo(source, vulnId, component);
}
/**
* Removes assignment of a vulnerability from a component
*
* @param source The vulnerability source (required)
* @param vulnId The vulnId (required)
* @param component The UUID of the component (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> unassignVulnerabilityWithHttpInfo(String source, String vulnId, String component) throws ApiException {
com.squareup.okhttp.Call call = unassignVulnerabilityValidateBeforeCall(source, vulnId, component, null, null);
return apiClient.execute(call);
}
/**
* Removes assignment of a vulnerability from a component (asynchronously)
*
* @param source The vulnerability source (required)
* @param vulnId The vulnId (required)
* @param component The UUID of the component (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call unassignVulnerabilityAsync(String source, String vulnId, String component, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = unassignVulnerabilityValidateBeforeCall(source, vulnId, component, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for unassignVulnerability1
* @param uuid The UUID of the vulnerability (required)
* @param component The UUID of the component (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call unassignVulnerability1Call(String uuid, String component, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/vulnerability/{uuid}/component/{component}"
.replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString()))
.replaceAll("\\{" + "component" + "\\}", apiClient.escapeString(component.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call unassignVulnerability1ValidateBeforeCall(String uuid, String component, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'uuid' is set
if (uuid == null) {
throw new ApiException("Missing the required parameter 'uuid' when calling unassignVulnerability1(Async)");
}
// verify the required parameter 'component' is set
if (component == null) {
throw new ApiException("Missing the required parameter 'component' when calling unassignVulnerability1(Async)");
}
com.squareup.okhttp.Call call = unassignVulnerability1Call(uuid, component, progressListener, progressRequestListener);
return call;
}
/**
* Removes assignment of a vulnerability from a component
*
* @param uuid The UUID of the vulnerability (required)
* @param component The UUID of the component (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void unassignVulnerability1(String uuid, String component) throws ApiException {
unassignVulnerability1WithHttpInfo(uuid, component);
}
/**
* Removes assignment of a vulnerability from a component
*
* @param uuid The UUID of the vulnerability (required)
* @param component The UUID of the component (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> unassignVulnerability1WithHttpInfo(String uuid, String component) throws ApiException {
com.squareup.okhttp.Call call = unassignVulnerability1ValidateBeforeCall(uuid, component, null, null);
return apiClient.execute(call);
}
/**
* Removes assignment of a vulnerability from a component (asynchronously)
*
* @param uuid The UUID of the vulnerability (required)
* @param component The UUID of the component (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call unassignVulnerability1Async(String uuid, String component, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = unassignVulnerability1ValidateBeforeCall(uuid, component, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for updateVulnerability
* @param body (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call updateVulnerabilityCall(Vulnerability body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
String localVarPath = "/v1/vulnerability";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "X-Api-Key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call updateVulnerabilityValidateBeforeCall(Vulnerability body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = updateVulnerabilityCall(body, progressListener, progressRequestListener);
return call;
}
/**
* Updates an internal vulnerability
*
* @param body (optional)
* @return Project
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Project updateVulnerability(Vulnerability body) throws ApiException {
ApiResponse<Project> resp = updateVulnerabilityWithHttpInfo(body);
return resp.getData();
}
/**
* Updates an internal vulnerability
*
* @param body (optional)
* @return ApiResponse<Project>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Project> updateVulnerabilityWithHttpInfo(Vulnerability body) throws ApiException {
com.squareup.okhttp.Call call = updateVulnerabilityValidateBeforeCall(body, null, null);
Type localVarReturnType = new TypeToken<Project>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Updates an internal vulnerability (asynchronously)
*
* @param body (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call updateVulnerabilityAsync(Vulnerability body, final ApiCallback<Project> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = updateVulnerabilityValidateBeforeCall(body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<Project>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}
| 48.153894 | 283 | 0.688343 |
510301e5b294cbb3e64566e585e1c425b254d0b7 | 18,823 | lua | Lua | forum/BattleChips/Main.lua | effelsberg/loveCodea | 3909566b0eef0f57bd82b9c4b6b298449bbae0f7 | [
"MIT"
] | 23 | 2015-01-22T01:57:59.000Z | 2021-05-03T13:22:57.000Z | forum/BattleChips/Main.lua | effelsberg/loveCodea | 3909566b0eef0f57bd82b9c4b6b298449bbae0f7 | [
"MIT"
] | 1 | 2015-02-25T23:47:42.000Z | 2015-02-25T23:47:42.000Z | forum/BattleChips/Main.lua | effelsberg/loveCodea | 3909566b0eef0f57bd82b9c4b6b298449bbae0f7 | [
"MIT"
] | 3 | 2015-11-04T13:21:02.000Z | 2018-07-13T00:20:36.000Z | -- Batlle Chips 26 Jun 12
-- Mark Sumner
-- devilstower@gmail.com
displayMode(FULLSCREEN)
supportedOrientations(PORTRAIT_ANY)
rectMode(CORNERS)
spriteMode(CORNERS)
textMode(CORNER)
noSmooth()
font("Copperplate")
function setup()
local y, x, i
-- create background images
gridImg = image(200, 200)
fill(25, 27, 46, 255)
stroke(255, 255, 255, 25)
setContext(gridImg)
noStroke()
rect(0,0,200,200)
strokeWidth(1)
r = HEIGHT/WIDTH
for y = 0, 59 do
line(0, y * 4, 200, y * 4)
end
for x = 0,39 do
line(x * 4 * r, 0, x * 4 * r, 200)
end
-- chip texture
setContext()
chipImg = image(145, 30)
fill(79, 79, 79, 255)
stroke(131, 123, 123, 135)
strokeWidth(1)
setContext(chipImg)
rect(0,0,200,200)
for y = 0, 20 do
line(0, y * 3, 200, y * 3)
end
for x = 0,70 do
line(x * 3, 0, x * 3 + 30, 200)
end
setContext()
-- circut board texture
boardImg = image(200, 200)
fill(255, 255, 255, 255)
strokeWidth(1)
setContext(boardImg)
rect(0,0,200,200)
stroke(29, 54, 30, 135)
for x = 0, 200 do
line(x * 2, 0, x * 2, 200)
end
stroke(72, 72, 72, 135)
for x = 0, 200 do
line(0, x * 2, 200, x * 2)
end
setContext()
-- robot array
robots = {}
for i = 1,20 do
robots[i] = Robot(17 + i * 70,300)
end
-- definition of program codes
codes = {}
color(219, 11, 10, 255)
codes[1] = Code("F", "Forward", "", false, color(219, 11, 10, 255))
codes[2] = Code("L", "Turn", "Left", false, color(219, 11, 10, 255))
codes[3] = Code("R", "Turn", "Right",
false, color(219, 11, 10, 255))
codes[4] = Code("B", "Reverse", "", false, color(219, 11, 10, 255))
codes[5] = Code("W", "Fire!", "",
false, color(251, 215, 9, 255))
codes[6] = Code("H", "Bump", "", true, color(95, 99, 229, 255))
codes[7] = Code("A", "Radar", "", true, color(95, 99, 229, 255))
codes[8] = Code("I", "Radar", "Right",
true, color(95, 99, 229, 255))
codes[9] = Code("T", "Radar", "Left",
true, color(95, 99, 229, 255))
codes[10] = Code("D", "Damage", "", true, color(95, 99, 229, 255))
codes[11] = Code("G", "Goto", "", true, color(31, 195, 17, 255))
codes[12] = Code("5", "Random", "", true, color(31, 195, 17, 255))
codes[13] = Code("P", "Repeat", "", true, color(31, 195, 17, 255))
codes[14] = Code("+", "Shields", "On", false,
color(251, 215, 9, 255))
codes[15] = Code("-", "Shields", "Off", false,
color(251, 215, 9, 255))
codes[16] = Code("E", "Conduct", "Repairs",
false, color(251, 215, 9, 255))
codes[17] = Code("1", "Board", "A", false, color(42, 251, 8, 255))
codes[18] = Code("2", "Board", "B", false, color(42, 251, 8, 255))
codes[19] = Code("S", "Sound", "Horn", false,
color(251, 215, 9, 255))
codes[20] = Code("v", "Pen", "Down", false,
color(251, 215, 9, 255))
codes[21] = Code("^", "Pen", "Up", false,
color(251, 215, 9, 255))
mode = 1
dragToken = Token(codes[1], 0, 0)
bench = CodeBench(35, 150)
scheduler = TourneyOrganizer(35, 150)
tray = TokenTray(550, 150)
oldState = nil
doneBtn = BigButton("Done", 550, 25)
doneBtn.frame.right = doneBtn.frame.right + 60
codeBtn = BigButton("Code", 220, 100)
designBtn = BigButton("Design", 30, 100)
tourneyBtn = BigButton("Compete", 410, 100)
tradeBtn = BigButton("Trade", 600, 100)
arena = Arena(10, HEIGHT - 650, WIDTH - 10, HEIGHT - 10)
arena:draw()
studio = DesignStudio(20, 410, WIDTH - 20, HEIGHT - 20)
vslider = Vslider(0,0,0)
vcslider = VColorSlider(0,0,0)
trader = TradingCenter()
showSlider = false
sliderPosition = 0
leftBot = 1
selectedRobot = 0
botFrames = {}
loadRobots()
for i = 1,7 do
botFrames[i] = Frame(i * 87, 200,
i * 87 + 80, 300)
end
leftRobot = 1
rightBtn = Frame(WIDTH - 80, 260, WIDTH, 360)
leftBtn = Frame(0, 260, 80, 360)
-- tourney variables
tourney = Tourney()
end
function saveRobots()
local k, s, i, c
s = table.maxn(robots)..","
for i, r in ipairs(robots) do
r.wins = r.body * 10 + r.tread
r.losses = r.head * 10 + r.dish
s = s..r.name..","..r.wins..","..r.losses..","
s = s..r.treadColor..","..r.bodyColor..","
s = s..r.headColor..","..r.dishColor..","
c = table.maxn(r.program)
s = s..c
if i < table.maxn(robots) or c > 0 then s = s.."," end
for k, p in ipairs(r.program) do
if p.code ~= nil then
s = s..k..","..p.code.short..","..p.value
s=s..","
else
s = s..k..",nil"..","..p.value
s=s..","
end
end
end
saveProjectData("BCBots", s)
end
function loadRobots()
local k, s, i, robotCount, d, c
local w = {}
--displayMode(STANDARD)
s = readProjectData("BCBots")
--print(s)
if s == nil then
s = getDefault()
end
if s ~= nil then
i = 0
for k in string.gmatch(s,"([^,]+)") do
i = i + 1
w[i] = k
end
robotCount = w[1]
top = 2
for r = 1, robotCount do
robots[r].name = w[top]
robots[r].wins = tonumber(w[top + 1])
robots[r].losses = tonumber(w[top + 2])
robots[r].treadColor = tonumber(w[top + 3])
robots[r].bodyColor = tonumber(w[top + 4])
robots[r].headColor = tonumber(w[top + 5])
robots[r].dishColor = tonumber(w[top + 6])
robots[r].body = math.floor(robots[r].wins / 10)
robots[r].head = math.floor(robots[r].losses / 10)
robots[r].tread = math.fmod(robots[r].wins , 10)
robots[r].dish = math.fmod(robots[r].losses , 10)
if robots[r].body == 0 then robots[r].body = 2 end
if robots[r].head == 0 then robots[r].head = 1 end
if robots[r].tread == 0 then robots[r].tread = 2 end
if robots[r].dish == 0 then robots[r].dish = 1 end
programSize = tonumber(w[top + 7])
i = 0
if programSize > 0 then
for i = 1, programSize do
socketNum = tonumber(w[i * 3 - 2 + top + 7])
codeShort = w[i * 3 - 1 + top + 7]
value = tonumber(w[i * 3 + top + 7])
-- find the right code
code = nil
for d, c in ipairs(codes) do
if c.short == codeShort then
code = c
end
end
robots[r].program[socketNum] = Socket(code, 0, 0)
robots[r].program[socketNum].value = value
end
end
top = top + 8 + programSize * 3
end
end
end
function drawMain()
local i
pushStyle()
fill(0, 0, 0, 255)
stroke(0, 69, 255, 255)
tint(249, 249, 249, 255)
strokeWidth(2)
textMode(CENTER)
fontSize(12)
stroke(255, 255, 255, 255)
for i = 1, 7 do
noFill()
noStroke()
botFrames[i]:draw()
robots[i + leftRobot - 1].x = botFrames[i].left + 10
robots[i + leftRobot - 1].y = botFrames[i]:midY()
fill(255, 255, 255, 255)
text(robots[i + leftRobot - 1].name, botFrames[i]:midX(),
botFrames[i].bottom+32)
end
codeBtn:draw()
designBtn:draw()
tourneyBtn:draw()
tradeBtn:draw()
textMode(CORNER)
stroke(255, 255, 255, 255)
fill(255, 255, 255, 255)
stroke(213, 213, 213, 255)
strokeWidth(1)
line(arena.frame.left, arena.frame.bottom - 15,
arena.frame:midX() - 50, arena.frame.bottom - 15)
line(arena.frame.right, arena.frame.bottom - 15,
arena.frame:midX() + 60, arena.frame.bottom - 15)
line(arena.frame.left, arena.frame.bottom - 20,
arena.frame.left, arena.frame.bottom - 10)
line(arena.frame.right, arena.frame.bottom - 20,
arena.frame.right, arena.frame.bottom - 10)
fontSize(16)
text("10.3 meters", arena.frame:midX() - 45,
arena.frame.bottom - 25)
stroke(255, 255, 255, 255)
strokeWidth(1)
if leftRobot > 1 then
line(10, 280, 50, 310)
line(10, 280, 50, 250)
line(50, 310, 50, 250)
end
if leftRobot < 13 then
line(WIDTH - 10, 280, WIDTH - 50, 310)
line(WIDTH - 10, 280, WIDTH - 50, 250)
line(WIDTH - 50, 250, WIDTH - 50, 310)
end
strokeWidth(1)
popStyle()
end
function draw()
local i, m
noSmooth()
background(255, 255, 255, 255)
tint(255, 255, 255, 255)
sprite(gridImg, 0, 0, WIDTH, HEIGHT)
if mode == 1 then
arena:draw()
end
if mode == 1 and arena.game == 1 then
drawMain()
for i = 1,7 do
s = math.abs(4 - i) / 10
robots[i + leftRobot - 1]:draw(1)
end
elseif mode == 2 then
bench:draw()
tray:draw()
if showSlider then
vslider:draw()
end
doneBtn:draw()
elseif mode == 3 then
studio:draw()
doneBtn:draw()
elseif mode == 4 then
scheduler:draw(robots)
doneBtn:draw()
elseif mode == 5 then
trader:draw(robots)
doneBtn:draw()
end
-- touch handling
if mode == 1 then
if CurrentTouch.state == BEGAN and
CurrentTouch.state ~= oldState then
if arena:touched(CurrentTouch) then
end
if arena.stop:touched(CurrentTouch) then
arena:sizeFrames(10, HEIGHT - 650,
WIDTH - 10, HEIGHT - 10)
arena:clear()
end
if leftBtn:touched(CurrentTouch) and leftRobot > 1 then
leftRobot = leftRobot - 1
end
if rightBtn:touched(CurrentTouch) and
leftRobot < 13 then
leftRobot = leftRobot + 1
end
selectedRobot = 0
-- check to see if a robot was selected
for i = 1, 7 do
if botFrames[i]:touched(CurrentTouch) then
selectedRobot = i + leftRobot - 1
end
end
end
if CurrentTouch.state == MOVING then
if selectedRobot > 0 then
robots[selectedRobot].x = CurrentTouch.x - 20
robots[selectedRobot].y = CurrentTouch.y - 20
robots[selectedRobot]:draw(1)
end
end
if CurrentTouch.state == ENDED
and CurrentTouch.state ~= oldState then
if selectedRobot > 0 then
if codeBtn:touched(CurrentTouch) then
bench:loadRobot(robots[selectedRobot])
mode = 2
end
if designBtn:touched(CurrentTouch) then
showKeyboard()
doneBtn.frame.top = 380
doneBtn.frame.bottom = 300
studio:setBot(robots[selectedRobot])
mode = 3
end
if tourneyBtn:touched(CurrentTouch) then
scheduler:loadRobot(selectedRobot)
selectedRobot = 0
mode = 4
end
if tradeBtn:touched(CurrentTouch) then
trader:loadRobot(selectedRobot)
selectedRobot = 0
mode = 5
end
if arena:touched(CurrentTouch) then
if table.maxn(arena.robots) < 4 then
arena:loadRobot(robots[selectedRobot],
CurrentTouch.x, 111)
else
sound(SOUND_BLIT, 30424)
end
end
end
end
end
if mode == 2 then
if CurrentTouch.state == BEGAN and
CurrentTouch.state ~= oldState then
selectedToken = 0
-- check to see if a token was selected
if tray:touched(CurrentTouch) then
dragToken = Token(tray.tokens[tray.selected].code,
CurrentTouch.x - 20, CurrentTouch.y,
tray.tokens[tray.selected].color)
end
if bench:touched(CurrentTouch) then
-- touched a socket
c = bench.sockets[bench.selectedSocket].code
if c ~= nil and bench.action == 0 then
if c.hasValue then
vslider = Vslider(CurrentTouch.x,
CurrentTouch.y,
bench.sockets[bench.selectedSocket].value)
showSlider = true
end
end
if c ~= nil and bench.action == 1 then
dragToken =
Token(bench.sockets[bench.selectedSocket].code,
CurrentTouch.x - 20, CurrentTouch.y,
bench.sockets[bench.selectedSocket].color)
bench.sockets[bench.selectedSocket].code = nil
end
end
end
if CurrentTouch.state == MOVING then
if dragToken ~= nil
then
dragToken.x = CurrentTouch.x - 20
dragToken.y = CurrentTouch.y
dragToken:draw()
end
if showSlider then
if vslider:touched(CurrentTouch) then
bench.sockets[bench.selectedSocket].value =
vslider.value
end
end
end
if CurrentTouch.state == ENDED
and CurrentTouch.state ~= oldState then
if dragToken ~= nil then
if bench:touched(CurrentTouch) then
bench.sockets[bench.selectedSocket].code =
dragToken.code
sound(SOUND_HIT, 30249)
end
dragToken = nil
end
for i = 1,3 do
if bench.mini[i]:touched(CurrentTouch) then
if bench.board ~= i then
bench.board = i
sound(DATA, "ZgNAZgBBASw/EiBhpHA9PqcNdD6dNtA9GAADTRUtLU4wP3wA")
end
end
end
if showSlider then showSlider = false end
if doneBtn:touched(CurrentTouch) then
-- save code
for i = 1,90 do
if bench.sockets[i].code ~= nil then
b = bench.sockets[i]
robots[selectedRobot].program[i] =
Socket(b.code, 0, 0)
robots[selectedRobot].program[i].value = b.value
else
robots[selectedRobot].program[i] =
Socket(nil, 0, 0)
robots[selectedRobot].program[i].value = 1
end
end
saveRobots()
mode = 1
end
end
end
if mode == 3 then
if CurrentTouch.state == BEGAN and
CurrentTouch.state ~= oldState then
-- check to see if a robot was selected
studio:touched(CurrentTouch)
if doneBtn:touched(CurrentTouch) then
doneBtn.frame.top = 140
doneBtn.frame.bottom = 60
hideKeyboard()
mode = 1
saveRobots()
end
end
if CurrentTouch.state == MOVING then
studio:touched(CurrentTouch)
end
if CurrentTouch.state == ENDED
and CurrentTouch.state ~= oldState then
studio.showColorSlider = false
end
end
if mode == 4 then
if CurrentTouch.state == BEGAN and
CurrentTouch.state ~= oldState then
-- check to see if a robot was selected
scheduler:touched(CurrentTouch)
if doneBtn:touched(CurrentTouch) then
mode = 1
saveRobots()
end
if scheduler.meleeBtn:touched(CurrentTouch) then
mode = 1
arena:clear()
for i = 1, 4 do
if scheduler.contestants[i] == 0 then
scheduler.contestants[i] = math.random(20)
end
end
arena:loadRobot(robots[scheduler.contestants[1]],
60, 60)
arena:loadRobot(robots[scheduler.contestants[2]],
60, arena.field:height() - 60)
arena:loadRobot(robots[scheduler.contestants[3]],
arena.field:height() - 60, arena.field:height() - 60)
arena:loadRobot(robots[scheduler.contestants[4]],
arena.field:height() - 60, 60)
arena.game = 4
arena.tourney = true
arena:sizeFrames(10, 60, WIDTH - 10, HEIGHT - 10)
end
if scheduler.skeetBtn:touched(CurrentTouch) then
mode = 1
arena:sizeFrames(10, 60, WIDTH - 10, HEIGHT - 10)
arena:skeetMatch(robots[scheduler.contestants[1]])
end
if scheduler.mazeBtn:touched(CurrentTouch) then
mode = 1
arena:sizeFrames(10, 60, WIDTH - 10, HEIGHT - 10)
arena:mazeRace(robots[scheduler.contestants[1]])
end
end
if CurrentTouch.state == MOVING then
scheduler:touched(CurrentTouch)
end
if CurrentTouch.state == ENDED
and CurrentTouch.state ~= oldState then
scheduler.showSlider = false
end
end
if mode == 5 then
if CurrentTouch.state == BEGAN and
CurrentTouch.state ~= oldState then
-- check to see if a robot was selected
trader:touched(CurrentTouch)
if doneBtn:touched(CurrentTouch) then
mode = 1
saveRobots()
end
end
if CurrentTouch.state == MOVING then
trader:touched(CurrentTouch)
end
if CurrentTouch.state == ENDED
and CurrentTouch.state ~= oldState then
end
end
oldState = CurrentTouch.state
end
function keyboard(key)
if mode == 3 then
if key ~= nil then
if string.byte(key) == 10 then
--
else
if string.byte(key) ~= 44 then -- filter out commas
studio.tb:acceptKey(key)
end
end
end
end
end
| 32.849913 | 87 | 0.499442 |
43cc14f35681f8a9120ffa160df94c4a88a2ea93 | 155 | go | Go | config_test.go | jetz/sslchecker | 56b9295d5906f20e9a8739c254a122eb88d7154d | [
"MIT"
] | 8 | 2016-09-03T00:38:50.000Z | 2020-11-25T08:43:14.000Z | config_test.go | jetz/sslchecker | 56b9295d5906f20e9a8739c254a122eb88d7154d | [
"MIT"
] | null | null | null | config_test.go | jetz/sslchecker | 56b9295d5906f20e9a8739c254a122eb88d7154d | [
"MIT"
] | 5 | 2016-10-27T10:20:32.000Z | 2020-05-22T15:37:53.000Z | package main
import "testing"
func TestLoad(t *testing.T) {
config := NewConfig()
if err := config.load(); err != nil {
t.Error(err)
t.Fail()
}
}
| 12.916667 | 38 | 0.612903 |
ee608ddffee3cf8f259db68549e5f90ab95bfc7e | 456 | asm | Assembly | oeis/116/A116736.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/116/A116736.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/116/A116736.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A116736: Number of permutations of length n which avoid the patterns 1432, 2314, 2413.
; Submitted by Jon Maiga
; 1,2,6,21,75,263,904,3066,10324,34652,116179,389443,1305592,4377595,14679474,49227937,165091510,553658600,1856778673,6226985606,20883103968,70034469898,234870470627,787671056978,2641565114181
lpb $0
sub $0,1
add $1,$3
add $1,$5
sub $3,$4
sub $3,1
sub $2,$3
add $3,$1
add $4,$1
add $4,$2
add $5,$2
lpe
mov $0,$4
add $0,1
| 24 | 192 | 0.703947 |
77da0cd6993dacf3d0312e826d5cae320b1a6ec9 | 11,141 | dart | Dart | lib/src/generated/google/monitoring/v3/service_service.pbjson.dart | peiffer-innovations/grpc_googleapis | b36cb71289ed0714a7246bc6f8db84ad1551d39a | [
"MIT"
] | null | null | null | lib/src/generated/google/monitoring/v3/service_service.pbjson.dart | peiffer-innovations/grpc_googleapis | b36cb71289ed0714a7246bc6f8db84ad1551d39a | [
"MIT"
] | null | null | null | lib/src/generated/google/monitoring/v3/service_service.pbjson.dart | peiffer-innovations/grpc_googleapis | b36cb71289ed0714a7246bc6f8db84ad1551d39a | [
"MIT"
] | null | null | null | ///
// Generated code. Do not modify.
// source: google/monitoring/v3/service_service.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use createServiceRequestDescriptor instead')
const CreateServiceRequest$json = const {
'1': 'CreateServiceRequest',
'2': const [
const {
'1': 'parent',
'3': 1,
'4': 1,
'5': 9,
'8': const {},
'10': 'parent'
},
const {'1': 'service_id', '3': 3, '4': 1, '5': 9, '10': 'serviceId'},
const {
'1': 'service',
'3': 2,
'4': 1,
'5': 11,
'6': '.google.monitoring.v3.Service',
'8': const {},
'10': 'service'
},
],
};
/// Descriptor for `CreateServiceRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List createServiceRequestDescriptor = $convert.base64Decode(
'ChRDcmVhdGVTZXJ2aWNlUmVxdWVzdBJBCgZwYXJlbnQYASABKAlCKeBBAvpBIxIhbW9uaXRvcmluZy5nb29nbGVhcGlzLmNvbS9TZXJ2aWNlUgZwYXJlbnQSHQoKc2VydmljZV9pZBgDIAEoCVIJc2VydmljZUlkEjwKB3NlcnZpY2UYAiABKAsyHS5nb29nbGUubW9uaXRvcmluZy52My5TZXJ2aWNlQgPgQQJSB3NlcnZpY2U=');
@$core.Deprecated('Use getServiceRequestDescriptor instead')
const GetServiceRequest$json = const {
'1': 'GetServiceRequest',
'2': const [
const {'1': 'name', '3': 1, '4': 1, '5': 9, '8': const {}, '10': 'name'},
],
};
/// Descriptor for `GetServiceRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List getServiceRequestDescriptor = $convert.base64Decode(
'ChFHZXRTZXJ2aWNlUmVxdWVzdBI9CgRuYW1lGAEgASgJQingQQL6QSMKIW1vbml0b3JpbmcuZ29vZ2xlYXBpcy5jb20vU2VydmljZVIEbmFtZQ==');
@$core.Deprecated('Use listServicesRequestDescriptor instead')
const ListServicesRequest$json = const {
'1': 'ListServicesRequest',
'2': const [
const {
'1': 'parent',
'3': 1,
'4': 1,
'5': 9,
'8': const {},
'10': 'parent'
},
const {'1': 'filter', '3': 2, '4': 1, '5': 9, '10': 'filter'},
const {'1': 'page_size', '3': 3, '4': 1, '5': 5, '10': 'pageSize'},
const {'1': 'page_token', '3': 4, '4': 1, '5': 9, '10': 'pageToken'},
],
};
/// Descriptor for `ListServicesRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listServicesRequestDescriptor = $convert.base64Decode(
'ChNMaXN0U2VydmljZXNSZXF1ZXN0EkEKBnBhcmVudBgBIAEoCUIp4EEC+kEjEiFtb25pdG9yaW5nLmdvb2dsZWFwaXMuY29tL1NlcnZpY2VSBnBhcmVudBIWCgZmaWx0ZXIYAiABKAlSBmZpbHRlchIbCglwYWdlX3NpemUYAyABKAVSCHBhZ2VTaXplEh0KCnBhZ2VfdG9rZW4YBCABKAlSCXBhZ2VUb2tlbg==');
@$core.Deprecated('Use listServicesResponseDescriptor instead')
const ListServicesResponse$json = const {
'1': 'ListServicesResponse',
'2': const [
const {
'1': 'services',
'3': 1,
'4': 3,
'5': 11,
'6': '.google.monitoring.v3.Service',
'10': 'services'
},
const {
'1': 'next_page_token',
'3': 2,
'4': 1,
'5': 9,
'10': 'nextPageToken'
},
],
};
/// Descriptor for `ListServicesResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listServicesResponseDescriptor = $convert.base64Decode(
'ChRMaXN0U2VydmljZXNSZXNwb25zZRI5CghzZXJ2aWNlcxgBIAMoCzIdLmdvb2dsZS5tb25pdG9yaW5nLnYzLlNlcnZpY2VSCHNlcnZpY2VzEiYKD25leHRfcGFnZV90b2tlbhgCIAEoCVINbmV4dFBhZ2VUb2tlbg==');
@$core.Deprecated('Use updateServiceRequestDescriptor instead')
const UpdateServiceRequest$json = const {
'1': 'UpdateServiceRequest',
'2': const [
const {
'1': 'service',
'3': 1,
'4': 1,
'5': 11,
'6': '.google.monitoring.v3.Service',
'8': const {},
'10': 'service'
},
const {
'1': 'update_mask',
'3': 2,
'4': 1,
'5': 11,
'6': '.google.protobuf.FieldMask',
'10': 'updateMask'
},
],
};
/// Descriptor for `UpdateServiceRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List updateServiceRequestDescriptor = $convert.base64Decode(
'ChRVcGRhdGVTZXJ2aWNlUmVxdWVzdBI8CgdzZXJ2aWNlGAEgASgLMh0uZ29vZ2xlLm1vbml0b3JpbmcudjMuU2VydmljZUID4EECUgdzZXJ2aWNlEjsKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza1IKdXBkYXRlTWFzaw==');
@$core.Deprecated('Use deleteServiceRequestDescriptor instead')
const DeleteServiceRequest$json = const {
'1': 'DeleteServiceRequest',
'2': const [
const {'1': 'name', '3': 1, '4': 1, '5': 9, '8': const {}, '10': 'name'},
],
};
/// Descriptor for `DeleteServiceRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List deleteServiceRequestDescriptor = $convert.base64Decode(
'ChREZWxldGVTZXJ2aWNlUmVxdWVzdBI9CgRuYW1lGAEgASgJQingQQL6QSMKIW1vbml0b3JpbmcuZ29vZ2xlYXBpcy5jb20vU2VydmljZVIEbmFtZQ==');
@$core.Deprecated('Use createServiceLevelObjectiveRequestDescriptor instead')
const CreateServiceLevelObjectiveRequest$json = const {
'1': 'CreateServiceLevelObjectiveRequest',
'2': const [
const {
'1': 'parent',
'3': 1,
'4': 1,
'5': 9,
'8': const {},
'10': 'parent'
},
const {
'1': 'service_level_objective_id',
'3': 3,
'4': 1,
'5': 9,
'10': 'serviceLevelObjectiveId'
},
const {
'1': 'service_level_objective',
'3': 2,
'4': 1,
'5': 11,
'6': '.google.monitoring.v3.ServiceLevelObjective',
'8': const {},
'10': 'serviceLevelObjective'
},
],
};
/// Descriptor for `CreateServiceLevelObjectiveRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List createServiceLevelObjectiveRequestDescriptor =
$convert.base64Decode(
'CiJDcmVhdGVTZXJ2aWNlTGV2ZWxPYmplY3RpdmVSZXF1ZXN0EkEKBnBhcmVudBgBIAEoCUIp4EEC+kEjCiFtb25pdG9yaW5nLmdvb2dsZWFwaXMuY29tL1NlcnZpY2VSBnBhcmVudBI7ChpzZXJ2aWNlX2xldmVsX29iamVjdGl2ZV9pZBgDIAEoCVIXc2VydmljZUxldmVsT2JqZWN0aXZlSWQSaAoXc2VydmljZV9sZXZlbF9vYmplY3RpdmUYAiABKAsyKy5nb29nbGUubW9uaXRvcmluZy52My5TZXJ2aWNlTGV2ZWxPYmplY3RpdmVCA+BBAlIVc2VydmljZUxldmVsT2JqZWN0aXZl');
@$core.Deprecated('Use getServiceLevelObjectiveRequestDescriptor instead')
const GetServiceLevelObjectiveRequest$json = const {
'1': 'GetServiceLevelObjectiveRequest',
'2': const [
const {'1': 'name', '3': 1, '4': 1, '5': 9, '8': const {}, '10': 'name'},
const {
'1': 'view',
'3': 2,
'4': 1,
'5': 14,
'6': '.google.monitoring.v3.ServiceLevelObjective.View',
'10': 'view'
},
],
};
/// Descriptor for `GetServiceLevelObjectiveRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List getServiceLevelObjectiveRequestDescriptor =
$convert.base64Decode(
'Ch9HZXRTZXJ2aWNlTGV2ZWxPYmplY3RpdmVSZXF1ZXN0EksKBG5hbWUYASABKAlCN+BBAvpBMQovbW9uaXRvcmluZy5nb29nbGVhcGlzLmNvbS9TZXJ2aWNlTGV2ZWxPYmplY3RpdmVSBG5hbWUSRAoEdmlldxgCIAEoDjIwLmdvb2dsZS5tb25pdG9yaW5nLnYzLlNlcnZpY2VMZXZlbE9iamVjdGl2ZS5WaWV3UgR2aWV3');
@$core.Deprecated('Use listServiceLevelObjectivesRequestDescriptor instead')
const ListServiceLevelObjectivesRequest$json = const {
'1': 'ListServiceLevelObjectivesRequest',
'2': const [
const {
'1': 'parent',
'3': 1,
'4': 1,
'5': 9,
'8': const {},
'10': 'parent'
},
const {'1': 'filter', '3': 2, '4': 1, '5': 9, '10': 'filter'},
const {'1': 'page_size', '3': 3, '4': 1, '5': 5, '10': 'pageSize'},
const {'1': 'page_token', '3': 4, '4': 1, '5': 9, '10': 'pageToken'},
const {
'1': 'view',
'3': 5,
'4': 1,
'5': 14,
'6': '.google.monitoring.v3.ServiceLevelObjective.View',
'10': 'view'
},
],
};
/// Descriptor for `ListServiceLevelObjectivesRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listServiceLevelObjectivesRequestDescriptor =
$convert.base64Decode(
'CiFMaXN0U2VydmljZUxldmVsT2JqZWN0aXZlc1JlcXVlc3QSQQoGcGFyZW50GAEgASgJQingQQL6QSMKIW1vbml0b3JpbmcuZ29vZ2xlYXBpcy5jb20vU2VydmljZVIGcGFyZW50EhYKBmZpbHRlchgCIAEoCVIGZmlsdGVyEhsKCXBhZ2Vfc2l6ZRgDIAEoBVIIcGFnZVNpemUSHQoKcGFnZV90b2tlbhgEIAEoCVIJcGFnZVRva2VuEkQKBHZpZXcYBSABKA4yMC5nb29nbGUubW9uaXRvcmluZy52My5TZXJ2aWNlTGV2ZWxPYmplY3RpdmUuVmlld1IEdmlldw==');
@$core.Deprecated('Use listServiceLevelObjectivesResponseDescriptor instead')
const ListServiceLevelObjectivesResponse$json = const {
'1': 'ListServiceLevelObjectivesResponse',
'2': const [
const {
'1': 'service_level_objectives',
'3': 1,
'4': 3,
'5': 11,
'6': '.google.monitoring.v3.ServiceLevelObjective',
'10': 'serviceLevelObjectives'
},
const {
'1': 'next_page_token',
'3': 2,
'4': 1,
'5': 9,
'10': 'nextPageToken'
},
],
};
/// Descriptor for `ListServiceLevelObjectivesResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listServiceLevelObjectivesResponseDescriptor =
$convert.base64Decode(
'CiJMaXN0U2VydmljZUxldmVsT2JqZWN0aXZlc1Jlc3BvbnNlEmUKGHNlcnZpY2VfbGV2ZWxfb2JqZWN0aXZlcxgBIAMoCzIrLmdvb2dsZS5tb25pdG9yaW5nLnYzLlNlcnZpY2VMZXZlbE9iamVjdGl2ZVIWc2VydmljZUxldmVsT2JqZWN0aXZlcxImCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAlSDW5leHRQYWdlVG9rZW4=');
@$core.Deprecated('Use updateServiceLevelObjectiveRequestDescriptor instead')
const UpdateServiceLevelObjectiveRequest$json = const {
'1': 'UpdateServiceLevelObjectiveRequest',
'2': const [
const {
'1': 'service_level_objective',
'3': 1,
'4': 1,
'5': 11,
'6': '.google.monitoring.v3.ServiceLevelObjective',
'8': const {},
'10': 'serviceLevelObjective'
},
const {
'1': 'update_mask',
'3': 2,
'4': 1,
'5': 11,
'6': '.google.protobuf.FieldMask',
'10': 'updateMask'
},
],
};
/// Descriptor for `UpdateServiceLevelObjectiveRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List updateServiceLevelObjectiveRequestDescriptor =
$convert.base64Decode(
'CiJVcGRhdGVTZXJ2aWNlTGV2ZWxPYmplY3RpdmVSZXF1ZXN0EmgKF3NlcnZpY2VfbGV2ZWxfb2JqZWN0aXZlGAEgASgLMisuZ29vZ2xlLm1vbml0b3JpbmcudjMuU2VydmljZUxldmVsT2JqZWN0aXZlQgPgQQJSFXNlcnZpY2VMZXZlbE9iamVjdGl2ZRI7Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tSCnVwZGF0ZU1hc2s=');
@$core.Deprecated('Use deleteServiceLevelObjectiveRequestDescriptor instead')
const DeleteServiceLevelObjectiveRequest$json = const {
'1': 'DeleteServiceLevelObjectiveRequest',
'2': const [
const {'1': 'name', '3': 1, '4': 1, '5': 9, '8': const {}, '10': 'name'},
],
};
/// Descriptor for `DeleteServiceLevelObjectiveRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List deleteServiceLevelObjectiveRequestDescriptor =
$convert.base64Decode(
'CiJEZWxldGVTZXJ2aWNlTGV2ZWxPYmplY3RpdmVSZXF1ZXN0EksKBG5hbWUYASABKAlCN+BBAvpBMQovbW9uaXRvcmluZy5nb29nbGVhcGlzLmNvbS9TZXJ2aWNlTGV2ZWxPYmplY3RpdmVSBG5hbWU=');
| 38.954545 | 372 | 0.706669 |
164ca5000b2bad26e33517f087d7fc174b8f73ce | 344 | dart | Dart | lib/src/defaults/feature_provider/engine/evaluation_engine.dart | MattHamburger/flutter_clean_framework | 1efa5d18f476206f0137683671a4381b20793413 | [
"MIT"
] | null | null | null | lib/src/defaults/feature_provider/engine/evaluation_engine.dart | MattHamburger/flutter_clean_framework | 1efa5d18f476206f0137683671a4381b20793413 | [
"MIT"
] | null | null | null | lib/src/defaults/feature_provider/engine/evaluation_engine.dart | MattHamburger/flutter_clean_framework | 1efa5d18f476206f0137683671a4381b20793413 | [
"MIT"
] | null | null | null | import 'package:clean_framework/src/open_feature/open_feature.dart';
import 'open_feature_flags.dart';
abstract class EvaluationEngine {
ResolutionDetails<T> evaluate<T extends Object>({
required OpenFeatureFlags flags,
required String flagKey,
required FlagValueType returnType,
required EvaluationContext context,
});
}
| 26.461538 | 68 | 0.781977 |
0f5f1613a80218fb3bff0cc64532a075499c16f2 | 1,794 | sql | SQL | rad/25112020 (Database Firebird)/loja/Scripts/CriaTabelas.sql | mateusschwede/delphi | 9aa9e6cde1370c1ce52a6ab8db59b30fd557fe6d | [
"MIT"
] | 1 | 2021-11-04T22:56:33.000Z | 2021-11-04T22:56:33.000Z | Anexos/Banco de Dados/bancoFirebird.sql | ubsocial/delphi | 25d0946c299b7da67998671c7b70f194f5ea57c6 | [
"MIT"
] | null | null | null | Anexos/Banco de Dados/bancoFirebird.sql | ubsocial/delphi | 25d0946c299b7da67998671c7b70f194f5ea57c6 | [
"MIT"
] | 1 | 2021-12-14T01:14:55.000Z | 2021-12-14T01:14:55.000Z | /* TABELA DE FORNECEDORES */
create table fornecedores
(
cdfornecedor integer not null,
dcfornecedor varchar(30),
endereco varchar(40),
bairro varchar(20),
cidade varchar(20),
telefone varchar(10),
cep varchar(8),
constraint pkfornecedores primary key(cdfornecedor));
/* TABELA DE CLIENTES */
create table clientes
(
cdcliente integer not null,
dccliente varchar(30),
endereco varchar(40),
bairro varchar(20),
cidade varchar(20),
telefone varchar(10),
cep varchar(8),
constraint pkclientes primary key(cdcliente));
/* TABELA DE VENDEDORES */
create table vendedores
(
cdvendedor integer not null,
dcvendedor varchar(30),
constraint pkvendedores primary key(cdvendedor));
/* TABELA DE PRODUTOS */
create table produtos
(
cdproduto integer not null,
dcproduto varchar(30),
vlproduto decimal(16,2),
qtestoque decimal(16,2),
qtminima decimal(16,2),
cdfornecedor integer not null,
constraint pkprodutos primary key(cdproduto),
constraint fkprodutosfornecedores foreign key(cdfornecedor)
references fornecedores(cdfornecedor));
/* TABELA DE VENDAS */
create table vendas
(
nrvenda integer not null,
dtvenda date not null,
cdcliente integer not null,
cdvendedor integer not null,
constraint pkvendas primary key(nrvenda),
constraint fkvendasclientes foreign key(cdcliente)
references clientes(cdcliente),
constraint fkvendasvendedores foreign key(cdvendedor)
references vendedores(cdvendedor));
/* TABELA DE ITENS */
create table itens
(
nrvenda integer not null,
nritem integer not null,
cdproduto integer not null,
qtvenda decimal(16,2) not null,
vlproduto decimal(16,2) not null,
constraint pkitens primary key(nrvenda,nritem),
constraint fkitensvendas foreign key(nrvenda)
references vendas(nrvenda),
constraint fkitensprodutos foreign key(cdproduto)
references produtos(cdproduto));
| 24.575342 | 59 | 0.796544 |
80d30f61409133249a636bb039c8c562542d6dd3 | 2,184 | java | Java | OpenImmo/src/main/java/org/openestate/io/openimmo/OpenImmoDocument.java | OpenEstate/OpenEstate-IO | 180e62a1c23596e5e284ce7fc6d07081918b0a38 | [
"Apache-2.0"
] | 35 | 2015-03-31T13:36:07.000Z | 2020-12-13T07:27:36.000Z | OpenImmo/src/main/java/org/openestate/io/openimmo/OpenImmoDocument.java | OpenEstate/OpenEstate-IO | 180e62a1c23596e5e284ce7fc6d07081918b0a38 | [
"Apache-2.0"
] | 16 | 2015-11-05T07:39:11.000Z | 2021-08-16T00:45:06.000Z | OpenImmo/src/main/java/org/openestate/io/openimmo/OpenImmoDocument.java | OpenEstate/OpenEstate-IO | 180e62a1c23596e5e284ce7fc6d07081918b0a38 | [
"Apache-2.0"
] | 15 | 2015-07-31T11:39:25.000Z | 2022-03-12T07:38:10.000Z | /*
* Copyright 2015-2021 OpenEstate.org.
*
* 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 org.openestate.io.openimmo;
import org.openestate.io.core.XmlConvertableDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
/**
* A general OpenImmo-XML document.
*
* @param <JavaType> the class of a (via JAXB generated) Java object, that the contained
* {@link Document} is mapped to
* @author Andreas Rudolph
* @since 1.0
*/
public abstract class OpenImmoDocument<JavaType> extends XmlConvertableDocument<JavaType, OpenImmoVersion> {
@SuppressWarnings("unused")
private final static Logger LOGGER = LoggerFactory.getLogger(OpenImmoDocument.class);
/**
* Create from a {@link Document}.
*
* @param document the document to create from
*/
protected OpenImmoDocument(Document document) {
super(document);
}
@Override
public abstract OpenImmoVersion getDocumentVersion();
@Override
public OpenImmoVersion getLatestVersion() {
return OpenImmoUtils.VERSION;
}
/**
* Checks, if the current document is a {@link OpenImmoFeedbackDocument}.
*
* @return true, if the current document is a {@link OpenImmoFeedbackDocument}
*/
public boolean isFeedback() {
return this instanceof OpenImmoFeedbackDocument;
}
/**
* Checks, if the current document is a {@link OpenImmoTransferDocument}.
*
* @return true, if the current document is a {@link OpenImmoTransferDocument}
*/
public boolean isTransfer() {
return this instanceof OpenImmoTransferDocument;
}
} | 31.652174 | 108 | 0.702381 |
406c34054a0cb54dca1c8e856fbfee333b34d011 | 1,654 | kt | Kotlin | libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/KotlinDependencyScope.kt | jdemeulenaere/kotlin | bbdbc2896bc780b96ce43d9707d3735635e7dbad | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2018-06-22T18:21:59.000Z | 2020-11-22T14:48:57.000Z | libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/KotlinDependencyScope.kt | jdemeulenaere/kotlin | bbdbc2896bc780b96ce43d9707d3735635e7dbad | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/KotlinDependencyScope.kt | jdemeulenaere/kotlin | bbdbc2896bc780b96ce43d9707d3735635e7dbad | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2015-03-18T06:12:57.000Z | 2015-03-18T06:12:57.000Z | /*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.plugin.sources
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.sources.KotlinDependencyScope.*
internal enum class KotlinDependencyScope(val scopeName: String) {
API_SCOPE("api"),
IMPLEMENTATION_SCOPE("implementation"),
COMPILE_ONLY_SCOPE("compileOnly"),
RUNTIME_ONLY_SCOPE("runtimeOnly")
}
internal fun Project.sourceSetDependencyConfigurationByScope(sourceSet: KotlinSourceSet, scope: KotlinDependencyScope): Configuration =
project.configurations.getByName(
when (scope) {
API_SCOPE -> sourceSet.apiConfigurationName
IMPLEMENTATION_SCOPE -> sourceSet.implementationConfigurationName
COMPILE_ONLY_SCOPE -> sourceSet.compileOnlyConfigurationName
RUNTIME_ONLY_SCOPE -> sourceSet.runtimeOnlyConfigurationName
}
)
internal fun Project.sourceSetMetadataConfigurationByScope(sourceSet: KotlinSourceSet, scope: KotlinDependencyScope): Configuration =
project.configurations.getByName(
when (scope) {
API_SCOPE -> sourceSet.apiMetadataConfigurationName
IMPLEMENTATION_SCOPE -> sourceSet.implementationMetadataConfigurationName
COMPILE_ONLY_SCOPE -> sourceSet.compileOnlyMetadataConfigurationName
RUNTIME_ONLY_SCOPE -> sourceSet.runtimeOnlyMetadataConfigurationName
}
) | 43.526316 | 135 | 0.765417 |
5b6d9dfe11d430cd24e31a35779985bd8298f183 | 1,432 | cpp | C++ | cpp/libs/opendnp3/src/opendnp3/objects/Group51.cpp | SensusDA/opendnp3 | c9aab97279fa7461155fd583d3955853b3ad99a0 | [
"Apache-2.0"
] | null | null | null | cpp/libs/opendnp3/src/opendnp3/objects/Group51.cpp | SensusDA/opendnp3 | c9aab97279fa7461155fd583d3955853b3ad99a0 | [
"Apache-2.0"
] | null | null | null | cpp/libs/opendnp3/src/opendnp3/objects/Group51.cpp | SensusDA/opendnp3 | c9aab97279fa7461155fd583d3955853b3ad99a0 | [
"Apache-2.0"
] | null | null | null | //
// _ _ ______ _ _ _ _ _ _ _
// | \ | | | ____| | (_) | (_) | | | |
// | \| | ___ | |__ __| |_| |_ _ _ __ __ _| | | |
// | . ` |/ _ \ | __| / _` | | __| | '_ \ / _` | | | |
// | |\ | (_) | | |___| (_| | | |_| | | | | (_| |_|_|_|
// |_| \_|\___/ |______\__,_|_|\__|_|_| |_|\__, (_|_|_)
// __/ |
// |___/
//
// This file is auto-generated. Do not edit manually
//
// Copyright 2013 Automatak LLC
//
// Automatak LLC (www.automatak.com) licenses this file
// to you under the the Apache License Version 2.0 (the "License"):
//
// http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "Group51.h"
#include <openpal/serialization/Serialization.h>
using namespace openpal;
namespace opendnp3 {
Group51Var1 Group51Var1::Read(ReadBufferView& buffer)
{
Group51Var1 obj;
obj.time = UInt48::Read(buffer);
buffer.Advance(6);
return obj;
}
void Group51Var1::Write(const Group51Var1& arg, openpal::WriteBufferView& buffer)
{
UInt48::Write(buffer, arg.time);
buffer.Advance(6);
}
Group51Var2 Group51Var2::Read(ReadBufferView& buffer)
{
Group51Var2 obj;
obj.time = UInt48::Read(buffer);
buffer.Advance(6);
return obj;
}
void Group51Var2::Write(const Group51Var2& arg, openpal::WriteBufferView& buffer)
{
UInt48::Write(buffer, arg.time);
buffer.Advance(6);
}
}
| 23.47541 | 81 | 0.554469 |
b98b647222e24a36971be125182a88d3fe4e72da | 273 | lua | Lua | scripts/Remove All Fx.lua | selimachour/reaper | 34a03035739353dcf20c8c4eaf0aac840967468c | [
"MIT"
] | null | null | null | scripts/Remove All Fx.lua | selimachour/reaper | 34a03035739353dcf20c8c4eaf0aac840967468c | [
"MIT"
] | null | null | null | scripts/Remove All Fx.lua | selimachour/reaper | 34a03035739353dcf20c8c4eaf0aac840967468c | [
"MIT"
] | null | null | null |
-- removes a line of fx on every track but the master
nbTracks = reaper.CountTracks(0)
for trackidx = 0, nbTracks-1 do
tr = reaper.GetTrack(0, trackidx)
fxCount = reaper.TrackFX_GetCount(tr)
reaper.SNM_MoveOrRemoveTrackFX(tr, 0, 0)
end
| 19.5 | 54 | 0.663004 |
4ec94cfbc146964023b5903a0adbe2b9ed3430e1 | 3,394 | dart | Dart | lib/widgets/cyber_knob/cyber_knob.dart | FlutterHack20/FlutterBand | d6ac6fdd27a1959632d822be7685f106143148c0 | [
"BSD-2-Clause"
] | 9 | 2020-06-30T18:30:18.000Z | 2021-12-11T19:26:51.000Z | lib/widgets/cyber_knob/cyber_knob.dart | FlutterHack20/FlutterBand | d6ac6fdd27a1959632d822be7685f106143148c0 | [
"BSD-2-Clause"
] | null | null | null | lib/widgets/cyber_knob/cyber_knob.dart | FlutterHack20/FlutterBand | d6ac6fdd27a1959632d822be7685f106143148c0 | [
"BSD-2-Clause"
] | 1 | 2020-06-29T16:25:56.000Z | 2020-06-29T16:25:56.000Z | import 'dart:math';
import 'package:flare_flutter/flare_actor.dart';
import 'package:flutter/material.dart';
import './cyber_knob_controller.dart';
class CyberKnob extends StatefulWidget {
// Define the parameters of this widget
final double value;
final double min;
final double max;
// Two extra parameters to make the widget more easy to customise
final double size;
// ValueChanged is a type built into Dart for a function that changes a value
final ValueChanged<double> onChanged;
CyberKnob({
Key key,
this.value = 0.0,
this.min = 1.0,
this.max = 40.0,
this.size = 200.0,
this.onChanged,
}) : super(key: key);
@override
_CyberKnobState createState() => _CyberKnobState();
}
class _CyberKnobState extends State<CyberKnob> {
double radius = 100;
double _movement = 0.0;
CyberKnobController _cyberKnobController = CyberKnobController();
void _panUpdate(DragUpdateDetails d) {
/// Pan location on the wheel
bool onTop = d.localPosition.dy <= radius;
bool onLeftSide = d.localPosition.dx <= radius;
bool onRightSide = !onLeftSide;
bool onBottom = !onTop;
/// Pan movements
bool panUp = d.delta.dy <= 0.0;
bool panLeft = d.delta.dx <= 0.0;
bool panRight = !panLeft;
bool panDown = !panUp;
/// Absoulte change on axis
double yChange = d.delta.dy.abs();
double xChange = d.delta.dx.abs();
/// Directional change on wheel
double verticalRotation = (onRightSide && panDown) || (onLeftSide && panUp)
? yChange
: yChange * -1;
double horizontalRotation =
(onTop && panRight) || (onBottom && panLeft) ? xChange : xChange * -1;
// Total computed change
double rotationalChange =
(verticalRotation + horizontalRotation) * d.delta.distance;
// bool movingClockwise = rotationalChange > 0;
// bool movingCounterClockwise = rotationalChange < 0;
setState(() {
_movement = rotationalChange;
_cyberKnobController.setTick = _movement;
});
}
double reverseNumber(double num, int min, int max) {
return (max + min) - num.toDouble();
}
@override
Widget build(BuildContext context) {
return ClipOval(
child: Container(
height: 200,
width: 200,
child: GestureDetector(
onPanDown: (DragDownDetails details) {
print('We have contact on drag $details');
},
onPanStart: (DragStartDetails details) {
print('Starting drag $details');
},
onPanUpdate: (DragUpdateDetails details) {
_panUpdate(details);
},
onPanEnd: (DragEndDetails details) {
print('Ended drag ${_cyberKnobController.tick}');
widget.onChanged(reverseNumber(_cyberKnobController.tick * 25,1,25));
},
onTap: () {
_cyberKnobController.setTick = 0.1;
},
child: Transform(
transform: Matrix4.rotationY(pi),
alignment: Alignment.center,
child: FlareActor(
"assets/flares/knob.flr",
callback: (value) {
print('animation ended $value');
},
alignment: Alignment.bottomCenter,
fit: BoxFit.contain,
controller: _cyberKnobController,
),
),
),
),
);
}
}
| 27.819672 | 81 | 0.610194 |
54fb0b5149707b10aa38e00afd8b5eade466428d | 53 | sql | SQL | sql/getMigrations.sql | swlkr/exodusjs | 9bcc9128c4a10cf43c53f88d2f01230c86a5b115 | [
"MIT"
] | 1 | 2016-05-14T02:50:56.000Z | 2016-05-14T02:50:56.000Z | sql/getMigrations.sql | swlkr/exodusjs | 9bcc9128c4a10cf43c53f88d2f01230c86a5b115 | [
"MIT"
] | null | null | null | sql/getMigrations.sql | swlkr/exodusjs | 9bcc9128c4a10cf43c53f88d2f01230c86a5b115 | [
"MIT"
] | null | null | null | select *
from exodus_migrations
order by ran_at desc
| 13.25 | 22 | 0.830189 |
768a2286b78486b3c16c51f33f9c58757a5916fc | 2,422 | swift | Swift | src/ios/AppDelegate+AliPush.swift | cyqkevin/cordova-plugin-aliyun-push | 85fc5c4cc316f8e6be4487e9067ac0c02d21bf3b | [
"Apache-2.0"
] | 14 | 2019-11-22T01:22:15.000Z | 2021-12-04T08:31:34.000Z | src/ios/AppDelegate+AliPush.swift | cyqkevin/cordova-plugin-aliyun-push | 85fc5c4cc316f8e6be4487e9067ac0c02d21bf3b | [
"Apache-2.0"
] | 10 | 2019-11-22T01:22:08.000Z | 2021-11-16T07:11:27.000Z | src/ios/AppDelegate+AliPush.swift | cyqkevin/cordova-plugin-aliyun-push | 85fc5c4cc316f8e6be4487e9067ac0c02d21bf3b | [
"Apache-2.0"
] | 3 | 2020-09-05T00:42:53.000Z | 2020-12-11T08:22:14.000Z | import CloudPushSDK
import UserNotifications
extension AppDelegate {
override open func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
self.viewController = MainViewController()
CloudPushSDK.sendNotificationAck(launchOptions);
if(launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] != nil){
let userInfo = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as! [AnyHashable : Any];
let aps = userInfo["aps"] as! [AnyHashable : Any];
let alert = aps["alert"] as! [AnyHashable: Any];
let title = alert["title"] as! String;
let body = alert["body"] as! String;
AliPushPlugin.fireNotificationEvent(object: ["eventType":"openNotification", "title": title, "content": body, "extras": userInfo]);
}
return super.application(application,didFinishLaunchingWithOptions:launchOptions);
}
open override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
CloudPushSDK.registerDevice(deviceToken) {res in
if (res!.success) {
print("Upload deviceToken to Push Server, deviceToken: \(CloudPushSDK.getApnsDeviceToken()!), deviceId: \(CloudPushSDK.getDeviceId()!)")
} else {
print("Upload deviceToken to Push Server failed, error: \(String(describing: res?.error))")
}
}
}
override open func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("register for remote notifications error", error);
}
override open func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
print("Receive one notification.")
let aps = userInfo["aps"] as! [AnyHashable : Any];
let alert = aps["alert"] as! [AnyHashable: Any];
let title = alert["title"] as! String;
let body = alert["body"] as! String;
AliPushPlugin.fireNotificationEvent(object: ["eventType":"receiveNotification", "title": title, "content": body, "extras": userInfo]);
CloudPushSDK.sendNotificationAck(userInfo)
print("Notification, title: \(title), body: \(body).");
}
}
| 53.822222 | 165 | 0.677126 |
40b053770ed4e667b202104716f8f39f4dbde377 | 1,115 | py | Python | gnuradio-3.7.13.4/gnuradio-runtime/python/gnuradio/gru/os_read_exactly.py | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | 1 | 2021-03-09T07:32:37.000Z | 2021-03-09T07:32:37.000Z | gnuradio-3.7.13.4/gnuradio-runtime/python/gnuradio/gru/os_read_exactly.py | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | null | null | null | gnuradio-3.7.13.4/gnuradio-runtime/python/gnuradio/gru/os_read_exactly.py | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | null | null | null | #
# Copyright 2005 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
import os
def os_read_exactly(file_descriptor, nbytes):
"""
Replacement for os.read that blocks until it reads exactly nbytes.
"""
s = ''
while nbytes > 0:
sbuf = os.read(file_descriptor, nbytes)
if not(sbuf):
return ''
nbytes -= len(sbuf)
s = s + sbuf
return s
| 30.135135 | 70 | 0.697758 |
1dac4d0a466b29eecb9ba8d698a206e316ed76e6 | 501 | kt | Kotlin | src/main/kotlin/br/com/zupacademy/gabrielamartins/validation/ChavePixValida.kt | gabrielamartinszup/orange-talents-07-template-pix-keymanager-rest | 45bdc6dca26bbf4829f05d1c0ef6f8cfa87adc3e | [
"Apache-2.0"
] | null | null | null | src/main/kotlin/br/com/zupacademy/gabrielamartins/validation/ChavePixValida.kt | gabrielamartinszup/orange-talents-07-template-pix-keymanager-rest | 45bdc6dca26bbf4829f05d1c0ef6f8cfa87adc3e | [
"Apache-2.0"
] | null | null | null | src/main/kotlin/br/com/zupacademy/gabrielamartins/validation/ChavePixValida.kt | gabrielamartinszup/orange-talents-07-template-pix-keymanager-rest | 45bdc6dca26bbf4829f05d1c0ef6f8cfa87adc3e | [
"Apache-2.0"
] | null | null | null | package br.com.zupacademy.gabrielamartins.validation
import javax.validation.Constraint
import javax.validation.Payload
import kotlin.reflect.KClass
@MustBeDocumented
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE)
@Retention(AnnotationRetention.RUNTIME)
@Constraint(validatedBy = [ChavePixValidaValidator::class])
annotation class ChavePixValida(
val message: String = "Chave Pix com formato inválido", val groups: Array<KClass<Any>> = [],
val payload: Array<KClass<Payload>> = []
)
| 33.4 | 96 | 0.798403 |
f9b0855d8ac1d3d5d174f8cb68634017ff4f5844 | 5,482 | sql | SQL | ressources/lychee.sql | bezineb5/lycheesync | 043bc70d6f56ac791075bdc033b70d66f26ec60f | [
"DOC",
"MIT"
] | 110 | 2015-01-01T13:02:16.000Z | 2021-06-24T04:47:41.000Z | ressources/lychee.sql | bezineb5/lycheesync | 043bc70d6f56ac791075bdc033b70d66f26ec60f | [
"DOC",
"MIT"
] | 83 | 2015-01-01T13:01:02.000Z | 2022-03-11T23:15:26.000Z | ressources/lychee.sql | bezineb5/lycheesync | 043bc70d6f56ac791075bdc033b70d66f26ec60f | [
"DOC",
"MIT"
] | 45 | 2015-06-20T11:36:45.000Z | 2021-02-02T14:24:30.000Z | -- MySQL dump 10.13 Distrib 5.5.46, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: lychee_ci
-- ------------------------------------------------------
-- Server version 5.5.46-0ubuntu0.14.04.2
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Current Database: `lychee_ci`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `lychee_ci` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `lychee_ci`;
--
-- Table structure for table `lychee_albums`
--
DROP TABLE IF EXISTS `lychee_albums`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lychee_albums` (
`id` bigint(14) NOT NULL,
`title` varchar(100) NOT NULL DEFAULT '',
`description` varchar(1000) DEFAULT '',
`sysstamp` int(11) NOT NULL,
`public` tinyint(1) NOT NULL DEFAULT '0',
`visible` tinyint(1) NOT NULL DEFAULT '1',
`downloadable` tinyint(1) NOT NULL DEFAULT '0',
`password` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lychee_albums`
--
LOCK TABLES `lychee_albums` WRITE;
/*!40000 ALTER TABLE `lychee_albums` DISABLE KEYS */;
/*!40000 ALTER TABLE `lychee_albums` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lychee_log`
--
DROP TABLE IF EXISTS `lychee_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lychee_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` int(11) NOT NULL,
`type` varchar(11) NOT NULL,
`function` varchar(100) NOT NULL,
`line` int(11) NOT NULL,
`text` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lychee_log`
--
LOCK TABLES `lychee_log` WRITE;
/*!40000 ALTER TABLE `lychee_log` DISABLE KEYS */;
/*!40000 ALTER TABLE `lychee_log` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lychee_photos`
--
DROP TABLE IF EXISTS `lychee_photos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lychee_photos` (
`id` bigint(14) NOT NULL,
`title` varchar(100) NOT NULL DEFAULT '',
`description` varchar(1000) DEFAULT '',
`url` varchar(100) NOT NULL,
`tags` varchar(1000) NOT NULL DEFAULT '',
`public` tinyint(1) NOT NULL,
`type` varchar(10) NOT NULL,
`width` int(11) NOT NULL,
`height` int(11) NOT NULL,
`size` varchar(20) NOT NULL,
`iso` varchar(15) NOT NULL,
`aperture` varchar(20) NOT NULL,
`make` varchar(50) NOT NULL,
`model` varchar(50) NOT NULL,
`shutter` varchar(30) NOT NULL,
`focal` varchar(20) NOT NULL,
`takestamp` int(11) DEFAULT NULL,
`star` tinyint(1) NOT NULL,
`thumbUrl` varchar(50) NOT NULL,
`album` varchar(30) NOT NULL DEFAULT '0',
`checksum` varchar(100) DEFAULT NULL,
`medium` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lychee_photos`
--
LOCK TABLES `lychee_photos` WRITE;
/*!40000 ALTER TABLE `lychee_photos` DISABLE KEYS */;
/*!40000 ALTER TABLE `lychee_photos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lychee_settings`
--
DROP TABLE IF EXISTS `lychee_settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lychee_settings` (
`key` varchar(50) NOT NULL DEFAULT '',
`value` varchar(200) DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lychee_settings`
--
-- login: lychee_ci / password: lychee_ci
--
LOCK TABLES `lychee_settings` WRITE;
/*!40000 ALTER TABLE `lychee_settings` DISABLE KEYS */;
INSERT INTO `lychee_settings` VALUES ('version','030003'),('username','$2a$10$pmGfzUucdS2lMbXLAc5H5e.RkUHHGZFQIYSACrPpPnFXp.3kddlje'),('password','$2a$10$xY/P39dlcR3K5Eg7DL3kduL.BjKKDafceWwDPQa19zlrO2/buL1ua'),('thumbQuality','90'),('checkForUpdates','1'),('sortingPhotos','ORDER BY id DESC'),('sortingAlbums','ORDER BY id DESC'),('medium','1'),('imagick','1'),('dropboxKey',''),('identifier','e9a65d4887d9786ffb77d4b7108dd95a'),('skipDuplicates','0'),('plugins','');
/*!40000 ALTER TABLE `lychee_settings` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-01-09 18:31:19
| 34.477987 | 467 | 0.703211 |
ad1bc172d2ed4919e5227816633830c23895a215 | 399 | kt | Kotlin | arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/EndoTest.kt | kategory/Katz | 051847de3b1d3186fc9843864aaf642a2f4a854f | [
"Apache-2.0"
] | 4,525 | 2017-12-30T19:37:54.000Z | 2022-03-31T23:22:24.000Z | arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/EndoTest.kt | kategory/Katz | 051847de3b1d3186fc9843864aaf642a2f4a854f | [
"Apache-2.0"
] | 1,579 | 2017-12-31T16:14:21.000Z | 2022-03-22T17:46:12.000Z | arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/EndoTest.kt | kategory/Katz | 051847de3b1d3186fc9843864aaf642a2f4a854f | [
"Apache-2.0"
] | 414 | 2017-12-31T20:19:41.000Z | 2022-03-28T21:39:02.000Z | package arrow.core
import arrow.core.test.UnitSpec
import arrow.core.test.generators.endo
import arrow.core.test.laws.MonoidLaws
import arrow.typeclasses.Monoid
import io.kotest.property.Arb
import io.kotest.property.arbitrary.int
class EndoTest : UnitSpec() {
init {
testLaws(
MonoidLaws.laws(Monoid.endo(), Arb.endo(Arb.int())) { a, b ->
a.f(1) == b.f(1)
}
)
}
}
| 21 | 67 | 0.686717 |
1678de560cca32d9aebe3ce552f361a83a4e0f35 | 690 | h | C | src/mainp/elem19.h | jerebenitez/IFE-simpact-openfoam | 2dbcbf3195b22fca1c80ad0da6b3822b6cad5cdf | [
"MIT"
] | null | null | null | src/mainp/elem19.h | jerebenitez/IFE-simpact-openfoam | 2dbcbf3195b22fca1c80ad0da6b3822b6cad5cdf | [
"MIT"
] | null | null | null | src/mainp/elem19.h | jerebenitez/IFE-simpact-openfoam | 2dbcbf3195b22fca1c80ad0da6b3822b6cad5cdf | [
"MIT"
] | null | null | null | SUBROUTINE elem19(TASK, elsnam, dtime, ttime, istop, lnod, flag1, flag2)
!master routine for element 19 (TLF) 2-D solid triangular element with thermal coupling
!USE ctrl_db, ONLY: ndofn, npoin, ntype
!USE outp_db, ONLY: sumat, iwrit
USE ele19_db
!USE npo_db
!USE sms_db, ONLY : selective_mass_scaling, sms_ns , sms_name, sms_thl, sms_alp
IMPLICIT NONE
!--- Dummy variables
CHARACTER(len=*),INTENT(IN):: TASK
! optional parameters
LOGICAL, OPTIONAL :: flag1,flag2
CHARACTER (len=*), OPTIONAL :: elsnam
INTEGER (kind=4), OPTIONAL :: istop
INTEGER (kind=4), POINTER, OPTIONAL :: lnod(:,:)
REAL (kind=8), OPTIONAL :: dtime,ttime
END SUBROUTINE elem19
| 31.363636 | 89 | 0.7 |
6860498b9c087e3e6e117723bc48283e6eba0e7f | 1,636 | swift | Swift | DereGuide/Toolbox/CharaInfo/View/CharaProfileTitleView.swift | tsekityam/DereGuide | 8d5cef3b1c4b297034edfcdf48cb25494ed16575 | [
"MIT"
] | 42 | 2017-08-30T12:19:25.000Z | 2022-02-23T03:37:52.000Z | DereGuide/Toolbox/CharaInfo/View/CharaProfileTitleView.swift | tsekityam/DereGuide | 8d5cef3b1c4b297034edfcdf48cb25494ed16575 | [
"MIT"
] | 17 | 2017-11-18T11:59:48.000Z | 2020-04-27T05:41:25.000Z | DereGuide/Toolbox/CharaInfo/View/CharaProfileTitleView.swift | tsekityam/DereGuide | 8d5cef3b1c4b297034edfcdf48cb25494ed16575 | [
"MIT"
] | 6 | 2018-01-06T09:39:23.000Z | 2020-10-11T23:43:02.000Z | //
// CharaProfileTitleView.swift
// DereGuide
//
// Created by zzk on 08/10/2017.
// Copyright © 2017 zzk. All rights reserved.
//
import UIKit
import ZKCornerRadiusView
class CharaProfileTitleView: UIView {
var label: CharaProfileTitleLabel!
var backgoundImageView: ZKCornerRadiusView!
var text: String? {
get {
return self.label.text
}
set {
self.label.text = newValue
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgoundImageView = ZKCornerRadiusView()
addSubview(backgoundImageView)
backgoundImageView.zk.cornerRadius = 6
backgoundImageView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
label = CharaProfileTitleLabel.init(frame: CGRect(x: 5, y: 0, width: frame.size.width - 10, height: frame.size.height))
label.font = UIFont.boldSystemFont(ofSize: 16)
addSubview(label)
label.adjustsFontSizeToFitWidth = true
label.baselineAdjustment = .alignCenters
label.textColor = UIColor.white
label.textAlignment = .center
label.snp.makeConstraints { (make) in
make.left.greaterThanOrEqualTo(5)
make.right.lessThanOrEqualTo(-5)
make.center.equalToSuperview()
}
}
override func layoutSubviews() {
super.layoutSubviews()
backgoundImageView.image = nil
backgoundImageView.render()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| 28.206897 | 127 | 0.628362 |
8a5600e92bf5d4cce6e99e66f5f0e79c0b022844 | 4,511 | rs | Rust | crates/wasmparser/src/readers/instance_section.rs | ethindp/wasm-tools | 5b1dd7faf9b920240738d0ea5d14677a2ff738b7 | [
"Apache-2.0"
] | null | null | null | crates/wasmparser/src/readers/instance_section.rs | ethindp/wasm-tools | 5b1dd7faf9b920240738d0ea5d14677a2ff738b7 | [
"Apache-2.0"
] | null | null | null | crates/wasmparser/src/readers/instance_section.rs | ethindp/wasm-tools | 5b1dd7faf9b920240738d0ea5d14677a2ff738b7 | [
"Apache-2.0"
] | null | null | null | use crate::{
BinaryReader, BinaryReaderError, ExternalKind, Range, Result, SectionIteratorLimited,
SectionReader, SectionWithLimitedItems,
};
use std::prelude::v1::*;
#[derive(Clone)]
pub struct InstanceSectionReader<'a> {
reader: BinaryReader<'a>,
count: u32,
}
impl<'a> InstanceSectionReader<'a> {
pub fn new(data: &'a [u8], offset: usize) -> Result<InstanceSectionReader<'a>> {
let mut reader = BinaryReader::new_with_offset(data, offset);
let count = reader.read_var_u32()?;
Ok(InstanceSectionReader { reader, count })
}
pub fn original_position(&self) -> usize {
self.reader.original_position()
}
pub fn get_count(&self) -> u32 {
self.count
}
pub fn read(&mut self) -> Result<Instance<'a>> {
let instance = Instance::new(
&self.reader.buffer[self.reader.position..],
self.original_position(),
)?;
// FIXME(#188): should probably figure out a different API for
// wasmparser such that we don't have to read instances to skip them
// here.
let mut args = instance.args()?;
for _ in 0..args.get_count() {
args.read()?;
}
self.reader = args.reader;
Ok(instance)
}
}
impl<'a> SectionReader for InstanceSectionReader<'a> {
type Item = Instance<'a>;
fn read(&mut self) -> Result<Self::Item> {
InstanceSectionReader::read(self)
}
fn eof(&self) -> bool {
self.reader.eof()
}
fn original_position(&self) -> usize {
InstanceSectionReader::original_position(self)
}
fn range(&self) -> Range {
self.reader.range()
}
}
impl<'a> SectionWithLimitedItems for InstanceSectionReader<'a> {
fn get_count(&self) -> u32 {
InstanceSectionReader::get_count(self)
}
}
impl<'a> IntoIterator for InstanceSectionReader<'a> {
type Item = Result<Instance<'a>>;
type IntoIter = SectionIteratorLimited<InstanceSectionReader<'a>>;
fn into_iter(self) -> Self::IntoIter {
SectionIteratorLimited::new(self)
}
}
#[derive(Clone)]
pub struct Instance<'a> {
reader: BinaryReader<'a>,
module: u32,
}
impl<'a> Instance<'a> {
pub fn new(data: &'a [u8], offset: usize) -> Result<Instance<'a>> {
let mut reader = BinaryReader::new_with_offset(data, offset);
if reader.read_u8()? != 0 {
return Err(BinaryReaderError::new(
"instantiate instruction not found",
offset,
));
}
let module = reader.read_var_u32()?;
Ok(Instance { module, reader })
}
pub fn original_position(&self) -> usize {
self.reader.original_position()
}
pub fn module(&self) -> u32 {
self.module
}
pub fn args(&self) -> Result<InstanceArgsReader<'a>> {
let mut reader = self.reader.clone();
let count = reader.read_var_u32()?;
Ok(InstanceArgsReader {
count,
remaining: count,
reader,
})
}
}
#[derive(Clone)]
pub struct InstanceArgsReader<'a> {
reader: BinaryReader<'a>,
count: u32,
remaining: u32,
}
#[derive(Clone, Copy, Debug)]
pub struct InstanceArg<'a> {
pub name: &'a str,
pub kind: ExternalKind,
pub index: u32,
}
impl<'a> InstanceArgsReader<'a> {
pub fn original_position(&self) -> usize {
self.reader.original_position()
}
pub fn read(&mut self) -> Result<InstanceArg<'a>> {
self.remaining -= 1;
Ok(InstanceArg {
name: self.reader.read_string()?,
kind: self.reader.read_external_kind()?,
index: self.reader.read_var_u32()?,
})
}
}
impl<'a> SectionReader for InstanceArgsReader<'a> {
type Item = InstanceArg<'a>;
fn read(&mut self) -> Result<Self::Item> {
InstanceArgsReader::read(self)
}
fn eof(&self) -> bool {
self.remaining == 0
}
fn original_position(&self) -> usize {
InstanceArgsReader::original_position(self)
}
fn range(&self) -> Range {
self.reader.range()
}
}
impl<'a> SectionWithLimitedItems for InstanceArgsReader<'a> {
fn get_count(&self) -> u32 {
self.count
}
}
impl<'a> IntoIterator for InstanceArgsReader<'a> {
type Item = Result<InstanceArg<'a>>;
type IntoIter = SectionIteratorLimited<InstanceArgsReader<'a>>;
fn into_iter(self) -> Self::IntoIter {
SectionIteratorLimited::new(self)
}
}
| 25.630682 | 89 | 0.595433 |
83cc98f5bacd8b5be0d46eb61652820355ac8456 | 1,313 | java | Java | spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/support/RateLimitExceededEvent.java | sartrebrasil/spring-cloud-zuul-ratelimit | c12fefc164c948ccb4a89d88c94d0f71bbeeeb23 | [
"Apache-2.0"
] | null | null | null | spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/support/RateLimitExceededEvent.java | sartrebrasil/spring-cloud-zuul-ratelimit | c12fefc164c948ccb4a89d88c94d0f71bbeeeb23 | [
"Apache-2.0"
] | null | null | null | spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/support/RateLimitExceededEvent.java | sartrebrasil/spring-cloud-zuul-ratelimit | c12fefc164c948ccb4a89d88c94d0f71bbeeeb23 | [
"Apache-2.0"
] | null | null | null | package com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support;
import com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.config.properties.RateLimitProperties.Policy;
import com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.filters.RateLimitPreFilter;
import java.util.Objects;
import org.springframework.context.ApplicationEvent;
/**
* Event raised when a rate limit exceeded.
*
* @author vasilaio
*/
public final class RateLimitExceededEvent extends ApplicationEvent {
private static final long serialVersionUID = 5241485625003998587L;
private final Policy policy;
private final String remoteAddress;
public RateLimitExceededEvent(RateLimitPreFilter source, Policy policy, String remoteAddress) {
super(source);
this.policy = Objects.requireNonNull(policy, "Policy should not be null.");
this.remoteAddress = Objects.requireNonNull(remoteAddress, "RemoteAddress should not be null.");
}
/**
* Return the {@link Policy} which raised the event.
*
* @return the {@link Policy}
*/
public Policy getPolicy() {
return this.policy;
}
/**
* Return the remote IP address.
*
* @return the remote IP address
*/
public String getRemoteAddress() {
return this.remoteAddress;
}
} | 31.261905 | 105 | 0.720487 |
75fc6666641f903dafe050db156fdf9d19ad1b75 | 3,798 | java | Java | library/src/main/java/moe/feng/support/biometricprompt/BiometricPromptApi28Impl.java | nikz-dev/BiometricPromptCompat | 9d0da44c2dbdda9bc388fbc3d91b9a9ad8dd6e2d | [
"Apache-2.0"
] | 275 | 2018-06-07T01:31:46.000Z | 2021-11-08T11:58:18.000Z | library/src/main/java/moe/feng/support/biometricprompt/BiometricPromptApi28Impl.java | nikz-dev/BiometricPromptCompat | 9d0da44c2dbdda9bc388fbc3d91b9a9ad8dd6e2d | [
"Apache-2.0"
] | 11 | 2018-06-07T10:10:50.000Z | 2018-11-09T21:07:57.000Z | library/src/main/java/moe/feng/support/biometricprompt/BiometricPromptApi28Impl.java | nikz-dev/BiometricPromptCompat | 9d0da44c2dbdda9bc388fbc3d91b9a9ad8dd6e2d | [
"Apache-2.0"
] | 24 | 2018-06-08T10:17:36.000Z | 2019-11-30T06:51:11.000Z | package moe.feng.support.biometricprompt;
import android.content.Context;
import android.hardware.biometrics.BiometricPrompt;
import android.os.Build;
import android.os.CancellationSignal;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
import java.security.Signature;
import javax.crypto.Cipher;
import javax.crypto.Mac;
@RequiresApi(api = Build.VERSION_CODES.P)
@RestrictTo({RestrictTo.Scope.LIBRARY})
class BiometricPromptApi28Impl implements IBiometricPromptImpl {
private final Context context;
private final BiometricPrompt biometricPrompt;
BiometricPromptApi28Impl(@NonNull Context context, @NonNull BiometricPrompt prompt) {
this.context = context;
this.biometricPrompt = prompt;
}
@NonNull
@Override
public Context getContext() {
return context;
}
@Override
public void authenticate(
@Nullable BiometricPromptCompat.ICryptoObject crypto,
@Nullable CancellationSignal cancel,
@NonNull BiometricPromptCompat.IAuthenticationCallback callback
) {
final BiometricPrompt.AuthenticationCallback authCallback = new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationError(int errorCode, CharSequence errString) {
callback.onAuthenticationError(errorCode, errString);
}
@Override
public void onAuthenticationHelp(int helpCode, CharSequence helpString) {
callback.onAuthenticationHelp(helpCode, helpString);
}
@Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
callback.onAuthenticationSucceeded(
() -> new CryptoObjectApi28Impl(result.getCryptoObject()));
}
@Override
public void onAuthenticationFailed() {
callback.onAuthenticationFailed();
}
};
if (cancel == null) {
cancel = new CancellationSignal();
}
if (crypto != null) {
biometricPrompt.authenticate(
toCryptoObjectApi28(crypto), cancel, context.getMainExecutor(), authCallback);
} else {
biometricPrompt.authenticate(cancel, context.getMainExecutor(), authCallback);
}
}
private static BiometricPrompt.CryptoObject toCryptoObjectApi28(
@Nullable BiometricPromptCompat.ICryptoObject ico
) {
if (ico == null) {
return null;
} else if (ico.getCipher() != null) {
return new BiometricPrompt.CryptoObject(ico.getCipher());
} else if (ico.getMac() != null) {
return new BiometricPrompt.CryptoObject(ico.getMac());
} else if (ico.getSignature() != null) {
return new BiometricPrompt.CryptoObject(ico.getSignature());
} else {
throw new IllegalArgumentException("ICryptoObject doesn\'t include any data.");
}
}
private static class CryptoObjectApi28Impl implements BiometricPromptCompat.ICryptoObject {
private final BiometricPrompt.CryptoObject cryptoObject;
CryptoObjectApi28Impl(BiometricPrompt.CryptoObject cryptoObject) {
this.cryptoObject = cryptoObject;
}
@Override
public Signature getSignature() {
return cryptoObject.getSignature();
}
@Override
public Cipher getCipher() {
return cryptoObject.getCipher();
}
@Override
public Mac getMac() {
return cryptoObject.getMac();
}
}
}
| 32.461538 | 114 | 0.654028 |
4a646db3caf8b3802371d0d9060af77d330e7d77 | 268 | cs | C# | Data/SellMe.Data.Common/BaseModel.cs | kriskok95/SellMe | 28bd649ce8749567617e0f6d6f70b858a19e8f53 | [
"MIT"
] | 1 | 2020-03-10T09:11:39.000Z | 2020-03-10T09:11:39.000Z | Data/SellMe.Data.Common/BaseModel.cs | kriskok95/SellMe | 28bd649ce8749567617e0f6d6f70b858a19e8f53 | [
"MIT"
] | null | null | null | Data/SellMe.Data.Common/BaseModel.cs | kriskok95/SellMe | 28bd649ce8749567617e0f6d6f70b858a19e8f53 | [
"MIT"
] | null | null | null | namespace SellMe.Data.Common
{
using System;
public class BaseModel<TKey> : IAuditInfo
{
public TKey Id { get; set; }
public DateTime CreatedOn { get; set; } = DateTime.UtcNow;
public DateTime? ModifiedOn { get; set; }
}
}
| 19.142857 | 66 | 0.600746 |
f1be25c9c28a00eb4ed28645408465babc3137f2 | 461 | rb | Ruby | db/migrate/20160702120512_create_trainee_requests.rb | thepriyakadam/hrms | af7f44ac10691850487e2c412a666694680a0672 | [
"Unlicense"
] | null | null | null | db/migrate/20160702120512_create_trainee_requests.rb | thepriyakadam/hrms | af7f44ac10691850487e2c412a666694680a0672 | [
"Unlicense"
] | null | null | null | db/migrate/20160702120512_create_trainee_requests.rb | thepriyakadam/hrms | af7f44ac10691850487e2c412a666694680a0672 | [
"Unlicense"
] | null | null | null | class CreateTraineeRequests < ActiveRecord::Migration
def change
create_table :trainee_requests do |t|
t.references :training_request, index: true, foreign_key: true
t.references :employee, index: true, foreign_key: true
t.references :reporting_master
t.references :training_topic_master, index: true, foreign_key: true
t.boolean :is_complete
t.boolean :training_plan
t.timestamps null: false
end
end
end
| 28.8125 | 73 | 0.722343 |
f28e7eda143f7d1d0d6aeca64af777aeae15c6c9 | 644 | dart | Dart | lib/src/ui/widget/visual/preferred/visibility_builder.widget.dart | yohom/decorated_flutter | 1885922042f9326adcaa66572ddbf599670702bd | [
"Apache-2.0"
] | 24 | 2019-03-11T13:20:09.000Z | 2021-03-28T11:55:10.000Z | lib/src/ui/widget/visual/preferred/visibility_builder.widget.dart | yohom/decorated_flutter | 1885922042f9326adcaa66572ddbf599670702bd | [
"Apache-2.0"
] | 6 | 2019-06-15T04:12:04.000Z | 2021-06-12T11:57:40.000Z | lib/src/ui/widget/visual/preferred/visibility_builder.widget.dart | yohom/flutter_framework | 49f3735aa31aa2f80afe81d38afa3879838dd771 | [
"Apache-2.0"
] | 37 | 2019-04-11T03:13:14.000Z | 2021-03-30T02:33:19.000Z | import 'package:decorated_flutter/decorated_flutter.dart';
import 'package:flutter/material.dart';
class VisibilityBuilder extends StatelessWidget {
const VisibilityBuilder({
Key? key,
this.initialValue = true,
required this.visibilityStream,
required this.child,
}) : super(key: key);
final bool initialValue;
final Stream<bool> visibilityStream;
final Widget child;
@override
Widget build(BuildContext context) {
return Subscriber<bool>(
initialData: initialValue,
stream: visibilityStream,
builder: (data) {
return Visibility(visible: data, child: child);
},
);
}
}
| 23.851852 | 58 | 0.698758 |
e78c10feea813aa07e93bcc42a148587ec24cf74 | 457 | js | JavaScript | test/resources/partyResources.js | Jack-Golding/ui-oa | baa8d85c1dd3cc7eb39cd4bdbb05bf24ce4f814e | [
"Apache-2.0"
] | null | null | null | test/resources/partyResources.js | Jack-Golding/ui-oa | baa8d85c1dd3cc7eb39cd4bdbb05bf24ce4f814e | [
"Apache-2.0"
] | null | null | null | test/resources/partyResources.js | Jack-Golding/ui-oa | baa8d85c1dd3cc7eb39cd4bdbb05bf24ce4f814e | [
"Apache-2.0"
] | null | null | null | const party = {
'id': '2353b398-ceb1-460e-94b9-47f4a95c06b9',
'title': 'Dr',
'mainEmail': 'Elijah_Dempsey6074@brety.org',
'fullName': 'Elijah Dempsey',
'givenNames': 'Elijah',
'familyName': 'Dempsey',
'orcidId': '0000-1111',
'phone': '012345678',
'mobile': '012345678'
};
const handlers = {
onClose: jest.fn(),
onDelete: jest.fn(),
onEdit: jest.fn(),
onSubmit: jest.fn(),
};
export { party, handlers };
| 21.761905 | 49 | 0.588621 |
6c2cde8cd2e4f57e5282d88894dab8ce09534fba | 353 | kt | Kotlin | unleash/src/main/java/com/silvercar/unleash/UnleashException.kt | silvercar/unleash-client-kotlin | 98d12a20913bc1b91954d525c035cb638ddc1b21 | [
"Apache-2.0"
] | 8 | 2020-03-18T20:49:53.000Z | 2021-05-06T16:04:49.000Z | unleash/src/main/java/com/silvercar/unleash/UnleashException.kt | silvercar/unleash-client-kotlin | 98d12a20913bc1b91954d525c035cb638ddc1b21 | [
"Apache-2.0"
] | 10 | 2020-03-28T22:04:21.000Z | 2021-01-21T11:18:12.000Z | unleash/src/main/java/com/silvercar/unleash/UnleashException.kt | silvercar/unleash-client-kotlin | 98d12a20913bc1b91954d525c035cb638ddc1b21 | [
"Apache-2.0"
] | 2 | 2020-05-26T18:11:39.000Z | 2021-12-23T22:14:15.000Z | package com.silvercar.unleash
import com.silvercar.unleash.event.UnleashEvent
import com.silvercar.unleash.event.UnleashSubscriber
class UnleashException(message: String?, cause: Throwable?) :
RuntimeException(message, cause), UnleashEvent {
override fun publishTo(unleashSubscriber: UnleashSubscriber) {
unleashSubscriber.onError(this)
}
}
| 29.416667 | 64 | 0.807365 |
66549abdfd2d73422f8e064c2cf634439955257b | 2,415 | dart | Dart | lib/comman/custom_animation.dart | MultiQoSTechnologies/women_apparel | 77fd1dc6ae029e1150ba64028a2dd6ddacddd00e | [
"MIT"
] | 9 | 2021-11-12T14:21:52.000Z | 2021-11-15T12:32:49.000Z | lib/comman/custom_animation.dart | krishnasoni2103/women_apparel | 77fd1dc6ae029e1150ba64028a2dd6ddacddd00e | [
"MIT"
] | null | null | null | lib/comman/custom_animation.dart | krishnasoni2103/women_apparel | 77fd1dc6ae029e1150ba64028a2dd6ddacddd00e | [
"MIT"
] | 3 | 2021-11-12T14:21:53.000Z | 2021-11-16T00:25:08.000Z | import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:get/get_navigation/src/extension_navigation.dart';
import 'package:women_apparel/comman/app_routes.dart';
import 'package:women_apparel/comman/custom_imagelist.dart';
import 'package:women_apparel/constant/app_assets.dart';
class CustomAnimation extends StatefulWidget {
const CustomAnimation({Key? key}) : super(key: key);
@override
_CustomAnimationState createState() => _CustomAnimationState();
}
class _CustomAnimationState extends State<CustomAnimation> {
@override
Widget build(BuildContext context) {
return Expanded(
child: Hero(
tag: AssetImages.download,
child: Column(
children: [
Material(
//Navigation to ThirdPage
child: InkWell(
onTap: () {
// navigating using get plugin.
Get.toNamed(Routes.ThirdPage);
},
// use of carousel_slider plugin.
child: CarouselSlider(
items: [
CustomImageList(
image: const AssetImage(AssetImages.download),
),
CustomImageList(
image: const AssetImage(AssetImages.image1),
),
CustomImageList(
image: const AssetImage(AssetImages.download),
),
CustomImageList(
image: const AssetImage(AssetImages.image1),
),
],
options: CarouselOptions(
height: 500.0,
viewportFraction: 1,
initialPage: 0,
enableInfiniteScroll: true,
autoPlay: true,
autoPlayInterval: const Duration(seconds: 3),
autoPlayAnimationDuration:
const Duration(milliseconds: 800),
autoPlayCurve: Curves.fastOutSlowIn,
enlargeCenterPage: true,
scrollDirection: Axis.horizontal,
),
),
),
),
],
),
),
);
}
}
| 34.5 | 68 | 0.527536 |
93b6a6bdf0695a11cca2dec7969ac8114920b9f8 | 1,082 | html | HTML | manuscript/page-734/body.html | marvindanig/english-literature | 5f9dcbfdd63ede766219354678514fe862c72471 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | 1 | 2019-08-20T13:31:32.000Z | 2019-08-20T13:31:32.000Z | manuscript/page-734/body.html | marvindanig/english-literature | 5f9dcbfdd63ede766219354678514fe862c72471 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | 1 | 2020-09-07T00:12:34.000Z | 2020-09-07T00:12:34.000Z | manuscript/page-734/body.html | marvindanig/english-literature | 5f9dcbfdd63ede766219354678514fe862c72471 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | <div class="leaf flex"><div class="inner justify"><p class="no-indent ">a matter of rhetoric rather than of romance, but is interesting still to the reader who wants to hear Johnson's personal views of society, philosophy, and religion. Any one of his <em>Essays</em>, like that on "Reading," or "The Pernicious Effects of Revery," will be enough to acquaint the reader with the Johnsonese style, which was once much admired and copied by orators, but which happily has been replaced by a more natural way of speaking. Most of his works, it must be confessed, are rather tiresome. It is not to his books, but rather to the picture of the man himself, as given by Boswell, that Johnson owes his great place in our literature.</p><ul><li>BOSWELL'S "LIFE OF JOHNSON"</li></ul><p class=" stretch-last-line ">In James Boswell (1740-1795 we have another extraordinary figure,—a shallow little Scotch barrister, who trots about like a dog at the heels of his big master, frantic at a caress and groveling at a cuff, and abundantly contented if only he can be near him and</p></div> </div> | 1,082 | 1,082 | 0.76525 |
a278352f294236b2ff65fc3aa72d5f6d2ba63fd1 | 5,738 | sql | SQL | smartbptp.sql | Razka173/smartbptp | d9a4b646b96892b456fc003d42aa2fc895670e0a | [
"MIT"
] | null | null | null | smartbptp.sql | Razka173/smartbptp | d9a4b646b96892b456fc003d42aa2fc895670e0a | [
"MIT"
] | null | null | null | smartbptp.sql | Razka173/smartbptp | d9a4b646b96892b456fc003d42aa2fc895670e0a | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 15 Jun 2021 pada 17.32
-- Versi server: 10.1.36-MariaDB
-- Versi PHP: 7.2.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `smartbptp`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `bukutamu`
--
CREATE TABLE `bukutamu` (
`id_bukutamu` int(11) NOT NULL,
`nama` varchar(255) NOT NULL,
`nik` varchar(255) DEFAULT NULL,
`instansi` varchar(255) DEFAULT NULL,
`nomor_telepon` varchar(255) DEFAULT NULL,
`tujuan_kunjungan` varchar(255) DEFAULT NULL,
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `pelatihan`
--
CREATE TABLE `pelatihan` (
`id_pelatihan` int(11) NOT NULL,
`nama` varchar(255) NOT NULL,
`instansi` varchar(255) NOT NULL,
`alamat` varchar(255) DEFAULT NULL,
`nomor_telepon` varchar(255) DEFAULT NULL,
`email` varchar(255) NOT NULL,
`tanggal_kunjungan` date DEFAULT NULL,
`tujuan_kunjungan` varchar(255) DEFAULT NULL,
`dokumen` varchar(255) DEFAULT NULL,
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `peserta`
--
CREATE TABLE `peserta` (
`id_peserta` int(11) NOT NULL,
`nama` varchar(255) NOT NULL,
`instansi` varchar(255) NOT NULL,
`nomor_induk` varchar(255) NOT NULL,
`alamat` varchar(255) DEFAULT NULL,
`nomor_telepon` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`waktu` varchar(255) DEFAULT NULL,
`materi` varchar(255) DEFAULT NULL,
`jumlah_anggota` varchar(255) DEFAULT NULL,
`nama_anggota` varchar(255) DEFAULT NULL,
`status` varchar(255) DEFAULT NULL,
`dokumen` varchar(255) DEFAULT NULL,
`tanggal_masuk` date DEFAULT NULL,
`tanggal_keluar` date DEFAULT NULL,
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `qrcode`
--
CREATE TABLE `qrcode` (
`id_qrcode` int(11) NOT NULL,
`data` varchar(255) NOT NULL,
`gambar` varchar(255) NOT NULL,
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `users`
--
CREATE TABLE `users` (
`id_user` int(11) NOT NULL,
`nama` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`username` varchar(32) NOT NULL,
`password` varchar(255) NOT NULL,
`last_login` timestamp NULL DEFAULT NULL,
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `users`
--
INSERT INTO `users` (`id_user`, `nama`, `email`, `username`, `password`, `last_login`, `date_created`, `date_updated`) VALUES
(1, 'Admin Smart BPTP', 'smartbptp@gmail.com', 'superadmin', 'ed813787a911e7188845d8ee891bc3ced9717af6', '2021-06-15 08:08:13', '2021-06-15 10:22:56', '2021-06-15 10:22:56'),
(2, 'Donny', 'donie_don2@yahoo.com', 'donnybptp', '17cbac7a5a62f32e49b118007bda0036d1f0874c', NULL, '2021-06-15 10:31:31', '2021-06-15 10:31:31'),
(3, 'Karno', 'kaheriswanto@gmail.com', 'karnobptp', '17cbac7a5a62f32e49b118007bda0036d1f0874c', NULL, '2021-06-15 10:31:52', '2021-06-15 10:31:52');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `bukutamu`
--
ALTER TABLE `bukutamu`
ADD PRIMARY KEY (`id_bukutamu`);
--
-- Indeks untuk tabel `pelatihan`
--
ALTER TABLE `pelatihan`
ADD PRIMARY KEY (`id_pelatihan`);
--
-- Indeks untuk tabel `peserta`
--
ALTER TABLE `peserta`
ADD PRIMARY KEY (`id_peserta`);
--
-- Indeks untuk tabel `qrcode`
--
ALTER TABLE `qrcode`
ADD PRIMARY KEY (`id_qrcode`);
--
-- Indeks untuk tabel `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id_user`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `bukutamu`
--
ALTER TABLE `bukutamu`
MODIFY `id_bukutamu` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `pelatihan`
--
ALTER TABLE `pelatihan`
MODIFY `id_pelatihan` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `peserta`
--
ALTER TABLE `peserta`
MODIFY `id_peserta` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `qrcode`
--
ALTER TABLE `qrcode`
MODIFY `id_qrcode` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `users`
--
ALTER TABLE `users`
MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 28.547264 | 174 | 0.689613 |
744c199155258bc54c24d4e1c5f933044fc5d4e0 | 3,838 | html | HTML | client/app/modal/files/share/share.html | jhl0123/web_client | a006109c5341c5fb497eabc2f80fcaa4186f0360 | [
"MIT"
] | null | null | null | client/app/modal/files/share/share.html | jhl0123/web_client | a006109c5341c5fb497eabc2f80fcaa4186f0360 | [
"MIT"
] | null | null | null | client/app/modal/files/share/share.html | jhl0123/web_client | a006109c5341c5fb497eabc2f80fcaa4186f0360 | [
"MIT"
] | null | null | null | <page-tracker page="files/share" title="File Share"></page-tracker>
<!-- Modal: File Share -->
<div class="modal-header">
<button type="button" class="close" data-ng-click="cancel();"><i class="icon-delete"></i></button>
<h3 class="modal-header__title">
<span translate>@common-share-file</span>
</h3>
</div>
<form name="file_share_form" data-ng-submit="onFileShareClick();">
<div class="modal-body">
<div class="form-horizontal">
<!-- FILE INFO -->
<div class="form-group">
<label class="control-label col-sm-3">
<span translate>@common-file</span>
</label>
<div class="col-sm-9 modal-share__file">
<div class="modal-share__file-type">
<!-- IMAGE -->
<div class="image_wrapper msg-file-body__img__background jnd-text-center" ng-if="hasPreview">
<div class="opac-zero msg-file-body__img cursor_pointer"
image-loader="{{::thumbnailImage}}"
image-max-height="65" image-max-width="65" image-is-square="true">
</div>
</div>
<!-- OTHER TYPE -->
<div class="modal-share__file-type__other" ng-if="!hasPreview">
<div class="fileicon fileicon-{{file.content | fileIcon}}"></div>
</div>
</div>
<div class="modal-share__file-body">
<span class="modal-share__file-body__writer">{{ file.extWriter|getName }}</span>
<span class="modal-share__file-body__time">{{ file.createTime | date: 'yyyy/MM/dd h:mm a' }}</span>
<div class="modal-share__file-body__title keep">{{ file.content | fileTitle }}</div>
<div class="modal-share__file-body__meta">
<span class="modal-share__file-body__meta-size"
data-ng-if="file.content.size > 0"
data-ng-bind="file.content.size | bytes"></span>
</div>
</div>
</div>
</div>
<!-- FILE SHARE OPTION -->
<div class="form-group">
<label class="control-label col-sm-3">
<span translate>@common-share-in</span>
</label>
<div class="col-sm-9">
<!--<select ng-if="selectOptions.length"-->
<!--id="_modalShareEntitySelect"-->
<!--class="form-control"-->
<!--ng-model="selected.data"-->
<!--ng-options="channel as channel|getName group by channel.extGroupName for channel in selectOptions">-->
<!--</select>-->
<jnd-selectbox-room jnd-data-model="selected.id" jnd-data-list="selectOptions"></jnd-selectbox-room>
<span ng-if="!selectOptions.length"
class="modal-share-span"
translate>@common-all-shared</span>
</div>
</div>
<!-- FILE COMMENT -->
<div class="form-group hidden">
<label class="control-label col-sm-3">
<span translate>@common-comment</span>
</label>
<div class="col-sm-9">
<textarea class="form-control"
name="file_share_comment"
rows="3"
data-ng-model="comment"
data-ng-maxlength="256"
maxlength="256"
style="resize:none;"
disabled>
</textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<input class="btn btn-ok pull-right _modalSubmit" type="submit" id="file_share_btn" value="{{ '@btn-share' | translate }}"/>
<button type="button" class="btn btn-cancel pull-right" data-ng-click="cancel();"><span translate>@btn-cancel</span></button>
</div>
</form>
<span ng-if="false" translate>@common-file-share-jump-channel-confirm-msg</span>
| 43.613636 | 129 | 0.543773 |
469db6f5c509fc3faeeca34d9c6089ba7ed46a76 | 1,045 | html | HTML | docs/sections/_cssstats.html | webintensive/skeletor | 3ce6cc2240c280208fc03969024f0c4b885d5ea3 | [
"MIT"
] | 13 | 2015-01-21T16:11:15.000Z | 2016-08-24T13:09:49.000Z | docs/sections/_cssstats.html | webintensive/skeletor | 3ce6cc2240c280208fc03969024f0c4b885d5ea3 | [
"MIT"
] | 38 | 2015-01-05T19:27:45.000Z | 2021-06-29T14:15:12.000Z | docs/sections/_cssstats.html | webintensive/skeletor | 3ce6cc2240c280208fc03969024f0c4b885d5ea3 | [
"MIT"
] | 7 | 2015-01-17T20:38:41.000Z | 2016-07-19T18:09:21.000Z | <!-- CSS Stats -->
<div class="docs-section" id="cssstats">
<h6 class="docs-section__header">CSS Stats</h6>
<p><a href="https://www.npmjs.com/package/cssstats">cssstats</a> parses the compiled CSS stylesheet and returns an object with statistics. These are high-level stats which help you analyse the performance and maintainability of your code. It helps you avoid bloat, catch redundant rules, and keep a low average specificity of selectors.</p>
<p>The visualization of these stats are available at <a href="/css/stats">/css/stats</a>. The visualization is based on CSS Stats by <a href="http://mrmrs.cc" class="bold dark-gray">Mrmrs</a> & <a href="http://jxnblk.com" class="bold dark-gray">Jxnblk</a>.</p>
<ul>
<li><a href="http://webdesign.tutsplus.com/tutorials/understanding-css-stats-how-to-make-the-most-of-the-numbers--cms-22756">Understanding CSS Stats: How to Make the Most of the Numbers</a></li>
<li><a href="http://csswizardry.com/2014/10/the-specificity-graph">The Specificity Graph</a></li>
</ul>
</div>
| 80.384615 | 342 | 0.724402 |
a105a067c93907dc87863cf45449bea3c5e593da | 2,402 | lua | Lua | tests/test-net.lua | Theintercooler/luvit | dfb57e66da9f112e3ffa373001698e9deb8d15d6 | [
"Apache-2.0"
] | null | null | null | tests/test-net.lua | Theintercooler/luvit | dfb57e66da9f112e3ffa373001698e9deb8d15d6 | [
"Apache-2.0"
] | null | null | null | tests/test-net.lua | Theintercooler/luvit | dfb57e66da9f112e3ffa373001698e9deb8d15d6 | [
"Apache-2.0"
] | null | null | null | --[[
Copyright 2014 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
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.
--]]
require("helper")
local net = require('net')
local PORT = process.env.PORT or 10081
local HOST = '127.0.0.1'
local server = net.createServer(function(client)
client:on("data", function (chunk)
client:write(chunk, function(err)
assert(err == nil)
end)
end)
client:on("end", function()
client:destroy()
end)
end)
server:listen(PORT, HOST, function(err)
local function test_keepalive(on_done) -- test :keepalive(enable, delay)
local client
client = net.createConnection(PORT, HOST, function(err)
client:keepalive(true, 10)
if err then
assert(err)
end
assert(client:isConnected() == true)
client:on('data', function(data)
assert(#data == 5)
assert(data == 'hello')
client:destroy()
if on_done then on_done() end
end)
client:write('hello')
end)
assert(client:isConnected() == false)
end
local function test_nodelay(on_done) -- test :nodelay(enable) function
local client
client = net.createConnection(PORT, HOST, function(err)
client:nodelay(true)
if err then
assert(err)
end
client:on('data', function(data)
assert(#data == 5)
assert(data == 'hello')
client:destroy()
if on_done then on_done() end
end)
client:write('hello')
end)
end
local client
client = net.createConnection(PORT, HOST, function(err)
if err then
assert(err)
end
client:on('data', function(data)
assert(#data == 5)
assert(data == 'hello')
client:destroy()
test_nodelay(function()
test_keepalive(function()
server:close()
end)
end)
end)
client:write('hello')
end)
end)
server:on("error", function(err)
assert(err)
end)
| 24.02 | 77 | 0.64821 |
71dd5675922c68806e8f10fff9656182e0b523c0 | 695 | tsx | TypeScript | components/SubscribeItem/SubscribeItem.tsx | alexart721/ds-client | 34c44067fb4d66aa52e8807f339e26d4c63f1e87 | [
"Apache-2.0"
] | null | null | null | components/SubscribeItem/SubscribeItem.tsx | alexart721/ds-client | 34c44067fb4d66aa52e8807f339e26d4c63f1e87 | [
"Apache-2.0"
] | null | null | null | components/SubscribeItem/SubscribeItem.tsx | alexart721/ds-client | 34c44067fb4d66aa52e8807f339e26d4c63f1e87 | [
"Apache-2.0"
] | null | null | null | import { FC } from 'react';
import { Checkbox } from 'antd';
import { CheckboxChangeEvent } from 'antd/lib/checkbox';
import { MyChannelState } from '../../lib/types';
interface Props {
channel: MyChannelState,
onCheck: Function
}
const SubscribeItem: FC<Props> = ({ channel, onCheck }) => {
const handleChange = (event: CheckboxChangeEvent) => {
event.preventDefault();
onCheck(event.target.value);
};
return (
<>
<div>
<Checkbox onChange={handleChange} value={channel}>
<div style={{ fontSize: 'medium' }}>
#
{channel.name}
</div>
</Checkbox>
</div>
</>
);
};
export default SubscribeItem;
| 22.419355 | 60 | 0.588489 |
fc593d1456f83671c69e9343b4e5b6f45af952ec | 266 | kts | Kotlin | settings.gradle.kts | deepakdawadedd1/Recipe-Finder | 8272959b3b692bd4ee797e15e76d57282efa7ad4 | [
"Apache-2.0"
] | 2 | 2021-04-17T10:02:55.000Z | 2021-06-05T18:33:25.000Z | settings.gradle.kts | deepakdawadedd1/Recipe | 8272959b3b692bd4ee797e15e76d57282efa7ad4 | [
"Apache-2.0"
] | null | null | null | settings.gradle.kts | deepakdawadedd1/Recipe | 8272959b3b692bd4ee797e15e76d57282efa7ad4 | [
"Apache-2.0"
] | 1 | 2021-06-10T21:27:36.000Z | 2021-06-10T21:27:36.000Z | include(
":app",
":base",
":base-android",
":data",
":feature-home",
":feature-search",
":feature-favorite",
":feature-profile",
":ui",
":theme",
":domain",
":navigation",
":firebase"
)
rootProject.name = "Recipe"
| 15.647059 | 27 | 0.503759 |
0f3f51aa9bfd334b763b39ea39a8c0b4ca0b88ad | 40,006 | sql | SQL | tests/vendor/umpirsky/language-list/data/sv_FI/language.postgresql.sql | ariSatriooo/DKC-Indramayu | 726f0f52219c310bb48e76ef7f936388f5dd7d60 | [
"MIT"
] | 456 | 2016-01-10T19:23:58.000Z | 2022-03-21T02:39:41.000Z | tests/vendor/umpirsky/language-list/data/sv_FI/language.postgresql.sql | ariSatriooo/DKC-Indramayu | 726f0f52219c310bb48e76ef7f936388f5dd7d60 | [
"MIT"
] | 18 | 2016-02-08T13:16:15.000Z | 2021-08-16T08:49:42.000Z | tests/vendor/umpirsky/language-list/data/sv_FI/language.postgresql.sql | ariSatriooo/DKC-Indramayu | 726f0f52219c310bb48e76ef7f936388f5dd7d60 | [
"MIT"
] | 229 | 2016-01-14T08:05:55.000Z | 2022-03-31T07:18:18.000Z | CREATE TABLE list (id VARCHAR(64) NOT NULL, value VARCHAR(64) NOT NULL, PRIMARY KEY(id));
INSERT INTO "list" ("id", "value") VALUES (E'ab', E'abchaziska');
INSERT INTO "list" ("id", "value") VALUES (E'ace', E'acehnesiska');
INSERT INTO "list" ("id", "value") VALUES (E'ach', E'acholi');
INSERT INTO "list" ("id", "value") VALUES (E'ada', E'adangme');
INSERT INTO "list" ("id", "value") VALUES (E'ady', E'adygeiska');
INSERT INTO "list" ("id", "value") VALUES (E'aa', E'afar');
INSERT INTO "list" ("id", "value") VALUES (E'ps', E'afghanska');
INSERT INTO "list" ("id", "value") VALUES (E'afh', E'afrihili');
INSERT INTO "list" ("id", "value") VALUES (E'af', E'afrikaans');
INSERT INTO "list" ("id", "value") VALUES (E'agq', E'aghem');
INSERT INTO "list" ("id", "value") VALUES (E'ain', E'ainu');
INSERT INTO "list" ("id", "value") VALUES (E'ak', E'akan');
INSERT INTO "list" ("id", "value") VALUES (E'akk', E'akkadiska');
INSERT INTO "list" ("id", "value") VALUES (E'akz', E'Alabama');
INSERT INTO "list" ("id", "value") VALUES (E'sq', E'albanska');
INSERT INTO "list" ("id", "value") VALUES (E'ale', E'aleutiska');
INSERT INTO "list" ("id", "value") VALUES (E'arq', E'algerisk arabiska');
INSERT INTO "list" ("id", "value") VALUES (E'en_US', E'amerikansk engelska');
INSERT INTO "list" ("id", "value") VALUES (E'ase', E'amerikanskt teckenspråk');
INSERT INTO "list" ("id", "value") VALUES (E'am', E'amhariska');
INSERT INTO "list" ("id", "value") VALUES (E'anp', E'angika');
INSERT INTO "list" ("id", "value") VALUES (E'njo', E'Ao Naga');
INSERT INTO "list" ("id", "value") VALUES (E'ar', E'arabiska');
INSERT INTO "list" ("id", "value") VALUES (E'an', E'aragonesiska');
INSERT INTO "list" ("id", "value") VALUES (E'arc', E'arameiska');
INSERT INTO "list" ("id", "value") VALUES (E'aro', E'araoniska');
INSERT INTO "list" ("id", "value") VALUES (E'arp', E'arapaho');
INSERT INTO "list" ("id", "value") VALUES (E'arn', E'araukanska');
INSERT INTO "list" ("id", "value") VALUES (E'arw', E'arawakiska');
INSERT INTO "list" ("id", "value") VALUES (E'hy', E'armeniska');
INSERT INTO "list" ("id", "value") VALUES (E'rup', E'arumänska');
INSERT INTO "list" ("id", "value") VALUES (E'as', E'assamesiska');
INSERT INTO "list" ("id", "value") VALUES (E'ast', E'asturiska');
INSERT INTO "list" ("id", "value") VALUES (E'asa', E'asu');
INSERT INTO "list" ("id", "value") VALUES (E'cch', E'atsam');
INSERT INTO "list" ("id", "value") VALUES (E'en_AU', E'australisk engelska');
INSERT INTO "list" ("id", "value") VALUES (E'av', E'avariska');
INSERT INTO "list" ("id", "value") VALUES (E'ae', E'avestiska');
INSERT INTO "list" ("id", "value") VALUES (E'awa', E'awadhi');
INSERT INTO "list" ("id", "value") VALUES (E'ay', E'aymara');
INSERT INTO "list" ("id", "value") VALUES (E'az', E'azerbajdzjanska');
INSERT INTO "list" ("id", "value") VALUES (E'ksf', E'bafia');
INSERT INTO "list" ("id", "value") VALUES (E'bfd', E'bafut');
INSERT INTO "list" ("id", "value") VALUES (E'bfq', E'bagada');
INSERT INTO "list" ("id", "value") VALUES (E'byv', E'bagangte');
INSERT INTO "list" ("id", "value") VALUES (E'bqi', E'bakhtiari');
INSERT INTO "list" ("id", "value") VALUES (E'bss', E'bakossi');
INSERT INTO "list" ("id", "value") VALUES (E'ban', E'balinesiska');
INSERT INTO "list" ("id", "value") VALUES (E'bal', E'baluchiska');
INSERT INTO "list" ("id", "value") VALUES (E'bm', E'bambara');
INSERT INTO "list" ("id", "value") VALUES (E'bkm', E'bamekon');
INSERT INTO "list" ("id", "value") VALUES (E'ybb', E'bamileké-jemba');
INSERT INTO "list" ("id", "value") VALUES (E'nnh', E'bamileké-ngiemboon');
INSERT INTO "list" ("id", "value") VALUES (E'bax', E'bamunska');
INSERT INTO "list" ("id", "value") VALUES (E'bjn', E'banjariska');
INSERT INTO "list" ("id", "value") VALUES (E'bas', E'basa');
INSERT INTO "list" ("id", "value") VALUES (E'ba', E'basjkiriska');
INSERT INTO "list" ("id", "value") VALUES (E'eu', E'baskiska');
INSERT INTO "list" ("id", "value") VALUES (E'bbc', E'Batak Toba');
INSERT INTO "list" ("id", "value") VALUES (E'bar', E'bayerska');
INSERT INTO "list" ("id", "value") VALUES (E'bej', E'beja');
INSERT INTO "list" ("id", "value") VALUES (E'bem', E'bemba');
INSERT INTO "list" ("id", "value") VALUES (E'bez', E'bena');
INSERT INTO "list" ("id", "value") VALUES (E'bn', E'bengali');
INSERT INTO "list" ("id", "value") VALUES (E'bew', E'betawiska');
INSERT INTO "list" ("id", "value") VALUES (E'bho', E'bhojpuri');
INSERT INTO "list" ("id", "value") VALUES (E'dz', E'bhutanesiska');
INSERT INTO "list" ("id", "value") VALUES (E'bik', E'bikol');
INSERT INTO "list" ("id", "value") VALUES (E'bin', E'bini');
INSERT INTO "list" ("id", "value") VALUES (E'bpy', E'bishnupriya');
INSERT INTO "list" ("id", "value") VALUES (E'bi', E'bislama');
INSERT INTO "list" ("id", "value") VALUES (E'byn', E'blin');
INSERT INTO "list" ("id", "value") VALUES (E'zbl', E'blissymboler');
INSERT INTO "list" ("id", "value") VALUES (E'brx', E'bodo');
INSERT INTO "list" ("id", "value") VALUES (E'bs', E'bosniska');
INSERT INTO "list" ("id", "value") VALUES (E'bum', E'boulou');
INSERT INTO "list" ("id", "value") VALUES (E'brh', E'brahuiska');
INSERT INTO "list" ("id", "value") VALUES (E'bra', E'braj');
INSERT INTO "list" ("id", "value") VALUES (E'pt_BR', E'brasiliansk portugisiska');
INSERT INTO "list" ("id", "value") VALUES (E'br', E'bretonska');
INSERT INTO "list" ("id", "value") VALUES (E'en_GB', E'brittisk engelska');
INSERT INTO "list" ("id", "value") VALUES (E'bug', E'buginesiska');
INSERT INTO "list" ("id", "value") VALUES (E'bg', E'bulgariska');
INSERT INTO "list" ("id", "value") VALUES (E'bua', E'burjätiska');
INSERT INTO "list" ("id", "value") VALUES (E'my', E'burmesiska');
INSERT INTO "list" ("id", "value") VALUES (E'cad', E'caddo');
INSERT INTO "list" ("id", "value") VALUES (E'frc', E'cajun-franska');
INSERT INTO "list" ("id", "value") VALUES (E'cps', E'Capiznon');
INSERT INTO "list" ("id", "value") VALUES (E'cay', E'cayuga');
INSERT INTO "list" ("id", "value") VALUES (E'ceb', E'cebuano');
INSERT INTO "list" ("id", "value") VALUES (E'dtp', E'Central Dusun');
INSERT INTO "list" ("id", "value") VALUES (E'esu', E'Central Yupik');
INSERT INTO "list" ("id", "value") VALUES (E'tzm', E'centralmarockansk tamazight');
INSERT INTO "list" ("id", "value") VALUES (E'shu', E'Chad-arabiska');
INSERT INTO "list" ("id", "value") VALUES (E'chg', E'chagatai');
INSERT INTO "list" ("id", "value") VALUES (E'ch', E'chamorro');
INSERT INTO "list" ("id", "value") VALUES (E'chr', E'cherokesiska');
INSERT INTO "list" ("id", "value") VALUES (E'chy', E'cheyenne');
INSERT INTO "list" ("id", "value") VALUES (E'chb', E'chibcha');
INSERT INTO "list" ("id", "value") VALUES (E'cgg', E'chiga');
INSERT INTO "list" ("id", "value") VALUES (E'qug', E'Chimborazo-höglandskichwa');
INSERT INTO "list" ("id", "value") VALUES (E'chn', E'chinook');
INSERT INTO "list" ("id", "value") VALUES (E'chp', E'chipewyan');
INSERT INTO "list" ("id", "value") VALUES (E'cho', E'choctaw');
INSERT INTO "list" ("id", "value") VALUES (E'chk', E'chuukesiska');
INSERT INTO "list" ("id", "value") VALUES (E'cr', E'cree');
INSERT INTO "list" ("id", "value") VALUES (E'dak', E'dakota');
INSERT INTO "list" ("id", "value") VALUES (E'da', E'danska');
INSERT INTO "list" ("id", "value") VALUES (E'dar', E'darginska');
INSERT INTO "list" ("id", "value") VALUES (E'dzg', E'dazaga');
INSERT INTO "list" ("id", "value") VALUES (E'del', E'delaware');
INSERT INTO "list" ("id", "value") VALUES (E'din', E'dinka');
INSERT INTO "list" ("id", "value") VALUES (E'dv', E'divehi');
INSERT INTO "list" ("id", "value") VALUES (E'doi', E'dogri');
INSERT INTO "list" ("id", "value") VALUES (E'dgr', E'dogrib');
INSERT INTO "list" ("id", "value") VALUES (E'dua', E'duala');
INSERT INTO "list" ("id", "value") VALUES (E'dyu', E'dyula');
INSERT INTO "list" ("id", "value") VALUES (E'efi', E'efik');
INSERT INTO "list" ("id", "value") VALUES (E'arz', E'egyptisk arabiska');
INSERT INTO "list" ("id", "value") VALUES (E'eka', E'ekajuk');
INSERT INTO "list" ("id", "value") VALUES (E'elx', E'elamitiska');
INSERT INTO "list" ("id", "value") VALUES (E'ebu', E'embu');
INSERT INTO "list" ("id", "value") VALUES (E'egl', E'emiliska');
INSERT INTO "list" ("id", "value") VALUES (E'smn', E'enaresamiska');
INSERT INTO "list" ("id", "value") VALUES (E'en', E'engelska');
INSERT INTO "list" ("id", "value") VALUES (E'myv', E'erjya');
INSERT INTO "list" ("id", "value") VALUES (E'eo', E'esperanto');
INSERT INTO "list" ("id", "value") VALUES (E'et', E'estniska');
INSERT INTO "list" ("id", "value") VALUES (E'gez', E'etiopiska');
INSERT INTO "list" ("id", "value") VALUES (E'pt_PT', E'europeisk portugisiska');
INSERT INTO "list" ("id", "value") VALUES (E'es_ES', E'europeisk spanska');
INSERT INTO "list" ("id", "value") VALUES (E'ee', E'ewe');
INSERT INTO "list" ("id", "value") VALUES (E'ewo', E'ewondo');
INSERT INTO "list" ("id", "value") VALUES (E'ext', E'Extremaduran');
INSERT INTO "list" ("id", "value") VALUES (E'fan', E'fang');
INSERT INTO "list" ("id", "value") VALUES (E'fat', E'fanti');
INSERT INTO "list" ("id", "value") VALUES (E'phn', E'feniciska');
INSERT INTO "list" ("id", "value") VALUES (E'hif', E'Fiji-hindi');
INSERT INTO "list" ("id", "value") VALUES (E'fj', E'fijianska');
INSERT INTO "list" ("id", "value") VALUES (E'fil', E'filippinska');
INSERT INTO "list" ("id", "value") VALUES (E'fi', E'finska');
INSERT INTO "list" ("id", "value") VALUES (E'nl_BE', E'flamländska');
INSERT INTO "list" ("id", "value") VALUES (E'mul', E'flera språk');
INSERT INTO "list" ("id", "value") VALUES (E'fon', E'fonspråket');
INSERT INTO "list" ("id", "value") VALUES (E'egy', E'fornegyptiska');
INSERT INTO "list" ("id", "value") VALUES (E'ang', E'fornengelska');
INSERT INTO "list" ("id", "value") VALUES (E'fro', E'fornfranska');
INSERT INTO "list" ("id", "value") VALUES (E'grc', E'forngrekiska');
INSERT INTO "list" ("id", "value") VALUES (E'goh', E'fornhögtyska');
INSERT INTO "list" ("id", "value") VALUES (E'sga', E'forniriska');
INSERT INTO "list" ("id", "value") VALUES (E'non', E'fornnordiska');
INSERT INTO "list" ("id", "value") VALUES (E'peo', E'fornpersiska');
INSERT INTO "list" ("id", "value") VALUES (E'prg', E'fornpreussiska');
INSERT INTO "list" ("id", "value") VALUES (E'pro', E'fornprovensalska');
INSERT INTO "list" ("id", "value") VALUES (E'gur', E'Frafra');
INSERT INTO "list" ("id", "value") VALUES (E'frp', E'frankoprovensalska');
INSERT INTO "list" ("id", "value") VALUES (E'fr', E'franska');
INSERT INTO "list" ("id", "value") VALUES (E'fur', E'friulianska');
INSERT INTO "list" ("id", "value") VALUES (E'ff', E'fulani');
INSERT INTO "list" ("id", "value") VALUES (E'fo', E'färöiska');
INSERT INTO "list" ("id", "value") VALUES (E'zh_Hans', E'förenklad kinesiska');
INSERT INTO "list" ("id", "value") VALUES (E'gaa', E'gã');
INSERT INTO "list" ("id", "value") VALUES (E'gag', E'gagauziska');
INSERT INTO "list" ("id", "value") VALUES (E'gl', E'galiciska');
INSERT INTO "list" ("id", "value") VALUES (E'gan', E'gan');
INSERT INTO "list" ("id", "value") VALUES (E'ses', E'Gao-songhay');
INSERT INTO "list" ("id", "value") VALUES (E'gay', E'gayo');
INSERT INTO "list" ("id", "value") VALUES (E'gba', E'gbaya');
INSERT INTO "list" ("id", "value") VALUES (E'aln', E'gegiska');
INSERT INTO "list" ("id", "value") VALUES (E'ka', E'georgiska');
INSERT INTO "list" ("id", "value") VALUES (E'bbj', E'ghomala');
INSERT INTO "list" ("id", "value") VALUES (E'glk', E'gilaki');
INSERT INTO "list" ("id", "value") VALUES (E'gil', E'gilbertiska');
INSERT INTO "list" ("id", "value") VALUES (E'gom', E'Goa-konkani');
INSERT INTO "list" ("id", "value") VALUES (E'gon', E'gondi');
INSERT INTO "list" ("id", "value") VALUES (E'gor', E'gorontalo');
INSERT INTO "list" ("id", "value") VALUES (E'got', E'gotiska');
INSERT INTO "list" ("id", "value") VALUES (E'grb', E'grebo');
INSERT INTO "list" ("id", "value") VALUES (E'el', E'grekiska');
INSERT INTO "list" ("id", "value") VALUES (E'kl', E'grönländska');
INSERT INTO "list" ("id", "value") VALUES (E'gn', E'guaraní');
INSERT INTO "list" ("id", "value") VALUES (E'gu', E'gujarati');
INSERT INTO "list" ("id", "value") VALUES (E'guz', E'gusii');
INSERT INTO "list" ("id", "value") VALUES (E'gwi', E'gwichin');
INSERT INTO "list" ("id", "value") VALUES (E'hai', E'haida');
INSERT INTO "list" ("id", "value") VALUES (E'ht', E'haitiska');
INSERT INTO "list" ("id", "value") VALUES (E'hak', E'hakka');
INSERT INTO "list" ("id", "value") VALUES (E'ha', E'hausa');
INSERT INTO "list" ("id", "value") VALUES (E'haw', E'hawaiiska');
INSERT INTO "list" ("id", "value") VALUES (E'he', E'hebreiska');
INSERT INTO "list" ("id", "value") VALUES (E'hz', E'herero');
INSERT INTO "list" ("id", "value") VALUES (E'hit', E'hettitiska');
INSERT INTO "list" ("id", "value") VALUES (E'hil', E'hiligaynon');
INSERT INTO "list" ("id", "value") VALUES (E'hi', E'hindi');
INSERT INTO "list" ("id", "value") VALUES (E'ho', E'hirimotu');
INSERT INTO "list" ("id", "value") VALUES (E'hmn', E'hmongspråk');
INSERT INTO "list" ("id", "value") VALUES (E'hup', E'hupa');
INSERT INTO "list" ("id", "value") VALUES (E'hsb', E'högsorbiska');
INSERT INTO "list" ("id", "value") VALUES (E'iba', E'ibanska');
INSERT INTO "list" ("id", "value") VALUES (E'ibb', E'ibibio');
INSERT INTO "list" ("id", "value") VALUES (E'io', E'ido');
INSERT INTO "list" ("id", "value") VALUES (E'ig', E'igbo');
INSERT INTO "list" ("id", "value") VALUES (E'ilo', E'iloko');
INSERT INTO "list" ("id", "value") VALUES (E'id', E'indonesiska');
INSERT INTO "list" ("id", "value") VALUES (E'zxx', E'inget språkligt innehåll');
INSERT INTO "list" ("id", "value") VALUES (E'izh', E'ingriska');
INSERT INTO "list" ("id", "value") VALUES (E'inh', E'ingusjiska');
INSERT INTO "list" ("id", "value") VALUES (E'ia', E'interlingua');
INSERT INTO "list" ("id", "value") VALUES (E'ie', E'interlingue');
INSERT INTO "list" ("id", "value") VALUES (E'iu', E'inuktitut');
INSERT INTO "list" ("id", "value") VALUES (E'ik', E'inupiak');
INSERT INTO "list" ("id", "value") VALUES (E'ga', E'iriska');
INSERT INTO "list" ("id", "value") VALUES (E'is', E'isländska');
INSERT INTO "list" ("id", "value") VALUES (E'it', E'italienska');
INSERT INTO "list" ("id", "value") VALUES (E'sah', E'jakutiska');
INSERT INTO "list" ("id", "value") VALUES (E'jam', E'jamaikansk engelsk kreol');
INSERT INTO "list" ("id", "value") VALUES (E'ja', E'japanska');
INSERT INTO "list" ("id", "value") VALUES (E'yap', E'japetiska');
INSERT INTO "list" ("id", "value") VALUES (E'jv', E'javanesiska');
INSERT INTO "list" ("id", "value") VALUES (E'yi', E'jiddisch');
INSERT INTO "list" ("id", "value") VALUES (E'kaj', E'jju');
INSERT INTO "list" ("id", "value") VALUES (E'dyo', E'jola-fonyi');
INSERT INTO "list" ("id", "value") VALUES (E'jrb', E'judisk arabiska');
INSERT INTO "list" ("id", "value") VALUES (E'jpr', E'judisk persiska');
INSERT INTO "list" ("id", "value") VALUES (E'jut', E'jylländska');
INSERT INTO "list" ("id", "value") VALUES (E'kbd', E'kabardinska');
INSERT INTO "list" ("id", "value") VALUES (E'kab', E'kabyliska');
INSERT INTO "list" ("id", "value") VALUES (E'kac', E'kachin');
INSERT INTO "list" ("id", "value") VALUES (E'kgp', E'Kaingang');
INSERT INTO "list" ("id", "value") VALUES (E'kln', E'kalenjin');
INSERT INTO "list" ("id", "value") VALUES (E'xal', E'kalmuckiska');
INSERT INTO "list" ("id", "value") VALUES (E'kam', E'kamba');
INSERT INTO "list" ("id", "value") VALUES (E'km', E'kambodjanska');
INSERT INTO "list" ("id", "value") VALUES (E'en_CA', E'kanadensisk engelska');
INSERT INTO "list" ("id", "value") VALUES (E'fr_CA', E'kanadensisk franska');
INSERT INTO "list" ("id", "value") VALUES (E'kbl', E'kanembu');
INSERT INTO "list" ("id", "value") VALUES (E'kn', E'kannada');
INSERT INTO "list" ("id", "value") VALUES (E'yue', E'kantonesiska');
INSERT INTO "list" ("id", "value") VALUES (E'kr', E'kanuri');
INSERT INTO "list" ("id", "value") VALUES (E'kea', E'kapverdiska');
INSERT INTO "list" ("id", "value") VALUES (E'krc', E'karachay-balkar');
INSERT INTO "list" ("id", "value") VALUES (E'kaa', E'karakalpakiska');
INSERT INTO "list" ("id", "value") VALUES (E'krl', E'karelska');
INSERT INTO "list" ("id", "value") VALUES (E'car', E'karibiska');
INSERT INTO "list" ("id", "value") VALUES (E'ks', E'kashmiriska');
INSERT INTO "list" ("id", "value") VALUES (E'csb', E'kasjubiska');
INSERT INTO "list" ("id", "value") VALUES (E'ca', E'katalanska');
INSERT INTO "list" ("id", "value") VALUES (E'kaw', E'kawi');
INSERT INTO "list" ("id", "value") VALUES (E'kk', E'kazakiska');
INSERT INTO "list" ("id", "value") VALUES (E'ken', E'Kenyang');
INSERT INTO "list" ("id", "value") VALUES (E'kha', E'khasi');
INSERT INTO "list" ("id", "value") VALUES (E'kho', E'khotanesiska');
INSERT INTO "list" ("id", "value") VALUES (E'khw', E'khowar');
INSERT INTO "list" ("id", "value") VALUES (E'kg', E'kikongo');
INSERT INTO "list" ("id", "value") VALUES (E'ki', E'kikuyu');
INSERT INTO "list" ("id", "value") VALUES (E'jmc', E'kimashami');
INSERT INTO "list" ("id", "value") VALUES (E'kmb', E'kimbundu');
INSERT INTO "list" ("id", "value") VALUES (E'krj', E'Kinaray-a');
INSERT INTO "list" ("id", "value") VALUES (E'zh', E'kinesiska');
INSERT INTO "list" ("id", "value") VALUES (E'rw', E'kinjarwanda');
INSERT INTO "list" ("id", "value") VALUES (E'ky', E'kirgiziska');
INSERT INTO "list" ("id", "value") VALUES (E'kiu', E'Kirmanjki');
INSERT INTO "list" ("id", "value") VALUES (E'ksb', E'kisambaa');
INSERT INTO "list" ("id", "value") VALUES (E'yao', E'kiyao');
INSERT INTO "list" ("id", "value") VALUES (E'nwc', E'klassisk newariska');
INSERT INTO "list" ("id", "value") VALUES (E'syc', E'klassisk syriska');
INSERT INTO "list" ("id", "value") VALUES (E'tlh', E'klingonska');
INSERT INTO "list" ("id", "value") VALUES (E'kv', E'kome');
INSERT INTO "list" ("id", "value") VALUES (E'koi', E'komi-permjakiska');
INSERT INTO "list" ("id", "value") VALUES (E'swc', E'Kongo-swahili');
INSERT INTO "list" ("id", "value") VALUES (E'kok', E'konkani');
INSERT INTO "list" ("id", "value") VALUES (E'cop', E'koptiska');
INSERT INTO "list" ("id", "value") VALUES (E'ko', E'koreanska');
INSERT INTO "list" ("id", "value") VALUES (E'kw', E'korniska');
INSERT INTO "list" ("id", "value") VALUES (E'kfo', E'koro');
INSERT INTO "list" ("id", "value") VALUES (E'co', E'korsikanska');
INSERT INTO "list" ("id", "value") VALUES (E'kos', E'kosreanska');
INSERT INTO "list" ("id", "value") VALUES (E'avk', E'kotava');
INSERT INTO "list" ("id", "value") VALUES (E'kpe', E'kpelle');
INSERT INTO "list" ("id", "value") VALUES (E'crh', E'krimtatariska');
INSERT INTO "list" ("id", "value") VALUES (E'kri', E'Krio');
INSERT INTO "list" ("id", "value") VALUES (E'hr', E'kroatiska');
INSERT INTO "list" ("id", "value") VALUES (E'kj', E'kuanyama');
INSERT INTO "list" ("id", "value") VALUES (E'kum', E'kumykiska');
INSERT INTO "list" ("id", "value") VALUES (E'ku', E'kurdiska');
INSERT INTO "list" ("id", "value") VALUES (E'kru', E'kurukh');
INSERT INTO "list" ("id", "value") VALUES (E'kut', E'kutenaj');
INSERT INTO "list" ("id", "value") VALUES (E'nmg', E'kwasio');
INSERT INTO "list" ("id", "value") VALUES (E'cu', E'kyrkslaviska');
INSERT INTO "list" ("id", "value") VALUES (E'quc', E'kʼicheʼ');
INSERT INTO "list" ("id", "value") VALUES (E'ksh', E'kölniska');
INSERT INTO "list" ("id", "value") VALUES (E'lad', E'ladino');
INSERT INTO "list" ("id", "value") VALUES (E'lah', E'lahnda');
INSERT INTO "list" ("id", "value") VALUES (E'lkt', E'lakota');
INSERT INTO "list" ("id", "value") VALUES (E'lam', E'lamba');
INSERT INTO "list" ("id", "value") VALUES (E'lag', E'langi');
INSERT INTO "list" ("id", "value") VALUES (E'lo', E'laotiska');
INSERT INTO "list" ("id", "value") VALUES (E'la', E'latin');
INSERT INTO "list" ("id", "value") VALUES (E'es_419', E'latinamerikansk spanska');
INSERT INTO "list" ("id", "value") VALUES (E'lzz', E'Laz');
INSERT INTO "list" ("id", "value") VALUES (E'ltg', E'lettgalliska');
INSERT INTO "list" ("id", "value") VALUES (E'lv', E'lettiska');
INSERT INTO "list" ("id", "value") VALUES (E'lez', E'lezghien');
INSERT INTO "list" ("id", "value") VALUES (E'lij', E'liguriska');
INSERT INTO "list" ("id", "value") VALUES (E'li', E'limburgiska');
INSERT INTO "list" ("id", "value") VALUES (E'ln', E'lingala');
INSERT INTO "list" ("id", "value") VALUES (E'lfn', E'Lingua Franca Nova');
INSERT INTO "list" ("id", "value") VALUES (E'lt', E'litauiska');
INSERT INTO "list" ("id", "value") VALUES (E'lzh', E'Literary Chinese');
INSERT INTO "list" ("id", "value") VALUES (E'liv', E'livoniska');
INSERT INTO "list" ("id", "value") VALUES (E'jbo', E'lojban');
INSERT INTO "list" ("id", "value") VALUES (E'lmo', E'lombardiska');
INSERT INTO "list" ("id", "value") VALUES (E'loz', E'lozi');
INSERT INTO "list" ("id", "value") VALUES (E'lu', E'luba-katanga');
INSERT INTO "list" ("id", "value") VALUES (E'lua', E'luba-lulua');
INSERT INTO "list" ("id", "value") VALUES (E'lg', E'luganda');
INSERT INTO "list" ("id", "value") VALUES (E'luy', E'luhya');
INSERT INTO "list" ("id", "value") VALUES (E'lui', E'luiseño');
INSERT INTO "list" ("id", "value") VALUES (E'smj', E'lulesamiska');
INSERT INTO "list" ("id", "value") VALUES (E'lun', E'lunda');
INSERT INTO "list" ("id", "value") VALUES (E'luo', E'luo');
INSERT INTO "list" ("id", "value") VALUES (E'lus', E'lushai');
INSERT INTO "list" ("id", "value") VALUES (E'xog', E'lusoga');
INSERT INTO "list" ("id", "value") VALUES (E'lb', E'luxemburgiska');
INSERT INTO "list" ("id", "value") VALUES (E'sli', E'lågsilesiska');
INSERT INTO "list" ("id", "value") VALUES (E'dsb', E'lågsorbiska');
INSERT INTO "list" ("id", "value") VALUES (E'nds', E'lågtyska');
INSERT INTO "list" ("id", "value") VALUES (E'mde', E'maba');
INSERT INTO "list" ("id", "value") VALUES (E'mad', E'maduresiska');
INSERT INTO "list" ("id", "value") VALUES (E'maf', E'mafa');
INSERT INTO "list" ("id", "value") VALUES (E'mag', E'magahi');
INSERT INTO "list" ("id", "value") VALUES (E'vmf', E'Main-frankiska');
INSERT INTO "list" ("id", "value") VALUES (E'mai', E'maithili');
INSERT INTO "list" ("id", "value") VALUES (E'mak', E'makasar');
INSERT INTO "list" ("id", "value") VALUES (E'mk', E'makedonska');
INSERT INTO "list" ("id", "value") VALUES (E'mgh', E'makhuwa-meetto');
INSERT INTO "list" ("id", "value") VALUES (E'kde', E'makonde');
INSERT INTO "list" ("id", "value") VALUES (E'mg', E'malagassiska');
INSERT INTO "list" ("id", "value") VALUES (E'ms', E'malajiska');
INSERT INTO "list" ("id", "value") VALUES (E'ml', E'malayalam');
INSERT INTO "list" ("id", "value") VALUES (E'mt', E'maltesiska');
INSERT INTO "list" ("id", "value") VALUES (E'mnc', E'manchuriska');
INSERT INTO "list" ("id", "value") VALUES (E'mdr', E'mandar');
INSERT INTO "list" ("id", "value") VALUES (E'man', E'mande');
INSERT INTO "list" ("id", "value") VALUES (E'mni', E'manipuri');
INSERT INTO "list" ("id", "value") VALUES (E'gv', E'manx');
INSERT INTO "list" ("id", "value") VALUES (E'mi', E'maori');
INSERT INTO "list" ("id", "value") VALUES (E'mr', E'marathi');
INSERT INTO "list" ("id", "value") VALUES (E'chm', E'mariska');
INSERT INTO "list" ("id", "value") VALUES (E'ary', E'marockansk arabiska');
INSERT INTO "list" ("id", "value") VALUES (E'zgh', E'marockansk standard-tamazight');
INSERT INTO "list" ("id", "value") VALUES (E'mh', E'marshalliska');
INSERT INTO "list" ("id", "value") VALUES (E'mwr', E'marwari');
INSERT INTO "list" ("id", "value") VALUES (E'mas', E'massajiska');
INSERT INTO "list" ("id", "value") VALUES (E'mfe', E'mauritansk kreol');
INSERT INTO "list" ("id", "value") VALUES (E'mzn', E'mazanderani');
INSERT INTO "list" ("id", "value") VALUES (E'enm', E'medelengelska');
INSERT INTO "list" ("id", "value") VALUES (E'frm', E'medelfranska');
INSERT INTO "list" ("id", "value") VALUES (E'gmh', E'medelhögtyska');
INSERT INTO "list" ("id", "value") VALUES (E'mga', E'medeliriska');
INSERT INTO "list" ("id", "value") VALUES (E'dum', E'medelnederländska');
INSERT INTO "list" ("id", "value") VALUES (E'pal', E'medelpersiska');
INSERT INTO "list" ("id", "value") VALUES (E'men', E'mende');
INSERT INTO "list" ("id", "value") VALUES (E'pdt', E'mennonitisk lågtyska');
INSERT INTO "list" ("id", "value") VALUES (E'mwv', E'Mentawai');
INSERT INTO "list" ("id", "value") VALUES (E'mer', E'meru');
INSERT INTO "list" ("id", "value") VALUES (E'mgo', E'meta’');
INSERT INTO "list" ("id", "value") VALUES (E'es_MX', E'mexikansk spanska');
INSERT INTO "list" ("id", "value") VALUES (E'fit', E'meänkieli');
INSERT INTO "list" ("id", "value") VALUES (E'mic', E'mi’kmaq');
INSERT INTO "list" ("id", "value") VALUES (E'nan', E'min nan');
INSERT INTO "list" ("id", "value") VALUES (E'min', E'minangkabau');
INSERT INTO "list" ("id", "value") VALUES (E'xmf', E'Mingrelian');
INSERT INTO "list" ("id", "value") VALUES (E'mwl', E'mirandesiska');
INSERT INTO "list" ("id", "value") VALUES (E'kkj', E'mkako');
INSERT INTO "list" ("id", "value") VALUES (E'ar_001', E'modern standardarabiska');
INSERT INTO "list" ("id", "value") VALUES (E'moh', E'mohawk');
INSERT INTO "list" ("id", "value") VALUES (E'mdf', E'moksja');
INSERT INTO "list" ("id", "value") VALUES (E'ro_MD', E'moldaviska');
INSERT INTO "list" ("id", "value") VALUES (E'lol', E'mongo');
INSERT INTO "list" ("id", "value") VALUES (E'mn', E'mongoliska');
INSERT INTO "list" ("id", "value") VALUES (E'mos', E'mossi');
INSERT INTO "list" ("id", "value") VALUES (E'mua', E'mundang');
INSERT INTO "list" ("id", "value") VALUES (E'mus', E'muskogee');
INSERT INTO "list" ("id", "value") VALUES (E'ttt', E'Muslim Tat');
INSERT INTO "list" ("id", "value") VALUES (E'mye', E'myene');
INSERT INTO "list" ("id", "value") VALUES (E'nqo', E'n-kå');
INSERT INTO "list" ("id", "value") VALUES (E'naq', E'nama');
INSERT INTO "list" ("id", "value") VALUES (E'nap', E'napolitanska');
INSERT INTO "list" ("id", "value") VALUES (E'na', E'nauru');
INSERT INTO "list" ("id", "value") VALUES (E'nv', E'navaho');
INSERT INTO "list" ("id", "value") VALUES (E'ng', E'ndonga');
INSERT INTO "list" ("id", "value") VALUES (E'nl', E'nederländska');
INSERT INTO "list" ("id", "value") VALUES (E'ne', E'nepalesiska');
INSERT INTO "list" ("id", "value") VALUES (E'new', E'newariska');
INSERT INTO "list" ("id", "value") VALUES (E'sba', E'ngambay');
INSERT INTO "list" ("id", "value") VALUES (E'jgo', E'ngomba');
INSERT INTO "list" ("id", "value") VALUES (E'yrl', E'Nheengatu');
INSERT INTO "list" ("id", "value") VALUES (E'nia', E'nias');
INSERT INTO "list" ("id", "value") VALUES (E'niu', E'niueanska');
INSERT INTO "list" ("id", "value") VALUES (E'nog', E'nogai');
INSERT INTO "list" ("id", "value") VALUES (E'frr', E'nordfrisiska');
INSERT INTO "list" ("id", "value") VALUES (E'nd', E'nordndebele');
INSERT INTO "list" ("id", "value") VALUES (E'se', E'nordsamiska');
INSERT INTO "list" ("id", "value") VALUES (E'nso', E'nordsotho');
INSERT INTO "list" ("id", "value") VALUES (E'no', E'norska');
INSERT INTO "list" ("id", "value") VALUES (E'nb', E'norskt bokmål');
INSERT INTO "list" ("id", "value") VALUES (E'nov', E'Novial');
INSERT INTO "list" ("id", "value") VALUES (E'nus', E'nuer');
INSERT INTO "list" ("id", "value") VALUES (E'nym', E'nyamwezi');
INSERT INTO "list" ("id", "value") VALUES (E'ny', E'nyanja');
INSERT INTO "list" ("id", "value") VALUES (E'nyn', E'nyankole');
INSERT INTO "list" ("id", "value") VALUES (E'tog', E'nyasatonganska');
INSERT INTO "list" ("id", "value") VALUES (E'nn', E'nynorska');
INSERT INTO "list" ("id", "value") VALUES (E'nyo', E'nyoro');
INSERT INTO "list" ("id", "value") VALUES (E'nzi', E'nzima');
INSERT INTO "list" ("id", "value") VALUES (E'und', E'obestämt språk');
INSERT INTO "list" ("id", "value") VALUES (E'oc', E'occitanska');
INSERT INTO "list" ("id", "value") VALUES (E'oj', E'odjibwa');
INSERT INTO "list" ("id", "value") VALUES (E'or', E'oriya');
INSERT INTO "list" ("id", "value") VALUES (E'om', E'oromo');
INSERT INTO "list" ("id", "value") VALUES (E'osa', E'osage');
INSERT INTO "list" ("id", "value") VALUES (E'os', E'ossetiska');
INSERT INTO "list" ("id", "value") VALUES (E'ota', E'ottomanska');
INSERT INTO "list" ("id", "value") VALUES (E'pau', E'palau');
INSERT INTO "list" ("id", "value") VALUES (E'pi', E'pali');
INSERT INTO "list" ("id", "value") VALUES (E'pam', E'pampanga');
INSERT INTO "list" ("id", "value") VALUES (E'pag', E'pangasinan');
INSERT INTO "list" ("id", "value") VALUES (E'pap', E'papiamento');
INSERT INTO "list" ("id", "value") VALUES (E'pdc', E'Pennsylvaniatyska');
INSERT INTO "list" ("id", "value") VALUES (E'fa', E'persiska');
INSERT INTO "list" ("id", "value") VALUES (E'pfl', E'Pfalz-tyska');
INSERT INTO "list" ("id", "value") VALUES (E'pms', E'piemontesiska');
INSERT INTO "list" ("id", "value") VALUES (E'pcd', E'pikardiska');
INSERT INTO "list" ("id", "value") VALUES (E'pl', E'polska');
INSERT INTO "list" ("id", "value") VALUES (E'pon', E'ponape');
INSERT INTO "list" ("id", "value") VALUES (E'pnt', E'pontiska');
INSERT INTO "list" ("id", "value") VALUES (E'pt', E'portugisiska');
INSERT INTO "list" ("id", "value") VALUES (E'pa', E'punjabi');
INSERT INTO "list" ("id", "value") VALUES (E'qu', E'quechua');
INSERT INTO "list" ("id", "value") VALUES (E'raj', E'rajasthani');
INSERT INTO "list" ("id", "value") VALUES (E'rap', E'rapanui');
INSERT INTO "list" ("id", "value") VALUES (E'rar', E'rarotonganska');
INSERT INTO "list" ("id", "value") VALUES (E'rif', E'riffianska');
INSERT INTO "list" ("id", "value") VALUES (E'rgn', E'romagnol');
INSERT INTO "list" ("id", "value") VALUES (E'rom', E'romani');
INSERT INTO "list" ("id", "value") VALUES (E'rof', E'rombo');
INSERT INTO "list" ("id", "value") VALUES (E'root', E'rot');
INSERT INTO "list" ("id", "value") VALUES (E'rtm', E'rotumänska');
INSERT INTO "list" ("id", "value") VALUES (E'rug', E'rovianska');
INSERT INTO "list" ("id", "value") VALUES (E'ro', E'rumänska');
INSERT INTO "list" ("id", "value") VALUES (E'rn', E'rundi');
INSERT INTO "list" ("id", "value") VALUES (E'rue', E'rusyn');
INSERT INTO "list" ("id", "value") VALUES (E'rwk', E'rwa');
INSERT INTO "list" ("id", "value") VALUES (E'ru', E'ryska');
INSERT INTO "list" ("id", "value") VALUES (E'rm', E'rätoromanska');
INSERT INTO "list" ("id", "value") VALUES (E'ssy', E'saho');
INSERT INTO "list" ("id", "value") VALUES (E'sam', E'samaritanska');
INSERT INTO "list" ("id", "value") VALUES (E'saq', E'samburu');
INSERT INTO "list" ("id", "value") VALUES (E'sm', E'samoanska');
INSERT INTO "list" ("id", "value") VALUES (E'sgs', E'samogitiska');
INSERT INTO "list" ("id", "value") VALUES (E'sad', E'sandawe');
INSERT INTO "list" ("id", "value") VALUES (E'sg', E'sango');
INSERT INTO "list" ("id", "value") VALUES (E'sbp', E'sangu');
INSERT INTO "list" ("id", "value") VALUES (E'sa', E'sanskrit');
INSERT INTO "list" ("id", "value") VALUES (E'sat', E'santali');
INSERT INTO "list" ("id", "value") VALUES (E'sc', E'sardiska');
INSERT INTO "list" ("id", "value") VALUES (E'sas', E'sasak');
INSERT INTO "list" ("id", "value") VALUES (E'sdc', E'sassaresisk sardiska');
INSERT INTO "list" ("id", "value") VALUES (E'stq', E'saterfrisiska');
INSERT INTO "list" ("id", "value") VALUES (E'saz', E'saurashtra');
INSERT INTO "list" ("id", "value") VALUES (E'gsw', E'schweizertyska');
INSERT INTO "list" ("id", "value") VALUES (E'fr_CH', E'schweizisk franska');
INSERT INTO "list" ("id", "value") VALUES (E'de_CH', E'schweizisk högtyska');
INSERT INTO "list" ("id", "value") VALUES (E'sly', E'Selayar');
INSERT INTO "list" ("id", "value") VALUES (E'sel', E'selkup');
INSERT INTO "list" ("id", "value") VALUES (E'seh', E'sena');
INSERT INTO "list" ("id", "value") VALUES (E'see', E'seneca');
INSERT INTO "list" ("id", "value") VALUES (E'sr', E'serbiska');
INSERT INTO "list" ("id", "value") VALUES (E'sh', E'serbokroatiska');
INSERT INTO "list" ("id", "value") VALUES (E'srr', E'serer');
INSERT INTO "list" ("id", "value") VALUES (E'sei', E'Seri');
INSERT INTO "list" ("id", "value") VALUES (E'shn', E'shan');
INSERT INTO "list" ("id", "value") VALUES (E'swb', E'shimaoré');
INSERT INTO "list" ("id", "value") VALUES (E'sn', E'shona');
INSERT INTO "list" ("id", "value") VALUES (E'scn', E'sicilianska');
INSERT INTO "list" ("id", "value") VALUES (E'sid', E'sidamo');
INSERT INTO "list" ("id", "value") VALUES (E'bla', E'siksika');
INSERT INTO "list" ("id", "value") VALUES (E'szl', E'silesiska');
INSERT INTO "list" ("id", "value") VALUES (E'sd', E'sindhi');
INSERT INTO "list" ("id", "value") VALUES (E'si', E'singalesiska');
INSERT INTO "list" ("id", "value") VALUES (E'sms', E'skoltsamiska');
INSERT INTO "list" ("id", "value") VALUES (E'gd', E'skotsk gäliska');
INSERT INTO "list" ("id", "value") VALUES (E'sco', E'skotska');
INSERT INTO "list" ("id", "value") VALUES (E'den', E'slavej');
INSERT INTO "list" ("id", "value") VALUES (E'sk', E'slovakiska');
INSERT INTO "list" ("id", "value") VALUES (E'sl', E'slovenska');
INSERT INTO "list" ("id", "value") VALUES (E'sog', E'sogdiska');
INSERT INTO "list" ("id", "value") VALUES (E'so', E'somaliska');
INSERT INTO "list" ("id", "value") VALUES (E'snk', E'soninke');
INSERT INTO "list" ("id", "value") VALUES (E'ckb', E'soranisk kurdiska');
INSERT INTO "list" ("id", "value") VALUES (E'es', E'spanska');
INSERT INTO "list" ("id", "value") VALUES (E'srn', E'sranan tongo');
INSERT INTO "list" ("id", "value") VALUES (E'suk', E'sukuma');
INSERT INTO "list" ("id", "value") VALUES (E'sux', E'sumeriska');
INSERT INTO "list" ("id", "value") VALUES (E'su', E'sundanesiska');
INSERT INTO "list" ("id", "value") VALUES (E'sus', E'susu');
INSERT INTO "list" ("id", "value") VALUES (E'sv', E'svenska');
INSERT INTO "list" ("id", "value") VALUES (E'sw', E'swahili');
INSERT INTO "list" ("id", "value") VALUES (E'ss', E'swati');
INSERT INTO "list" ("id", "value") VALUES (E'alt', E'sydaltaiska');
INSERT INTO "list" ("id", "value") VALUES (E'azb', E'sydazerbadjanska');
INSERT INTO "list" ("id", "value") VALUES (E'nr', E'sydndebele');
INSERT INTO "list" ("id", "value") VALUES (E'sma', E'sydsamiska');
INSERT INTO "list" ("id", "value") VALUES (E'st', E'sydsotho');
INSERT INTO "list" ("id", "value") VALUES (E'syr', E'syriska');
INSERT INTO "list" ("id", "value") VALUES (E'ii', E'szezuan i');
INSERT INTO "list" ("id", "value") VALUES (E'shi', E'tachelhit');
INSERT INTO "list" ("id", "value") VALUES (E'tg', E'tadzjikiska');
INSERT INTO "list" ("id", "value") VALUES (E'tl', E'tagalog');
INSERT INTO "list" ("id", "value") VALUES (E'ty', E'tahitiska');
INSERT INTO "list" ("id", "value") VALUES (E'dav', E'taita');
INSERT INTO "list" ("id", "value") VALUES (E'tly', E'talysh');
INSERT INTO "list" ("id", "value") VALUES (E'tmh', E'tamashek');
INSERT INTO "list" ("id", "value") VALUES (E'ta', E'tamil');
INSERT INTO "list" ("id", "value") VALUES (E'trv', E'taroko');
INSERT INTO "list" ("id", "value") VALUES (E'twq', E'tasawaq');
INSERT INTO "list" ("id", "value") VALUES (E'tt', E'tatariska');
INSERT INTO "list" ("id", "value") VALUES (E'te', E'telugiska');
INSERT INTO "list" ("id", "value") VALUES (E'tem', E'temne');
INSERT INTO "list" ("id", "value") VALUES (E'ter', E'tereno');
INSERT INTO "list" ("id", "value") VALUES (E'teo', E'teso');
INSERT INTO "list" ("id", "value") VALUES (E'tet', E'tetum');
INSERT INTO "list" ("id", "value") VALUES (E'th', E'thailändska');
INSERT INTO "list" ("id", "value") VALUES (E'bo', E'tibetanska');
INSERT INTO "list" ("id", "value") VALUES (E'tig', E'tigré');
INSERT INTO "list" ("id", "value") VALUES (E'ti', E'tigrinja');
INSERT INTO "list" ("id", "value") VALUES (E'khq', E'Timbuktu-songhoy');
INSERT INTO "list" ("id", "value") VALUES (E'tiv', E'tivi');
INSERT INTO "list" ("id", "value") VALUES (E'cs', E'tjeckiska');
INSERT INTO "list" ("id", "value") VALUES (E'ce', E'tjetjenska');
INSERT INTO "list" ("id", "value") VALUES (E'cv', E'tjuvasjiska');
INSERT INTO "list" ("id", "value") VALUES (E'tli', E'tlingit');
INSERT INTO "list" ("id", "value") VALUES (E'tpi', E'tok pisin');
INSERT INTO "list" ("id", "value") VALUES (E'tkl', E'tokelauiska');
INSERT INTO "list" ("id", "value") VALUES (E'to', E'tonganska');
INSERT INTO "list" ("id", "value") VALUES (E'zh_Hant', E'traditionell kinesiska');
INSERT INTO "list" ("id", "value") VALUES (E'tkr', E'Tsakhur');
INSERT INTO "list" ("id", "value") VALUES (E'tsd', E'tsakodiska');
INSERT INTO "list" ("id", "value") VALUES (E'tsi', E'tsimshian');
INSERT INTO "list" ("id", "value") VALUES (E'ts', E'tsonga');
INSERT INTO "list" ("id", "value") VALUES (E'tn', E'tswana');
INSERT INTO "list" ("id", "value") VALUES (E'tcy', E'tulu');
INSERT INTO "list" ("id", "value") VALUES (E'tum', E'tumbuka');
INSERT INTO "list" ("id", "value") VALUES (E'aeb', E'tunisisk arabiska');
INSERT INTO "list" ("id", "value") VALUES (E'tr', E'turkiska');
INSERT INTO "list" ("id", "value") VALUES (E'tk', E'turkmeniska');
INSERT INTO "list" ("id", "value") VALUES (E'tru', E'Turoyo');
INSERT INTO "list" ("id", "value") VALUES (E'tvl', E'tuvaluanska');
INSERT INTO "list" ("id", "value") VALUES (E'tyv', E'tuviniska');
INSERT INTO "list" ("id", "value") VALUES (E'tw', E'twi');
INSERT INTO "list" ("id", "value") VALUES (E'kcg', E'tyap');
INSERT INTO "list" ("id", "value") VALUES (E'de', E'tyska');
INSERT INTO "list" ("id", "value") VALUES (E'udm', E'udmurtiska');
INSERT INTO "list" ("id", "value") VALUES (E'uga', E'ugaritiska');
INSERT INTO "list" ("id", "value") VALUES (E'ug', E'uiguriska');
INSERT INTO "list" ("id", "value") VALUES (E'uk', E'ukrainska');
INSERT INTO "list" ("id", "value") VALUES (E'umb', E'umbundu');
INSERT INTO "list" ("id", "value") VALUES (E'hu', E'ungerska');
INSERT INTO "list" ("id", "value") VALUES (E'ur', E'urdu');
INSERT INTO "list" ("id", "value") VALUES (E'uz', E'uzbekiska');
INSERT INTO "list" ("id", "value") VALUES (E'vai', E'vaj');
INSERT INTO "list" ("id", "value") VALUES (E'wa', E'vallonska');
INSERT INTO "list" ("id", "value") VALUES (E've', E'venda');
INSERT INTO "list" ("id", "value") VALUES (E'vec', E'venetianska');
INSERT INTO "list" ("id", "value") VALUES (E'vep', E'veps');
INSERT INTO "list" ("id", "value") VALUES (E'vi', E'vietnamesiska');
INSERT INTO "list" ("id", "value") VALUES (E'be', E'vitryska');
INSERT INTO "list" ("id", "value") VALUES (E'vo', E'volapük');
INSERT INTO "list" ("id", "value") VALUES (E'vro', E'võru');
INSERT INTO "list" ("id", "value") VALUES (E'vot', E'votiska');
INSERT INTO "list" ("id", "value") VALUES (E'vun', E'vunjo');
INSERT INTO "list" ("id", "value") VALUES (E'vls', E'västflamländska');
INSERT INTO "list" ("id", "value") VALUES (E'fy', E'västfrisiska');
INSERT INTO "list" ("id", "value") VALUES (E'mrj', E'västmariska');
INSERT INTO "list" ("id", "value") VALUES (E'wal', E'walamo');
INSERT INTO "list" ("id", "value") VALUES (E'cy', E'walesiska');
INSERT INTO "list" ("id", "value") VALUES (E'wae', E'walsertyska');
INSERT INTO "list" ("id", "value") VALUES (E'war', E'waray');
INSERT INTO "list" ("id", "value") VALUES (E'wbp', E'Warlpiri');
INSERT INTO "list" ("id", "value") VALUES (E'was', E'washo');
INSERT INTO "list" ("id", "value") VALUES (E'guc', E'Wayuu');
INSERT INTO "list" ("id", "value") VALUES (E'wo', E'wolof');
INSERT INTO "list" ("id", "value") VALUES (E'wuu', E'wu');
INSERT INTO "list" ("id", "value") VALUES (E'xh', E'xhosa');
INSERT INTO "list" ("id", "value") VALUES (E'hsn', E'xiang');
INSERT INTO "list" ("id", "value") VALUES (E'yav', E'yangben');
INSERT INTO "list" ("id", "value") VALUES (E'yo', E'yoruba');
INSERT INTO "list" ("id", "value") VALUES (E'zap', E'zapotek');
INSERT INTO "list" ("id", "value") VALUES (E'dje', E'zarma');
INSERT INTO "list" ("id", "value") VALUES (E'zza', E'zazaiska');
INSERT INTO "list" ("id", "value") VALUES (E'zea', E'zeeländska');
INSERT INTO "list" ("id", "value") VALUES (E'zen', E'zenaga');
INSERT INTO "list" ("id", "value") VALUES (E'za', E'zhuang');
INSERT INTO "list" ("id", "value") VALUES (E'gbz', E'zoroastrisk dari');
INSERT INTO "list" ("id", "value") VALUES (E'zu', E'zulu');
INSERT INTO "list" ("id", "value") VALUES (E'zun', E'zuni');
INSERT INTO "list" ("id", "value") VALUES (E'de_AT', E'österrikisk tyska');
INSERT INTO "list" ("id", "value") VALUES (E'frs', E'östfrisiska');
| 65.369281 | 89 | 0.616932 |
4a7976c0888d7ab9003fb779b21d39cf0d1c44f4 | 405 | html | HTML | app/templates/dl_form.html | thebluesnevrdie/online-ldap-password-changer | 0cef0aa521baba105ebf6785f29a50b21383b82a | [
"BSD-3-Clause"
] | null | null | null | app/templates/dl_form.html | thebluesnevrdie/online-ldap-password-changer | 0cef0aa521baba105ebf6785f29a50b21383b82a | [
"BSD-3-Clause"
] | null | null | null | app/templates/dl_form.html | thebluesnevrdie/online-ldap-password-changer | 0cef0aa521baba105ebf6785f29a50b21383b82a | [
"BSD-3-Clause"
] | null | null | null | <% extends "index.html" %>
<% block head %>
<< super() >>
<%endblock %>
<% block body %>
<div class="container">
<h3>Welcome << displayname >></h3>
<p>Click below to download your VPN config
<div class="element-box container-box">
<a href="/<< token >>/Download">
<button class="btn btn-danger">
<span>Download</span>
</button>
</a>
</div>
</div>
<% endblock %>
| 21.315789 | 48 | 0.562963 |
7223898470cc6f0265ca38674fd82f3e23423be8 | 5,946 | rs | Rust | src/lib.rs | wfraser/dc4 | c5c33bb7227c15f15b04a43b41d6836f086e7c0d | [
"Apache-2.0",
"MIT"
] | 4 | 2019-01-09T16:58:22.000Z | 2021-12-05T02:01:55.000Z | src/lib.rs | wfraser/dc4 | c5c33bb7227c15f15b04a43b41d6836f086e7c0d | [
"Apache-2.0",
"MIT"
] | null | null | null | src/lib.rs | wfraser/dc4 | c5c33bb7227c15f15b04a43b41d6836f086e7c0d | [
"Apache-2.0",
"MIT"
] | null | null | null | //
// dc4 :: A Unix dc(1) implementation in Rust
//
// Copyright (c) 2015-2021 by William R. Fraser
//
#![deny(rust_2018_idioms)]
mod big_real;
mod dcregisters;
pub mod parser;
mod reader_parser;
mod state;
use parser::Action;
use state::Dc4State;
use std::io::{BufRead, Write};
/// Desk Calculator 4
pub struct Dc4 {
state: Dc4State,
}
impl Dc4 {
/// Make a new DC4 instance with the given name.
pub fn new(program_name: String) -> Self {
Self { state: Dc4State::new(program_name) }
}
/// Run a program from a stream of bytes.
///
/// This consumes the entire stream. Errors do not stop the program; they are written to
/// output, but execution continues.
pub fn stream(&mut self, r: &mut impl BufRead, w: &mut impl Write) -> DcResult
{
let mut actions = reader_parser::ReaderParser::new(r);
// There's no safe way to stop mid-stream on an error, because ReaderParser may have read
// the source stream past the action that caused it, and so returning from here could lose
// data from the source stream. So you can't really make a `try_stream()` that doesn't do
// this.
loop {
match self.actions(&mut actions, w) {
Err(e) => self.state.error(w, format_args!("{}", e)),
Ok(result) => return result,
}
}
}
/// Run a given program text as if it was a macro.
///
/// Errors do not stop the program; they are written to output, but execution continues.
pub fn text(&mut self, text: impl Into<Vec<u8>>, w: &mut impl Write) -> DcResult {
self.state.run_macro(text.into(), w)
}
/// Run a program from an iterator of actions.
///
/// Stops on the first error encountered.
pub fn actions(&mut self, actions: impl Iterator<Item = Action>, w: &mut impl Write)
-> Result<DcResult, DcError>
{
for action in actions {
let mut result = self.state.action(action, w);
if let Ok(DcResult::Macro(text)) = result {
result = Ok(self.state.run_macro(text, w));
}
match result {
Ok(DcResult::Continue) => (),
Ok(DcResult::QuitLevels(_)) => (), // 'Q' mustn't exit the top level
Ok(other) => return Ok(other),
Err(e) => return Err(e),
}
}
Ok(DcResult::Continue)
}
/// Convenience function for pushing a number onto the stack. Returns Err if the given string
/// is not a valid number.
pub fn push_number(&mut self, input: impl AsRef<[u8]>) -> Result<(), DcError> {
self.state.push_number(input)
}
/// Convenience function for pushing a string directly onto the stack (rather than running
/// Action::StringChar for each byte, followed by Action::PushString).
pub fn push_string(&mut self, string: impl Into<Vec<u8>>) {
self.state.push_string(string)
}
/// Run a single action.
///
/// Any output gets written to the given writer.
///
/// Errors get returned to the caller and are not written to the writer, but any warnings will
/// get written as output.
pub fn action(&mut self, action: Action, w: &mut impl Write) -> Result<DcResult, DcError> {
self.state.action(action, w)
}
}
#[derive(Clone, Debug)]
pub enum DcValue {
Str(Vec<u8>),
Num(big_real::BigReal)
}
#[derive(Debug)]
pub enum DcResult {
Terminate(u32),
QuitLevels(u32),
Continue,
Macro(Vec<u8>),
}
#[derive(Debug)]
pub enum DcError {
ArrayIndexInvalid,
DivideByZero,
InputError(std::io::Error),
InputRadixInvalid,
NegativeExponent,
NonNumericValue,
OutputRadixInvalid,
QuitInvalid,
QuitTooBig,
RegisterEmpty(u8),
RemainderByZero,
ScaleInvalid,
ScaleTooBig,
ShellUnsupported,
SqrtNegative,
SqrtNonNumeric,
StackEmpty,
StackRegisterEmpty(u8),
UnexpectedNumberChar(u8),
Unimplemented(u8),
}
impl std::fmt::Display for DcError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use DcError::*;
// error messages should match those from GNU dc as much as possible
match self {
ArrayIndexInvalid => f.write_str("array index must be a nonnegative integer"),
DivideByZero => f.write_str("divide by zero"),
InputError(e) => write!(f, "error reading input: {}", e),
InputRadixInvalid => f.write_str("input base must be a number between 2 and 16 (inclusive)"),
NegativeExponent => f.write_str("negative exponent"),
NonNumericValue => f.write_str("non-numeric value"),
OutputRadixInvalid => f.write_str("output base must be a number between 2 and 16 (inclusive)"),
QuitInvalid => f.write_str("Q command requires a number >= 1"),
QuitTooBig => f.write_str("quit levels out of range (must fit into 32 bits)"),
RegisterEmpty(r) => write!(f, "register '{}' (0{:o}) is empty", *r as char, r),
RemainderByZero => f.write_str("remainder by zero"),
ScaleInvalid => f.write_str("scale must be a nonnegative integer"),
ScaleTooBig => f.write_str("scale must fit into 32 bits"),
ShellUnsupported => f.write_str("running shell commands is not supported"),
SqrtNegative => f.write_str("square root of negative number"),
SqrtNonNumeric => f.write_str("square root of nonnumeric attempted"),
StackEmpty => f.write_str("stack empty"),
StackRegisterEmpty(r) => write!(f, "stack register '{}' (0{:o}) is empty", *r as char, r),
UnexpectedNumberChar(c) => write!(f, "unexpected character in number: {:?}", *c as char),
Unimplemented(c) => write!(f, "{:?} (0{:o}) unimplemented", *c as char, c),
}
}
}
impl std::error::Error for DcError {}
| 35.392857 | 107 | 0.608476 |
7e803b8e7bcc9e107859616cb8e15500989b9a07 | 5,215 | dart | Dart | example/lib/main.dart | yxwandroid/Flutter-AssetsAudioPlayer | a4959bd28569bfe74ba83ad55dd320a54a4e6bae | [
"Apache-2.0"
] | null | null | null | example/lib/main.dart | yxwandroid/Flutter-AssetsAudioPlayer | a4959bd28569bfe74ba83ad55dd320a54a4e6bae | [
"Apache-2.0"
] | null | null | null | example/lib/main.dart | yxwandroid/Flutter-AssetsAudioPlayer | a4959bd28569bfe74ba83ad55dd320a54a4e6bae | [
"Apache-2.0"
] | null | null | null | import 'package:flutter/material.dart';
import 'package:assets_audio_player/assets_audio_player.dart';
import 'asset_audio_player_icons.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final assets = <String>[
"song1.mp3",
"song2.mp3",
"song3.mp3",
];
final AssetsAudioPlayer _assetsAudioPlayer = AssetsAudioPlayer();
var _currentAssetPosition = -1;
void _open(int assetIndex) {
_currentAssetPosition = assetIndex % assets.length;
_assetsAudioPlayer.open(
AssetsAudio(
asset: assets[_currentAssetPosition],
folder: "assets/audios/",
),
);
}
void _playPause() {
_assetsAudioPlayer.playOrPause();
}
void _next() {
_currentAssetPosition++;
_open(_currentAssetPosition);
}
void _prev() {
_currentAssetPosition--;
_open(_currentAssetPosition);
}
@override
void dispose() {
_assetsAudioPlayer.stop();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Padding(
padding: const EdgeInsets.only(bottom: 48.0),
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: StreamBuilder(
stream: _assetsAudioPlayer.current,
initialData: const PlayingAudio(),
builder: (BuildContext context,
AsyncSnapshot<PlayingAudio> snapshot) {
final PlayingAudio currentAudio = snapshot.data;
return ListView.builder(
itemBuilder: (context, position) {
return ListTile(
title: Text(assets[position],
style: TextStyle(
color: assets[position] ==
currentAudio.assetAudio.asset
? Colors.blue
: Colors.black)),
onTap: () {
_open(position);
});
},
itemCount: assets.length,
);
},
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
StreamBuilder(
stream: _assetsAudioPlayer.currentPosition,
initialData: const Duration(),
builder: (BuildContext context,
AsyncSnapshot<Duration> snapshot) {
Duration duration = snapshot.data;
return Text(durationToString(duration));
},
),
Text(" - "),
StreamBuilder(
stream: _assetsAudioPlayer.current,
builder: (BuildContext context,
AsyncSnapshot<PlayingAudio> snapshot) {
Duration duration = Duration();
if (snapshot.hasData) {
duration = snapshot.data.duration;
}
return Text(durationToString(duration));
},
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
IconButton(
onPressed: _prev,
icon: Icon(AssetAudioPlayerIcons.to_start),
),
StreamBuilder(
stream: _assetsAudioPlayer.isPlaying,
initialData: false,
builder:
(BuildContext context, AsyncSnapshot<bool> snapshot) {
return IconButton(
onPressed: _playPause,
icon: Icon(snapshot.data
? AssetAudioPlayerIcons.pause
: AssetAudioPlayerIcons.play),
);
},
),
IconButton(
icon: Icon(AssetAudioPlayerIcons.to_end),
onPressed: _next,
),
],
),
],
),
),
),
);
}
}
String durationToString(Duration duration) {
String twoDigits(int n) {
if (n >= 10) return "$n";
return "0$n";
}
String twoDigitMinutes =
twoDigits(duration.inMinutes.remainder(Duration.minutesPerHour));
String twoDigitSeconds =
twoDigits(duration.inSeconds.remainder(Duration.secondsPerMinute));
return "$twoDigitMinutes:$twoDigitSeconds";
} | 31.606061 | 78 | 0.482646 |
0bb8ff4a1df7d5be76576cd453cdd215e21cee00 | 340 | js | JavaScript | src/components/Notification/Notification.js | YermakovaDina/goit-react-hw-02-feedback | 4cb362c9bd2e43a141e63a343be9b7fd877269fe | [
"MIT"
] | null | null | null | src/components/Notification/Notification.js | YermakovaDina/goit-react-hw-02-feedback | 4cb362c9bd2e43a141e63a343be9b7fd877269fe | [
"MIT"
] | null | null | null | src/components/Notification/Notification.js | YermakovaDina/goit-react-hw-02-feedback | 4cb362c9bd2e43a141e63a343be9b7fd877269fe | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
const Notification = ({ message }) => {
return (
<div className="NotificationWrapper">
<h1>{message}</h1>
</div>
);
};
Notification.propTypes = {
message: PropTypes.string,
};
Notification.defaultProps = {
message: '',
};
export default Notification;
| 16.190476 | 41 | 0.652941 |
80b05ce368a00894c4e8685fba070b5dbe5ba957 | 813 | java | Java | core/src/com/bressio/rendezvous/entities/objects/equipment/helmets/HalfHelmet.java | bressio/Rendezvous | ac8b79af0d5c2ad93ae69f654e91175ff6f30e8d | [
"MIT"
] | null | null | null | core/src/com/bressio/rendezvous/entities/objects/equipment/helmets/HalfHelmet.java | bressio/Rendezvous | ac8b79af0d5c2ad93ae69f654e91175ff6f30e8d | [
"MIT"
] | null | null | null | core/src/com/bressio/rendezvous/entities/objects/equipment/helmets/HalfHelmet.java | bressio/Rendezvous | ac8b79af0d5c2ad93ae69f654e91175ff6f30e8d | [
"MIT"
] | 2 | 2020-04-29T17:51:24.000Z | 2020-11-21T02:47:42.000Z | package com.bressio.rendezvous.entities.objects.equipment.helmets;
import com.bressio.rendezvous.entities.Soldier;
import com.bressio.rendezvous.graphics.ResourceHandler;
import com.bressio.rendezvous.scenes.Match;
public class HalfHelmet extends Helmet {
public HalfHelmet(Match match) {
super(match);
setAttributes();
}
@Override
public void updateName() {
setName(getI18n().getBundle().get("halfHelmet") + " (" + getArmorPoints() + "%)");
}
@Override
public boolean transformSoldier(Soldier soldier) {
return false;
}
private void setAttributes() {
setIcon(getResources().getTexture(ResourceHandler.TexturePath.HALF_HELMET));
setArmorPoints(30);
takeDamage(0);
setRarity(9);
updateName();
}
} | 26.225806 | 90 | 0.670357 |
f0ded729fe6dc373dff7177dafbf3f29617c92ea | 3,520 | kt | Kotlin | src/main/kotlin/com/expansemc/township/plugin/command/executor/HelpCommand.kt | ExpanseMC/township | 3c02ce5e155519124c5bb4b915d5704253454ce7 | [
"MIT"
] | null | null | null | src/main/kotlin/com/expansemc/township/plugin/command/executor/HelpCommand.kt | ExpanseMC/township | 3c02ce5e155519124c5bb4b915d5704253454ce7 | [
"MIT"
] | null | null | null | src/main/kotlin/com/expansemc/township/plugin/command/executor/HelpCommand.kt | ExpanseMC/township | 3c02ce5e155519124c5bb4b915d5704253454ce7 | [
"MIT"
] | null | null | null | package com.expansemc.township.plugin.command.executor
import com.expansemc.township.plugin.util.TextUI
import com.expansemc.township.plugin.util.unwrap
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.TextComponent
import net.kyori.adventure.text.format.NamedTextColor
import org.spongepowered.api.command.Command
import org.spongepowered.api.command.CommandCause
import org.spongepowered.api.command.CommandExecutor
import org.spongepowered.api.command.CommandResult
import org.spongepowered.api.command.parameter.CommandContext
import org.spongepowered.api.command.parameter.Parameter
import org.spongepowered.api.service.pagination.PaginationList
class HelpCommand(
private val title: String,
private val baseAlias: String? = null,
) : CommandExecutor {
override fun execute(context: CommandContext): CommandResult {
val command: Command.Parameterized = context.executedCommand.unwrap()
?: return CommandResult.error(TextComponent.of("Unknown command being executed."))
val pagination: PaginationList = TextUI.pagination(title) {
command.subcommands()
.sortedBy(this@HelpCommand::getAlias)
.mapNotNullTo(destination = this) { sub: Parameter.Subcommand ->
val subAlias: String = sub.aliases.maxByOrNull { it.length } ?: return@mapNotNullTo null
val alias: String = if (baseAlias != null) "$baseAlias $subAlias" else subAlias
val usage: TextComponent = getUsage(sub.command, context.cause)
TextComponent.builder("- /", NamedTextColor.GRAY)
.append("$alias ", NamedTextColor.WHITE)
.append(usage)
.build()
}
}
pagination.sendTo(context.cause.audience)
return CommandResult.success()
}
private fun getUsage(command: Command.Parameterized, cause: CommandCause): TextComponent =
when {
command.parameters().isNotEmpty() -> {
// We have parameters to get the usage of.
val params: List<Component> = command.parameters()
.mapNotNull { parameter: Parameter ->
val usage: Component = (parameter as? Parameter.Value<*>)?.getUsage(cause) ?: return@mapNotNull null
when {
parameter.isOptional -> usage
else -> TextComponent.builder("<").append(usage).append(">").build()
}
}
TextComponent.join(TextComponent.space(), params).color(NamedTextColor.YELLOW)
}
command.subcommands().isNotEmpty() -> {
// We have subcommands to create usage from.
val subcommands: List<TextComponent> = command.subcommands()
.sortedBy(this::getAlias)
.mapNotNull { subcommand: Parameter.Subcommand ->
val alias: String = getAlias(subcommand) ?: return@mapNotNull null
TextComponent.of(alias)
}
TextComponent.join(TextComponent.of(" | "), subcommands).color(NamedTextColor.AQUA)
}
else -> {
// Nothing to create usage from.
TextComponent.empty()
}
}
private fun getAlias(subcommand: Parameter.Subcommand): String? =
subcommand.aliases.maxByOrNull { it.length }
} | 45.128205 | 124 | 0.619034 |
26ad4b0a88530bfd3e69ef16b6197bc2fa901279 | 3,992 | java | Java | src/main/java/io/parallec/core/util/PcDateUtils.java | fansaien/parallec | 1b4f1628f34fedfb06b24c33a5372d64d3df0952 | [
"Apache-2.0"
] | 878 | 2015-11-02T07:59:51.000Z | 2022-03-01T03:57:55.000Z | src/main/java/io/parallec/core/util/PcDateUtils.java | juliomoral2000/parallec | 1b4f1628f34fedfb06b24c33a5372d64d3df0952 | [
"Apache-2.0"
] | 89 | 2015-11-03T02:06:32.000Z | 2018-10-26T05:01:04.000Z | src/main/java/io/parallec/core/util/PcDateUtils.java | juliomoral2000/parallec | 1b4f1628f34fedfb06b24c33a5372d64d3df0952 | [
"Apache-2.0"
] | 205 | 2015-11-03T02:03:35.000Z | 2022-02-19T09:45:41.000Z | /*
Copyright [2013-2015] eBay Software Foundation
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.parallec.core.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class PcDateUtils.
*/
public class PcDateUtils {
/** The logger. */
private static Logger logger = LoggerFactory.getLogger(PcDateUtils.class);
/**
* Gets the date time str.
*
* @param d
* the d
* @return the date time str
*/
public static String getDateTimeStr(Date d) {
if (d == null)
return "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
// 20140315 test will problem +0000
return sdf.format(d);
}
/**
* Gets the date time str standard.
*
* @param d
* the d
* @return the date time str standard
*/
public static String getDateTimeStrStandard(Date d) {
if (d == null)
return "";
if (d.getTime() == 0L)
return "Never";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss.SSSZ");
return sdf.format(d);
}
/**
* Gets the date time str concise.
*
* @param d
* the d
* @return the date time str concise
*/
public static String getDateTimeStrConcise(Date d) {
if (d == null)
return "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSSZ");
return sdf.format(d);
}
/**
* 20141027: same as getDateTimeStrConcise but no timezone.
*
* @param d
* the d
* @return the date time str concise no zone
*/
public static String getDateTimeStrConciseNoZone(Date d) {
if (d == null)
return "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
return sdf.format(d);
}
/**
* 20130512 Converts the sdsm string generated above to Date format.
*
* @param str
* the str
* @return the date from concise str
*/
public static Date getDateFromConciseStr(String str) {
Date d = null;
if (str == null || str.isEmpty())
return null;
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSSZ");
d = sdf.parse(str);
} catch (Exception ex) {
logger.error(ex + "Exception while converting string to date : "
+ str);
}
return d;
}
/**
* Gets the now date time str.
*
* @return the now date time str
*/
public static String getNowDateTimeStr() {
return getDateTimeStr(new Date());
}
/**
* Gets the now date time str standard.
*
* @return the now date time str standard
*/
public static String getNowDateTimeStrStandard() {
return getDateTimeStrStandard(new Date());
}
/**
* Gets the now date time str concise.
*
* @return the now date time str concise
*/
public static String getNowDateTimeStrConcise() {
return getDateTimeStrConcise(new Date());
}
/**
* Gets the now date time str concise no zone.
*
* @return the now date time str concise no zone
*/
public static String getNowDateTimeStrConciseNoZone() {
return getDateTimeStrConciseNoZone(new Date());
}
}
| 24.795031 | 80 | 0.596192 |