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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a448b7d05d2b1ac348d37fcdc4a61f3903012fb8
| 1,042
|
php
|
PHP
|
app/Models/SalesTicket.php
|
kingkpono/cspa
|
e4f92a50187432b5396a495781e40a9c218dc3a2
|
[
"MIT"
] | null | null | null |
app/Models/SalesTicket.php
|
kingkpono/cspa
|
e4f92a50187432b5396a495781e40a9c218dc3a2
|
[
"MIT"
] | null | null | null |
app/Models/SalesTicket.php
|
kingkpono/cspa
|
e4f92a50187432b5396a495781e40a9c218dc3a2
|
[
"MIT"
] | null | null | null |
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Model;
class SalesTicket extends Model
{
use Notifiable;
protected $fillable = [
'client_id', 'service_type_id' ,'device','serial_number',
'device_description', 'ticket_contact_email', 'ticket_contact_phone','device_warranty','project_details', 'start_date','end_date',
'status','officer1','officer2','officer3', 'attachment'];
public function client()
{
return $this->belongsTo('App\Models\Client');
}
public function serviceType()
{
return $this->belongsTo('App\Models\ServiceType', 'service_type_id');
}
public function officer1()
{
return $this->belongsTo('App\Models\Auth\User', 'officer1');
}
public function officer2()
{
return $this->belongsTo('App\Models\Auth\User','officer2');
}
public function officer3()
{
return $this->belongsTo('App\Models\Auth\User','officer3');
}
}
| 23.155556
| 138
| 0.642035
|
2fc395eba8c035561a54d7a02bdb4bf0ee47431e
| 940
|
dart
|
Dart
|
flutter/catsao/lib/entity/weather_entity.dart
|
shunwuyu/lesson_show
|
44c8fc05742611e30d84572abb91dc92b9a9fa72
|
[
"MIT"
] | 41
|
2018-06-19T07:23:02.000Z
|
2021-12-26T13:33:16.000Z
|
flutter/catsao/lib/entity/weather_entity.dart
|
shunwuyu/lesson_show
|
44c8fc05742611e30d84572abb91dc92b9a9fa72
|
[
"MIT"
] | 101
|
2019-07-01T05:49:46.000Z
|
2022-03-08T22:53:00.000Z
|
flutter/catsao/lib/entity/weather_entity.dart
|
shunwuyu/lesson_show
|
44c8fc05742611e30d84572abb91dc92b9a9fa72
|
[
"MIT"
] | 21
|
2018-11-01T00:49:59.000Z
|
2021-04-27T07:18:37.000Z
|
class WeatherEntity {
String country;
String location;
String tmp;
String cond;
String hum;
String windDir;
String windSc;
String windSpd;
String statusCode;
String statusTxt;
WeatherEntity({this.country, this.location, this.tmp, this.cond,
this.hum, this.windDir, this.windSc, this.windSpd, this.statusCode, this.statusTxt});
WeatherEntity.fromSp(List<String> list) {
country = list[0];
location = list[1];
tmp = list[2];
cond = list[3];
hum = list[4];
windDir = list[5];
windSc = list[6];
windSpd = list[7];
statusCode = list[8];
statusTxt = list[9];
}
toList() {
List<String> result = [];
result.add(country);
result.add(location);
result.add(tmp);
result.add(cond);
result.add(hum);
result.add(windDir);
result.add(windSc);
result.add(windSpd);
result.add(statusCode);
result.add(statusTxt);
return result;
}
}
| 21.860465
| 88
| 0.631915
|
01e2879f4df2d077f8fcbd99632d1045244f2e6f
| 21,454
|
html
|
HTML
|
example/example/templates/base.html
|
carriemclaughlin/django-components
|
b761f6d56f56a29f28d5f7983cc15f6a7971acf4
|
[
"BSD-3-Clause"
] | null | null | null |
example/example/templates/base.html
|
carriemclaughlin/django-components
|
b761f6d56f56a29f28d5f7983cc15f6a7971acf4
|
[
"BSD-3-Clause"
] | null | null | null |
example/example/templates/base.html
|
carriemclaughlin/django-components
|
b761f6d56f56a29f28d5f7983cc15f6a7971acf4
|
[
"BSD-3-Clause"
] | 1
|
2018-09-28T17:41:21.000Z
|
2018-09-28T17:41:21.000Z
|
<!DOCTYPE html>
<html>
<head>
<title>{% block head_title %}Attendance Example{% endblock %}</title>
{% block extra_head %}
{% endblock %}
<style>
div.cmp {
border: 2px solid grey;
}
body.no-js .cmp-deferred .js { display: none; }
body.no-js .cmp-deferred .no-js {
display: none;
float: left;
clear: left;
width: 100%;
}
body.js .cmp-deferred .js { display: block; }
body.js .cmp-deferred .spinner {
margin: 20px;
}
body.js .cmp-deferred .no-js { display: none; }
.no_js_hider {
display: none;
}
.spinner {
display: inline-block;
width: 16px;
height: 16px;
background: url(http://i.imgur.com/QDy2kNq.gif) 0 0 no-repeat;
}
</style>
<script src="//code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
var show_component_debug = function(){
$("div.debug_component_info").show();
};
</script>
<script type="text/javascript">
var disable_ajax_form_handling = function(){
$('form').each(function(){
$(this).off("submit");
});
};
</script>
<script type="text/javascript">
/* NOTE: This should be a static file in production. */
(function (){
/**
* Checks if element is visible within the viewport or in
* relation to the $container element
*
* @param {jQuery} $container is the dom element that
* contains the component we are checking if it is null
* window will be used instead.
* @return {Boolean}
*/
$.fn.is_in_pane = function ($container) {
// We need to calculate the top or base offset incase we are in a modal
// which is in front of a page that has been scrolled
$container = $container || null;
var topOffset = 0;
if($container !== null && $container[0]) {
topOffset = $container.offset().top;
} else {
$container = $(window);
}
var $el = $(this[0]); // grab first element
if($el.length === 0) {
return false;
}
var top = $container.scrollTop(),
bottom = top + $container.height(),
etop = $el.offset().top - topOffset,
ebottom = etop + $el.outerHeight();
// top of element is above viewport bottom and
// bottom of element is below top of viewport.
// returns true even if element is only partially visible
return etop > 0 && etop <= bottom && ebottom >= top;
};
window.vkey = window.vkey || {};
// default handler
// to use in your callbacks:
// var x = vkey.handle(action, action_key) -- x is jq object for component
window.vkey.handle = function(action, action_key) {
var cmp = $('#cmp_' + action_key + '_id');
if(cmp.length === 0) {
cmp = $('.cmp_' + action_key + '_id');
}
cmp.html(action.new_html);
autosubmit.init(cmp);
// // Load all the deferred components inside this component if there are any
cmp.find('.cmp-deferred').each(function () {
deferred.add($(this));
});
return cmp;
};
var ajax = function (key) {
if(this instanceof ajax) {
this.key = key || false;
return this;
} else {
return new ajax(key);
}
};
ajax.prototype = {
post: function (url, data) {
return this.send(url, data, 'POST');
},
get: function (url, data) {
return this.send(url, data, 'GET');
},
form: function (selector, data) {
selector = selector || '';
data = data || {};
var formdata = {},
form = $(selector);
// if there's no form returned from the query...
if(form.length === 0) {
// there's no form to send
return this;
}
// if there's a url in the data obj, use that. otherwise, use the form's action
formdata.url = typeof data.url === 'string' ? data.url : form.attr('action');
formdata.url = formdata.url || '';
formdata.url = formdata.url.length === 0 ? window.location.href : formdata.url;
// loop through all inputs
form.find('input:not([type=radio], [type=checkbox]),input[type=checkbox]:checked,input[type=radio]:checked,input[type=checkbox]:selected,select,textarea').each(function (index, value) {
var input = this,
key = input.name || '';
if(key.length > 0) {
// if duplicate keys, convert to or push to an array
if(key.indexOf('[]') > -1 && formdata[key]) {
// if this key is already an array
if(formdata[key] instanceof Array) {
formdata[key].push(input.value);
// else start an array of values
} else {
formdata[key] = [formdata[key], input.value];
}
// else just store the value like normal
} else {
formdata[key] = input.value;
}
}
});
// combine the formdata with override data
data = $.extend(true, {}, formdata, data, form.data());
// disable the buttons
form.find('button,input[type=submit]')
.prop('disabled', 'disabled')
.addClass('dim');
// send it
return this.send(data.url, data, 'POST');
},
send: function (url, data, type) {
// multiple this' (thises? this's?) are too confusing, 'context' refers to ajax class
var context = this;
// init...
url = url || '';
data = data || {};
type = type || 'POST';
data.page_key = data.page_key || this.key;
data.deferred = data.deferred || false;
data.timeout = data.timeout || 90000;
$.ajax({
url: url,
data: data,
type: type,
timeout: data.timeout,
cache: false,
success: function (result) {
// if there's a redirect, do that before bothering with this other stuff
if (typeof result.redirect === "string") {
window.location = result.redirect;
}
// loop through all actions
$.each(result.actions || {}, function (action_key, action) {
// action.result no longer exists in the response
if(action.result && action.result.reload) {
ajax(data.page_key).get(action.result.reload, {
param_key: action_key
});
} else {
context.success(action_key, action, data.deferred);
}
});
},
error: function (response) {
context.error(response, data);
}
});
return this;
},
error: function (response, data) {
$('.hide-on-error').hide();
response.status = response.status || 0;
// process data
data.page_key = this.key;
delete data.csrfmiddlewaretoken;
delete data.deferred;
if(response.statusText === 'timeout') {
alert('timeout');
} else if(response.status > 0) {
alert('server communication error');
}
},
success: function (action_key, action, deferred) {
var callback = window.vkey[action.component_key] || window.vkey.handle;
callback(action, action_key, deferred || false);
}
};
// auto submit most forms
// To disable auto submit:
// 1. add 'disable-auto-submit' class to form
// 2. use autosubmit.disable($('.my-form'))
// --------------------------------------------------
var autosubmit = {
// autosubmit.init() -- searches <body> for forms and adds auto_submit event
// autosubmit.init($('.my-div')) -- searches <div class="my-div"> for forms and adds auto_submit event
init: function (elem) {
elem = elem || $('body');
var disabled = 'form:not(.disable-auto-submit)';
elem.find('form').each( function () {
var $this = $(this);
if($this.is(disabled)) {
$this.off('submit.auto_submit');
$this.on('submit.auto_submit', function (e) {
e.preventDefault();
autosubmit.process.apply(this, arguments);
});
if($this.not('.disable_submit_auto_disabling')) {
$this.submit_auto_disable();
}
}
});
},
process: function (e) {
var $form = $($(this).get(0)),
page_key = $form.find('input#id_page_key').val();
e.preventDefault();
ajax(page_key).form($form);
},
disable: function (obj) {
obj.off('submit.auto_submit');
}
};
ajax.autosubmit = autosubmit;
// auto disable forms, prevent submitting more than once
$.fn.submit_auto_disable = function () {
return $(this).each( function () {
var submit_events = [],
submit_bindings = [];
if($._data($(this).get(0)).events) {
submit_bindings = $._data($(this).get(0)).events.submit || [];
submit_bindings = submit_bindings.slice(0);
}
if($(this)[0].onsubmit) {
submit_events.push($(this)[0].onsubmit);
}
$.each(submit_bindings, function (index, value) {
submit_events.push(value.handler);
});
$(this)[0].onsubmit = function () {};
$(this).off('submit');
$(this).on('submit', function (e) {
var fail = false,
default_prevented = false;
var index;
for(index in submit_events) {
try {
this.next_handler = submit_events[index];
if(this.next_handler(e) === false) {
fail = true;
}
} catch(err) {}
}
if(e.isDefaultPrevented) {
if(e.isDefaultPrevented()) {
default_prevented = true;
}
}
if(!fail && !default_prevented) {
$(this).off('submit');
$(this).on('submit', function(e) {
e.preventDefault();
});
}
return !fail;
});
});
};
// deferred components
// --------------------------------------------------
var deferred = {
cmps: [],
count: 0,
listening: false,
show_overridden: false,
// regex to catch userAgents that must load
// deferred components onLoad or onDomReady
should_autoshow: /opera mini|series40/i
};
ajax.deferred = deferred;
// add: determines how to load the component
deferred.add = function ($cmp) {
if(this.should_autoshow.test(navigator.userAgent)) {
deferred.load($cmp);
return;
}
if($cmp.is(':visible')) {
// if it's showing on the page somewhere
if($cmp.is_in_pane()) {
// if it's in the frame, load it
deferred.load($cmp);
} else {
// else, it's visible but somewhere out of view, check on it when scrolling
deferred.cmps.push($cmp);
deferred.count ++;
if(!deferred.listening) {
deferred.listen();
}
}
} else {
// else, it's really hidden, hijack the show function
deferred.check_for_unhide();
}
};
// listen: check for non-loaded components and load them as they come into view
deferred.listen = function () {
this.listening = true;
$(window).on('scroll.deferred', _.throttle(function (e) {
var i = 0,
l = deferred.cmps.length,
$cmp = false;
for(i; i<l; i++) {
$cmp = deferred.cmps[i];
if($cmp !== false && $cmp.is_in_pane()) {
deferred.load($cmp);
deferred.cmps[i] = false;
deferred.count --;
if(deferred.count === 0) {
deferred.listening = false;
$(window).off('scroll.deferred');
}
}
}
}, 16));
};
// check_for_unhide: load the component when it is shown
deferred.check_for_unhide = function ($cmp) {
if(!this.show_overridden) {
this.show_overridden = true;
var old_show = $.fn.show;
$.fn.show = function(speed, callback) {
return $(this).each(function() {
var $this = $(this);
old_show.apply($this, [speed, callback]);
$this.find('.cmp-deferred').each(function () {
var $cmp = $(this);
if($cmp.is(':visible')) {
deferred.load($cmp);
}
});
});
};
}
};
// load: load the component
deferred.load = function ($cmp) {
var data = $cmp.data();
$cmp.find('.js').addClass('spinner');
ajax(data.cmp_page_key).get(data.cmp_url, {
param_key: data.cmp_param_key,
deferred: true
});
};
// Onload
$(function () {
// Auto Submit Setup
// automatically submit_auto_disable this to all forms (unless specificied)
$('form:not(.disable_submit_auto_disabling)').submit_auto_disable();
$('form').each(function () {
if($(this).attr('action') === '') {
$(this).attr('action', window.location.href);
}
});
autosubmit.init();
// Deferred Component Setup
$('.cmp-deferred').each(function () {
deferred.add($(this));
});
});
})();
</script>
</head>
<body class="no-js">
{% block body %}
{% if messages %}
{% spaceless %}
<div>
<strong>Messages:</strong>
<ul>
{% for message in messages %}
<li>{{message}}</li>
{% endfor %}
</ul>
</div>
{% endspaceless %}
{% endif %}
<div>
<strong>Menu:</strong>
<ul>
<li>
<a onclick="show_component_debug();return false;"
href="javascript:void();">
Show component debug info
</a>
</li>
<li>
<a onclick="disable_ajax_form_handling();return false;"
href="javascript:void();">
Disable automatic ajax form handling</a>
(Next action will do a full page POST (ajax will reenable automatically))
</li>
<li>
Time since full page reload/redirect/etc
<span id="countup_timer">0</span> Seconds
</li>
</ul>
</div>
{% block content %}
{% endblock content %}
{% endblock body %}
{% block extra_body %}
{% endblock extra_body %}
</body>
<script type="text/javascript">
setInterval(function(){
var $timer = $("#countup_timer");
$timer.html(parseInt($timer.html()) + 1);
}, 1000)
</script>
<script type="text/javascript">
(function(){
$('body').removeClass('no-js').addClass('js');
})();
</script>
</html>
| 42.149312
| 209
| 0.361564
|
976a3e7f93b6a0be1a1c7971f94ef4b9a64506b9
| 3,477
|
ksh
|
Shell
|
src/tests/sys/cddl/zfs/tests/snapshot/snapshot_009_pos.ksh
|
lastweek/source-freebsd
|
0821950b0c40cbc891a27964b342e0202a3859ec
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null |
src/tests/sys/cddl/zfs/tests/snapshot/snapshot_009_pos.ksh
|
lastweek/source-freebsd
|
0821950b0c40cbc891a27964b342e0202a3859ec
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null |
src/tests/sys/cddl/zfs/tests/snapshot/snapshot_009_pos.ksh
|
lastweek/source-freebsd
|
0821950b0c40cbc891a27964b342e0202a3859ec
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null |
#! /usr/local/bin/ksh93 -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# $FreeBSD$
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)snapshot_009_pos.ksh 1.2 07/01/09 SMI"
#
. $STF_SUITE/include/libtest.kshlib
################################################################################
#
# __stc_assertion_start
#
# ID: snapshot_009_pos
#
# DESCRIPTION:
# Verify 'snapshot -r' and 'destroy -r' can correctly create and destroy
# snapshot tree respectively.
#
# STRATEGY:
# 1. Use the snapshot -r to create snapshot for top level pool
# 2. Verify the children snapshots are created correctly.
# 3. Use destroy -r to destroy the top level snapshot
# 4. Verify that all children snapshots are destroyed too.
#
# TESTABILITY: explicit
#
# TEST_AUTOMATION_LEVEL: automated
#
# CODING_STATUS: COMPLETED (2006-06-20)
#
# __stc_assertion_end
#
################################################################################
verify_runnable "both"
function cleanup
{
typeset ds
typeset snap
for ds in $ctr/$TESTVOL1 $ctr/$TESTCLONE; do
datasetexists $ds && \
log_must $ZFS destroy -f $ds
done
for snap in $ctr/$TESTFS1@$TESTSNAP1 \
$snappool $snapvol $snapctr $snapctrvol \
$snapctrclone $snapctrfs
do
snapexists $snap && \
log_must $ZFS destroy -rf $snap
done
}
log_assert "Verify snapshot -r can correctly create a snapshot tree."
log_onexit cleanup
ctr=$TESTPOOL/$TESTCTR
ctrfs=$ctr/$TESTFS1
ctrclone=$ctr/$TESTCLONE
ctrvol=$ctr/$TESTVOL1
snappool=$SNAPPOOL
snapfs=$SNAPFS
snapctr=$ctr@$TESTSNAP
snapvol=$SNAPFS1
snapctrvol=$ctrvol@$TESTSNAP
snapctrclone=$ctrclone@$TESTSNAP
snapctrfs=$SNAPCTR
#preparation for testing
log_must $ZFS snapshot $ctrfs@$TESTSNAP1
log_must $ZFS clone $ctrfs@$TESTSNAP1 $ctrclone
if is_global_zone; then
log_must $ZFS create -V $VOLSIZE $ctrvol
else
log_must $ZFS create $ctrvol
fi
log_must $ZFS snapshot -r $snappool
#verify the snapshot -r results
for snap in $snappool $snapfs $snapvol $snapctr $snapctrvol \
$snapctrclone $snapctrfs
do
! snapexists $snap && \
log_fail "The snapshot $snap is not created via -r option."
done
log_note "Verify that destroy -r can destroy the snapshot tree."
log_must $ZFS destroy -r $snappool
for snap in $snappool $snapfs $snapvol $snapctr $snapctrvol \
$snapctrclone $snapctrfs
do
snapexists $snap && \
log_fail "The snapshot $snap is not destroyed correctly."
done
log_note "Verify that the snapshot with different name should \
be not destroyed."
! snapexists $ctrfs@$TESTSNAP1 && \
log_fail "destroy -r incorrectly destroys the snapshot \
$ctrfs@$TESTSNAP1."
log_pass "snapshot|destroy -r with snapshot tree works as expected."
| 26.340909
| 80
| 0.715272
|
e2a940f1b9a5bf4cbc169f3060b803d38775f156
| 699
|
py
|
Python
|
website/__init__.py
|
Jason13201/Lets-tidy-up-this-space
|
ca815f1e8227e7b60c9047c7a36d05355616021b
|
[
"MIT"
] | 2
|
2021-03-15T04:34:29.000Z
|
2021-03-15T04:34:56.000Z
|
website/__init__.py
|
Jason13201/Lets-tidy-up-this-space
|
ca815f1e8227e7b60c9047c7a36d05355616021b
|
[
"MIT"
] | null | null | null |
website/__init__.py
|
Jason13201/Lets-tidy-up-this-space
|
ca815f1e8227e7b60c9047c7a36d05355616021b
|
[
"MIT"
] | 1
|
2021-03-15T04:35:18.000Z
|
2021-03-15T04:35:18.000Z
|
from flask import Flask
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
from config import DBPass, DBUsername
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
app = Flask(__name__)
app.config["SECRET_KEY"] = "enterasecretkeyhere"
bcrypt = Bcrypt(app)
login_manager = LoginManager(app)
cloud_config = {"secure_connect_bundle": "secure-connect-tidyup.zip"}
auth_provider = PlainTextAuthProvider(DBUsername, DBPass)
cluster = Cluster(cloud=cloud_config, auth_provider=auth_provider)
session = cluster.connect()
from website import routes
def startDebugServer(sharedQ):
global discordQ
discordQ = sharedQ
app.run(debug=True)
| 25.888889
| 69
| 0.805436
|
a37aa8bdac1562ca31b2857dd5cb880cb1cecf22
| 4,348
|
java
|
Java
|
src/example/java/cn/pipeline/example/DragonRenderer.java
|
LambdaInnovation/Pipeline
|
c88f26c6e8a3901dae104cf6461c35d4d373eb6c
|
[
"MIT"
] | 10
|
2016-06-19T15:59:42.000Z
|
2022-03-14T15:14:35.000Z
|
src/example/java/cn/pipeline/example/DragonRenderer.java
|
LambdaInnovation/Pipeline
|
c88f26c6e8a3901dae104cf6461c35d4d373eb6c
|
[
"MIT"
] | 7
|
2016-06-12T02:39:24.000Z
|
2016-06-26T10:52:32.000Z
|
src/example/java/cn/pipeline/example/DragonRenderer.java
|
LambdaInnovation/Pipeline
|
c88f26c6e8a3901dae104cf6461c35d4d373eb6c
|
[
"MIT"
] | null | null | null |
package cn.pipeline.example;
import cn.pipeline.api.GraphicPipeline;
import cn.pipeline.api.Material;
import cn.pipeline.api.Material.*;
import cn.pipeline.api.ObjParser;
import cn.pipeline.api.ObjParser.VertexAttr;
import cn.pipeline.api.ShaderProgram;
import cn.pipeline.api.mc.EntityRenderUtils;
import cn.pipeline.api.mc.MCPipeline;
import cn.pipeline.api.state.StateContext;
import cn.pipeline.api.state.StateContext.BlendFunction;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import java.util.HashMap;
import java.util.Map;
import static org.apache.commons.lang3.tuple.Pair.of;
public class DragonRenderer {
public static void init() {
GameRegistry.registerBlock(new DragonBlock(), "DragonBlock");
GameRegistry.registerTileEntity(DragonTileEntity.class, "DragonTile");
// Note that normally rendering registry should be done in proxy, but this demo is client-only so registering here is fine.
ClientRegistry.bindTileEntitySpecialRenderer(DragonTileEntity.class, new TileEntitySpecialRenderer() {
final Material material = Material.load(
ShaderProgram.load(
new ResourceLocation("pipex:shaders/dragon.vert"),
new ResourceLocation("pipex:shaders/dragon.frag")
),
LayoutMapping.create(
of("position", LayoutType.VERTEX),
of("uv", LayoutType.VERTEX),
of("offset", LayoutType.INSTANCE)
)
);
final Mesh mesh = material.newMesh(MeshType.STATIC);
final Layout l_offset = material.getLayout("offset");
final ResourceLocation tex = new ResourceLocation("pipex:textures/dragon.png");
{
Map<VertexAttr, Layout> vertexMapping = new HashMap<>();
vertexMapping.put(VertexAttr.Position, material.getLayout("position"));
vertexMapping.put(VertexAttr.UV, material.getLayout("uv"));
Map<String, Integer> groupMapping = new HashMap<>();
groupMapping.put("Cube1", 0);
groupMapping.put("Cube2", 1);
groupMapping.put("Cube3", 2);
long time0 = System.currentTimeMillis();
ObjParser.parse(new ResourceLocation("pipex:models/dragon.obj"), material, mesh, vertexMapping, groupMapping);
System.out.println("Took " + (System.currentTimeMillis() - time0) + " ms parsing obj file.");
StateContext ctx = material.stateContext();
ctx.setTexBinding2D(0, tex);
ctx.setBlendEnabled(true);
ctx.setBlendFunc(BlendFunction.SrcAlpha, BlendFunction.One);
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
GraphicPipeline pipeline = MCPipeline.entity();
material.setUniforms(material.newUniformBlock()
.setMat4("pvp_matrix", EntityRenderUtils.getPVPMatrix())
);
pipeline.draw(material, mesh,
material.newInstance().setVec3(l_offset, (float) x, (float) y, (float) z));
}
});
}
public static class DragonBlock extends Block implements ITileEntityProvider {
public DragonBlock() {
super(net.minecraft.block.material.Material.wood);
setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new DragonTileEntity();
}
}
public static class DragonTileEntity extends TileEntity {
@Override
public AxisAlignedBB getRenderBoundingBox() {
return INFINITE_EXTENT_AABB;
}
}
}
| 38.821429
| 131
| 0.642364
|
1aa07b641c2ed4b8873f39e2f95c0b9eb8ed4d0f
| 388
|
cs
|
C#
|
SimpleGames.TicTacToe.Tests/SimpleGames.TicTacToe.Position.Test.cs
|
Dmitry-Bychenko/SimpleGames.TicTacToe
|
18cbca1dced97d6f9013d1c857185bb965e612e8
|
[
"MIT"
] | null | null | null |
SimpleGames.TicTacToe.Tests/SimpleGames.TicTacToe.Position.Test.cs
|
Dmitry-Bychenko/SimpleGames.TicTacToe
|
18cbca1dced97d6f9013d1c857185bb965e612e8
|
[
"MIT"
] | null | null | null |
SimpleGames.TicTacToe.Tests/SimpleGames.TicTacToe.Position.Test.cs
|
Dmitry-Bychenko/SimpleGames.TicTacToe
|
18cbca1dced97d6f9013d1c857185bb965e612e8
|
[
"MIT"
] | null | null | null |
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace SimpleGames.TicTacToe.Tests {
[TestClass]
public sealed class PositionTests {
[TestMethod]
public void OutcomeTest() {
TicTacToePosition board = TicTacToePosition.Build(
"a1", "a2", "a3", "b2", "b1", "c1", "b3", "c3", "c2");
Assert.IsTrue(board.Outcome == GameOutcome.Draw);
}
}
}
| 20.421053
| 62
| 0.646907
|
215f089cf35ceee5846d65f15465d4940bf73115
| 1,111
|
js
|
JavaScript
|
replate-app/src/components/Pickup Requests/AssignedPickupRequest.js
|
iDecisive/front-end-1
|
8fb303fbe7162a8f975ff45dbbe62c64c8789281
|
[
"MIT"
] | 1
|
2020-10-16T16:14:36.000Z
|
2020-10-16T16:14:36.000Z
|
replate-app/src/components/Pickup Requests/AssignedPickupRequest.js
|
daniel-j-dev/front-end-1
|
8fb303fbe7162a8f975ff45dbbe62c64c8789281
|
[
"MIT"
] | 2
|
2020-06-25T16:23:35.000Z
|
2020-06-25T16:34:56.000Z
|
replate-app/src/components/Pickup Requests/AssignedPickupRequest.js
|
daniel-j-dev/front-end-1
|
8fb303fbe7162a8f975ff45dbbe62c64c8789281
|
[
"MIT"
] | null | null | null |
import React, { useContext } from 'react';
import MainContext from '../../contexts/MainContext';
import './assignedpickuprequest.css';
function AssignedPickupRequest(props) {
let {item, index} = props;
let {data, setData} = useContext(MainContext);
let completeRequest = event => {
event.preventDefault();
let newData = {
...data
}
newData.pickupRequests[index].requestStatus = 'Complete'
setData(newData);
}
let cancelRequest = (event) => {
event.preventDefault();
let newData = {
...data,
};
newData.pickupRequests[index].requestStatus = 'Available';
newData.pickupRequests[index].assignedVolunteer = '';
setData(newData);
};
return (
<div className="assigned-pickup-request">
<p>Food type: {item.foodType}</p>
<p>Weight: {item.weight}</p>
<p>Pickup date: {item.pickupDate}</p>
<div className='assigned-pickup-request-controls'>
<button onClick={completeRequest}>Complete</button>
<button className='cancelBtn' onClick={cancelRequest}>Cancel</button>
</div>
</div>
);
}
export default AssignedPickupRequest;
| 20.962264
| 74
| 0.671467
|
7fbb04ed69c8fe6b89dcc24278b1b9c97f5bf834
| 1,647
|
php
|
PHP
|
API/Parsers/Public/Spells.php
|
Aprelius/vectra-website
|
b553760e182a7f0d4723882e7a71a6033a61d6f4
|
[
"MIT"
] | null | null | null |
API/Parsers/Public/Spells.php
|
Aprelius/vectra-website
|
b553760e182a7f0d4723882e7a71a6033a61d6f4
|
[
"MIT"
] | null | null | null |
API/Parsers/Public/Spells.php
|
Aprelius/vectra-website
|
b553760e182a7f0d4723882e7a71a6033a61d6f4
|
[
"MIT"
] | null | null | null |
<?php
if (!defined('IN_PARSERS') || !IN_PARSERS)
{
exit ;
}
$Amount = 1 ;
if (!empty($_GET["amount"]) && stringToNum($_GET["amount"]) > 1)
{
$Amount = stringToNum($_GET["amount"]) ;
}
if (empty($_GET['spell']))
{
echo 'ERROR: Missing arguement &spell' . chr(10) ;
}
else
{
$Spell = trim(urldecode($_GET['spell'])) ;
$Dbc->connect() ;
if (isUpdating())
{
echo 'NOTICE: Grand Exchange Database is currently updating prices may be out of date.' . chr(10) ;
}
# sqlSearch($DbName, $TbName, $Column, $Search, $OrderBy = null)
$Result = sqlSearch('Parsers', 'rs_spells', 'name', $Spell) ;
if ($Result == false)
{
echo 'ERROR: No spell found for the search '.$Spell.chr(10);
}
else
{
$Obj = $Dbc->sql_fetch($Result);
echo 'NAME: '.$Obj->Name.chr(10);
echo 'LEVEL: '.$Obj->Level.chr(10);
echo 'EXP: '.$Obj->Exp.chr(10);
echo 'DAMAGE: '.$Obj->MaxDamage.chr(10);
echo 'EFFECT: '.$Obj->Special.chr(10);
$Runes = json_decode($Obj->Runes) ;
$Total = array(0, 0, 0) ;
echo 'RUNES: ' ;
foreach ($Runes as $Rune)
{
$Name = getItemById($Rune[0]) ;
$Total[0] += ($Rune[1] * $Name->min * $Amount) ;
$Total[1] += ($Rune[1] * $Name->market * $Amount) ;
$Total[2] += ($Rune[1] * $Name->max * $Amount) ;
printf("%dx %s ", $Rune[1], str_replace('_', ' ', $Name->name)) ;
}
echo chr(10);
echo 'COST: ' . implode(',', $Total) . chr(10) ;
}
}
?>
| 27.915254
| 108
| 0.480874
|
8b4c46b6afc6f5e4dfa6a0dcca11d1e534b070e7
| 1,145
|
rb
|
Ruby
|
Formula/bioawk.rb
|
jeroen/homebrew-core
|
06f9b59ff6e7ec8c3be8ee26681867695e40b03f
|
[
"BSD-2-Clause"
] | 1
|
2022-01-04T21:18:59.000Z
|
2022-01-04T21:18:59.000Z
|
Formula/bioawk.rb
|
jeroen/homebrew-core
|
06f9b59ff6e7ec8c3be8ee26681867695e40b03f
|
[
"BSD-2-Clause"
] | 24
|
2019-07-24T19:22:19.000Z
|
2022-02-06T13:50:06.000Z
|
Formula/bioawk.rb
|
jeroen/homebrew-core
|
06f9b59ff6e7ec8c3be8ee26681867695e40b03f
|
[
"BSD-2-Clause"
] | 12
|
2019-07-23T18:05:14.000Z
|
2022-03-19T13:56:03.000Z
|
class Bioawk < Formula
desc "AWK modified for biological data"
homepage "https://github.com/lh3/bioawk"
url "https://github.com/lh3/bioawk/archive/v1.0.tar.gz"
sha256 "5cbef3f39b085daba45510ff450afcf943cfdfdd483a546c8a509d3075ff51b5"
bottle do
cellar :any_skip_relocation
# sha256 "7082d4073e07ba3dfa849f95eb126d966a45f9fceb1d197595119a216e465727" => :mojave
sha256 "023f5cafaa31404e68b8fc6bcfbeee27e63eb5fbcab897d2f406fceda90ec9ff" => :high_sierra
sha256 "154d44dd9ea56db8170127711e991950d487e379ae12df76332e4b7512f79fe8" => :sierra
sha256 "df0810bc087f924cdddcdb73f00faf9772de9475e0e698c7af8a7d036b3a4c91" => :el_capitan
end
def install
# Fix make: *** No rule to make target `ytab.h', needed by `b.o'.
ENV.deparallelize
system "make"
bin.install "bioawk"
man1.install "awk.1" => "bioawk.1"
end
test do
(testpath/"test.fasta").write <<~EOS
>U00096.2:1-70
AGCTTTTCATTCTGACTGCAACGGGCAATATGTCT
CTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC
EOS
cmd = "#{bin}/bioawk -cfastx '{print length($seq)}' test.fasta"
assert_equal "70", shell_output(cmd).chomp
end
end
| 33.676471
| 93
| 0.744978
|
b3001b605d248e64b4db5522adbf52faa85ab824
| 422
|
py
|
Python
|
follower_maze/events/operations.py
|
begor/follower_maze
|
d76315e5085d4566f5730d70b51559b2262bc827
|
[
"MIT"
] | null | null | null |
follower_maze/events/operations.py
|
begor/follower_maze
|
d76315e5085d4566f5730d70b51559b2262bc827
|
[
"MIT"
] | null | null | null |
follower_maze/events/operations.py
|
begor/follower_maze
|
d76315e5085d4566f5730d70b51559b2262bc827
|
[
"MIT"
] | null | null | null |
from follower_maze.events import handler
from follower_maze.events import parser
def parse(payload: bytes):
"""
Parse given payload bytes into one of `types.Event` subclasses.
"""
return parser.EventParser(payload).parse()
async def handle(payload: bytes):
"""
Parse event and handle it using `EventHandler`.
"""
event = parse(payload)
await handler.EventHandler.new(event)
| 23.444444
| 71
| 0.687204
|
c6817af855c04ffbb1befe940b8712aaa45a0d26
| 1,397
|
kt
|
Kotlin
|
server/src/main/kotlin/com/transparency/config/DataConfig.kt
|
stefan-cimander/transparency
|
e8fe7289640df68f568d4f68e4600d563a7aa2cc
|
[
"MIT"
] | 1
|
2017-08-05T02:24:27.000Z
|
2017-08-05T02:24:27.000Z
|
server/src/main/kotlin/com/transparency/config/DataConfig.kt
|
stefan-cimander/transparency
|
e8fe7289640df68f568d4f68e4600d563a7aa2cc
|
[
"MIT"
] | null | null | null |
server/src/main/kotlin/com/transparency/config/DataConfig.kt
|
stefan-cimander/transparency
|
e8fe7289640df68f568d4f68e4600d563a7aa2cc
|
[
"MIT"
] | null | null | null |
package com.transparency.config
import org.apache.tomcat.dbcp.dbcp2.BasicDataSource
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.PropertySource
import org.springframework.core.env.Environment
import org.springframework.core.io.ClassPathResource
@Configuration
@PropertySource("application.properties")
class DataConfig {
@Autowired
private lateinit var environment: Environment
@Bean
fun sessionFactory(): org.springframework.orm.hibernate5.LocalSessionFactoryBean {
val config = ClassPathResource("hibernate.cfg.xml")
val sessionFactory = org.springframework.orm.hibernate5.LocalSessionFactoryBean()
sessionFactory.setConfigLocation(config)
sessionFactory.setDataSource(dataSource())
return sessionFactory
}
@Bean
fun dataSource(): BasicDataSource {
val dataSource = BasicDataSource()
dataSource.driverClassName = environment.getProperty("transparency.db.driver")
dataSource.url = environment.getProperty("transparency.db.url")
dataSource.username = environment.getProperty("transparency.db.username")
dataSource.password = environment.getProperty("transparency.db.password")
return dataSource
}
}
| 38.805556
| 89
| 0.775233
|
da4ba942cefb814fcddc2f2e90b36c5fdef86b26
| 12,477
|
php
|
PHP
|
resources/views/temp/layanan.blade.php
|
wulanpratiwi/sushihouse
|
8532baa9914859315ff3f99faec2eb46505fd0e0
|
[
"MIT"
] | null | null | null |
resources/views/temp/layanan.blade.php
|
wulanpratiwi/sushihouse
|
8532baa9914859315ff3f99faec2eb46505fd0e0
|
[
"MIT"
] | 3
|
2021-03-10T15:50:07.000Z
|
2022-02-27T03:35:13.000Z
|
resources/views/temp/layanan.blade.php
|
wulanpratiwi/sushihouse
|
8532baa9914859315ff3f99faec2eb46505fd0e0
|
[
"MIT"
] | 1
|
2020-04-25T06:31:54.000Z
|
2020-04-25T06:31:54.000Z
|
@extends('template')
@section('content')
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark ftco-navbar-light" id="ftco-navbar">
<div class="container">
<a class="navbar-brand" href="/">
<span class="flaticon-pizza-1 mr-1"></span>SUSHI<br><small>HOUSE</small>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-label="Toggle navigation">
<span class="oi oi-menu"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a href="{{ url('/') }}" class="nav-link">UTAMA</a></li>
<li class="nav-item"><a href="{{ url('menu') }}" class="nav-link">MENU</a></li>
<li class="nav-item"><a href="{{ url('layanan') }}" class="nav-link">LAYANAN</a></li>
<li class="nav-item"><a href="{{ url('login') }}" class="nav-link">BLOG</a></li>
<li class="nav-item"><a href="{{ url('login') }}" class="nav-link">TENTANG</a></li>
<li class="nav-item"><a href="{{ url('login') }}" class="nav-link">KONTAK</a></li>
<!-- <li class="nav-item active"><a href="{{ url('#') }}" class="nav-link">DASHBOARD</a> -->
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre style="color: yellow;">
PROFILE <span class="caret"></span>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ url('#') }}">Edit Profile</a>
<a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">{{ __('Keluar') }}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
@csrf
</form>
</div>
</li>
</ul>
</div>
</div>
</nav>
<!-- End Navbar -->
<section class="home-slider owl-carousel img" style="background-image: url(images/bg_1.jpg);">
<div class="slider-item" style="background-image: url(images/bg_3.jpg);">
<div class="overlay"></div>
<div class="container">
<div class="row slider-text justify-content-center align-items-center">
<div class="col-md-7 col-sm-12 text-center ftco-animate">
<h1 class="mb-3 mt-5 bread">Services</h1>
<p class="breadcrumbs"><span class="mr-2"><a href="index.html">Home</a></span> <span>Services</span></p>
</div>
</div>
</div>
</div>
</section>
<section class="ftco-section ftco-services">
<div class="overlay"></div>
<div class="container">
<div class="row justify-content-center mb-5 pb-3">
<div class="col-md-7 heading-section ftco-animate text-center">
<h2 class="mb-4">Our Services</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
</div>
</div>
<div class="row">
<div class="col-md-4 ftco-animate">
<div class="media d-block text-center block-6 services">
<div class="icon d-flex justify-content-center align-items-center mb-5">
<span class="flaticon-diet"></span>
</div>
<div class="media-body">
<h3 class="heading">Healthy Foods</h3>
<p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic.</p>
</div>
</div>
</div>
<div class="col-md-4 ftco-animate">
<div class="media d-block text-center block-6 services">
<div class="icon d-flex justify-content-center align-items-center mb-5">
<span class="flaticon-bicycle"></span>
</div>
<div class="media-body">
<h3 class="heading">Fastest Delivery</h3>
<p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic.</p>
</div>
</div>
</div>
<div class="col-md-4 ftco-animate">
<div class="media d-block text-center block-6 services">
<div class="icon d-flex justify-content-center align-items-center mb-5"><span class="flaticon-pizza-1"></span></div>
<div class="media-body">
<h3 class="heading">Original Recipes</h3>
<p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="ftco-section">
<div class="container">
<div class="row justify-content-center mb-5 pb-3">
<div class="col-md-7 heading-section ftco-animate text-center">
<h2 class="mb-4">Hot Meals</h2>
<p class="flip"><span class="deg1"></span><span class="deg2"></span><span class="deg3"></span></p>
<p class="mt-5">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
</div>
</div>
<div class="row">
<div class="col-md-3 text-center ftco-animate">
<div class="menu-wrap">
<a href="#" class="menu-img img mb-4" style="background-image: url(images/pizza-1.jpg);"></a>
<div class="text">
<h3><a href="#">Itallian Pizza</a></h3>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia.</p>
<p class="price"><span>$2.90</span></p>
<p><a href="#" class="btn btn-white btn-outline-white">Add to cart</a></p>
</div>
</div>
</div>
<div class="col-md-3 text-center ftco-animate">
<div class="menu-wrap">
<a href="#" class="menu-img img mb-4" style="background-image: url(images/pizza-2.jpg);"></a>
<div class="text">
<h3><a href="#">Itallian Pizza</a></h3>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia.</p>
<p class="price"><span>$2.90</span></p>
<p><a href="#" class="btn btn-white btn-outline-white">Add to cart</a></p>
</div>
</div>
</div>
<div class="col-md-3 text-center ftco-animate">
<div class="menu-wrap">
<a href="#" class="menu-img img mb-4" style="background-image: url(images/pizza-3.jpg);"></a>
<div class="text">
<h3><a href="#">Itallian Pizza</a></h3>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia.</p>
<p class="price"><span>$2.90</span></p>
<p><a href="#" class="btn btn-white btn-outline-white">Add to cart</a></p>
</div>
</div>
</div>
<div class="col-md-3 text-center ftco-animate">
<div class="menu-wrap">
<a href="#" class="menu-img img mb-4" style="background-image: url(images/pizza-4.jpg);"></a>
<div class="text">
<h3><a href="#">Itallian Pizza</a></h3>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia.</p>
<p class="price"><span>$2.90</span></p>
<p><a href="#" class="btn btn-white btn-outline-white">Add to cart</a></p>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="ftco-footer ftco-section img">
<div class="overlay"></div>
<div class="container">
<div class="row mb-5">
<div class="col-lg-3 col-md-6 mb-5 mb-md-5">
<div class="ftco-footer-widget mb-4">
<h2 class="ftco-heading-2">About Us</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
<ul class="ftco-footer-social list-unstyled float-md-left float-lft mt-5">
<li class="ftco-animate"><a href="#"><span class="icon-twitter"></span></a></li>
<li class="ftco-animate"><a href="#"><span class="icon-facebook"></span></a></li>
<li class="ftco-animate"><a href="#"><span class="icon-instagram"></span></a></li>
</ul>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-5 mb-md-5">
<div class="ftco-footer-widget mb-4">
<h2 class="ftco-heading-2">Recent Blog</h2>
<div class="block-21 mb-4 d-flex">
<a class="blog-img mr-4" style="background-image: url(images/image_1.jpg);"></a>
<div class="text">
<h3 class="heading"><a href="#">Even the all-powerful Pointing has no control about</a></h3>
<div class="meta">
<div><a href="#"><span class="icon-calendar"></span> Sept 15, 2018</a></div>
<div><a href="#"><span class="icon-person"></span> Admin</a></div>
<div><a href="#"><span class="icon-chat"></span> 19</a></div>
</div>
</div>
</div>
<div class="block-21 mb-4 d-flex">
<a class="blog-img mr-4" style="background-image: url(images/image_2.jpg);"></a>
<div class="text">
<h3 class="heading"><a href="#">Even the all-powerful Pointing has no control about</a></h3>
<div class="meta">
<div><a href="#"><span class="icon-calendar"></span> Sept 15, 2018</a></div>
<div><a href="#"><span class="icon-person"></span> Admin</a></div>
<div><a href="#"><span class="icon-chat"></span> 19</a></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-2 col-md-6 mb-5 mb-md-5">
<div class="ftco-footer-widget mb-4 ml-md-4">
<h2 class="ftco-heading-2">Services</h2>
<ul class="list-unstyled">
<li><a href="#" class="py-2 d-block">Cooked</a></li>
<li><a href="#" class="py-2 d-block">Deliver</a></li>
<li><a href="#" class="py-2 d-block">Quality Foods</a></li>
<li><a href="#" class="py-2 d-block">Mixed</a></li>
</ul>
</div>
</div>
<div class="col-lg-3 col-md-6 mb-5 mb-md-5">
<div class="ftco-footer-widget mb-4">
<h2 class="ftco-heading-2">Have a Questions?</h2>
<div class="block-23 mb-3">
<ul>
<li><span class="icon icon-map-marker"></span><span class="text">203 Fake St. Mountain View, San Francisco, California, USA</span></li>
<li><a href="#"><span class="icon icon-phone"></span><span class="text">+2 392 3929 210</span></a></li>
<li><a href="#"><span class="icon icon-envelope"></span><span class="text">info@yourdomain.com</span></a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
<p><!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="icon-heart" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank">Colorlib</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --></p>
</div>
</div>
</div>
</footer>
@endsection
| 51.9875
| 234
| 0.518714
|
be3e20ebf77d01dea0306bcfee00feaee8685061
| 2,471
|
ts
|
TypeScript
|
sdk/identity/identity/src/credentials/managedIdentityCredential/cloudShellMsi.ts
|
hectorhdzg/azure-sdk-for-js
|
b7ea09b24504ce820a819bcde802306fd37cce2a
|
[
"MIT"
] | 2
|
2021-12-10T08:56:33.000Z
|
2021-12-10T08:56:35.000Z
|
sdk/identity/identity/src/credentials/managedIdentityCredential/cloudShellMsi.ts
|
hectorhdzg/azure-sdk-for-js
|
b7ea09b24504ce820a819bcde802306fd37cce2a
|
[
"MIT"
] | null | null | null |
sdk/identity/identity/src/credentials/managedIdentityCredential/cloudShellMsi.ts
|
hectorhdzg/azure-sdk-for-js
|
b7ea09b24504ce820a819bcde802306fd37cce2a
|
[
"MIT"
] | 1
|
2021-10-04T19:21:57.000Z
|
2021-10-04T19:21:57.000Z
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { createHttpHeaders, PipelineRequestOptions } from "@azure/core-rest-pipeline";
import { AccessToken, GetTokenOptions } from "@azure/core-auth";
import { MSI, MSIConfiguration } from "./models";
import { credentialLogger } from "../../util/logging";
import { mapScopesToResource, msiGenericGetToken } from "./utils";
const msiName = "ManagedIdentityCredential - CloudShellMSI";
const logger = credentialLogger(msiName);
// Cloud Shell MSI doesn't have a special expiresIn parser.
const expiresInParser = undefined;
function prepareRequestOptions(
scopes: string | string[],
clientId?: string
): PipelineRequestOptions {
const resource = mapScopesToResource(scopes);
if (!resource) {
throw new Error(`${msiName}: Multiple scopes are not supported.`);
}
const body: any = {
resource
};
if (clientId) {
body.client_id = clientId;
}
// This error should not bubble up, since we verify that this environment variable is defined in the isAvailable() method defined below.
if (!process.env.MSI_ENDPOINT) {
throw new Error(`${msiName}: Missing environment variable: MSI_ENDPOINT`);
}
const params = new URLSearchParams(body);
return {
url: process.env.MSI_ENDPOINT,
method: "POST",
body: params.toString(),
headers: createHttpHeaders({
Accept: "application/json",
Metadata: "true",
"Content-Type": "application/x-www-form-urlencoded"
})
};
}
export const cloudShellMsi: MSI = {
async isAvailable(scopes): Promise<boolean> {
const resource = mapScopesToResource(scopes);
if (!resource) {
logger.info(`${msiName}: Unavailable. Multiple scopes are not supported.`);
return false;
}
const result = Boolean(process.env.MSI_ENDPOINT);
if (!result) {
logger.info(`${msiName}: Unavailable. The environment variable MSI_ENDPOINT is needed.`);
}
return result;
},
async getToken(
configuration: MSIConfiguration,
getTokenOptions: GetTokenOptions = {}
): Promise<AccessToken | null> {
const { identityClient, scopes, clientId } = configuration;
logger.info(
`${msiName}: Using the endpoint coming form the environment variable MSI_ENDPOINT = ${process.env.MSI_ENDPOINT}.`
);
return msiGenericGetToken(
identityClient,
prepareRequestOptions(scopes, clientId),
expiresInParser,
getTokenOptions
);
}
};
| 30.506173
| 138
| 0.696074
|
a446b9419a557bf7e46fdebe856946d29a48f64b
| 2,579
|
php
|
PHP
|
app/Nova/SchlesingerSurveyQualification.php
|
770studio/tds-adbloom
|
2eefbcbe7f359c829d867355fba2ae5b4cd24f35
|
[
"MIT"
] | null | null | null |
app/Nova/SchlesingerSurveyQualification.php
|
770studio/tds-adbloom
|
2eefbcbe7f359c829d867355fba2ae5b4cd24f35
|
[
"MIT"
] | null | null | null |
app/Nova/SchlesingerSurveyQualification.php
|
770studio/tds-adbloom
|
2eefbcbe7f359c829d867355fba2ae5b4cd24f35
|
[
"MIT"
] | null | null | null |
<?php
namespace App\Nova;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
class SchlesingerSurveyQualification extends Resource
{
/**
* The model the resource corresponds to.
*
* @var string
*/
public static $model = \App\Models\Integrations\Schlesinger\SchlesingerSurveyQualification::class;
/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'id';
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'id',
];
public static $with = ['question', 'answers'];
/**
* Get the fields displayed by the resource.
*
* @param Request $request
* @return array
*/
public function fields(Request $request)
{
return [
ID::make(__('ID'), 'id')->sortable(),
Text::make('AnswerIds', function () {
return implode(",", $this->AnswerIds);
}),
Text::make('AnswerCodes', function () {
return implode(",", $this->AnswerCodes);
}),
Text::make('Name', function () {
return $this->question->name;
}),
Text::make('Text', function () {
return $this->question->text;
}),
Text::make('Answers', function () {
/** @var Collection $answers */
$answers = $this->answers;
return $answers->isNotEmpty()
? $answers->pluck('text')->implode(',')
: '';
}),
];
}
/**
* Get the cards available for the request.
*
* @param Request $request
* @return array
*/
public function cards(Request $request)
{
return [];
}
/**
* Get the filters available for the resource.
*
* @param Request $request
* @return array
*/
public function filters(Request $request)
{
return [];
}
/**
* Get the lenses available for the resource.
*
* @param Request $request
* @return array
*/
public function lenses(Request $request)
{
return [];
}
/**
* Get the actions available for the resource.
*
* @param Request $request
* @return array
*/
public function actions(Request $request)
{
return [];
}
}
| 21.672269
| 102
| 0.51299
|
a3760ae6041a278aee4f0e72b08483b3e7fe8b20
| 1,320
|
java
|
Java
|
java/org/l2jserver/gameserver/model/actor/instance/TrainerInstance.java
|
juninhorosa/L2JServer_C6_Interlude
|
f46627b75d86531fe863297544a5a4578388a6fe
|
[
"MIT"
] | 6
|
2020-05-14T22:52:59.000Z
|
2022-02-24T01:37:23.000Z
|
java/org/l2jserver/gameserver/model/actor/instance/TrainerInstance.java
|
juninhorosa/L2JServer_C6_Interlude
|
f46627b75d86531fe863297544a5a4578388a6fe
|
[
"MIT"
] | 2
|
2020-12-10T15:08:48.000Z
|
2021-12-01T01:01:46.000Z
|
java/org/l2jserver/gameserver/model/actor/instance/TrainerInstance.java
|
juninhorosa/L2JServer_C6_Interlude
|
f46627b75d86531fe863297544a5a4578388a6fe
|
[
"MIT"
] | 15
|
2020-05-08T20:41:06.000Z
|
2022-02-24T01:36:58.000Z
|
/*
* This file is part of the L2JServer project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jserver.gameserver.model.actor.instance;
import org.l2jserver.gameserver.model.actor.templates.NpcTemplate;
public class TrainerInstance extends FolkInstance
{
/**
* Instantiates a new trainer instance.
* @param objectId the object id
* @param template the template
*/
public TrainerInstance(int objectId, NpcTemplate template)
{
super(objectId, template);
}
@Override
public String getHtmlPath(int npcId, int value)
{
String pom = "";
if (value == 0)
{
pom = "" + npcId;
}
else
{
pom = npcId + "-" + value;
}
return "data/html/trainer/" + pom + ".htm";
}
}
| 27.5
| 71
| 0.710606
|
1a88fab4fc64ab14b58a3919ebec4cbe97d82f52
| 2,880
|
py
|
Python
|
generativemagic/checks/poker.py
|
misaka3/generativemagic
|
58f24a9fd95c94828281ed6c1267d570ee7c7b10
|
[
"MIT"
] | null | null | null |
generativemagic/checks/poker.py
|
misaka3/generativemagic
|
58f24a9fd95c94828281ed6c1267d570ee7c7b10
|
[
"MIT"
] | null | null | null |
generativemagic/checks/poker.py
|
misaka3/generativemagic
|
58f24a9fd95c94828281ed6c1267d570ee7c7b10
|
[
"MIT"
] | null | null | null |
from generativemagic.arrays import np_index
from generativemagic.checks.basic import Checker
def cards_positions(deck, cards):
positions = [np_index(deck, card) for card in cards]
return sorted(positions)
class IsGenericHand:
def __init__(self, hands, can_second_deal, desired_cards):
self.__hands = hands
self.__can_second_deal = can_second_deal
self.__desired_cards = desired_cards
def check(self, deck):
for hand in self.__hands:
found = self.__check_hand(deck, hand)
if found:
return hand, found
return None
def __check_hand(self, deck, hand):
positions = cards_positions(deck, self.__desired_cards)
length = len(deck)
for starting in positions:
viable_positions = sorted([(starting + i * hand) % length for i in range(len(self.__desired_cards))])
print(viable_positions)
if positions == viable_positions:
return positions
if not self.__can_second_deal:
return None
# this simple O(hand) implementation does not support second dealing with any card, only with the ace
# it also only supports the required N cards in the first N distributions
# we can generate all combinations and make this a quick search
deltas = [positions[i + 1] - positions[i] - 1 for i in range(4 - 1)]
for position in range(hand - 2):
deltas[position] -= hand - 1
if deltas[position] > 0:
# too many cards, will have to hold a non ace, fail (could be done, of course)
return None
# holding the ace and removing from the next one...
deltas[position + 1] += deltas[position]
deltas[position] = 0
print(deltas)
if deltas[-1] < 0:
# missing cards before the last ace
return None
if deltas[-1] > hand - 1:
# too many cards before the last one
return None
return deltas
class IsAcesHand(IsGenericHand):
def __init__(self, hands, can_second_deal):
super().__init__(hands, can_second_deal, [0, 13, 26, 39])
class ArePokerHand(Checker):
def __init__(self, desired, at_start=False):
self._desired = desired
self._at_start = at_start
def check(self, deck):
positions = cards_positions(deck, [0, 13, 26, 39])
if self._at_start:
if positions == [0, 4, 8, 12]:
return positions
return None
l = len(deck)
for starting in positions:
if positions == sorted([starting, (starting + 4) % l, (starting + 8) % l, (starting + 12) % l]):
return positions
return None
def __repr__(self):
return f"ArePokerHand({self._desired},{self._at_start})"
| 35.121951
| 113
| 0.603819
|
2d7a0bc85cbb3d961fcf03b98e8d3ebec03ef45f
| 18,773
|
css
|
CSS
|
widgets/common/assets/gradients/glassy/glassyPurple/glassyPurple4.css
|
idutta2007/yiigems
|
4278e750db1f19d50615a5acc7a93c8802ff5618
|
[
"MIT"
] | 1
|
2015-11-02T14:12:02.000Z
|
2015-11-02T14:12:02.000Z
|
widgets/common/assets/gradients/glassy/glassyPurple/glassyPurple4.css
|
idutta2007/yiigems
|
4278e750db1f19d50615a5acc7a93c8802ff5618
|
[
"MIT"
] | 1
|
2015-11-01T08:58:53.000Z
|
2016-01-02T09:25:49.000Z
|
widgets/common/assets/gradients/glassy/glassyPurple/glassyPurple4.css
|
idutta2007/yiigems
|
4278e750db1f19d50615a5acc7a93c8802ff5618
|
[
"MIT"
] | null | null | null |
.background_glassyPurple4,
.hover_background_glassyPurple4:hover,
.active_background_glassyPurple4:active:hover {
background: #ff0bff;
background-image: -moz-linear-gradient(top, rgb(240, 0, 240) 0%, rgb(213, 0, 213) 50%, rgb(186, 0, 186) 55%, rgb(255, 11, 255) 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(240, 0, 240)), color-stop(50%, rgb(213, 0, 213)), color-stop(55%, rgb(186, 0, 186)), color-stop(100%, rgb(255, 11, 255)));
background-image: -webkit-linear-gradient(top, rgb(240, 0, 240) 0%, rgb(213, 0, 213) 50%, rgb(186, 0, 186) 55%, rgb(255, 11, 255) 100%);
background-image: -o-linear-gradient(top, rgb(240, 0, 240) 0%, rgb(213, 0, 213) 50%, rgb(186, 0, 186) 55%, rgb(255, 11, 255) 100%);
background-image: -ms-linear-gradient(top, rgb(240, 0, 240) 0%, rgb(213, 0, 213) 50%, rgb(186, 0, 186) 55%, rgb(255, 11, 255) 100%);
background-image: linear-gradient(to bottom, rgb(240, 0, 240) 0%, rgb(213, 0, 213) 50%, rgb(186, 0, 186) 55%, rgb(255, 11, 255) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f000f0', endColorstr='#ff0bff',GradientType=0 );
}
.background_glassyPurple4h,
.hover_background_glassyPurple4h:hover,
.active_background_glassyPurple4h:active:hover {
background: #ff0bff;
background-image: -moz-linear-gradient(top, rgb(255, 32, 255) 0%, rgb(255, 1, 255) 50%, rgb(224, 0, 224) 55%, rgb(255, 64, 255) 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(255, 32, 255)), color-stop(50%, rgb(255, 1, 255)), color-stop(55%, rgb(224, 0, 224)), color-stop(100%, rgb(255, 64, 255)));
background-image: -webkit-linear-gradient(top, rgb(255, 32, 255) 0%, rgb(255, 1, 255) 50%, rgb(224, 0, 224) 55%, rgb(255, 64, 255) 100%);
background-image: -o-linear-gradient(top, rgb(255, 32, 255) 0%, rgb(255, 1, 255) 50%, rgb(224, 0, 224) 55%, rgb(255, 64, 255) 100%);
background-image: -ms-linear-gradient(top, rgb(255, 32, 255) 0%, rgb(255, 1, 255) 50%, rgb(224, 0, 224) 55%, rgb(255, 64, 255) 100%);
background-image: linear-gradient(to bottom, rgb(255, 32, 255) 0%, rgb(255, 1, 255) 50%, rgb(224, 0, 224) 55%, rgb(255, 64, 255) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff20ff', endColorstr='#ff40ff',GradientType=0 );
}
.background_glassyPurple4a,
.hover_background_glassyPurple4a:hover,
.active_background_glassyPurple4a:active:hover {
background: #ff0bff;
background-image: -moz-linear-gradient(top, rgb(255, 64, 255) 0%, rgb(224, 0, 224) 50%, rgb(255, 1, 255) 55%, rgb(255, 32, 255) 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(255, 64, 255)), color-stop(50%, rgb(224, 0, 224)), color-stop(55%, rgb(255, 1, 255)), color-stop(100%, rgb(255, 32, 255)));
background-image: -webkit-linear-gradient(top, rgb(255, 64, 255) 0%, rgb(224, 0, 224) 50%, rgb(255, 1, 255) 55%, rgb(255, 32, 255) 100%);
background-image: -o-linear-gradient(top, rgb(255, 64, 255) 0%, rgb(224, 0, 224) 50%, rgb(255, 1, 255) 55%, rgb(255, 32, 255) 100%);
background-image: -ms-linear-gradient(top, rgb(255, 64, 255) 0%, rgb(224, 0, 224) 50%, rgb(255, 1, 255) 55%, rgb(255, 32, 255) 100%);
background-image: linear-gradient(to bottom, rgb(255, 64, 255) 0%, rgb(224, 0, 224) 50%, rgb(255, 1, 255) 55%, rgb(255, 32, 255) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff40ff', endColorstr='#ff20ff',GradientType=0 );
}
.background_glassyPurple4s,
.hover_background_glassyPurple4s:hover,
.active_background_glassyPurple4s:active:hover {
background: #ff0bff;
background-image: -moz-linear-gradient(top, rgb(255, 104, 255) 0%, rgb(255, 64, 255) 50%, rgb(255, 25, 255) 55%, rgb(255, 144, 255) 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(255, 104, 255)), color-stop(50%, rgb(255, 64, 255)), color-stop(55%, rgb(255, 25, 255)), color-stop(100%, rgb(255, 144, 255)));
background-image: -webkit-linear-gradient(top, rgb(255, 104, 255) 0%, rgb(255, 64, 255) 50%, rgb(255, 25, 255) 55%, rgb(255, 144, 255) 100%);
background-image: -o-linear-gradient(top, rgb(255, 104, 255) 0%, rgb(255, 64, 255) 50%, rgb(255, 25, 255) 55%, rgb(255, 144, 255) 100%);
background-image: -ms-linear-gradient(top, rgb(255, 104, 255) 0%, rgb(255, 64, 255) 50%, rgb(255, 25, 255) 55%, rgb(255, 144, 255) 100%);
background-image: linear-gradient(to bottom, rgb(255, 104, 255) 0%, rgb(255, 64, 255) 50%, rgb(255, 25, 255) 55%, rgb(255, 144, 255) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff68ff', endColorstr='#ff90ff',GradientType=0 );
}
.background_color_glassyPurple4,
.hover_background_color_glassyPurple4:hover,
.active_background_color_glassyPurple4:active:hover {
background-color:#ff0bff;
}
.background_first_color_glassyPurple4,
.hover_background_first_color_glassyPurple4:hover,
.active_background_first_color_glassyPurple4:active:hover {
background-color:#f000f0;
}
.background_last_color_glassyPurple4,
.hover_background_last_color_glassyPurple4:hover,
.active_background_color_last_glassyPurple4:active:hover {
background-color:#ff0bff;
}
/* ------------------------------ color settings -------------------------------*/
.color_glassyPurple4,
.hover_color_glassyPurple4:hover,
.active_color_glassyPurple4:active:hover {
color: #c8c8c8;
}
.color_glassyPurple4h,
.hover_color_glassyPurple4h:hover,
.active_color_glassyPurple4h:active:hover {
color: #c8c8c8;
}
.color_glassyPurple4a,
.hover_color_glassyPurple4a:hover,
.active_color_glassyPurple4a:active:hover {
color: #ff0;
}
.color_glassyPurple4s,
.hover_color_glassyPurple4s:hover,
.active_color_glassyPurple4s:active:hover {
color: #dd0;
}
/* -------------------------- border color settings -----------------------------*/
.border_glassyPurple4,
.hover_border_glassyPurple4:hover,
.active_border_glassyPurple4:active:hover {
border-color: #c000c0 #a000a0 #a000a0 #c000c0;
}
.border_glassyPurple4h,
.hover_border_glassyPurple4h:hover,
.active_border_glassyPurple4h:active:hover {
border-color: #c000c0 #a000a0 #a000a0 #c000c0;
}
.border_glassyPurple4a,
.hover_border_glassyPurple4a:hover,
.active_border_glassyPurple4a:active:hover {
border-color: #950095 #950095 #950095 #950095;
}
.border_glassyPurple4s,
.hover_border_glassyPurple4s:hover,
.active_border_glassyPurple4s:active:hover {
border-color: #950095 #950095 #950095 #950095;
}
/* -------------------------- shadow expand settings --------------------------------*/
.shadow_expand_glassyPurple4,
.hover_shadow_expand_glassyPurple4:hover,
.active_shadow_expand_glassyPurple4:active:hover {
-webkit-box-shadow: 0em 0em 1em 0.25em rgba(255, 11, 255, .39);
-moz-box-shadow: 0em 0em 1em 0.25em rgba(255, 11, 255, .39);
box-shadow: 0em 0em 1em 0.25em rgba(255, 11, 255, .39);
}
.shadow_expand_glassyPurple4h,
.hover_shadow_expand_glassyPurple4h:hover,
.active_shadow_expand_glassyPurple4h:active:hover {
-webkit-box-shadow: 0em 0em 1em 0.25em rgba(255, 64, 255, .50);
-moz-box-shadow: 0em 0em 1em 0.25em rgba(255, 64, 255, .50);
box-shadow: 0em 0em 1em 0.25em rgba(255, 64, 255, .50);
}
.shadow_expand_glassyPurple4a,
.hover_shadow_expand_glassyPurple4a:hover,
.active_shadow_expand_glassyPurple4a:active:hover {
-webkit-box-shadow: 0em 0em 1em 0.25em rgba(255, 32, 255, .63);
-moz-box-shadow: 0em 0em 1em 0.25em rgba(255, 32, 255, .63);
box-shadow: 0em 0em 1em 0.25em rgba(255, 32, 255, .63);
}
.shadow_expand_glassyPurple4s,
.hover_shadow_expand_glassyPurple4s:hover,
.active_shadow_expand_glassyPurple4s:active:hover {
-webkit-box-shadow: 0em 0em 1em 0.25em rgba(255, 32, 255, .78);
-moz-box-shadow: 0em 0em 1em 0.25em rgba(255, 32, 255, .78);
box-shadow: 0em 0em 1em 0.25em rgba(255, 32, 255, .78);
}
/* -------------------------- shadow left settings --------------------------------*/
.shadow_left_glassyPurple4,
.hover_shadow_left_glassyPurple4:hover,
.active_shadow_left_glassyPurple4:active:hover {
-webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 11, 255, .39);
-moz-box-shadow: -0.5em -0.5em 1em rgba(255, 11, 255, .39);
box-shadow: -0.5em -0.5em 1em rgba(255, 11, 255, .39);
}
.shadow_left_glassyPurple4h,
.hover_shadow_left_glassyPurple4h:hover,
.active_shadow_left_glassyPurple4h:active:hover {
-webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 64, 255, .50);
-moz-box-shadow: -0.5em -0.5em 1em rgba(255, 64, 255, .50);
box-shadow: -0.5em -0.5em 1em rgba(255, 64, 255, .50);
}
.shadow_left_glassyPurple4a,
.hover_shadow_left_glassyPurple4a:hover,
.active_shadow_left_glassyPurple4a:active:hover {
-webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .63);
-moz-box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .63);
box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .63);
}
.shadow_left_glassyPurple4s,
.hover_shadow_left_glassyPurple4s:hover,
.active_shadow_left_glassyPurple4s:active:hover {
-webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .78);
-moz-box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .78);
box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .78);
}
/* -------------------------- shadow right settings --------------------------------*/
.shadow_right_glassyPurple4,
.hover_shadow_right_glassyPurple4:hover,
.active_shadow_right_glassyPurple4:active:hover {
-webkit-box-shadow: 0.5em 0em 1em rgba(255, 11, 255, .39);
-moz-box-shadow: 0.5em 0em 1em rgba(255, 11, 255, .39);
box-shadow: 0.5em 0em 1em rgba(255, 11, 255, .39);
}
.shadow_right_glassyPurple4h,
.hover_shadow_right_glassyPurple4h:hover,
.active_shadow_right_glassyPurple4h:active:hover {
-webkit-box-shadow: 0.5em 0em 1em rgba(255, 64, 255, .50);
-moz-box-shadow: 0.5em 0em 1em rgba(255, 64, 255, .50);
box-shadow: 0.5em 0em 1em rgba(255, 64, 255, .50);
}
.shadow_right_glassyPurple4a,
.hover_shadow_right_glassyPurple4a:hover,
.active_shadow_right_glassyPurple4a:active:hover {
-webkit-box-shadow: 0.5em 0em 1em rgba(255, 32, 255, .63);
-moz-box-shadow: 0.5em 0em 1em rgba(255, 32, 255, .63);
box-shadow: 0.5em 0em 1em rgba(255, 32, 255, .63);
}
.shadow_right_glassyPurple4s,
.hover_shadow_right_glassyPurple4s:hover,
.active_shadow_right_glassyPurple4s:active:hover {
-webkit-box-shadow: 0.5em 0em 1em rgba(255, 32, 255, .78);
-moz-box-shadow: 0.5em 0em 1em rgba(255, 32, 255, .78);
box-shadow: 0.5em 0em 1em rgba(255, 32, 255, .78);
}
/* -------------------------- shadow top settings --------------------------------*/
.shadow_top_glassyPurple4,
.hover_shadow_top_glassyPurple4:hover,
.active_shadow_top_glassyPurple4:active:hover {
-webkit-box-shadow: 0em -0.5em 1em rgba(255, 11, 255, .39);
-moz-box-shadow: 0em -0.5em 1em rgba(255, 11, 255, .39);
box-shadow: 0em -0.5em 1em rgba(255, 11, 255, .39);
}
.shadow_top_glassyPurple4h,
.hover_shadow_top_glassyPurple4h:hover,
.active_shadow_top_glassyPurple4h:active:hover {
-webkit-box-shadow: 0em -0.5em 1em rgba(255, 64, 255, .50);
-moz-box-shadow: 0em -0.5em 1em rgba(255, 64, 255, .50);
box-shadow: 0em -0.5em 1em rgba(255, 64, 255, .50);
}
.shadow_top_glassyPurple4a,
.hover_shadow_top_glassyPurple4a:hover,
.active_shadow_top_glassyPurple4a:active:hover {
-webkit-box-shadow: 0em -0.5em 1em rgba(255, 32, 255, .63);
-moz-box-shadow: 0em -0.5em 1em rgba(255, 32, 255, .63);
box-shadow: 0em -0.5em 1em rgba(255, 32, 255, .63);
}
.shadow_top_glassyPurple4s,
.hover_shadow_top_glassyPurple4s:hover,
.active_shadow_top_glassyPurple4s:active:hover {
-webkit-box-shadow: 0em -0.5em 1em rgba(255, 32, 255, .78);
-moz-box-shadow: 0em -0.5em 1em rgba(255, 32, 255, .78);
box-shadow: 0em -0.5em 1em rgba(255, 32, 255, .78);
}
/* -------------------------- shadow bottom settings --------------------------------*/
.shadow_bottom_glassyPurple4,
.hover_shadow_bottom_glassyPurple4:hover,
.active_shadow_bottom_glassyPurple4:active:hover {
-webkit-box-shadow: 0em 0.5em 1em rgba(255, 11, 255, .39);
-moz-box-shadow: 0em 0.5em 1em rgba(255, 11, 255, .39);
box-shadow: 0em 0.5em 1em rgba(255, 11, 255, .39);
}
.shadow_bottom_glassyPurple4h,
.hover_shadow_bottom_glassyPurple4h:hover,
.active_shadow_bottom_glassyPurple4h:active:hover {
-webkit-box-shadow: 0em 0.5em 1em rgba(255, 64, 255, .50);
-moz-box-shadow: 0em 0.5em 1em rgba(255, 64, 255, .50);
box-shadow: 0em 0.5em 1em rgba(255, 64, 255, .50);
}
.shadow_bottom_glassyPurple4a,
.hover_shadow_bottom_glassyPurple4a:hover,
.active_shadow_bottom_glassyPurple4a:active:hover {
-webkit-box-shadow: 0em 0.5em 1em rgba(255, 32, 255, .63);
-moz-box-shadow: 0em 0.5em 1em rgba(255, 32, 255, .63);
box-shadow: 0em 0.5em 1em rgba(255, 32, 255, .63);
}
.shadow_bottom_glassyPurple4s,
.hover_shadow_bottom_glassyPurple4s:hover,
.active_shadow_bottom_glassyPurple4s:active:hover {
-webkit-box-shadow: 0em 0.5em 1em rgba(255, 32, 255, .78);
-moz-box-shadow: 0em 0.5em 1em rgba(255, 32, 255, .78);
box-shadow: 0em 0.5em 1em rgba(255, 32, 255, .78);
}
/* -------------------------- shadow top_left settings --------------------------------*/
.shadow_top_left_glassyPurple4,
.hover_shadow_top_left_glassyPurple4:hover,
.active_shadow_top_left_glassyPurple4:active:hover {
-webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 11, 255, .39);
-moz-box-shadow: -0.5em -0.5em 1em rgba(255, 11, 255, .39);
box-shadow: -0.5em -0.5em 1em rgba(255, 11, 255, .39);
}
.shadow_top_left_glassyPurple4h,
.hover_shadow_top_left_glassyPurple4h:hover,
.active_shadow_top_left_glassyPurple4h:active:hover {
-webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 64, 255, .50);
-moz-box-shadow: -0.5em -0.5em 1em rgba(255, 64, 255, .50);
box-shadow: -0.5em -0.5em 1em rgba(255, 64, 255, .50);
}
.shadow_top_left_glassyPurple4a,
.hover_shadow_top_left_glassyPurple4a:hover,
.active_shadow_top_left_glassyPurple4a:active:hover {
-webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .63);
-moz-box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .63);
box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .63);
}
.shadow_top_left_glassyPurple4s,
.hover_shadow_top_left_glassyPurple4s:hover,
.active_shadow_top_left_glassyPurple4s:active:hover {
-webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .78);
-moz-box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .78);
box-shadow: -0.5em -0.5em 1em rgba(255, 32, 255, .78);
}
/* -------------------------- shadow top_right settings --------------------------------*/
.shadow_top_right_glassyPurple4,
.hover_shadow_top_right_glassyPurple4:hover,
.active_shadow_top_right_glassyPurple4:active:hover {
-webkit-box-shadow: 0.5em -0.5em 1em rgba(255, 11, 255, .39);
-moz-box-shadow: 0.5em -0.5em 1em rgba(255, 11, 255, .39);
box-shadow: 0.5em -0.5em 1em rgba(255, 11, 255, .39);
}
.shadow_top_right_glassyPurple4h,
.hover_shadow_top_right_glassyPurple4h:hover,
.active_shadow_top_right_glassyPurple4h:active:hover {
-webkit-box-shadow: 0.5em -0.5em 1em rgba(255, 64, 255, .50);
-moz-box-shadow: 0.5em -0.5em 1em rgba(255, 64, 255, .50);
box-shadow: 0.5em -0.5em 1em rgba(255, 64, 255, .50);
}
.shadow_top_right_glassyPurple4a,
.hover_shadow_top_right_glassyPurple4a:hover,
.active_shadow_top_right_glassyPurple4a:active:hover {
-webkit-box-shadow: 0.5em -0.5em 1em rgba(255, 32, 255, .63);
-moz-box-shadow: 0.5em -0.5em 1em rgba(255, 32, 255, .63);
box-shadow: 0.5em -0.5em 1em rgba(255, 32, 255, .63);
}
.shadow_top_right_glassyPurple4s,
.hover_shadow_top_right_glassyPurple4s:hover,
.active_shadow_top_right_glassyPurple4s:active:hover {
-webkit-box-shadow: 0.5em -0.5em 1em rgba(255, 32, 255, .78);
-moz-box-shadow: 0.5em -0.5em 1em rgba(255, 32, 255, .78);
box-shadow: 0.5em -0.5em 1em rgba(255, 32, 255, .78);
}
/* -------------------------- shadow bottom_left settings --------------------------------*/
.shadow_bottom_left_glassyPurple4,
.hover_shadow_bottom_left_glassyPurple4:hover,
.active_shadow_bottom_left_glassyPurple4:active:hover {
-webkit-box-shadow: -0.5em 0.5em 1em rgba(255, 11, 255, .39);
-moz-box-shadow: -0.5em 0.5em 1em rgba(255, 11, 255, .39);
box-shadow: -0.5em 0.5em 1em rgba(255, 11, 255, .39);
}
.shadow_bottom_left_glassyPurple4h,
.hover_shadow_bottom_left_glassyPurple4h:hover,
.active_shadow_bottom_left_glassyPurple4h:active:hover {
-webkit-box-shadow: -0.5em 0.5em 1em rgba(255, 64, 255, .50);
-moz-box-shadow: -0.5em 0.5em 1em rgba(255, 64, 255, .50);
box-shadow: -0.5em 0.5em 1em rgba(255, 64, 255, .50);
}
.shadow_bottom_left_glassyPurple4a,
.hover_shadow_bottom_left_glassyPurple4a:hover,
.active_shadow_bottom_left_glassyPurple4a:active:hover {
-webkit-box-shadow: -0.5em 0.5em 1em rgba(255, 32, 255, .63);
-moz-box-shadow: -0.5em 0.5em 1em rgba(255, 32, 255, .63);
box-shadow: -0.5em 0.5em 1em rgba(255, 32, 255, .63);
}
.shadow_bottom_left_glassyPurple4s,
.hover_shadow_bottom_left_glassyPurple4s:hover,
.active_shadow_bottom_left_glassyPurple4s:active:hover {
-webkit-box-shadow: -0.5em 0.5em 1em rgba(255, 32, 255, .78);
-moz-box-shadow: -0.5em 0.5em 1em rgba(255, 32, 255, .78);
box-shadow: -0.5em 0.5em 1em rgba(255, 32, 255, .78);
}
/* -------------------------- shadow bottom_right settings --------------------------------*/
.shadow_bottom_right_glassyPurple4,
.hover_shadow_bottom_right_glassyPurple4:hover,
.active_shadow_bottom_right_glassyPurple4:active:hover {
-webkit-box-shadow: 0.5em 0.5em 1em rgba(255, 11, 255, .39);
-moz-box-shadow: 0.5em 0.5em 1em rgba(255, 11, 255, .39);
box-shadow: 0.5em 0.5em 1em rgba(255, 11, 255, .39);
}
.shadow_bottom_right_glassyPurple4h,
.hover_shadow_bottom_right_glassyPurple4h:hover,
.active_shadow_bottom_right_glassyPurple4h:active:hover {
-webkit-box-shadow: 0.5em 0.5em 1em rgba(255, 64, 255, .50);
-moz-box-shadow: 0.5em 0.5em 1em rgba(255, 64, 255, .50);
box-shadow: 0.5em 0.5em 1em rgba(255, 64, 255, .50);
}
.shadow_bottom_right_glassyPurple4a,
.hover_shadow_bottom_right_glassyPurple4a:hover,
.active_shadow_bottom_right_glassyPurple4a:active:hover {
-webkit-box-shadow: 0.5em 0.5em 1em rgba(255, 32, 255, .63);
-moz-box-shadow: 0.5em 0.5em 1em rgba(255, 32, 255, .63);
box-shadow: 0.5em 0.5em 1em rgba(255, 32, 255, .63);
}
.shadow_bottom_right_glassyPurple4s,
.hover_shadow_bottom_right_glassyPurple4s:hover,
.active_shadow_bottom_right_glassyPurple4s:active:hover {
-webkit-box-shadow: 0.5em 0.5em 1em rgba(255, 32, 255, .78);
-moz-box-shadow: 0.5em 0.5em 1em rgba(255, 32, 255, .78);
box-shadow: 0.5em 0.5em 1em rgba(255, 32, 255, .78);
}
| 45.019185
| 216
| 0.684973
|
c4b457a7d61ab62179e13416dda2f179f7be4a5e
| 1,663
|
hh
|
C++
|
modules/Tsp/TspParticle.hh
|
ElonKou/genetic
|
507f739b44399b8dbae1bde4523fbb718704e223
|
[
"MIT"
] | null | null | null |
modules/Tsp/TspParticle.hh
|
ElonKou/genetic
|
507f739b44399b8dbae1bde4523fbb718704e223
|
[
"MIT"
] | null | null | null |
modules/Tsp/TspParticle.hh
|
ElonKou/genetic
|
507f739b44399b8dbae1bde4523fbb718704e223
|
[
"MIT"
] | null | null | null |
#pragma once
#include "TspAlgorithmBase.hh"
typedef struct SpeedItem {
int x;
int y;
} SpeedItem;
class TspParticle : public TspAlgorithmBase {
public:
std::vector<SpeedItem> m_personal; // cur:A -> his:B (current vs personal history)
std::vector<SpeedItem> m_global; // cur:A -> bst:B (current and global history)
std::vector<std::vector<int>> p_best_genes; // record all best genes for all personal gene history.
std::vector<std::vector<SpeedItem>> m_speeds; // record particle's old speeds.
float w; // keep current rate.
float alpha; // move personal best rate.
float beta; // move hsitory best rate.
float gama; // move random.
TspParticle();
TspParticle(int node_cnt, int agent_cnt, float w_, float alpha_, float beta_, float gama = 0.1);
~TspParticle();
void Init();
void SomeInit();
void RandomRemoveWorstParticles();
/**
* Calculate velocity of all particles between two positions.
*/
void CalculateVelocity(std::vector<int>& cur_ori, const std::vector<int>& per, const std::vector<int>& glo, std::vector<SpeedItem>& cur_speed, std::vector<SpeedItem>& speed);
/**
* Calculate new position of all velocity and current position.
*/
void CalculatePosition(std::vector<int>& cur, std::vector<SpeedItem>& cur_speed);
virtual void Step();
virtual void Predict();
virtual void GetCurrentBest(std::vector<int>& best, float& score);
};
| 33.938776
| 178
| 0.595911
|
0dfb4a630e757afcc404d920e5ed42854902f693
| 6,679
|
cs
|
C#
|
Cranks.Result.Tests/ExtensionAndFactoryTests/Result.WithValueIf.Tests.cs
|
crazycrank/Cranks.Result
|
e6674170de88b4f7621ccaac38bc44b2cda97409
|
[
"MIT"
] | 5
|
2021-03-17T21:38:27.000Z
|
2021-03-19T13:02:23.000Z
|
Cranks.Result.Tests/ExtensionAndFactoryTests/Result.WithValueIf.Tests.cs
|
crazycrank/ResultZ
|
e6674170de88b4f7621ccaac38bc44b2cda97409
|
[
"MIT"
] | 2
|
2021-03-18T13:10:54.000Z
|
2021-05-17T01:06:11.000Z
|
Cranks.Result.Tests/ExtensionAndFactoryTests/Result.WithValueIf.Tests.cs
|
crazycrank/ResultZ
|
e6674170de88b4f7621ccaac38bc44b2cda97409
|
[
"MIT"
] | 1
|
2021-03-15T14:10:04.000Z
|
2021-03-15T14:10:04.000Z
|
using Cranks.Result.Tests.Utils;
using Moq;
using Shouldly;
using Xunit;
namespace Cranks.Result.Tests.ExtensionAndFactoryTests
{
public class ResultWithValueIfTests
{
[Fact]
public void WithValueIf_True_OnPassed_NowHasValue()
{
var result = Result.WithValue("oldValue")
.WithValueIf(true, "value");
result.ShouldBeOfType<Passed<string>>();
result.Value.ShouldBe("value");
}
[Fact]
public void WithValueIf_True_OnFailed_ValueIsDropped()
{
var result = Result.WithValue("oldValue")
.Fail()
.WithValueIf(true, "value");
result.ShouldBeOfType<Failed<string>>();
ShouldThrowExtensions.ShouldThrow<ResultException>(() => result.Value);
}
[Fact]
public void WithValueIf_False_OnPassed_RetainsOldValue()
{
var result = Result.WithValue("oldValue")
.WithValueIf(false, "value");
result.ShouldBeOfType<Passed<string>>();
result.Value.ShouldBe("oldValue");
}
[Fact]
public void WithValueIf_True_OnPassed_WithOrValue_NowHasValue()
{
var result = Result.WithValue("oldValue")
.WithValueIf(true, "value", "orValue");
result.ShouldBeOfType<Passed<string>>();
result.Value.ShouldBe("value");
}
[Fact]
public void WithValueIf_False_OnPassed_WithOrValue_NowHasOrValue()
{
var result = Result.WithValue("oldValue")
.WithValueIf(false, "value", "orValue");
result.ShouldBeOfType<Passed<string>>();
result.Value.ShouldBe("orValue");
}
[Fact]
public void WithValueIf_True_OnFailed_WithOrValue_ValueIsDropped()
{
var result = Result.WithValue("oldValue")
.Fail()
.WithValueIf(true, "value", "orValue");
result.ShouldBeOfType<Failed<string>>();
ShouldThrowExtensions.ShouldThrow<ResultException>(() => result.Value);
}
[Fact]
public void WithValueIf_False_OnFailed_WithOrValue_ValueIsDropped()
{
var result = Result.WithValue("oldValue")
.Fail()
.WithValueIf(false, "value", "orValue");
result.ShouldBeOfType<Failed<string>>();
ShouldThrowExtensions.ShouldThrow<ResultException>(() => result.Value);
}
[Fact]
public void WithValueIf_True_OnPassed_NowHasValue_WithValueFactory()
{
var mock = IValueFactoryMock<string>.GetMock("value", "orValue");
var result = Result.WithValue("oldValue")
.WithValueIf(true, () => mock.Object.Value());
result.ShouldBeOfType<Passed<string>>();
result.Value.ShouldBe("value");
mock.Verify(m => m.Value(), Times.Once);
}
[Fact]
public void WithValueIf_True_OnFailed_ValueIsDropped_WithValueFactory()
{
var mock = IValueFactoryMock<string>.GetMock("value", "orValue");
var result = Result.WithValue("oldValue")
.Fail()
.WithValueIf(true, () => mock.Object.Value());
result.ShouldBeOfType<Failed<string>>();
ShouldThrowExtensions.ShouldThrow<ResultException>(() => result.Value);
mock.Verify(m => m.Value(), Times.Never);
}
[Fact]
public void WithValueIf_False_OnPassed_RetainsOldValue_WithValueFactory()
{
var mock = IValueFactoryMock<string>.GetMock("value", "orValue");
var result = Result.WithValue("oldValue")
.WithValueIf(false, () => mock.Object.Value());
result.ShouldBeOfType<Passed<string>>();
result.Value.ShouldBe("oldValue");
mock.Verify(m => m.Value(), Times.Never);
}
[Fact]
public void WithValueIf_True_OnPassed_WithOrValue_NowHasValue_WithValueFactory()
{
var mock = IValueFactoryMock<string>.GetMock("value", "orValue");
var result = Result.WithValue("oldValue")
.WithValueIf(true, () => mock.Object.Value(), () => mock.Object.OrValue());
result.ShouldBeOfType<Passed<string>>();
result.Value.ShouldBe("value");
mock.Verify(m => m.Value(), Times.Once);
mock.Verify(m => m.OrValue(), Times.Never);
}
[Fact]
public void WithValueIf_False_OnPassed_WithOrValue_NowHasOrValue_WithValueFactory()
{
var mock = IValueFactoryMock<string>.GetMock("value", "orValue");
var result = Result.WithValue("oldValue")
.WithValueIf(false, () => mock.Object.Value(), () => mock.Object.OrValue());
result.ShouldBeOfType<Passed<string>>();
result.Value.ShouldBe("orValue");
mock.Verify(m => m.Value(), Times.Never);
mock.Verify(m => m.OrValue(), Times.Once);
}
[Fact]
public void WithValueIf_True_OnFailed_WithOrValue_ValueIsDropped_WithValueFactory()
{
var mock = IValueFactoryMock<string>.GetMock("value", "orValue");
var result = Result.WithValue("oldValue")
.Fail()
.WithValueIf(true, () => mock.Object.Value(), () => mock.Object.OrValue());
result.ShouldBeOfType<Failed<string>>();
ShouldThrowExtensions.ShouldThrow<ResultException>(() => result.Value);
mock.Verify(m => m.Value(), Times.Never);
mock.Verify(m => m.OrValue(), Times.Never);
}
[Fact]
public void WithValueIf_False_OnFailed_WithOrValue_ValueIsDropped_WithValueFactory()
{
var mock = IValueFactoryMock<string>.GetMock("value", "orValue");
var result = Result.WithValue("oldValue")
.Fail()
.WithValueIf(false, () => mock.Object.Value(), () => mock.Object.OrValue());
result.ShouldBeOfType<Failed<string>>();
ShouldThrowExtensions.ShouldThrow<ResultException>(() => result.Value);
mock.Verify(m => m.Value(), Times.Never);
mock.Verify(m => m.OrValue(), Times.Never);
}
}
}
| 36.102703
| 107
| 0.549933
|
45ab0cafa08e6e0155dad5d9beed6e7c1b803bd6
| 1,166
|
py
|
Python
|
estimateratio/estimate_ratio.py
|
anthony-aylward/estimateratio
|
0b4ed577150a27ee0f1e61f5d45ff14a4327090c
|
[
"MIT"
] | null | null | null |
estimateratio/estimate_ratio.py
|
anthony-aylward/estimateratio
|
0b4ed577150a27ee0f1e61f5d45ff14a4327090c
|
[
"MIT"
] | null | null | null |
estimateratio/estimate_ratio.py
|
anthony-aylward/estimateratio
|
0b4ed577150a27ee0f1e61f5d45ff14a4327090c
|
[
"MIT"
] | null | null | null |
#===============================================================================
# estimate_ratio.py
#===============================================================================
"""Estimate the ratio of two random variables from a sample"""
from math import sqrt
from statistics import mean
def estimate_ratio(x, y, conf: float = 0.95):
"""Estimate the ratio of two random variables from a sample
Parameters
----------
x
iterable of observations for denomenator
y
iterable of observations for numerator
conf : float
confidence level for confidence intervals
Returns
-------
dict
A dict with keys 'r', 'variance', 'sd', and 'ci' giving the estimated
ratio, variance, standard deviation, and confidence interval
"""
m_x = mean(x)
m_y = mean(y)
r = m_y / m_x
s_r_2 = 1 / (len(x) - 1) * sum((y_i - r * x_i)**2 for x_i, y_i in zip(x, y))
var_r = 1 / m_x**2 * s_r_2 / len(x)
sd_r = sqrt(var_r)
l = 2 / (3 * sqrt(1 - conf))
return {
'r': r,
'variance': var_r,
'sd': sd_r,
'ci': (r - sd_r * l, r + sd_r * l)
}
| 26.5
| 80
| 0.48542
|
4596b5ff0098ec1f335d9381c7fa4c8d2a142b71
| 10,719
|
py
|
Python
|
ama/dbscan_processor.py
|
k-zen/Ama
|
a5889996201dcb6a5b0ccd9cd0f369ce95aec6b6
|
[
"BSD-2-Clause"
] | null | null | null |
ama/dbscan_processor.py
|
k-zen/Ama
|
a5889996201dcb6a5b0ccd9cd0f369ce95aec6b6
|
[
"BSD-2-Clause"
] | null | null | null |
ama/dbscan_processor.py
|
k-zen/Ama
|
a5889996201dcb6a5b0ccd9cd0f369ce95aec6b6
|
[
"BSD-2-Clause"
] | 1
|
2018-09-15T03:46:25.000Z
|
2018-09-15T03:46:25.000Z
|
# -*- coding: utf-8 -*-
"""
Clase perteneciente al módulo de procesamiento de datos e inferencias Ama.
.. module:: dbscan_processor
:platform: Unix
:synopsis: Detección de clusters de tormenta utilizando el algoritmo DBSCAN.
.. moduleauthor:: Andreas P. Koenzen <akc@apkc.net>
"""
import ama.utils as utils
import ama.processor as processor
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import time
import wradlib as wrl
from geopy.distance import great_circle
from shapely.geometry import MultiPoint
from sklearn.cluster import DBSCAN
__author__ = "Andreas P. Koenzen"
__copyright__ = "Copyright 2016, Proyecto de Tesis / Universidad Católica de Asunción."
__credits__ = "Andreas P. Koenzen"
__license__ = "BSD"
__version__ = "0.1"
__maintainer__ = "Andreas P. Koenzen"
__email__ = "akc@apkc.net"
__status__ = "Prototype"
class DBSCANProcessor:
"""
Detección de clusters de tormenta utilizando el algoritmo DBSCAN.
Valores óptimos Epsilon = 10.0, Densidad = 300
"""
def __init__(self):
pass
###### OPCIONES DE PROCESAMIENTO ######
KMS_PER_RADIAN = 6371.0088
"""
float: La cantidad de kilómetros en un radián.
"""
EPSILON = 10. / KMS_PER_RADIAN
"""
float: El espacio radial o distancia entre puntos.
"""
MIN_SAMPLES = 300
"""
int: La cantidad mínima de puntos para ser considerado un cluster.
"""
TESTING_POINTS = 20
"""
int: La cantidad máxima de puntos a utilizar para las pruebas y verificaciones.
"""
def get_centermost_point(self, clusters):
"""
Función que detecta el centroide para cada cluster de tormenta.
:param clusters: Un vector con los clusters detectados por DBSCAN.
:return: Un vector con tuplas de Latitud, Longitud correspondientes a cada centroide.
"""
result = []
for cluster in clusters:
if len(cluster):
centroid = (MultiPoint(cluster).centroid.x, MultiPoint(cluster).centroid.y)
centermost_point = min(cluster, key=lambda point: great_circle(point, centroid).m)
result.append(tuple(centermost_point))
return result
def detect_dbz_clusters(self, filename, layer, test=False):
"""
Función que detecta los clusters de tormenta.
:param filename: El archivo con datos de Radar a procesar.
:param layer: La capa de datos a procesar. Cada capa corresponde a un ángulo de elevación del radar.
:param test: Habilitar modo verificación de datos. En modo verificación se utilizan pocos datos \
para poder verificar cada uno de los datos.
:return: matrix = Una matriz de Nx3 con los valores originales. \
no_noise = Un vector de vectores con todos los puntos detectados como no-ruido. \
centermost_points = Un vector de tuplas con las coordenadas de los centroides detectados. \
time = Fecha/hora de los datos. \
radar = Tupla con las coordenadas del radar.
"""
data, metadata = processor.Processor.process(filename)
lat_vector = []
lon_vector = []
dBZ_vector = []
layer_key = u"SCAN{0}".format(layer)
radar_latitude = float(metadata["VOL"]["Latitude"])
radar_longitude = float(metadata["VOL"]["Longitude"])
for (row, column), value in np.ndenumerate(data[layer_key][u"Z"]["data"]):
if value > -64.:
rng = metadata[layer_key]["r"][column]
azi = metadata[layer_key]["az"][row]
dBZ = value
lon, lat = wrl.georef.polar2lonlat(rng, azi, (radar_longitude, radar_latitude))
# realizar los redondeos
dBZ_value = float("{0:.1f}".format(dBZ))
latitude_value = float("{0:.5f}".format(lat))
longitude_value = float("{0:.5f}".format(lon))
# filtrar los datos.
if dBZ_value >= processor.Processor.MINIMUM_REFLECTIVITY and dBZ_value <= processor.Processor.MAXIMUM_REFLECTIVITY:
lat_vector.append(latitude_value)
lon_vector.append(longitude_value)
dBZ_vector.append(dBZ_value)
if test == 1:
if len(lat_vector) > self.TESTING_POINTS:
break
###### DBSCAN ######
#
# Convertir los vectores de latitud, longitud y dBZ a una matriz de Nx3.
#
# Ejemplo:
# -25.29036 -57.52304 20.0
# -25.28811 -57.52302 30.0
#
matrix = np.column_stack((lat_vector, lon_vector, dBZ_vector))
print("")
print(utils.Colors.BOLD + "### Matriz Latitud-Longitud-dBZ ###" + utils.Colors.ENDC)
print(utils.Colors.BOLD + "Tamaño: {0}".format(matrix.shape) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "{0}".format(np.matrix(matrix)) + utils.Colors.ENDC)
print("")
#
# Ejecutar el algoritmo DBSCAN sobre la matriz recién generada, pero los valores
# deben ser convertidos a radianes para poder aplicar la función haversine sobre cada
# punto.
#
start_time = time.time()
db = DBSCAN(eps=self.EPSILON, min_samples=self.MIN_SAMPLES, algorithm='ball_tree', metric='haversine').fit(
np.radians(np.column_stack((lat_vector, lon_vector))))
cluster_labels = db.labels_
num_clusters = len(set(cluster_labels))
end_time = time.time()
print("")
print(utils.Colors.BOLD + "### DBSCAN sobre matriz Latitud-Longitud ###" + utils.Colors.ENDC)
print(utils.Colors.BOLD + "Nro. Puntos: {0}".format(len(matrix)) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "Nro. Clusteres: {0}".format(num_clusters) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "Compresión: {0}".format(100 * (1 - float(num_clusters) / len(matrix))) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "Tiempo: {0} segundos".format(end_time - start_time) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "Tamaño: {0}".format(cluster_labels.shape) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "{0}".format(np.array(cluster_labels)) + utils.Colors.ENDC)
print("")
clusters = pd.Series([matrix[cluster_labels == n] for n in range(num_clusters)])
print("")
print(utils.Colors.BOLD + "### Lista de Clusteres ###" + utils.Colors.ENDC)
print(utils.Colors.BOLD + "Tamaño: {0}".format(clusters.shape) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "{0}".format(clusters.to_string()) + utils.Colors.ENDC)
print("###")
print(utils.Colors.BOLD + "Clusteres:" + utils.Colors.ENDC)
for cluster in clusters:
print(utils.Colors.BOLD + "Tamaño: {0}".format(cluster.shape) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "{0}".format(cluster) + utils.Colors.ENDC)
print("")
#
# Vector de tuplas con todos los centroides.
#
# Ejemplo:
# [(-25.29036,-57.52304),...]
#
centermost_points = self.get_centermost_point(clusters)
print("")
print(utils.Colors.BOLD + "### Centroides ###" + utils.Colors.ENDC)
print(utils.Colors.BOLD + "Tamaño: {0}".format(len(centermost_points)) + utils.Colors.ENDC)
print(utils.Colors.BOLD + "{0}".format(centermost_points) + utils.Colors.ENDC)
print("")
#
# Juntar todos los puntos detectados como no-ruido.
#
no_noise = []
for cluster in clusters:
for row in cluster:
no_noise.append(row)
return matrix, no_noise, centermost_points, metadata[layer_key]["Time"], (radar_latitude, radar_longitude)
def plot_all_points(self, filename, layer, test=False):
"""
Función que genera un gráfico con los datos detectados por la función DBSCAN.
:param filename: El archivo con datos de Radar a procesar.
:param layer: La capa de datos a procesar. Cada capa corresponde a un ángulo de elevación del radar.
:param test: Habilitar modo verificación de datos. En modo verificación se utilizan pocos datos \
para poder verificar cada uno de los datos.
:return: void
"""
#
# Datos que retorna el proceso de detección de clusters.
#
original, clustered, centroids, time, radar_coordinates = self.detect_dbz_clusters(filename, layer, test)
if len(clustered) > 0:
original_lats, original_lons, original_dBZ = zip(*original)
clustered_lats, clustered_lons, clustered_dBZ = zip(*clustered)
centroid_lats, centroid_lons, centroid_dBZ = zip(*centroids)
###### PLOTEAR ######
#
# Aquí ploteamos los datos completos con una capa extra encima donde se
# muestran los clusteres detectados con sus correpondientes centroides.
#
plt.style.use(u'ggplot')
fig1, ax1 = plt.subplots(figsize=[10, 6])
original_scatter = ax1.scatter(original_lons, original_lats, c=original_dBZ, alpha=1.0, s=6)
clustered_scatter = ax1.scatter(clustered_lons, clustered_lats, c='black', alpha=1.0, s=12)
centroids_scatter = ax1.scatter(centroid_lons, centroid_lats, c='red', edgecolor='None', alpha=0.7, s=120)
radar_scatter = ax1.scatter(radar_coordinates[1], radar_coordinates[0], c='green', edgecolor='None', alpha=1.0, s=80)
ax1.set_title(
u"Reflectividades (dBZ) entre los valores {0} a {1}. Elevación Radar = Capa {2} / {3}".format(
processor.Processor.MINIMUM_REFLECTIVITY,
processor.Processor.MAXIMUM_REFLECTIVITY,
layer + 1,
time),
fontsize=11,
fontweight="bold",
y=1.05)
ax1.set_xlabel('Longitud')
ax1.set_ylabel('Latitud')
ax1.legend(
[original_scatter, clustered_scatter, centroids_scatter, radar_scatter],
[
"dBZ {0} - {1}".format(processor.Processor.MINIMUM_REFLECTIVITY, processor.Processor.MAXIMUM_REFLECTIVITY),
"Datos Limpios",
"Centroides Clusters",
u"Ubicación Radar"
],
loc='upper right')
plt.show()
else:
print(utils.Colors.BOLD + "---" + utils.Colors.ENDC)
print(utils.Colors.BOLD + "No se detectaron clusters." + utils.Colors.ENDC)
| 42.200787
| 131
| 0.612091
|
817349b5c3ba90b7c9cc555dc0699247165dd09d
| 383
|
php
|
PHP
|
module/Menu/view/helper/ShowMenu.php
|
imediasun/indigo
|
038900c3b538b552f15ed082de2f48e66215c2b0
|
[
"BSD-3-Clause"
] | null | null | null |
module/Menu/view/helper/ShowMenu.php
|
imediasun/indigo
|
038900c3b538b552f15ed082de2f48e66215c2b0
|
[
"BSD-3-Clause"
] | null | null | null |
module/Menu/view/helper/ShowMenu.php
|
imediasun/indigo
|
038900c3b538b552f15ed082de2f48e66215c2b0
|
[
"BSD-3-Clause"
] | null | null | null |
<?php
namespace Menu\View\Helper;
use Zend\View\Helper\AbstractHelper;
class ShowMenu extends AbstractHelper
{
public function __invoke($str, $find)
{
if (!is_string($str)){
return 'must be string';
}
if (strpos($str, $find) === false){
return 'not found';
}
return 'found';
}
}
| 16.652174
| 44
| 0.51436
|
bb4f9f2a2c370579ddca57847dbfcc390b499726
| 514
|
cshtml
|
C#
|
HairSalon/Views/Stylists/New.cshtml
|
antonyukmaryana/HairSalon
|
ae5a900ab8b2199abee42375e8ef0cc863e01a1a
|
[
"MIT"
] | null | null | null |
HairSalon/Views/Stylists/New.cshtml
|
antonyukmaryana/HairSalon
|
ae5a900ab8b2199abee42375e8ef0cc863e01a1a
|
[
"MIT"
] | null | null | null |
HairSalon/Views/Stylists/New.cshtml
|
antonyukmaryana/HairSalon
|
ae5a900ab8b2199abee42375e8ef0cc863e01a1a
|
[
"MIT"
] | null | null | null |
@using HairSalon.Models;
<h1> We are happy to welcome you at our Hair Salon</h1>
<h2>Please enter information.</h2>
<form action='/stylists/new' method='post'>
<label for='stylistName'>Enter Stylist name:</label>
<input id='stylistName' name='stylistName' type='text'>
<label for='stylistDescription'>Enter Stylist desctiprion:</label>
<input id='stylistDescription' name='StylistDescription' type='text'>
<button type='submit'>Add stylist</button>
</form>
<p><a href='/'>Return to Main Page</a></p>
| 32.125
| 71
| 0.714008
|
d9385be71e87611db80e0e76e8ce00d3d77bb296
| 6,143
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_1122.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_1122.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_1122.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 %r10
push %r12
push %r14
push %r15
push %r8
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x13a9b, %rsi
lea addresses_WC_ht+0x14b4c, %rdi
nop
nop
nop
xor %r15, %r15
mov $36, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $14863, %r8
lea addresses_WC_ht+0x1e79b, %rsi
lea addresses_D_ht+0x11a9b, %rdi
nop
nop
add %r10, %r10
mov $103, %rcx
rep movsl
nop
nop
sub %rdi, %rdi
lea addresses_normal_ht+0xfb, %r8
nop
nop
sub $43280, %r14
movb $0x61, (%r8)
nop
nop
nop
nop
nop
and $8661, %rcx
lea addresses_A_ht+0x1ced3, %rsi
lea addresses_D_ht+0x1569b, %rdi
nop
nop
nop
nop
xor $9176, %r15
mov $76, %rcx
rep movsl
nop
nop
nop
nop
sub $40055, %rsi
lea addresses_D_ht+0x6495, %rsi
lea addresses_D_ht+0x1029b, %rdi
nop
xor %r12, %r12
mov $6, %rcx
rep movsl
nop
and %rcx, %rcx
lea addresses_normal_ht+0x1bd4b, %rcx
nop
nop
nop
inc %rsi
and $0xffffffffffffffc0, %rcx
vmovaps (%rcx), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %r10
nop
and %r15, %r15
lea addresses_D_ht+0xb99b, %rdi
nop
nop
nop
nop
nop
cmp %rsi, %rsi
movb $0x61, (%rdi)
nop
inc %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r8
push %rax
push %rdi
push %rsi
// Store
lea addresses_PSE+0x1e492, %r13
nop
nop
nop
nop
nop
and %r14, %r14
mov $0x5152535455565758, %rdi
movq %rdi, %xmm4
movups %xmm4, (%r13)
add $19927, %r11
// Faulty Load
lea addresses_PSE+0x17a9b, %r13
xor %r8, %r8
vmovups (%r13), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %rax
lea oracles, %r14
and $0xff, %rax
shlq $12, %rax
mov (%r14,%rax,1), %rax
pop %rsi
pop %rdi
pop %rax
pop %r8
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
| 38.63522
| 2,999
| 0.661566
|
b05a6d7c5837d692d2c119a62cc1ca7614bb3f8b
| 5,924
|
py
|
Python
|
src/core/python/llnms/viewer/ui/NetworkSummaryPage.py
|
marvins/LLNMS
|
ebc15418e1a5dddafdb3e55cea4e8cb71f619b2d
|
[
"MIT"
] | null | null | null |
src/core/python/llnms/viewer/ui/NetworkSummaryPage.py
|
marvins/LLNMS
|
ebc15418e1a5dddafdb3e55cea4e8cb71f619b2d
|
[
"MIT"
] | null | null | null |
src/core/python/llnms/viewer/ui/NetworkSummaryPage.py
|
marvins/LLNMS
|
ebc15418e1a5dddafdb3e55cea4e8cb71f619b2d
|
[
"MIT"
] | 1
|
2020-12-16T09:28:26.000Z
|
2020-12-16T09:28:26.000Z
|
#!/usr/bin/env python
# System Libraries
import curses, logging
# LLNMS Libraries
import CursesTable
from NetworkAddWindow import NetworkAddWindow
from UI_Window_Base import Base_Window_Type
from WarningWindow import WarningWindow
# ---------------------------------------- #
# - Network Summary Window - #
# ---------------------------------------- #
class NetworkSummaryWindow(Base_Window_Type):
# Default NCurses Screen
screen = []
# Exit loop variable
exit_window = False
# Subwindows
sub_windows = []
# Add network subwindow
ADD_NETWORK_INDEX = 0
# Current Network
current_network = 0
# ------------------------------- #
# - Constructor - #
# ------------------------------- #
def __init__(self, screen, title = None):
# Build the Parent
Base_Window_Type.__init__(self,
title="Network Summary Window",
screen=screen)
# Set the screen
self.screen = screen
# Add the add network window
self.sub_windows.append(NetworkAddWindow(screen))
# ----------------------------- #
# - Process the window - #
# ----------------------------- #
def Process(self, llnms_state):
logging.info('Start of NetworkSummaryPage.Process() method. There are ' + str(len(llnms_state.network_list)) + ' networks.')
self.exit_window = False
while self.exit_window == False:
# clear the screen
self.screen.clear()
# Print the header
self.Render_Header()
# Print the tables
max_network_row = curses.LINES - 5
self.Render_Network_Summary_Table( llnms_state, 3, max_network_row )
# Print the footer
self.Render_Footer()
# grab the input
self.screen.addstr( curses.LINES-1, 0, 'option:')
self.screen.refresh()
# get input
c = self.screen.getch()
# If user wants to quit
if c == ord('q'):
self.exit_window = True
# If user wants to refresh network screen
elif c == ord('r'):
llnms_state.Reload_Networks()
# Add network
elif c == ord('a'):
llnms_state = self.sub_windows[self.ADD_NETWORK_INDEX].Process(llnms_state)
# Delete network key
elif c == ord('d'):
# Make sure the user wishes to do this
result = WarningWindow().Process(self.screen)
if result == True:
# Delete the file
llnms_state.Remove_Network( llnms_state.network_list[self.current_network] )
# Decrent the cursor
self.current_network -= 1
# Arrow Keys
elif c == curses.KEY_UP:
self.current_network = max(0, self.current_network-1)
# Arrow Keys
elif c == curses.KEY_DOWN:
self.current_network = min( len(llnms_state.network_list)-1, self.current_network+1)
# Return the state
return llnms_state
# ------------------------- #
# - Render Header - #
# ------------------------- #
def Render_Header(self):
# Add the title
self.screen.addstr( 0, 0, self.window_title)
# Add the horizontal bar
self.screen.addstr( 1, 0, '-' * (curses.COLS-1))
# --------------------------------------- #
# - Print Network Summary Footer - #
# --------------------------------------- #
def Render_Footer(self):
# Render Horizontal Bar
self.screen.addstr( curses.LINES-4, 0, '-' * (curses.COLS-1))
# Render Menu
self.screen.addstr( curses.LINES-3, 0, 'q) Return to main menu, r) Refresh, Up/Down Arrows) Switch Networks')
self.screen.addstr( curses.LINES-2, 0, 'a) Add network definition, d) Delete network')
# ------------------------------------------ #
# - Print the Network Summary Table - #
# ------------------------------------------ #
def Render_Network_Summary_Table(self, llnms_state, min_row, max_row ):
# Create the table
table = CursesTable.CursesTable( 3, 1 )
# Set the column headers
table.Set_Column_Header_Item( 0, ' Network Name', 0.40)
table.Set_Column_Header_Item( 1, ' Min Address', 0.30)
table.Set_Column_Header_Item( 2, ' Max Address', 0.30)
table.Set_Column_Alignment( 0, CursesTable.StringAlignment.ALIGN_LEFT )
table.Set_Column_Alignment( 1, CursesTable.StringAlignment.ALIGN_LEFT )
table.Set_Column_Alignment( 2, CursesTable.StringAlignment.ALIGN_LEFT )
# Load the table
for x in xrange( 0, len(llnms_state.network_list)):
# Set the Name
table.Set_Item( 0, x+1, llnms_state.network_list[x].name )
# Set the start address
table.Set_Item( 1, x+1, llnms_state.network_list[x].address_start )
# Set the end address
table.Set_Item( 2, x+1, llnms_state.network_list[x].address_end )
# Print the Table
min_col = 2
max_col = curses.COLS-1 - min_col
min_print_row = min_row+2
table.Render_Table( self.screen,
min_col,
max_col,
min_print_row,
max_row,
self.current_network+1)
# -------------------------------------------------- #
# - Command for externally closing the window - #
# -------------------------------------------------- #
def Close_Window(self):
self.exit_window = True
| 32.021622
| 134
| 0.505402
|
c47171f2c1440e31b553a7d616ac860c2d1647e9
| 1,840
|
cc
|
C++
|
content/browser/ssl/ssl_host_state.cc
|
Crystalnix/BitPop
|
1fae4ecfb965e163f6ce154b3988b3181678742a
|
[
"BSD-3-Clause"
] | 7
|
2015-05-20T22:41:35.000Z
|
2021-11-18T19:07:59.000Z
|
content/browser/ssl/ssl_host_state.cc
|
quisquous/chromium
|
b25660e05cddc9d0c3053b3514f07037acc69a10
|
[
"BSD-3-Clause"
] | 1
|
2015-02-02T06:55:08.000Z
|
2016-01-20T06:11:59.000Z
|
content/browser/ssl/ssl_host_state.cc
|
quisquous/chromium
|
b25660e05cddc9d0c3053b3514f07037acc69a10
|
[
"BSD-3-Clause"
] | 2
|
2015-12-08T00:37:41.000Z
|
2017-04-06T05:34:05.000Z
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/ssl/ssl_host_state.h"
#include "base/logging.h"
#include "base/lazy_instance.h"
#include "content/public/browser/browser_context.h"
static const char* kKeyName = "content_ssl_host_state";
SSLHostState* SSLHostState::GetFor(content::BrowserContext* context) {
SSLHostState* rv = static_cast<SSLHostState*>(context->GetUserData(kKeyName));
if (!rv) {
rv = new SSLHostState();
context->SetUserData(kKeyName, rv);
}
return rv;
}
SSLHostState::SSLHostState() {
}
SSLHostState::~SSLHostState() {
}
void SSLHostState::HostRanInsecureContent(const std::string& host, int pid) {
DCHECK(CalledOnValidThread());
ran_insecure_content_hosts_.insert(BrokenHostEntry(host, pid));
}
bool SSLHostState::DidHostRunInsecureContent(const std::string& host,
int pid) const {
DCHECK(CalledOnValidThread());
return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid));
}
void SSLHostState::DenyCertForHost(net::X509Certificate* cert,
const std::string& host) {
DCHECK(CalledOnValidThread());
cert_policy_for_host_[host].Deny(cert);
}
void SSLHostState::AllowCertForHost(net::X509Certificate* cert,
const std::string& host) {
DCHECK(CalledOnValidThread());
cert_policy_for_host_[host].Allow(cert);
}
void SSLHostState::Clear() {
DCHECK(CalledOnValidThread());
cert_policy_for_host_.clear();
}
net::CertPolicy::Judgment SSLHostState::QueryPolicy(
net::X509Certificate* cert, const std::string& host) {
DCHECK(CalledOnValidThread());
return cert_policy_for_host_[host].Check(cert);
}
| 28.307692
| 80
| 0.707065
|
0a610d0fb9742a2bf3c0dff7d3ad41810ce073fb
| 294
|
lua
|
Lua
|
tests/libace/cpuid/01_BadId.lua
|
xguerin/ace
|
ad6e1bc4cb4f10d6cf5b782f623ec0eef13e000b
|
[
"MIT"
] | 5
|
2016-06-14T17:56:47.000Z
|
2022-02-10T19:54:25.000Z
|
tests/libace/cpuid/01_BadId.lua
|
xguerin/ace
|
ad6e1bc4cb4f10d6cf5b782f623ec0eef13e000b
|
[
"MIT"
] | 42
|
2016-06-21T20:48:22.000Z
|
2021-03-23T15:20:51.000Z
|
tests/libace/cpuid/01_BadId.lua
|
xguerin/ace
|
ad6e1bc4cb4f10d6cf5b782f623ec0eef13e000b
|
[
"MIT"
] | 1
|
2016-10-02T02:58:49.000Z
|
2016-10-02T02:58:49.000Z
|
config = {
var0 = {
-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63
}
}
| 36.75
| 99
| 0.442177
|
67446af6d02ef8cb2b41b74a665bf5a3163ac5b4
| 5,771
|
sql
|
SQL
|
nordb/sql/sitechan_policies.sql
|
MrCubanfrog/NorDB
|
8348733d10799e9ae40744fbd7b200fcc09a9a3a
|
[
"MIT"
] | 1
|
2021-06-08T20:46:10.000Z
|
2021-06-08T20:46:10.000Z
|
nordb/sql/sitechan_policies.sql
|
MrCubanfrog/NorDB
|
8348733d10799e9ae40744fbd7b200fcc09a9a3a
|
[
"MIT"
] | null | null | null |
nordb/sql/sitechan_policies.sql
|
MrCubanfrog/NorDB
|
8348733d10799e9ae40744fbd7b200fcc09a9a3a
|
[
"MIT"
] | null | null | null |
/*
+-----------------+
|SITECHAN POLICIES|
+-----------------+
This file contains the sql commands for creating the correct policies for sitechan.
*/
/*
ADMIN POLICIES
--------------
*/
--Admin policy. Allow admins to access sitechan freely
CREATE POLICY admin_all_policy ON sitechan FOR ALL TO admins
USING (true) WITH CHECK (true);
/*
STATION MANAGER POLICIES
------------------------
*/
--Station Manager view policy. Allows station_managers to see all sitechan rows except for private ones that do not belong to the user
CREATE POLICY station_manager_view_policy ON sitechan FOR SELECT TO station_managers
USING (
current_user = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id) OR
'private' != (SELECT privacy_setting FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
--Station Manager insert policy. Allows station_managers to insert sitechan rows into public and secure stations freely
CREATE POLICY station_manager_insert_policy ON sitechan FOR INSERT TO station_managers
WITH CHECK (
current_user = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id) OR
'private' != (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
--Station Manager delete policy. Allows station_managers to delete sitechan rows if they are private and their own
CREATE POLICY station_manager_delete_policy ON sitechan FOR DELETE TO station_managers
USING (
current_user = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id) AND
'private' = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
--Station Manager update policy. Allows station_managers to close sitechans
CREATE POLICY station_manager_update_policy ON sitechan FOR UPDATE TO station_managers
WITH CHECK (
current_user = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id) OR
'private' != (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
/*
DEFAULT USER POLICIES
---------------------
*/
--User view policy. Allows user to see all sitechan rows except for private ones that do not belong to the user
CREATE POLICY user_view_policy ON sitechan FOR SELECT TO default_users
USING (
current_user = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id) OR
'private' != (SELECT privacy_setting FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
--User insert policy. Allows user to insert private sitechan rows
CREATE POLICY user_insert_policy ON sitechan FOR INSERT TO default_users
WITH CHECK (
current_user = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id) AND
'private' = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
--User delete policy. Allows user to delete sitechan rows if they belong to their own private network
CREATE POLICY user_delete_policy ON sitechan FOR DELETE TO default_users
USING (
current_user = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id) AND
'private' = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
--User update policy. Allows user to close their own private sitechans
CREATE POLICY user_update_policy ON sitechan FOR UPDATE TO default_users
WITH CHECK (
current_user = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id) AND
'private' = (SELECT owner FROM creation_info, network, station WHERE creation_info.id = network.creation_id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
/*
GUEST POLICIES
--------------
*/
--Guest view policy. Allow guest to see all public sitechan rows
CREATE POLICY guest_view_policy ON sitechan FOR SELECT TO guests
USING (
'public' = (SELECT privacy_setting FROM creation_info, network, station WHERE network.creation_id = creation_info.id AND network.id = station.network_id AND station.id = sitechan.station_id)
);
| 60.114583
| 204
| 0.731936
|
b3636195601e99ba41fb230804c3fbe974a23e03
| 1,221
|
py
|
Python
|
utils/other.py
|
evicxixi/lens
|
b4fc43ee33877a2b1b299a971c01d1d3f9e594c5
|
[
"MIT"
] | 2
|
2021-02-06T15:00:30.000Z
|
2021-08-03T11:59:24.000Z
|
utils/other.py
|
evicxixi/lens
|
b4fc43ee33877a2b1b299a971c01d1d3f9e594c5
|
[
"MIT"
] | null | null | null |
utils/other.py
|
evicxixi/lens
|
b4fc43ee33877a2b1b299a971c01d1d3f9e594c5
|
[
"MIT"
] | 1
|
2021-02-06T15:00:38.000Z
|
2021-02-06T15:00:38.000Z
|
import collections
class ApiResponse(object):
'''lensAPI响应
Variables:
_status {dict} -- [description]
} {[type]} -- [description]
'''
_status = {
-1: '失败',
0: '未知错误',
1: '成功',
}
def __init__(self, code=0, msg=None, msg_list=[], data={}):
# super(Response, self).__init__()
if not self._status.get(code):
self._status[code] = msg
self.code = code
# self.status_code = code
# self.msg = self.init_msg()
if msg_list:
html = ['<ul class="list-group">', '</ul>']
for x in msg_list:
html.insert(-1, '<div class="alert alert-danger" role="alert">' +
str(x) + '</div>')
self.msg = ''.join(html)
else:
self.msg = msg or self._status.get(code)
self.data = data
class OrderedSet(collections.Set):
'''保持顺序的set
'''
def __init__(self, iterable=()):
self.d = collections.OrderedDict.fromkeys(iterable)
def __len__(self):
return len(self.d)
def __contains__(self, element):
return element in self.d
def __iter__(self):
return iter(self.d)
| 24.42
| 81
| 0.517609
|
28b3ffbfef1be65a7d10ab7b25e8ef395c8ece1d
| 1,974
|
swift
|
Swift
|
code/JewelCase/Views/Discover/DiscoverMoviesView.swift
|
peterfriese/JewelCase
|
c3060e3117dc9661c0dc556f1c6b920f6bbc3dc9
|
[
"Apache-2.0"
] | 43
|
2020-08-03T18:11:02.000Z
|
2022-03-04T20:16:32.000Z
|
code/JewelCase/Views/Discover/DiscoverMoviesView.swift
|
peterfriese/JewelCase
|
c3060e3117dc9661c0dc556f1c6b920f6bbc3dc9
|
[
"Apache-2.0"
] | null | null | null |
code/JewelCase/Views/Discover/DiscoverMoviesView.swift
|
peterfriese/JewelCase
|
c3060e3117dc9661c0dc556f1c6b920f6bbc3dc9
|
[
"Apache-2.0"
] | 2
|
2021-01-03T03:49:10.000Z
|
2021-06-04T10:27:34.000Z
|
//
// DiscoverMoviesView.swift
// JewelCase
//
// Created by Peter Friese on 28/07/2020.
//
import SwiftUI
import URLImage
import TMDB
struct DiscoverMoviesView: View {
@StateObject var viewModel = DiscoverViewModel()
@Environment(\.presentationMode) var presentationMode
@EnvironmentObject var movieStore: MovieStore
var body: some View {
NavigationView {
VStack {
SearchBar(text: $viewModel.searchText)
List {
ForEach(viewModel.tmdbMovies) { item in
HStack(alignment: .top) {
URLImage(item.imageUrl) { proxy in
proxy.image
.resizable()
.aspectRatio(contentMode: .fit)
.clipped()
}
.frame(height: 80,
alignment: .center)
.cornerRadius(6)
VStack(alignment: .leading) {
Text(item.title)
.font(.headline)
Text(item.year)
Text(item.overview ?? "")
.font(.callout)
.lineLimit(2)
}
}
.contextMenu {
Button(action: { addMovie(movie: item )}, label: {
Label("Add", systemImage: "plus")
})
}
.onTapGesture(count: 2, perform: {
print("You double tapped on \(item.title)")
})
}
}
}
.navigationBarTitle("Search")
}
}
func addMovie(movie: TMDBMovie) {
print("Adding \(movie.title)")
let newMovie = Movie(from: movie)
movieStore.addMovie(newMovie)
dismiss()
}
func dismiss() {
presentationMode.wrappedValue.dismiss()
}
}
struct DiscoverMoviesView_Previews: PreviewProvider {
static var previews: some View {
Group {
DiscoverMoviesView()
DiscoverMoviesView()
.preferredColorScheme(.dark)
}
}
}
| 24.073171
| 64
| 0.519757
|
38a1b25e8eb01156bea60885a4769a98465b9972
| 1,813
|
php
|
PHP
|
app/Http/Controllers/HomeController.php
|
cbnuke/FilesCollection
|
783dd0a3b33298064636594f8f79d4d1d34a5366
|
[
"MIT"
] | null | null | null |
app/Http/Controllers/HomeController.php
|
cbnuke/FilesCollection
|
783dd0a3b33298064636594f8f79d4d1d34a5366
|
[
"MIT"
] | 10
|
2020-08-07T14:53:42.000Z
|
2022-02-27T09:37:04.000Z
|
app/Http/Controllers/HomeController.php
|
cbnuke/FilesCollection
|
783dd0a3b33298064636594f8f79d4d1d34a5366
|
[
"MIT"
] | null | null | null |
<?php
namespace App\Http\Controllers;
use App\File;
use App\Storage;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$files = File::all();
$storages = Storage::all();
$items_storage = Storage::all(['id', 'name']);
return view('home', ['files' => $files, 'storages' => $storages, 'items_storage' => $items_storage]);
}
public function show($id)
{
$file = File::find($id);
if (empty($file)) {
abort(404);
}
return view('home', ['files' => $file]);
}
public function storeFile(Request $request)
{
$this->validate($request, [
'name' => 'required|max:255',
'description' => '',
]);
File::create($request->all());
return redirect('home');
}
public function destroyFile($id)
{
$file = File::find($id);
if (empty($file)) {
abort(404);
}
$file->delete();
return redirect('home');
}
public function storeStorage(Request $request)
{
$this->validate($request, [
'name' => 'required|max:255',
'description' => '',
]);
Storage::create($request->all());
return redirect('home');
}
public function destroyStorage($id)
{
$storage = Storage::find($id);
if (empty($storage)) {
abort(404);
}
$storage->delete();
return redirect('home');
}
}
| 21.329412
| 109
| 0.503034
|
af268153ce3eb5628d4af8654240f1d7ab29b05d
| 141
|
py
|
Python
|
chapter04/test/test_module01.py
|
codingEzio/code_python_book_001
|
d9dd7a3d40c4c34c2ae8d08222aba989631abd88
|
[
"Unlicense"
] | null | null | null |
chapter04/test/test_module01.py
|
codingEzio/code_python_book_001
|
d9dd7a3d40c4c34c2ae8d08222aba989631abd88
|
[
"Unlicense"
] | null | null | null |
chapter04/test/test_module01.py
|
codingEzio/code_python_book_001
|
d9dd7a3d40c4c34c2ae8d08222aba989631abd88
|
[
"Unlicense"
] | null | null | null |
# type this to run tests
# 'python -m nose FILENAME -v'
# 'nosetests FILENAME -v'
def test_case01():
assert 'aaa'.upper() == 'AAA'
| 17.625
| 33
| 0.617021
|
75161eeff1cc1109659b6cf186979d03cd7d1ce2
| 6,539
|
css
|
CSS
|
style-C.css
|
momijimomimomi/NCUTEASS
|
76b9d21a039b9fac9b71eb8deca8737d11d20871
|
[
"Apache-2.0"
] | null | null | null |
style-C.css
|
momijimomimomi/NCUTEASS
|
76b9d21a039b9fac9b71eb8deca8737d11d20871
|
[
"Apache-2.0"
] | null | null | null |
style-C.css
|
momijimomimomi/NCUTEASS
|
76b9d21a039b9fac9b71eb8deca8737d11d20871
|
[
"Apache-2.0"
] | null | null | null |
/*-------------------------
BASIC SETTING
-------------------------*/
@media (min-width: 768px) {
/* line 6, ../sass/style-1.scss */
.container-fluid {
width: 810px;
}
}
/* line 10, ../sass/style-1.scss */
body {
background-color: #aaa;
padding-top: 50px;
}
/* line 15, ../sass/style-1.scss */
.container-fluid {
background-color: #fff;
}
/* line 19, ../sass/style-1.scss */
a,
a:hover,
a:focus {
text-decoration: none;
}
/*-------------------------
MENU STTING
-------------------------*/
@media (min-width: 768px) {
/* line 5, ../sass/style-2.scss */
.navbar {
box-shadow: 0 15px 30px -20px inset;
-mz-width: 100%;
margin: 0 auto;
}
/* line 11, ../sass/style-2.scss */
.navbar-right {
margin-right: -10px;
padding-top: 85px;
}
/* line 16, ../sass/style-2.scss */
.nav > li > a {
padding: 3px 0;
border-radius: 10px 10px 0 0;
}
/* line 21, ../sass/style-2.scss */
.navbar-nav > li {
float: left;
width: 130px;
height: 25px;
text-align: center;
border-left: 1px solid #fff;
border-radius: 10px 10px 0 0;
background-color: #f4a80a;
}
}
@media (max-width: 767px) {
/* line 32, ../sass/style-2.scss */
.navbar-fixed-top .navbar-collapse {
background-color: #f4a80a;
}
}
/* line 36, ../sass/style-2.scss */
.nav > li > a {
font: bold 12px/19px Verdana, Arial, Helvetica, sans-serif;
color: #fff;
}
/* line 41, ../sass/style-2.scss */
.nav > li > a:focus,
.nav > li > a:hover {
background-color: #fcce0a;
}
/* line 46, ../sass/style-2.scss */
.navbar-toggle .icon-bar {
background-color: #f4a80a;
}
/* line 50, ../sass/style-2.scss */
.navbar-fixed-bottom,
.navbar-fixed-top {
position: absolute;
height: 110px;
}
/*-------------------------
LOGO AND IMGLOGO SETTING
-------------------------*/
@media (min-width: 768px) {
/* line 5, ../sass/style-3.scss */
#logo {
margin-top: 17px;
margin-left: 16px;
}
/* line 10, ../sass/style-3.scss */
#img h3 {
font-size: 48px;
}
/* line 14, ../sass/style-3.scss */
#img h4 {
font-size: 18px;
}
}
@media (max-width: 767px) {
/* line 19, ../sass/style-3.scss */
#logo {
margin-top: 12px;
margin-left: 0px;
}
/* line 24, ../sass/style-3.scss */
#img h3,
#img h4 {
text-align: right;
}
/* line 29, ../sass/style-3.scss */
#img h3 {
font-size: 25px;
padding-top: 60px;
}
/* line 34, ../sass/style-3.scss */
#img h4 {
font-size: 15px;
}
}
@media (max-width: 289px) {
/* line 39, ../sass/style-3.scss */
#logo {
margin-top: 15px;
margin-left: 0px;
}
/* line 44, ../sass/style-3.scss */
#img h3 {
font-size: 20px;
}
/* line 48, ../sass/style-3.scss */
#img h4 {
font-size: 15px;
}
/* line 52, ../sass/style-3.scss */
.navbar-brand {
float: none;
}
}
@media (max-width: 245px) {
/* line 57, ../sass/style-3.scss */
#logo {
margin-top: -5px;
margin-left: -5px;
}
}
/* line 62, ../sass/style-3.scss */
.navbar-brand {
line-height: 27px;
padding: 0 0;
}
/* line 67, ../sass/style-3.scss */
#logo {
font-family: 'KaiTi', Verdana, Arial, Helvetica, sans-serif;
font-size: 35px;
color: #f76b0c;
}
/* line 73, ../sass/style-3.scss */
#logo h4 {
font-size: 11px;
color: #808080;
}
/* line 78, ../sass/style-3.scss */
.business-header {
height: 132px;
background: url("/img/test.png") center center no-repeat scroll;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
/* line 87, ../sass/style-3.scss */
.tagline {
text-shadow: 0 0 10px #000;
color: #fff;
}
/* line 92, ../sass/style-3.scss */
.img-center {
margin: 0 auto;
}
/* line 96, ../sass/style-3.scss */
#img {
margin-top: 60px;
}
/* line 100, ../sass/style-3.scss */
#img h3,
#img h4 {
font-family: 'KaiTi', Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
margin-top: 10px;
text-align: right;
color: #fff;
}
/*-------------------------
MAIN SETTING
-------------------------*/
/* line 4, ../sass/style-4.scss */
#rightbar li {
margin-left: -2em;
list-style: none;
}
/* line 9, ../sass/style-4.scss */
#rightbar a {
font: bold 12px/19px Verdana, Arial, Helvetica, sans-serif;
display: block;
padding: 0 6px;
color: white;
border: 1px solid #fff;
background: #6a91c8;
}
/* line 18, ../sass/style-4.scss */
#rightbar a:focus,
#rightbar a:hover {
background-color: #6a91f5;
}
/* line 23, ../sass/style-4.scss */
#rightbar h2 {
font-size: 24px;
font-weight: bolder;
padding-left: 25px;
color: #797b7a;
}
/* line 30, ../sass/style-4.scss */
.style5 {
color: #f00;
}
/* line 34, ../sass/style-4.scss */
.style2,
.emp {
font-weight: bold;
color: #f00;
}
/*
leftbar setting-1
*/
@media (min-width: 768px) {
/* line 5, ../sass/style-4-2.scss */
#leftbar {
width: 600px;
border-right: 1px solid #bcbdbc;
}
/* line 10, ../sass/style-4-2.scss */
#leftbar table th {
padding-top: 5px;
padding-bottom: 5px;
}
/* line 15, ../sass/style-4-2.scss */
#leftbar table {
margin-top: 0px;
}
}
/* line 20, ../sass/style-4-2.scss */
#leftbar table th {
font-size: 18px;
font-weight: 600;
text-align: left;
color: #000;
background-color: #ccc;
padding-left: 3px;
border-color: #ccc;
}
/* line 29, ../sass/style-4-2.scss */
#leftbar table td {
border-color: #ccc;
}
/* line 33, ../sass/style-4-2.scss */
#leftbar table {
width: 98%;
border-collapse: collapse;
}
/* line 38, ../sass/style-4-2.scss */
#leftbar td table {
width: 100%;
}
/* line 42, ../sass/style-4-2.scss */
#leftbar h2 {
font-size: 24px;
color: #ee8907;
font-weight: bolder;
}
/* line 48, ../sass/style-4-2.scss */
#leftbar p {
padding: 0 40px;
color: #797b7a;
}
/* line 53, ../sass/style-4-2.scss */
#leftbar a {
color: #ee8907;
}
/*-------------------------
FOOTER SETTING
-------------------------*/
@media (min-width: 768px) {
/* line 5, ../sass/style-5.scss */
#email,
#validtext {
font-size: 11px;
width: 810px;
padding-top: 10px;
letter-spacing: 1px;
}
}
/* line 13, ../sass/style-5.scss */
footer {
margin: 35px 0 0 0;
}
/* line 17, ../sass/style-5.scss */
#bottom {
padding-right: 0;
padding-left: 0;
}
/* line 22, ../sass/style-5.scss */
#email,
#validtext {
font-size: 11px;
text-align: center;
color: #fff;
background-color: #9bbe00;
}
/* line 30, ../sass/style-5.scss */
#validtext p {
margin: 0 0 0;
}
| 17.769022
| 66
| 0.554825
|
2cc9083c93096ee149b4f99399e2974c1e86373a
| 3,025
|
py
|
Python
|
deepclaw/sim2real/simulation/tasks/Claw_machine/toy.py
|
bionicdl-sustech/DeepClaw
|
5cc61289e6088adc03d502f07ec970d221e05857
|
[
"MIT"
] | 5
|
2020-06-24T03:47:00.000Z
|
2021-10-13T03:35:38.000Z
|
deepclaw/sim2real/simulation/tasks/Claw_machine/toy.py
|
bionicdl-sustech/DeepClaw
|
5cc61289e6088adc03d502f07ec970d221e05857
|
[
"MIT"
] | null | null | null |
deepclaw/sim2real/simulation/tasks/Claw_machine/toy.py
|
bionicdl-sustech/DeepClaw
|
5cc61289e6088adc03d502f07ec970d221e05857
|
[
"MIT"
] | 3
|
2020-06-18T09:25:39.000Z
|
2021-04-18T03:51:08.000Z
|
from os.path import dirname, abspath
from os import system, environ
sim_path = dirname(dirname(dirname(dirname(abspath(__file__)))))
scene_path = sim_path + '/Simulation/scene/'
import sys
sys.path.append(sim_path)
from Simulation.src.camera import Camera
from Simulation.src.env import Env
from Simulation.src.franka import Franka
from pyrep.objects.shape import Shape
import numpy as np
import cv2
import copy
environ['TF_CPP_MIN_LOG_LEVEL'] = "3" # stop print warning!!!
from DeepClaw.modules.end2end.graspNet.fc_predictor import FCPredictor
def scene(scene_file_name):
# return abs dir of scene file
return scene_path + scene_file_name
def franka_move(start, target, grasp_pose):
franka.clear_path = True
start[2] += 0.1
franka.move(env,start,euler=[0,np.radians(180),grasp_pose])
start[2] -= 0.07
franka.move(env,start,euler=[0,np.radians(180),grasp_pose])
for toy in toys:
if franka.gripper._proximity_sensor.is_detected(toy):
franka.grasp(env,toy)
break
if toy is toys[-1]:
raise RuntimeError('can not sense toy')
start[2] += 0.07
franka.move(env,start,euler=[0,np.radians(180),grasp_pose])
franka.home(env)
a = copy.copy(franka.home_joints)
a[0] += np.pi/2
franka.move_j(a,env)
franka.release(env)
franka.home(env)
NUM_THETAS = 9
predictor = FCPredictor(NUM_THETAS*2, './net9/Network9-1000-100')
if __name__ == '__main__':
env = Env(scene('Claw_machine.ttt'))
env.start()
# franka
franka = Franka()
# cam
cam = Camera()
# toys
Bird = Shape('Bird')
Hipp = Shape('Hipp')
Elephant = Shape('Elephant')
Penguin = Shape('Penguin')
box_dest = Shape('box_dest')
target = Shape('Sphere')
toys = [Bird, Hipp, Elephant, Penguin]
dest_position = box_dest.get_position()
# random exchange the position of toys
toy_positions = [toy.get_position() for toy in toys]
arr = np.arange(len(toys))
np.random.shuffle(arr)
[toys[i].set_position(toy_positions[arr[i]]) for i in range(len(toys))]
# set franka to home joints
franka.home(env)
end = False
while not end:
img = cam.capture_bgr()
ros = img[41:299,114:372] # (258, 258)
depth_image = cam.capture_depth(in_meters=True)
ros = cv2.resize(ros, (1280, 720), interpolation=cv2.INTER_CUBIC)
y_, p_best, grasp_pose = predictor.run(ros)
x,y,angle = grasp_pose
possi = p_best.max()
print('possibility:',possi)
if possi < 0.8:
break
cx,cy = int(x*258/1280+114),int(y*258/720+41) # u:cy, v:cx
# print(x,y,cx,cy)
real_position = (cam.H@cam.uv2XYZ(depth_image,cx,cy))[0:3]
real_position[2] = 1.123
target.set_position(real_position)
cv2.circle(img,(cx,cy),5,(0,0,255),5)
cv2.circle(ros,(x,y),5,(0,0,255),5)
franka_move(real_position, dest_position, grasp_pose[2])
env.stop()
env.shutdown()
| 30.555556
| 75
| 0.644959
|
df55d08932a24ad14ec5d33c886b7bab91c0314c
| 1,388
|
cs
|
C#
|
WONKERZ/Assets/Scripts/Managers/ManagerLifecycle.cs
|
GreenCalx/LD49
|
203d1bedaf31c22f3c554000d73fe091329f99a0
|
[
"MIT"
] | null | null | null |
WONKERZ/Assets/Scripts/Managers/ManagerLifecycle.cs
|
GreenCalx/LD49
|
203d1bedaf31c22f3c554000d73fe091329f99a0
|
[
"MIT"
] | null | null | null |
WONKERZ/Assets/Scripts/Managers/ManagerLifecycle.cs
|
GreenCalx/LD49
|
203d1bedaf31c22f3c554000d73fe091329f99a0
|
[
"MIT"
] | null | null | null |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
/**
* Handles objects that are not destroyed on scene change and remove duplicates of them
* > To attach on object carrying unique managers that we want to carry from scene to scene
*/
public class ManagerLifecycle : MonoBehaviour
{
private int previousSceneIndex = -1; // no previous scene
void Awake()
{
int n_manager_handler = FindObjectsOfType<ManagerLifecycle>().Length;
if ( n_manager_handler > 1 )
{
Destroy(gameObject);
} else {
DontDestroyOnLoad(gameObject);
}
SceneManager.sceneLoaded += OnSceneLoaded;
}
void OnDestroy ()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (previousSceneIndex==-1)
{
previousSceneIndex = SceneManager.GetActiveScene().buildIndex;
return; // first scene loaded, if we detach we lost inputz
}
previousSceneIndex = SceneManager.GetActiveScene().buildIndex;
// Do stuff on new scene load
// ....
}
}
| 25.703704
| 90
| 0.628242
|
a00986ed609ba3d5fcd182f44bad550fc6a82e75
| 1,937
|
ts
|
TypeScript
|
lib/schema.ts
|
zimv/clickhouse-orm
|
bfe9f5dbb69b51bb2392fa20f35a6a9a3deabb20
|
[
"MIT"
] | 9
|
2022-02-05T16:00:08.000Z
|
2022-03-29T11:08:50.000Z
|
lib/schema.ts
|
zimv/clickhouse-orm
|
bfe9f5dbb69b51bb2392fa20f35a6a9a3deabb20
|
[
"MIT"
] | 2
|
2022-02-09T07:09:53.000Z
|
2022-02-18T09:09:49.000Z
|
lib/schema.ts
|
zimv/node-clickhouse-orm
|
bfe9f5dbb69b51bb2392fa20f35a6a9a3deabb20
|
[
"MIT"
] | null | null | null |
import { getPureData, insertSQL } from './transformer';
import { DebugLog } from './log';
class dataInstance {
private schema;
constructor(schemaThis) {
this.schema = schemaThis;
this.proxyApply();
}
proxyApply() {
this.schema.columns.forEach((column) => {
this.schema.proxyAttr(this.schema.obj, this, column);
});
}
save() {
const data = getPureData(this.schema.columns, this);
const insertHeaders = insertSQL(this.schema.table, this.schema.columns);
if(this.schema.debug) DebugLog(`execute save> ${insertHeaders} ${JSON.stringify([data])}`);
return this.schema.client
.insert(insertHeaders, [data])
.toPromise();
}
}
export default class Schema {
public obj;
public columns;
public client;
public table;
public debug;
constructor(obj) {
this.obj = obj;
this.columns = Object.keys(obj);
return this;
}
setOptions({ client, table, debug }) {
this.client = client;
this.table = table;
this.debug = debug;
}
createModel() {
return new dataInstance(this);
}
proxyAttr(obj, data, column) {
let value; //= (data[key] = obj[key].default || '')
const defaultVal = obj[column].default;
if (defaultVal) {
if (defaultVal === Date.now) value = Date.now();
if (defaultVal === Date) value = new Date();
else value = defaultVal;
}
Object.defineProperty(data, column, {
enumerable: true,
get: function () {
return value;
},
set: function (newVal) {
if (newVal === undefined) return;
switch (obj[column].type) {
case String:
// 如果定义的是字符串类型,却传入了数字或者其他类型
if (new String(newVal).toString() !== newVal) {
throw new Error(`column:(${column}) should be a string, the value is: ${newVal}`);
}
break;
}
value = newVal;
return newVal;
},
});
}
}
| 25.155844
| 96
| 0.589055
|
fa42f7d64228c4762e9e0fc5e8e7546e729a0bb5
| 3,354
|
cpp
|
C++
|
src/seraphon/SaurusEternityWarden.cpp
|
rweyrauch/AoSSimulator
|
d2bfbbe0fab904cc543f1a01e62e0b82cf67c27b
|
[
"MIT"
] | 5
|
2019-02-01T01:41:19.000Z
|
2021-06-17T02:16:13.000Z
|
src/seraphon/SaurusEternityWarden.cpp
|
rweyrauch/AoSSimulator
|
d2bfbbe0fab904cc543f1a01e62e0b82cf67c27b
|
[
"MIT"
] | 2
|
2020-01-14T16:57:42.000Z
|
2021-04-01T00:53:18.000Z
|
src/seraphon/SaurusEternityWarden.cpp
|
rweyrauch/AoSSimulator
|
d2bfbbe0fab904cc543f1a01e62e0b82cf67c27b
|
[
"MIT"
] | 1
|
2019-03-02T20:03:51.000Z
|
2019-03-02T20:03:51.000Z
|
/*
* Warhammer Age of Sigmar battle simulator.
*
* Copyright (C) 2019 by Rick Weyrauch - rpweyrauch@gmail.com
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
#include <seraphon/SaurusEternityWarden.h>
#include <UnitFactory.h>
#include "SeraphonPrivate.h"
namespace Seraphon {
static const int g_basesize = 40;
static const int g_wounds = 7;
static const int g_pointsPerUnit = 125;
bool SaurusEternityWarden::s_registered = false;
SaurusEternityWarden::SaurusEternityWarden(WayOfTheSeraphon way, Constellation constellation, CommandTrait trait, Artefact artefact, bool isGeneral) :
SeraphonBase("Saurus Eternity Warden", 5, g_wounds, 8, 3, false, g_pointsPerUnit) {
m_keywords = {ORDER, SERAPHON, SAURUS, HERO, ETERNITY_WARDEN};
m_weapons = {&m_mace, &m_jaws};
m_battleFieldRole = Role::Leader;
setWayOfTheSeraphon(way, constellation);
setCommandTrait(trait);
setArtefact(artefact);
setGeneral(isGeneral);
auto model = new Model(g_basesize, wounds());
model->addMeleeWeapon(&m_mace);
model->addMeleeWeapon(&m_jaws);
addModel(model);
}
Unit *SaurusEternityWarden::Create(const ParameterList ¶meters) {
auto way = (WayOfTheSeraphon) GetEnumParam("Way of the Seraphon", parameters, g_wayOfTheSeraphon[0]);
auto constellation = (Constellation) GetEnumParam("Constellation", parameters, g_constellation[0]);
auto trait = (CommandTrait) GetEnumParam("Command Trait", parameters, g_saurusCommandTrait[0]);
auto artefact = (Artefact) GetEnumParam("Artefact", parameters, g_celestialRelicsOfTheWarrior[0]);
auto general = GetBoolParam("General", parameters, false);
return new SaurusEternityWarden(way, constellation, trait, artefact, general);
}
void SaurusEternityWarden::Init() {
if (!s_registered) {
static FactoryMethod factoryMethod = {
Create,
SeraphonBase::ValueToString,
SeraphonBase::EnumStringToInt,
ComputePoints,
{
EnumParameter("Way of the Seraphon", g_wayOfTheSeraphon[0], g_wayOfTheSeraphon),
EnumParameter("Constellation", g_constellation[0], g_constellation),
EnumParameter("Command Trait", g_saurusCommandTrait[0], g_saurusCommandTrait),
EnumParameter("Artefact", g_celestialRelicsOfTheWarrior[0], g_celestialRelicsOfTheWarrior),
BoolParameter("General")
},
ORDER,
{SERAPHON}
};
s_registered = UnitFactory::Register("Saurus Eternity Warden", factoryMethod);
}
}
int SaurusEternityWarden::generateHits(int unmodifiedHitRoll, const Weapon *weapon, const Unit *unit) const {
// Cold Ferocity
if ((unmodifiedHitRoll == 6) && (weapon->name() == m_mace.name())) {
return 2;
}
return SeraphonBase::generateHits(unmodifiedHitRoll, weapon, unit);
}
int SaurusEternityWarden::ComputePoints(const ParameterList& /*parameters*/) {
return g_pointsPerUnit;
}
} //namespace Seraphon
| 40.902439
| 154
| 0.640429
|
93cf27f2724b9fc1c19373e97588f9244eb7eb2f
| 30,607
|
cs
|
C#
|
WUnderK/Form1.Designer.cs
|
klimenta/WUnderK
|
55f96366ff10fc8746b253b65869b8cf355d6aca
|
[
"BSD-2-Clause"
] | null | null | null |
WUnderK/Form1.Designer.cs
|
klimenta/WUnderK
|
55f96366ff10fc8746b253b65869b8cf355d6aca
|
[
"BSD-2-Clause"
] | null | null | null |
WUnderK/Form1.Designer.cs
|
klimenta/WUnderK
|
55f96366ff10fc8746b253b65869b8cf355d6aca
|
[
"BSD-2-Clause"
] | null | null | null |
namespace WUnderK
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.lbl1min = new System.Windows.Forms.Label();
this.lbl2min = new System.Windows.Forms.Label();
this.lbl3min = new System.Windows.Forms.Label();
this.lbl4min = new System.Windows.Forms.Label();
this.lbl5min = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.pbForecastButton = new System.Windows.Forms.PictureBox();
this.pbDetailsButton = new System.Windows.Forms.PictureBox();
this.pbMove = new System.Windows.Forms.PictureBox();
this.pbOptions = new System.Windows.Forms.PictureBox();
this.pbMinimize = new System.Windows.Forms.PictureBox();
this.pbExit = new System.Windows.Forms.PictureBox();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.lblCity = new System.Windows.Forms.Label();
this.lblTemperature = new System.Windows.Forms.Label();
this.paDetails = new System.Windows.Forms.Panel();
this.lblPrecip = new System.Windows.Forms.Label();
this.lblUV = new System.Windows.Forms.Label();
this.lblVisibility = new System.Windows.Forms.Label();
this.lblFeelsLike = new System.Windows.Forms.Label();
this.lblPressure = new System.Windows.Forms.Label();
this.lblWind = new System.Windows.Forms.Label();
this.lblHumidity = new System.Windows.Forms.Label();
this.lblWeather = new System.Windows.Forms.Label();
this.pbDetailsPane = new System.Windows.Forms.PictureBox();
this.pbWeatherImage = new System.Windows.Forms.PictureBox();
this.paForecast = new System.Windows.Forms.Panel();
this.lblForecast1 = new System.Windows.Forms.Label();
this.lblFC2 = new System.Windows.Forms.Label();
this.lblForecast2 = new System.Windows.Forms.Label();
this.lblFC3 = new System.Windows.Forms.Label();
this.lblForecast3 = new System.Windows.Forms.Label();
this.lblForecast4 = new System.Windows.Forms.Label();
this.lblFC4 = new System.Windows.Forms.Label();
this.lblFC1 = new System.Windows.Forms.Label();
this.pbForecast = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbForecastButton)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbDetailsButton)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbMove)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbOptions)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbMinimize)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbExit)).BeginInit();
this.paDetails.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbDetailsPane)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbWeatherImage)).BeginInit();
this.paForecast.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbForecast)).BeginInit();
this.SuspendLayout();
//
// timer1
//
this.timer1.Interval = 5000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// lbl1min
//
this.lbl1min.AutoSize = true;
this.lbl1min.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl1min.ForeColor = System.Drawing.Color.Yellow;
this.lbl1min.Location = new System.Drawing.Point(12, 63);
this.lbl1min.Name = "lbl1min";
this.lbl1min.Size = new System.Drawing.Size(0, 9);
this.lbl1min.TabIndex = 4;
//
// lbl2min
//
this.lbl2min.AutoSize = true;
this.lbl2min.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl2min.ForeColor = System.Drawing.Color.Yellow;
this.lbl2min.Location = new System.Drawing.Point(32, 63);
this.lbl2min.Name = "lbl2min";
this.lbl2min.Size = new System.Drawing.Size(0, 9);
this.lbl2min.TabIndex = 5;
//
// lbl3min
//
this.lbl3min.AutoSize = true;
this.lbl3min.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl3min.ForeColor = System.Drawing.Color.Yellow;
this.lbl3min.Location = new System.Drawing.Point(52, 63);
this.lbl3min.Name = "lbl3min";
this.lbl3min.Size = new System.Drawing.Size(0, 9);
this.lbl3min.TabIndex = 6;
//
// lbl4min
//
this.lbl4min.AutoSize = true;
this.lbl4min.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl4min.ForeColor = System.Drawing.Color.Yellow;
this.lbl4min.Location = new System.Drawing.Point(72, 63);
this.lbl4min.Name = "lbl4min";
this.lbl4min.Size = new System.Drawing.Size(0, 9);
this.lbl4min.TabIndex = 7;
//
// lbl5min
//
this.lbl5min.AutoSize = true;
this.lbl5min.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl5min.ForeColor = System.Drawing.Color.Yellow;
this.lbl5min.Location = new System.Drawing.Point(92, 63);
this.lbl5min.Name = "lbl5min";
this.lbl5min.Size = new System.Drawing.Size(0, 9);
this.lbl5min.TabIndex = 8;
//
// pbForecastButton
//
this.pbForecastButton.Image = global::WUnderK.Properties.Resources.forecast_off;
this.pbForecastButton.Location = new System.Drawing.Point(137, 93);
this.pbForecastButton.Name = "pbForecastButton";
this.pbForecastButton.Size = new System.Drawing.Size(15, 15);
this.pbForecastButton.TabIndex = 27;
this.pbForecastButton.TabStop = false;
this.toolTip1.SetToolTip(this.pbForecastButton, "Forecast");
this.pbForecastButton.Click += new System.EventHandler(this.pbForecastButton_Click);
this.pbForecastButton.MouseEnter += new System.EventHandler(this.pbForecast_MouseEnter);
this.pbForecastButton.MouseLeave += new System.EventHandler(this.pbForecast_MouseLeave);
//
// pbDetailsButton
//
this.pbDetailsButton.Image = global::WUnderK.Properties.Resources.details_off;
this.pbDetailsButton.Location = new System.Drawing.Point(3, 93);
this.pbDetailsButton.Name = "pbDetailsButton";
this.pbDetailsButton.Size = new System.Drawing.Size(15, 15);
this.pbDetailsButton.TabIndex = 16;
this.pbDetailsButton.TabStop = false;
this.toolTip1.SetToolTip(this.pbDetailsButton, "Details");
this.pbDetailsButton.Click += new System.EventHandler(this.pbDetails_Click);
this.pbDetailsButton.MouseEnter += new System.EventHandler(this.pbDetails_MouseEnter);
this.pbDetailsButton.MouseLeave += new System.EventHandler(this.pbDetails_MouseLeave);
//
// pbMove
//
this.pbMove.Image = global::WUnderK.Properties.Resources.hand_off;
this.pbMove.Location = new System.Drawing.Point(154, 58);
this.pbMove.Name = "pbMove";
this.pbMove.Size = new System.Drawing.Size(20, 20);
this.pbMove.TabIndex = 12;
this.pbMove.TabStop = false;
this.toolTip1.SetToolTip(this.pbMove, "Move");
this.pbMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbMove_MouseDown);
this.pbMove.MouseEnter += new System.EventHandler(this.pbMove_MouseEnter);
this.pbMove.MouseLeave += new System.EventHandler(this.pbMove_MouseLeave);
this.pbMove.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbMove_MouseMove);
this.pbMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbMove_MouseUp);
//
// pbOptions
//
this.pbOptions.Image = global::WUnderK.Properties.Resources.options_off;
this.pbOptions.Location = new System.Drawing.Point(155, 33);
this.pbOptions.Name = "pbOptions";
this.pbOptions.Size = new System.Drawing.Size(15, 15);
this.pbOptions.TabIndex = 11;
this.pbOptions.TabStop = false;
this.toolTip1.SetToolTip(this.pbOptions, "Options");
this.pbOptions.Click += new System.EventHandler(this.pbOptions_Click);
this.pbOptions.MouseEnter += new System.EventHandler(this.pbOptions_MouseEnter);
this.pbOptions.MouseLeave += new System.EventHandler(this.pbOptions_MouseLeave);
//
// pbMinimize
//
this.pbMinimize.Image = global::WUnderK.Properties.Resources.min_off;
this.pbMinimize.Location = new System.Drawing.Point(155, 17);
this.pbMinimize.Name = "pbMinimize";
this.pbMinimize.Size = new System.Drawing.Size(15, 15);
this.pbMinimize.TabIndex = 10;
this.pbMinimize.TabStop = false;
this.toolTip1.SetToolTip(this.pbMinimize, "Minimize");
this.pbMinimize.Click += new System.EventHandler(this.pbMinimize_Click);
this.pbMinimize.MouseEnter += new System.EventHandler(this.pbMinimize_MouseEnter);
this.pbMinimize.MouseLeave += new System.EventHandler(this.pbMinimize_MouseLeave);
//
// pbExit
//
this.pbExit.Image = global::WUnderK.Properties.Resources.close_off;
this.pbExit.Location = new System.Drawing.Point(155, 1);
this.pbExit.Name = "pbExit";
this.pbExit.Size = new System.Drawing.Size(15, 15);
this.pbExit.TabIndex = 9;
this.pbExit.TabStop = false;
this.toolTip1.SetToolTip(this.pbExit, "Exit");
this.pbExit.Click += new System.EventHandler(this.pbExit_Click);
this.pbExit.MouseEnter += new System.EventHandler(this.pbExit_MouseEnter);
this.pbExit.MouseLeave += new System.EventHandler(this.pbExit_MouseLeave);
//
// notifyIcon1
//
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "WUnderK";
this.notifyIcon1.Visible = true;
this.notifyIcon1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick);
//
// lblCity
//
this.lblCity.AutoSize = true;
this.lblCity.BackColor = System.Drawing.Color.Transparent;
this.lblCity.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCity.ForeColor = System.Drawing.Color.White;
this.lblCity.Location = new System.Drawing.Point(5, 65);
this.lblCity.Name = "lblCity";
this.lblCity.Size = new System.Drawing.Size(101, 20);
this.lblCity.TabIndex = 14;
this.lblCity.Text = "Click Options";
//
// lblTemperature
//
this.lblTemperature.BackColor = System.Drawing.Color.Transparent;
this.lblTemperature.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTemperature.ForeColor = System.Drawing.Color.White;
this.lblTemperature.Location = new System.Drawing.Point(80, 1);
this.lblTemperature.Name = "lblTemperature";
this.lblTemperature.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lblTemperature.Size = new System.Drawing.Size(75, 31);
this.lblTemperature.TabIndex = 15;
this.lblTemperature.Text = "---°";
this.lblTemperature.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// paDetails
//
this.paDetails.Controls.Add(this.lblPrecip);
this.paDetails.Controls.Add(this.lblUV);
this.paDetails.Controls.Add(this.lblVisibility);
this.paDetails.Controls.Add(this.lblFeelsLike);
this.paDetails.Controls.Add(this.lblPressure);
this.paDetails.Controls.Add(this.lblWind);
this.paDetails.Controls.Add(this.lblHumidity);
this.paDetails.Controls.Add(this.lblWeather);
this.paDetails.Controls.Add(this.pbDetailsPane);
this.paDetails.Location = new System.Drawing.Point(3, 115);
this.paDetails.Name = "paDetails";
this.paDetails.Size = new System.Drawing.Size(150, 110);
this.paDetails.TabIndex = 26;
//
// lblPrecip
//
this.lblPrecip.AutoSize = true;
this.lblPrecip.BackColor = System.Drawing.Color.DarkBlue;
this.lblPrecip.ForeColor = System.Drawing.Color.Yellow;
this.lblPrecip.Location = new System.Drawing.Point(3, 97);
this.lblPrecip.Name = "lblPrecip";
this.lblPrecip.Size = new System.Drawing.Size(35, 13);
this.lblPrecip.TabIndex = 8;
this.lblPrecip.Text = "label1";
//
// lblUV
//
this.lblUV.AutoSize = true;
this.lblUV.BackColor = System.Drawing.Color.DarkBlue;
this.lblUV.ForeColor = System.Drawing.Color.Yellow;
this.lblUV.Location = new System.Drawing.Point(3, 82);
this.lblUV.Name = "lblUV";
this.lblUV.Size = new System.Drawing.Size(35, 13);
this.lblUV.TabIndex = 7;
this.lblUV.Text = "label1";
//
// lblVisibility
//
this.lblVisibility.AutoSize = true;
this.lblVisibility.BackColor = System.Drawing.Color.DarkBlue;
this.lblVisibility.ForeColor = System.Drawing.Color.Yellow;
this.lblVisibility.Location = new System.Drawing.Point(3, 69);
this.lblVisibility.Name = "lblVisibility";
this.lblVisibility.Size = new System.Drawing.Size(35, 13);
this.lblVisibility.TabIndex = 6;
this.lblVisibility.Text = "label1";
//
// lblFeelsLike
//
this.lblFeelsLike.AutoSize = true;
this.lblFeelsLike.BackColor = System.Drawing.Color.DarkBlue;
this.lblFeelsLike.ForeColor = System.Drawing.Color.Yellow;
this.lblFeelsLike.Location = new System.Drawing.Point(3, 56);
this.lblFeelsLike.Name = "lblFeelsLike";
this.lblFeelsLike.Size = new System.Drawing.Size(35, 13);
this.lblFeelsLike.TabIndex = 5;
this.lblFeelsLike.Text = "label1";
//
// lblPressure
//
this.lblPressure.AutoSize = true;
this.lblPressure.BackColor = System.Drawing.Color.DarkBlue;
this.lblPressure.ForeColor = System.Drawing.Color.Yellow;
this.lblPressure.Location = new System.Drawing.Point(3, 43);
this.lblPressure.Name = "lblPressure";
this.lblPressure.Size = new System.Drawing.Size(35, 13);
this.lblPressure.TabIndex = 4;
this.lblPressure.Text = "label1";
//
// lblWind
//
this.lblWind.AutoSize = true;
this.lblWind.BackColor = System.Drawing.Color.DarkBlue;
this.lblWind.ForeColor = System.Drawing.Color.Yellow;
this.lblWind.Location = new System.Drawing.Point(3, 30);
this.lblWind.Name = "lblWind";
this.lblWind.Size = new System.Drawing.Size(35, 13);
this.lblWind.TabIndex = 3;
this.lblWind.Text = "label1";
//
// lblHumidity
//
this.lblHumidity.AutoSize = true;
this.lblHumidity.BackColor = System.Drawing.Color.DarkBlue;
this.lblHumidity.ForeColor = System.Drawing.Color.Yellow;
this.lblHumidity.Location = new System.Drawing.Point(3, 17);
this.lblHumidity.Name = "lblHumidity";
this.lblHumidity.Size = new System.Drawing.Size(35, 13);
this.lblHumidity.TabIndex = 2;
this.lblHumidity.Text = "label1";
//
// lblWeather
//
this.lblWeather.AutoSize = true;
this.lblWeather.BackColor = System.Drawing.Color.DarkBlue;
this.lblWeather.ForeColor = System.Drawing.Color.Yellow;
this.lblWeather.Location = new System.Drawing.Point(3, 4);
this.lblWeather.Name = "lblWeather";
this.lblWeather.Size = new System.Drawing.Size(35, 13);
this.lblWeather.TabIndex = 1;
this.lblWeather.Text = "label1";
//
// pbDetailsPane
//
this.pbDetailsPane.BackColor = System.Drawing.Color.DarkBlue;
this.pbDetailsPane.Dock = System.Windows.Forms.DockStyle.Fill;
this.pbDetailsPane.Location = new System.Drawing.Point(0, 0);
this.pbDetailsPane.Name = "pbDetailsPane";
this.pbDetailsPane.Size = new System.Drawing.Size(150, 110);
this.pbDetailsPane.TabIndex = 0;
this.pbDetailsPane.TabStop = false;
//
// pbWeatherImage
//
this.pbWeatherImage.Image = global::WUnderK.Properties.Resources._4_few_clouds;
this.pbWeatherImage.Location = new System.Drawing.Point(3, 1);
this.pbWeatherImage.Name = "pbWeatherImage";
this.pbWeatherImage.Size = new System.Drawing.Size(150, 90);
this.pbWeatherImage.TabIndex = 13;
this.pbWeatherImage.TabStop = false;
//
// paForecast
//
this.paForecast.Controls.Add(this.lblForecast1);
this.paForecast.Controls.Add(this.lblFC2);
this.paForecast.Controls.Add(this.lblForecast2);
this.paForecast.Controls.Add(this.lblFC3);
this.paForecast.Controls.Add(this.lblForecast3);
this.paForecast.Controls.Add(this.lblForecast4);
this.paForecast.Controls.Add(this.lblFC4);
this.paForecast.Controls.Add(this.lblFC1);
this.paForecast.Controls.Add(this.pbForecast);
this.paForecast.Location = new System.Drawing.Point(180, 1);
this.paForecast.Name = "paForecast";
this.paForecast.Size = new System.Drawing.Size(437, 107);
this.paForecast.TabIndex = 28;
//
// lblForecast1
//
this.lblForecast1.AutoSize = true;
this.lblForecast1.BackColor = System.Drawing.Color.Purple;
this.lblForecast1.ForeColor = System.Drawing.Color.Yellow;
this.lblForecast1.Location = new System.Drawing.Point(1, 14);
this.lblForecast1.Name = "lblForecast1";
this.lblForecast1.Size = new System.Drawing.Size(0, 13);
this.lblForecast1.TabIndex = 12;
//
// lblFC2
//
this.lblFC2.AutoSize = true;
this.lblFC2.BackColor = System.Drawing.Color.Purple;
this.lblFC2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblFC2.ForeColor = System.Drawing.Color.Yellow;
this.lblFC2.Location = new System.Drawing.Point(1, 27);
this.lblFC2.Name = "lblFC2";
this.lblFC2.Size = new System.Drawing.Size(0, 13);
this.lblFC2.TabIndex = 11;
//
// lblForecast2
//
this.lblForecast2.AutoSize = true;
this.lblForecast2.BackColor = System.Drawing.Color.Purple;
this.lblForecast2.ForeColor = System.Drawing.Color.Yellow;
this.lblForecast2.Location = new System.Drawing.Point(1, 40);
this.lblForecast2.Name = "lblForecast2";
this.lblForecast2.Size = new System.Drawing.Size(0, 13);
this.lblForecast2.TabIndex = 10;
//
// lblFC3
//
this.lblFC3.AutoSize = true;
this.lblFC3.BackColor = System.Drawing.Color.Purple;
this.lblFC3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblFC3.ForeColor = System.Drawing.Color.Yellow;
this.lblFC3.Location = new System.Drawing.Point(1, 53);
this.lblFC3.Name = "lblFC3";
this.lblFC3.Size = new System.Drawing.Size(410, 13);
this.lblFC3.TabIndex = 9;
this.lblFC3.Text = "Click on Options and enter the City, State or Country and your API key.";
//
// lblForecast3
//
this.lblForecast3.AutoSize = true;
this.lblForecast3.BackColor = System.Drawing.Color.Purple;
this.lblForecast3.ForeColor = System.Drawing.Color.Yellow;
this.lblForecast3.Location = new System.Drawing.Point(1, 66);
this.lblForecast3.Name = "lblForecast3";
this.lblForecast3.Size = new System.Drawing.Size(0, 13);
this.lblForecast3.TabIndex = 8;
//
// lblForecast4
//
this.lblForecast4.AutoSize = true;
this.lblForecast4.BackColor = System.Drawing.Color.Purple;
this.lblForecast4.ForeColor = System.Drawing.Color.Yellow;
this.lblForecast4.Location = new System.Drawing.Point(1, 92);
this.lblForecast4.Name = "lblForecast4";
this.lblForecast4.Size = new System.Drawing.Size(0, 13);
this.lblForecast4.TabIndex = 6;
//
// lblFC4
//
this.lblFC4.AutoSize = true;
this.lblFC4.BackColor = System.Drawing.Color.Purple;
this.lblFC4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblFC4.ForeColor = System.Drawing.Color.Yellow;
this.lblFC4.Location = new System.Drawing.Point(1, 79);
this.lblFC4.Name = "lblFC4";
this.lblFC4.Size = new System.Drawing.Size(0, 13);
this.lblFC4.TabIndex = 5;
//
// lblFC1
//
this.lblFC1.AutoSize = true;
this.lblFC1.BackColor = System.Drawing.Color.Purple;
this.lblFC1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblFC1.ForeColor = System.Drawing.Color.Yellow;
this.lblFC1.Location = new System.Drawing.Point(1, 1);
this.lblFC1.Name = "lblFC1";
this.lblFC1.Size = new System.Drawing.Size(0, 13);
this.lblFC1.TabIndex = 2;
//
// pbForecast
//
this.pbForecast.BackColor = System.Drawing.Color.Purple;
this.pbForecast.Dock = System.Windows.Forms.DockStyle.Fill;
this.pbForecast.Location = new System.Drawing.Point(0, 0);
this.pbForecast.Name = "pbForecast";
this.pbForecast.Size = new System.Drawing.Size(437, 107);
this.pbForecast.TabIndex = 1;
this.pbForecast.TabStop = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(625, 240);
this.Controls.Add(this.paForecast);
this.Controls.Add(this.pbForecastButton);
this.Controls.Add(this.paDetails);
this.Controls.Add(this.pbDetailsButton);
this.Controls.Add(this.lblTemperature);
this.Controls.Add(this.lblCity);
this.Controls.Add(this.pbWeatherImage);
this.Controls.Add(this.pbMove);
this.Controls.Add(this.pbOptions);
this.Controls.Add(this.pbMinimize);
this.Controls.Add(this.pbExit);
this.Controls.Add(this.lbl5min);
this.Controls.Add(this.lbl4min);
this.Controls.Add(this.lbl3min);
this.Controls.Add(this.lbl2min);
this.Controls.Add(this.lbl1min);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.TransparencyKey = System.Drawing.Color.Black;
this.Activated += new System.EventHandler(this.Form1_Activated);
this.Load += new System.EventHandler(this.Form1_Load);
this.Resize += new System.EventHandler(this.Form1_Resize);
((System.ComponentModel.ISupportInitialize)(this.pbForecastButton)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbDetailsButton)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbMove)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbOptions)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbMinimize)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbExit)).EndInit();
this.paDetails.ResumeLayout(false);
this.paDetails.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbDetailsPane)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbWeatherImage)).EndInit();
this.paForecast.ResumeLayout(false);
this.paForecast.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbForecast)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label lbl1min;
private System.Windows.Forms.Label lbl2min;
private System.Windows.Forms.Label lbl3min;
private System.Windows.Forms.Label lbl4min;
private System.Windows.Forms.Label lbl5min;
private System.Windows.Forms.PictureBox pbExit;
private System.Windows.Forms.PictureBox pbMinimize;
private System.Windows.Forms.PictureBox pbOptions;
private System.Windows.Forms.PictureBox pbMove;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.PictureBox pbWeatherImage;
private System.Windows.Forms.Label lblCity;
private System.Windows.Forms.Label lblTemperature;
private System.Windows.Forms.PictureBox pbDetailsButton;
private System.Windows.Forms.Panel paDetails;
private System.Windows.Forms.Label lblPrecip;
private System.Windows.Forms.Label lblUV;
private System.Windows.Forms.Label lblVisibility;
private System.Windows.Forms.Label lblFeelsLike;
private System.Windows.Forms.Label lblPressure;
private System.Windows.Forms.Label lblWind;
private System.Windows.Forms.Label lblHumidity;
private System.Windows.Forms.Label lblWeather;
private System.Windows.Forms.PictureBox pbDetailsPane;
private System.Windows.Forms.PictureBox pbForecastButton;
private System.Windows.Forms.Panel paForecast;
private System.Windows.Forms.Label lblForecast1;
private System.Windows.Forms.Label lblFC2;
private System.Windows.Forms.Label lblForecast2;
private System.Windows.Forms.Label lblFC3;
private System.Windows.Forms.Label lblForecast3;
private System.Windows.Forms.Label lblForecast4;
private System.Windows.Forms.Label lblFC4;
private System.Windows.Forms.Label lblFC1;
private System.Windows.Forms.PictureBox pbForecast;
}
}
| 53.229565
| 177
| 0.613912
|
d6810c29d482a835e7ba39d87f49e709b9365f9a
| 812
|
cs
|
C#
|
testsubject/Program.cs
|
inorton/XR.Baboon
|
0732a54e10db65fb5bfeacbc3ed358fe3c0b3964
|
[
"MIT"
] | 20
|
2015-01-23T22:04:22.000Z
|
2019-11-15T08:40:25.000Z
|
testsubject/Program.cs
|
inorton/XR.Baboon
|
0732a54e10db65fb5bfeacbc3ed358fe3c0b3964
|
[
"MIT"
] | 16
|
2015-03-18T09:38:26.000Z
|
2020-04-02T13:51:30.000Z
|
testsubject/Program.cs
|
inorton/XR.Baboon
|
0732a54e10db65fb5bfeacbc3ed358fe3c0b3964
|
[
"MIT"
] | 7
|
2015-02-02T10:02:30.000Z
|
2019-10-15T08:42:39.000Z
|
using System;
namespace testsubject
{
class MainClass
{
public static void Main (string[] args)
{
for (int i = 0; i < 12; i++){
var x = new SplineFinder();
x.Reticulate();
GetCount ();
}
#if FALSE
for (int i = 0; i < 22; i++)
GetCount ();
#endif
}
public static void Foo ()
{
throw new NotImplementedException ();
}
static int count = 0;
public static int GetCount ()
{
Console.WriteLine (count);
if (count > 100)
Foo ();
if (count > 8)
throw new InvalidOperationException ("bang");
return ++count;
}
}
}
| 18.044444
| 61
| 0.412562
|
a680c89e493805fea1271ec445df1138946955f9
| 2,504
|
rb
|
Ruby
|
lib/book.rb
|
reidashwill/ruby_library
|
58ff12bf49b87d79af8b391579c0e1314588b49c
|
[
"MIT"
] | null | null | null |
lib/book.rb
|
reidashwill/ruby_library
|
58ff12bf49b87d79af8b391579c0e1314588b49c
|
[
"MIT"
] | 2
|
2021-09-28T02:52:56.000Z
|
2022-02-26T08:05:01.000Z
|
lib/book.rb
|
reidashwill/ruby_library
|
58ff12bf49b87d79af8b391579c0e1314588b49c
|
[
"MIT"
] | 2
|
2020-05-20T23:27:52.000Z
|
2020-05-21T23:16:39.000Z
|
class Book
attr_reader :id
attr_accessor :name
def initialize(attributes)
@name = attributes.fetch(:name)
@id = attributes.fetch(:id)
end
def self.all
returned_books = DB.exec("SELECT * FROM books")
books = []
returned_books.each do |book|
name = book.fetch("name")
id = book.fetch("id").to_i
books.push(Book.new({:name => name, :id => id}))
end
books
end
def self.clear
DB.exec("DELETE FROM books *")
end
def save
result = DB.exec("INSERT INTO books (name) VALUES ('#{@name}') RETURNING id;")
@id = result.first().fetch("id").to_i
end
def self.find(id)
book = DB.exec("SELECT * FROM books WHERE id = #{id};").first
name = book.fetch('name')
id = book.fetch('id').to_i
Book.new({:name => name, :id => id})
end
def update(name)
@name = name
DB.exec("UPDATE books SET name = '#{name}' WHERE id = #{id};")
end
def delete
DB.exec("DELETE FROM checkouts WHERE book_id = #{@id};")
DB.exec("DELETE FROM authors_books WHERE book_id = #{@id};")
DB.exec("DELETE FROM books WHERE id = #{@id};")
end
def bind_to_author(author_id)
DB.exec("INSERT INTO authors_books (author_id, book_id) VALUES (#{author_id}, #{@id});")
end
def ==(book_to_compare)
self.name() == book_to_compare.name()
end
def self.search(search_name)
@books = DB.exec("SELECT * FROM books WHERE name ILIKE '%#{search_name}%';")
@result = []
@books.each do |b|
name = b.fetch("name")
id = b.fetch("id")
@result.push(Book.new({:name => name, :id => id}))
end
@result
end
def self.find_by_consumer(c_id)
books = []
checkouts = DB.exec("SELECT books.* FROM books JOIN checkouts ON (books.id = checkouts.book_id) JOIN consumers ON (checkouts.consumer_id = consumers.id) WHERE consumers.id = #{c_id}")
checkouts.each() do |b|
name = b.fetch("name")
id = b.fetch("id").to_i
books.push(Book.new({:name => name, :id => id}))
end
books
end
def self.find_by_author(auth_id)
books= []
authors_books = DB.exec("SELECT books.* FROM books JOIN authors_books ON (books.id = authors_books.book_id) JOIN authors ON (authors_books.author_id = authors.id) WHERE authors.id = #{auth_id}")
authors_books.each() do |b|
name = b.fetch("name")
id = b.fetch("id").to_i
books.push(Book.new({:name => name, :id => id}))
end
books
end
def authors
Author.find_by_book(self.id)
end
end
| 26.638298
| 198
| 0.611022
|
2fb88e1929d9b8ffe0a84fc88c2c6ff310a6ba11
| 228
|
py
|
Python
|
config.py
|
gtracy/APODEmail
|
328dbb610963c23af4e1ff9285cd7bf3dcce2b6c
|
[
"MIT"
] | 1
|
2021-09-18T11:28:16.000Z
|
2021-09-18T11:28:16.000Z
|
config.py
|
gtracy/APODEmail
|
328dbb610963c23af4e1ff9285cd7bf3dcce2b6c
|
[
"MIT"
] | 1
|
2020-01-11T22:27:00.000Z
|
2020-01-12T03:38:07.000Z
|
config.py
|
gtracy/APODEmail
|
328dbb610963c23af4e1ff9285cd7bf3dcce2b6c
|
[
"MIT"
] | null | null | null |
API_SECRET = 'fluffernutterpie'
# google reCAPTCHA sign-up
# https://www.google.com/recaptcha/admin
RECAPTCHA_KEY = '6LedVBUUAAAAANb2vWVUSByvl66ob3k9r-zSruCu'
RECAPTCHA_PRIVATE_KEY = '6LedVBUUAAAAALWe4MQ2VJQhI9rKi6GJTukS6Hrl'
| 28.5
| 66
| 0.837719
|
72fc94a89d0e5e125395df4e807186d469dbbd62
| 511
|
cs
|
C#
|
Unity/Assets/Script/UI/FloatingText.cs
|
KorStrix/GGJ_2019
|
d1011abae523274e0b148209adeacd976b06b3d7
|
[
"MIT"
] | null | null | null |
Unity/Assets/Script/UI/FloatingText.cs
|
KorStrix/GGJ_2019
|
d1011abae523274e0b148209adeacd976b06b3d7
|
[
"MIT"
] | null | null | null |
Unity/Assets/Script/UI/FloatingText.cs
|
KorStrix/GGJ_2019
|
d1011abae523274e0b148209adeacd976b06b3d7
|
[
"MIT"
] | null | null | null |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FloatingText : MonoBehaviour {
public Animator animator;
public Text indicator;
private void OnEnable()
{
AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(0);
Destroy(gameObject, clipInfo[0].clip.length);
indicator = animator.GetComponent<Text>();
}
public void SetText(string text)
{
indicator.text = text;
}
}
| 23.227273
| 77
| 0.690802
|
e2ac7240ca2c30c4ad4bb096d6f92779e45c4c10
| 2,084
|
py
|
Python
|
examples/ao2mo/10-diff_orbs_for_ijkl.py
|
robert-anderson/pyscf
|
cdc56e168cb15f47e8cdc791a92d689fa9b655af
|
[
"Apache-2.0"
] | 501
|
2018-12-06T23:48:17.000Z
|
2022-03-31T11:53:18.000Z
|
examples/ao2mo/10-diff_orbs_for_ijkl.py
|
robert-anderson/pyscf
|
cdc56e168cb15f47e8cdc791a92d689fa9b655af
|
[
"Apache-2.0"
] | 710
|
2018-11-26T22:04:52.000Z
|
2022-03-30T03:53:12.000Z
|
examples/ao2mo/10-diff_orbs_for_ijkl.py
|
robert-anderson/pyscf
|
cdc56e168cb15f47e8cdc791a92d689fa9b655af
|
[
"Apache-2.0"
] | 273
|
2018-11-26T10:10:24.000Z
|
2022-03-30T12:25:28.000Z
|
#!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
import tempfile
import numpy
import h5py
from pyscf import gto, scf, ao2mo
'''
Integral transformation for four different orbitals
'''
mol = gto.Mole()
mol.build(
atom = [
["C", (-0.65830719, 0.61123287, -0.00800148)],
["C", ( 0.73685281, 0.61123287, -0.00800148)],
["C", ( 1.43439081, 1.81898387, -0.00800148)],
["C", ( 0.73673681, 3.02749287, -0.00920048)],
["C", (-0.65808819, 3.02741487, -0.00967948)],
["C", (-1.35568919, 1.81920887, -0.00868348)],
["H", (-1.20806619, -0.34108413, -0.00755148)],
["H", ( 1.28636081, -0.34128013, -0.00668648)],
["H", ( 2.53407081, 1.81906387, -0.00736748)],
["H", ( 1.28693681, 3.97963587, -0.00925948)],
["H", (-1.20821019, 3.97969587, -0.01063248)],
["H", (-2.45529319, 1.81939187, -0.00886348)],],
basis = 'ccpvtz'
)
mf = scf.RHF(mol)
mf.conv_tol = 1e-8
e = mf.kernel()
print('E = %.15g, ref -230.776765415' % e)
#
# Given four MOs, compute the MO-integrals and saved in dataset "mp2_bz"
#
eritmp = tempfile.NamedTemporaryFile()
nocc = mol.nelectron // 2
nvir = len(mf.mo_energy) - nocc
co = mf.mo_coeff[:,:nocc]
cv = mf.mo_coeff[:,nocc:]
orbs = (co, cv, co, cv)
# Depending on your hardware and BLAS library, it needs about 1 min on I5 3GHz
# CPU with MKL library to transform the integrals
ao2mo.general(mol, orbs, eritmp.name, dataname='mp2_bz')#, verbose=5)
eia = mf.mo_energy[:nocc,None] - mf.mo_energy[None,nocc:]
f = h5py.File(eritmp.name, 'r')
eri = f['mp2_bz']
print('Note the shape of the transformed integrals (ij|kl) is %s.' % str(eri.shape))
print("It's a 2D array: the first index for compressed ij, the second index for compressed kl")
emp2 = 0
for i in range(nocc):
dajb = eia[i].reshape(-1,1) + eia.reshape(1,-1)
gi = numpy.array(eri[i*nvir:(i+1)*nvir])
t2 = gi.flatten() / dajb.flatten()
gi = gi.reshape(nvir,nocc,nvir)
theta = gi*2 - gi.transpose(2,1,0)
emp2 += numpy.dot(t2, theta.flatten())
print('E_MP2 = %.15g, ref = -1.0435476768' % emp2)
f.close()
| 30.202899
| 95
| 0.630038
|
4d58762d115eb02f59c966a2316a505ac497f34c
| 66
|
sql
|
SQL
|
src/test/resources/sql/insert/e14b4f88.sql
|
Shuttl-Tech/antlr_psql
|
fcf83192300abe723f3fd3709aff5b0c8118ad12
|
[
"MIT"
] | 66
|
2018-06-15T11:34:03.000Z
|
2022-03-16T09:24:49.000Z
|
src/test/resources/sql/insert/e14b4f88.sql
|
Shuttl-Tech/antlr_psql
|
fcf83192300abe723f3fd3709aff5b0c8118ad12
|
[
"MIT"
] | 13
|
2019-03-19T11:56:28.000Z
|
2020-08-05T04:20:50.000Z
|
src/test/resources/sql/insert/e14b4f88.sql
|
Shuttl-Tech/antlr_psql
|
fcf83192300abe723f3fd3709aff5b0c8118ad12
|
[
"MIT"
] | 28
|
2019-01-05T19:59:02.000Z
|
2022-03-24T11:55:50.000Z
|
-- file:plpgsql.sql ln:1761 expect:true
insert into foo values(x)
| 22
| 39
| 0.757576
|
767e89f9f26e1a6263e51401223af806432d9844
| 127,286
|
rs
|
Rust
|
components/html/src/tokenizer/mod.rs
|
ZeroX-DG/moon
|
db24fd8b54a6bf28666cc05f6ee54a307c7079b8
|
[
"MIT"
] | 170
|
2020-09-20T16:54:57.000Z
|
2022-03-29T02:27:14.000Z
|
components/html/src/tokenizer/mod.rs
|
ZeroX-DG/moon
|
db24fd8b54a6bf28666cc05f6ee54a307c7079b8
|
[
"MIT"
] | 14
|
2020-09-18T15:27:07.000Z
|
2022-03-27T22:40:00.000Z
|
components/html/src/tokenizer/mod.rs
|
ZeroX-DG/moon
|
db24fd8b54a6bf28666cc05f6ee54a307c7079b8
|
[
"MIT"
] | 7
|
2020-09-24T12:33:17.000Z
|
2022-03-17T12:49:00.000Z
|
pub mod state;
pub mod token;
use super::entities::ENTITIES;
use io::input_stream::CharInputStream;
use state::State;
use std::collections::{HashSet, VecDeque};
use std::env;
use token::Attribute;
use token::Token;
fn is_trace() -> bool {
match env::var("TRACE_TOKENIZER") {
Ok(s) => s == "true",
_ => false,
}
}
macro_rules! trace {
($err:expr) => {
println!("[ParseError][Tokenization]: {}", $err);
};
}
macro_rules! emit_error {
($err:expr) => {
if is_trace() {
trace!($err)
}
};
}
fn is_surrogate(n: u32) -> bool {
match n {
0xD800..=0xDFFF => true,
_ => false,
}
}
fn is_nonecharacter(n: u32) -> bool {
match n {
0xfdd0..=0xfdef
| 0xfffe..=0xffff
| 0x1_fffe..=0x1_ffff
| 0x2_fffe..=0x2_ffff
| 0x3_fffe..=0x3_ffff
| 0x4_fffe..=0x4_ffff
| 0x5_fffe..=0x5_ffff
| 0x6_fffe..=0x6_ffff
| 0x7_fffe..=0x7_ffff
| 0x8_fffe..=0x8_ffff
| 0x9_fffe..=0x9_ffff
| 0xA_fffe..=0xA_ffff
| 0xB_fffe..=0xB_ffff
| 0xC_fffe..=0xC_ffff
| 0xD_fffe..=0xD_ffff
| 0xE_fffe..=0xE_ffff
| 0xF_fffe..=0xF_ffff
| 0x10_fffe..=0x10_ffff => true,
_ => false,
}
}
fn is_control(n: u32) -> bool {
match n {
0x0000..=0x001F => true,
0x007F..=0x009F => true,
_ => false,
}
}
fn is_whitespace(n: u32) -> bool {
match n {
0x0009 | 0x000A | 0x000C | 0x000D | 0x0020 => true,
_ => false,
}
}
pub fn replace_control_codes(n: u32) -> Option<u32> {
match n {
0x80 => Some(0x20AC),
0x82 => Some(0x201A),
0x83 => Some(0x0192),
0x84 => Some(0x201E),
0x85 => Some(0x2026),
0x86 => Some(0x2020),
0x87 => Some(0x2021),
0x88 => Some(0x02C6),
0x89 => Some(0x2030),
0x8A => Some(0x0160),
0x8B => Some(0x2039),
0x8C => Some(0x0152),
0x8E => Some(0x017D),
0x91 => Some(0x2018),
0x92 => Some(0x2019),
0x93 => Some(0x201C),
0x94 => Some(0x201D),
0x95 => Some(0x2022),
0x96 => Some(0x2013),
0x97 => Some(0x2014),
0x98 => Some(0x02DC),
0x99 => Some(0x2122),
0x9A => Some(0x0161),
0x9B => Some(0x203A),
0x9C => Some(0x0153),
0x9E => Some(0x017E),
0x9F => Some(0x0178),
_ => None,
}
}
// TODO: replace with char::REPLACEMENT_CHARACTER when stable
const REPLACEMENT_CHARACTER: char = '\u{FFFD}';
#[allow(non_camel_case_types)]
#[derive(Clone)]
pub enum Char {
ch(char),
eof,
null,
whitespace,
}
pub struct Tokenizer<T>
where
T: Iterator<Item = char>,
{
// chars input stream for tokenizer
input: CharInputStream<T>,
// A list of tokenized tokens
output: VecDeque<Token>,
// Current consumed character. Might reconsume later
current_character: char,
// The state for tokenizing
state: State,
// The return state
return_state: Option<State>,
// Current token
current_token: Option<Token>,
// Specify if the next step should reconsume the current char
reconsume_char: bool,
// Temporary buffer to track progress
temp_buffer: String,
// Last emitted start tag to verify if end tag is valid
last_emitted_start_tag: Option<Token>,
// Code for a character reference. Example: ä
character_reference_code: u32,
}
pub trait Tokenizing {
fn next_token(&mut self) -> Token;
fn switch_to(&mut self, state: State);
}
impl<T> Tokenizing for Tokenizer<T>
where
T: Iterator<Item = char>,
{
fn next_token(&mut self) -> Token {
if !self.output.is_empty() {
return self.output.pop_front().unwrap();
}
loop {
match self.state {
State::Data => {
let ch = self.consume_next();
match ch {
Char::ch('&') => {
self.return_state = Some(State::Data);
self.switch_to(State::CharacterReference);
}
Char::ch('<') => self.switch_to(State::TagOpen),
Char::null => {
emit_error!("unexpected-null-character");
return self.emit_current_char();
}
Char::eof => return self.emit_eof(),
_ => return self.emit_current_char(),
}
}
State::RCDATA => {
let ch = self.consume_next();
match ch {
Char::ch('&') => {
self.return_state = Some(State::RCDATA);
self.switch_to(State::CharacterReference);
}
Char::ch('<') => self.switch_to(State::RCDATALessThanSign),
Char::null => {
emit_error!("unexpected-null-character");
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => return self.emit_eof(),
_ => return self.emit_current_char(),
}
}
State::RAWTEXT => {
let ch = self.consume_next();
match ch {
Char::ch('<') => self.switch_to(State::RAWTEXTLessThanSign),
Char::null => {
emit_error!("unexpected-null-character");
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => return self.emit_eof(),
_ => return self.emit_current_char(),
}
}
State::ScriptData => {
let ch = self.consume_next();
match ch {
Char::ch('<') => self.switch_to(State::ScriptDataLessThanSign),
Char::null => {
emit_error!("unexpected-null-character");
self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => return self.emit_eof(),
_ => return self.emit_current_char(),
}
}
State::PLAINTEXT => {
let ch = self.consume_next();
match ch {
Char::null => {
emit_error!("unexpected-null-character");
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => return self.emit_eof(),
_ => return self.emit_current_char(),
}
}
State::TagOpen => {
let ch = self.consume_next();
match ch {
Char::ch('!') => self.switch_to(State::MarkupDeclarationOpen),
Char::ch('/') => self.switch_to(State::EndTagOpen),
Char::ch(c) if c.is_ascii_alphabetic() => {
self.current_token = Some(Token::new_start_tag());
self.reconsume_in(State::TagName);
}
Char::ch('?') => {
emit_error!("unexpected-question-mark-instead-of-tag-name");
self.new_token(Token::new_comment(""));
self.reconsume_in(State::BogusComment);
}
Char::eof => {
emit_error!("eof-before-tag-name");
self.will_emit(Token::Character('<'));
return self.emit_eof();
}
_ => {
emit_error!("invalid-first-character-of-tag-name");
self.will_emit(Token::Character('<'));
self.reconsume_in(State::Data);
}
}
}
State::EndTagOpen => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_alphabetic() => {
self.new_token(Token::new_end_tag());
self.reconsume_in(State::TagName);
}
Char::ch('>') => {
emit_error!("missing-end-tag-name");
self.switch_to(State::Data);
}
Char::eof => {
emit_error!("eof-before-tag-name");
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
return self.emit_eof();
}
_ => {
emit_error!("invalid-first-character-of-tag-name");
self.new_token(Token::new_comment(""));
self.reconsume_in(State::BogusComment);
}
}
}
State::TagName => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
self.switch_to(State::BeforeAttributeName);
}
Char::ch('/') => {
self.switch_to(State::SelfClosingStartTag);
}
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.append_character_to_tag_name(c.to_ascii_lowercase());
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_tag_name(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-tag");
return self.emit_eof();
}
_ => {
self.append_character_to_tag_name(self.current_character);
}
}
}
State::RCDATALessThanSign => {
let ch = self.consume_next();
match ch {
Char::ch('/') => {
self.temp_buffer.clear();
self.switch_to(State::RCDATAEndTagOpen);
}
_ => {
self.will_emit(Token::Character('<'));
self.reconsume_in(State::RCDATA);
}
}
}
State::RCDATAEndTagOpen => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_alphabetic() => {
self.new_token(Token::new_end_tag());
self.reconsume_in(State::RCDATAEndTagName);
}
_ => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.reconsume_in(State::RCDATA);
}
}
}
State::RCDATAEndTagName => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::RCDATA);
} else {
self.switch_to(State::BeforeAttributeName);
}
}
Char::ch('/') => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::RCDATA);
} else {
self.switch_to(State::SelfClosingStartTag);
}
}
Char::ch('>') => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::RCDATA);
} else {
self.switch_to(State::Data);
return self.emit_current_token();
}
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.append_character_to_tag_name(c.to_ascii_lowercase());
self.temp_buffer.push(self.current_character);
}
Char::ch(c) if c.is_ascii_lowercase() => {
self.append_character_to_tag_name(self.current_character);
self.temp_buffer.push(self.current_character);
}
_ => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::RCDATA);
}
}
}
State::RAWTEXTLessThanSign => {
let ch = self.consume_next();
match ch {
Char::ch('/') => {
self.temp_buffer.clear();
self.switch_to(State::RAWTEXTEndTagOpen);
}
_ => {
self.will_emit(Token::Character('<'));
self.reconsume_in(State::RAWTEXT);
}
}
}
State::RAWTEXTEndTagOpen => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_alphabetic() => {
self.new_token(Token::new_end_tag());
self.reconsume_in(State::RAWTEXTEndTagName);
}
_ => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.reconsume_in(State::RAWTEXT);
}
}
}
State::RAWTEXTEndTagName => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::RAWTEXT);
} else {
self.switch_to(State::BeforeAttributeName);
}
}
Char::ch('/') => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::RAWTEXT);
} else {
self.switch_to(State::SelfClosingStartTag);
}
}
Char::ch('>') => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::RAWTEXT);
} else {
self.switch_to(State::Data);
return self.emit_current_token();
}
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.append_character_to_tag_name(c.to_ascii_lowercase());
self.temp_buffer.push(self.current_character);
}
Char::ch(c) if c.is_ascii_lowercase() => {
self.append_character_to_tag_name(self.current_character);
self.temp_buffer.push(self.current_character);
}
_ => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::RAWTEXT);
}
}
}
State::ScriptDataLessThanSign => {
let ch = self.consume_next();
match ch {
Char::ch('/') => {
self.temp_buffer.clear();
self.switch_to(State::ScriptDataEndTagOpen);
}
Char::ch('!') => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('!'));
self.switch_to(State::ScriptDataEscapeStart);
}
_ => {
self.will_emit(Token::Character('<'));
self.reconsume_in(State::ScriptData);
}
}
}
State::ScriptDataEndTagOpen => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_alphabetic() => {
self.new_token(Token::new_end_tag());
self.reconsume_in(State::ScriptDataEndTagName);
}
_ => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.reconsume_in(State::ScriptData);
}
}
}
State::ScriptDataEndTagName => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::ScriptData);
} else {
self.switch_to(State::BeforeAttributeName);
}
}
Char::ch('/') => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::ScriptData);
} else {
self.switch_to(State::SelfClosingStartTag);
}
}
Char::ch('>') => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::ScriptData);
} else {
self.switch_to(State::Data);
return self.emit_current_token();
}
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.append_character_to_tag_name(c.to_ascii_lowercase());
self.temp_buffer.push(self.current_character);
}
Char::ch(c) if c.is_ascii_lowercase() => {
self.append_character_to_tag_name(self.current_character);
self.temp_buffer.push(self.current_character);
}
_ => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::ScriptData);
}
}
}
State::ScriptDataEscapeStart => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::ScriptDataEscapeStartDash);
}
_ => {
self.reconsume_in(State::ScriptData);
}
}
}
State::ScriptDataEscapeStartDash => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::ScriptDataEscapedDashDash);
}
_ => {
self.reconsume_in(State::ScriptData);
}
}
}
State::ScriptDataEscaped => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::ScriptDataEscapedDash);
return self.emit_char('-');
}
Char::ch('<') => {
self.switch_to(State::ScriptDataEscapedLessThanSign);
}
Char::null => {
emit_error!("unexpected-null-character");
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-script-html-comment-like-text");
return self.emit_eof();
}
_ => {
return self.emit_current_char();
}
}
}
State::ScriptDataEscapedDash => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::ScriptDataEscapedDashDash);
return self.emit_char('-');
}
Char::ch('<') => {
self.switch_to(State::ScriptDataEscapedLessThanSign);
}
Char::null => {
emit_error!("unexpected-null-character");
self.switch_to(State::ScriptDataEscaped);
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-script-html-comment-like-text");
return self.emit_eof();
}
_ => {
self.switch_to(State::ScriptDataEscaped);
return self.emit_current_char();
}
}
}
State::ScriptDataEscapedDashDash => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
return self.emit_char('-');
}
Char::ch('<') => {
self.switch_to(State::ScriptDataEscapedLessThanSign);
}
Char::ch('>') => {
self.switch_to(State::ScriptData);
return self.emit_char('>');
}
Char::null => {
emit_error!("unexpected-null-character");
self.switch_to(State::ScriptDataEscaped);
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-script-html-comment-like-text");
return self.emit_eof();
}
_ => {
self.switch_to(State::ScriptDataEscaped);
return self.emit_current_char();
}
}
}
State::ScriptDataEscapedLessThanSign => {
let ch = self.consume_next();
match ch {
Char::ch('/') => {
self.temp_buffer.clear();
self.switch_to(State::ScriptDataEscapedEndTagOpen);
}
Char::ch(c) if c.is_ascii_alphabetic() => {
self.temp_buffer.clear();
self.will_emit(Token::Character('<'));
self.reconsume_in(State::ScriptDataDoubleEscapeStart);
}
_ => {
self.will_emit(Token::Character('<'));
self.reconsume_in(State::ScriptDataEscaped);
}
}
}
State::ScriptDataEscapedEndTagOpen => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_alphabetic() => {
self.new_token(Token::new_end_tag());
self.reconsume_in(State::ScriptDataEscapedEndTagName);
}
_ => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.reconsume_in(State::ScriptDataEscaped);
}
}
}
State::ScriptDataEscapedEndTagName => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::ScriptDataEscaped);
} else {
self.switch_to(State::BeforeAttributeName);
}
}
Char::ch('/') => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::ScriptDataEscaped);
} else {
self.switch_to(State::SelfClosingStartTag);
}
}
Char::ch('>') => {
if !self.is_end_tag_appropriate() {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::ScriptDataEscaped);
} else {
self.switch_to(State::Data);
return self.emit_current_token();
}
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.append_character_to_tag_name(c.to_ascii_lowercase());
self.temp_buffer.push(c);
}
Char::ch(c) if c.is_ascii_lowercase() => {
self.append_character_to_tag_name(c);
self.temp_buffer.push(c);
}
_ => {
self.will_emit(Token::Character('<'));
self.will_emit(Token::Character('/'));
self.emit_temp_buffer();
self.reconsume_in(State::ScriptDataEscaped);
}
}
}
State::ScriptDataDoubleEscapeStart => {
let ch = self.consume_next();
match ch {
Char::whitespace | Char::ch('/') | Char::ch('>') => {
if self.temp_buffer == "script" {
self.switch_to(State::ScriptDataDoubleEscaped);
} else {
self.switch_to(State::ScriptDataEscaped);
}
return self.emit_current_char();
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.temp_buffer.push(c.to_ascii_lowercase());
return self.emit_current_char();
}
Char::ch(c) if c.is_ascii_lowercase() => {
self.temp_buffer.push(c);
return self.emit_current_char();
}
_ => {
self.reconsume_in(State::ScriptDataEscaped);
}
}
}
State::ScriptDataDoubleEscaped => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::ScriptDataDoubleEscapedDash);
return self.emit_char('-');
}
Char::ch('<') => {
self.switch_to(State::ScriptDataDoubleEscapedLessThanSign);
return self.emit_char('<');
}
Char::null => {
emit_error!("unexpected-null-character");
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-script-html-comment-like-text");
return self.emit_eof();
}
_ => {
return self.emit_current_char();
}
}
}
State::ScriptDataDoubleEscapedDash => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::ScriptDataDoubleEscapedDashDash);
return self.emit_char('-');
}
Char::ch('<') => {
self.switch_to(State::ScriptDataDoubleEscapedLessThanSign);
return self.emit_char('<');
}
Char::null => {
emit_error!("unexpected-null-character");
self.switch_to(State::ScriptDataDoubleEscaped);
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-script-html-comment-like-text");
return self.emit_eof();
}
_ => {
self.switch_to(State::ScriptDataDoubleEscaped);
return self.emit_current_char();
}
}
}
State::ScriptDataDoubleEscapedDashDash => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
return self.emit_char('-');
}
Char::ch('<') => {
self.switch_to(State::ScriptDataDoubleEscapedLessThanSign);
return self.emit_char('<');
}
Char::ch('>') => {
self.switch_to(State::ScriptData);
return self.emit_char('>');
}
Char::null => {
emit_error!("unexpected-null-character");
self.switch_to(State::ScriptDataDoubleEscaped);
return self.emit_char(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-script-html-comment-like-text");
return self.emit_eof();
}
_ => {
self.switch_to(State::ScriptDataDoubleEscaped);
return self.emit_current_char();
}
}
}
State::ScriptDataDoubleEscapedLessThanSign => {
let ch = self.consume_next();
match ch {
Char::ch('/') => {
self.temp_buffer.clear();
self.switch_to(State::ScriptDataDoubleEscapeEnd);
return self.emit_char('/');
}
_ => {
self.reconsume_in(State::ScriptDataDoubleEscaped);
}
}
}
State::ScriptDataDoubleEscapeEnd => {
let ch = self.consume_next();
match ch {
Char::whitespace | Char::ch('/') | Char::ch('>') => {
if self.temp_buffer == "script" {
self.switch_to(State::ScriptDataEscaped);
} else {
self.switch_to(State::ScriptDataDoubleEscaped);
}
return self.emit_current_char();
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.temp_buffer.push(c.to_ascii_lowercase());
return self.emit_current_char();
}
Char::ch(c) if c.is_ascii_lowercase() => {
self.temp_buffer.push(c);
return self.emit_current_char();
}
_ => {
self.reconsume_in(State::ScriptDataDoubleEscaped);
}
}
}
State::BeforeAttributeName => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch('/') | Char::ch('>') | Char::eof => {
self.reconsume_in(State::AfterAttributeName);
}
Char::ch('=') => {
emit_error!("unexpected-equals-sign-before-attribute-name");
let mut attribute = Attribute::new();
attribute.name.push(self.current_character);
self.new_attribute(attribute);
self.switch_to(State::AttributeName);
}
_ => {
let attribute = Attribute::new();
self.new_attribute(attribute);
self.reconsume_in(State::AttributeName);
}
}
}
State::AttributeName => {
let ch = self.consume_next();
match ch {
Char::whitespace | Char::ch('/') | Char::ch('>') | Char::eof => {
self.reconsume_in(State::AfterAttributeName);
}
Char::ch('=') => {
self.switch_to(State::BeforeAttributeValue);
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.append_character_to_attribute_name(c.to_ascii_lowercase());
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_attribute_name(REPLACEMENT_CHARACTER);
}
Char::ch('"') | Char::ch('\'') | Char::ch('<') => {
emit_error!("unexpected-character-in-attribute-name");
self.append_character_to_attribute_name(self.current_character);
}
_ => {
self.append_character_to_attribute_name(self.current_character);
}
}
}
State::AfterAttributeName => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch('/') => {
self.switch_to(State::SelfClosingStartTag);
}
Char::ch('=') => {
self.switch_to(State::BeforeAttributeValue);
}
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-tag");
return self.emit_eof();
}
_ => {
let attribute = Attribute::new();
self.new_attribute(attribute);
self.reconsume_in(State::AttributeName);
}
}
}
State::BeforeAttributeValue => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch('"') => {
self.switch_to(State::AttributeValueDoubleQuoted);
}
Char::ch('\'') => {
self.switch_to(State::AttributeValueSingleQuoted);
}
Char::ch('>') => {
emit_error!("missing-attribute-value");
self.switch_to(State::Data);
return self.emit_current_token();
}
_ => {
self.reconsume_in(State::AttributeValueUnQuoted);
}
}
}
State::AttributeValueDoubleQuoted => {
let ch = self.consume_next();
match ch {
Char::ch('"') => {
self.switch_to(State::AfterAttributeValueQuoted);
}
Char::ch('&') => {
self.return_state = Some(State::AttributeValueDoubleQuoted);
self.switch_to(State::CharacterReference);
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_attribute_value(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-tag");
return self.emit_eof();
}
_ => {
self.append_character_to_attribute_value(self.current_character);
}
}
}
State::AttributeValueSingleQuoted => {
let ch = self.consume_next();
match ch {
Char::ch('\'') => {
self.switch_to(State::AfterAttributeValueQuoted);
}
Char::ch('&') => {
self.return_state = Some(State::AttributeValueSingleQuoted);
self.switch_to(State::CharacterReference);
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_attribute_value(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-tag");
return self.emit_eof();
}
_ => {
self.append_character_to_attribute_value(self.current_character);
}
}
}
State::AttributeValueUnQuoted => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
self.switch_to(State::BeforeAttributeName);
}
Char::ch('&') => {
self.return_state = Some(State::AttributeValueUnQuoted);
self.switch_to(State::CharacterReference);
}
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_attribute_value(REPLACEMENT_CHARACTER);
}
Char::ch('"')
| Char::ch('\'')
| Char::ch('<')
| Char::ch('=')
| Char::ch('`') => {
emit_error!("unexpected-character-in-unquoted-attribute-value");
self.append_character_to_attribute_value(self.current_character);
}
Char::eof => {
emit_error!("eof-in-tag");
return self.emit_eof();
}
_ => {
self.append_character_to_attribute_value(self.current_character);
}
}
}
State::AfterAttributeValueQuoted => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
self.switch_to(State::BeforeAttributeName);
}
Char::ch('/') => {
self.switch_to(State::SelfClosingStartTag);
}
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-tag");
return self.emit_eof();
}
_ => {
emit_error!("missing-whitespace-between-attributes");
self.reconsume_in(State::BeforeAttributeName);
}
}
}
State::SelfClosingStartTag => {
let ch = self.consume_next();
match ch {
Char::ch('>') => {
let tag = self.current_token.as_mut().unwrap();
if let Token::Tag {
ref mut self_closing,
..
} = tag
{
*self_closing = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-tag");
return self.emit_eof();
}
_ => {
emit_error!("unexpected-solidus-in-tag");
self.reconsume_in(State::BeforeAttributeName);
}
}
}
State::BogusComment => {
let ch = self.consume_next();
match ch {
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_token_data(REPLACEMENT_CHARACTER);
}
_ => {
self.append_character_to_token_data(self.current_character);
}
}
}
State::MarkupDeclarationOpen => {
if self.consume_if_match("--", false) {
self.new_token(Token::new_comment(""));
self.switch_to(State::CommentStart);
} else if self.consume_if_match("doctype", true) {
self.switch_to(State::DOCTYPE);
} else if self.consume_if_match("[CDATA[", false) {
// TODO: implement this
unimplemented!();
} else {
emit_error!("incorrectly-opened-comment");
self.new_token(Token::new_comment(""));
self.switch_to(State::BogusComment);
}
}
State::CommentStart => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::CommentStartDash);
}
Char::ch('>') => {
emit_error!("abrupt-closing-of-empty-comment");
self.switch_to(State::Data);
return self.emit_current_token();
}
_ => {
self.reconsume_in(State::Comment);
}
}
}
State::CommentStartDash => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::CommentEnd);
}
Char::ch('>') => {
emit_error!("abrupt-closing-of-empty-comment");
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-comment");
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_token_data('-');
self.reconsume_in(State::Comment);
}
}
}
State::Comment => {
let ch = self.consume_next();
match ch {
Char::ch('<') => {
self.append_character_to_token_data(self.current_character);
self.switch_to(State::CommentLessThanSign);
}
Char::ch('-') => {
self.switch_to(State::CommentEndDash);
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_token_data(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-comment");
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_token_data(self.current_character);
}
}
}
State::CommentLessThanSign => {
let ch = self.consume_next();
match ch {
Char::ch('!') => {
self.append_character_to_token_data(self.current_character);
self.switch_to(State::CommentLessThanSignBang);
}
Char::ch('<') => {
self.append_character_to_token_data(self.current_character);
}
_ => {
self.reconsume_in(State::Comment);
}
}
}
State::CommentLessThanSignBang => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::CommentLessThanSignBangDash);
}
_ => {
self.reconsume_in(State::Comment);
}
}
}
State::CommentLessThanSignBangDash => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::CommentLessThanSignBangDashDash);
}
_ => {
self.reconsume_in(State::CommentEndDash);
}
}
}
State::CommentLessThanSignBangDashDash => {
let ch = self.consume_next();
match ch {
Char::ch('>') | Char::eof => {
self.reconsume_in(State::CommentEnd);
}
_ => {
emit_error!("nested-comment");
self.reconsume_in(State::CommentEnd);
}
}
}
State::CommentEndDash => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.switch_to(State::CommentEnd);
}
Char::eof => {
emit_error!("eof-in-comment");
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_token_data('-');
self.reconsume_in(State::Comment);
}
}
}
State::CommentEnd => {
let ch = self.consume_next();
match ch {
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::ch('!') => {
self.switch_to(State::CommentEndBang);
}
Char::ch('-') => {
self.append_character_to_token_data('-');
}
Char::eof => {
emit_error!("eof-in-comment");
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_token_data('-');
self.append_character_to_token_data('-');
self.reconsume_in(State::Comment);
}
}
}
State::CommentEndBang => {
let ch = self.consume_next();
match ch {
Char::ch('-') => {
self.append_character_to_token_data('-');
self.append_character_to_token_data('-');
self.append_character_to_token_data('!');
self.switch_to(State::CommentEndDash);
}
Char::ch('>') => {
emit_error!("incorrectly-closed-comment");
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-comment");
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_token_data('-');
self.append_character_to_token_data('-');
self.append_character_to_token_data('!');
self.reconsume_in(State::Comment);
}
}
}
State::DOCTYPE => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
self.switch_to(State::BeforeDOCTYPEName);
}
Char::ch('>') => {
self.reconsume_in(State::BeforeDOCTYPEName);
}
Char::eof => {
emit_error!("eof-in-doctype");
let mut token = Token::new_doctype();
token.set_force_quirks(true);
self.new_token(token);
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
emit_error!("missing-whitespace-before-doctype-name");
self.reconsume_in(State::BeforeDOCTYPEName);
}
}
}
State::BeforeDOCTYPEName => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch(c) if c.is_ascii_uppercase() => {
let mut token = Token::new_doctype();
if let Token::DOCTYPE { ref mut name, .. } = token {
let mut new_name = String::new();
new_name.push(c.to_ascii_lowercase());
*name = Some(new_name);
}
self.new_token(token);
self.switch_to(State::DOCTYPEName);
}
Char::null => {
emit_error!("unexpected-null-character");
let mut token = Token::new_doctype();
if let Token::DOCTYPE { ref mut name, .. } = token {
let mut new_name = String::new();
new_name.push(REPLACEMENT_CHARACTER);
*name = Some(new_name);
}
self.new_token(token);
self.switch_to(State::DOCTYPEName);
}
Char::ch('>') => {
emit_error!("missing-doctype-name");
let mut token = Token::new_doctype();
token.set_force_quirks(true);
self.new_token(token);
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let mut token = Token::new_doctype();
token.set_force_quirks(true);
self.new_token(token);
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
let mut token = Token::new_doctype();
if let Token::DOCTYPE { ref mut name, .. } = token {
let mut new_name = String::new();
new_name.push(self.current_character);
*name = Some(new_name);
}
self.new_token(token);
self.switch_to(State::DOCTYPEName);
}
}
}
State::DOCTYPEName => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
self.switch_to(State::AfterDOCTYPEName);
}
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::ch(c) if c.is_ascii_uppercase() => {
self.append_character_to_doctype_name(c.to_ascii_lowercase());
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_doctype_name(REPLACEMENT_CHARACTER);
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_doctype_name(self.current_character);
}
}
}
State::AfterDOCTYPEName => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
if self.consume_from_current_if_match("PUBLIC", true) {
self.switch_to(State::AfterDOCTYPEPublicKeyword);
} else if self.consume_from_current_if_match("SYSTEM", true) {
self.switch_to(State::AfterDOCTYPESystemKeyword);
} else {
emit_error!("invalid-character-sequence-after-doctype-name");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.reconsume_in(State::BogusDOCTYPE);
}
}
}
}
State::AfterDOCTYPEPublicKeyword => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
self.switch_to(State::BeforeDOCTYPEPublicIdentifier);
}
Char::ch('"') => {
emit_error!("missing-whitespace-after-doctype-public-keyword");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut public_identifier,
..
} = token
{
*public_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPEPublicIdentifierDoubleQuoted);
}
Char::ch('\'') => {
emit_error!("missing-whitespace-after-doctype-public-keyword");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut public_identifier,
..
} = token
{
*public_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPEPublicIdentifierSingleQuoted);
}
Char::ch('>') => {
emit_error!("missing-doctype-public-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
emit_error!("missing-quote-before-doctype-public-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.reconsume_in(State::BogusDOCTYPE);
}
}
}
State::BeforeDOCTYPEPublicIdentifier => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch('"') => {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut public_identifier,
..
} = token
{
*public_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPEPublicIdentifierDoubleQuoted);
}
Char::ch('\'') => {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut public_identifier,
..
} = token
{
*public_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPEPublicIdentifierSingleQuoted);
}
Char::ch('>') => {
emit_error!("missing-doctype-public-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
emit_error!("missing-quote-before-doctype-public-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.reconsume_in(State::BogusDOCTYPE);
}
}
}
State::DOCTYPEPublicIdentifierDoubleQuoted => {
let ch = self.consume_next();
match ch {
Char::ch('"') => {
self.switch_to(State::AfterDOCTYPEPublicIdentifier);
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_doctype_public_identifier(
REPLACEMENT_CHARACTER,
);
}
Char::ch('>') => {
emit_error!("abrupt-doctype-public-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_doctype_public_identifier(
self.current_character,
);
}
}
}
State::DOCTYPEPublicIdentifierSingleQuoted => {
let ch = self.consume_next();
match ch {
Char::ch('\'') => {
self.switch_to(State::AfterDOCTYPEPublicIdentifier);
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_doctype_public_identifier(
REPLACEMENT_CHARACTER,
);
}
Char::ch('>') => {
emit_error!("abrupt-doctype-public-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_doctype_public_identifier(
self.current_character,
);
}
}
}
State::AfterDOCTYPEPublicIdentifier => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
self.switch_to(State::BetweenDOCTYPEPublicAndSystemIdentifiers);
}
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::ch('"') => {
emit_error!(
"missing-whitespace-between-doctype-public-and-system-identifiers"
);
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
*system_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPESytemIdentifierDoubleQuoted);
}
Char::ch('\'') => {
emit_error!(
"missing-whitespace-between-doctype-public-and-system-identifiers"
);
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
*system_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPESytemIdentifierSingleQuoted);
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
emit_error!("missing-quote-before-doctype-system-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.reconsume_in(State::BogusDOCTYPE);
}
}
}
State::BetweenDOCTYPEPublicAndSystemIdentifiers => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::ch('"') => {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
*system_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPESytemIdentifierDoubleQuoted);
}
Char::ch('\'') => {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
*system_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPESytemIdentifierSingleQuoted);
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
emit_error!("missing-quote-before-doctype-system-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.reconsume_in(State::BogusDOCTYPE);
}
}
}
State::AfterDOCTYPESystemKeyword => {
let ch = self.consume_next();
match ch {
Char::whitespace => {
self.switch_to(State::BeforeDOCTYPESystemIdentifier);
}
Char::ch('"') => {
emit_error!("missing-whitespace-after-doctype-system-keyword");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
*system_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPESytemIdentifierDoubleQuoted);
}
Char::ch('\'') => {
emit_error!("missing-whitespace-after-doctype-system-keyword");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
*system_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPESytemIdentifierSingleQuoted);
}
Char::ch('>') => {
emit_error!("missing-doctype-system-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
emit_error!("missing-quote-before-doctype-system-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.reconsume_in(State::BogusDOCTYPE);
}
}
}
State::BeforeDOCTYPESystemIdentifier => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch('"') => {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
*system_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPESytemIdentifierDoubleQuoted);
}
Char::ch('\'') => {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
*system_identifier = Some(String::new());
}
self.switch_to(State::DOCTYPESytemIdentifierSingleQuoted);
}
Char::ch('>') => {
emit_error!("missing-doctype-system-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
emit_error!("missing-quote-before-doctype-system-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.reconsume_in(State::BogusDOCTYPE);
}
}
}
State::DOCTYPESytemIdentifierDoubleQuoted => {
let ch = self.consume_next();
match ch {
Char::ch('"') => {
self.switch_to(State::AfterDOCTYPESystemIdentifier);
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_doctype_system_identifier(
REPLACEMENT_CHARACTER,
);
}
Char::ch('>') => {
emit_error!("abrupt-doctype-system-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_doctype_system_identifier(
self.current_character,
);
}
}
}
State::DOCTYPESytemIdentifierSingleQuoted => {
let ch = self.consume_next();
match ch {
Char::ch('\'') => {
self.switch_to(State::AfterDOCTYPESystemIdentifier);
}
Char::null => {
emit_error!("unexpected-null-character");
self.append_character_to_doctype_system_identifier(
REPLACEMENT_CHARACTER,
);
}
Char::ch('>') => {
emit_error!("abrupt-doctype-system-identifier");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
self.append_character_to_doctype_system_identifier(
self.current_character,
);
}
}
}
State::AfterDOCTYPESystemIdentifier => {
let ch = self.consume_next();
match ch {
Char::whitespace => continue,
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::eof => {
emit_error!("eof-in-doctype");
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut force_quirks,
..
} = token
{
*force_quirks = true;
}
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
emit_error!("unexpected-character-after-doctype-system-identifier");
self.reconsume_in(State::BogusDOCTYPE);
}
}
}
State::BogusDOCTYPE => {
let ch = self.consume_next();
match ch {
Char::ch('>') => {
self.switch_to(State::Data);
return self.emit_current_token();
}
Char::null => {
emit_error!("unexpected-null-character");
continue;
}
Char::eof => {
self.will_emit(self.current_token.clone().unwrap());
return self.emit_eof();
}
_ => {
continue;
}
}
}
State::CDATASection => {
let ch = self.consume_next();
match ch {
Char::ch(']') => {
self.switch_to(State::CDATASectionBracket);
}
Char::eof => {
emit_error!("eof-in-cdata");
return self.emit_eof();
}
_ => {
return self.emit_current_char();
}
}
}
State::CDATASectionBracket => {
let ch = self.consume_next();
match ch {
Char::ch(']') => {
self.switch_to(State::CDATASectionEnd);
}
_ => {
self.will_emit(Token::Character(']'));
self.reconsume_in(State::CDATASection);
}
}
}
State::CDATASectionEnd => {
let ch = self.consume_next();
match ch {
Char::ch(']') => {
return self.emit_char(']');
}
Char::ch('>') => {
self.switch_to(State::Data);
}
_ => {
self.will_emit(Token::Character(']'));
self.will_emit(Token::Character(']'));
self.reconsume_in(State::CDATASection);
}
}
}
State::CharacterReference => {
let ch = self.consume_next();
self.temp_buffer.clear();
self.temp_buffer.push('&');
match ch {
Char::ch(c) if c.is_ascii_alphanumeric() => {
self.reconsume_in(State::NamedCharacterReference);
}
Char::ch('#') => {
self.temp_buffer.push(self.current_character);
self.switch_to(State::NumericCharacterReference);
}
_ => {
self.flush_code_points_consumed_as_a_character_reference();
self.reconsume_in_return_state();
}
}
}
State::NamedCharacterReference => {
let current_str = format!(
"{}{}",
self.current_character,
self.input.peek_max().iter().collect::<String>()
);
let mut match_result: Option<(&str, u32, u32)> = None;
let mut max_len: usize = 0;
// TODO: optimize matching
for entity in ENTITIES.iter() {
let entity_name = entity.0;
let entity_len = entity_name.len();
if current_str.starts_with(entity_name) {
if entity_len > max_len {
max_len = entity_len;
match_result = Some(*entity);
}
}
}
if let Some(result) = match_result {
let (entity_name, charcode_1, charcode_2) = result;
for c in entity_name.chars() {
self.consume_next();
self.temp_buffer.push(c);
}
let last_match_ch = self.current_character;
if self.is_character_part_of_attribute() && last_match_ch != ';' {
let next_ch = current_str.chars().nth(max_len - 1);
if let Some(next_ch) = next_ch {
if next_ch == '=' || next_ch.is_ascii_alphanumeric() {
self.flush_code_points_consumed_as_a_character_reference();
self.switch_to_return_state();
continue;
}
}
}
if last_match_ch != ';' {
emit_error!("missing-semicolon-after-character-reference");
}
self.temp_buffer.clear();
self.temp_buffer
.push(std::char::from_u32(charcode_1).unwrap());
if charcode_2 != 0 {
self.temp_buffer
.push(std::char::from_u32(charcode_2).unwrap());
}
self.flush_code_points_consumed_as_a_character_reference();
self.switch_to_return_state();
} else {
self.flush_code_points_consumed_as_a_character_reference();
self.switch_to(State::AmbiguousAmpersand);
}
}
State::AmbiguousAmpersand => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_alphanumeric() => {
if self.is_character_part_of_attribute() {
self.append_character_to_attribute_value(c);
} else {
return self.emit_current_char();
}
}
Char::ch(';') => {
emit_error!("unknown-named-character-reference");
self.reconsume_in_return_state();
}
_ => {
self.reconsume_in_return_state();
}
}
}
State::NumericCharacterReference => {
self.character_reference_code = 0;
let ch = self.consume_next();
match ch {
Char::ch('x') | Char::ch('X') => {
self.temp_buffer.push(self.current_character);
self.switch_to(State::HexadecimalCharacterReferenceStart);
}
_ => {
self.reconsume_in(State::DecimalCharacterReferenceStart);
}
}
}
State::HexadecimalCharacterReferenceStart => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_hexdigit() => {
self.reconsume_in(State::HexadecimalCharacterReference);
}
_ => {
emit_error!("absence-of-digits-in-numeric-character-reference");
self.flush_code_points_consumed_as_a_character_reference();
self.reconsume_in_return_state();
}
}
}
State::DecimalCharacterReferenceStart => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_digit() => {
self.reconsume_in(State::DecimalCharacterReference);
}
_ => {
emit_error!("absence-of-digits-in-numeric-character-reference");
self.flush_code_points_consumed_as_a_character_reference();
self.reconsume_in_return_state();
}
}
}
State::HexadecimalCharacterReference => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_digit() => {
self.character_reference_code *= 16;
if let Some(d) = self.current_character.to_digit(10) {
self.character_reference_code += d;
} else {
emit_error!("Can't convert current character to digit");
}
}
Char::ch(c) if c.is_ascii_hexdigit() => {
self.character_reference_code *= 16;
if let Some(d) = self.current_character.to_digit(16) {
self.character_reference_code += d;
} else {
emit_error!("Can't convert current character to digit");
}
}
Char::ch(';') => {
self.switch_to(State::NumericCharacterReferenceEnd);
}
_ => {
emit_error!("missing-semicolon-after-character-reference");
self.reconsume_in(State::NumericCharacterReferenceEnd);
}
}
}
State::DecimalCharacterReference => {
let ch = self.consume_next();
match ch {
Char::ch(c) if c.is_ascii_digit() => {
self.character_reference_code *= 10;
if let Some(d) = self.current_character.to_digit(10) {
self.character_reference_code += d;
} else {
emit_error!("Can't convert current character to digit");
}
}
Char::ch(';') => {
self.switch_to(State::NumericCharacterReferenceEnd);
}
_ => {
emit_error!("missing-semicolon-after-character-reference");
self.reconsume_in(State::NumericCharacterReferenceEnd);
}
}
}
State::NumericCharacterReferenceEnd => {
let code = self.character_reference_code;
if code == 0x00 {
emit_error!("null-character-reference");
self.character_reference_code = 0xFFFD;
}
if code > 0x10FFFF {
emit_error!("character-reference-outside-unicode-range");
self.character_reference_code = 0xFFFD;
}
if is_surrogate(code) {
emit_error!("surrogate-character-reference");
self.character_reference_code = 0xFFFD;
}
if is_nonecharacter(code) {
emit_error!("noncharacter-character-reference");
}
if code == 0x0D || (is_control(code) && !is_whitespace(code)) {
emit_error!("control-character-reference");
if let Some(new_code) = replace_control_codes(code) {
self.character_reference_code = new_code;
}
}
let result = std::char::from_u32(self.character_reference_code)
.unwrap_or(REPLACEMENT_CHARACTER);
self.temp_buffer.clear();
self.temp_buffer.push(result);
self.flush_code_points_consumed_as_a_character_reference();
self.switch_to_return_state();
}
}
}
}
fn switch_to(&mut self, state: State) {
if is_trace() {
println!("Switch to: {:#?}", state);
}
self.state = state;
}
}
impl<T> Tokenizer<T>
where
T: Iterator<Item = char>,
{
pub fn new(input: T) -> Self {
Self {
input: CharInputStream::new(input),
output: VecDeque::new(),
current_character: '\0',
state: State::Data,
return_state: None,
current_token: None,
reconsume_char: false,
temp_buffer: String::new(),
last_emitted_start_tag: None,
character_reference_code: 0,
}
}
fn reconsume_in_return_state(&mut self) {
self.reconsume_in(self.return_state.clone().unwrap());
}
fn switch_to_return_state(&mut self) {
self.switch_to(self.return_state.clone().unwrap());
}
fn new_attribute(&mut self, attribute: Attribute) {
let token = self.current_token.as_mut().unwrap();
if let Token::Tag {
ref mut attributes, ..
} = token
{
attributes.push(attribute);
}
}
fn flush_code_points_consumed_as_a_character_reference(&mut self) {
if self.is_character_part_of_attribute() {
let chars: Vec<char> = self.temp_buffer.chars().collect();
for c in chars {
self.append_character_to_attribute_value(c);
}
} else {
self.emit_temp_buffer();
}
}
fn is_character_part_of_attribute(&self) -> bool {
if let Some(return_state) = &self.return_state {
return match return_state {
State::AttributeValueDoubleQuoted => true,
State::AttributeValueSingleQuoted => true,
State::AttributeValueUnQuoted => true,
_ => false,
};
}
emit_error!("No return state found");
false
}
fn emit_temp_buffer(&mut self) {
for c in self.temp_buffer.chars() {
self.output.push_back(Token::Character(c));
}
}
fn append_character_to_doctype_name(&mut self, ch: char) {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE { ref mut name, .. } = token {
let name = name.as_mut().unwrap();
name.push(ch);
}
}
fn append_character_to_doctype_public_identifier(&mut self, ch: char) {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut public_identifier,
..
} = token
{
let public_identifier = public_identifier.as_mut().unwrap();
public_identifier.push(ch);
}
}
fn append_character_to_doctype_system_identifier(&mut self, ch: char) {
let token = self.current_token.as_mut().unwrap();
if let Token::DOCTYPE {
ref mut system_identifier,
..
} = token
{
let system_identifier = system_identifier.as_mut().unwrap();
system_identifier.push(ch);
}
}
fn append_character_to_tag_name(&mut self, ch: char) {
// better crash that hang process
let current_tag = self.current_token.as_mut().unwrap();
if let Token::Tag { tag_name, .. } = current_tag {
tag_name.push(ch);
} else {
// hope that this never fire
emit_error!("No tag found");
}
}
fn append_character_to_token_data(&mut self, ch: char) {
let current_tag = self.current_token.as_mut().unwrap();
if let Token::Comment(ref mut data) = current_tag {
data.push(ch);
} else {
// hope that this never fire
emit_error!("No tag found");
}
}
fn append_character_to_attribute_name(&mut self, ch: char) {
let current_tag = self.current_token.as_mut().unwrap();
if let Token::Tag {
ref mut attributes, ..
} = current_tag
{
let attribute = attributes.last_mut().unwrap();
attribute.name.push(ch);
}
}
fn append_character_to_attribute_value(&mut self, ch: char) {
let current_tag = self.current_token.as_mut().unwrap();
if let Token::Tag {
ref mut attributes, ..
} = current_tag
{
let attribute = attributes.last_mut().unwrap();
attribute.value.push(ch);
}
}
fn emit_current_token(&mut self) -> Token {
self.will_emit(self.current_token.clone().unwrap());
self.pop_token()
}
fn emit_char(&mut self, ch: char) -> Token {
self.new_token(Token::Character(ch));
self.emit_current_token()
}
fn emit_current_char(&mut self) -> Token {
self.emit_char(self.current_character)
}
fn emit_eof(&mut self) -> Token {
self.new_token(Token::EOF);
self.emit_current_token()
}
fn new_token(&mut self, token: Token) {
self.current_token = Some(token);
}
fn will_emit(&mut self, token: Token) {
let mut token = token;
if let Token::Tag {
is_end_tag,
ref mut attributes,
..
} = token
{
let mut seen = HashSet::new();
let mut remove_indexes = Vec::new();
for (index, attribute) in attributes.iter().enumerate() {
if seen.contains(&attribute.name) {
emit_error!("duplicate-attribute");
remove_indexes.push(index);
} else {
seen.insert(attribute.name.clone());
}
}
for index in remove_indexes {
attributes.remove(index);
}
if !is_end_tag {
self.last_emitted_start_tag = Some(token.clone());
}
}
self.output.push_back(token);
}
fn is_end_tag_appropriate(&mut self) -> bool {
if self.last_emitted_start_tag.is_none() {
return false;
}
let current_tag = self.current_token.as_ref().unwrap();
let last_start_tag = self.last_emitted_start_tag.as_ref().unwrap();
if let Token::Tag { tag_name, .. } = current_tag {
let current_tag_name = tag_name;
if let Token::Tag { tag_name, .. } = last_start_tag {
let last_tag_name = tag_name;
return current_tag_name == last_tag_name;
}
}
false
}
fn pop_token(&mut self) -> Token {
self.output.pop_front().unwrap()
}
fn reconsume_in(&mut self, state: State) {
self.reconsume_char = true;
self.switch_to(state);
}
fn consume_if_match(&mut self, pattern: &str, case_insensitive: bool) -> bool {
let mut current_str = self.input.peek_max().iter().collect::<String>();
let mut pattern = pattern.to_owned();
if case_insensitive {
current_str = current_str.to_ascii_lowercase();
pattern = pattern.to_ascii_lowercase();
}
if current_str.starts_with(&pattern) {
for _ in 0..pattern.len() {
self.consume_next();
}
return true;
}
false
}
fn consume_from_current_if_match(&mut self, pattern: &str, case_insensitive: bool) -> bool {
let mut current_str = format!(
"{}{}",
self.current_character,
self.input.peek_max().iter().collect::<String>()
);
let mut pattern = pattern.to_owned();
if case_insensitive {
current_str = current_str.to_ascii_lowercase();
pattern = pattern.to_ascii_lowercase();
}
if current_str.starts_with(&pattern) {
for _ in 0..pattern.len() {
self.consume_next();
}
return true;
}
false
}
fn consume_next(&mut self) -> Char {
let ch = if self.reconsume_char {
// reset reconsume flag
self.reconsume_char = false;
Some(self.current_character)
} else {
self.input.next()
};
match ch {
Some(c) => {
self.current_character = c;
match c {
'\0' => Char::null,
'\t' | '\n' | '\x0C' | ' ' => Char::whitespace,
_ => Char::ch(c),
}
}
None => Char::eof,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn parse_comment() {
let html = "<!--xin chao-->";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Comment("xin chao".to_owned()),
tokenizer.next_token()
);
}
#[test]
fn parse_tag() {
let html = "<html>";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "html".to_owned(),
self_closing: false,
self_closing_acknowledged: false,
attributes: Vec::new(),
is_end_tag: false
},
tokenizer.next_token()
);
}
#[test]
fn parse_tag_self_closing() {
let html = "<div />";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: true,
self_closing_acknowledged: false,
attributes: Vec::new(),
is_end_tag: false
},
tokenizer.next_token()
);
}
#[test]
fn parse_tag_attribute_double_quote() {
let html = "<div name=\"hello\" />";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: true,
self_closing_acknowledged: false,
attributes: vec![Attribute {
name: "name".to_owned(),
value: "hello".to_owned(),
prefix: "".to_owned(),
namespace: "".to_owned()
}],
is_end_tag: false
},
tokenizer.next_token()
);
}
#[test]
fn parse_tag_attribute_single_quote() {
let html = "<div name='hello' />";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: true,
self_closing_acknowledged: false,
attributes: vec![Attribute {
name: "name".to_owned(),
value: "hello".to_owned(),
prefix: "".to_owned(),
namespace: "".to_owned()
}],
is_end_tag: false
},
tokenizer.next_token()
);
}
#[test]
fn parse_tag_attribute_unquote() {
let html = "<div name=hello world />";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: true,
self_closing_acknowledged: false,
attributes: vec![
Attribute {
name: "name".to_owned(),
value: "hello".to_owned(),
prefix: "".to_owned(),
namespace: "".to_owned()
},
Attribute {
name: "world".to_owned(),
value: "".to_owned(),
prefix: "".to_owned(),
namespace: "".to_owned()
}
],
is_end_tag: false
},
tokenizer.next_token()
);
}
#[test]
fn parse_doctype() {
let html = "<!DOCTYPE html>";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::DOCTYPE {
name: Some("html".to_owned()),
force_quirks: false,
public_identifier: None,
system_identifier: None
},
tokenizer.next_token()
);
}
#[test]
fn parse_doctype_with_identifiers() {
let html = r#"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">"#;
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::DOCTYPE {
name: Some("html".to_owned()),
force_quirks: false,
public_identifier: Some("-//W3C//DTD HTML 4.01 Transitional//EN".to_owned()),
system_identifier: Some("http://www.w3.org/TR/html4/loose.dtd".to_owned())
},
tokenizer.next_token()
);
}
#[test]
fn parse_decimal_character_reference() {
let html = "^";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(Token::Character('^'), tokenizer.next_token());
}
#[test]
fn parse_hex_character_reference() {
let html = "@";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(Token::Character('@'), tokenizer.next_token());
}
#[test]
fn parse_named_character_reference() {
let html = "Æ";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(Token::Character('Æ'), tokenizer.next_token());
}
#[test]
fn parse_invalid_named_character_reference() {
let html = "&g;";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(Token::Character('&'), tokenizer.next_token());
}
#[test]
fn parse_named_character_reference_in_string() {
let html = "I'm ¬it;";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(Token::Character('I'), tokenizer.next_token());
assert_eq!(Token::Character('\''), tokenizer.next_token());
assert_eq!(Token::Character('m'), tokenizer.next_token());
assert_eq!(Token::Character(' '), tokenizer.next_token());
assert_eq!(Token::Character('¬'), tokenizer.next_token());
assert_eq!(Token::Character('i'), tokenizer.next_token());
assert_eq!(Token::Character('t'), tokenizer.next_token());
assert_eq!(Token::Character(';'), tokenizer.next_token());
}
#[test]
fn parse_named_character_reference_in_attribute_name() {
let html = "<br █=\"name\" />";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "br".to_owned(),
self_closing: true,
is_end_tag: false,
self_closing_acknowledged: false,
attributes: vec![Attribute {
name: "█".to_owned(),
value: "name".to_owned(),
prefix: "".to_owned(),
namespace: "".to_owned()
}]
},
tokenizer.next_token()
);
}
#[test]
fn parse_named_character_reference_in_attribute_value() {
let html = "<br name=\"█\" />";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "br".to_owned(),
self_closing: true,
is_end_tag: false,
self_closing_acknowledged: false,
attributes: vec![Attribute {
name: "name".to_owned(),
value: "█".to_owned(),
prefix: "".to_owned(),
namespace: "".to_owned()
}]
},
tokenizer.next_token()
);
}
#[test]
fn parse_duplicate_attribute() {
let html = "<div attr attr />";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: true,
is_end_tag: false,
self_closing_acknowledged: false,
attributes: vec![Attribute {
name: "attr".to_owned(),
value: "".to_owned(),
prefix: "".to_owned(),
namespace: "".to_owned()
}]
},
tokenizer.next_token()
);
}
#[test]
fn tokenize_mutliple() {
let html = "<div><div></div><div></div></div>";
let mut tokenizer = Tokenizer::new(html.chars());
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: false,
is_end_tag: false,
self_closing_acknowledged: false,
attributes: vec![]
},
tokenizer.next_token()
);
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: false,
is_end_tag: false,
self_closing_acknowledged: false,
attributes: vec![]
},
tokenizer.next_token()
);
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: false,
is_end_tag: true,
self_closing_acknowledged: false,
attributes: vec![]
},
tokenizer.next_token()
);
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: false,
is_end_tag: false,
self_closing_acknowledged: false,
attributes: vec![]
},
tokenizer.next_token()
);
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: false,
is_end_tag: true,
self_closing_acknowledged: false,
attributes: vec![]
},
tokenizer.next_token()
);
assert_eq!(
Token::Tag {
tag_name: "div".to_owned(),
self_closing: false,
is_end_tag: true,
self_closing_acknowledged: false,
attributes: vec![]
},
tokenizer.next_token()
);
}
}
| 43.177069
| 127
| 0.371023
|
c63de056b313d10bed3db36f0b31ebffddf5782c
| 451
|
rb
|
Ruby
|
lib/monkey/types/return_value_type.rb
|
awcrotwell/monkey
|
0387dc0cef578064e377f7a796d8fae2ad7adb0a
|
[
"MIT"
] | null | null | null |
lib/monkey/types/return_value_type.rb
|
awcrotwell/monkey
|
0387dc0cef578064e377f7a796d8fae2ad7adb0a
|
[
"MIT"
] | null | null | null |
lib/monkey/types/return_value_type.rb
|
awcrotwell/monkey
|
0387dc0cef578064e377f7a796d8fae2ad7adb0a
|
[
"MIT"
] | null | null | null |
# typed: strict
# frozen_string_literal: true
module Monkey
class ReturnValueType
extend T::Sig
include ObjectType
sig { returns(ObjectType) }
attr_reader :value
sig { params(value: ObjectType).void }
def initialize(value)
@value = value
end
sig { override.returns(String) }
def type
RETURN_VALUE_TYPE
end
sig { override.returns(String) }
def to_s
@value.to_s
end
end
end
| 16.107143
| 42
| 0.643016
|
7bfa4757f6bc63cc5625b6fd0d9ef1b0bb824b29
| 2,830
|
cc
|
C++
|
src/main/bandlog.cc
|
bandprotocol/bandprotocol
|
4a5861d14dba6a69af0e7ce9fc142beb9315dcb4
|
[
"Apache-2.0"
] | 2
|
2020-02-13T17:50:46.000Z
|
2020-07-21T15:18:14.000Z
|
src/main/bandlog.cc
|
bandprotocol/bandchain-legacy
|
4a5861d14dba6a69af0e7ce9fc142beb9315dcb4
|
[
"Apache-2.0"
] | null | null | null |
src/main/bandlog.cc
|
bandprotocol/bandchain-legacy
|
4a5861d14dba6a69af0e7ce9fc142beb9315dcb4
|
[
"Apache-2.0"
] | null | null | null |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the LICENSE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include "listener/logging.h"
#include "listener/manager.h"
#include "listener/primary.h"
#include "net/server.h"
#include "net/tmapp.h"
#include "store/storage.h"
#include "store/storage_map.h"
#include "util/cli.h"
class BandLoggingApplication : public TendermintApplication
{
public:
BandLoggingApplication(ListenerManager& _manager)
: manager(_manager)
{
}
std::string get_name() const final
{
return "band-logging";
}
std::string get_version() const final
{
return "n/a";
}
std::string get_current_app_hash() const final
{
return "";
}
void init(const std::vector<std::pair<VerifyKey, uint64_t>>& _validators,
const std::string& init_state) final
{
manager.initChain(gsl::as_bytes(gsl::make_span(init_state)));
}
std::string query(const std::string& path, const std::string& data) final
{
return ListenerManager::abi();
}
void check(const std::string& msg_raw) final
{
manager.checkTransaction(gsl::as_bytes(gsl::make_span(msg_raw)));
}
std::string apply(const std::string& msg_raw) final
{
return manager.applyTransaction(gsl::as_bytes(gsl::make_span(msg_raw)));
}
void begin_block(uint64_t block_time, const Address& block_proposer) final
{
manager.beginBlock(block_time, block_proposer);
}
std::vector<std::pair<VerifyKey, uint64_t>> end_block() final
{
manager.endBlock();
return {};
}
void commit_block() final
{
manager.commitBlock();
}
private:
ListenerManager& manager;
};
CmdArg<int> port("p,port", "the port on which tmapp connects", "26658");
int main(int argc, char* argv[])
{
Cmd cmd("Band ACBI application", argc, argv);
boost::asio::io_service service;
ListenerManager manager;
StorageMap storage;
manager.setPrimary(std::make_unique<PrimaryListener>(storage));
manager.addListener(std::make_unique<LoggingListener>());
BandLoggingApplication app(manager);
Server server(service, app, +port);
server.start();
service.run();
return 0;
}
| 25.267857
| 76
| 0.711661
|
46d051486212e868bbb8334744d8bacf3ba667b7
| 1,117
|
py
|
Python
|
examples/beta_GeTe.py
|
dquigley-warwick/PyGeTe
|
5afe22b00ee769541b7fd2051543b196ce043e3c
|
[
"CC0-1.0"
] | null | null | null |
examples/beta_GeTe.py
|
dquigley-warwick/PyGeTe
|
5afe22b00ee769541b7fd2051543b196ce043e3c
|
[
"CC0-1.0"
] | null | null | null |
examples/beta_GeTe.py
|
dquigley-warwick/PyGeTe
|
5afe22b00ee769541b7fd2051543b196ce043e3c
|
[
"CC0-1.0"
] | null | null | null |
import numpy as np
import ase.spacegroup as spg
import PyGeTe as en
###########################################
# Create the beta GeTe structure with ASE #
###########################################
LAT = 6.009 # Lattice constant
n = 4 # Repeats
betaGeTe = spg.crystal(["Ge", "Te"], [(0.0, 0.0, 0.0), (0.5, 0.5, 0.5)],
spacegroup=225, cellpar=[LAT, LAT, LAT, 90, 90, 90],
size=(n, n, n))
###########################################
# Calculate energy per atom with PyGeTe #
###########################################
# Set species
betaGeTeSpecies = [en.symdict[s] for s in betaGeTe.get_chemical_symbols()]
# Make sure initial neighbour list is up to date
en.compute_neighbour_list(betaGeTe.positions,
betaGeTe.get_cell(), betaGeTeSpecies)
# Compute initial energy
total_energy = en.compute_model_energy(betaGeTe.positions,
betaGeTe.get_cell(), betaGeTeSpecies)
print("Energy per atom = %.3f eV" %(total_energy/betaGeTe.get_global_number_of_atoms()))
| 34.90625
| 88
| 0.515667
|
2e3258fac6b152aaa4ba8eb6a44d0d9fd1ff7d81
| 3,819
|
dart
|
Dart
|
lib/routes/animation_switcher.dart
|
404nofound/Flutter-Github
|
f48b7b9d25e2a14d8eff76af5d8bc003523112c8
|
[
"Apache-2.0"
] | 3
|
2019-09-30T04:30:08.000Z
|
2019-11-26T01:46:09.000Z
|
first_app/lib/routes/animation_switcher.dart
|
silence0201/Flutter-Demo
|
da6008fd23cad8ca9ed554227fb2dcab87c7d952
|
[
"MIT"
] | null | null | null |
first_app/lib/routes/animation_switcher.dart
|
silence0201/Flutter-Demo
|
da6008fd23cad8ca9ed554227fb2dcab87c7d952
|
[
"MIT"
] | null | null | null |
import 'package:flutter/material.dart';
class AnimatedSwitcherRoute extends StatefulWidget {
@override
_AnimatedSwitcherRouteState createState() => _AnimatedSwitcherRouteState();
}
class _AnimatedSwitcherRouteState extends State<AnimatedSwitcherRoute> {
int _count = 0;
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: <Widget>[
AnimatedSwitcher(
duration: Duration(milliseconds: 600),
transitionBuilder: (Widget child, Animation<double> animation) {
// 旧页面屏幕中向左侧平移退出,新页面重屏幕右侧平移进入
// var tween = Tween<Offset>(begin: Offset(1, 0), end: Offset(0, 0));
// return MySlideTransition(
// child: child,
// position: tween.animate(animation),
// );
return SlideTransitionX(
child: child,
direction: AxisDirection.down,
position: animation,
);
},
child: Text(
"$_count",
key: ValueKey<int>(_count),
textScaleFactor: 3,
),
),
RaisedButton(
child: const Text('Increment',),
onPressed: () {
setState(() {
_count += 1;
});
},
),
],
),
);
}
}
// ignore: must_be_immutable
class MySlideTransition extends AnimatedWidget {
MySlideTransition({
Key key,
@required Animation<Offset> position,
this.transformHitTests = true,
this.child,
}) : assert(position != null),
super(key: key, listenable: position);
Animation<Offset> get position => listenable;
final bool transformHitTests;
final Widget child;
@override
Widget build(BuildContext context) {
Offset offset = position.value;
if (position.status == AnimationStatus.reverse) {
offset = Offset(-offset.dx, offset.dy);
}
return FractionalTranslation(
translation: offset,
transformHitTests: transformHitTests,
child: child,
);
}
}
// ignore: must_be_immutable
class SlideTransitionX extends AnimatedWidget {
SlideTransitionX({
Key key,
@required Animation<double> position,
this.transformHitTests = true,
this.direction = AxisDirection.down,
this.child,
})
: assert(position != null),
super(key: key, listenable: position) {
switch (direction) {
case AxisDirection.up:
_tween = Tween(begin: Offset(0, 1), end: Offset(0, 0));
break;
case AxisDirection.right:
_tween = Tween(begin: Offset(-1, 0), end: Offset(0, 0));
break;
case AxisDirection.down:
_tween = Tween(begin: Offset(0, -1), end: Offset(0, 0));
break;
case AxisDirection.left:
_tween = Tween(begin: Offset(1, 0), end: Offset(0, 0));
break;
}
}
Animation<double> get position => listenable;
final bool transformHitTests;
final Widget child;
final AxisDirection direction;
Tween<Offset> _tween;
@override
Widget build(BuildContext context) {
Offset offset = _tween.evaluate(position);
if (position.status == AnimationStatus.reverse) {
switch (direction) {
case AxisDirection.up:
offset = Offset(offset.dx, -offset.dy);
break;
case AxisDirection.right:
offset = Offset(-offset.dx, offset.dy);
break;
case AxisDirection.down:
offset = Offset(offset.dx, -offset.dy);
break;
case AxisDirection.left:
offset = Offset(-offset.dx, offset.dy);
break;
}
}
return FractionalTranslation(
translation: offset,
transformHitTests: transformHitTests,
child: child,
);
}
}
| 26.157534
| 80
| 0.588898
|
b021aba85a5df9c794c09c6a6412ed361f4eca26
| 2,400
|
py
|
Python
|
pyTorch_app/flask_app/flask_mobility/tests/test_decorators.py
|
Takkoyanagi/insight_computer_vision
|
9c5f2a06ec924e101c0554635bf5bf49b27bb9eb
|
[
"MIT"
] | null | null | null |
pyTorch_app/flask_app/flask_mobility/tests/test_decorators.py
|
Takkoyanagi/insight_computer_vision
|
9c5f2a06ec924e101c0554635bf5bf49b27bb9eb
|
[
"MIT"
] | null | null | null |
pyTorch_app/flask_app/flask_mobility/tests/test_decorators.py
|
Takkoyanagi/insight_computer_vision
|
9c5f2a06ec924e101c0554635bf5bf49b27bb9eb
|
[
"MIT"
] | null | null | null |
import unittest
from flask import Flask, render_template_string
from flask.ext.mobility import Mobility
from flask.ext.mobility.decorators import mobile_template, mobilized
class DecoratorsTestCase(unittest.TestCase):
def setUp(self):
app = Flask(__name__)
Mobility(app)
@app.route('/')
@mobile_template('{mobile/}template.html')
def index(template):
return render_template_string(template)
# Default View
def mobilize():
return render_template_string('False')
# Mobilized view
@app.route('/mobilize')
@mobilized(mobilize)
def mobilize():
return render_template_string('True')
self.app = app
self.client = app.test_client()
def test_mobile_template_user_agent(self):
"""Test the mobile_template decorator"""
# Check without mobile User-Agent header
assert b'template.html' == self.client.get('/').data
# Check with mobile User-Agent header
headers = [('User-Agent', 'android')]
response = self.client.get('/', headers=headers)
assert b'mobile/template.html' == response.data
def test_mobile_template_cookie(self):
assert b'template.html' == self.client.get('/').data
MOBILE_COOKIE = self.app.config.get('MOBILE_COOKIE')
self.client.set_cookie('localhost', MOBILE_COOKIE, 'on')
assert b'mobile/template.html' == self.client.get('/').data
self.client.set_cookie('localhost', MOBILE_COOKIE, 'off')
assert b'template.html' == self.client.get('/').data
def test_mobilized_user_agent(self):
"""Test the mobilized decorator"""
# Check without mobile User-Agent header
assert b'False' == self.client.get('/mobilize').data
# Check with mobile User-Agent header
headers = [('User-Agent', 'android')]
assert b'True' == self.client.get('/mobilize', headers=headers).data
def test_mobilized_cookie(self):
assert b'False' == self.client.get('/mobilize').data
MOBILE_COOKIE = self.app.config.get('MOBILE_COOKIE')
self.client.set_cookie('localhost', MOBILE_COOKIE, 'on')
assert b'True' == self.client.get('/mobilize').data
self.client.set_cookie('localhost', MOBILE_COOKIE, 'off')
assert b'False' == self.client.get('/mobilize').data
| 32.432432
| 76
| 0.641667
|
6ff5cd185743dd39d0ff7532bc3c8f798b145987
| 342
|
dart
|
Dart
|
newsprovider_app/lib/src/news/data/remote/server/news_provider.dart
|
woowrale/flutter-labs
|
ece3c2c3f2523f6fa2fbc87a08a1c80898aecb61
|
[
"MIT"
] | null | null | null |
newsprovider_app/lib/src/news/data/remote/server/news_provider.dart
|
woowrale/flutter-labs
|
ece3c2c3f2523f6fa2fbc87a08a1c80898aecb61
|
[
"MIT"
] | null | null | null |
newsprovider_app/lib/src/news/data/remote/server/news_provider.dart
|
woowrale/flutter-labs
|
ece3c2c3f2523f6fa2fbc87a08a1c80898aecb61
|
[
"MIT"
] | null | null | null |
import 'package:newsprovider_app/src/news/data/remote/models/news_response.dart';
import 'package:newsprovider_app/src/news/data/remote/server/api_news.dart';
class NewsProvider implements ApiNews {
List<Article>headLines = [];
@override
getTopHeadLines() {
// TODO: implement getHeadLines
throw UnimplementedError();
}
}
| 22.8
| 81
| 0.754386
|
4f32bfe76942d3431ee872f9b39ba426c49b7ad2
| 192
|
rb
|
Ruby
|
db/migrate/20190715214412_add_mqtt_throttle_email_sent_at_to_device.rb
|
EarthEngineering/Facetop-Web-App
|
d0bf9808a89b8a9df625abbfe3ebf04841f67286
|
[
"MIT"
] | 493
|
2017-07-13T05:14:07.000Z
|
2022-03-13T21:04:34.000Z
|
db/migrate/20190715214412_add_mqtt_throttle_email_sent_at_to_device.rb
|
EarthEngineering/Facetop-Web-App
|
d0bf9808a89b8a9df625abbfe3ebf04841f67286
|
[
"MIT"
] | 1,752
|
2017-07-06T14:56:37.000Z
|
2022-03-21T16:17:22.000Z
|
db/migrate/20190715214412_add_mqtt_throttle_email_sent_at_to_device.rb
|
EarthEngineering/Facetop-Web-App
|
d0bf9808a89b8a9df625abbfe3ebf04841f67286
|
[
"MIT"
] | 231
|
2017-07-19T20:09:47.000Z
|
2022-03-11T07:05:28.000Z
|
class AddMqttThrottleEmailSentAtToDevice < ActiveRecord::Migration[5.2]
def change
add_column :devices,
:mqtt_rate_limit_email_sent_at,
:datetime
end
end
| 24
| 71
| 0.682292
|
4f1a330f298cc23e4def8b8e101a29d084948873
| 2,934
|
sql
|
SQL
|
minkspay_demo.sql
|
suvozit/minkspay-demo
|
448f4f5a3ea8d4c525410262a98e801c207f4a96
|
[
"MIT"
] | null | null | null |
minkspay_demo.sql
|
suvozit/minkspay-demo
|
448f4f5a3ea8d4c525410262a98e801c207f4a96
|
[
"MIT"
] | null | null | null |
minkspay_demo.sql
|
suvozit/minkspay-demo
|
448f4f5a3ea8d4c525410262a98e801c207f4a96
|
[
"MIT"
] | null | null | null |
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Aug 28, 2019 at 11:04 PM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.3.8
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: `minkspay_demo`
--
-- --------------------------------------------------------
--
-- Table structure for table `ci_sessions`
--
CREATE TABLE `ci_sessions` (
`id` varchar(128) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) UNSIGNED NOT NULL DEFAULT 0,
`data` blob NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `login_history`
--
CREATE TABLE `login_history` (
`user_id` int(11) NOT NULL,
`medium` varchar(8) NOT NULL,
`user_agent` varchar(150) NOT NULL,
`ip` varchar(40) NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(256) NOT NULL,
`password` varchar(50) NOT NULL,
`age` int(11) NOT NULL,
`gender` varchar(8) NOT NULL,
`location` varchar(100) NOT NULL,
`facebook_id` varchar(100) DEFAULT NULL,
`google_id` varchar(100) DEFAULT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`modified` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `ci_sessions`
--
ALTER TABLE `ci_sessions`
ADD PRIMARY KEY (`id`),
ADD KEY `ci_sessions_timestamp` (`timestamp`);
--
-- Indexes for table `login_history`
--
ALTER TABLE `login_history`
ADD KEY `user_id` (`user_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `login_history`
--
ALTER TABLE `login_history`
ADD CONSTRAINT `login_history_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;
| 24.45
| 131
| 0.669393
|
a3b52c343a2d949e8f691c38acc4695d12c716da
| 2,752
|
kt
|
Kotlin
|
src/lesson12/task1/OpenHashSet.kt
|
httpsKitty/KotlinAsFirst2021
|
50548f298f6a0ae90ada4e88c4a9e005aabdf1a2
|
[
"CC0-1.0"
] | null | null | null |
src/lesson12/task1/OpenHashSet.kt
|
httpsKitty/KotlinAsFirst2021
|
50548f298f6a0ae90ada4e88c4a9e005aabdf1a2
|
[
"CC0-1.0"
] | null | null | null |
src/lesson12/task1/OpenHashSet.kt
|
httpsKitty/KotlinAsFirst2021
|
50548f298f6a0ae90ada4e88c4a9e005aabdf1a2
|
[
"CC0-1.0"
] | null | null | null |
@file:Suppress("UNUSED_PARAMETER")
package lesson12.task1
/**
* Класс "хеш-таблица с открытой адресацией"
*
* Общая сложность задания -- сложная, общая ценность в баллах -- 20.
* Объект класса хранит данные типа T в виде хеш-таблицы.
* Хеш-таблица не может содержать равные по equals элементы.
* Подробности по организации см. статью википедии "Хеш-таблица", раздел "Открытая адресация".
* Методы: добавление элемента, проверка вхождения элемента, сравнение двух таблиц на равенство.
* В этом задании не разрешается использовать библиотечные классы HashSet, HashMap и им подобные,
* а также любые функции, создающие множества (mutableSetOf и пр.).
*
* В конструктор хеш-таблицы передаётся её вместимость (максимальное количество элементов)
*/
class OpenHashSet<T>(val capacity: Int) {
/**
* Массив для хранения элементов хеш-таблицы
*/
internal val elements = Array<Any?>(capacity) { null }
/**
* Число элементов в хеш-таблице
*/
private var sizeImpl = 0
val size: Int
get() = sizeImpl
/**
* Признак пустоты
*/
fun isEmpty(): Boolean = size == 0
/**
* Добавление элемента.
* Вернуть true, если элемент был успешно добавлен,
* или false, если такой элемент уже был в таблице, или превышена вместимость таблицы.
*/
fun add(element: T): Boolean {
if (size == capacity) return false
var index = element.hashCode() % capacity
if (elements[index] == element) return false
while (elements[index] != null) index = (index + 1) % capacity
elements[index] = element
sizeImpl++
return true
}
/**
* Проверка, входит ли заданный элемент в хеш-таблицу
*/
operator fun contains(element: T) = containsObject(element)
private fun containsObject(any: Any?): Boolean {
val startIndex = any.hashCode() % capacity
if (elements[startIndex] == any) return true
var index = (startIndex + 1) % capacity
while (any != elements[index] && index != startIndex) index = (index + 1) % capacity
return index != startIndex
}
/**
* Таблицы равны, если в них одинаковое количество элементов,
* и любой элемент из второй таблицы входит также и в первую
*/
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as OpenHashSet<*>
if (size != other.size) return false
for (otherElement in other.elements) {
if (otherElement != null && !this.containsObject(otherElement)) return false
}
return true
}
override fun hashCode(): Int = elements.sumOf { it?.hashCode() ?: 0}
}
| 32
| 97
| 0.644985
|
46d8c643ef9ecaa23bfbd75e161952100e75aa81
| 358
|
py
|
Python
|
tests/farm/annotate/run_encodings.py
|
blueyed/coveragepy-bbmirror
|
fec75c18a87e8acf8a0d4f978b2ef4e1cea755de
|
[
"Apache-2.0"
] | null | null | null |
tests/farm/annotate/run_encodings.py
|
blueyed/coveragepy-bbmirror
|
fec75c18a87e8acf8a0d4f978b2ef4e1cea755de
|
[
"Apache-2.0"
] | null | null | null |
tests/farm/annotate/run_encodings.py
|
blueyed/coveragepy-bbmirror
|
fec75c18a87e8acf8a0d4f978b2ef4e1cea755de
|
[
"Apache-2.0"
] | 2
|
2018-02-27T08:56:41.000Z
|
2020-12-22T22:10:38.000Z
|
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
copy("src", "out_encodings")
run("""
coverage run utf8.py
coverage annotate utf8.py
""", rundir="out_encodings")
compare("out_encodings", "gold_encodings", "*,cover")
clean("out_encodings")
| 32.545455
| 79
| 0.723464
|
a19c7898e6e247a52fb663d806b10f27edcdc80b
| 1,562
|
ts
|
TypeScript
|
src/layouts/PageTranslator/PageTranslator.utils/PageTranslationStorage.ts
|
vitonsky/linguist
|
f2ee9b13eb1b5c0df3ae22ae510a3f7c8ee84944
|
[
"BSD-3-Clause"
] | 21
|
2021-11-29T22:01:56.000Z
|
2022-03-27T04:03:15.000Z
|
src/layouts/PageTranslator/PageTranslator.utils/PageTranslationStorage.ts
|
translate-tools/linguist
|
f2ee9b13eb1b5c0df3ae22ae510a3f7c8ee84944
|
[
"BSD-3-Clause"
] | 83
|
2021-06-22T17:43:24.000Z
|
2022-03-25T23:55:34.000Z
|
src/layouts/PageTranslator/PageTranslator.utils/PageTranslationStorage.ts
|
vitonsky/linguist
|
f2ee9b13eb1b5c0df3ae22ae510a3f7c8ee84944
|
[
"BSD-3-Clause"
] | null | null | null |
import { TypeOf } from 'io-ts';
import { browser } from 'webextension-polyfill-ts';
import { tryDecode, type } from '../../../lib/types';
import { AbstractVersionedStorage } from '../../../types/utils';
export class PageTranslationStorage extends AbstractVersionedStorage {
static storageVersion = 1;
public static readonly storeName = 'PageTranslationStorage';
public static readonly storageSignature = type.type({
optionsSpoilerState: type.boolean,
});
/**
* Default data
*/
public static readonly defaultData: TypeOf<
typeof PageTranslationStorage.storageSignature
> = {
optionsSpoilerState: false,
};
public static getData = async () => {
const storeName = PageTranslationStorage.storeName;
const { [storeName]: tabData } = await browser.storage.local.get(storeName);
if (tabData !== undefined) {
return tryDecode(PageTranslationStorage.storageSignature, tabData);
} else {
return PageTranslationStorage.defaultData;
}
};
private static setData = async (
data: TypeOf<typeof PageTranslationStorage.storageSignature>,
) => {
// Verify data
tryDecode(PageTranslationStorage.storageSignature, data);
const storeName = PageTranslationStorage.storeName;
await browser.storage.local.set({ [storeName]: data });
};
public static updateData = async (
data: Partial<TypeOf<typeof PageTranslationStorage.storageSignature>>,
) => {
const actualData = await PageTranslationStorage.getData();
const mergedData = Object.assign(actualData, data);
return PageTranslationStorage.setData(mergedData);
};
}
| 28.925926
| 78
| 0.739437
|
8e9fe7d97584e0bf17be4e98d9ca05b56baa3da8
| 1,163
|
js
|
JavaScript
|
2-intermediate/charity-finder/scripts/pagination.js
|
wksam/app-ideas
|
94cf0a7f69f940471877efd2a5e10bcda64490dc
|
[
"MIT"
] | 2
|
2020-06-05T18:46:02.000Z
|
2020-06-05T18:46:25.000Z
|
2-intermediate/charity-finder/scripts/pagination.js
|
wksam/app-ideas
|
94cf0a7f69f940471877efd2a5e10bcda64490dc
|
[
"MIT"
] | null | null | null |
2-intermediate/charity-finder/scripts/pagination.js
|
wksam/app-ideas
|
94cf0a7f69f940471877efd2a5e10bcda64490dc
|
[
"MIT"
] | null | null | null |
document.querySelector('a[aria-label=Previous]').addEventListener('click', previous);
document.querySelector('a[aria-label=Next]').addEventListener('click', next);
function previous() {
if(!api.hasPrevious) return;
const id = api.getPreviousId();
getOrganizations(id);
}
function next() {
if(!api.hasNext) return;
const id = api.getNextId();
api.addOrganization(id);
getOrganizations(id);
}
function updatePagination() {
document.querySelector('.pagination').hidden = false;
if(!api.hasNext) document.querySelector('a[aria-label=Next]').parentElement.classList.add('disabled');
else document.querySelector('a[aria-label=Next]').parentElement.classList.remove('disabled');
if(!api.hasPrevious) document.querySelector('a[aria-label=Previous]').parentElement.classList.add('disabled');
else document.querySelector('a[aria-label=Previous]').parentElement.classList.remove('disabled');
}
function disablePagination() {
document.querySelector('a[aria-label=Next]').parentElement.classList.add('disabled');
document.querySelector('a[aria-label=Previous]').parentElement.classList.add('disabled');
}
| 36.34375
| 114
| 0.728289
|
38a6558aabdffc9ff929be794d588aa41fe25c4b
| 987
|
php
|
PHP
|
src/Response/Directives/Display/Templates/Template.php
|
nanuc/alexa-app
|
427b989bff430f3c633d2e4d3b4649937d89de28
|
[
"MIT"
] | 86
|
2015-06-28T03:51:35.000Z
|
2019-05-27T18:56:03.000Z
|
src/Response/Directives/Display/Templates/Template.php
|
nanuc/alexa-app
|
427b989bff430f3c633d2e4d3b4649937d89de28
|
[
"MIT"
] | 54
|
2016-01-03T19:36:40.000Z
|
2019-11-29T14:08:28.000Z
|
src/Response/Directives/Display/Templates/Template.php
|
nanuc/alexa-app
|
427b989bff430f3c633d2e4d3b4649937d89de28
|
[
"MIT"
] | 51
|
2015-09-05T04:10:21.000Z
|
2019-08-15T02:44:45.000Z
|
<?php
namespace Develpr\AlexaApp\Response\Directives\Display\Templates;
abstract class Template
{
protected $type;
protected $token;
protected $backButton = true;
protected $title;
protected $textContent;
protected $backgroundImage;
protected $image;
public function setBackButton($backButton)
{
$this->backButton = $backButton;
return $this;
}
public function setToken($token)
{
$this->token = $token;
return $this;
}
public function setTitle($title)
{
$this->title = $title;
return $this;
}
public function setBackgroundImage($backgroundImage)
{
$this->backgroundImage = $backgroundImage;
return $this;
}
public function setImage($image)
{
$this->image = $image;
return $this;
}
public function setTextContent($textContent)
{
$this->textContent = $textContent;
return $this;
}
}
| 18.622642
| 65
| 0.601824
|
e77b744247db96ab57703de25fba022c90de46b0
| 1,975
|
php
|
PHP
|
tests/TestApplication/src/Entity/User.php
|
mrgoodbytes8667/EasyAdminBundle
|
b043fdcd971f0d0b2ee53ffba313c7414d448bb9
|
[
"MIT"
] | 2,129
|
2015-01-13T22:56:40.000Z
|
2022-01-18T19:55:01.000Z
|
tests/TestApplication/src/Entity/User.php
|
mrgoodbytes8667/EasyAdminBundle
|
b043fdcd971f0d0b2ee53ffba313c7414d448bb9
|
[
"MIT"
] | 2,643
|
2018-02-24T11:22:30.000Z
|
2022-03-31T10:44:02.000Z
|
tests/TestApplication/src/Entity/User.php
|
mrgoodbytes8667/EasyAdminBundle
|
b043fdcd971f0d0b2ee53ffba313c7414d448bb9
|
[
"MIT"
] | 770
|
2018-02-25T10:23:38.000Z
|
2022-03-30T09:59:05.000Z
|
<?php
namespace EasyCorp\Bundle\EasyAdminBundle\Tests\TestApplication\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="`user`")
*/
class User
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $email;
/**
* @ORM\OneToMany(targetEntity=BlogPost::class, mappedBy="author", orphanRemoval=true)
*/
private $blogPosts;
public function __construct()
{
$this->blogPosts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
/**
* @return Collection|BlogPost[]
*/
public function getBlogPosts(): Collection
{
return $this->blogPosts;
}
public function addBlogPost(BlogPost $blogPost): self
{
if (!$this->blogPosts->contains($blogPost)) {
$this->blogPosts[] = $blogPost;
$blogPost->setAuthor($this);
}
return $this;
}
public function removeBlogPost(BlogPost $blogPost): self
{
if ($this->blogPosts->removeElement($blogPost)) {
// set the owning side to null (unless already changed)
if ($blogPost->getAuthor() === $this) {
$blogPost->setAuthor(null);
}
}
return $this;
}
}
| 19.554455
| 90
| 0.557468
|
2e5b6500d442cfa9cc26512fab59ba2f8fedce91
| 2,509
|
kt
|
Kotlin
|
src/main/kotlin/cn/yiiguxing/plugin/translate/action/ChooseTranslatorAction.kt
|
niktrop/TranslationPlugin
|
b484e02d877e76040d9a3b7f47999b202d8e9cb6
|
[
"MIT"
] | null | null | null |
src/main/kotlin/cn/yiiguxing/plugin/translate/action/ChooseTranslatorAction.kt
|
niktrop/TranslationPlugin
|
b484e02d877e76040d9a3b7f47999b202d8e9cb6
|
[
"MIT"
] | 1
|
2021-02-17T15:14:30.000Z
|
2021-02-17T15:14:30.000Z
|
src/main/kotlin/cn/yiiguxing/plugin/translate/action/ChooseTranslatorAction.kt
|
niktrop/TranslationPlugin
|
b484e02d877e76040d9a3b7f47999b202d8e9cb6
|
[
"MIT"
] | 1
|
2020-10-06T19:13:43.000Z
|
2020-10-06T19:13:43.000Z
|
package cn.yiiguxing.plugin.translate.action
import cn.yiiguxing.plugin.translate.message
import cn.yiiguxing.plugin.translate.util.TranslateService
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.actionSystem.ex.ComboBoxAction
import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.ui.popup.JBPopup
import com.intellij.openapi.ui.popup.JBPopupFactory
import com.intellij.openapi.ui.popup.ListPopup
import com.intellij.openapi.util.Condition
import com.intellij.openapi.wm.ex.WindowManagerEx
import java.awt.Dimension
import javax.swing.JComponent
/**
* ChooseTranslatorAction
*/
class ChooseTranslatorAction : ComboBoxAction(), DumbAware {
init {
setPopupTitle(message("choose.translator.popup.title"))
isEnabledInModalContext = true
}
override fun update(e: AnActionEvent) {
TranslateService.translator.let {
e.presentation.text = it.name
e.presentation.icon = it.icon
}
}
override fun actionPerformed(e: AnActionEvent) {
WindowManagerEx.getInstanceEx()
.findFrameFor(e.project)
?.component
?.let { createActionPopup(message("choose.translator.popup.title"), e.dataContext, it).showInCenterOf(it) }
}
private fun createActionPopup(
title: String?,
context: DataContext,
component: JComponent,
disposeCallback: Runnable? = null
): ListPopup {
val group = createPopupActionGroup(component, context)
return JBPopupFactory
.getInstance()
.createActionGroupPopup(
title,
group,
context,
false,
shouldShowDisabledActions(),
false,
disposeCallback,
maxRows,
preselectCondition
)
.apply { setMinimumSize(Dimension(minWidth, minHeight)) }
}
override fun getPreselectCondition(): Condition<AnAction> = TranslatorAction.PRESELECT_CONDITION
override fun createPopupActionGroup(button: JComponent)
: DefaultActionGroup = DefaultActionGroup(TranslatorAction.ACTIONS)
override fun createComboBoxButton(presentation: Presentation): ComboBoxButton =
object : ComboBoxButton(presentation) {
override fun createPopup(onDispose: Runnable?): JBPopup {
return createActionPopup(null, dataContext, this, onDispose)
}
}
}
| 33.453333
| 119
| 0.669988
|
a0e5ba935feda485e4fef5127d5a71b0ed37d2a3
| 394
|
lua
|
Lua
|
cameratest/lua/catmullromcams/sh_gc_booster.lua
|
JessySztark/yume-dev
|
5982357c8eaa188a2b60f4bede23ecb591df0dde
|
[
"FSFAP"
] | null | null | null |
cameratest/lua/catmullromcams/sh_gc_booster.lua
|
JessySztark/yume-dev
|
5982357c8eaa188a2b60f4bede23ecb591df0dde
|
[
"FSFAP"
] | null | null | null |
cameratest/lua/catmullromcams/sh_gc_booster.lua
|
JessySztark/yume-dev
|
5982357c8eaa188a2b60f4bede23ecb591df0dde
|
[
"FSFAP"
] | null | null | null |
if CatmullRomCams.SH.GCStarted then return end
CatmullRomCams.SH.GCStarted = true
function CatmullRomCams.SH.GarbageCollectionBooster()
collectgarbage()
return timer.Simple(30, CatmullRomCams.SH.GarbageCollectionBooster)
end
timer.Simple(30, CatmullRomCams.SH.GarbageCollectionBooster) -- Now unneeded! :4chan: But reenabled beause it's not readily noticeable and it still helps. :wink:
| 32.833333
| 161
| 0.817259
|
759fb8e0366fae06e36e4e531b932f6b444d144c
| 643
|
swift
|
Swift
|
LucidDreams/ImageDrawable.swift
|
cntrump/LucidDreams
|
f20edb482ee52c19f02dfdf2a61ac8f3068c3585
|
[
"AML"
] | 2
|
2019-06-11T09:22:40.000Z
|
2020-03-17T21:16:17.000Z
|
LucidDreams/ImageDrawable.swift
|
cntrump/LucidDreams
|
f20edb482ee52c19f02dfdf2a61ac8f3068c3585
|
[
"AML"
] | null | null | null |
LucidDreams/ImageDrawable.swift
|
cntrump/LucidDreams
|
f20edb482ee52c19f02dfdf2a61ac8f3068c3585
|
[
"AML"
] | 2
|
2019-06-11T11:31:59.000Z
|
2020-03-17T21:16:18.000Z
|
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
Contains functionality to render a `UIImage` as a `Drawable`.
*/
import UIKit
/// Draws an image.
struct ImageDrawable: Layout, Drawable {
var image: UIImage
var frame: CGRect
mutating func layout(in rect: CGRect) {
frame = rect
}
func draw(in context: CGContext) {
UIGraphicsPushContext(context)
image.draw(in: frame)
UIGraphicsPopContext()
}
typealias Content = Drawable
var contents: [Content] {
return [self]
}
}
| 20.741935
| 65
| 0.634526
|
a56bdede00493fe93c88dac5551258d42fe43079
| 2,184
|
rs
|
Rust
|
stm32f4/src/stm32f412/fsmc.rs
|
dgoodlad/crabdac
|
9341949c83e4437dee55af80b4eb6ab0cac648b1
|
[
"MIT"
] | null | null | null |
stm32f4/src/stm32f412/fsmc.rs
|
dgoodlad/crabdac
|
9341949c83e4437dee55af80b4eb6ab0cac648b1
|
[
"MIT"
] | null | null | null |
stm32f4/src/stm32f412/fsmc.rs
|
dgoodlad/crabdac
|
9341949c83e4437dee55af80b4eb6ab0cac648b1
|
[
"MIT"
] | null | null | null |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - SRAM/NOR-Flash chip-select control register 1"]
pub bcr1: crate::Reg<bcr1::BCR1_SPEC>,
#[doc = "0x04 - SRAM/NOR-Flash chip-select timing register 1"]
pub btr1: crate::Reg<btr::BTR_SPEC>,
#[doc = "0x08 - SRAM/NOR-Flash chip-select control register 2"]
pub bcr2: crate::Reg<bcr::BCR_SPEC>,
#[doc = "0x0c - SRAM/NOR-Flash chip-select timing register 1"]
pub btr2: crate::Reg<btr::BTR_SPEC>,
#[doc = "0x10 - SRAM/NOR-Flash chip-select control register 2"]
pub bcr3: crate::Reg<bcr::BCR_SPEC>,
#[doc = "0x14 - SRAM/NOR-Flash chip-select timing register 1"]
pub btr3: crate::Reg<btr::BTR_SPEC>,
#[doc = "0x18 - SRAM/NOR-Flash chip-select control register 2"]
pub bcr4: crate::Reg<bcr::BCR_SPEC>,
#[doc = "0x1c - SRAM/NOR-Flash chip-select timing register 1"]
pub btr4: crate::Reg<btr::BTR_SPEC>,
_reserved8: [u8; 0xe4],
#[doc = "0x104 - SRAM/NOR-Flash write timing registers 1"]
pub bwtr1: crate::Reg<bwtr::BWTR_SPEC>,
_reserved9: [u8; 0x04],
#[doc = "0x10c - SRAM/NOR-Flash write timing registers 1"]
pub bwtr2: crate::Reg<bwtr::BWTR_SPEC>,
_reserved10: [u8; 0x04],
#[doc = "0x114 - SRAM/NOR-Flash write timing registers 1"]
pub bwtr3: crate::Reg<bwtr::BWTR_SPEC>,
_reserved11: [u8; 0x04],
#[doc = "0x11c - SRAM/NOR-Flash write timing registers 1"]
pub bwtr4: crate::Reg<bwtr::BWTR_SPEC>,
}
#[doc = "BCR1 register accessor: an alias for `Reg<BCR1_SPEC>`"]
pub type BCR1 = crate::Reg<bcr1::BCR1_SPEC>;
#[doc = "SRAM/NOR-Flash chip-select control register 1"]
pub mod bcr1;
#[doc = "BTR register accessor: an alias for `Reg<BTR_SPEC>`"]
pub type BTR = crate::Reg<btr::BTR_SPEC>;
#[doc = "SRAM/NOR-Flash chip-select timing register 1"]
pub mod btr;
#[doc = "BCR register accessor: an alias for `Reg<BCR_SPEC>`"]
pub type BCR = crate::Reg<bcr::BCR_SPEC>;
#[doc = "SRAM/NOR-Flash chip-select control register 2"]
pub mod bcr;
#[doc = "BWTR register accessor: an alias for `Reg<BWTR_SPEC>`"]
pub type BWTR = crate::Reg<bwtr::BWTR_SPEC>;
#[doc = "SRAM/NOR-Flash write timing registers 1"]
pub mod bwtr;
| 44.571429
| 67
| 0.663919
|
c53ca057102c1fe970e326c9bf106ddf7e03a452
| 643
|
css
|
CSS
|
OmniStack/week-8/frontend/src/pages/Login.css
|
Hygor/RocketSeatLE
|
6570f7908937baee775b3c7656009def5ba54c52
|
[
"Unlicense"
] | null | null | null |
OmniStack/week-8/frontend/src/pages/Login.css
|
Hygor/RocketSeatLE
|
6570f7908937baee775b3c7656009def5ba54c52
|
[
"Unlicense"
] | 1
|
2022-03-26T10:36:28.000Z
|
2022-03-26T10:36:28.000Z
|
OmniStack/week-8/frontend/src/pages/Login.css
|
Hygor/RocketSeatLE
|
6570f7908937baee775b3c7656009def5ba54c52
|
[
"Unlicense"
] | null | null | null |
.login-container {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.login-container form {
width: 100%;
max-width: 300px;
display: flex;
flex-direction: column;
}
.login-container input {
margin-top: 1em;
border: 1px solid #DDD;
border-radius: .3em;
height: 3em;
padding: 0 1em;
font-size: 16px;
color: #666;
text-align: center;
}
.login-container input::placeholder {
color: #ccc;
}
.login-container button {
margin-top: 1em;
border: 0;
border-radius: .3em;
height: 3em;
padding: 0 1em;
font-size: 16px;
background: #DF4723;
color: #FFF;
cursor: pointer;
}
| 16.075
| 37
| 0.653188
|
0d691847a0a6b78aaf280e4f988fd91cb58237af
| 2,407
|
h
|
C
|
src/hash.h
|
joshuachp/project-compilers-2021
|
71553e8dfd9aa919d2da5b04d0228a67c227a58a
|
[
"MIT"
] | null | null | null |
src/hash.h
|
joshuachp/project-compilers-2021
|
71553e8dfd9aa919d2da5b04d0228a67c227a58a
|
[
"MIT"
] | null | null | null |
src/hash.h
|
joshuachp/project-compilers-2021
|
71553e8dfd9aa919d2da5b04d0228a67c227a58a
|
[
"MIT"
] | null | null | null |
#ifndef HASH_TABLE
#define HASH_TABLE
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct Item {
char *key;
int32_t value;
struct Item *next;
} Item;
typedef struct Bucket {
Item *head;
Item *tail;
} Bucket;
// Initial capacity of a new hash table
#define HASH_TABLE_DEFAULT_CAPACITY 256
typedef struct HashMap {
size_t length;
size_t capacity;
Bucket **buckets;
} HashMap;
Bucket *new_bucket();
void free_bucket(Bucket *bucket);
void free_item(Item *item);
Item *new_item(char *key, int32_t value, Item *next);
/**
* @brief Append or updates and item in the bucket
*
* @param bucket
* @param key Item key
* @param value Item value
* @return True if it's a new item, false if updated
*/
bool bucket_set(Bucket *bucket, char *key, int32_t value);
Item *bucket_get(Bucket *bucket, char *key);
/**
* @brief Check if the Bucket contains a item
*
* @param map
* @param key Item key
* @return True if is contained, false otherwise
*/
bool bucket_has(Bucket *bucket, char *key);
/**
* @brief Delete an item from the bucket
*
* @param bucket
* @param key Item key
* @return True if the item is deleted
*/
bool bucket_delete(Bucket *bucket, char *key);
/**
* @brief Allocate a new HashMap
*
* @return Pointer to the HashMap
*/
HashMap *new_hash_map();
/**
* @brief Free an HashMap
*
* @param map Allocated map to free
*/
void free_hash_map(HashMap *map);
/**
* @brief Key hash function for the HashMap
*
* @param key
* @return Key hash
*/
size_t hash_key(char *key);
/**
* @brief Inserts an item into the HashMap
*
* @param map
* @param key Item key
* @param value Item vale
*/
void hm_set(HashMap *map, char *key, int32_t value);
/**
* @brief Get an Item in the HashMap
*
* @param map
* @param key Item key
* @return Pointer to a copy of the item
*/
Item *hm_get(HashMap *map, char *key);
/**
* @brief Check if the HashMap contains a key
*
* @param map
* @param key
* @return True if is contained, false otherwise
*/
bool hm_has(HashMap *map, char *key);
/**
* @brief Deletes an item in the HashMap
*
* @param map
* @param key Item key
* @return True if the item is present and has been deleted
*/
bool hm_delete(HashMap *map, char *key);
/**
* @brief Doubles the capacity of the HashMap
*
* @param map
*/
void hm_resize(HashMap *map);
#endif // HASH_TABLE
| 18.097744
| 59
| 0.672206
|
275c748531957153cd5ad3fe66c19f2ea216ade6
| 7,367
|
rs
|
Rust
|
examples/vendored/non_cratesio_library/cargo/vendor/futures-util-0.2.0/src/sink/mod.rs
|
tommilligan/cargo-raze
|
b20c29f8f6a0902a7aadf5424dd830cd045ac92d
|
[
"Apache-2.0"
] | null | null | null |
examples/vendored/non_cratesio_library/cargo/vendor/futures-util-0.2.0/src/sink/mod.rs
|
tommilligan/cargo-raze
|
b20c29f8f6a0902a7aadf5424dd830cd045ac92d
|
[
"Apache-2.0"
] | null | null | null |
examples/vendored/non_cratesio_library/cargo/vendor/futures-util-0.2.0/src/sink/mod.rs
|
tommilligan/cargo-raze
|
b20c29f8f6a0902a7aadf5424dd830cd045ac92d
|
[
"Apache-2.0"
] | 2
|
2021-06-03T10:01:21.000Z
|
2022-02-02T14:19:43.000Z
|
//! Sinks
//!
//! This module contains a number of functions for working with `Sink`s,
//! including the `SinkExt` trait which adds methods to `Sink` types.
use futures_core::{Stream, IntoFuture};
use futures_sink::Sink;
mod close;
mod fanout;
mod flush;
mod err_into;
mod map_err;
mod send;
mod send_all;
mod with;
mod with_flat_map;
if_std! {
mod buffer;
pub use self::buffer::Buffer;
}
pub use self::close::Close;
pub use self::fanout::Fanout;
pub use self::flush::Flush;
pub use self::err_into::SinkErrInto;
pub use self::map_err::SinkMapErr;
pub use self::send::Send;
pub use self::send_all::SendAll;
pub use self::with::With;
pub use self::with_flat_map::WithFlatMap;
impl<T: ?Sized> SinkExt for T where T: Sink {}
/// An extension trait for `Sink`s that provides a variety of convenient
/// combinator functions.
pub trait SinkExt: Sink {
/// Composes a function *in front of* the sink.
///
/// This adapter produces a new sink that passes each value through the
/// given function `f` before sending it to `self`.
///
/// To process each value, `f` produces a *future*, which is then polled to
/// completion before passing its result down to the underlying sink. If the
/// future produces an error, that error is returned by the new sink.
///
/// Note that this function consumes the given sink, returning a wrapped
/// version, much like `Iterator::map`.
fn with<U, Fut, F>(self, f: F) -> With<Self, U, Fut, F>
where F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = Self::SinkItem>,
Fut::Error: From<Self::SinkError>,
Self: Sized
{
with::new(self, f)
}
/// Composes a function *in front of* the sink.
///
/// This adapter produces a new sink that passes each value through the
/// given function `f` before sending it to `self`.
///
/// To process each value, `f` produces a *stream*, of which each value
/// is passed to the underlying sink. A new value will not be accepted until
/// the stream has been drained
///
/// Note that this function consumes the given sink, returning a wrapped
/// version, much like `Iterator::flat_map`.
///
/// # Examples
/// ---
/// Using this function with an iterator through use of the `stream::iter_ok()`
/// function
///
/// ```
/// # extern crate futures;
/// # extern crate futures_channel;
/// # extern crate futures_executor;
/// use futures::prelude::*;
/// use futures::stream;
/// use futures_channel::mpsc;
/// use futures_executor::block_on;
///
/// # fn main() {
/// let (tx, rx) = mpsc::channel::<i32>(5);
///
/// let tx = tx.with_flat_map(|x| {
/// stream::iter_ok(vec![42; x].into_iter().map(|y| y))
/// });
///
/// block_on(tx.send(5)).unwrap();
/// assert_eq!(block_on(rx.collect()), Ok(vec![42, 42, 42, 42, 42]));
/// # }
/// ```
fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, U, St, F>
where F: FnMut(U) -> St,
St: Stream<Item = Self::SinkItem, Error=Self::SinkError>,
Self: Sized
{
with_flat_map::new(self, f)
}
/*
fn with_map<U, F>(self, f: F) -> WithMap<Self, U, F>
where F: FnMut(U) -> Self::SinkItem,
Self: Sized;
fn with_filter<F>(self, f: F) -> WithFilter<Self, F>
where F: FnMut(Self::SinkItem) -> bool,
Self: Sized;
fn with_filter_map<U, F>(self, f: F) -> WithFilterMap<Self, U, F>
where F: FnMut(U) -> Option<Self::SinkItem>,
Self: Sized;
*/
/// Transforms the error returned by the sink.
fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
where F: FnOnce(Self::SinkError) -> E,
Self: Sized,
{
map_err::new(self, f)
}
/// Map this sink's error to a different error type using the `Into` trait.
///
/// If wanting to map errors of a `Sink + Stream`, use `.sink_err_into().err_into()`.
fn sink_err_into<E>(self) -> err_into::SinkErrInto<Self, E>
where Self: Sized,
Self::SinkError: Into<E>,
{
err_into::new(self)
}
/// Adds a fixed-size buffer to the current sink.
///
/// The resulting sink will buffer up to `amt` items when the underlying
/// sink is unwilling to accept additional items. Calling `flush` on
/// the buffered sink will attempt to both empty the buffer and complete
/// processing on the underlying sink.
///
/// Note that this function consumes the given sink, returning a wrapped
/// version, much like `Iterator::map`.
///
/// This method is only available when the `std` feature of this
/// library is activated, and it is activated by default.
#[cfg(feature = "std")]
fn buffer(self, amt: usize) -> Buffer<Self>
where Self: Sized
{
buffer::new(self, amt)
}
/// Close the sink.
///
/// The sink itself is returned after closeing is complete.
fn close(self) -> Close<Self>
where Self: Sized
{
close::new(self)
}
/// Fanout items to multiple sinks.
///
/// This adapter clones each incoming item and forwards it to both this as well as
/// the other sink at the same time.
fn fanout<S>(self, other: S) -> Fanout<Self, S>
where Self: Sized,
Self::SinkItem: Clone,
S: Sink<SinkItem=Self::SinkItem, SinkError=Self::SinkError>
{
fanout::new(self, other)
}
/// Flush the sync, processing all pending items.
///
/// The sink itself is returned after flushing is complete; this adapter is
/// intended to be used when you want to stop sending to the sink until
/// all current requests are processed.
fn flush(self) -> Flush<Self>
where Self: Sized
{
flush::new(self)
}
/// A future that completes after the given item has been fully processed
/// into the sink, including flushing.
///
/// Note that, **because of the flushing requirement, it is usually better
/// to batch together items to send via `send_all`, rather than flushing
/// between each item.**
///
/// On completion, the sink is returned.
fn send(self, item: Self::SinkItem) -> Send<Self>
where Self: Sized
{
send::new(self, item)
}
/// A future that completes after the given stream has been fully processed
/// into the sink, including flushing.
///
/// This future will drive the stream to keep producing items until it is
/// exhausted, sending each item to the sink. It will complete once both the
/// stream is exhausted, the sink has received all items, and the sink has
/// been flushed. Note that the sink is **not** closed.
///
/// Doing `sink.send_all(stream)` is roughly equivalent to
/// `stream.forward(sink)`. The returned future will exhaust all items from
/// `stream` and send them to `self`.
///
/// On completion, the pair `(sink, source)` is returned.
fn send_all<S>(self, stream: S) -> SendAll<Self, S>
where S: Stream<Item = Self::SinkItem>,
Self::SinkError: From<S::Error>,
Self: Sized
{
send_all::new(self, stream)
}
}
| 33.035874
| 89
| 0.601059
|
72aaa94bfd624d556fba48b10ec84c6810dc5741
| 3,395
|
cs
|
C#
|
src/prod/test/System.Fabric/unit/Common/FabricUtility/InProc/PortHelper.cs
|
gridgentoo/ServiceFabricAzure
|
c3e7a07617e852322d73e6cc9819d266146866a4
|
[
"MIT"
] | 2,542
|
2018-03-14T21:56:12.000Z
|
2019-05-06T01:18:20.000Z
|
src/prod/test/System.Fabric/unit/Common/FabricUtility/InProc/PortHelper.cs
|
gridgentoo/ServiceFabricAzure
|
c3e7a07617e852322d73e6cc9819d266146866a4
|
[
"MIT"
] | 994
|
2019-05-07T02:39:30.000Z
|
2022-03-31T13:23:04.000Z
|
src/prod/test/System.Fabric/unit/Common/FabricUtility/InProc/PortHelper.cs
|
gridgentoo/ServiceFabricAzure
|
c3e7a07617e852322d73e6cc9819d266146866a4
|
[
"MIT"
] | 300
|
2018-03-14T21:57:17.000Z
|
2019-05-06T20:07:00.000Z
|
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
namespace System.Fabric.Test.Common.FabricUtility.InProc
{
using System;
public class TestPortHelper
{
private const string EnvVarName_WinFabTestPorts = "WinFabTestPorts";
private const int DefaultStartPort = 22000;
private const int DefaultEndPort = 22979;
private const int DefaultEndLeasePort = 22999;
static int StartPort = 0;
static int EndPort = 0;
static int EndLeasePort = 0;
static int CurrentIndex = 0;
static int LeaseIndex = 0;
static object portLock = new object();
public static int GetNextLeasePort()
{
int nextPort = EndPort + 1 + LeaseIndex;
if (nextPort == EndLeasePort)
{
LeaseIndex = 0;
}
else
{
++LeaseIndex;
}
return nextPort;
}
public static void GetPorts(int numberOfPorts, out int startPort)
{
lock (portLock)
{
if (StartPort == 0 && EndPort == 0)
{
string ports = Environment.GetEnvironmentVariable(EnvVarName_WinFabTestPorts);
if (ports != null)
{
string[] portsArray = ports.Split(',');
if (portsArray.Length == 2)
{
StartPort = int.Parse(portsArray[0]);
EndLeasePort = int.Parse(portsArray[1]);
if (EndLeasePort - StartPort < 500)
{
throw new InvalidOperationException("Not enough ports supplied to TestPortHelpers");
}
EndPort = EndLeasePort - 20;
}
else
{
StartPort = TestPortHelper.DefaultStartPort;
EndPort = TestPortHelper.DefaultEndPort;
EndLeasePort = TestPortHelper.DefaultEndLeasePort;
}
}
else
{
StartPort = TestPortHelper.DefaultStartPort;
EndPort = TestPortHelper.DefaultEndPort;
EndLeasePort = TestPortHelper.DefaultEndLeasePort;
}
CurrentIndex = StartPort;
}
if (numberOfPorts > (EndPort - StartPort) + 1)
{
throw new InvalidOperationException("Not enough ports to assign");
}
if ((CurrentIndex + numberOfPorts - 1) <= EndPort)
{
startPort = CurrentIndex;
CurrentIndex = CurrentIndex + numberOfPorts;
}
else
{
startPort = StartPort;
CurrentIndex = StartPort;
}
}
}
}
}
| 35.364583
| 116
| 0.444183
|
6e610931e44cc4bb0b886e3ae859cef418c3ca80
| 25,885
|
lua
|
Lua
|
game/dota_addons/friendly_fire/scripts/vscripts/util.lua
|
DarkoniusXNG/friendly_fire_dota2
|
9b76f6c7de1ff68a6478cdbd3cef7ea7de8fa61e
|
[
"MIT"
] | 1
|
2018-09-21T03:29:40.000Z
|
2018-09-21T03:29:40.000Z
|
game/dota_addons/friendly_fire/scripts/vscripts/util.lua
|
DarkoniusXNG/friendly_fire_dota2
|
9b76f6c7de1ff68a6478cdbd3cef7ea7de8fa61e
|
[
"MIT"
] | null | null | null |
game/dota_addons/friendly_fire/scripts/vscripts/util.lua
|
DarkoniusXNG/friendly_fire_dota2
|
9b76f6c7de1ff68a6478cdbd3cef7ea7de8fa61e
|
[
"MIT"
] | null | null | null |
-- Given element and table, returns true if element is in the table.
function TableContains(table1, element)
if table1 == nil then return false end
for k,v in pairs(table1) do
if k == element then
return true
end
end
return false
end
function TableLength(t)
if t == nil or t == {} then
return 0
end
local length = 0
for k,v in pairs(t) do
length = length + 1
end
return length
end
function PrintTable(t, indent, done)
--print ( string.format ('PrintTable type %s', type(keys)) )
if type(t) ~= "table" then return end
done = done or {}
done[t] = true
indent = indent or 0
local l = {}
for k, v in pairs(t) do
table.insert(l, k)
end
table.sort(l)
for k, v in ipairs(l) do
-- Ignore FDesc
if v ~= 'FDesc' then
local value = t[v]
if type(value) == "table" and not done[value] then
done [value] = true
print(string.rep ("\t", indent)..tostring(v)..":")
PrintTable (value, indent + 2, done)
elseif type(value) == "userdata" and not done[value] then
done [value] = true
print(string.rep ("\t", indent)..tostring(v)..": "..tostring(value))
PrintTable ((getmetatable(value) and getmetatable(value).__index) or getmetatable(value), indent + 2, done)
else
if t.FDesc and t.FDesc[v] then
print(string.rep ("\t", indent)..tostring(t.FDesc[v]))
else
print(string.rep ("\t", indent)..tostring(v)..": "..tostring(value))
end
end
end
end
end
-- Colors
COLOR_NONE = '\x06'
COLOR_GRAY = '\x06'
COLOR_GREY = '\x06'
COLOR_GREEN = '\x0C'
COLOR_DPURPLE = '\x0D'
COLOR_SPINK = '\x0E'
COLOR_DYELLOW = '\x10'
COLOR_PINK = '\x11'
COLOR_RED = '\x12'
COLOR_LGREEN = '\x15'
COLOR_BLUE = '\x16'
COLOR_DGREEN = '\x18'
COLOR_SBLUE = '\x19'
COLOR_PURPLE = '\x1A'
COLOR_ORANGE = '\x1B'
COLOR_LRED = '\x1C'
COLOR_GOLD = '\x1D'
--[[ This function is showing Error Messages using notifications library from BMD's Barebones
Author: Noya
]]
function SendErrorMessage(pID, string)
Notifications:ClearBottom(pID)
Notifications:Bottom(pID, {text=string, style={color='#E62020'}, duration=2})
EmitSoundOnClient("General.Cancel", PlayerResource:GetPlayer(pID))
end
--[[ This function hides all hats (wearables) from the hero and store them into a handle variable
Date: 09.08.2015.
Author: Noya (Part of BMD Barebones)
]]
function HideWearables(hero)
hero.hiddenWearables = {} -- Keep every wearable handle in a table to show them later
local model = hero:FirstMoveChild()
while model ~= nil do
if model:GetClassname() == "dota_item_wearable" then
model:AddEffects(EF_NODRAW) -- Set model hidden
table.insert(hero.hiddenWearables, model)
end
model = model:NextMovePeer()
end
end
--[[ This function unhides/shows wearables that were hidden with HideWearables() function.
Author: Noya (Part of BMD Barebones)
]]
function ShowWearables(hero)
for i,v in pairs(hero.hiddenWearables) do
v:RemoveEffects(EF_NODRAW)
end
end
--[[ This function is needed for changing models (for Arcanas for example)
Author: Noya
]]
function SwapWearable(unit, target_model, new_model)
local wearable = unit:FirstMoveChild()
while wearable ~= nil do
if wearable:GetClassname() == "dota_item_wearable" then
if wearable:GetModelName() == target_model then
wearable:SetModel( new_model )
return
end
end
wearable = wearable:NextMovePeer()
end
end
-- This function checks if a given unit is Roshan, returns boolean value;
function IsRoshan(unit)
if unit:IsAncient() and unit:GetName() == "npc_dota_roshan" then
return true
end
return false
end
-- This function checks if this unit/entity is a fountain or not; returns boolean value;
function IsFountain(unit)
if unit:GetName() == "ent_dota_fountain_bad" or unit:GetName() == "ent_dota_fountain_good" then
return true
end
return false
end
-- Initializes heroes' innate abilities
function InitializeInnateAbilities(hero)
-- List of innate abilities
local innate_abilities = {
"innate_ability1",
"innate_ability2"
}
-- Cycle through any innate abilities found, then upgrade them
for i = 1, #innate_abilities do
local current_ability = hero:FindAbilityByName(innate_abilities[i])
if current_ability then
current_ability:SetLevel(1)
end
end
end
--[[ This function interrupts and hide the target hero, applies SuperStrongDispel and CustomPassiveBreak to the target,
and creates a copy of the target for the caster, returns the hScript copy;
Target hero has vision over the area where he is moved! You need a modifier to disable this vision;
Copy/Clone of the target hero is not invulnerable! You need a modifier for that too;
Used in some abilities ...
]]
function HideAndCopyHero(target, caster)
if target and caster then
local caster_team = caster:GetTeamNumber()
local playerID = caster:GetPlayerOwnerID()
local target_name = target:GetUnitName()
local target_origin = target:GetAbsOrigin()
local target_ability_count = target:GetAbilityCount()
local target_HP = target:GetHealth()
local target_MP = target:GetMana()
local target_level = target:GetLevel()
target:Interrupt()
target:InterruptChannel()
target:AddNoDraw() -- needed for hiding the original hero
-- Moving the target (original hero) to the corner of the map
local corner = Vector(0,0,0)
if GetMapName() == "smaller_map" then
corner = Vector(2300,-2300,-322)
else
corner = Vector(7500,-7200,-322)
end
target:SetAbsOrigin(corner)
local hidden_modifiers = {
"modifier_not_removed_on_death",
"modifier_not_removed_with_super_strong_dispel_or_custom_passive_break"
}
-- Remove all buffs and debuffs from the target
SuperStrongDispel(target, true, true)
-- Remove passive modifiers from the target with Custom Passive Break
CustomPassiveBreak(target, 100)
-- Cycle through remaining hidden modifiers and bugging visual effects and remove them
for i=1, #hidden_modifiers do
target:RemoveModifierByName(hidden_modifiers[i])
end
local ability_table = {}
local item_table = {}
ability_table[1] = "shredder_chakram" -- crashes
ability_table[2] = "shredder_chakram_2" -- crashes
item_table[1] = "item_tpscroll" -- preventing abuse
item_table[2] = "item_travel_boots" -- preventing abuse
item_table[3] = "item_travel_boots_2" -- preventing abuse
-- Creating copy of the target hero
local copy = CreateUnitByName(target_name, target_origin, true, caster, nil, caster_team) -- handle hUnitOwner MUST be nil, else it will crash the game.
copy:SetPlayerID(playerID)
copy:SetControllableByPlayer(playerID, true)
copy:SetOwner(caster:GetOwner())
FindClearSpaceForUnit(copy, target_origin, false)
-- Levelling up the Copy of the hero
for i=1,target_level-1 do
copy:HeroLevelUp(false) -- false because we don't want to see level up effects
end
-- Recreate the items of the original, disabling some items, not ignoring items in backpack
local disable_item = {}
for item_slot=0,8 do
local item = target:GetItemInSlot(item_slot)
if item then
local item_name = item:GetName()
local new_item = CreateItem(item_name, copy, copy)
local new_item_name = new_item:GetName()
disable_item[item_slot+1] = 0
for i=1, #item_table do
if new_item_name == item_table[i] then
--print("Disabling "..new_item_name)
disable_item[item_slot+1] = 1
end
end
if disable_item[item_slot+1] == 0 then
copy:AddItem(new_item)
end
end
end
-- Enabling and disabling abilities on the Copy/Clone
copy:SetAbilityPoints(0)
local disable_ability = {}
for ability_slot=0,target_ability_count-1 do
local ability = target:GetAbilityByIndex(ability_slot)
if ability then
local ability_level = ability:GetLevel()
local ability_name = ability:GetAbilityName()
local copy_ability = copy:FindAbilityByName(ability_name)
local copy_ability_name = copy_ability:GetAbilityName()
disable_ability[ability_slot+1] = 0
for i=1, #ability_table do
if copy_ability_name == ability_table[i] then
--print("Disabling "..copy_ability_name)
disable_ability[ability_slot+1] = 1
end
end
if disable_ability[ability_slot+1] == 0 then
copy_ability:SetLevel(ability_level)
end
end
end
-- Setting health and mana to be the same as the original(target) hero at the moment of casting
copy:SetHealth(target_HP)
copy:SetMana(target_MP)
-- Preventing dropping and selling items in inventory
copy:SetHasInventory(false)
copy:SetCanSellItems(false)
-- Disabling bounties because copy can die (even if its invulnerable it can still die: suicide (bloodstone) or axe's cut from above/culling blade)
copy:SetMaximumGoldBounty(0)
copy:SetMinimumGoldBounty(0)
copy:SetDeathXP(0)
-- Preventing copy hero from respawning (IMPORTANT)
copy:SetRespawnsDisabled(true)
-- Storing the information about the original (IMPORTANT for placing the original at the position of the copy, for OnEntityKilled, for OnPlayerLevelUp, for OnHeroInGame)
copy.original = target
return copy
else
print("target or caster are nil values.")
return nil
end
end
--[[ This function interrupts, hides the hero and disables all his passives and auras; If he is not alive it revives him first;
This function is meant to be used on heroes that will not be unhidden afterwards.
Used in some abilities ...
]]
function HideTheCopyPermanently(copy)
if copy then
-- Effects and auras that are visual while hidden - Special cases
local hidden_modifiers = {
"modifier_custom_arcana", -- Custom Arcana
"modifier_drow_ranger_trueshot", -- Precision Aura (built-in)
"modifier_drow_ranger_trueshot_aura", -- Precision Aura (built-in)
"modifier_drow_ranger_trueshot_global", -- Precision Aura (built-in)
"modifier_black_king_bar_immune", -- Black King Bar (built-in)
"modifier_item_ring_of_basilius_aura", -- Ring of Basilius Aura
"modifier_item_ring_of_aquila_aura", -- Ring of Aquila Aura
"modifier_item_mekansm_aura", -- Mekansm Aura
"modifier_item_ancient_janggo", -- Drums of Endurance Aura
"modifier_item_vladmir", -- Vladmir's Aura
"modifier_item_guardian_greaves", -- Guardian Greaves Aura
"modifier_item_assault_positive_aura", -- Assault Cuirass Positive Aura
"modifier_item_assault_positive_buildings_aura", -- Assault Cuirass Positive Aura (buildings)
"modifier_item_assault_negative_armor_aura", -- Assault Cuirass Negative Aura
"modifier_item_pipe", -- Pipe of Insight Aura
"modifier_item_headdress", -- Headdress Aura
"modifier_item_radiance", -- Radiance Aura
"modifier_item_crimson_guard_extra", -- Crimson Guard Active
"modifier_item_shivas_guard" -- Shiva's Guard Aura
}
if copy:IsAlive() then
copy:Stop()
copy:Interrupt()
copy.died = false
else
-- MakeIllusion() and RemoveSelf() are not good here because:
-- Illusions can't deal damage over time (poisons etc.) -> automatic crash to desktop if illusions have DoT
-- Removed units cant deal damage over time -> automatic crash to desktop if DoT is still active after removing the unit
copy:RespawnUnit()
copy.died = true
end
copy:AddNoDraw() -- Hiding the copy visually only (base skeleton)
HideWearables(copy) -- Hiding hats/wearables if some are still visible
-- Remove most buffs and most debuffs
SuperStrongDispel(copy, true, true)
-- Remove passive modifiers with Custom Break
CustomPassiveBreak(copy, 100)
-- Cycle through hidden modifiers and remove them (Death, SuperStrongDispel and CustomPassiveBreak remove most modifiers but we need to make sure for remaining modifiers)
for i=1, #hidden_modifiers do
copy:RemoveModifierByName(hidden_modifiers[i])
end
-- Moving the copy to the corner of the map (Hiding him for sure)
local corner = Vector(0,0,0)
if GetMapName() == "smaller_map" then
corner = corner_of_that_smaller_map
else
corner = Vector(7500,-7200,-322)
end
copy:SetAbsOrigin(corner)
else
print("Copy is nil!")
end
end
--[[ This function reveals the original hero (that was hidden) at certain location;
This function re-enables abilities and auras (some, not all! it's intentional!) that were disabled in HideAndCopyHero function
Used in some abilities ...
]]
function UnhideOriginalOnLocation(original, location)
if original then
original:RemoveNoDraw() -- Unhiding the hero (only visually)
if location~= nil then
original:SetAbsOrigin(location) -- Moving the original to location instantly
else
print("Original is revealed at the location where it was hidden")
end
FindClearSpaceForUnit(original, original:GetAbsOrigin(), false)
-- List of auras and abilities with visual effect
local hidden_abilities = {
"custom_arcana_model",
"hidden_ability_not_affected_with_custom_passive_break"
}
local passive_modifiers = {
"modifier_custom_arcana",
"modifier_not_removed_with_super_strong_dispel_or_custom_passive_break"
}
-- Re-enabling removed passive modifiers with CustomPassiveBreak
CustomPassiveBreak(original, 0.1)
-- Cycle through remaining hidden abilities found on the hero, then re-activate them
for i=1, #hidden_abilities do
local ability = original:FindAbilityByName(hidden_abilities[i])
if ability then
if ability:GetLevel() ~= 0 then
ability:ApplyDataDrivenModifier(original, original, passive_modifiers[i], {})
end
end
end
else
print("Hero that needed to be unhidden is nil.")
end
end
--[[ This function disables passive modifiers from custom (datadriven) abilities for the duration.
Attention: This only works with abilities that have 1 passive modifier and if the order of strings in tables is not random.
If Duration is 100, passives are disabled forever / until death or removal of the hero.
Used in HideAndCopyHero, HideTheCopyPermanently, UnhideOriginalOnLocation ...
]]
function CustomPassiveBreak(unit, duration)
-- List of custom abilities with passive modifiers
local abilities_with_passives = {
"ability1",
"ability2"
}
local passive_modifiers = {
"modifier1",
"modifier2"
}
if unit and duration then
for i=1, #passive_modifiers do
unit:RemoveModifierByName(passive_modifiers[i])
end
unit.custom_already_breaked = true
if duration ~= 100 then
Timers:CreateTimer(duration, function()
for i=1, #abilities_with_passives do
local ability = unit:FindAbilityByName(abilities_with_passives[i])
if ability then
if ability:GetLevel() ~= 0 then
ability:ApplyDataDrivenModifier(unit, unit, passive_modifiers[i], {})
end
end
end
unit.custom_already_breaked = false
end)
end
end
end
--[[ This function disables inventory and removes item passives.
]]
function CustomItemDisable(caster, unit)
local passive_item_modifiers_exceptions ={
"modifier_item_empty_bottle",
"modifier_item_observer_ward",
"modifier_item_tome_of_knowledge",
"modifier_item_sentry_ward",
"modifier_item_blink_dagger",
"modifier_item_armlet_unholy_strength"
}
if unit then
for item_slot=0,8 do
local item = unit:GetItemInSlot(item_slot)
if item then
local item_owner = item:GetPurchaser()
local unit_owner = unit:GetOwner()
local caster_owner = caster:GetOwner()
if item_owner == unit then
item:SetPurchaser(caster)
elseif item_owner == unit_owner then
item:SetPurchaser(caster_owner)
end
end
end
-- Find All modifiers (ALL buffs, debuffs, passives)
local all_modifiers = unit:FindAllModifiers()
-- Iterate through each one and check their ability
for _, modifier in pairs(all_modifiers) do
local modifier_ability = modifier:GetAbility() -- can be nil
if modifier_ability then
if modifier_ability:IsItem() then
-- Get the duration of the item modifier
local item_modifier_duration = modifier:GetDuration()
-- If the modifier duration is -1 (infinite duration) there is a chance that this is a passive modifier
if item_modifier_duration == -1 then
-- Get the name of the item modifier
local item_modifier_name = modifier:GetName()
-- Initializing handle: safe_to_remove
modifier.safe_to_remove = true
for i=1, #passive_item_modifiers_exceptions do
if item_modifier_name == passive_item_modifiers_exceptions[i] then
modifier.safe_to_remove = false
end
end
if modifier.safe_to_remove == true then
unit:RemoveModifierByName(item_modifier_name)
end
end
end
end
end
-- Preventing dropping and selling items in inventory
unit:SetHasInventory(false)
unit:SetCanSellItems(false)
else
print("unit is nil!")
end
end
--[[ This function enables inventory and item passives if they were disabled with CustomItemDisable
]]
function CustomItemEnable(caster, unit)
if unit then
for item_slot=0,8 do
local item = unit:GetItemInSlot(item_slot)
if item then
local item_owner = item:GetPurchaser()
local unit_owner = unit:GetOwner()
local caster_owner = caster:GetOwner()
if item_owner == caster then
item:SetPurchaser(unit)
elseif item_owner == caster_owner then
item:SetPurchaser(unit_owner)
end
end
end
-- Enable dropping and selling items back
unit:SetHasInventory(true)
unit:SetCanSellItems(true)
-- To reset unit's items and their passive modifiers: add an item and remove it
local new_item = CreateItem("item_magic_wand", unit, unit)
unit:AddItem(new_item)
new_item:RemoveSelf()
else
print("unit is nil!")
end
end
--[[ This function applies strong dispel and removes almost all debuffs;
Can remove most buffs that are not removable with basic dispel;
Can remove most debuffs that are not removable with strong dispel;
Used in many abilities, HideAndCopyHero, HideTheCopyPermanently, ...
]]
function SuperStrongDispel(target, bCustomRemoveAllDebuffs, bCustomRemoveAllBuffs)
if target then
local BuffsCreatedThisFrameOnly = false
local RemoveExceptions = false
local RemoveStuns = false
if bCustomRemoveAllDebuffs == true then
RemoveStuns = true -- this ensures removing modifiers debuffs with "IsStunDebuff" "1"
-- Ability debuffs:
target:RemoveModifierByName("modifier_venomancer_poison_sting") -- pierces BKB, doesn't get removed with BKB
target:RemoveModifierByName("modifier_bane_nightmare_invulnerable") -- invulnerable type
-- Item debuffs:
target:RemoveModifierByName("modifier_item_skadi_slow") -- pierces BKB, doesn't get removed with BKB
target:RemoveModifierByName("modifier_heavens_halberd_debuff") -- doesn't pierce BKB, doesn't get removed with BKB
target:RemoveModifierByName("modifier_sheepstick_debuff") -- doesn't pierce BKB, doesn't get removed with BKB
target:RemoveModifierByName("modifier_silver_edge_debuff") -- doesn't pierce BKB, doesn't get removed with BKB
end
if bCustomRemoveAllBuffs == true then
-- List of undispellable buffs that are safe to remove without making errors, crashes etc.
local undispellable_with_normal_dispel_buffs = {
"modifier_alchemist_chemical_rage",
"modifier_custom_blade_fury_buff",
"modifier_item_aeon_disk_buff",
"modifier_item_blade_mail_reflect",
"modifier_item_phase_boots_active",
"modifier_item_hood_of_defiance_barrier",
"modifier_item_pipe_barrier",
"modifier_item_crimson_guard_extra",
"modifier_black_king_bar_immune"
-- Death Pact
}
for i=1, #undispellable_with_normal_dispel_buffs do
target:RemoveModifierByName(undispellable_with_normal_dispel_buffs[i])
end
end
target:Purge(bCustomRemoveAllBuffs, bCustomRemoveAllDebuffs, BuffsCreatedThisFrameOnly, RemoveStuns, RemoveExceptions)
else
print("Target for Super Strong Dispel is nil.")
end
end
-- Disruptor Glimpse Position Tracker
function glimpse_position_tracker()
local current_time = GameRules:GetGameTime()
for i, hero in pairs(GameRules.Heroes) do
if not hero.positions[math.floor(current_time)] then
hero.positions[math.floor(current_time)] = hero:GetAbsOrigin()
end
for t, pos in pairs(hero.positions) do
if (current_time-t) > 9 then
hero.positions[t] = nil
else -- the rest of the times in the table are <= 4.
break
end
end
end
end
-- Finding units in a trapezoid shape area
function FindUnitsinTrapezoid(team_number, direction, start_position, cache_unit, start_radius, end_radius, distance, target_team, target_type, target_flags, order, cache)
local circle = FindUnitsInRadius(team_number, start_position, cache_unit, distance+end_radius, target_team, target_type, target_flags, order, cache)
local direction = direction
direction.z = 0.0
direction = direction:Normalized()
local perpendicular_direction = Vector(direction.y, -direction.x, 0.0)
local end_position = start_position + direction*distance
-- Trapezoid vertexes
local vertex1 = start_position - perpendicular_direction*start_radius
local vertex2 = start_position + perpendicular_direction*start_radius
local vertex3 = end_position - perpendicular_direction*end_radius
local vertex4 = end_position + perpendicular_direction*end_radius
-- Trapezoid sides (vectors)
local vector1 = vertex2 - vertex1 -- vector12
local vector2 = vertex4 - vertex2 -- vector24
local vector3 = vertex3 - vertex4 -- vector43
local vector4 = vertex1 - vertex3 -- vector31
local unit_table = {}
for _, unit in pairs(circle) do
if unit then
local unit_location = unit:GetAbsOrigin()
local vector1p = unit_location - vertex1
local vector2p = unit_location - vertex2
local vector3p = unit_location - vertex3
local vector4p = unit_location - vertex4
local cross1 = vector1.x * vector1p.y - vector1.y * vector1p.x
local cross2 = vector2.x * vector2p.y - vector2.y * vector2p.x
local cross3 = vector3.x * vector4p.y - vector3.y * vector4p.x
local cross4 = vector4.x * vector3p.y - vector4.y * vector3p.x
if (cross1 > 0 and cross2 > 0 and cross3 > 0 and cross4 > 0) or (cross1 < 0 and cross2 < 0 and cross3 < 0 and cross4 < 0) then
table.insert(unit_table, unit)
end
end
end
return unit_table
end
-- Custom Cleave function
-- Required arguments: main_damage, damage_percent, cleave_origin, start_radius, end_radius, distance;
-- If start_radius is 0, it will behave like the old cleave (pre 7.00);
function CustomCleaveAttack(attacker, target, ability, main_damage, damage_percent, cleave_origin, start_radius, end_radius, distance, particle_cleave)
if attacker == nil then
print("Attacker/Cleaver is nil!")
return nil
end
local team_number = attacker:GetTeamNumber()
local direction = attacker:GetForwardVector()
local cache_unit = nil
local order = FIND_ANY_ORDER
local cache = false
local damage_table = {}
damage_table.attacker = attacker
local target_team
local target_type
local target_flags
if ability then
target_team = ability:GetAbilityTargetTeam()
target_type = ability:GetAbilityTargetType()
target_flags = ability:GetAbilityTargetFlags()
damage_table.damage_type = ability:GetAbilityDamageType()
damage_table.ability = ability
else
target_team = DOTA_UNIT_TARGET_TEAM_BOTH
target_type = bit.bor(DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_HERO)
target_flags = DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES
damage_table.damage_type = DAMAGE_TYPE_PHYSICAL
end
if target == nil then
print("Attacked target is nil!")
return nil
end
if target:GetTeamNumber() == team_number then
--print("Cleave works when attacking allies!")
end
if target:IsTower() or target:IsBarracks() or target:IsBuilding() then
--print("Cleave doesn't work when attacking buildings!")
return
end
if target:IsOther() then
--print("Cleave doesn't work when attacking ward-type units!")
return
end
local affected_units = FindUnitsinTrapezoid(team_number, direction, cleave_origin, cache_unit, start_radius, end_radius, distance, target_team, target_type, target_flags, order, cache)
-- Calculating damage and setting damage flags
damage_table.damage = main_damage*damage_percent/100
damage_table.damage_flags = bit.bor(DOTA_DAMAGE_FLAG_IGNORES_PHYSICAL_ARMOR, DOTA_DAMAGE_FLAG_NO_SPELL_AMPLIFICATION, DOTA_DAMAGE_FLAG_NO_SPELL_LIFESTEAL)
for _, unit in pairs(affected_units) do
if unit ~= target and unit ~= attacker then
damage_table.victim = unit
ApplyDamage(damage_table)
end
end
-- Particles
if particle_cleave then
if particle_cleave == "particles/units/heroes/hero_kunkka/kunkka_spell_tidebringer.vpcf" then
for _, unit in pairs(affected_units) do
if unit ~= attacker then
local tidebringer_hit_fx = ParticleManager:CreateParticle(particle_cleave, PATTACH_CUSTOMORIGIN, attacker)
ParticleManager:SetParticleControlEnt(tidebringer_hit_fx, 0, unit, PATTACH_OVERHEAD_FOLLOW, "attach_hitloc", unit:GetAbsOrigin(), true)
ParticleManager:SetParticleControlEnt(tidebringer_hit_fx, 1, unit, PATTACH_OVERHEAD_FOLLOW, "attach_hitloc", unit:GetAbsOrigin(), true)
ParticleManager:SetParticleControlEnt(tidebringer_hit_fx, 2, unit, PATTACH_OVERHEAD_FOLLOW, "attach_hitloc", unit:GetAbsOrigin(), true)
ParticleManager:ReleaseParticleIndex(tidebringer_hit_fx)
unit:EmitSound("Hero_Kunkka.TidebringerDamage")
end
end
else
local cleave_pfx = ParticleManager:CreateParticle(particle_cleave, PATTACH_WORLDORIGIN, attacker)
ParticleManager:SetParticleControl(cleave_pfx, 0, cleave_origin)
ParticleManager:SetParticleControlForward(cleave_pfx, 0, direction)
ParticleManager:ReleaseParticleIndex(cleave_pfx)
end
end
end
| 35.703448
| 185
| 0.73784
|
6ee74e4b915ed65d1eec29571087d47bf80dbe41
| 1,565
|
swift
|
Swift
|
ToDoo/ToDoo/critter/CritterAssets.swift
|
Gerilimy/ECE651-Project
|
4ccc009358033cf591edaef1ff8c5e40812f6aa2
|
[
"MIT"
] | 5,426
|
2018-04-23T18:32:11.000Z
|
2022-03-31T07:25:23.000Z
|
ToDoo/ToDoo/critter/CritterAssets.swift
|
chuxi-z/ECE651-Project
|
11ad8d70d7ad9fd64fc8ce521f1d77e52f9404c0
|
[
"MIT"
] | 12
|
2018-04-27T13:50:54.000Z
|
2020-04-29T05:00:32.000Z
|
ToDoo/ToDoo/critter/CritterAssets.swift
|
chuxi-z/ECE651-Project
|
11ad8d70d7ad9fd64fc8ce521f1d77e52f9404c0
|
[
"MIT"
] | 398
|
2018-04-27T11:59:22.000Z
|
2022-03-22T01:32:34.000Z
|
//
// CritterAssets.swift
// LoginCritter
//
// Created by Christopher Goldsby on 3/30/18.
// Copyright © 2018 Christopher Goldsby. All rights reserved.
//
import UIKit
extension UIImage {
struct Critter {
static let body = #imageLiteral(resourceName: "Body")
static let doeEye = #imageLiteral(resourceName: "Eye-doe")
static let eye = #imageLiteral(resourceName: "Eye")
static let head = #imageLiteral(resourceName: "Head")
static let leftArm = #imageLiteral(resourceName: "Arm")
static let leftEar = #imageLiteral(resourceName: "Ear")
static let mouthCircle = #imageLiteral(resourceName: "Mouth-circle")
static let mouthFull = #imageLiteral(resourceName: "Mouth-full")
static let mouthHalf = #imageLiteral(resourceName: "Mouth-half")
static let mouthSmile = #imageLiteral(resourceName: "Mouth-smile")
static let muzzle = #imageLiteral(resourceName: "Muzzle")
static let nose = #imageLiteral(resourceName: "Nose")
static let rightEar: UIImage = {
let leftEar = UIImage.Critter.leftEar
return UIImage(
cgImage: leftEar.cgImage!,
scale: leftEar.scale,
orientation: .upMirrored
)
}()
static let rightArm: UIImage = {
let leftArm = UIImage.Critter.leftArm
return UIImage(
cgImage: leftArm.cgImage!,
scale: leftArm.scale,
orientation: .upMirrored
)
}()
}
}
| 34.777778
| 76
| 0.609585
|
14205d86213fd010a240b5efad86090fe5159820
| 212
|
ts
|
TypeScript
|
src/removeElement.ts
|
newying61/js-utils
|
b5e1908b5d0dead1d15fe0bda69ec710e363662a
|
[
"MIT"
] | 5
|
2019-11-19T12:44:39.000Z
|
2021-11-02T06:33:48.000Z
|
src/removeElement.ts
|
newying61/js-utils
|
b5e1908b5d0dead1d15fe0bda69ec710e363662a
|
[
"MIT"
] | 1
|
2020-07-17T04:35:19.000Z
|
2020-07-17T04:35:19.000Z
|
src/removeElement.ts
|
newying61/js-utils
|
b5e1908b5d0dead1d15fe0bda69ec710e363662a
|
[
"MIT"
] | 1
|
2021-12-10T13:18:11.000Z
|
2021-12-10T13:18:11.000Z
|
export function removeElement(node: Element) {
if (!node) {
return;
}
const parent = node.parentNode;
if (!parent) {
// If node not in DOM already
return;
}
parent.removeChild(node);
}
| 14.133333
| 46
| 0.617925
|
e22fc010589ccd6230e975965fd6452506902f24
| 1,857
|
js
|
JavaScript
|
src/utils/__tests__/bindCommands-test.js
|
lpan/react-term
|
abdc549918d34b6689ea35e11475b762021e6246
|
[
"MIT"
] | 14
|
2016-08-21T22:18:34.000Z
|
2018-12-25T17:14:39.000Z
|
src/utils/__tests__/bindCommands-test.js
|
lpan/react-term
|
abdc549918d34b6689ea35e11475b762021e6246
|
[
"MIT"
] | 7
|
2016-08-19T17:50:52.000Z
|
2017-02-03T19:13:54.000Z
|
src/utils/__tests__/bindCommands-test.js
|
lpan/react-term
|
abdc549918d34b6689ea35e11475b762021e6246
|
[
"MIT"
] | 1
|
2016-08-08T01:55:33.000Z
|
2016-08-08T01:55:33.000Z
|
jest.unmock('../bindCommands');
import bindCommands from '../bindCommands';
import mockComponent from '../../__mocks__/component';
import {pick} from 'ramda';
const pickState = pick(['history', 'visibles']);
describe('bindCommands()', () => {
it('should bind commands to "this" and update the state', () => {
const component = mockComponent();
const mockCommands = {
ls: () => 'ls',
lmao: () => 'lmao',
};
const finalCommands = bindCommands(mockCommands, component);
finalCommands.ls('ls -l');
finalCommands.lmao('lmao');
expect(pickState(component.state)).toEqual({
history: ['ls -l', 'lmao'],
visibles: [
{
command: 'ls -l',
currentPath: [],
outputs: ['ls'],
},
{
command: 'lmao',
currentPath: [],
outputs: ['lmao'],
},
],
});
});
it('does not update the state if the function returns undefined', () => {
const component = mockComponent();
const mockCommands = {
clear: () => {},
};
const finalCommands = bindCommands(mockCommands, component);
finalCommands.clear('clear');
expect(pickState(component.state)).toEqual({
history: ['clear'],
visibles: [{
command: 'clear',
currentPath: [],
outputs: [],
}],
});
});
it('handles promises', done => {
const component = mockComponent();
const mockCommands = {
wait: () => new Promise(resolve => {
resolve('yo');
done();
}),
};
const finalCommands = bindCommands(mockCommands, component);
finalCommands.wait('wait');
expect(pickState(component.state)).toEqual({
history: ['wait'],
visibles: [{
command: 'wait',
currentPath: [],
outputs: ['yo'],
}],
});
});
});
| 23.2125
| 75
| 0.536887
|
300a3b7f40f0106a1bdf711b0fa54196dff9fc88
| 3,423
|
kt
|
Kotlin
|
app/src/main/java/xyz/weatherpoints/weatherpoints/ui/MapsActivity.kt
|
orbitbot/weatherpoints
|
2cb203213716094bb8139146f1d850000643bd13
|
[
"MIT"
] | null | null | null |
app/src/main/java/xyz/weatherpoints/weatherpoints/ui/MapsActivity.kt
|
orbitbot/weatherpoints
|
2cb203213716094bb8139146f1d850000643bd13
|
[
"MIT"
] | null | null | null |
app/src/main/java/xyz/weatherpoints/weatherpoints/ui/MapsActivity.kt
|
orbitbot/weatherpoints
|
2cb203213716094bb8139146f1d850000643bd13
|
[
"MIT"
] | null | null | null |
package xyz.weatherpoints.weatherpoints.ui
import android.os.Bundle
import android.widget.Toast
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.OnMapReadyCallback
import com.google.android.gms.maps.SupportMapFragment
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
import xyz.weatherpoints.weatherpoints.R
import xyz.weatherpoints.weatherpoints.domain.LocationData
import xyz.weatherpoints.weatherpoints.domain.WeatherData
import xyz.weatherpoints.weatherpoints.util.BaseActivity
import javax.inject.Inject
class MapsActivity : BaseActivity() {
private lateinit var mMap: GoogleMap
private lateinit var compositeDisposable: CompositeDisposable
@Inject
lateinit var weatherData: WeatherData
@Inject
lateinit var locationData: LocationData
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_maps)
val mapFragment = supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment
// If Google Play services is not installed on the device, the user will be prompted to install
// it inside the SupportMapFragment. This method will only be triggered once the user has
// installed Google Play services and returned to the app.
//
// race condition wrt compositeDisposable? :)
mapFragment.getMapAsync(object : OnMapReadyCallback {
override fun onMapReady(googleMap: GoogleMap) {
mMap = googleMap
mMap.setOnMapLongClickListener { latLng ->
Timber.d("Clicked map - %s", latLng)
val lat = String.format("%.2f", latLng.latitude)
val lon = String.format("%.2f", latLng.longitude)
compositeDisposable.add(
locationData.getLocationNameFor(latLng.latitude, latLng.longitude, this@MapsActivity)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ next ->
Timber.d("got location %s", next)
Toast.makeText(this@MapsActivity, next, Toast.LENGTH_SHORT).show()
}, { error ->
Timber.e(error)
})
)
compositeDisposable.add(
weatherData.getWeatherDataFor(lat, lon)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ next ->
Timber.d("got temperature %s", next)
Toast.makeText(this@MapsActivity, next, Toast.LENGTH_SHORT).show()
}, { error ->
Timber.e(error)
})
)
}
}
})
}
override fun onResume() {
super.onResume()
compositeDisposable = CompositeDisposable()
}
override fun onPause() {
super.onPause()
compositeDisposable.dispose()
}
}
| 39.802326
| 109
| 0.5948
|
cf36609064cc1f3fba4c8da28281e602a1bde19f
| 1,786
|
sql
|
SQL
|
pois.sql
|
GrupoPIIS/pois
|
702c42bb43e8a10c37a1f7dd76e8e5466932e1b6
|
[
"MIT"
] | null | null | null |
pois.sql
|
GrupoPIIS/pois
|
702c42bb43e8a10c37a1f7dd76e8e5466932e1b6
|
[
"MIT"
] | null | null | null |
pois.sql
|
GrupoPIIS/pois
|
702c42bb43e8a10c37a1f7dd76e8e5466932e1b6
|
[
"MIT"
] | 1
|
2015-03-18T11:52:14.000Z
|
2015-03-18T11:52:14.000Z
|
-- phpMyAdmin SQL Dump
-- version 4.2.11
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 24-03-2015 a las 00:07:29
-- Versión del servidor: 5.6.21
-- Versión de PHP: 5.6.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `pois`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pois`
--
CREATE TABLE IF NOT EXISTS `pois` (
`id` int(10) NOT NULL,
`nombre` varchar(70) NOT NULL,
`loc` varchar(70) NOT NULL,
`lema` varchar(200) NOT NULL,
`desc` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `pois`
--
INSERT INTO `pois` (`id`, `nombre`, `loc`, `lema`, `desc`) VALUES
(1, 'los antonios', '34.333442, 0.23456', 'Los mejores bocatas', 'Es un restaurante de comida rápida destinado a llevar el arte del bocadillo a altas cotas de excelencia'),
(2, 'Las mulas', '34.5563, 0.368928', 'Tasca típica murciana', 'Taberna tradicional murciana con más de 100 años de experiencia');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `pois`
--
ALTER TABLE `pois`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `pois`
--
ALTER TABLE `pois`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
/*!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 */;
| 26.656716
| 172
| 0.680851
|
443127ababa992a1158ecc86780f973e2ea79292
| 6,897
|
py
|
Python
|
tests/generation/vres/potentials/glaes/test_manager.py
|
montefesp/EPIPPy
|
7de873cf70d06986e83a434b6ab4b8997694a269
|
[
"MIT"
] | null | null | null |
tests/generation/vres/potentials/glaes/test_manager.py
|
montefesp/EPIPPy
|
7de873cf70d06986e83a434b6ab4b8997694a269
|
[
"MIT"
] | null | null | null |
tests/generation/vres/potentials/glaes/test_manager.py
|
montefesp/EPIPPy
|
7de873cf70d06986e83a434b6ab4b8997694a269
|
[
"MIT"
] | null | null | null |
import pytest
from epippy.generation.vres.potentials.glaes import *
# All these tests were run with a pixelRes set to 1000
def check_correctness(expected, actual):
assert np.abs(actual - expected) / expected < 0.05
def test_get_glaes_prior_defaults_empty_config_list():
with pytest.raises(AssertionError):
get_glaes_prior_defaults([])
def test_get_glaes_prior_defaults_wrong_exclusion_file():
with pytest.raises(AssertionError):
get_glaes_prior_defaults(["wrong"])
def test_get_glaes_prior_defaults_wrong_subconfig():
with pytest.raises(AssertionError):
get_glaes_prior_defaults(["holtinger", "wrong"])
def test_get_glaes_prior_defaults_absent_prior():
with pytest.raises(AssertionError):
get_glaes_prior_defaults(["holtinger", "wind_onshore", "min"], ["wrong"])
def test_get_glaes_prior_defaults_all_priors():
dct = get_glaes_prior_defaults(["holtinger", "wind_onshore", "min"])
assert len(dct.keys()) == 18
def test_get_glaes_prior_defaults():
priors = ["airport_proximity", "river_proximity"]
dct = get_glaes_prior_defaults(["holtinger", "wind_onshore", "min"], priors)
assert len(dct.keys()) == len(priors)
assert all([p in dct for p in priors])
def test_compute_land_availability_missing_globals():
onshore_shape = get_shapes(["BE"], "onshore").loc["BE", "geometry"]
with pytest.raises(NameError):
compute_land_availability(onshore_shape)
def test_compute_land_availability_empty_filters():
onshore_shape = get_shapes(["BE"], "onshore").loc["BE", "geometry"]
init_land_availability_globals({})
availability = compute_land_availability(onshore_shape)
check_correctness(30683.0, availability)
offshore_shape = get_shapes(["BE"], "offshore").loc["BE", "geometry"]
init_land_availability_globals({})
availability = compute_land_availability(offshore_shape)
check_correctness(3454.0, availability)
def test_compute_land_availability_esm():
onshore_shape = get_shapes(["BE"], "onshore").loc["BE", "geometry"]
filters = {'esm': True}
init_land_availability_globals(filters)
availability = compute_land_availability(onshore_shape)
check_correctness(11542.83, availability)
def test_compute_land_availability_glaes_priors():
onshore_shape = get_shapes(["BE"], "onshore").loc["BE", "geometry"]
filters = {'glaes_priors': {'settlement_proximity': (None, 1000)}}
init_land_availability_globals(filters)
availability = compute_land_availability(onshore_shape)
check_correctness(6122.68, availability)
offshore_shape = get_shapes(["BE"], "offshore").loc["BE", "geometry"]
filters = {'glaes_priors': {'shore_proximity': [(None, 20e3), (370e3, None)]}}
init_land_availability_globals(filters)
availability = compute_land_availability(offshore_shape)
check_correctness(2125.0, availability)
def test_compute_land_availability_natura():
onshore_shape = get_shapes(["BE"], "onshore").loc["BE", "geometry"]
filters = {'natura': 1}
init_land_availability_globals(filters)
availability = compute_land_availability(onshore_shape)
check_correctness(26821.79, availability)
offshore_shape = get_shapes(["BE"], "offshore").loc["BE", "geometry"]
filters = {'natura': 1}
init_land_availability_globals(filters)
availability = compute_land_availability(offshore_shape)
check_correctness(2197.84, availability)
def test_compute_land_availability_gebco():
onshore_shape = get_shapes(["BE"], "onshore").loc["BE", "geometry"]
filters = {'altitude_threshold': 300}
init_land_availability_globals(filters)
availability = compute_land_availability(onshore_shape)
check_correctness(24715.12, availability)
offshore_shape = get_shapes(["BE"], "offshore").loc["BE", "geometry"]
filters = {'depth_thresholds': {'low': -50, 'high': -10}}
init_land_availability_globals(filters)
availability = compute_land_availability(offshore_shape)
check_correctness(2828.41, availability)
def test_compute_land_availability_emodnet():
offshore_shape = get_shapes(["BE"], "offshore").loc["BE", "geometry"]
filters = {'cables': 500}
init_land_availability_globals(filters)
availability = compute_land_availability(offshore_shape)
check_correctness(3115.0, availability)
filters = {'pipelines': 500}
init_land_availability_globals(filters)
availability = compute_land_availability(offshore_shape)
check_correctness(3287.0, availability)
filters = {'shipping': (100, None)}
init_land_availability_globals(filters)
availability = compute_land_availability(offshore_shape)
check_correctness(1661.0, availability)
def test_get_land_availability_for_shapes_empty_list_of_shapes():
with pytest.raises(AssertionError):
get_land_availability_for_shapes([], {})
def test_get_land_availability_for_shapes_mp_vs_non_mp():
onshore_shapes = get_shapes(["BE", "NL"], "onshore")["geometry"]
filters = {'glaes_priors': {'settlement_proximity': (None, 1000)}}
availabilities_mp = get_land_availability_for_shapes(onshore_shapes, filters)
availabilities_non_mp = get_land_availability_for_shapes(onshore_shapes, filters, 1)
assert len(availabilities_mp) == 2
assert all([availabilities_mp[i] == availabilities_non_mp[i] for i in range(2)])
def test_get_capacity_potential_for_shapes():
onshore_shapes = get_shapes(["BE", "NL"], "onshore")["geometry"]
filters = {'glaes_priors': {'settlement_proximity': (None, 1000)}}
power_density = 10
capacities = get_capacity_potential_for_shapes(onshore_shapes, filters, power_density)
assert len(capacities) == 2
check_correctness(61.2268, capacities[0])
check_correctness(198.8756, capacities[1])
offshore_shapes = get_shapes(["BE", "NL"], "offshore")["geometry"]
filters = {'natura': 1}
power_density = 15
capacities = get_capacity_potential_for_shapes(offshore_shapes, filters, power_density)
assert len(capacities) == 2
check_correctness(32.9676, capacities[0])
check_correctness(715.9119, capacities[1])
def test_get_capacity_potential_per_country():
filters = {'glaes_priors': {'settlement_proximity': (None, 1000)}}
power_density = 10
capacities_ds = get_capacity_potential_per_country(["BE", "NL"], True, filters, power_density)
assert isinstance(capacities_ds, pd.Series)
assert len(capacities_ds) == 2
check_correctness(61.2268, capacities_ds["BE"])
check_correctness(198.8756, capacities_ds["NL"])
filters = {'natura': 1}
power_density = 15
capacities_ds = get_capacity_potential_per_country(["BE", "NL"], False, filters, power_density)
assert isinstance(capacities_ds, pd.Series)
assert len(capacities_ds) == 2
check_correctness(32.9676, capacities_ds["BE"])
check_correctness(715.9119, capacities_ds["NL"])
| 39.1875
| 99
| 0.741047
|
4bbcba3f99be41d8174b62dabf87da70e8d40297
| 2,099
|
c
|
C
|
experiments/nursery.c
|
Lemmih/lhc
|
53bfa57b9b7275b7737dcf9dd620533d0261be66
|
[
"Unlicense"
] | 193
|
2015-01-07T01:25:13.000Z
|
2022-01-07T13:52:13.000Z
|
experiments/nursery.c
|
lemmih/lhc
|
53bfa57b9b7275b7737dcf9dd620533d0261be66
|
[
"Unlicense"
] | 9
|
2017-10-25T04:10:33.000Z
|
2019-06-27T06:30:34.000Z
|
experiments/nursery.c
|
lemmih/lhc
|
53bfa57b9b7275b7737dcf9dd620533d0261be66
|
[
"Unlicense"
] | 19
|
2015-05-12T13:25:29.000Z
|
2021-02-13T21:01:38.000Z
|
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*
0: 21.4% 1 kb 16.65
1: 12.5% 2 kb 19.22
2: 6.9% 4 kb 20.94
3: 3.8% 8 kb 21.78
4: 2.0% 16 kb 22.35
5: 2.1% 32 kb 22.34
6: 11.4% 64 kb 20.18
7: 11.4% 128 kb 20.24
8: 13.1% 256 kb 19.86
9: 17.8% 512 kb 18.70
10: 18.6% 1 mb 18.59
11: 21.3% 2 mb 17.55
12: 45.8% 4 mb 12.33
13: 58.9% 8 mb 9.32
14: 61.0% 16 mb 8.83
15: 61.7% 32 mb 8.65
16: 61.9% 64 mb 8.58
17: 62.8% 128 mb 8.67
*/
#define STEPS 17
#define WORD_SIZE ((uint64_t)sizeof(uint64_t))
// write size in kb. set to 32gb.
#define WRITE_SIZE (1024*1024*32)
int main() {
uint64_t i,j,n;
uint64_t *nursery;
printf("Allocating nursery, %d mb:\t", (1024<<(STEPS-1))/1024/1024);
fflush(stdout);
nursery = (uint64_t*) malloc(1024<<(STEPS-1));
printf("Done.\n");
// heap = (uint64_t*) malloc(HEAP_SIZE*WORD_SIZE);
// printf("Heap: %lu MiBi\n", HEAP_SIZE*WORD_SIZE/1024/1024);
// printf("Nursery: %d KiBi\n", SIZE*WORD_SIZE/1024);
// printf("Iterations: %lu\n", ITERATIONS);
// printf("Memory being written: %lu MiBi\n", (SIZE*ITERATIONS/1024/1024)*WORD_SIZE);
printf("Warm up:\t\t\t");
fflush(stdout);
// Warm up
for(n=STEPS-3;n<STEPS;n++) {
uint64_t size = 128<<n;
uint64_t iterations = WRITE_SIZE>>n;
for(j=0;j<iterations;j++) {
for(i=0;i<size;i++) {
nursery[i]=i;
}
}
}
printf("Done.\n");
for(n=0;n<STEPS;n++) {
uint64_t size = 128<<n;
uint64_t iterations = WRITE_SIZE>>n;
clock_t start, end;
printf("Testing nursery size: %lu kb:\t", (size*WORD_SIZE)/1024);
fflush(stdout);
start = clock();
for(j=0;j<iterations;j++) {
for(i=0;i<size;) {
nursery[i++]=0xDEADBEEF;
nursery[i++]=i;
nursery[i++]=i;
nursery[i++]=i;
}
}
end = clock();
printf("%.2f gb/s\n", WRITE_SIZE/((end-start)/(double)CLOCKS_PER_SEC)/1024/1024);
}
// for(j=0;j<(uint64_t)ITERATIONS*SIZE;j++) {
// nursery[j%SIZE]=j%SIZE;
// }
return (int)nursery[0]; // + *heap;
}
| 25.91358
| 87
| 0.565984
|
e5f062ebe80e5607b9e4e1045d6babf1aa12da84
| 786
|
lua
|
Lua
|
2010/kuroScript/hl2rp/gamemount/mounts/writing/scheme/directory/cl_writing.lua
|
kurozael/project-archive
|
dcac1a9a8dee65c11f4a631ec08d6eef320f5ad0
|
[
"MIT"
] | null | null | null |
2010/kuroScript/hl2rp/gamemount/mounts/writing/scheme/directory/cl_writing.lua
|
kurozael/project-archive
|
dcac1a9a8dee65c11f4a631ec08d6eef320f5ad0
|
[
"MIT"
] | null | null | null |
2010/kuroScript/hl2rp/gamemount/mounts/writing/scheme/directory/cl_writing.lua
|
kurozael/project-archive
|
dcac1a9a8dee65c11f4a631ec08d6eef320f5ad0
|
[
"MIT"
] | 2
|
2020-03-16T22:49:09.000Z
|
2022-01-02T23:04:32.000Z
|
--[[
Name: "cl_clocks.lua".
Product: "HL2 RP".
--]]
local HELP = [[
<html>
<font face="Arial" size="2">
<center>
<font color="red" size="4">Writing and Paper</font>
</center>
<p>
In HL2 RP you have the ability to write things down, to say make personal notes for yourself or leave them for others. To do so you must first have paper.
You can buy paper from any merchant. Once you have the paper, go into your inventory, click on it and hit use. The paper will be dropped onto the ground.
Look at the paper and press use to write on it, if paper has already been written on it cannot be written on again - but you can press use to read it.
</p>
</font>
</html>
]];
-- Add a HTML category.
kuroScript.directory.AddHTMLCategory("Writing and Paper", "HL2 RP", HELP);
| 35.727273
| 157
| 0.694656
|
4d7b57e281f7e3bdf78f952f7cb0d1ccac250227
| 19,104
|
cs
|
C#
|
Squishy.Irc/Commands/DefaultCommands.cs
|
Domiii/Squishy.IRC
|
de8e1834cf43db5fbafb02a60cf964f6038863b3
|
[
"MIT"
] | 1
|
2016-09-22T03:04:35.000Z
|
2016-09-22T03:04:35.000Z
|
Squishy.Irc/Commands/DefaultCommands.cs
|
Domiii/Squishy.IRC
|
de8e1834cf43db5fbafb02a60cf964f6038863b3
|
[
"MIT"
] | null | null | null |
Squishy.Irc/Commands/DefaultCommands.cs
|
Domiii/Squishy.IRC
|
de8e1834cf43db5fbafb02a60cf964f6038863b3
|
[
"MIT"
] | null | null | null |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Reflection;
using Squishy.Irc.Dcc;
using Squishy.Irc.Protocol;
using WCell.Util;
using WCell.Util.Commands;
namespace Squishy.Irc.Commands
{
/// <summary>
/// TODO: Use localized strings
/// The help command is special since it generates output.
/// This output needs to be shown in the GUI if used from commandline and
/// sent to the requester if executed remotely.
/// </summary>
public class HelpCommand : IrcCommand
{
public static int MaxUncompressedCommands = 3;
protected override void Initialize()
{
Init("Help", "?");
EnglishParamInfo = "[<match>]";
EnglishDescription = "Shows an overview over all Commands or -if you specify a <match>- the help for any matching commands.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
var cmdHandler = trigger.Args.IrcClient.CommandHandler;
List<BaseCommand<IrcCmdArgs>> cmds;
if (trigger.Text.HasNext)
{
// help for a specific command
var cmdStr = trigger.Text.Remainder;
cmds = cmdHandler.GetCommands(cmdStr);
var count = cmds.Count;
foreach (var cmd in cmds)
{
if (cmdHandler.MayDisplay(trigger, cmd, false))
{
cmdHandler.DisplayCmd(trigger, cmd, false, true);
}
else
{
count--;
}
}
if (count == 0)
{
trigger.ReplyFormat("Did not find any Command that matches '{0}'.", cmdStr);
}
}
else
{
// help for all commands
cmds = new List<BaseCommand<IrcCmdArgs>>();
foreach (var cmd in cmdHandler.Commands)
{
if (cmdHandler.MayDisplay(trigger, cmd, false))
{
cmds.Add(cmd);
}
}
trigger.Reply("Use: ? <Alias> [<subalias> [<subalias> ...]] for help on a certain command. - All current commands:");
}
string line = "";
foreach (var cmd in cmds)
{
if (cmds.Count <= MaxUncompressedCommands)
{
trigger.Reply(cmd.CreateUsage(trigger));
}
else
{
var info = cmd.Name + " (" + cmd.Aliases.ToString(", ") + ") ";
if (line.Length + info.Length >= IrcProtocol.MaxLineLength)
{
trigger.Reply(line);
line = "";
}
line += info;
}
}
if (line.Length > 0)
{
trigger.Reply(line);
}
}
}
public class VersionCommand : IrcCommand
{
protected override void Initialize()
{
Init("Version");
EnglishDescription = "Shows the version of this client.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
//trigger.Reply(IrcClient.Version);
AssemblyName asmName = Assembly.GetAssembly(GetType()).GetName();
trigger.Reply(asmName.Name + ", v" + asmName.Version);
}
}
public class JoinCommand : IrcCommand
{
protected override void Initialize()
{
Init("Join", "J");
EnglishParamInfo = "<Channel>";
EnglishDescription = "Joins a channel";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Join(trigger.Text.NextWord());
}
//public override string[] ExpectedServResponses {
// get {
// return new string[] {
// "JOIN",
// "405", // Too many channels
// "471", // Cannot join channel (+l)
// "473", // Cannot join channel (+i)
// "474", // Cannot join channel (+b)
// "475", // Cannot join channel (+k)
// "477", // need to register
// "485" // Cannot join channel
// };
// }
//}
}
public class AuthCommand : IrcCommand
{
protected override void Initialize()
{
Init("Auth");
EnglishDescription = "Will query the Authentication data from the server if not already present.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
var user = trigger.Args.User;
if (user == null)
{
trigger.Reply("AuthCommand requires User-argument.");
}
else
{
if (user.IsAuthenticated)
{
trigger.Reply("User {0} is authed as: {1}", user.Nick, user.AuthName);
}
else
{
var authMgr = trigger.Args.IrcClient.AuthMgr;
if (authMgr.IsResolving(user))
{
trigger.Reply("User {0} is being resolved - Please wait...", user.Nick, user.AuthName);
}
else if (!authMgr.CanResolve)
{
trigger.Reply("Authentication is not supported on this Network.");
}
else
{
trigger.Reply("Resolving User...".Colorize(IrcColorCode.Red));
if (!user.ResolveAuthentication())
{
trigger.Reply("Failed to resolve user - This network's authentication method is probably not supported.".Colorize(IrcColorCode.Red));
}
}
}
}
}
//public override string[] ExpectedServResponses {
// get {
// return new string[] {
// "JOIN",
// "405", // Too many channels
// "471", // Cannot join channel (+l)
// "473", // Cannot join channel (+i)
// "474", // Cannot join channel (+b)
// "475", // Cannot join channel (+k)
// "477", // need to register
// "485" // Cannot join channel
// };
// }
//}
}
public class NickCommand : IrcCommand
{
protected override void Initialize()
{
Init("Nick");
EnglishParamInfo = "<NewNnick>";
EnglishDescription = "Changes your current nickname.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Nick(trigger.Text.NextWord());
}
}
public class TopicCommand : IrcCommand
{
protected override void Initialize()
{
Init("Topic");
EnglishParamInfo = "[<Channel>] <Topic>";
EnglishDescription = "Changes the Topic in the given Channel (if possible). The channel parameter will only be accepted if not used in a Channel.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
var chan = trigger.Args.Channel;
if (chan == null)
{
chan = trigger.Args.IrcClient.GetChannel(trigger.Text.NextWord());
if (chan == null)
{
trigger.Reply("Invalid Channel.");
return;
}
}
chan.Topic = trigger.Text.Remainder;
}
}
public class PartCommand : IrcCommand
{
protected override void Initialize()
{
Init("Part");
EnglishParamInfo = "[<Channel> [<Reason>]]";
EnglishDescription = "Parts a given channel (or the channel of origin if no argument given) with an optional reason";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
var target = trigger.Text.NextWord();
if (target.Length == 0)
{
target = trigger.Args.Channel.Name;
}
trigger.Args.IrcClient.CommandHandler.Part(target,
trigger.Text.Remainder.Trim());
}
}
public class PartThisCommand : IrcCommand
{
protected override void Initialize()
{
Init("PartThis");
EnglishParamInfo = "[<Reason>]";
EnglishDescription = "Parts the channel from where the trigger originated";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Part(trigger.Args.Channel,
trigger.Text.Remainder.Trim());
}
}
public class MsgCommand : IrcCommand
{
protected override void Initialize()
{
Init("Msg", "Message", "Privmsg");
EnglishParamInfo = "<Target> <Text>";
EnglishDescription = "Sends a privmsg to the specified target";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Msg(trigger.Text.NextWord(), trigger.Text.Remainder.Trim());
}
}
public class NoticeCommand : IrcCommand
{
protected override void Initialize()
{
Init("Notice");
EnglishParamInfo = "<Target> <Text>";
EnglishDescription = "Sends a notice to the specified target";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Notice(trigger.Text.NextWord(), trigger.Text.Remainder.Trim());
}
}
public class CtcpRequestCommand : IrcCommand
{
protected override void Initialize()
{
Init("Ctcp");
EnglishParamInfo = "<Target> <Request> [<arguments>]";
EnglishDescription = "Sends a ctcp - request to a target";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.CtcpRequest(trigger.Text.NextWord(), trigger.Text.NextWord(),
trigger.Text.Remainder.Trim());
}
}
public class KickCommand : IrcCommand
{
protected override void Initialize()
{
Init("Kick");
EnglishParamInfo = "<Channel> <User> [<Reason>]";
EnglishDescription = "Kicks a user from a channel with an optional reason";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Kick(trigger.Text.NextWord(), trigger.Text.NextWord(),
trigger.Text.Remainder.Trim());
}
}
public class KickMaskCommand : IrcCommand
{
protected override void Initialize()
{
Init("KickMask", "KickM");
EnglishParamInfo = "<Channel> <Mask> [<Reason>]";
EnglishDescription = "Kicks all users with a specified mask for an optional reason";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
string chanName = trigger.Text.NextWord();
IrcChannel chan = trigger.Args.IrcClient.GetChannel(chanName);
if (chan != null)
{
string mask = trigger.Text.NextWord();
foreach (IrcUser user in chan)
{
if (user.Matches(mask))
trigger.Args.IrcClient.CommandHandler.Kick(chanName, user.Nick, trigger.Text.Remainder.Trim());
}
}
}
}
public class ModeCommand : IrcCommand
{
protected override void Initialize()
{
Init("Mode");
EnglishParamInfo = "<flags> <targets>";
EnglishDescription = "Sets the specified mode";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Mode(trigger.Text.Remainder.Trim());
}
}
public class BanCommand : IrcCommand
{
protected override void Initialize()
{
Init("Ban");
EnglishParamInfo = "[-u <seconds>] <Channel> <Mask1> <Mask2> ...";
EnglishDescription =
"Bans masks from a channel. " +
"If the -u switch is specified, the following argument must be the number of seconds before the masks are automatically unbanned again.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
string word = trigger.Text.NextWord();
string target = trigger.Text.NextWord();
if (word.Equals("-u"))
{
TimeSpan time = TimeSpan.FromSeconds(trigger.Text.NextInt());
trigger.Args.IrcClient.CommandHandler.Ban(target, time, trigger.Text.RemainingWords());
}
else
{
trigger.Args.IrcClient.CommandHandler.Ban(target, trigger.Text.RemainingWords());
}
}
}
public class UnbanCommand : IrcCommand
{
protected override void Initialize()
{
Init("Unban");
EnglishParamInfo = "<Channel> <Mask1> <Mask2> ...";
EnglishDescription = "Unbans given masks from a channel";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Unban(trigger.Text.NextWord(), trigger.Text.RemainingWords());
}
}
public class InviteCommand : IrcCommand
{
protected override void Initialize()
{
Init("Invite");
EnglishParamInfo = "<Nick> [<Channel>]";
EnglishDescription = "Invites a person into a channel. Invites into the channel of origin if channel is left out.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
string nick = trigger.Text.NextWord();
string target = trigger.Text.NextWord();
if (target.Length == 0)
{
target = trigger.Args.Channel.Name;
}
trigger.Args.IrcClient.CommandHandler.Invite(nick, target);
}
}
public class InviteMeCommand : IrcCommand
{
protected override void Initialize()
{
Init("InviteMe");
EnglishParamInfo = "<Channel>";
EnglishDescription = "Invites the triggering user into a channel.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.Invite(trigger.Args.User, trigger.Text.NextWord());
}
}
public class BanListCommand : IrcCommand
{
protected override void Initialize()
{
Init("BanList", "ListBans");
EnglishParamInfo = "<channel>";
EnglishDescription = "Retrieves the active banmasks from a channel";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.CommandHandler.RetrieveBanList(trigger.Text.NextWord());
}
}
public class SetInfoCommand : IrcCommand
{
protected override void Initialize()
{
Init("SetInfo", "ChangeInfo");
EnglishParamInfo = "<userinfo>";
EnglishDescription = "Changes your user-info (will have effect after reconnect)";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.Info = trigger.Text.NextWord();
}
}
public class SetPwCommand : IrcCommand
{
protected override void Initialize()
{
Init("SetPw", "SetPass", "ChangePass");
EnglishParamInfo = "<newPassword>";
EnglishDescription = "Changes your password (will have effect after reconnect)";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.ServerPassword = trigger.Text.NextWord();
}
}
public class SetUsernameCommand : IrcCommand
{
protected override void Initialize()
{
Init("SetUser", "SetUsername");
EnglishParamInfo = "<username>";
EnglishDescription = "Changes your username (will have effect after reconnect)";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.UserName = trigger.Text.NextWord();
}
}
public class SetNicksCommand : IrcCommand
{
protected override void Initialize()
{
Init("SetNicks");
EnglishParamInfo = "<nick>[ <nick2> [<nick3>...]]";
EnglishDescription = "Changes your default nicknames (seperated by space).";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.Nicks = trigger.Text.RemainingWords();
}
}
public class ConnectCommand : IrcCommand
{
protected override void Initialize()
{
Init("Connect", "Con");
EnglishParamInfo = "[<address> [<port>]]";
EnglishDescription = "(Re)connects to the given server.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
string addr = trigger.Text.NextWord();
int port = trigger.Args.IrcClient.Client.RemotePort;
if (addr.Length == 0)
{
addr = trigger.Args.IrcClient.Client.RemoteAddress;
}
else
{
port = trigger.Text.NextInt(port);
}
trigger.Args.IrcClient.Client.Disconnect();
trigger.Args.IrcClient.BeginConnect(addr, port);
}
}
public class DisconnectCommand : IrcCommand
{
protected override void Initialize()
{
Init("Disconnect", "Discon");
EnglishParamInfo = "";
EnglishDescription = "Disconnects the current connection";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.Client.DisconnectNow();
}
}
public class SetExternalIPCommand : IrcCommand
{
protected override void Initialize()
{
Init("SetExternalIP");
EnglishParamInfo = "<Ip>";
EnglishDescription = "Changes your Util.ExternalAddres. This is used for DCC sessions and to bind local sockets to, if possible.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
Util.ExternalAddress = IPAddress.Parse(trigger.Text.NextWord());
}
}
#region DCC
public class DccSendCommand : IrcCommand
{
protected override void Initialize()
{
Init("DccSend");
EnglishParamInfo = "<filename> [<port> [<target>]]";
EnglishDescription = "Tries to send a file to a user.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
string filename = trigger.Text.NextWord();
var port = trigger.Text.NextInt(0);
string target = trigger.Text.NextWord();
if (target.Length == 0)
{
target = trigger.Args.User.Nick;
}
trigger.Args.IrcClient.Dcc.Send(target, filename, port);
}
}
public class DccChatCommand : IrcCommand
{
protected override void Initialize()
{
Init("DccChat");
EnglishParamInfo = "<target> [<port> [<text>]]";
EnglishDescription =
"Tries to establish a direct Chat session with the specified target or sends the given text if the connection is already established.";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
var nick = trigger.Text.NextWord();
var port = trigger.Text.NextInt(0);
var client = trigger.Args.IrcClient.Dcc.GetChatClient(nick);
if (client == null)
{
trigger.Args.IrcClient.Dcc.Chat(nick, port);
}
else
{
client.Send(trigger.Text.Remainder.Trim());
}
}
}
//public class StatsCommand : IrcCommand {
// protected override void Initialize()
// {
// Init("Stats");
// EnglishParamInfo ="<options>";
// EnglishDescription = "Queries server stats.";
// }
// public override void Process(CmdTrigger<IrcCmdArgs> trigger) {
// trigger.Args.IrcClient.Send("STATS " + trigger.Text.Remainder.Trim());
// }
//}
#endregion
public class SendCommand : IrcCommand
{
protected override void Initialize()
{
Init("Send");
EnglishParamInfo = "<args>";
EnglishDescription = "Sends the given args as-is to the server (raw).";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger)
{
trigger.Args.IrcClient.Send(trigger.Text.Remainder.Trim());
}
}
/*
public class EchoCommand : IrcCommand {
protected override void Initialize() {
Init("echo","e","ech") {
EnglishParamInfo ="Echo <text>";
EnglishDescription = "Echo'str some evluated text in the active window";
}
public override void Process(CmdTrigger<IrcCmdArgs> trigger) {
Match match = (new Regex(@"\$([^ ]+)")).Match(args);
Type type = typeof(IrcConnection);
while (match.Success) {
string var = match.Groups[1].Value;
PropertyInfo prop = type.GetProperty(var, BindingFlags.IgnoreCase);
if (prop != null) {
args = args.Replace(var, prop.GetValue(trigger.Args.IrcClient, new object[0]).ToString());
}
match = match.NextMatch();
}
Window.Active.WriteLine(args.Replace("$active", Window.Active.Text));
}
}*/
}
| 27.330472
| 151
| 0.640128
|
852df16441f310e2e4f1083fbf959b2aec9449a2
| 662
|
dart
|
Dart
|
lib/src/entities/apps/configuracoes.dart
|
venosyd/opensyd_dart
|
16ea2288e548c3fdbc829c6bed789d834ca590a1
|
[
"MIT"
] | null | null | null |
lib/src/entities/apps/configuracoes.dart
|
venosyd/opensyd_dart
|
16ea2288e548c3fdbc829c6bed789d834ca590a1
|
[
"MIT"
] | null | null | null |
lib/src/entities/apps/configuracoes.dart
|
venosyd/opensyd_dart
|
16ea2288e548c3fdbc829c6bed789d834ca590a1
|
[
"MIT"
] | null | null | null |
///
/// venosyd © 2016-2021.
///
/// sergio lisan <sels@venosyd.com>
///
library opensyd.entities.apps.config;
import 'dart:async';
import 'package:opensyd_dart/opensyd_dart.dart';
///
class Configuracoes extends OpensydEntity {
///
Configuracoes({String id}) : super(id, 'Configuracoes');
@override
Configuracoes fromJson(Map<String, dynamic> map) =>
Configuracoes(id: map['id'] as String)..json.addAll(map);
///
dynamic operator [](String key) => get<dynamic>(key);
///
void operator []=(String key, dynamic value) => set<dynamic>(key, value);
@override
Future<Configuracoes> deep(entities, {foreign, update}) async => this;
}
| 22.066667
| 75
| 0.672205
|
f66a34d1a949367dc11ecfc7994fe18fdef5ba41
| 1,306
|
swift
|
Swift
|
Kuri/Template/Wireframe/WireframeTemplate.swift
|
ktanaka117/Kuri
|
b42d9265c08fff9fd3ed74cc389f9601bcc5ab32
|
[
"MIT"
] | null | null | null |
Kuri/Template/Wireframe/WireframeTemplate.swift
|
ktanaka117/Kuri
|
b42d9265c08fff9fd3ed74cc389f9601bcc5ab32
|
[
"MIT"
] | null | null | null |
Kuri/Template/Wireframe/WireframeTemplate.swift
|
ktanaka117/Kuri
|
b42d9265c08fff9fd3ed74cc389f9601bcc5ab32
|
[
"MIT"
] | 1
|
2019-12-12T13:16:51.000Z
|
2019-12-12T13:16:51.000Z
|
import Foundation
struct WireframeTemplate: Templatable {
func interface() -> String {
return [
"//",
"// __WIREFRAME__.swift",
"// Kuri",
"//",
"// Created by __USERNAME__ on __DATE__.",
"// Copyright © 2016年 __USERNAME__. All rights reserved.",
"//",
"",
"import UIKit",
"",
"protocol __WIREFRAME__: class {",
" ",
"}",
].joined(separator: "\n")
}
func implement() -> String {
return [
"//",
"// __WIREFRAME__Impl.swift",
"// Kuri",
"//",
"// Created by __USERNAME__ on __DATE__.",
"// Copyright © 2016年 __USERNAME__. All rights reserved.",
"//",
"",
"import UIKit",
"",
"class __WIREFRAME__Impl: __WIREFRAME__ {",
" private weak var viewController: UIViewController!",
" ",
" init(",
" viewController: UIViewController",
" ) {",
" self.viewController = viewController",
" }",
"}",
].joined(separator: "\n")
}
}
| 27.208333
| 71
| 0.398928
|
61d358ca5f7f59e25a96ae886e351813d442a8dc
| 3,086
|
psm1
|
PowerShell
|
Configs/Petshop4AzureAutomation/Resources/xFileContent/DSCResources/MSFT_xFindAndReplace/MSFT_xFindAndReplace.psm1
|
grayzu/DSC_Examples
|
cd4b17ef540c104653b7dc6902d0ae7fd488ad13
|
[
"MIT"
] | null | null | null |
Configs/Petshop4AzureAutomation/Resources/xFileContent/DSCResources/MSFT_xFindAndReplace/MSFT_xFindAndReplace.psm1
|
grayzu/DSC_Examples
|
cd4b17ef540c104653b7dc6902d0ae7fd488ad13
|
[
"MIT"
] | null | null | null |
Configs/Petshop4AzureAutomation/Resources/xFileContent/DSCResources/MSFT_xFindAndReplace/MSFT_xFindAndReplace.psm1
|
grayzu/DSC_Examples
|
cd4b17ef540c104653b7dc6902d0ae7fd488ad13
|
[
"MIT"
] | 3
|
2016-02-17T19:02:30.000Z
|
2016-11-23T00:46:42.000Z
|
<#######################################################################################
# MSFT_xFindAndReplace : DSC Resource that will set/test/get the content of a file
# by replacing any instances of a pattern with the specified string.
#######################################################################################>
######################################################################################
# The Get-TargetResource cmdlet.
# This function will get the list of string instances that match the given pattern in the file.
######################################################################################
function Get-TargetResource
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$FilePath,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$Pattern,
[Parameter()]
[String]$ReplacementString = "",
[Parameter()]
[String[]] $MatchingString
)
$MatchingString = Select-String -Path $FilePath -Pattern $Pattern
$returnValue = @{
FilePath = $FilePath
Pattern = $Pattern
ReplacementString = $ReplacementString
MatchingString = $MatchingString
}
$returnValue
}
######################################################################################
# The Set-TargetResource cmdlet.
# This function will replace instances of thea string pattern with another string in the file.
######################################################################################
function Set-TargetResource
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$FilePath,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$Pattern,
[Parameter()]
[String]$ReplacementString = ""
)
if((($Content = get-content $FilePath) -match $Pattern).count -gt 0)
{
$i = 0
$Content | ForEach-Object {$_ -replace $Pattern, $ReplacementString; if($_ -match $Pattern){$i += 1}} | set-content $FilePath
Write-Verbose "Replaced $i instances of '$Pattern' in file $FilePath with '$ReplacementString'."
}
else
{
Write-Verbose "No instances of '$Pattern' were found in file $FilePath."
}
}
######################################################################################
# The Test-TargetResource cmdlet.
# This will test if the string pattern exists in the given file.
######################################################################################
function Test-TargetResource
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$FilePath,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$Pattern,
[Parameter()]
[String]$ReplacementString = ""
)
if(((get-content $FilePath) -match $Pattern).count -gt 0)
{
return $false # Not in the desired state
}
else
{
return $true # In the desired state
}
}
# FUNCTIONS TO BE EXPORTED
Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource
| 28.574074
| 133
| 0.510693
|
3fd405cbe958773ce407feb36ddad0f149e0ca68
| 804
|
rb
|
Ruby
|
lib/refinery/photo_gallery.rb
|
szajbus/refinerycms-photo-gallery
|
90bf74636a15238bff3425414ef82a97a2ecc951
|
[
"MIT"
] | null | null | null |
lib/refinery/photo_gallery.rb
|
szajbus/refinerycms-photo-gallery
|
90bf74636a15238bff3425414ef82a97a2ecc951
|
[
"MIT"
] | null | null | null |
lib/refinery/photo_gallery.rb
|
szajbus/refinerycms-photo-gallery
|
90bf74636a15238bff3425414ef82a97a2ecc951
|
[
"MIT"
] | null | null | null |
require 'refinerycms-core'
require 'refinerycms-settings'
module Refinery
autoload :PhotoGalleryGenerator, 'generators/refinery/photo_gallery_generator'
module PhotoGallery
autoload :Version, 'refinery/photo_gallery/version'
class << self
attr_writer :root
def root
@root ||= Pathname.new(File.expand_path('../../../', __FILE__))
end
def version
::Refinery::PhotoGallery::Version.to_s
end
def factory_paths
@factory_paths ||= [ root.join("spec/factories").to_s ]
end
end
require 'refinery/photo_gallery/engine'
require 'refinery/photo_gallery/configuration'
require 'refinery/photo_gallery/extensions/pages_extension'
require 'refinery/photo_gallery/extensions/pages_controller_extension'
end
end
| 25.125
| 80
| 0.705224
|
e26553c04cafa5848c91fe927e2f045d42674ceb
| 806
|
py
|
Python
|
airbnb/random_request.py
|
agroszer/airbnb-python
|
7a8d343877c673e9db42f25647e678266655af09
|
[
"WTFPL"
] | null | null | null |
airbnb/random_request.py
|
agroszer/airbnb-python
|
7a8d343877c673e9db42f25647e678266655af09
|
[
"WTFPL"
] | null | null | null |
airbnb/random_request.py
|
agroszer/airbnb-python
|
7a8d343877c673e9db42f25647e678266655af09
|
[
"WTFPL"
] | null | null | null |
import random
import uuid
import os
class RandomRequest(object):
def __init__(self):
pass
def get_random_user_agent(self):
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'files/supported_ios_versions.txt')) as f:
ios_versions = f.read().splitlines()
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'files/airbnb_versions.txt')) as f:
airbnb_versions = f.read().splitlines()
return "Airbnb/{} iPhone/{} Type/Phone".format(random.choice(airbnb_versions), random.choice(ios_versions))
def get_random_udid(self):
hex_digits = "0123456789abcdef"
return ''.join(random.choice(hex_digits) for _ in range(40))
def get_random_uuid(self):
return str(uuid.uuid4()).upper()
| 32.24
| 118
| 0.676179
|
33a1d171955b6940a7227633bc07995d19e3a01f
| 1,804
|
c
|
C
|
sources/libc16image_rw_tif/tif_read_til_all.c
|
sahwar/GTS
|
b25734116ea81eb0d7e2eabc8ce16cdd1c8b22dd
|
[
"BSD-3-Clause"
] | 1
|
2019-04-14T20:19:18.000Z
|
2019-04-14T20:19:18.000Z
|
sources/libc16image_rw_tif/tif_read_til_all.c
|
sahwar/GTS
|
b25734116ea81eb0d7e2eabc8ce16cdd1c8b22dd
|
[
"BSD-3-Clause"
] | null | null | null |
sources/libc16image_rw_tif/tif_read_til_all.c
|
sahwar/GTS
|
b25734116ea81eb0d7e2eabc8ce16cdd1c8b22dd
|
[
"BSD-3-Clause"
] | null | null | null |
#include <math.h> /* ceil() */
#include "ptbl_returncode.h"
#include "pri.h"
#include "tif.h"
int tif_read_til_all( TIF_IMAGE_RW *tp_read, void *vp_image, uint32_t ui32_width, uint32_t ui32_height, uint32_t ui32_tile_width, uint32_t ui32_tile_height, uint16_t ui16_channels, uint16_t ui16_bytes, int i_reverse_sw, int i_cv_sw )
{
int i_tile_count,i_tile_size;
uint8_t *ui8p_yy, *ui8p_xx;
uint32_t ui32_yy, ui32_xx;
i_tile_size =
(int)ceil( (double)ui32_height / ui32_tile_height ) *
(int)ceil( (double)ui32_width / ui32_tile_width );
/* カウントダウン表示始め */
if (ON == i_cv_sw) { pri_funct_cv_start( i_tile_size ); }
/* .tifファイルの読み込み位置 */
if (ON == i_reverse_sw) {
/* vp_imageデータのポインターを一番上の行に移動する */
ui8p_yy = (unsigned char *)vp_image +
(ui32_height-1) *
ui32_width *
ui16_channels *
ui16_bytes;
} else {
ui8p_yy = (unsigned char *)vp_image;
}
i_tile_count = 0;
for ( ui32_yy = 0;
ui32_yy < ui32_height;
ui32_yy += ui32_tile_height
) {
ui8p_xx = ui8p_yy;
for ( ui32_xx = 0;
ui32_xx < ui32_width;
ui32_xx += ui32_tile_width
) {
/* カウントダウン表示中 */
if (ON == i_cv_sw) {
pri_funct_cv_run(i_tile_count);
}
/* タイル読み込み */
if (NG == tif_read_tile(
tp_read, ui32_xx, ui32_yy,
(void *)ui8p_xx, i_reverse_sw
)) {
pri_funct_err_bttvr(
"Error : tif_read_tile(,%u,%u,,) returns NG.",
ui32_xx,ui32_yy );
return NG;
}
ui8p_xx +=
ui32_tile_width *
ui16_channels *
ui16_bytes;
++i_tile_count;
}
if (ON == i_reverse_sw) {
ui8p_yy -=
ui32_tile_height *
ui32_width *
ui16_channels *
ui16_bytes;
} else {
ui8p_yy +=
ui32_tile_height *
ui32_width *
ui16_channels *
ui16_bytes;
}
}
/* カウントダウン表示終了 */
if (ON == i_cv_sw) { pri_funct_cv_end(); }
return OK;
}
| 22.271605
| 233
| 0.654102
|
63b84a91ee2eedeec3e0635a051e6e4257cf9c20
| 848
|
rs
|
Rust
|
wpilib/src/lib.rs
|
Redrield/first-rust-competition
|
54922c26f7793cb8929ce68c4da09ace392bf6ef
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
wpilib/src/lib.rs
|
Redrield/first-rust-competition
|
54922c26f7793cb8929ce68c4da09ace392bf6ef
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
wpilib/src/lib.rs
|
Redrield/first-rust-competition
|
54922c26f7793cb8929ce68c4da09ace392bf6ef
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
// Copyright 2018 First Rust Competition Developers.
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate lazy_static;
extern crate wpilib_sys;
mod analog_input;
pub use self::analog_input::AnalogInput;
mod pdp;
pub use self::pdp::PowerDistributionPanel;
pub mod can;
pub use self::can::Can;
pub mod dio;
pub mod ds;
pub mod encoder;
pub mod i2c;
pub mod notifier;
pub mod pneumatics;
pub mod pwm;
pub mod relay;
mod robot;
pub use self::robot::*;
mod robot_base;
pub use self::robot_base::*;
pub mod serial;
pub mod spi;
pub use wpilib_sys::hal_call::{HalError, HalMaybe, HalResult};
| 25.69697
| 68
| 0.752358
|
6d71b4539e617ef002d764ba2a883b7d0919348c
| 15,985
|
ts
|
TypeScript
|
types/dwt/Dynamsoft.d.ts
|
CiaccoDavide/DefinitelyTyped
|
f4b63e02370940350887eaa82ac976dc2ecbf313
|
[
"MIT"
] | 35,620
|
2015-11-04T04:20:38.000Z
|
2022-03-31T21:14:58.000Z
|
types/dwt/Dynamsoft.d.ts
|
CiaccoDavide/DefinitelyTyped
|
f4b63e02370940350887eaa82ac976dc2ecbf313
|
[
"MIT"
] | 49,391
|
2015-11-04T05:15:18.000Z
|
2022-03-31T23:44:18.000Z
|
types/dwt/Dynamsoft.d.ts
|
CiaccoDavide/DefinitelyTyped
|
f4b63e02370940350887eaa82ac976dc2ecbf313
|
[
"MIT"
] | 36,450
|
2015-11-04T04:30:18.000Z
|
2022-03-31T23:29:51.000Z
|
import { DynamsoftEnums } from "./Dynamsoft.Enum";
import { WebTwain } from "./WebTwain";
import { Settings } from "./Addon.OCRPro";
import { FileUploader } from "./Dynamsoft.FileUploader";
export namespace DynamsoftStatic {
let Lib: DynamsoftLib;
let MSG: Messages;
let WebTwainEnv: WebTwainEnv;
let managerEnv: ManagerEnv;
let FileUploader: FileUploader;
namespace WebTwain {
namespace Addon {
namespace OCRPro {
function NewSettings(): Settings;
}
}
}
}
export interface DWTInitialConfig {
WebTwainId: string;
Host?: string | undefined;
Port?: string | undefined;
SSLPort?: string | undefined;
}
export interface DynamsoftLib {
/**
* A built-in method to set up a listener for the specified event type on the target element.
* @param target Specify the HTML element.
* @param type Specify the event
* @param listener Specify the callback
*/
addEventListener(target: HTMLElement, type: string, listener: EventListenerOrEventListenerObject): void;
/**
* Whether to enable debugging. Once enabled, debugging inforamtion is printed out in the browser console.
*/
debug: boolean;
detect: DSLibDetect;
env: DSLibEnv;
/**
* Hide the built-in page mask
*/
hideMask(): void;
/**
* Show the built-in page mask
*/
showMask(): void;
/**
* Load the specified script.
* @param url Specify the URL of the script.
* @param bAsync Whether to load the script asynchronously.
* @param callback Callback function triggered when the script is loaded.
*/
getScript(url: string, bAsync: boolean, callback: () => void): void;
/**
* Load the specified scripts.
* @param urls Specify the URLs of the scripts.
* @param bAsync Whether to load the script asynchronously.
* @param callback Callback function triggered when the scripts are all loaded.
*/
getScripts(urls: string[], bAsync: boolean, callback: () => void): void;
dlgLoadingShowStatus: boolean;
product: Product;
/**
* The following Functions & Options are internal & ignored
*
* Addon_Events, Addon_Sendback_Events, Attributes, BGR2RGB, BIO, DOM,
* DynamicLoadAddonFuns, DynamicWebTwain, EnumMouseButton, Errors,
* Events, File, Index, IntToColorStr, LS, License, MobileFuns, Path,
* ProgressBar, RGB2BGR, ShowLicenseDialog, UI, Uri
* ajax, all, appendMessage, appendRichMessage, asyncQueue, atob,
* attachAddon, attachProperty, attachPropertyUI, base64, bio, btoa,
* cancelFrome, checkDomReady, checkNavInfoReady, clearMessage, clone,
* closeAll, closeLoadingMsg, closeProgress, colorStrToInt, config,css,
* currentStyle, detectButton, dialog, dialogShowStatus, dlgLoading,
* dlgLoadingShowStatus, dlgProgress, dlgRef, doc, domReady,
* each, empty, endsWith, error, escapeHtml, escapeRegExp, extend,
* filter, fireEvent, fromUnicode, get, getAllCss, getColor, getCss,
* getElDimensions, getHex, getHttpUrl, getLogger, getNavInfo,
* getNavInfoByUAData, getNavInfoByUserAgent, getNavInfoSync, getRandom,
* getRealPath, getWS, getWSUrl, getWheelDelta, globalEval, guid, hide,
* html5, indexOf, initProgress, install,io, isArray, isBoolean, isDef,
* isFunction, isLocalIP, isNaN, isNodeList, isNull, isNumber, isObject,
* isPlainObject, isString, isUndef, isUndefined, isWindow, keys, makeArray,
* mask, mix, needShowTwiceShowDialog, nil, noop, now, obj, one, openLoadingMsg,
* page, param, parse, parseHTML, progressMessage, ready,
* removeEventListener, replaceAll, replaceControl, setBtnCancelVisibleForProgress,
* show, showLoadingMsg, showProgress, showProgressMsg, sizzle, sprintf, startWS,
* startWSByIP, startsWith, stopPropagation, stringify, style, support, switchEvent,
* tmp, toggle, trim, type, unEscapeHtml, uniq, unparam, upperCaseFirst, uriQuery,
* urlDecode, urlEncode, utf8, vsprintf, win
*/
}
export interface DSLibDetect {
/**
* Whether or not the site is secure (Https://).
*/
readonly ssl: boolean;
readonly scriptLoaded: boolean;
/**
* The following Functions & Options are internal & ignored
* OnCreatWS, OnDetectNext, StartWSByIPTimeoutId, StartWSTimeoutId,
* aryReconnectSTwains, arySTwains, arySTwainsByIP, bFirst,
* bNeedUpgradeEvent, bNoControlEvent, bOK, bPromptJSOrServerOutdated,
* cUrlIndex, cssLoaded, dcpCallbackType, dcpStatus, detectType, getVersionArray,
* isDWTVersionLatest, needUpgrade, onNoControl, onNotAllowedForChrome, ports,
* starting, tryTimes, urls, viewerScriptLoaded, wasmScriptLoaded,
* OnWebTwainPostExecute, OnWebTwainPreExecute, hideMask, showMask,
* win64Ports, __WebTwainMain, __dialog
*/
}
export interface DSLibEnv {
/**
* Whether the browser is Chrome.
*/
readonly bChrome: boolean;
/**
* Whether the browser is Edge.
*/
readonly bEdge: boolean;
/**
* Whether the page is opening from the disk.
*/
readonly bFileSystem: boolean;
/**
* Whether the browser is Firefox.
*/
readonly bFirefox: boolean;
/**
* Whether the browser is IE.
*/
readonly bIE: boolean;
/**
* Whether the browser is Safari.
*/
readonly bSafari: boolean;
/**
* Whether the operating system is Linux.
*/
readonly bLinux: boolean;
/**
* Whether the operating system is macOS.
*/
readonly bMac: boolean;
/**
* Whether the operating system is mobile (Android & iOS & iPadOS).
*/
readonly bMobile: boolean;
/**
* Whether the operating system is Windows.
*/
readonly bWin: boolean;
/**
* Whether the operating system is 64bit Windows.
*/
readonly bWin64: boolean;
/**
* The base path.
*/
readonly basePath: string;
/**
* The WebSocket session id.
*/
readonly WSSession: number;
/**
* The WebSocket version.
*/
readonly WSVersion: string;
/**
* The plugin lenghth.
*/
readonly iPluginLength: number;
/**
* Whether it is a desktop viewer.
*/
isDesktopViewer(): boolean;
/**
* Whether it is a mobile viewer.
*/
isMobileViewer(): boolean;
/**
* Whether it is a pad viewer.
*/
isPadViewer(): boolean;
/**
* Whether the platform is 64bit.
*/
readonly isX64: boolean;
/**
* Information about macOSX.
*/
readonly macOSX: string;
/**
* OS version.
*/
readonly osVersion: string;
/**
* The path type used to calculate the real path.
*/
readonly pathType: number;
/**
* The version of Chrome.
*/
readonly strChromeVersion: number | string;
/**
* The version of Firefox.
*/
readonly strFirefoxVersion: number | string;
/**
* The version of IE.
*/
readonly strIEVersion: number | string;
}
export interface WebTwainEnv {
/**
* Whether to install the ActiveX with CAB.
*/
ActiveXInstallWithCAB: boolean;
/**
* The version of the ActiveX;
*/
readonly ActiveXVersion: string;
/**
* Whether to create a WebTwain instance automatically upon page load.
*/
AutoLoad: boolean;
/**
* Close a dialog opened by the method ShowDialog.
*/
CloseDialog(): void;
/**
* A map of all WebTwain instances.
*/
ContainerMap: any;
/**
* Define the Id and UI of the WebTwain instances.
*/
Containers: Container[];
/**
* Create a WebTwain instance with UI.
* @param ContainerId Specify the HTML element (typically of the type HTMLDivElement) to hold the UI.
* @param host Specify the host.
* @param port Specify the port.
* @param portSSL Specify the SSL port.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
*/
CreateDWTObject(
ContainerId: string,
host: string,
port: string | number,
portSSL: string | number,
successCallBack: (DWObject: WebTwain) => void,
failureCallBack: (errorString: string) => void): void;
/**
* Create a WebTwain instance with UI.
* @param ContainerId Specify the HTML element (typically of the type HTMLDivElement) to hold the UI.
* @param host Specify the host.
* @param port Specify the port.
* @param portSSL Specify the SSL port.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
*/
CreateDWTObject(ContainerId: string, successCallBack: (DWObject: WebTwain) => void, failureCallBack: (errorString: string) => void): void;
/**
* Create a WebTwain instance without UI.
* @param WebTwainId Specify the Id of the instance.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
*/
CreateDWTObjectEx(dwtInitialConfig: DWTInitialConfig, successCallBack: (DWObject: WebTwain) => void, failureCallBack: (errorString: string) => void): void;
/**
* Define the display info.
*/
CustomizableDisplayInfo: DisplayInfo;
/**
* Remove and destroy a WebTwain instance.
* @param Id Specify the instance with its ContainerId or WebTwainId.
*/
DeleteDWTObject(Id: string): boolean;
/**
* Return the WebTwain instance specified by its ContainerId. If no parameter is provided, the first valid WebTwain instance is returnd.
* @param ContainerId The ContainerId.
*/
GetWebTwain(ContainerId?: string): WebTwain;
/**
* Return the WebTwain instance specified by its WebTwainId. If no parameter is provided, the first valid WebTwain instance is returnd.
* @param WebTwainId The WebTwainId.
*/
GetWebTwainEx(WebTwainId?: string): WebTwain;
/**
* Whether or not an md5 header `dwt-md5` should be included in HTTP upload requests.
*/
IfAddMD5InUploadHeader: boolean;
/**
* Whether to confine the mask within the viewer element.
*/
IfConfineMaskWithinTheViewer: boolean;
/**
* Whether to use ActiveX for IE 10 & 11.
*/
IfUseActiveXForIE10Plus: boolean;
/**
* The version of the JavaScript script.
*/
readonly JSVersion: string;
/**
* Create a WebTwain instance(s).
*/
Load(): void;
/**
* A callback function that is executed when the WebTwain related files are not found.
*/
OnWebTwainNotFound: () => {};
/**
* A callback function that is executed after a time-consuming operation.
*/
OnWebTwainPostExecute: () => {};
/**
* A callback function that is executed before a time-consuming operation.
*/
OnWebTwainPreExecute: () => {};
/**
* A callback function that is executed when a WebTwain instance is created.
*/
OnWebTwainReady: () => {};
/**
* A callback function that is executed right before the creation of a WebTwain instance.
*/
OnWebTwainWillInit: () => {};
/**
* The version of the PDF module (not the rasterizer).
*/
PdfVersion: string;
/**
* The version of the plug-in edition.
*/
PluginVersion: string;
/**
* Set or return the product key for the library. A product key is required to enables certain modules of the library.
*/
ProductKey: string;
/**
* The product name.
*/
readonly ProductName: string;
/**
* Attach the callback function to the specified event.
* @param event Specify the event.
* @param callback Specify the callback.
*/
RegisterEvent(event: string, callback: (...args: any[]) => void): void;
/**
* Remove all authorizations for accessing local resources.
*/
RemoveAllAuthorizations(): void;
/**
* Set or return where the library looks for resources files including service installers, CSS, etc.
*/
ResourcesPath: string;
/**
* The version of the Linux edition (the service, not wasm).
*/
ServerLinuxVersionInfo: string;
/**
* The version of the macOS edition (the service, not wasm).
*/
ServerMacVersionInfo: string;
/**
* The version of the Windows edition (the service, not wasm).
*/
ServerVersionInfo: string;
/**
* Built-in method to show a modal dialog.
* @param width Width of the dialog.
* @param height Height of the dialog.
* @param content Content of the dialog.
* @param simple Whether to show a simple dialog with no header.
* @param hideCloseButton Whether to hide the close button.
*/
ShowDialog(width: number, height: number, content: string, simple: boolean, hideCloseButton: boolean): void;
/**
* Remove and destroy all WebTwain instances.
*/
Unload(): void;
/**
* Whether to download the wasm for Camera Addon to use on initialization.
*/
UseCameraAddonWasm: boolean;
/**
* Whether to use the library in Local-Service mode or WASM mode.
*/
UseLocalService: boolean;
ConnectToTheService: () => void;
initQueue: any[];
/**
* The following Functions & Options are internal & ignored
* ActiveXIntegerited, CheckConnectToTheService,
* ContainerMap, Debug, DynamicContainers,
* DynamicDWTMap, GetLocalServiceStatus,IfCheck64bitServiceFirst,
* IfCheckDCP, IfCheckDWT,
* IfDisableDefaultSettings, IfDownload64bitService,
* IfInstallDWTModuleWithZIP, IfUpdateService,
* IfUseEmbeddedDownloadNoticeForActiveX, IfUseViewer,
* OnWebTwainInitMessage, OnWebTwainNeedUpgrade,
* OnWebTwainNeedUpgradeWebJavascript, OnWebTwainInitMessage
* OnWebTwainOldPluginNotAllowed, OnWebTwainOldPluginNotAllowed
* Trial, UseDefaultInstallUI, ViewerJSIntegerited,
* inited, _srcUseLocalService
*/
}
export interface DisplayInfo {
buttons: any;
customProgressText: any;
dialogText: any;
errorMessages: any;
generalMessages: any;
}
/**
* Define default messages.
*/
export interface Messages {
ConvertingToBase64: string;
ConvertingToBlob: string;
Downloading: string;
Encoding: string;
Err_BrowserNotSupportWasm: string;
Init_AllJsLoaded: string;
Init_CheckDWT: string;
Init_CheckDWTVersion: string;
Init_CheckingLicense: string;
Init_CompilingWasm: string;
Init_ConfiguringDWT: string;
Init_CreatingDWT: string;
Init_DownloadingWasm: string;
Init_FireBeforeInitEvt: string;
Init_GetLicenseInfoForDWT: string;
Init_InitActiveX: string;
Init_InitDynamsoftService: string;
Init_InitH5: string;
Init_InitWasm: string;
Init_LoadingViewerJs: string;
Init_LookingLicense: string;
Init_SetLicenseForDWT: string;
Loading: string;
LoadingPdf: string;
LoadingTiff: string;
SavingPdf: string;
SavingTiff: string;
Uploading: string;
}
export interface ManagerEnv {
IfUpdateService: boolean;
resourcesPath: string;
}
/**
* Interface for a WebTwain profile.
*/
export interface Container {
WebTwainId: string;
ContainerId?: string | undefined;
Width?: string | number | undefined;
Height?: string | number | undefined;
bNoUI?: boolean | undefined;
bLocalService?: boolean | undefined;
}
export interface Product {
bActiveXEdition: boolean;
bChromeEdition: boolean;
bHTML5Edition: boolean;
bPluginEdition: boolean;
host: string;
name: string;
}
declare const Dynamsoft: (typeof DynamsoftEnums & typeof DynamsoftStatic);
export default Dynamsoft;
| 33.441423
| 159
| 0.662183
|
6963a66452d75fe68ad37180ecc92316275f976c
| 1,562
|
ps1
|
PowerShell
|
SPOnPremises_ChangeVersioningAndRemoveOlderVersions.ps1
|
gambin/GSPShell
|
b7d98c1aa4170f70af5d72f8ee40ca560f4b07d7
|
[
"MIT"
] | null | null | null |
SPOnPremises_ChangeVersioningAndRemoveOlderVersions.ps1
|
gambin/GSPShell
|
b7d98c1aa4170f70af5d72f8ee40ca560f4b07d7
|
[
"MIT"
] | null | null | null |
SPOnPremises_ChangeVersioningAndRemoveOlderVersions.ps1
|
gambin/GSPShell
|
b7d98c1aa4170f70af5d72f8ee40ca560f4b07d7
|
[
"MIT"
] | null | null | null |
cls
Write-Host "** Atencao **" -BackgroundColor Blue -ForegroundColor White
Write-Host "Este script ira alterar a configuracao do versionamento de listas e bibliotecas dos sites SharePoint!" -ForegroundColor Yellow
Write-Host
$major = Read-Host "Qual o numero de major versions que serao mantidas?"
$minor = Read-Host "Qual o numero de minor versions que serao mantidas?"
$url = Read-Host "Entre com a URL do Site Collection (deixe em branco para rodar em todos os site collections)"
if (![string]::IsNullOrEmpty($url)){
$SPSites = Get-SPSite $url
} else {
$SPSites = Get-SPSite -Limit All
}
if ($SPSites){
foreach ($SPSite in $SPSites){
$SPWebs = $SPSite | Get-SPWeb -Limit All
foreach ($web in $SPWebs){
Write-Host "--------------------------------------------------------------------------------"
Write-Host "Configurando listas do site $($web.Url)" -ForegroundColor Yellow
$lists = $web.Lists | where {($_.EnableVersioning) -and ($_.RootFolder.Url -notmatch "_catalogs") -and ($_.Title -ne "Workflows")}
if ($lists){
foreach ($list in $lists){
Write-Host "Alterando configuracoes de versionamento da lista $($list.Title) - $($list.Url)" -ForegroundColor Green
$list.MajorVersionLimit = $major
if ($list.EnableMinorVersions){
$list.MajorWithMinorVersionsLimit = $minor
}
$list.Update()
Write-Host "Removendo versoes antigas de itens da lista $($list.Title)"
foreach($item in $list.Items){
$item.SystemUpdate($false)
}
}
}
}
$web.Dispose()
}
$SPSites.Dispose()
}
| 35.5
| 138
| 0.651088
|
5d355c64e2d141688a1135d92643686c9b6748f7
| 16,054
|
lua
|
Lua
|
Diminish/Diminish.lua
|
wardz/Diminish
|
04b3aa48022064b2c7b5032037dbe36827b894ba
|
[
"MIT"
] | 10
|
2015-06-10T17:21:51.000Z
|
2021-10-31T04:17:42.000Z
|
Diminish/Diminish.lua
|
wardz/Diminish
|
04b3aa48022064b2c7b5032037dbe36827b894ba
|
[
"MIT"
] | 15
|
2018-09-22T19:41:17.000Z
|
2022-03-21T18:26:34.000Z
|
Diminish/Diminish.lua
|
wardz/Diminish
|
04b3aa48022064b2c7b5032037dbe36827b894ba
|
[
"MIT"
] | 3
|
2019-01-15T11:32:15.000Z
|
2021-04-11T23:25:15.000Z
|
local _, NS = ...
local Timers = NS.Timers
local Icons = NS.Icons
local Info = NS.Info
local IsInBrawl = _G.C_PvP.IsInBrawl
local Diminish = CreateFrame("Frame")
Diminish:RegisterEvent("PLAYER_LOGIN")
Diminish:SetScript("OnEvent", function(self, event, ...)
return self[event](self, ...)
end)
-- used for Diminish_Options
NS.Diminish = Diminish
_G.DIMINISH_NS = NS
local unitEvents = {
target = "PLAYER_TARGET_CHANGED",
party = "GROUP_ROSTER_UPDATE, GROUP_JOINED", -- csv
player = "COMBAT_LOG_EVENT_UNFILTERED",
nameplate = "NAME_PLATE_UNIT_ADDED, NAME_PLATE_UNIT_REMOVED",
arena = not NS.IS_CLASSIC and "ARENA_OPPONENT_UPDATE" or nil,
focus = not NS.IS_CLASSIC and "PLAYER_FOCUS_CHANGED" or nil,
}
function Diminish:ToggleUnitEvent(events, enable)
for event in gmatch(events or "", "([^,%s]+)") do -- csv loop
if enable then
if not self:IsEventRegistered(event) then
self:RegisterEvent(event)
--@debug@
NS.Debug("Registered %s for instance %s.", event, self.currInstanceType)
--@end-debug@
end
else
if self:IsEventRegistered(event) then
self:UnregisterEvent(event)
--@debug@
NS.Debug("Unregistered %s for instance %s.", event, self.currInstanceType)
--@end-debug@
end
end
end
end
function Diminish:ToggleForZone(dontRunEnable)
self.currInstanceType = select(2, IsInInstance())
local registeredOnce = false
--@retail@
if self.currInstanceType == "arena" then
-- HACK: check if inside arena brawl, C_PvP.IsInBrawl() doesn't
-- always work on PLAYER_ENTERING_WORLD so delay it with this event.
-- Once event is fired it'll call ToggleForZone again
self:RegisterEvent("PVP_BRAWL_INFO_UPDATED")
else
self:UnregisterEvent("PVP_BRAWL_INFO_UPDATED")
end
-- PVP_BRAWL_INFO_UPDATED triggered ToggleForZone
if self.currInstanceType == "arena" and IsInBrawl() then
self.currInstanceType = "pvp" -- treat arena brawl as a battleground
self:UnregisterEvent("PVP_BRAWL_INFO_UPDATED")
end
--@end-retail@
-- (Un)register unit events for current zone depending on user settings
for unit, settings in pairs(NS.db.unitFrames) do -- DR tracking for focus/target etc each have their own seperate settings
local events = unitEvents[unit]
if settings.enabled then
-- Loop through every zone/instance enabled and see if we're currently in that instance
for zone, state in pairs(settings.zones) do
if state and zone == self.currInstanceType then
registeredOnce = true
settings.isEnabledForZone = true
self:ToggleUnitEvent(events, true)
break
else
settings.isEnabledForZone = false
self:ToggleUnitEvent(events, false)
end
end
else -- unitframe is not enabled for tracking at all
settings.isEnabledForZone = false
self:ToggleUnitEvent(events, false)
end
end
if dontRunEnable then
-- PVP_BRAWL_INFO_UPDATED triggered ToggleForZone again,
-- so dont run Enable() twice, just update vars
return self:SetCLEUWatchVariables()
end
if registeredOnce then -- atleast 1 event has been registered for zone
self:Enable()
else
self:Disable()
end
end
function Diminish:SetCLEUWatchVariables()
local cfg = NS.db.unitFrames
local targetOrFocusWatchFriendly = false
if cfg.target.watchFriendly and cfg.target.isEnabledForZone then
targetOrFocusWatchFriendly = true
elseif cfg.focus.watchFriendly and cfg.focus.isEnabledForZone then
targetOrFocusWatchFriendly = true
elseif cfg.nameplate.watchFriendly and cfg.nameplate.isEnabledForZone then
targetOrFocusWatchFriendly = true
end
-- PvE mode
self.isWatchingNPCs = NS.db.trackNPCs
if not cfg.target.isEnabledForZone and not cfg.focus.isEnabledForZone and not cfg.nameplate.isEnabledForZone then
-- PvE mode only works for target/focus/nameplate so disable mode if those frames are not active
self.isWatchingNPCs = false
end
-- Check if we're tracking any friendly units and not just enemy only
self.isWatchingFriendly = false
if cfg.player.isEnabledForZone or cfg.party.isEnabledForZone or targetOrFocusWatchFriendly then
self.isWatchingFriendly = true
end
-- Check if only PlayerFrame tracking is enabled for friendly, if it is
-- we want to ignore all friendly units later in CLEU except where destGUID == playerGUID
self.onlyPlayerWatchFriendly = cfg.player.isEnabledForZone
if cfg.player.isEnabledForZone then
if cfg.party.isEnabledForZone or targetOrFocusWatchFriendly then
self.onlyPlayerWatchFriendly = false
end
end
-- Check if we're only tracking friendly units so we can ignore enemy units in CLEU
self.onlyFriendlyTracking = true
if cfg.target.isEnabledForZone or cfg.focus.isEnabledForZone or cfg.arena.isEnabledForZone or cfg.nameplate.isEnabledForZone then
self.onlyFriendlyTracking = false
end
-- Check if we're only tracking friendly party members so we can ignore outsiders
self.onlyTrackingPartyForFriendly = cfg.party.isEnabledForZone
if targetOrFocusWatchFriendly then
self.onlyTrackingPartyForFriendly = false
end
end
function Diminish:Disable()
self:UnregisterAllEvents()
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("CVAR_UPDATE")
Timers:ResetAll(true)
--@debug@
Info("Disabled addon for zone %s.", self.currInstanceType)
--@end-debug@
end
function Diminish:Enable()
Timers:ResetAll(true)
self:SetCLEUWatchVariables()
self:GROUP_ROSTER_UPDATE()
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
--@debug@
Info("Enabled addon for zone %s.", self.currInstanceType)
--@end-debug@
end
function Diminish:InitDB()
DiminishDB = DiminishDB and next(DiminishDB) ~= nil and DiminishDB or {
profileKeys = {},
profiles = {},
}
local playerName = UnitName("player") .. "-" .. GetRealmName()
local profile = DiminishDB.profileKeys[playerName]
if not profile or not DiminishDB.profiles[profile] then
-- Profile doesn't exist or is deleted, reset to default
DiminishDB.profileKeys[playerName] = "Default"
profile = "Default"
end
-- Reset config if the config version is too old
if DiminishDB.profiles[profile] then
if DiminishDB.profiles[profile].version == "1.0" or not DiminishDB.profiles[profile].version then
wipe(DiminishDB.profiles[profile])
end
end
-- Copy any settings from default if they don't exist in current profile
NS.CopyDefaults({
[profile] = NS.DEFAULT_SETTINGS
}, DiminishDB.profiles)
-- Reference to active db profile
-- Always use this directly or reference will be invalid
-- after changing profile in Diminish_Options
NS.db = DiminishDB.profiles[profile]
NS.db.version = NS.DEFAULT_SETTINGS.version
NS.activeProfile = profile
if NS.IS_CLASSIC_OR_TBC and NS.db.unitFrames.player.usePersonalNameplate then
NS.db.unitFrames.player.usePersonalNameplate = false
end
-- Remove table values no longer found in default settings
NS.CleanupDB(DiminishDB.profiles[profile], NS.DEFAULT_SETTINGS)
if not IsAddOnLoaded("Diminish_Options") then
-- Cleanup functions/tables only used for Diminish_Options when it's not loaded
NS.DEFAULT_SETTINGS = nil
NS.CopyDefaults = nil
NS.CleanupDB = nil
Icons.OnFrameConfigChanged = nil
end
self.InitDB = nil
end
--------------------------------------------------------------
-- Events
--------------------------------------------------------------
local strfind = _G.string.find
local UnitIsUnit = _G.UnitIsUnit
function Diminish:PLAYER_LOGIN()
self:InitDB()
local Masque = LibStub and LibStub("Masque", true)
NS.MasqueGroup = Masque and Masque:Group("Diminish")
NS.useCompactPartyFrames = GetCVarBool("useCompactPartyFrames")
self.PLAYER_GUID = UnitGUID("player")
self.PLAYER_CLASS = select(2, UnitClass("player"))
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("CVAR_UPDATE")
self:UnregisterEvent("PLAYER_LOGIN")
self.PLAYER_LOGIN = nil
end
function Diminish:CVAR_UPDATE(name, value)
if name == "USE_RAID_STYLE_PARTY_FRAMES" then
NS.useCompactPartyFrames = value ~= "0"
Icons:AnchorPartyFrames()
end
end
--@retail@
function Diminish:PVP_BRAWL_INFO_UPDATED()
if not IsInBrawl() then
self:UnregisterEvent("PVP_BRAWL_INFO_UPDATED")
else
self:ToggleForZone(true)
end
end
--@end-retail@
function Diminish:PLAYER_ENTERING_WORLD()
self:ToggleForZone()
end
function Diminish:PLAYER_TARGET_CHANGED()
Timers:Refresh("target")
end
function Diminish:PLAYER_FOCUS_CHANGED()
Timers:Refresh("focus")
end
function Diminish:NAME_PLATE_UNIT_ADDED(namePlateUnitToken)
if UnitIsUnit("player", namePlateUnitToken) then
if not NS.db.unitFrames.player.usePersonalNameplate then return end
end
Timers:Refresh(namePlateUnitToken)
if DIMINISH_OPTIONS and DIMINISH_OPTIONS.TestMode:IsTesting() then
Timers:Refresh("nameplate")
end
end
function Diminish:NAME_PLATE_UNIT_REMOVED(namePlateUnitToken)
Icons:ReleaseNameplate(namePlateUnitToken)
end
function Diminish:ARENA_OPPONENT_UPDATE(unitID, status)
if status == "seen" and not strfind(unitID, "pet") then
if IsInBrawl() and not NS.db.unitFrames.arena.zones.pvp then return end
Timers:Refresh(unitID)
end
end
function Diminish:GROUP_ROSTER_UPDATE()
local members = min(GetNumGroupMembers(), 4)
Icons:AnchorPartyFrames(members)
-- Refresh every single party member, even if they have already just been refreshed
-- incase unit IDs have been shifted
for i = 1, 5 do
if UnitExists("party"..i) then
Timers:Refresh("party"..i)
else
Timers:RemoveActiveGUID("party"..i)
end
end
end
Diminish.GROUP_JOINED = Diminish.GROUP_ROSTER_UPDATE
-- Combat log scanning for DRs
do
local COMBATLOG_PARTY_MEMBER = bit.bor(COMBATLOG_OBJECT_AFFILIATION_MINE, COMBATLOG_OBJECT_AFFILIATION_PARTY)
local COMBATLOG_OBJECT_REACTION_FRIENDLY = _G.COMBATLOG_OBJECT_REACTION_FRIENDLY
local COMBATLOG_OBJECT_TYPE_PLAYER = _G.COMBATLOG_OBJECT_TYPE_PLAYER
local COMBATLOG_OBJECT_CONTROL_PLAYER = _G.COMBATLOG_OBJECT_CONTROL_PLAYER
local CombatLogGetCurrentEventInfo = _G.CombatLogGetCurrentEventInfo
local bit_band = _G.bit.band
local IS_CLASSIC_OR_TBC = NS.IS_CLASSIC_OR_TBC
local CATEGORY_STUN = NS.CATEGORIES.stun
local CATEGORY_TAUNT = NS.CATEGORIES.taunt
local CATEGORY_ROOT = NS.CATEGORIES.root
local CATEGORY_INCAP = NS.CATEGORIES.incapacitate
local CATEGORY_DISORIENT = NS.CATEGORIES.disorient
local CATEGORY_KIDNEY = NS.CATEGORIES.kidney_shot
local DRList = LibStub("DRList-1.0")
function Diminish:COMBAT_LOG_EVENT_UNFILTERED()
local _, eventType, _, srcGUID, _, srcFlags, _, destGUID, _, destFlags, _, spellID, spellName, _, auraType = CombatLogGetCurrentEventInfo()
if not destGUID then return end -- sanity check
if auraType == "DEBUFF" then
if eventType ~= "SPELL_AURA_REMOVED" and eventType ~= "SPELL_AURA_APPLIED" and eventType ~= "SPELL_AURA_REFRESH" then return end
if spellID == 0 then -- for classic
spellID = spellName
end
local category, drSpellID = DRList:GetCategoryBySpellID(spellID)
if not category or category == "knockback" then return end
category = DRList:GetCategoryLocalization(category)
if drSpellID then
spellID = drSpellID
end
local isMindControlled = false
local isNotPetOrPlayer = false
local isPlayer = bit_band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) > 0
if not isPlayer then
if strfind(destGUID, "Player-") then
-- Players have same bitmask as player pets when they're mindcontrolled and MC aura breaks, so we need to distinguish these
-- so we can ignore the player pets but not actual players
isMindControlled = true
end
if not self.isWatchingNPCs and not isMindControlled then return end
if bit_band(destFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) <= 0 then -- is not player pet or is not MCed
if IS_CLASSIC_OR_TBC then
if category ~= CATEGORY_STUN and category ~= CATEGORY_KIDNEY then return end
else
if category ~= CATEGORY_STUN and category ~= CATEGORY_TAUNT and category ~= CATEGORY_ROOT and category ~= CATEGORY_INCAP and category ~= CATEGORY_DISORIENT then
-- only show taunt and stun for normal mobs (roots/incaps/disorient for special mobs), player pets will show all
return
end
end
isNotPetOrPlayer = true
end
else
-- Ignore taunts for players
if category == CATEGORY_TAUNT then return end
if IS_CLASSIC_OR_TBC then
local isSrcPlayer = bit_band(srcFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) > 0
if not isSrcPlayer then return end
end
end
local isFriendly = bit_band(destFlags, COMBATLOG_OBJECT_REACTION_FRIENDLY) ~= 0
if isMindControlled then
isFriendly = not isFriendly -- reverse values
end
if not isFriendly and self.onlyFriendlyTracking then return end
if isFriendly then
if not self.isWatchingFriendly then return end
if self.onlyPlayerWatchFriendly then
-- Only store friendly timers for player
if destGUID ~= self.PLAYER_GUID then return end
end
if self.onlyTrackingPartyForFriendly then
-- Only store friendly timers for party1-4 and player
if bit_band(destFlags, COMBATLOG_PARTY_MEMBER) == 0 then return end
end
end
if eventType == "SPELL_AURA_REMOVED" then
Timers:Insert(destGUID, srcGUID, category, spellID, isFriendly, isNotPetOrPlayer, false)
elseif eventType == "SPELL_AURA_APPLIED" then
Timers:Insert(destGUID, srcGUID, category, spellID, isFriendly, isNotPetOrPlayer, true)
elseif eventType == "SPELL_AURA_REFRESH" then
Timers:Update(destGUID, srcGUID, category, spellID, isFriendly, isNotPetOrPlayer, true)
end
end
-------------------------------------------------------------------------------------------------------
if eventType == "UNIT_DIED" or eventType == "PARTY_KILL" then
if self.currInstanceType == "arena" and not IsInBrawl() then return end
-- Delete all timers when player died
if destGUID == self.PLAYER_GUID then
if self.PLAYER_CLASS == "HUNTER" then
-- Don't delete if player is Feign Deathing
if NS.GetAuraDuration("player", 5384) then return end
end
return Timers:ResetAll()
end
-- Delete all timers for unit that died
Timers:Remove(destGUID, false)
end
end
end
| 37.334884
| 184
| 0.658403
|
238019accce87374e5ebcae40d57c5468b535976
| 2,472
|
js
|
JavaScript
|
src/components/Sections/AboutMeSection.js
|
moafaqS/personal-website
|
d25034b4a073994f6cd9b80c220847dfaf6c44fb
|
[
"RSA-MD"
] | null | null | null |
src/components/Sections/AboutMeSection.js
|
moafaqS/personal-website
|
d25034b4a073994f6cd9b80c220847dfaf6c44fb
|
[
"RSA-MD"
] | null | null | null |
src/components/Sections/AboutMeSection.js
|
moafaqS/personal-website
|
d25034b4a073994f6cd9b80c220847dfaf6c44fb
|
[
"RSA-MD"
] | null | null | null |
import React from "react";
import styled from "styled-components";
import { H3, BodyIntro, BodyMain } from "../styles/textStyle";
export const AboutMeSection = () => {
return (
<Wrapper>
<ContentWrapper>
<Title>
<span>-</span> About Me <span>-</span>
</Title>
<Image src="/images/1614932209122.jpeg" />
<TextWrapper>
<Name>Mayaser Simbawa</Name>
<Summery>
<p>
I resented the gap between what I’ve been learning and what I’ve
been practicing, so I decided to balance it.
<br />
<br />
worked on the field of digital media & communications for almost 5
years, and gained through it the passion for writing, and whether
it was for the purpose of news or creativey, I made sure to master
the whole process, from ideation to delivering final pieces. Which
resulted in enabling me to become a stronger strategist, analyst
and storyteller.
<br />
<br />
As a researcher in the field, i believe I could combine my
experience and tactics with the theoretical framework to produce
more efficient methods & solutions for students, journalist and
everyone in the circle, with specific goals in mind; reducing the
gap and helping the local industry to reach its full potential.
<br />
<br />
There’s still long way to go, but this is the mission I’m
committed to, and I’m planning to spread the word!
</p>
</Summery>
</TextWrapper>
</ContentWrapper>
</Wrapper>
);
};
const Wrapper = styled.div`
position: relative;
overflow: hidden;
`;
const ContentWrapper = styled.div`
display: grid;
grid-template-rows: repeat(3, auto);
grid-gap: 50px;
padding: 130px 30px;
position: relative;
justify-items: center;
@media (max-width: 768px) {
padding: 0px;
}
`;
const Title = styled(H3)``;
const Image = styled.img`
border-radius: 50%;
width: 300px;
height: 300px;
`;
const TextWrapper = styled.div`
box-sizing: border-box;
width: 60%;
@media (max-width: 768px) {
width: 80%;
font-size: 14px;
}
`;
const Name = styled(BodyIntro)``;
const Summery = styled(BodyMain)`
text-align: justify;
* {
padding-top: 15px;
}
`;
| 29.428571
| 80
| 0.590615
|
b7285c94a4931f7fbba78a48c327c88b26861917
| 745
|
cs
|
C#
|
backend-api/FishingRecorder/FishingRecorder.API/Controllers/UsersController.cs
|
tonysulfaro/fishing-recorder
|
c74834d6f01315eb3e9d9f5e0288baa17a7b02ec
|
[
"MIT"
] | null | null | null |
backend-api/FishingRecorder/FishingRecorder.API/Controllers/UsersController.cs
|
tonysulfaro/fishing-recorder
|
c74834d6f01315eb3e9d9f5e0288baa17a7b02ec
|
[
"MIT"
] | 2
|
2020-09-26T01:00:42.000Z
|
2020-09-27T18:57:51.000Z
|
backend-api/FishingRecorder/FishingRecorder.API/Controllers/UsersController.cs
|
tonysulfaro/fishing-recorder
|
c74834d6f01315eb3e9d9f5e0288baa17a7b02ec
|
[
"MIT"
] | null | null | null |
using System.Collections.Generic;
using System.Threading.Tasks;
using FishingRecorder.API.Interfaces;
using FishingRecorder.API.Models.Database;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace FishingRecorder.API.Controllers
{
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class UsersController : ControllerBase
{
private readonly IUserRepository _userRepository;
public UsersController(IUserRepository userRepository)
{
_userRepository = userRepository;
}
[HttpGet]
public async Task<ActionResult<List<User>>> GetAllUsers()
{
return await _userRepository.GetAllUsers();
}
}
}
| 26.607143
| 65
| 0.697987
|
f64b8f2df6e270accde5d2e10fb663f41551bf5e
| 88,297
|
ps1
|
PowerShell
|
tests/Unit/DSC_DnsServerSetting.Tests.ps1
|
matthew-dupre/DnsServerDsc
|
9ac3399e026e51e0ea4f06fed8c34484dd9a6eb3
|
[
"MIT"
] | 37
|
2015-06-24T06:08:45.000Z
|
2019-09-26T18:18:33.000Z
|
tests/Unit/DSC_DnsServerSetting.Tests.ps1
|
matthew-dupre/DnsServerDsc
|
9ac3399e026e51e0ea4f06fed8c34484dd9a6eb3
|
[
"MIT"
] | 126
|
2019-12-10T17:08:47.000Z
|
2021-03-26T19:43:43.000Z
|
tests/Unit/DSC_DnsServerSetting.Tests.ps1
|
matthew-dupre/DnsServerDsc
|
9ac3399e026e51e0ea4f06fed8c34484dd9a6eb3
|
[
"MIT"
] | 80
|
2015-04-21T19:38:39.000Z
|
2019-09-24T19:49:08.000Z
|
$script:dscModuleName = 'DnsServerDsc'
$script:dscResourceName = 'DSC_DnsServerSetting'
function Invoke-TestSetup
{
try
{
Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop'
}
catch [System.IO.FileNotFoundException]
{
throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.'
}
$script:testEnvironment = Initialize-TestEnvironment `
-DSCModuleName $script:dscModuleName `
-DSCResourceName $script:dscResourceName `
-ResourceType 'Mof' `
-TestType 'Unit'
Import-Module (Join-Path -Path $PSScriptRoot -ChildPath 'Stubs\DnsServer.psm1') -Force
}
function Invoke-TestCleanup
{
Restore-TestEnvironment -TestEnvironment $script:testEnvironment
}
Invoke-TestSetup
try
{
InModuleScope $script:dscResourceName {
Describe 'DSC_DnsServerSetting\Get-TargetResource' -Tag 'Get' {
BeforeAll {
Mock -CommandName Assert-Module
Mock -CommandName Get-DnsServerSetting -MockWith {
return @{
DnsServer = 'dns1.company.local'
LocalNetPriority = $false
RoundRobin = $false
RpcProtocol = 1
NameCheckFlag = 2
AutoConfigFileZones = 1
AddressAnswerLimit = 0
UpdateOptions = 783
DisableAutoReverseZone = $false
StrictFileParsing = $false
EnableDirectoryPartitions = $false
XfrConnectTimeout = 30
BootMethod = 3
AllowUpdate = $true
LooseWildcarding = $false
BindSecondaries = $false
AutoCacheUpdate = $false
EnableDnsSec = $true
SendPort = 0
WriteAuthorityNS = $false
ListeningIPAddress = @('192.168.1.10', '192.168.2.10')
ForwardDelegations = $false
EnableIPv6 = $true
EnableOnlineSigning = $true
EnableDuplicateQuerySuppression = $true
AllowCnameAtNs = $true
EnableRsoForRodc = $true
OpenAclOnProxyUpdates = $true
NoUpdateDelegations = $false
EnableUpdateForwarding = $false
EnableWinsR = $true
DeleteOutsideGlue = $false
AppendMsZoneTransferTag = $false
AllowReadOnlyZoneTransfer = $false
EnableSendErrorSuppression = $true
SilentlyIgnoreCnameUpdateConflicts = $false
EnableIQueryResponseGeneration = $false
AdminConfigured = $true
PublishAutoNet = $false
ReloadException = $false
IgnoreServerLevelPolicies = $false
IgnoreAllPolicies = $false
EnableVersionQuery = 0
AutoCreateDelegation = 2
RemoteIPv4RankBoost = 5
RemoteIPv6RankBoost = 0
MaximumRodcRsoQueueLength = 300
MaximumRodcRsoAttemptsPerCycle = 100
MaxResourceRecordsInNonSecureUpdate = 30
LocalNetPriorityMask = 255
TcpReceivePacketSize = 65536
SelfTest = 4294967295
XfrThrottleMultiplier = 10
SocketPoolSize = 2500
QuietRecvFaultInterval = 0
QuietRecvLogInterval = 0
SyncDsZoneSerial = 2
ScopeOptionValue = 0
VirtualizationInstanceOptionValue = 0
ServerLevelPluginDll = 'C:\dns\plugin.dll'
RootTrustAnchorsURL = 'https://data.iana.org/root-anchors/root-anchors.xml'
SocketPoolExcludedPortRanges = @(5353, 5454)
LameDelegationTTL = New-TimeSpan -Seconds 0
MaximumSignatureScanPeriod = New-TimeSpan -Days 2
MaximumTrustAnchorActiveRefreshInterval = New-TimeSpan -Days 15
ZoneWritebackInterval = New-TimeSpan -Minutes 1
# Read-only properties
DsAvailable = $true
MajorVersion = 10
MinorVersion = 0
BuildNumber = 14393
IsReadOnlyDC = $false
AllIPAddress = @('fe80::e82e:70b7:f1d4:f695', '192.168.1.10', '192.168.2.10')
ForestDirectoryPartitionBaseName = 'ForestDnsZones'
DomainDirectoryPartitionBaseName = 'DomainDnsZones'
MaximumUdpPacketSize = 4000
}
}
}
Context 'When the system is in the desired state' {
It "Should return the correct values for each property" {
$getTargetResourceResult = Get-TargetResource -DnsServer 'dns1.company.local'
$getTargetResourceResult.LocalNetPriority | Should -BeFalse
$getTargetResourceResult.RoundRobin | Should -BeFalse
$getTargetResourceResult.RpcProtocol | Should -Be 1
# Read-only properties
$getTargetResourceResult.DsAvailable | Should -BeTrue
$getTargetResourceResult.MajorVersion | Should -Be 10
$getTargetResourceResult.MinorVersion | Should -Be 0
$getTargetResourceResult.BuildNumber | Should -Be 14393
$getTargetResourceResult.IsReadOnlyDC | Should -BeFalse
$getTargetResourceResult.ForestDirectoryPartitionBaseName | Should -Be 'ForestDnsZones'
$getTargetResourceResult.DomainDirectoryPartitionBaseName | Should -Be 'DomainDnsZones'
$getTargetResourceResult.MaximumUdpPacketSize | Should -Be 4000
$getTargetResourceResult.NameCheckFlag | Should -Be 2
$getTargetResourceResult.AutoConfigFileZones | Should -Be 1
$getTargetResourceResult.AddressAnswerLimit | Should -Be 0
$getTargetResourceResult.UpdateOptions | Should -Be 783
$getTargetResourceResult.DisableAutoReverseZone | Should -BeFalse
$getTargetResourceResult.StrictFileParsing | Should -BeFalse
$getTargetResourceResult.EnableDirectoryPartitions | Should -BeFalse
$getTargetResourceResult.XfrConnectTimeout | Should -Be 30
$getTargetResourceResult.BootMethod | Should -Be 3
$getTargetResourceResult.AllowUpdate | Should -BeTrue
$getTargetResourceResult.LooseWildcarding | Should -BeFalse
$getTargetResourceResult.BindSecondaries | Should -BeFalse
$getTargetResourceResult.AutoCacheUpdate | Should -BeFalse
$getTargetResourceResult.EnableDnsSec | Should -BeTrue
$getTargetResourceResult.SendPort | Should -Be 0
$getTargetResourceResult.WriteAuthorityNS | Should -BeFalse
$getTargetResourceResult.ForwardDelegations | Should -BeFalse
$getTargetResourceResult.EnableIPv6 | Should -BeTrue
$getTargetResourceResult.EnableOnlineSigning | Should -BeTrue
$getTargetResourceResult.EnableDuplicateQuerySuppression | Should -BeTrue
$getTargetResourceResult.AllowCnameAtNs | Should -BeTrue
$getTargetResourceResult.EnableRsoForRodc | Should -BeTrue
$getTargetResourceResult.OpenAclOnProxyUpdates | Should -BeTrue
$getTargetResourceResult.NoUpdateDelegations | Should -BeFalse
$getTargetResourceResult.EnableUpdateForwarding | Should -BeFalse
$getTargetResourceResult.EnableWinsR | Should -BeTrue
$getTargetResourceResult.DeleteOutsideGlue | Should -BeFalse
$getTargetResourceResult.AppendMsZoneTransferTag | Should -BeFalse
$getTargetResourceResult.AllowReadOnlyZoneTransfer | Should -BeFalse
$getTargetResourceResult.EnableSendErrorSuppression | Should -BeTrue
$getTargetResourceResult.SilentlyIgnoreCnameUpdateConflicts | Should -BeFalse
$getTargetResourceResult.EnableIQueryResponseGeneration | Should -BeFalse
$getTargetResourceResult.AdminConfigured | Should -BeTrue
$getTargetResourceResult.PublishAutoNet | Should -BeFalse
$getTargetResourceResult.ReloadException | Should -BeFalse
$getTargetResourceResult.IgnoreServerLevelPolicies | Should -BeFalse
$getTargetResourceResult.IgnoreAllPolicies | Should -BeFalse
$getTargetResourceResult.EnableVersionQuery | Should -Be 0
$getTargetResourceResult.AutoCreateDelegation | Should -Be 2
$getTargetResourceResult.RemoteIPv4RankBoost | Should -Be 5
$getTargetResourceResult.RemoteIPv6RankBoost | Should -Be 0
$getTargetResourceResult.MaximumRodcRsoQueueLength | Should -Be 300
$getTargetResourceResult.MaximumRodcRsoAttemptsPerCycle | Should -Be 100
$getTargetResourceResult.MaxResourceRecordsInNonSecureUpdate | Should -Be 30
$getTargetResourceResult.LocalNetPriorityMask | Should -Be 255
$getTargetResourceResult.TcpReceivePacketSize | Should -Be 65536
$getTargetResourceResult.SelfTest | Should -Be 4294967295
$getTargetResourceResult.XfrThrottleMultiplier | Should -Be 10
$getTargetResourceResult.SocketPoolSize | Should -Be 2500
$getTargetResourceResult.QuietRecvFaultInterval | Should -Be 0
$getTargetResourceResult.QuietRecvLogInterval | Should -Be 0
$getTargetResourceResult.SyncDsZoneSerial | Should -Be 2
$getTargetResourceResult.ScopeOptionValue | Should -Be 0
$getTargetResourceResult.VirtualizationInstanceOptionValue | Should -Be 0
$getTargetResourceResult.ServerLevelPluginDll | Should -Be 'C:\dns\plugin.dll'
$getTargetResourceResult.RootTrustAnchorsURL | Should -Be 'https://data.iana.org/root-anchors/root-anchors.xml'
$getTargetResourceResult.LameDelegationTTL | Should -Be '00:00:00'
$getTargetResourceResult.MaximumSignatureScanPeriod | Should -Be '2.00:00:00'
$getTargetResourceResult.MaximumTrustAnchorActiveRefreshInterval | Should -Be '15.00:00:00'
$getTargetResourceResult.ZoneWritebackInterval | Should -Be '00:01:00'
$getTargetResourceResult.ListeningIPAddress | Should -HaveCount 2
$getTargetResourceResult.ListeningIPAddress | Should -Contain '192.168.1.10'
$getTargetResourceResult.ListeningIPAddress | Should -Contain '192.168.2.10'
$getTargetResourceResult.AllIPAddress | Should -HaveCount 3
$getTargetResourceResult.AllIPAddress | Should -Contain 'fe80::e82e:70b7:f1d4:f695'
$getTargetResourceResult.AllIPAddress | Should -Contain '192.168.1.10'
$getTargetResourceResult.AllIPAddress | Should -Contain '192.168.2.10'
$getTargetResourceResult.SocketPoolExcludedPortRanges | Should -HaveCount 2
$getTargetResourceResult.SocketPoolExcludedPortRanges | Should -Contain 5353
$getTargetResourceResult.SocketPoolExcludedPortRanges | Should -Contain 5454
}
}
}
Describe 'DSC_DnsServerSetting\Test-TargetResource' -Tag 'Test' {
BeforeAll {
Mock -CommandName Assert-Module
}
Context 'When the system is not in the desired state' {
BeforeAll {
Mock -CommandName Get-TargetResource -MockWith {
return @{
DnsServer = 'dns1.company.local'
LocalNetPriority = $true
RoundRobin = $true
RpcProtocol = [System.UInt32] 0
NameCheckFlag = [System.UInt32] 2
AutoConfigFileZones = [System.UInt32] 1
AddressAnswerLimit = [System.UInt32] 0
UpdateOptions = [System.UInt32] 783
DisableAutoReverseZone = $false
StrictFileParsing = $false
EnableDirectoryPartitions = $false
XfrConnectTimeout = [System.UInt32] 30
BootMethod = [System.UInt32] 3
AllowUpdate = $true
LooseWildcarding = $false
BindSecondaries = $false
AutoCacheUpdate = $false
EnableDnsSec = $true
SendPort = [System.UInt32] 0
WriteAuthorityNS = $false
ListeningIPAddress = [System.String[]] @('192.168.1.10', '192.168.2.10')
ForwardDelegations = $false
EnableIPv6 = $true
EnableOnlineSigning = $true
EnableDuplicateQuerySuppression = $true
AllowCnameAtNs = $true
EnableRsoForRodc = $true
OpenAclOnProxyUpdates = $true
NoUpdateDelegations = $false
EnableUpdateForwarding = $false
EnableWinsR = $true
DeleteOutsideGlue = $false
AppendMsZoneTransferTag = $false
AllowReadOnlyZoneTransfer = $false
EnableSendErrorSuppression = $true
SilentlyIgnoreCnameUpdateConflicts = $false
EnableIQueryResponseGeneration = $false
AdminConfigured = $true
PublishAutoNet = $false
ReloadException = $false
IgnoreServerLevelPolicies = $false
IgnoreAllPolicies = $false
EnableVersionQuery = [System.UInt32] 0
AutoCreateDelegation = [System.UInt32] 2
RemoteIPv4RankBoost = [System.UInt32] 5
RemoteIPv6RankBoost = [System.UInt32] 0
MaximumRodcRsoQueueLength = [System.UInt32] 300
MaximumRodcRsoAttemptsPerCycle = [System.UInt32] 100
MaxResourceRecordsInNonSecureUpdate = [System.UInt32] 30
LocalNetPriorityMask = [System.UInt32] 255
TcpReceivePacketSize = [System.UInt32] 65536
SelfTest = [System.UInt32] 4294967295
XfrThrottleMultiplier = [System.UInt32] 10
SocketPoolSize = [System.UInt32] 2500
QuietRecvFaultInterval = [System.UInt32] 0
QuietRecvLogInterval = [System.UInt32] 0
SyncDsZoneSerial = [System.UInt32] 2
ScopeOptionValue = [System.UInt32] 0
VirtualizationInstanceOptionValue = [System.UInt32] 0
ServerLevelPluginDll = 'C:\dns\plugin.dll'
RootTrustAnchorsURL = 'https://data.iana.org/root-anchors/oroot-anchors.xml'
SocketPoolExcludedPortRanges = $null
LameDelegationTTL = '00:00:00'
MaximumSignatureScanPeriod = '2.00:00:00'
MaximumTrustAnchorActiveRefreshInterval = '15.00:00:00'
ZoneWritebackInterval = '00:01:00'
}
}
$testCases = @(
@{
PropertyName = 'LocalNetPriority'
PropertyValue = $false
}
@{
PropertyName = 'RoundRobin'
PropertyValue = $false
}
@{
PropertyName = 'RpcProtocol'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'NameCheckFlag'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'AutoConfigFileZones'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'AddressAnswerLimit'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'UpdateOptions'
PropertyValue = [System.UInt32] 784
}
@{
PropertyName = 'DisableAutoReverseZone'
PropertyValue = $true
}
@{
PropertyName = 'StrictFileParsing'
PropertyValue = $true
}
@{
PropertyName = 'EnableDirectoryPartitions'
PropertyValue = $true
}
@{
PropertyName = 'XfrConnectTimeout'
PropertyValue = [System.UInt32] 40
}
@{
PropertyName = 'BootMethod'
PropertyValue = [System.UInt32] 2
}
@{
PropertyName = 'AllowUpdate'
PropertyValue = $false
}
@{
PropertyName = 'LooseWildcarding'
PropertyValue = $true
}
@{
PropertyName = 'BindSecondaries'
PropertyValue = $true
}
@{
PropertyName = 'AutoCacheUpdate'
PropertyValue = $true
}
@{
PropertyName = 'EnableDnsSec'
PropertyValue = $false
}
@{
PropertyName = 'SendPort'
PropertyValue = [System.UInt32] 100
}
@{
PropertyName = 'WriteAuthorityNS'
PropertyValue = $true
}
@{
PropertyName = 'ForwardDelegations'
PropertyValue = $true
}
@{
PropertyName = 'ListeningIPAddress'
PropertyValue = [System.String[]] @('fe80::e82e:70b7:f1d4:f695')
}
@{
PropertyName = 'EnableIPv6'
PropertyValue = $false
}
@{
PropertyName = 'EnableOnlineSigning'
PropertyValue = $false
}
@{
PropertyName = 'EnableDuplicateQuerySuppression'
PropertyValue = $false
}
@{
PropertyName = 'AllowCnameAtNs'
PropertyValue = $false
}
@{
PropertyName = 'EnableRsoForRodc'
PropertyValue = $false
}
@{
PropertyName = 'OpenAclOnProxyUpdates'
PropertyValue = $false
}
@{
PropertyName = 'NoUpdateDelegations'
PropertyValue = $true
}
@{
PropertyName = 'EnableUpdateForwarding'
PropertyValue = $true
}
@{
PropertyName = 'EnableWinsR'
PropertyValue = $false
}
@{
PropertyName = 'DeleteOutsideGlue'
PropertyValue = $true
}
@{
PropertyName = 'AppendMsZoneTransferTag'
PropertyValue = $true
}
@{
PropertyName = 'AllowReadOnlyZoneTransfer'
PropertyValue = $true
}
@{
PropertyName = 'EnableSendErrorSuppression'
PropertyValue = $false
}
@{
PropertyName = 'SilentlyIgnoreCnameUpdateConflicts'
PropertyValue = $true
}
@{
PropertyName = 'EnableIQueryResponseGeneration'
PropertyValue = $true
}
@{
PropertyName = 'AdminConfigured'
PropertyValue = $false
}
@{
PropertyName = 'PublishAutoNet'
PropertyValue = $true
}
@{
PropertyName = 'ReloadException'
PropertyValue = $true
}
@{
PropertyName = 'IgnoreServerLevelPolicies'
PropertyValue = $true
}
@{
PropertyName = 'IgnoreAllPolicies'
PropertyValue = $true
}
@{
PropertyName = 'EnableVersionQuery'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'AutoCreateDelegation'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'RemoteIPv4RankBoost'
PropertyValue = [System.UInt32] 4
}
@{
PropertyName = 'RemoteIPv6RankBoost'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'MaximumRodcRsoQueueLength'
PropertyValue = [System.UInt32] 350
}
@{
PropertyName = 'MaximumRodcRsoAttemptsPerCycle'
PropertyValue = [System.UInt32] 150
}
@{
PropertyName = 'MaxResourceRecordsInNonSecureUpdate'
PropertyValue = [System.UInt32] 40
}
@{
PropertyName = 'LocalNetPriorityMask'
PropertyValue = [System.UInt32] 254
}
@{
PropertyName = 'TcpReceivePacketSize'
PropertyValue = [System.UInt32] 65000
}
@{
PropertyName = 'SelfTest'
PropertyValue = [System.UInt32] 4000000000
}
@{
PropertyName = 'XfrThrottleMultiplier'
PropertyValue = [System.UInt32] 15
}
@{
PropertyName = 'SocketPoolSize'
PropertyValue = [System.UInt32] 3000
}
@{
PropertyName = 'QuietRecvFaultInterval'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'QuietRecvLogInterval'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'SyncDsZoneSerial'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'ScopeOptionValue'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'VirtualizationInstanceOptionValue'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'ServerLevelPluginDll'
PropertyValue = 'C:\dns\oldPlugin.dll'
}
@{
PropertyName = 'RootTrustAnchorsURL'
PropertyValue = 'https://data.iana.org/old-root-anchors/root-anchors.xml'
}
@{
PropertyName = 'SocketPoolExcludedPortRanges'
PropertyValue = [System.String[]] @(5353, 5454)
}
@{
PropertyName = 'LameDelegationTTL'
PropertyValue = '00:00:01'
}
@{
PropertyName = 'MaximumSignatureScanPeriod'
PropertyValue = '3.00:00:00'
}
@{
PropertyName = 'MaximumTrustAnchorActiveRefreshInterval'
PropertyValue = '20.00:00:00'
}
@{
PropertyName = 'ZoneWritebackInterval'
PropertyValue = '00:00:30'
}
)
}
It 'Should return $false for property <PropertyName>' -TestCases $testCases {
param
(
$PropertyName,
$PropertyValue
)
$testTargetResourceParameters = @{
DnsServer = 'dns1.company.local'
$PropertyName = $PropertyValue
}
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
Context 'When the system is in the desired state' {
BeforeAll {
Mock -CommandName Get-TargetResource -MockWith {
return @{
DnsServer = 'dns1.company.local'
LocalNetPriority = $true
RoundRobin = $true
RpcProtocol = [System.UInt32] 0
NameCheckFlag = [System.UInt32] 2
AutoConfigFileZones = [System.UInt32] 1
AddressAnswerLimit = [System.UInt32] 0
UpdateOptions = [System.UInt32] 783
DisableAutoReverseZone = $false
StrictFileParsing = $false
EnableDirectoryPartitions = $false
XfrConnectTimeout = [System.UInt32] 30
BootMethod = [System.UInt32] 3
AllowUpdate = $true
LooseWildcarding = $false
BindSecondaries = $false
AutoCacheUpdate = $false
EnableDnsSec = $true
SendPort = [System.UInt32] 0
WriteAuthorityNS = $false
ListeningIPAddress = [System.String[]] @('192.168.1.10', '192.168.2.10')
ForwardDelegations = $false
EnableIPv6 = $true
EnableOnlineSigning = $true
EnableDuplicateQuerySuppression = $true
AllowCnameAtNs = $true
EnableRsoForRodc = $true
OpenAclOnProxyUpdates = $true
NoUpdateDelegations = $false
EnableUpdateForwarding = $false
EnableWinsR = $true
DeleteOutsideGlue = $false
AppendMsZoneTransferTag = $false
AllowReadOnlyZoneTransfer = $false
EnableSendErrorSuppression = $true
SilentlyIgnoreCnameUpdateConflicts = $false
EnableIQueryResponseGeneration = $false
AdminConfigured = $true
PublishAutoNet = $false
ReloadException = $false
IgnoreServerLevelPolicies = $false
IgnoreAllPolicies = $false
EnableVersionQuery = [System.UInt32] 0
AutoCreateDelegation = [System.UInt32] 2
RemoteIPv4RankBoost = [System.UInt32] 5
RemoteIPv6RankBoost = [System.UInt32] 0
MaximumRodcRsoQueueLength = [System.UInt32] 300
MaximumRodcRsoAttemptsPerCycle = [System.UInt32] 100
MaxResourceRecordsInNonSecureUpdate = [System.UInt32] 30
LocalNetPriorityMask = [System.UInt32] 255
TcpReceivePacketSize = [System.UInt32] 65536
SelfTest = [System.UInt32] 4294967295
XfrThrottleMultiplier = [System.UInt32] 10
SocketPoolSize = [System.UInt32] 2500
QuietRecvFaultInterval = [System.UInt32] 0
QuietRecvLogInterval = [System.UInt32] 0
SyncDsZoneSerial = [System.UInt32] 2
ScopeOptionValue = [System.UInt32] 0
VirtualizationInstanceOptionValue = [System.UInt32] 0
ServerLevelPluginDll = 'C:\dns\plugin.dll'
RootTrustAnchorsURL = 'https://data.iana.org/root-anchors/root-anchors.xml'
SocketPoolExcludedPortRanges = [System.String[]] @(5353, 5454)
LameDelegationTTL = '00:00:00'
MaximumSignatureScanPeriod = '2.00:00:00'
MaximumTrustAnchorActiveRefreshInterval = '15.00:00:00'
ZoneWritebackInterval = '00:01:00'
}
}
$testCases = @(
@{
PropertyName = 'LocalNetPriority'
PropertyValue = $true
}
@{
PropertyName = 'RoundRobin'
PropertyValue = $true
}
@{
PropertyName = 'RpcProtocol'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'NameCheckFlag'
PropertyValue = [System.UInt32] 2
}
@{
PropertyName = 'AutoConfigFileZones'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'AddressAnswerLimit'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'UpdateOptions'
PropertyValue = [System.UInt32] 783
}
@{
PropertyName = 'DisableAutoReverseZone'
PropertyValue = $false
}
@{
PropertyName = 'StrictFileParsing'
PropertyValue = $false
}
@{
PropertyName = 'EnableDirectoryPartitions'
PropertyValue = $false
}
@{
PropertyName = 'XfrConnectTimeout'
PropertyValue = [System.UInt32] 30
}
@{
PropertyName = 'BootMethod'
PropertyValue = [System.UInt32] 3
}
@{
PropertyName = 'AllowUpdate'
PropertyValue = $true
}
@{
PropertyName = 'LooseWildcarding'
PropertyValue = $false
}
@{
PropertyName = 'BindSecondaries'
PropertyValue = $false
}
@{
PropertyName = 'AutoCacheUpdate'
PropertyValue = $false
}
@{
PropertyName = 'EnableDnsSec'
PropertyValue = $true
}
@{
PropertyName = 'SendPort'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'WriteAuthorityNS'
PropertyValue = $false
}
@{
PropertyName = 'ForwardDelegations'
PropertyValue = $false
}
@{
PropertyName = 'ListeningIPAddress'
PropertyValue = [System.String[]] @('192.168.1.10', '192.168.2.10')
}
@{
PropertyName = 'EnableIPv6'
PropertyValue = $true
}
@{
PropertyName = 'EnableOnlineSigning'
PropertyValue = $true
}
@{
PropertyName = 'EnableDuplicateQuerySuppression'
PropertyValue = $true
}
@{
PropertyName = 'AllowCnameAtNs'
PropertyValue = $true
}
@{
PropertyName = 'EnableRsoForRodc'
PropertyValue = $true
}
@{
PropertyName = 'OpenAclOnProxyUpdates'
PropertyValue = $true
}
@{
PropertyName = 'NoUpdateDelegations'
PropertyValue = $false
}
@{
PropertyName = 'EnableUpdateForwarding'
PropertyValue = $false
}
@{
PropertyName = 'EnableWinsR'
PropertyValue = $true
}
@{
PropertyName = 'DeleteOutsideGlue'
PropertyValue = $false
}
@{
PropertyName = 'AppendMsZoneTransferTag'
PropertyValue = $false
}
@{
PropertyName = 'AllowReadOnlyZoneTransfer'
PropertyValue = $false
}
@{
PropertyName = 'EnableSendErrorSuppression'
PropertyValue = $true
}
@{
PropertyName = 'SilentlyIgnoreCnameUpdateConflicts'
PropertyValue = $false
}
@{
PropertyName = 'EnableIQueryResponseGeneration'
PropertyValue = $false
}
@{
PropertyName = 'AdminConfigured'
PropertyValue = $true
}
@{
PropertyName = 'PublishAutoNet'
PropertyValue = $false
}
@{
PropertyName = 'ReloadException'
PropertyValue = $false
}
@{
PropertyName = 'IgnoreServerLevelPolicies'
PropertyValue = $false
}
@{
PropertyName = 'IgnoreAllPolicies'
PropertyValue = $false
}
@{
PropertyName = 'EnableVersionQuery'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'AutoCreateDelegation'
PropertyValue = [System.UInt32] 2
}
@{
PropertyName = 'RemoteIPv4RankBoost'
PropertyValue = [System.UInt32] 5
}
@{
PropertyName = 'RemoteIPv6RankBoost'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'MaximumRodcRsoQueueLength'
PropertyValue = [System.UInt32] 300
}
@{
PropertyName = 'MaximumRodcRsoAttemptsPerCycle'
PropertyValue = [System.UInt32] 100
}
@{
PropertyName = 'MaxResourceRecordsInNonSecureUpdate'
PropertyValue = [System.UInt32] 30
}
@{
PropertyName = 'LocalNetPriorityMask'
PropertyValue = [System.UInt32] 255
}
@{
PropertyName = 'TcpReceivePacketSize'
PropertyValue = [System.UInt32] 65536
}
@{
PropertyName = 'SelfTest'
PropertyValue = [System.UInt32] 4294967295
}
@{
PropertyName = 'XfrThrottleMultiplier'
PropertyValue = [System.UInt32] 10
}
@{
PropertyName = 'SocketPoolSize'
PropertyValue = [System.UInt32] 2500
}
@{
PropertyName = 'QuietRecvFaultInterval'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'QuietRecvLogInterval'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'SyncDsZoneSerial'
PropertyValue = [System.UInt32] 2
}
@{
PropertyName = 'ScopeOptionValue'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'VirtualizationInstanceOptionValue'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'ServerLevelPluginDll'
PropertyValue = 'C:\dns\plugin.dll'
}
@{
PropertyName = 'RootTrustAnchorsURL'
PropertyValue = 'https://data.iana.org/root-anchors/root-anchors.xml'
}
@{
PropertyName = 'SocketPoolExcludedPortRanges'
PropertyValue = [System.String[]] @(5353, 5454)
}
@{
PropertyName = 'LameDelegationTTL'
PropertyValue = '00:00:00'
}
@{
PropertyName = 'MaximumSignatureScanPeriod'
PropertyValue = '2.00:00:00'
}
@{
PropertyName = 'MaximumTrustAnchorActiveRefreshInterval'
PropertyValue = '15.00:00:00'
}
@{
PropertyName = 'ZoneWritebackInterval'
PropertyValue = '00:01:00'
}
)
}
It 'Should return $true for property <PropertyName>' -TestCases $testCases {
param
(
$PropertyName,
$PropertyValue
)
$testTargetResourceParameters = @{
DnsServer = 'dns1.company.local'
$PropertyName = $PropertyValue
}
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
}
Describe 'DSC_DnsServerSetting\Set-TargetResource' -Tag 'Set' {
BeforeAll {
Mock -CommandName Assert-Module
Mock -CommandName Set-DnsServerSetting
}
Context 'When the system is not in the desired state' {
BeforeAll {
Mock -CommandName Get-DnsServerSetting -MockWith {
return New-CimInstance -ClassName 'DnsServerSetting' -Namespace 'root/Microsoft/Windows/DNS' -ClientOnly -Property @{
DnsServer = 'dns1.company.local'
LocalNetPriority = $true
RoundRobin = $true
RpcProtocol = [System.UInt32] 0
NameCheckFlag = [System.UInt32] 2
AutoConfigFileZones = [System.UInt32] 1
AddressAnswerLimit = [System.UInt32] 0
UpdateOptions = [System.UInt32] 783
DisableAutoReverseZone = $false
StrictFileParsing = $false
EnableDirectoryPartitions = $false
XfrConnectTimeout = [System.UInt32] 30
BootMethod = [System.UInt32] 3
AllowUpdate = $true
LooseWildcarding = $false
BindSecondaries = $false
AutoCacheUpdate = $false
EnableDnsSec = $true
SendPort = [System.UInt32] 0
WriteAuthorityNS = $false
ListeningIPAddress = [System.String[]] @('192.168.1.10', '192.168.2.10')
ForwardDelegations = $false
EnableIPv6 = $true
EnableOnlineSigning = $true
EnableDuplicateQuerySuppression = $true
AllowCnameAtNs = $true
EnableRsoForRodc = $true
OpenAclOnProxyUpdates = $true
NoUpdateDelegations = $false
EnableUpdateForwarding = $false
EnableWinsR = $true
DeleteOutsideGlue = $false
AppendMsZoneTransferTag = $false
AllowReadOnlyZoneTransfer = $false
EnableSendErrorSuppression = $true
SilentlyIgnoreCnameUpdateConflicts = $false
EnableIQueryResponseGeneration = $false
AdminConfigured = $true
PublishAutoNet = $false
ReloadException = $false
IgnoreServerLevelPolicies = $false
IgnoreAllPolicies = $false
EnableVersionQuery = [System.UInt32] 0
AutoCreateDelegation = [System.UInt32] 2
RemoteIPv4RankBoost = [System.UInt32] 5
RemoteIPv6RankBoost = [System.UInt32] 0
MaximumRodcRsoQueueLength = [System.UInt32] 300
MaximumRodcRsoAttemptsPerCycle = [System.UInt32] 100
MaxResourceRecordsInNonSecureUpdate = [System.UInt32] 30
LocalNetPriorityMask = [System.UInt32] 255
TcpReceivePacketSize = [System.UInt32] 65536
SelfTest = [System.UInt32] 4294967295
XfrThrottleMultiplier = [System.UInt32] 10
SocketPoolSize = [System.UInt32] 2500
QuietRecvFaultInterval = [System.UInt32] 0
QuietRecvLogInterval = [System.UInt32] 0
SyncDsZoneSerial = [System.UInt32] 2
ScopeOptionValue = [System.UInt32] 0
VirtualizationInstanceOptionValue = [System.UInt32] 0
ServerLevelPluginDll = 'C:\dns\plugin.dll'
RootTrustAnchorsURL = 'https://data.iana.org/root-anchors/root-anchors.xml'
SocketPoolExcludedPortRanges = [System.String[]] @()
LameDelegationTTL = New-TimeSpan -Seconds 0
MaximumSignatureScanPeriod = New-TimeSpan -Days 2
MaximumTrustAnchorActiveRefreshInterval = New-TimeSpan -Days 15
ZoneWritebackInterval = New-TimeSpan -Minutes 1
}
}
$testCases = @(
@{
PropertyName = 'LocalNetPriority'
PropertyValue = $false
}
@{
PropertyName = 'RoundRobin'
PropertyValue = $false
}
@{
PropertyName = 'RpcProtocol'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'NameCheckFlag'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'AutoConfigFileZones'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'AddressAnswerLimit'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'UpdateOptions'
PropertyValue = [System.UInt32] 784
}
@{
PropertyName = 'DisableAutoReverseZone'
PropertyValue = $true
}
@{
PropertyName = 'StrictFileParsing'
PropertyValue = $true
}
@{
PropertyName = 'EnableDirectoryPartitions'
PropertyValue = $true
}
@{
PropertyName = 'XfrConnectTimeout'
PropertyValue = [System.UInt32] 40
}
@{
PropertyName = 'BootMethod'
PropertyValue = [System.UInt32] 2
}
@{
PropertyName = 'AllowUpdate'
PropertyValue = $false
}
@{
PropertyName = 'LooseWildcarding'
PropertyValue = $true
}
@{
PropertyName = 'BindSecondaries'
PropertyValue = $true
}
@{
PropertyName = 'AutoCacheUpdate'
PropertyValue = $true
}
@{
PropertyName = 'EnableDnsSec'
PropertyValue = $false
}
@{
PropertyName = 'SendPort'
PropertyValue = [System.UInt32] 100
}
@{
PropertyName = 'WriteAuthorityNS'
PropertyValue = $true
}
@{
PropertyName = 'ForwardDelegations'
PropertyValue = $true
}
@{
PropertyName = 'ListeningIPAddress'
PropertyValue = [System.String[]] @('fe80::e82e:70b7:f1d4:f695')
}
@{
PropertyName = 'EnableIPv6'
PropertyValue = $false
}
@{
PropertyName = 'EnableOnlineSigning'
PropertyValue = $false
}
@{
PropertyName = 'EnableDuplicateQuerySuppression'
PropertyValue = $false
}
@{
PropertyName = 'AllowCnameAtNs'
PropertyValue = $false
}
@{
PropertyName = 'EnableRsoForRodc'
PropertyValue = $false
}
@{
PropertyName = 'OpenAclOnProxyUpdates'
PropertyValue = $false
}
@{
PropertyName = 'NoUpdateDelegations'
PropertyValue = $true
}
@{
PropertyName = 'EnableUpdateForwarding'
PropertyValue = $true
}
@{
PropertyName = 'EnableWinsR'
PropertyValue = $false
}
@{
PropertyName = 'DeleteOutsideGlue'
PropertyValue = $true
}
@{
PropertyName = 'AppendMsZoneTransferTag'
PropertyValue = $true
}
@{
PropertyName = 'AllowReadOnlyZoneTransfer'
PropertyValue = $true
}
@{
PropertyName = 'EnableSendErrorSuppression'
PropertyValue = $false
}
@{
PropertyName = 'SilentlyIgnoreCnameUpdateConflicts'
PropertyValue = $true
}
@{
PropertyName = 'EnableIQueryResponseGeneration'
PropertyValue = $true
}
@{
PropertyName = 'AdminConfigured'
PropertyValue = $false
}
@{
PropertyName = 'PublishAutoNet'
PropertyValue = $true
}
@{
PropertyName = 'ReloadException'
PropertyValue = $true
}
@{
PropertyName = 'IgnoreServerLevelPolicies'
PropertyValue = $true
}
@{
PropertyName = 'IgnoreAllPolicies'
PropertyValue = $true
}
@{
PropertyName = 'EnableVersionQuery'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'AutoCreateDelegation'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'RemoteIPv4RankBoost'
PropertyValue = [System.UInt32] 4
}
@{
PropertyName = 'RemoteIPv6RankBoost'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'MaximumRodcRsoQueueLength'
PropertyValue = [System.UInt32] 350
}
@{
PropertyName = 'MaximumRodcRsoAttemptsPerCycle'
PropertyValue = [System.UInt32] 150
}
@{
PropertyName = 'MaxResourceRecordsInNonSecureUpdate'
PropertyValue = [System.UInt32] 40
}
@{
PropertyName = 'LocalNetPriorityMask'
PropertyValue = [System.UInt32] 254
}
@{
PropertyName = 'TcpReceivePacketSize'
PropertyValue = [System.UInt32] 65000
}
@{
PropertyName = 'SelfTest'
PropertyValue = [System.UInt32] 4000000000
}
@{
PropertyName = 'XfrThrottleMultiplier'
PropertyValue = [System.UInt32] 15
}
@{
PropertyName = 'SocketPoolSize'
PropertyValue = [System.UInt32] 3000
}
@{
PropertyName = 'QuietRecvFaultInterval'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'QuietRecvLogInterval'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'SyncDsZoneSerial'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'ScopeOptionValue'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'VirtualizationInstanceOptionValue'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'ServerLevelPluginDll'
PropertyValue = 'C:\dns\oldPlugin.dll'
}
@{
PropertyName = 'RootTrustAnchorsURL'
PropertyValue = 'https://data.iana.org/old-root-anchors/root-anchors.xml'
}
@{
PropertyName = 'SocketPoolExcludedPortRanges'
PropertyValue = [System.String[]] @(5353, 5454)
}
@{
PropertyName = 'LameDelegationTTL'
PropertyValue = '00:00:01'
}
@{
PropertyName = 'MaximumSignatureScanPeriod'
PropertyValue = '3.00:00:00'
}
@{
PropertyName = 'MaximumTrustAnchorActiveRefreshInterval'
PropertyValue = '20.00:00:00'
}
@{
PropertyName = 'ZoneWritebackInterval'
PropertyValue = '00:00:30'
}
)
}
It 'Should not throw and call the correct mock to set the property <PropertyName>' -TestCases $testCases {
param
(
$PropertyName,
$PropertyValue
)
$setTargetResourceParameters = @{
DnsServer = 'dns1.company.local'
$PropertyName = $PropertyValue
}
{ Set-TargetResource @setTargetResourceParameters } | Should -Not -Throw
Assert-MockCalled -CommandName Set-DnsServerSetting -Exactly -Times 1 -Scope It
}
}
Context 'When the system is in the desired state' {
BeforeAll {
Mock -CommandName Get-DnsServerSetting -MockWith {
return New-CimInstance -ClassName 'DnsServerSetting' -Namespace 'root/Microsoft/Windows/DNS' -ClientOnly -Property @{
DnsServer = 'dns1.company.local'
LocalNetPriority = $true
RoundRobin = $true
RpcProtocol = [System.UInt32] 0
NameCheckFlag = [System.UInt32] 2
AutoConfigFileZones = [System.UInt32] 1
AddressAnswerLimit = [System.UInt32] 0
UpdateOptions = [System.UInt32] 783
DisableAutoReverseZone = $false
StrictFileParsing = $false
EnableDirectoryPartitions = $false
XfrConnectTimeout = [System.UInt32] 30
BootMethod = [System.UInt32] 3
AllowUpdate = $true
LooseWildcarding = $false
BindSecondaries = $false
AutoCacheUpdate = $false
EnableDnsSec = $true
SendPort = [System.UInt32] 0
WriteAuthorityNS = $false
ListeningIPAddress = [System.String[]] @('192.168.1.10', '192.168.2.10')
ForwardDelegations = $false
EnableIPv6 = $true
EnableOnlineSigning = $true
EnableDuplicateQuerySuppression = $true
AllowCnameAtNs = $true
EnableRsoForRodc = $true
OpenAclOnProxyUpdates = $true
NoUpdateDelegations = $false
EnableUpdateForwarding = $false
EnableWinsR = $true
DeleteOutsideGlue = $false
AppendMsZoneTransferTag = $false
AllowReadOnlyZoneTransfer = $false
EnableSendErrorSuppression = $true
SilentlyIgnoreCnameUpdateConflicts = $false
EnableIQueryResponseGeneration = $false
AdminConfigured = $true
PublishAutoNet = $false
ReloadException = $false
IgnoreServerLevelPolicies = $false
IgnoreAllPolicies = $false
EnableVersionQuery = [System.UInt32] 0
AutoCreateDelegation = [System.UInt32] 2
RemoteIPv4RankBoost = [System.UInt32] 5
RemoteIPv6RankBoost = [System.UInt32] 0
MaximumRodcRsoQueueLength = [System.UInt32] 300
MaximumRodcRsoAttemptsPerCycle = [System.UInt32] 100
MaxResourceRecordsInNonSecureUpdate = [System.UInt32] 30
LocalNetPriorityMask = [System.UInt32] 255
TcpReceivePacketSize = [System.UInt32] 65536
SelfTest = [System.UInt32] 4294967295
XfrThrottleMultiplier = [System.UInt32] 10
SocketPoolSize = [System.UInt32] 2500
QuietRecvFaultInterval = [System.UInt32] 0
QuietRecvLogInterval = [System.UInt32] 0
SyncDsZoneSerial = [System.UInt32] 2
ScopeOptionValue = [System.UInt32] 0
VirtualizationInstanceOptionValue = [System.UInt32] 0
ServerLevelPluginDll = 'C:\dns\plugin.dll'
RootTrustAnchorsURL = 'https://data.iana.org/root-anchors/root-anchors.xml'
SocketPoolExcludedPortRanges = [System.String[]] @(5353, 5454)
LameDelegationTTL = New-TimeSpan -Seconds 0
MaximumSignatureScanPeriod = New-TimeSpan -Days 2
MaximumTrustAnchorActiveRefreshInterval = New-TimeSpan -Days 15
ZoneWritebackInterval = New-TimeSpan -Minutes 1
}
}
$testCases = @(
@{
PropertyName = 'LocalNetPriority'
PropertyValue = $true
}
@{
PropertyName = 'RoundRobin'
PropertyValue = $true
}
@{
PropertyName = 'RpcProtocol'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'NameCheckFlag'
PropertyValue = [System.UInt32] 2
}
@{
PropertyName = 'AutoConfigFileZones'
PropertyValue = [System.UInt32] 1
}
@{
PropertyName = 'AddressAnswerLimit'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'UpdateOptions'
PropertyValue = [System.UInt32] 783
}
@{
PropertyName = 'DisableAutoReverseZone'
PropertyValue = $false
}
@{
PropertyName = 'StrictFileParsing'
PropertyValue = $false
}
@{
PropertyName = 'EnableDirectoryPartitions'
PropertyValue = $false
}
@{
PropertyName = 'XfrConnectTimeout'
PropertyValue = [System.UInt32] 30
}
@{
PropertyName = 'BootMethod'
PropertyValue = [System.UInt32] 3
}
@{
PropertyName = 'AllowUpdate'
PropertyValue = $true
}
@{
PropertyName = 'LooseWildcarding'
PropertyValue = $false
}
@{
PropertyName = 'BindSecondaries'
PropertyValue = $false
}
@{
PropertyName = 'AutoCacheUpdate'
PropertyValue = $false
}
@{
PropertyName = 'EnableDnsSec'
PropertyValue = $true
}
@{
PropertyName = 'SendPort'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'WriteAuthorityNS'
PropertyValue = $false
}
@{
PropertyName = 'ForwardDelegations'
PropertyValue = $false
}
@{
PropertyName = 'ListeningIPAddress'
PropertyValue = [System.String[]] @('192.168.1.10', '192.168.2.10')
}
@{
PropertyName = 'EnableIPv6'
PropertyValue = $true
}
@{
PropertyName = 'EnableOnlineSigning'
PropertyValue = $true
}
@{
PropertyName = 'EnableDuplicateQuerySuppression'
PropertyValue = $true
}
@{
PropertyName = 'AllowCnameAtNs'
PropertyValue = $true
}
@{
PropertyName = 'EnableRsoForRodc'
PropertyValue = $true
}
@{
PropertyName = 'OpenAclOnProxyUpdates'
PropertyValue = $true
}
@{
PropertyName = 'NoUpdateDelegations'
PropertyValue = $false
}
@{
PropertyName = 'EnableUpdateForwarding'
PropertyValue = $false
}
@{
PropertyName = 'EnableWinsR'
PropertyValue = $true
}
@{
PropertyName = 'DeleteOutsideGlue'
PropertyValue = $false
}
@{
PropertyName = 'AppendMsZoneTransferTag'
PropertyValue = $false
}
@{
PropertyName = 'AllowReadOnlyZoneTransfer'
PropertyValue = $false
}
@{
PropertyName = 'EnableSendErrorSuppression'
PropertyValue = $true
}
@{
PropertyName = 'SilentlyIgnoreCnameUpdateConflicts'
PropertyValue = $false
}
@{
PropertyName = 'EnableIQueryResponseGeneration'
PropertyValue = $false
}
@{
PropertyName = 'AdminConfigured'
PropertyValue = $true
}
@{
PropertyName = 'PublishAutoNet'
PropertyValue = $false
}
@{
PropertyName = 'ReloadException'
PropertyValue = $false
}
@{
PropertyName = 'IgnoreServerLevelPolicies'
PropertyValue = $false
}
@{
PropertyName = 'IgnoreAllPolicies'
PropertyValue = $false
}
@{
PropertyName = 'EnableVersionQuery'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'AutoCreateDelegation'
PropertyValue = [System.UInt32] 2
}
@{
PropertyName = 'RemoteIPv4RankBoost'
PropertyValue = [System.UInt32] 5
}
@{
PropertyName = 'RemoteIPv6RankBoost'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'MaximumRodcRsoQueueLength'
PropertyValue = [System.UInt32] 300
}
@{
PropertyName = 'MaximumRodcRsoAttemptsPerCycle'
PropertyValue = [System.UInt32] 100
}
@{
PropertyName = 'MaxResourceRecordsInNonSecureUpdate'
PropertyValue = [System.UInt32] 30
}
@{
PropertyName = 'LocalNetPriorityMask'
PropertyValue = [System.UInt32] 255
}
@{
PropertyName = 'TcpReceivePacketSize'
PropertyValue = [System.UInt32] 65536
}
@{
PropertyName = 'SelfTest'
PropertyValue = [System.UInt32] 4294967295
}
@{
PropertyName = 'XfrThrottleMultiplier'
PropertyValue = [System.UInt32] 10
}
@{
PropertyName = 'SocketPoolSize'
PropertyValue = [System.UInt32] 2500
}
@{
PropertyName = 'QuietRecvFaultInterval'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'QuietRecvLogInterval'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'SyncDsZoneSerial'
PropertyValue = [System.UInt32] 2
}
@{
PropertyName = 'ScopeOptionValue'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'VirtualizationInstanceOptionValue'
PropertyValue = [System.UInt32] 0
}
@{
PropertyName = 'ServerLevelPluginDll'
PropertyValue = 'C:\dns\plugin.dll'
}
@{
PropertyName = 'RootTrustAnchorsURL'
PropertyValue = 'https://data.iana.org/root-anchors/root-anchors.xml'
}
@{
PropertyName = 'SocketPoolExcludedPortRanges'
PropertyValue = [System.String[]] @(5353, 5454)
}
@{
PropertyName = 'LameDelegationTTL'
PropertyValue = '00:00:00'
}
@{
PropertyName = 'MaximumSignatureScanPeriod'
PropertyValue = '2.00:00:00'
}
@{
PropertyName = 'MaximumTrustAnchorActiveRefreshInterval'
PropertyValue = '15.00:00:00'
}
@{
PropertyName = 'ZoneWritebackInterval'
PropertyValue = '00:01:00'
}
)
}
It 'Should not throw and should not set the property <PropertyName>' -TestCases $testCases {
param
(
$PropertyName,
$PropertyValue
)
$setTargetResourceParameters = @{
DnsServer = 'dns1.company.local'
$PropertyName = $PropertyValue
}
{ Set-TargetResource @setTargetResourceParameters } | Should -Not -Throw
Assert-MockCalled -CommandName Set-DnsServerSetting -Exactly -Times 0 -Scope It
}
}
}
}
}
finally
{
Invoke-TestCleanup
}
| 53.513333
| 142
| 0.350001
|
6ddd0a5853a1c0d4986d94dd64ee39de186f3987
| 220
|
h
|
C
|
src/other_methods/bonn.h
|
chengengjie/salt
|
99f35e51c773c83877ed66d61c845bea24b19b3d
|
[
"MIT"
] | 17
|
2018-06-14T10:45:26.000Z
|
2021-12-20T12:06:23.000Z
|
src/other_methods/bonn.h
|
chengengjie/salt
|
99f35e51c773c83877ed66d61c845bea24b19b3d
|
[
"MIT"
] | 1
|
2022-01-25T09:40:34.000Z
|
2022-01-25T09:40:34.000Z
|
src/other_methods/bonn.h
|
chengengjie/salt
|
99f35e51c773c83877ed66d61c845bea24b19b3d
|
[
"MIT"
] | 5
|
2020-04-03T16:32:11.000Z
|
2021-10-20T12:37:08.000Z
|
#pragma once
#include "salt/base/tree.h"
namespace salt {
// Bonn algorithm
class BonnBuilder {
public:
static double unitCap;
void Run(const Net &net, Tree &saltTree, double epsilon);
};
} // namespace salt
| 15.714286
| 61
| 0.695455
|
ef532f6671dd7f6c829e5f98eb0eaacdd45222a7
| 2,558
|
php
|
PHP
|
controllers/JobScoreController.php
|
roundhouse/Jobscore
|
5ecc65a61a9b294c20866a34d93e57c598c2d818
|
[
"MIT"
] | 2
|
2016-10-31T11:18:51.000Z
|
2020-12-21T15:32:04.000Z
|
controllers/JobScoreController.php
|
roundhouse/Jobscore
|
5ecc65a61a9b294c20866a34d93e57c598c2d818
|
[
"MIT"
] | null | null | null |
controllers/JobScoreController.php
|
roundhouse/Jobscore
|
5ecc65a61a9b294c20866a34d93e57c598c2d818
|
[
"MIT"
] | null | null | null |
<?php
/**
* Job Score plugin for Craft CMS
*
* JobScore Controller
*
* @author Vadim Goncharov
* @copyright Copyright (c) 2016 Vadim Goncharov
* @link http://roundhouseagency.com
* @package JobScore
* @since 0.0.1
*/
namespace Craft;
class JobScoreController extends BaseController
{
/**
* @var bool|array Allows anonymous access to this controller's actions.
* @access protected
*/
protected $allowAnonymous = array('actionIndex');
/**
List Jobs
*/
public function actionIndex()
{
$variables['jobs'] = craft()->jobScore->getAllJobs();
$this->renderTemplate('jobscore/index', $variables);
}
/**
Sync Jobs
*/
public function actionSyncJobs()
{
$setings = craft()->plugins->getPlugin('jobscore')->getSettings();
$organizationName = $setings['organizationName'];
if (!empty($organizationName)) {
$url = 'http://www.jobscore.com/jobs/'.$organizationName.'/feed.json';
$json = file_get_contents($url);
$jobsObjects = json_decode($json);
craft()->db->createCommand()->truncateTable(JobScoreRecord::model()->tableName());
$jobIds = [];
foreach ($jobsObjects->jobs as $job) {
$slugTitle = false;
$jobId = (string) $job->id;
$jobEntry = new JobScoreModel();
$string = htmlentities($job->description, null, 'utf-8');
$source = str_replace(" ", "", $string);
$content = html_entity_decode($source);
$description = preg_replace('/<h3[^>]*><\\/h3[^>]*>/', '', $content);
// Populate Model
$jobEntry->companyName = $job->company_name;
$jobEntry->slug = $job->title;
$jobEntry->jobId = $job->id;
$jobEntry->title = $job->title;
$jobEntry->type = $job->job_type;
$jobEntry->applyUrl = $job->apply_url;
$jobEntry->detailUrl = $job->detail_url;
$jobEntry->department = $job->department;
$jobEntry->location = $job->location;
$jobEntry->city = $job->city;
$jobEntry->state = $job->state;
$jobEntry->country = $job->country;
$jobEntry->zipcode = $job->postal_code;
$jobEntry->description = $description;
$jobEntry->jobDateUpdated = $job->last_updated_date;
$jobEntry->jobDateOpened = $job->opened_date;
$jobEntry->jobDateCreate = $job->created_on;
craft()->jobScore->saveJob($jobEntry);
}
} else {
craft()->userSession->setError(Craft::t('You must set Organization Name in plugin settings.'));
}
}
}
| 29.068182
| 101
| 0.601642
|
4381ce5189e7abfc2505362dd5e998cfe31e7f69
| 1,060
|
ts
|
TypeScript
|
test-js/calculator-test.ts
|
JanaSimjanovska/skwd9-niwd2-wdel6
|
117268c60d8f7bb83b645c2d0e1a72be294665ed
|
[
"MIT"
] | null | null | null |
test-js/calculator-test.ts
|
JanaSimjanovska/skwd9-niwd2-wdel6
|
117268c60d8f7bb83b645c2d0e1a72be294665ed
|
[
"MIT"
] | null | null | null |
test-js/calculator-test.ts
|
JanaSimjanovska/skwd9-niwd2-wdel6
|
117268c60d8f7bb83b645c2d0e1a72be294665ed
|
[
"MIT"
] | 11
|
2021-11-01T20:08:45.000Z
|
2021-11-18T16:20:37.000Z
|
import { Calculator } from "./calculator";
// 1. Arrange
const addExpected = 3;
console.log(`Calling Calculator.add(1, 2). The Expected value is ${addExpected}`);
// 2. Act
const addResult = Calculator.add(1, 2);
// 3. Assert
console.log(addResult);
console.log(addExpected === addResult ? "\x1b[32mPassed\x1b[0m" : "\x1b[31mFailed\x1b[0m");
// 1. Arrange
const mulExpected = 4;
console.log(`Calling Calculator.multiply(2, 2). The Expected value is ${mulExpected}`);
// 2. Act
const mulResult = Calculator.multiply(2, 2);
// 3. Assert
console.log(mulResult);
console.log(mulExpected === mulResult ? "\x1b[32mPassed\x1b[0m" : "\x1b[31mFailed\x1b[0m");
// 1. Arrange
const mul2Expected = 12;
const mul2First = 4;
const mul2Second = 3;
console.log(`Calling Calculator.multiply(${mul2First}, ${mul2Second}). The Expected value is ${mul2Expected}`);
// 2. Act
const mul2Result = Calculator.multiply(mul2First, mul2Second);
// 3. Assert
console.log(mul2Result);
console.log(mul2Expected === mul2Result ? "\x1b[32mPassed\x1b[0m" : "\x1b[31mFailed\x1b[0m");
| 27.894737
| 111
| 0.706604
|
dab2d67f71d4c4f492e52a05f12bf9102e72a2a5
| 519
|
php
|
PHP
|
database/seeds/PacientesTableSeeder.php
|
gabrieldesousah/Vitta
|
2a6effda803afdea3a230c7a9bfa0ecc641e22da
|
[
"MIT"
] | null | null | null |
database/seeds/PacientesTableSeeder.php
|
gabrieldesousah/Vitta
|
2a6effda803afdea3a230c7a9bfa0ecc641e22da
|
[
"MIT"
] | null | null | null |
database/seeds/PacientesTableSeeder.php
|
gabrieldesousah/Vitta
|
2a6effda803afdea3a230c7a9bfa0ecc641e22da
|
[
"MIT"
] | null | null | null |
<?php
use Illuminate\Database\Seeder;
class PacientesTableSeeder extends Seeder
{
public function run()
{
//Queremos criar de 5 a 10 respostas por tópico
//O laravel cria uma collection com o seguinte script:
$pacientes = factory(\App\Paciente::class, 50)->create();
//Agora posso entrar no collection como se fosse um array:
$pacientes->each(function($paciente) {
factory(\App\exames_resultados::class, rand(5,10))->create(['paciente_id' => $paciente->id]);
});
}
}
| 28.833333
| 100
| 0.666667
|
7500faabc544116cc1254194930da326063b685c
| 8,095
|
css
|
CSS
|
app/www/ui2/js/ui/farms/builder/builder.css
|
ePlusPS/scalr
|
3f2b1f07768c773be890c88f3a2a2d197c7eabc9
|
[
"Apache-2.0"
] | null | null | null |
app/www/ui2/js/ui/farms/builder/builder.css
|
ePlusPS/scalr
|
3f2b1f07768c773be890c88f3a2a2d197c7eabc9
|
[
"Apache-2.0"
] | null | null | null |
app/www/ui2/js/ui/farms/builder/builder.css
|
ePlusPS/scalr
|
3f2b1f07768c773be890c88f3a2a2d197c7eabc9
|
[
"Apache-2.0"
] | null | null | null |
/*farm settings & add role buttons*/
.x-docked-tabs .x-btn-farm-settings {
box-shadow: 0 -1px #85a7c6 inset;
}
.x-docked-tabs .x-btn-farm-settings .x-btn-inner {
line-height: 48px;
text-transform: none;
font-family: OpenSansSemiBold;
font-size: 14px;
width: 154px;
padding-left: 6px;
}
.x-btn-farm-settings.x-btn-new-farm.x-btn-pressed .x-btn-inner {
color: rgba(34, 65, 100, 0.6);
}
.x-btn-farm-settings .x-btn-icon-settings {
margin-left: 10px!important;
background: url('/ui2/images/ui/farms/farmdesigner/settings-sprite.png') 0 0 no-repeat;
}
.x-btn-farm-settings.x-btn-pressed .x-btn-icon-settings {
background-position: 0 -24px;
}
.x-btn-farmroles-add {
width: 100%;
position:absolute;
z-index:3;
background: #699b62;
bottom: 0;
height: 56px;
border-radius: 0;
}
.x-btn-farmroles-add.x-btn-over {
background: #7ab372;
}
.x-btn-farmsettings {
height: 56px;
}
.x-btn-farmsettings .x-btn-inner {
padding-left: 14px!important;
}
.x-btn-farmsettings .x-btn-inner img {
margin-right: 8px;
}
/*widget.farmrolesview*/
.x-docked-tabs-farm-settings .x-panel-body-default {
padding-bottom: 56px;
}
.x-dataview-farmroles {
box-shadow: 0 1px #88a9c7 inset;
}
.x-dataview-farmroles .x-dataview-tab {
line-height: 1.4em;
}
.x-dataview-farmroles .name {
font-family: OpenSansSemiBold, Arial, sens-serif;
}
.x-dataview-farmroles .platform-location {
margin-left: 26px;
}
.x-dataview-farmroles .platform,
.x-dataview-farmroles .location {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.x-dataview-farmroles .platform {
text-transform: uppercase;
line-height: 1.8em;
}
.x-dataview-farmroles .location {
font-style: italic;
}
.x-dataview-farmroles .launchindex{
display: none;
position: absolute;
margin-top: 3px;
width: 18px;
text-align: center;
font-family: OpenSansSemiBold, Arial, sens-serif;
}
.x-dataview-farmroles-sortable .launchindex{
display:block;
}
.x-dataview-farmroles .delete-role {
position: absolute;
right: 0px;
top: 0px;
width: 24px;
height: 24px;
cursor: pointer;
background: url('/ui2/images/ui/farms/farmdesigner/close-small-sprite.png') 0 0 no-repeat;
z-index: 2;
display: none;
}
.x-dataview-farmroles .delete-role:hover {
background-position: 0 -24px;
}
.x-dataview-farmroles .x-dataview-tab:hover .delete-role{
display: block;
}
.x-dataview-farmroles .x-grid-empty {
background: transparent;
color: #fff;
}
/*farm role editor*/
.x-comboradiolist .x-menu-item-disabled-forced .x-menu-item-text{
padding-right: 24px;
background: url('/ui2/js/extjs-5.0/theme/images/form/trigger-warning.png') 100% 50% no-repeat;
}
.x-farmrole-editor-tab > .x-mask{
opacity: 1;
background: #e1ebf4;
}
.x-farmrole-editor-tab > .x-mask .x-mask-error div{
background: transparent;
width: auto;
}
.x-farmrole-editor-tab .x-container .x-mask{
background: transparent;
}
/*farmrole editor main tab*/
.x-farmrole-editor-maintab .x-overflow-ellipsis{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
line-height:20px
}
.x-farmrole-editor-maintab .x-icon-replace{
background: url('/ui2/images/ui/farms/farmdesigner/replace.png') 50% 50% no-repeat;
}
.x-farmrole-editor-maintab .x-btn-collapse, .x-farmrole-editor-maintab .x-btn-collapse .x-btn-inner {
width: 24px !important;
height: 22px !important;
}
.x-farmrole-editor-maintab .x-btn-collapse .x-btn-inner {
background: url('/ui2/js/extjs-5.0/theme/images/icon/collapse-sprite.png?1.1') no-repeat 0 0;
cursor: pointer;
}
.x-farmrole-editor-maintab .x-btn-collapse.x-btn-pressed .x-btn-inner {
background-position: 0px -24px;
}
.x-farmrole-editor-maintab .x-btn-collapse.x-btn-over .x-btn-inner {
opacity: .8;
}
.x-farmrole-editor-maintab .daily-rate {
text-align: center;
font-size: 16px;
font-family: OpenSansSemiBold;
}
.x-farmrole-editor-maintab .daily-rate .small{
font-size: 14px;
}
.x-farmrole-editor-maintab .hourly-rate {
text-align: center;
}
/*roles library search result button*/
.x-roleslibrary-search-result-btn .x-btn-inner{
width: 160px;
overflow: hidden;
text-overflow:ellipsis;
position: relative;
}
.x-roleslibrary-search-result-btn .delete-search{
position: absolute;
width: 12px;
height: 12px;
right: 4px;
top: 4px;
background: url('/ui2/images/ui/farms/farmdesigner/close-small-sprite.png') -6px -6px no-repeat;
}
/*roleslibrary quickstart tab*/
.x-btn-tab-quickstart .x-btn-inner{
color: #176F2B!important;
}
/*roleslibrary roles list*/
.x-roleslibary-list .x-icon-platform-small,
.x-roleslibary-list .x-icon-osfamily-small {
opacity: .4;
}
.x-roleslibary-list .x-grid-item-over .x-icon-platform-small,
.x-roleslibary-list .x-grid-item-over .x-icon-osfamily-small {
opacity: 1;
}
.x-roleslibary-list .x-grid-cell-inner {
padding-left: 0;
padding-right: 0;
}
.x-roleslibary-list .x-icon-platform-small {
margin-left: 6px;
}
.x-roleslibary-list .x-grid-row-green-text .x-grid-cell-inner{
color: green;
}
/*roleslibrary nothing found text*/
.x-roleslibrary .emptytext{
text-align: center;
padding: 20px 20px 0;
color: #666;
font: 13px/19px arial;
}
.x-roleslibrary .emptytext .title{
font: 18px/30px arial;
color: #202B3D;
text-shadow: 0 1px rgba(255, 255, 255, 0.3);
margin-bottom: 12px;
}
.x-roleslibrary .x-items-extra{
position:relative;
margin-left:50%;
left:-137px;
float:left;
width: 300px;
height: 130px;
}
.x-roleslibrary .x-items-extra.single{
left:-61px;
}
.x-roleslibrary .x-item-extra{
width: 110px;
height: 110px;
background: #fff;
border-radius: 4px;
text-align:center;
float:left;
margin:0 10px 10px 0;
overflow:hidden;
padding:0;
}
.x-roleslibrary .x-item-extra:hover{
text-decoration:none;
background:#F9FAFB;
}
.x-roleslibrary .x-item-extra .x-item-inner{
display: block;
}
.x-roleslibrary .x-item-extra .icon{
display: block;
margin-bottom: 6px;
}
.x-roleslibrary .x-item-extra .title{
font-size:12px;
font-weight:normal;
}
.x-roleslibrary .x-item-extra-delimiter{
float:left;
height: 100px;
line-height:100px!important;
width: 30px;
margin:0 12px 12px 0;
}
.x-roleslibrary .inner-container {
background: #e1ebf4;
border-radius: 1px;
margin: 12px 0 0 0;
padding: 18px 18px 6px;
}
/*farm costmetering*/
.x-costmetering-hours .title{
margin: 12px 0 4px;
font-family: OpenSansSemiBold;
}
.x-costmetering-hours table{
border-collapse: collapse;
}
.x-costmetering-hours table td{
text-align: center;
padding: 0 16px;
}
.x-costmetering-farmroles table{
margin-top: 4px;
border-collapse: collapse;
}
.x-costmetering-farmroles table th,
.x-costmetering-farmroles table td{
text-align: left;
white-space: nowrap;
padding: 4px 24px 0 0;
}
.x-costmetering-farmroles table td:last-child,
.x-ui-costmetering-farmroles table th:last-child{
padding-right: 0;
}
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5) {
.x-btn-farm-settings .x-btn-icon-settings {
background-size: 24px 48px;
background-image: url('/ui2/images/ui/farms/farmdesigner/settings-sprite-retina.png');
}
.x-farmrole-editor-maintab .x-icon-replace{
background-size: 30px 20px;
background-image: url('/ui2/images/ui/farms/farmdesigner/replace-retina.png');
}
.x-dataview-farmroles .delete-role {
background-image: url('/ui2/images/ui/farms/farmdesigner/close-small-sprite-retina.png');
background-size: 48px 48px;
}
.x-farmrole-editor-maintab .x-btn-collapse .x-btn-inner {
background-size: 26px 48px;
background-image: url('/ui2/js/extjs-5.0/theme/images/icon/collapse-sprite-retina.png?1.1');
}
}
| 21.819407
| 101
| 0.677579
|
23b1dd8e0879640c9d09253ae002e714634c913d
| 815
|
js
|
JavaScript
|
app/client/templates/patients/create_patient/create_patient.js
|
TransWebT/miniPIMS
|
e1272f0cb0c119ec02cdd1b56d4c6637954a9a79
|
[
"Apache-2.0"
] | null | null | null |
app/client/templates/patients/create_patient/create_patient.js
|
TransWebT/miniPIMS
|
e1272f0cb0c119ec02cdd1b56d4c6637954a9a79
|
[
"Apache-2.0"
] | null | null | null |
app/client/templates/patients/create_patient/create_patient.js
|
TransWebT/miniPIMS
|
e1272f0cb0c119ec02cdd1b56d4c6637954a9a79
|
[
"Apache-2.0"
] | null | null | null |
/*****************************************************************************/
/* CreatePatient: Event Handlers */
/*****************************************************************************/
Template.CreatePatient.events({
});
/*****************************************************************************/
/* CreatePatient: Helpers */
/*****************************************************************************/
Template.CreatePatient.helpers({
});
/*****************************************************************************/
/* CreatePatient: Lifecycle Hooks */
/*****************************************************************************/
Template.CreatePatient.onCreated(function () {
});
Template.CreatePatient.onRendered(function () {
});
Template.CreatePatient.onDestroyed(function () {
});
| 33.958333
| 79
| 0.300613
|
d249852ee9beb992b36d7906055b86dbc25c928f
| 957
|
swift
|
Swift
|
Sources/UserDefaultElement/UserDefaultElement.swift
|
3sidedcube/UserDefault
|
32b6d3647fb5429f2401e089e3df5fba02749038
|
[
"MIT"
] | null | null | null |
Sources/UserDefaultElement/UserDefaultElement.swift
|
3sidedcube/UserDefault
|
32b6d3647fb5429f2401e089e3df5fba02749038
|
[
"MIT"
] | null | null | null |
Sources/UserDefaultElement/UserDefaultElement.swift
|
3sidedcube/UserDefault
|
32b6d3647fb5429f2401e089e3df5fba02749038
|
[
"MIT"
] | null | null | null |
//
// UserDefaultsElement.swift
// UserDefault
//
// Created by Ben Shutt on 16/11/2020.
// Copyright © 2020 3 SIDED CUBE APP PRODUCTIONS LTD. All rights reserved.
//
import Foundation
/// Define functionality for reading and writing an object in the `UserDefaults`.
///
/// Some types will conform to this `protocol` as a result of conforming to another protocol,
/// e.g. `Codable`. These `protocol`s define enough already in order to implement this.
///
/// Some types are already supported by `UserDefaults`.
/// Their implementation should be simply cast by conforming to `SupportedUserDefaultElement`.
public protocol UserDefaultElement {
/// Convert the given `UserDefaults` `object` into an instance of `Self`
///
/// - Parameter object: `Any` object returned from the `UserDefaults`
static func read(object: Any) throws -> Self
/// Write instance of `Self` into a `UserDefaults` object
func write() throws -> Any
}
| 34.178571
| 94
| 0.714734
|
b31bf094a8f4a1ef050535b36b403d47d959b339
| 1,344
|
py
|
Python
|
replica/tagger.py
|
Kraymer/replica
|
b1ca7946ee525782081047e77af69b8ee69031da
|
[
"MIT"
] | 12
|
2015-06-07T12:45:43.000Z
|
2022-01-06T17:49:32.000Z
|
replica/tagger.py
|
Kraymer/replica
|
b1ca7946ee525782081047e77af69b8ee69031da
|
[
"MIT"
] | 5
|
2017-02-13T15:05:28.000Z
|
2021-03-15T21:56:42.000Z
|
replica/tagger.py
|
Kraymer/replica
|
b1ca7946ee525782081047e77af69b8ee69031da
|
[
"MIT"
] | 1
|
2021-10-10T15:13:00.000Z
|
2021-10-10T15:13:00.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 Fabrice Laporte - kray.me
# The MIT License http://www.opensource.org/licenses/mit-license.php
"""File-level functions to read and write id3 tags.
"""
import copy
import logging
from mutagen import id3, mp3
def get_tags(filepath):
"""Get id3 frames of mp3 file located at given filepath"""
try:
audio = mp3.MP3(filepath)
except mp3.HeaderNotFoundError:
audio = {}
header = id3.ID3()
header.save(filepath)
logging.warning("No ID3 header found, creating a new tag")
return audio
def set_tags(filepath, tag_vals, frames=None):
"""Set id3 frames of file"""
try:
tags = id3.ID3(filepath)
tags_bak = copy.deepcopy(tags)
tags.delete()
except id3.ID3NoHeaderError:
tags = id3.ID3()
tags.save(filepath)
logging.warning("No ID3 header found, created one.")
try:
for (tag, val) in tag_vals.items():
if frames and tag.split("::")[0] not in frames:
continue
tags.add(val)
tags.save(filepath)
except Exception:
msg = "Error writing file '%s'" % filepath
logging.error(msg)
if tags_bak:
tags_bak.save(filepath) # restore id3
return False
return True
| 26.352941
| 68
| 0.607887
|
ebab878c2f96c9dca456d980186c811ec20b34f1
| 52,853
|
css
|
CSS
|
assets/css/global.css
|
ioslide/PWA_XHY
|
00be485c6bbacc47eca576b265fa59e8ecb93dc8
|
[
"Apache-2.0"
] | null | null | null |
assets/css/global.css
|
ioslide/PWA_XHY
|
00be485c6bbacc47eca576b265fa59e8ecb93dc8
|
[
"Apache-2.0"
] | null | null | null |
assets/css/global.css
|
ioslide/PWA_XHY
|
00be485c6bbacc47eca576b265fa59e8ecb93dc8
|
[
"Apache-2.0"
] | null | null | null |
@import url(../../css.css);h4,h5{text-transform:none}.main-menu ul a:after,u:after{bottom:-3px;left:0;content:""}.js .loader,.section-content,.works{-webkit-box-orient:unset;-webkit-box-direction:unset}.center-text,.js .loader,.logo,h1.center,h2.center,h3.center,h4.center,h5.center,h6.center{text-align:center}.cursor,.whity{pointer-events:none}.contact-content a:after,.contact-content a:before,.main-menu ul a:after,.works__imgs__item__bg span:after,.works__titles__item span:before,u:after{content:""}::-moz-selection{color:#393939;background:#fff}::selection{color:#393939;background:#fff}*{-webkit-text-size-adjust:none;font-size-adjust:none}body{font:18px/1.6 Cabin,sans-serif;font-weight:700;color:#fff;margin:0;padding-top:0!important;background:#000}h1,h2,h3,h4,h5,h6{font-family:Cabin,sans-serif}body.no-scroll{overflow:hidden}@media (min-width:1600px){body{font-size:20px}}@media (max-width:1200px){body{font-size:16px}}@media (max-width:980px){body{font-size:15px}}.barba-container{background:url(../img/background.jpeg) center no-repeat;background-size:cover}address,dl,fieldset,h1,h2,h3,h4,h5,h6,hr,ol,p,pre,table,ul{margin:0 0 20px}hr{background:#d8d8d8;border:none;height:1px;padding:0;margin:5em 0}@media (max-width:740px){body{font-size:14px}hr{margin:2em 0}}h1,h2,h3,h4,h5,h6{font-weight:700;color:#fff;line-height:1.3;letter-spacing:0;margin-top:0}h1{font-size:3em}@media (max-width:1200px){h1{font-size:2.8em}}@media (max-width:740px){h1{font-size:1.8em;margin-bottom:10px}}.header h1{color:#fff}h2{font-size:2em}@media (max-width:980px){h2{font-size:1.8em}}@media (max-width:740px){h2{font-size:1.6em;margin-bottom:10px}}h3{font-size:1.5em;margin-bottom:15px}@media (max-width:740px){h3{font-size:1.3em}}h4{font-size:1.4em;margin-bottom:.5em}@media (max-width:740px){h4{font-size:1em}}h5{font-size:1.1em;margin-bottom:5px}.section-content_404,.section-content_404 h1{font-family:'Press Start 2P',cursive}@media (max-width:740px){h5{font-size:1em}}ul{list-style:none inside;padding-left:.5em}li{list-style-position:inside}ol ol,ul ul{padding-top:0}.node ol,.node ul{padding-left:0}img{max-width:100%;height:auto;display:block}a:active,a:link,a:visited{color:#fff;text-decoration:none}u{text-decoration:none;display:inline-block;position:relative;z-index:1}u:after{display:block;height:50%;width:0;background:rgba(216,216,216,.3);position:absolute;z-index:-1;-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.alpha-zio{position:absolute;z-index:1}.alpha-zio__inner{width:100%;height:100%;background:rgba(255,255,255,.1)}.alpha-zio span{display:block;width:100%;height:100%;background:rgba(233,70,49,.65)}.section-content_404{text-align:center;text-transform:uppercase}.section-content_404 h1{font-size:2em}.section-content_404 img{width:300px;height:auto;margin:40px auto 0}.section-footer,.section-header{position:relative;z-index:2}.section-footer .section__inner,.section-header .section__inner{height:10vh;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-orient:unset;-webkit-box-direction:unset;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset}.section-content{height:80vh;position:relative;z-index:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset}.section__inner{width:95%;max-width:1300px;margin:auto;position:relative}@media (max-width:740px){.section__inner{width:90%}.section-content{overflow-x:hidden}}.work-item .section-content{height:auto;padding-top:10vh;display:block}.work-item .section-header{position:fixed;top:0;left:0;width:100%;z-index:50}.logo{-webkit-perspective:400px;perspective:400px;position:relative;width:175px;height:30px;z-index:51}@media (min-width:1600px){.section__inner{max-width:85%}.logo{width:200px}}@media (max-width:980px){.logo{width:147px}}@media (max-width:740px){.logo{width:140px}}.logo a{position:absolute;left:0;top:0;display:block;width:100%;-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-webkit-backface-visibility:hidden;backface-visibility:hidden;text-transform:uppercase}.logo a.logo-back{-webkit-transform:rotateY(-180deg);transform:rotateY(-180deg);text-transform:none}.barba-container:not(.front) .logo:hover a.logo-front{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}.barba-container:not(.front) .logo:hover a.logo-back{-webkit-transform:rotateY(0);transform:rotateY(0)}.white .logo a{color:#393939}@media (max-width:740px){.main-menu{position:fixed;left:0;top:0;width:100%;height:100%;background:#202020;z-index:50;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-orient:unset;-webkit-box-direction:unset;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset;-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.main-menu.is-open{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.main-menu.is-open ul li{opacity:1;visibility:visible;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}.main-menu ul{margin:0;padding:0}.main-menu ul li{display:inline-block;margin-left:30px}@media (max-width:740px){.main-menu ul li{display:block;margin:0;font-size:3.8em;opacity:0;visibility:hidden;-webkit-transform:translateX(40px);-ms-transform:translateX(40px);transform:translateX(40px);-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) .4s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) .4s;transition:all .7s cubic-bezier(.23,1,.32,1) .4s}}.main-menu ul a{position:relative}.main-menu ul a:after{display:block;position:absolute;right:0;height:2px;background:#fff;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:right center 0;-ms-transform-origin:right center 0;transform-origin:right center 0;-webkit-transition:-webkit-transform .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:transform .7s cubic-bezier(.23,1,.32,1) 0s;transition:transform .7s cubic-bezier(.23,1,.32,1) 0s;transition:transform .7s cubic-bezier(.23,1,.32,1) 0s,-webkit-transform .7s cubic-bezier(.23,1,.32,1) 0s}.footer-social a,.hamburger span{-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.main-menu ul a.is-active:after,.main-menu ul a:hover:after{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:left center 0;-ms-transform-origin:left center 0;transform-origin:left center 0}.hamburger{display:none;width:30px;height:20px;position:relative;z-index:51}@media (max-width:740px){.hamburger{display:block}}.hamburger span{display:block;position:absolute;height:2px;background:#fff;left:0;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.cursor,.js .loader{position:fixed;z-index:999}.hamburger__top{top:0;width:100%}.hamburger__center{top:50%;width:70%;margin-top:-1px}.hamburger__bottom{bottom:0;width:90%}.hamburger__close-a,.hamburger__close-b{top:50%;width:100%;margin-top:-1px}.hamburger__close-a{-webkit-transform:rotate(45deg) scaleX(0);-ms-transform:rotate(45deg) scaleX(0);transform:rotate(45deg) scaleX(0)}.hamburger__close-b{-webkit-transform:rotate(-45deg) scaleX(0);-ms-transform:rotate(-45deg) scaleX(0);transform:rotate(-45deg) scaleX(0)}.hamburger.is-active .hamburger__bottom,.hamburger.is-active .hamburger__center,.hamburger.is-active .hamburger__top{-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0)}.hamburger.is-active .hamburger__bottom,.hamburger.is-active .hamburger__top{-webkit-transform-origin:right center;-ms-transform-origin:right center;transform-origin:right center}.hamburger.is-active .hamburger__close-a{-webkit-transform:rotate(45deg) scaleX(1);-ms-transform:rotate(45deg) scaleX(1);transform:rotate(45deg) scaleX(1);-webkit-transition-delay:.5s;-o-transition-delay:.5s;transition-delay:.5s}.hamburger.is-active .hamburger__close-b{-webkit-transform:rotate(-45deg) scaleX(1);-ms-transform:rotate(-45deg) scaleX(1);transform:rotate(-45deg) scaleX(1);-webkit-transition-delay:.7s;-o-transition-delay:.7s;transition-delay:.7s}.js .loader{background:#fff;height:100%;width:100%;left:0;top:0;right:0;bottom:0;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset;color:#dd2a47;text-transform:uppercase;font-size:1.5em}.js .loader__inner{-webkit-perspective:900px;perspective:900px;opacity:0;visibility:hidden}.js .loader span{display:block}.section-footer{font-weight:400;font-size:.9em;color:rgba(255,255,255,.8)}.white .section-footer{color:#393939}.footer-social{margin:0;padding:0}.footer-social a{display:block;width:18px;height:18px;background:center center no-repeat;background-size:100% auto;opacity:.7;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.footer-social a:hover,.works__titles__item.swiper-slide-active span{opacity:1}.footer-social a.facebook{background-image:url(../img/facebook.svg)}.footer-social a.linkedin{background-image:url(../img/linkedin.svg)}.footer-social a.github{background-image:url(../img/github.svg)}.footer-social a.twitter{background-image:url(../img/twitter.svg)}.footer-social a.codepen{background-image:url(../img/codepen.svg)}.footer-social li{display:inline-block;margin-right:10px}.white .footer-social{-webkit-filter:invert(5);filter:invert(5)}.js body *{cursor:none!important}.cursor{width:15px;height:15px;margin-top:-5px;margin-left:-5px;border-radius:100%;background:#ddd}@media (max-width:980px){.js body *{cursor:auto!important}.cursor{display:none}}.cursor .cursor-alpha{display:block;width:100%;height:100%;top:50%;left:50%;position:absolute;border-radius:100%;-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s;border:2px solid rgba(221,221,221,.5);-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transform:translateX(-50%) translateY(-50%);-ms-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);background:center center no-repeat;background-size:auto 50%}.cursor.is-hover{-webkit-transform:scale(.8);-ms-transform:scale(.8);transform:scale(.8)}.cursor.is-hover .cursor-alpha{height:600%;width:600%;background:rgba(221,221,221,.2)}.cursor.grab{background:0 0}.cursor.grab .cursor-alpha{background-image:url(../img/scroll-grab.svg);background-color:rgba(57,57,57,.5);height:80px;width:80px;background-size:auto 50%}.cursor.swipe{background:0 0;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.cursor.swipe .cursor-alpha{background-image:url(../img/scroll-grab.svg);background-color:rgba(57,57,57,.5);height:80px;width:80px;background-size:auto 50%}.cursor.site{background:0 0}.cursor.site .cursor-alpha{background:url(../img/site.svg) center center no-repeat;background-color:rgba(57,57,57,.5);height:80px;width:80px;background-size:auto 30%}.white .cursor{background:#ccc}.white .cursor .cursor-alpha{border-color:#ccc}.white .cursor.swipe{background:0 0;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.white .cursor.swipe .cursor-alpha{background-color:rgba(80,32,48,.5);height:80px;width:80px;background-size:auto 50%}.front-intro{display:inline-block;position:relative;z-index:2}.front-intro p{font-size:3em;line-height:1.15em}@media (max-width:740px){.front-intro p{font-size:1.7em;margin-bottom:10px}}.front-intro span{display:block;text-align:right;font-weight:400}.about-content__text p,.work__description__text,.work__header__title p{font-weight:300}.front-intro.loaded u:after{width:100%}.front .alpha-zio{width:45vw;height:60vh;left:15%;top:10vh;-webkit-perspective:35vw;perspective:35vw}@media (max-width:980px){.front .alpha-zio{display:none}}.barba-container.work{-webkit-transition:background-color .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:background-color .7s cubic-bezier(.23,1,.32,1) 0s;transition:background-color .7s cubic-bezier(.23,1,.32,1) 0s}.works{height:80vh;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset;-webkit-perspective:2000px;perspective:2000px}@media (max-width:980px){.works{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:unset;flex-wrap:unset}}.work__description,.works__controls,.works__titles__item{-webkit-box-orient:unset;-webkit-box-direction:unset}.works__titles.swiper-container{position:relative;height:50vh;margin:0;cursor:none;z-index:10;min-width:50%}.works__titles .swiper-wrapper{-webkit-transition-timing-function:cubic-bezier(.23,1,.32,1);-o-transition-timing-function:cubic-bezier(.23,1,.32,1);transition-timing-function:cubic-bezier(.23,1,.32,1)}.works__titles__item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset;font-size:1.7em}@media (max-width:980px){.works__titles.swiper-container{width:100%;margin:0 auto}.works__titles__item{font-size:1.5em}}@media (max-width:740px){.works__titles__item{font-size:1em;text-align:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-orient:unset;-webkit-box-direction:unset;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset}}.works__titles__item.swiper-slide-active{font-size:4em}@media (max-width:980px){.works__titles__item.swiper-slide-active{font-size:3.5em}.works__imgs{-webkit-transform:none!important;-ms-transform:none!important;transform:none!important}}.works__titles__item.swiper-slide-active span:before{width:50px;margin-right:10px}@media (max-width:740px){.works__titles__item.swiper-slide-active{font-size:1.7em}.works__titles__item.swiper-slide-active span:before{display:none}}.works__titles__item.swiper-slide-active span.is-hover:before{width:80px}.works__titles__item.swiper-slide-next span,.works__titles__item.swiper-slide-prev span{opacity:.3}.works__titles__item span{opacity:.1;-webkit-transition:all 1.2s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all 1.2s cubic-bezier(.23,1,.32,1) 0s;transition:all 1.2s cubic-bezier(.23,1,.32,1) 0s}.works__titles__item span:before{display:inline-block;vertical-align:middle;height:2px;width:0;background:#fff;-webkit-transition:all 1.2s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all 1.2s cubic-bezier(.23,1,.32,1) 0s;transition:all 1.2s cubic-bezier(.23,1,.32,1) 0s}.works__titles__item em{display:inline-block;vertical-align:middle;font-size:.2em;margin-right:10px;font-style:normal}.works__imgs.swiper-container{position:absolute;right:0;top:0;height:100%;width:85%;overflow:visible;z-index:9}@media (max-width:980px){.works__imgs.swiper-container{width:100%;height:500px;top:50%;right:auto;margin-top:-250px;padding:10px;left:50%;transform:translateX(-50%)!important}}@media (max-width:740px){.works__titles__item em{display:none}.works__imgs.swiper-container{height:250px;margin-top:-125px}}.works__imgs .swiper-wrapper{z-index:5}.works__imgs__item{-webkit-perspective:100vw;perspective:100vw}.works__imgs__item__bg{height:90%;width:80%;right:0;top:5%;position:absolute;z-index:5;overflow:hidden;opacity:0;transition:all .5s}.works__imgs__item.swiper-slide-active .works__imgs__item__bg{opacity:1}@media (max-width:980px){.works__imgs__item__bg{height:100%;width:100%;top:0}.works__imgs__item__bg>div{opacity:.5}}.works__imgs__item__bg__inner{height:100%;width:100%;background:center center no-repeat;background-size:cover;-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}@media (max-width:740px){.works__imgs__item__bg__inner{opacity:.6}}.works__imgs__item__bg span{position:absolute;top:50%;right:50px;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);text-align:center;opacity:0;visibility:hidden;-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.works__imgs__item__bg span:after{display:inline-block;vertical-align:middle;margin-left:5px;width:25px;height:2px;background:#fff;-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0)}.work-header div,.works__controls .works__nav>div{-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.works__imgs__item__bg:hover div{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1);opacity:.7}.works__imgs__item__bg:hover span{opacity:1;visibility:visible}.works__imgs__item__bg:hover span:after{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1)}.works__imgs a{display:block;width:100%;height:100%}.works__controls{position:absolute;right:40px;bottom:5%;z-index:15;width:50%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset}@media (max-width:980px){.works__controls{width:80%;bottom:10%;right:10%}}.works__controls .works__nav>div{width:50px;height:50px;border:2px solid #fff;border-radius:100%;background-image:url(../img/vertical-nav-arrows.svg);background-repeat:repeat-y;background-size:200% auto;display:inline-block;margin-left:10px;cursor:pointer;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}@media (max-width:740px){.works__controls .works__nav>div{width:25px;height:25px;margin-left:5px}}.works__controls .works__nav>div:hover{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1);background-color:rgba(255,255,255,.2)}.works__controls .works__nav__next{background-position:right 0}.works__controls .works__nav__next:hover{background-position:right 50px}.works__controls .works__nav__prev{background-position:left 0}.works__controls .works__nav__prev:hover{background-position:left -50px}.works__controls .works__pag{width:auto;margin-right:10px;opacity:.7}.works__controls .works__progress{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.works__controls .works__progress span{height:2px;width:100%;background:#fff;display:block}.work .alpha-zio{width:50%;height:70%;right:10%;bottom:0;z-index:4;-webkit-perspective:2000px;perspective:2000px;-webkit-transform:translateZ(-400px) scale(1.2);transform:translateZ(-400px) scale(1.2)}@media (max-width:980px){.work .alpha-zio{display:none}}.whity{display:block;position:absolute;height:90%;width:80%;top:5%;right:0;bottom:0;background-color:rgba(255,255,255,.7);z-index:40;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0)}@media (max-width:980px){.whity{width:100%;height:100%;top:0}}.work-header{height:90%;width:80%;right:0;top:5%;position:absolute;z-index:5;overflow:hidden;background:#000}.work-header div{height:100%;width:100%;background:center center no-repeat;background-size:cover;transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1);opacity:.7}.work-bg{position:fixed;right:0;top:0;height:100%;width:0;background:rgba(255,255,255,.1);-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s;z-index:0}.barba-container{-webkit-transition:background-color .5s ease 0s;-o-transition:background-color .5s ease 0s;transition:background-color .5s ease 0s}.barba-container.work-item{background-image:none}.white .barba-container{background-color:#eee!important}.white .section-header{background:rgba(255,255,255,.8)}.work__header{height:80vh;position:relative}@media (max-width:740px){.works__controls .works__pag{margin-right:5px}.work__header{height:300px}}.work__header__img{height:100%;width:70%;float:right;overflow:hidden;background:#000;position:relative}@media (max-width:980px){.work__header__img{width:100%}}.work__header__img>div{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1);opacity:.7}.work__header__img .works__imgs__item__bg__inner span{display:block;height:100%;width:0;position:absolute;left:0;top:0;z-index:50;background:#fff}.work__header__title{position:absolute;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:100%;padding-left:10%;-webkit-box-sizing:border-box;box-sizing:border-box}.work__header__title h1{font-size:4em;opacity:0;visibility:hidden}@media (max-width:740px){.work__header__title{padding:0 10px}.work__header__title h1{font-size:3em}}.work__header__title p{font-size:1.2em;width:50%;opacity:0;visibility:hidden}@media (max-width:740px){.work__header__title p{width:100%;font-size:1em}.work__header .scroll{display:none}}.work__header .scroll{position:absolute;right:40px;bottom:40px;font-size:.8em;cursor:pointer;opacity:0;visibility:hidden}.work__header .scroll span{width:30px;height:30px;border:2px solid #fff;border-radius:100%;background-image:url(../img/vertical-nav-arrows.svg);background-repeat:repeat-y;background-size:200% auto;background-position:right 0;display:inline-block;vertical-align:middle;margin-left:5px;-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.work__description,.work__screen__imgs{display:-webkit-box;display:-ms-flexbox}.work__header .scroll:hover span{-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1);background-position:right 30px;background-color:rgba(255,255,255,.2)}.work__description{background:rgba(255,255,255,.1);padding:80px 10%;margin-top:10vh;display:flex;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:distribute;justify-content:space-around;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset}@media (max-width:980px){.work__description{margin-top:60px;padding:40px}}@media (max-width:740px){.work__description{margin-top:30px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;-ms-flex-wrap:unset;flex-wrap:unset;padding:30px 20px 20px}}.work__description__details{width:40%;-ms-flex-negative:0;flex-shrink:0}@media (max-width:740px){.work__description__details{width:100%;margin-top:30px}}.work__description .detail{margin-bottom:1.2em;font-size:.9em}.work__description .detail span{display:block}.work__description .detail__label{opacity:.7}.work__description__text p:not(:last-child){margin-bottom:20px}.work__description p{margin:0}.work__screen__home{padding:100px 0}@media (max-width:980px){.work__screen__home{padding:40px 0}}@media (max-width:740px){.work__screen__home{padding:30px 0}}.work__screen__home img{max-width:75%;margin:auto}.work__screen__transition{width:75%;margin:0 auto 140px;padding:50px;background:rgba(255,255,255,.2);border:3px solid #fff;border-radius:40px;-webkit-box-sizing:border-box;box-sizing:border-box}@media (max-width:980px){.work__screen__home img{max-width:95%}.work__screen__transition{width:85%;padding:30px;border-radius:30px}}@media (max-width:740px){.work__screen__transition{width:95%;border:2px solid #fff;padding:20px;border-radius:20px;margin-bottom:30px}}.work__screen__transition>div{position:relative;padding-bottom:52.6%;padding-top:35px;height:0;overflow:hidden;border:3px solid #fff}@media (max-width:980px){.work__screen__transition>div{padding-top:20px}}.work__screen__transition iframe{pointer-events:none;position:absolute;top:-1%;left:-1%;width:102%;height:102%}.work__screen__imgs{max-width:90%;margin:0 auto 100px;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around;-webkit-box-orient:unset;-webkit-box-direction:unset;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset}@media (max-width:980px){.work__screen__transition iframe{pointer-events:auto}.work__screen__imgs{margin-bottom:40px}}.work__screen__imgs>div{position:relative;width:45%}@media (min-width:1600px){.work__screen__imgs>div img{margin-left:auto;margin-right:auto}}@media (max-width:740px){.work__screen__transition>div{padding-top:10px;border:2px solid #fff}.work__screen__imgs{max-width:95%;margin-bottom:30px}.work__screen__imgs>div{-webkit-transform:none!important;-ms-transform:none!important;transform:none!important}.work__screen__imgs>div img{margin-bottom:30px;-webkit-transform:none!important;-ms-transform:none!important;transform:none!important}}.work__screen__imgs .col-left img:first-child{margin-bottom:100px}@media (max-width:740px){.work__screen__imgs .col-left img:first-child{margin-bottom:30px}}.work__screen__mobile{width:90%;margin:auto;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}.work__screen__mobile .work-mobile{width:250px;margin:0;background:url(../img/works/mobile.png) center center no-repeat;background-size:100% 100%;padding:82px 19px 85px;position:relative}.work__screen__mobile .work-mobile__pag{text-align:center;position:absolute;bottom:-40px;width:100%;left:0}.work__screen__mobile .work-end{width:40%}@media (max-width:740px){.work__screen__mobile{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;-ms-flex-wrap:unset;flex-wrap:unset}.work__screen__mobile .work-end{width:90%;margin-top:80px}}.work__screen__mobile .work-end h4{color:rgba(255,255,255,.7)}.work__screen__mobile .work-end__text{margin-bottom:60px;font-weight:300}.work__screen__mobile a.view-site{color:#fff;position:relative;font-size:1.2em}.work__screen__mobile a.view-site:after,.work__screen__mobile a.view-site:before{content:"";display:block;position:absolute;left:0;right:0;height:2px;bottom:-3px;background:#fff;-webkit-transform-origin:right center 0;-ms-transform-origin:right center 0;transform-origin:right center 0;-webkit-transition:-webkit-transform .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:transform .7s cubic-bezier(.23,1,.32,1) 0s;transition:transform .7s cubic-bezier(.23,1,.32,1) 0s;transition:transform .7s cubic-bezier(.23,1,.32,1) 0s,-webkit-transform .7s cubic-bezier(.23,1,.32,1) 0s}.work__nav__item__img,.work__screen__mobile .swiper-pagination-bullet{-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.work__screen__mobile a.view-site:after{z-index:1;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);background:rgba(57,57,57,.3)}.work__screen__mobile a.view-site.is-active:after,.work__screen__mobile a.view-site:hover:after{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:left center 0;-ms-transform-origin:left center 0;transform-origin:left center 0}.work__screen__mobile .swiper-pagination-bullet{width:20px;height:5px;margin:0 5px;display:inline-block;border-radius:0;background:#d8d8d8;opacity:.2;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.work__screen__mobile .swiper-pagination-bullet-active{opacity:1;background:#fff}.work__nav{margin-top:100px;padding:100px 0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}@media (max-width:740px){.work__nav{padding:40px 0;margin-top:40px;background:rgba(255,255,255,.2)}}.work__nav__item{width:45%;position:relative}@media (min-width:1600px){.work__nav__item{width:38%}}.work__nav__item__img{background:#000;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.work__nav__item__img img{opacity:.7;-webkit-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:all .7s cubic-bezier(.23,1,.32,1) 0s;transition:all .7s cubic-bezier(.23,1,.32,1) 0s}.work__nav__item__label{position:absolute;top:50%;width:100%;font-size:2.5em;color:#fff;z-index:5;text-align:center;height:1.5em;line-height:1.5em;overflow:hidden;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.work__nav__item__label span{display:block;line-height:1.5em;-webkit-transition:margin-top .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:margin-top .7s cubic-bezier(.23,1,.32,1) 0s;transition:margin-top .7s cubic-bezier(.23,1,.32,1) 0s}.work__nav__item:hover span.label-nav{margin-top:-1.5em}.work__nav__item:hover img{opacity:.5}.work__nav__item:hover .work__nav__item__img{-webkit-transform:scale(.8);-ms-transform:scale(.8);transform:scale(.8)}.work-item .works__imgs__item__bg__inner{-webkit-transition:none;-o-transition:none;transition:none}.about-content{width:80%;max-width:900px;margin:auto;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-orient:unset;-webkit-box-direction:unset;-ms-flex-direction:unset;flex-direction:unset;-ms-flex-wrap:unset;flex-wrap:unset}.about-content__text{margin-left:40px;z-index:1;position:relative}@media (max-width:740px){.work__nav__item__label{font-size:1em}.about-content{display:block;width:90%}.about-content__text{margin:20px 0 0}}.about-content__text u:after{width:100%}.about-content__img{-ms-flex-negative:0;flex-shrink:0;height:500px;width:350px;position:relative;z-index:1;-webkit-perspective:2000px;perspective:2000px}@media (min-width:1600px){.about-content{max-width:70%}.about-content__img{height:700px;width:500px}}@media (max-width:980px){.about-content__img{height:350px;width:230px}}@media (max-width:740px){.about-content__img{height:180px;width:100%}}.about-content .me{background-color:#fff;background-size:300% 300%;width:100%;height:100%;color:#e03142;font-size:32px;display:flex;align-items:center;justify-content:center;text-align:center}@media (max-width:740px){.about-content .me{background-color:#fff;background-position:center center!important;background-size:cover;-webkit-transform:none!important;-ms-transform:none!important;transform:none!important;pointer-events:none}}.about-content .me:hover{background-color:#fff;background-size:100% 100%}.about .alpha-zio{width:45%;height:55%;left:10%;bottom:-5%;-webkit-perspective:2000px;perspective:2000px;z-index:0}.contact-content{font-size:1.4em;width:90%;max-width:800px;margin:auto;position:relative}@media (max-width:980px){.about .alpha-zio{display:none}.contact-content{max-width:600px}}@media (max-width:740px){.contact-content{font-size:1em}}.contact-content__inner{z-index:1;position:relative}.contact-content p{font-weight:400}.contact-content a{font-weight:700;position:relative}.contact-content a:after,.contact-content a:before{display:block;position:absolute;left:0;right:0;height:2px;bottom:-3px;background:#fff;-webkit-transform-origin:right center 0;-ms-transform-origin:right center 0;transform-origin:right center 0;-webkit-transition:-webkit-transform .7s cubic-bezier(.23,1,.32,1) 0s;-o-transition:transform .7s cubic-bezier(.23,1,.32,1) 0s;transition:transform .7s cubic-bezier(.23,1,.32,1) 0s;transition:transform .7s cubic-bezier(.23,1,.32,1) 0s,-webkit-transform .7s cubic-bezier(.23,1,.32,1) 0s}.contact-content a:after{z-index:1;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);background:rgba(80,32,48,.6)}.contact-content a.is-active:after,.contact-content a:hover:after{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:left center 0;-ms-transform-origin:left center 0;transform-origin:left center 0}.contact .alpha-zio{width:70%;height:150%;right:0;top:-25%;-webkit-perspective:800px;perspective:800px;z-index:0}.swiper-slide,.swiper-wrapper{height:100%;position:relative;width:100%}@media (max-width:980px){.contact .alpha-zio{display:none}}.swiper-container{margin:0 auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-container-no-flexbox .swiper-slide{float:left}.swiper-container-vertical>.swiper-wrapper{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{z-index:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-box-sizing:content-box;box-sizing:content-box;width:100%}.swiper-container-android .swiper-slide,.swiper-wrapper{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.swiper-container-multirow>.swiper-wrapper{-ms-flex-wrap:wrap;flex-wrap:wrap}.swiper-container-free-mode>.swiper-wrapper{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out;margin:0 auto}.swiper-slide{-ms-flex-negative:0;flex-shrink:0;-webkit-transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform}.swiper-invisible-blank-slide{visibility:hidden}.swiper-container-autoheight,.swiper-container-autoheight .swiper-slide{height:auto}.swiper-container-autoheight .swiper-wrapper{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height,-webkit-transform;-o-transition-property:transform,height;transition-property:transform,height;transition-property:transform,height,-webkit-transform}.swiper-container-3d{-webkit-perspective:1200px;perspective:1200px}.swiper-container-3d .swiper-cube-shadow,.swiper-container-3d .swiper-slide,.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top,.swiper-container-3d .swiper-wrapper{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-container-3d .swiper-slide-shadow-left{background-image:-webkit-gradient(linear,right top,left top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:linear-gradient(to left,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-right{background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:linear-gradient(to right,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-top{background-image:-webkit-gradient(linear,left bottom,left top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:linear-gradient(to top,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-bottom{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:linear-gradient(to bottom,rgba(0,0,0,.5),transparent)}.swiper-container-wp8-horizontal,.swiper-container-wp8-horizontal>.swiper-wrapper{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-container-wp8-vertical,.swiper-container-wp8-vertical>.swiper-wrapper{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:27px;height:44px;margin-top:-22px;z-index:10;cursor:pointer;background-size:27px 44px;background-position:center;background-repeat:no-repeat}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-prev,.swiper-container-rtl .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E");left:10px;right:auto}.swiper-button-next,.swiper-container-rtl .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E");right:10px;left:auto}.swiper-button-prev.swiper-button-white,.swiper-container-rtl .swiper-button-next.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E")}.swiper-button-next.swiper-button-white,.swiper-container-rtl .swiper-button-prev.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E")}.swiper-button-prev.swiper-button-black,.swiper-container-rtl .swiper-button-next.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E")}.swiper-button-next.swiper-button-black,.swiper-container-rtl .swiper-button-prev.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E")}.swiper-pagination{position:absolute;text-align:center;-webkit-transition:.3s opacity;-o-transition:.3s opacity;transition:.3s opacity;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-container-horizontal>.swiper-pagination-bullets,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:10px;left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-container-cube,.swiper-container-flip{overflow:visible}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullet{width:8px;height:8px;display:inline-block;border-radius:100%;background:#000;opacity:.2}button.swiper-pagination-bullet{border:none;margin:0;padding:0;-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-scrollbar-cursor-drag,.swiper-slide-zoomed{cursor:move}.swiper-pagination-bullet-active{opacity:1;background:#007aff}.swiper-container-vertical>.swiper-pagination-bullets{right:10px;top:50%;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.swiper-container-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:6px 0;display:block}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:8px}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;-webkit-transition:.2s top,.2s -webkit-transform;-o-transition:.2s transform,.2s top;transition:.2s transform,.2s top;transition:.2s transform,.2s top,.2s -webkit-transform}.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 4px}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);white-space:nowrap}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:.2s left,.2s -webkit-transform;-o-transition:.2s transform,.2s left;transition:.2s transform,.2s left;transition:.2s transform,.2s left,.2s -webkit-transform}.swiper-container-horizontal.swiper-container-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:.2s right,.2s -webkit-transform;-o-transition:.2s transform,.2s right;transition:.2s transform,.2s right;transition:.2s transform,.2s right,.2s -webkit-transform}.swiper-pagination-progressbar{background:rgba(0,0,0,.25);position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:#007aff;position:absolute;left:0;top:0;width:100%;height:100%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:left top;-ms-transform-origin:left top;transform-origin:left top}.swiper-container-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{-webkit-transform-origin:right top;-ms-transform-origin:right top;transform-origin:right top}.swiper-container-horizontal>.swiper-pagination-progressbar{width:100%;height:4px;left:0;top:0}.swiper-container-vertical>.swiper-pagination-progressbar{width:4px;height:100%;left:0;top:0}.swiper-pagination-white .swiper-pagination-bullet-active{background:#fff}.swiper-pagination-progressbar.swiper-pagination-white{background:rgba(255,255,255,.25)}.swiper-pagination-progressbar.swiper-pagination-white .swiper-pagination-progressbar-fill{background:#fff}.swiper-pagination-black .swiper-pagination-bullet-active{background:#000}.swiper-pagination-progressbar.swiper-pagination-black{background:rgba(0,0,0,.25)}.swiper-pagination-progressbar.swiper-pagination-black .swiper-pagination-progressbar-fill{background:#000}.swiper-scrollbar{border-radius:10px;position:relative;-ms-touch-action:none;background:rgba(0,0,0,.1)}.swiper-container-horizontal>.swiper-scrollbar{position:absolute;left:1%;bottom:3px;z-index:50;height:5px;width:98%}.swiper-container-vertical>.swiper-scrollbar{position:absolute;right:3px;top:1%;z-index:50;width:5px;height:98%}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:rgba(0,0,0,.5);border-radius:10px;left:0;top:0}.swiper-zoom-container{width:100%;height:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-animation:swiper-preloader-spin 1s steps(12,end) infinite;animation:swiper-preloader-spin 1s steps(12,end) infinite}.swiper-lazy-preloader:after{display:block;content:'';width:100%;height:100%;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%236c6c6c'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");background-position:50%;background-size:100%;background-repeat:no-repeat}.swiper-lazy-preloader-white:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%23fff'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}@-webkit-keyframes swiper-preloader-spin{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes swiper-preloader-spin{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.swiper-container .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-container-fade.swiper-container-free-mode .swiper-slide{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out}.swiper-container-fade .swiper-slide{pointer-events:none;-webkit-transition-property:opacity;-o-transition-property:opacity;transition-property:opacity}.swiper-container-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-fade .swiper-slide-active,.swiper-container-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;width:100%;height:100%}.swiper-container-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-cube.swiper-container-rtl .swiper-slide{-webkit-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-next,.swiper-container-cube .swiper-slide-next + .swiper-slide,.swiper-container-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-container-cube .swiper-slide-shadow-bottom,.swiper-container-cube .swiper-slide-shadow-left,.swiper-container-cube .swiper-slide-shadow-right,.swiper-container-cube .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0;width:100%;height:100%;background:#000;opacity:.6;-webkit-filter:blur(50px);filter:blur(50px);z-index:0}.swiper-container-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-container-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-flip .swiper-slide-active,.swiper-container-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-flip .swiper-slide-shadow-bottom,.swiper-container-flip .swiper-slide-shadow-left,.swiper-container-flip .swiper-slide-shadow-right,.swiper-container-flip .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-coverflow .swiper-wrapper{-ms-perspective:1200px}
| 52,853
| 52,853
| 0.795698
|