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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4126a73bd1f05adfd9228711d6ea30428568ca70
| 540 |
kt
|
Kotlin
|
src/test/kotlin/ru/jetbrains/testenvrunner/utils/DateTest.kt
|
mkuzmin/stamper
|
f3f6e926a73202122d4d8a2e31cec9917acb4d02
|
[
"Apache-2.0"
] | 2 |
2017-07-30T14:24:49.000Z
|
2017-07-30T14:24:50.000Z
|
src/test/kotlin/ru/jetbrains/testenvrunner/utils/DateTest.kt
|
mkuzmin/stamper
|
f3f6e926a73202122d4d8a2e31cec9917acb4d02
|
[
"Apache-2.0"
] | 13 |
2017-07-05T09:44:26.000Z
|
2017-07-30T14:12:34.000Z
|
src/test/kotlin/ru/jetbrains/testenvrunner/utils/DateTest.kt
|
mkuzmin/stamper
|
f3f6e926a73202122d4d8a2e31cec9917acb4d02
|
[
"Apache-2.0"
] | null | null | null |
package ru.jetbrains.testenvrunner.utils
import org.junit.Assert
import org.junit.Test
import java.text.SimpleDateFormat
class DateTest : Assert() {
private val dateUtil = DateUtils()
private val dateFormat = SimpleDateFormat("HH:mm dd/MM/yy")
@Test
fun getCurrentDateTest() {
val curDateString = dateUtil.getCurrentDateAsString()
val date = dateUtil.parseDate(curDateString)
dateFormat.format(date)
assertEquals("The date is not the same", curDateString, dateFormat.format(date))
}
}
| 28.421053 | 88 | 0.718519 |
74de1e3591e91960cd3a8be15619b9e4afb1c2da
| 10,302 |
js
|
JavaScript
|
app/repositories/ReportsRepository.js
|
noms-digital-studio/nomis-reports
|
090a7998c42d0fe8d51f2b6b1bf06f36d86b0d90
|
[
"MIT"
] | 2 |
2019-06-03T14:34:56.000Z
|
2020-04-16T16:43:58.000Z
|
app/repositories/ReportsRepository.js
|
noms-digital-studio/nomis-reports
|
090a7998c42d0fe8d51f2b6b1bf06f36d86b0d90
|
[
"MIT"
] | 5 |
2022-01-24T17:20:28.000Z
|
2022-02-12T02:43:15.000Z
|
app/repositories/ReportsRepository.js
|
noms-digital-studio/nomis-reports
|
090a7998c42d0fe8d51f2b6b1bf06f36d86b0d90
|
[
"MIT"
] | 1 |
2021-04-11T06:35:15.000Z
|
2021-04-11T06:35:15.000Z
|
const custodyApiAgent = require('../helpers/custodyApiAgent');
const helpers = require('../helpers');
function ReportsRepository(config, agent) {
this.config = Object.assign({ limit: 2000 }, config);
this.agent = custodyApiAgent(agent, undefined, this.config.custody);
let root = this.config.custody.apiUrl;
this.requests = {
listAddresses: this.agent.get(`${root}/addresses`),
listAgencyLocations: this.agent.get(`${root}/agencyLocations`),
listAgencyInternalLocations: this.agent.get(`${root}/agencyInternalLocations`),
listAlerts: this.agent.get(`${root}/alerts`),
listAssessments: this.agent.get(`${root}/assessments`),
listCharges: this.agent.get(`${root}/charges`),
listEvents: this.agent.get(`${root}/events`),
listHealthProblems: this.agent.get(`${root}/healthProblems`),
listImprisonmentStatuses: this.agent.get(`${root}/imprisonmentStatuses`),
listMovements: this.agent.get(`${root}/movements`),
listOffences: this.agent.get(`${root}/offences`),
listOffenders: this.agent.get(`${root}/offenders`),
listReleaseDetails: this.agent.get(`${root}/releaseDetails`),
listSentenceCalculations: this.agent.get(`${root}/sentenceCalculations`),
listSentences: this.agent.get(`${root}/sentences`),
getOffender: this.agent.get(`${root}/offenders/offenderId/:offenderId`),
getOffenderByNomsId: this.agent.get(`${root}/offenders/nomsId/:nomsId`),
getOffenderAddresses: this.agent.get(`${root}/offenders/offenderId/:offenderId/addresses`),
getOffenderAlerts: this.agent.get(`${root}/offenders/offenderId/:offenderId/alerts`),
getOffenderAssessments: this.agent.get(`${root}/offenders/offenderId/:offenderId/assessments`),
getOffenderCharges: this.agent.get(`${root}/offenders/offenderId/:offenderId/charges`),
getOffenderContactPersons: this.agent.get(`${root}/offenders/offenderId/:offenderId/contactPersons`),
getOffenderCourseAttendances: this.agent.get(`${root}/offenders/offenderId/:offenderId/courseAttendances`),
getOffenderCourseExclusions: this.agent.get(`${root}/offenders/offenderId/:offenderId/courseExclusions`),
getOffenderCourtEvents: this.agent.get(`${root}/offenders/offenderId/:offenderId/courtEvents`),
getOffenderDiaryDetails: this.agent.get(`${root}/offenders/offenderId/:offenderId/diaryDetails`),
getOffenderEmployments: this.agent.get(`${root}/offenders/offenderId/:offenderId/employments`),
getOffenderHealthProblems: this.agent.get(`${root}/offenders/offenderId/:offenderId/healthProblems`),
getOffenderIEPs: this.agent.get(`${root}/offenders/offenderId/:offenderId/ieps`),
getOffenderImprisonmentStatuses: this.agent.get(`${root}/offenders/offenderId/:offenderId/imprisonmentStatuses`),
getOffenderIndividualSchedules: this.agent.get(`${root}/offenders/offenderId/:offenderId/individualSchedules`),
getOffenderMovements: this.agent.get(`${root}/offenders/offenderId/:offenderId/movements`),
getOffenderPhysicals: this.agent.get(`${root}/offenders/offenderId/:offenderId/physicals`),
getOffenderProgrammeProfiles: this.agent.get(`${root}/offenders/offenderId/:offenderId/programmeProfiles`),
getOffenderRehabDecisions: this.agent.get(`${root}/offenders/offenderId/:offenderId/rehabDecisions`),
getOffenderReleaseDetails: this.agent.get(`${root}/offenders/offenderId/:offenderId/releaseDetails`),
getOffenderSentenceCalculations: this.agent.get(`${root}/offenders/offenderId/:offenderId/sentenceCalculations`),
getOffenderSentences: this.agent.get(`${root}/offenders/offenderId/:offenderId/sentences`),
};
}
ReportsRepository.prototype.listAddresses = function (query, page, size) {
return this.requests.listAddresses(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listAlerts = function (query, page, size) {
return this.requests.listAlerts(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listAssessments = function (query, page, size) {
return this.requests.listAssessments(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listCharges = function (query, page, size) {
return this.requests.listCharges(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listEvents = function (query, page, size) {
return this.requests.listEvents(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listHealthProblems = function (query, page, size) {
return this.requests.listHealthProblems(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listImprisonmentStatuses = function (query, page, size) {
return this.requests.listImprisonmentStatuses(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listMovements = function (query, page, size) {
return this.requests.listMovements(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listOffences = function (query, page, size) {
return this.requests.listOffences(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listOffenders = function (query, page, size) {
return this.requests.listOffenders(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listReleaseDetails = function (query, page, size) {
return this.requests.listReleaseDetails(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listSentenceCalculations = function (query, page, size) {
return this.requests.listSentenceCalculations(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.listSentences = function (query, page, size) {
return this.requests.listSentences(Object.assign({}, query, { page, size })).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffender = function (offenderId) {
return this.requests.getOffender({ offenderId }).then(helpers.handleResponse());
};
ReportsRepository.prototype.getOffenderByNomsId = function (nomsId) {
return this.requests.getOffenderByNomsId({ nomsId }).then(helpers.handleResponse());
};
ReportsRepository.prototype.getOffenderAddresses = function (offenderId) {
return this.requests.getOffenderAddresses({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderAlerts = function (offenderId) {
return this.requests.getOffenderAlerts({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderAssessments = function (offenderId) {
return this.requests.getOffenderAssessments({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderCharges = function (offenderId) {
return this.requests.getOffenderCharges({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderContactPersons = function (offenderId) {
return this.requests.getOffenderContactPersons({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderCourseAttendances = function (offenderId) {
return this.requests.getOffenderCourseAttendances({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderCourseExclusions = function (offenderId) {
return this.requests.getOffenderCourseExclusions({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderCourtEvents = function (offenderId) {
return this.requests.getOffenderCourtEvents({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderDiaryDetails = function (offenderId) {
return this.requests.getOffenderDiaryDetails({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderEmployments = function (offenderId) {
return this.requests.getOffenderEmployments({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderHealthProblems = function (offenderId) {
return this.requests.getOffenderHealthProblems({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderIEPs = function (offenderId) {
return this.requests.getOffenderIEPs({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderImprisonmentStatuses = function (offenderId) {
return this.requests.getOffenderImprisonmentStatuses({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderIndividualSchedules = function (offenderId) {
return this.requests.getOffenderIndividualSchedules({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderMovements = function (offenderId) {
return this.requests.getOffenderMovements({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderPhysicals = function (offenderId) {
return this.requests.getOffenderPhysicals({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderProgrammeProfiles = function (offenderId, bookingId) {
return this.requests.getOffenderProgrammeProfiles({ offenderId }, { bookingId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderRehabDecisions = function (offenderId) {
return this.requests.getOffenderRehabDecisions({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderReleaseDetails = function (offenderId) {
return this.requests.getOffenderReleaseDetails({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderSentenceCalculations = function (offenderId) {
return this.requests.getOffenderSentenceCalculations({ offenderId }).then(helpers.handleResponse([]));
};
ReportsRepository.prototype.getOffenderSentences = function (offenderId) {
return this.requests.getOffenderSentences({ offenderId }).then(helpers.handleResponse([]));
};
module.exports = ReportsRepository;
| 50.748768 | 123 | 0.76888 |
d41c64f36082456ae4883c154cbb63bf28bf057d
| 2,099 |
kt
|
Kotlin
|
app/src/main/java/com/rifqimfahmi/foorballapps/features/playerdetail/PlayerDetailActivity.kt
|
lazybearkid261/mvvm-clone
|
1014693a7faf49c2fc4cf50934d2cc1790935c69
|
[
"MIT"
] | 132 |
2019-03-05T22:24:37.000Z
|
2022-03-09T15:13:31.000Z
|
app/src/main/java/com/rifqimfahmi/foorballapps/features/playerdetail/PlayerDetailActivity.kt
|
lazybearkid261/mvvm-clone
|
1014693a7faf49c2fc4cf50934d2cc1790935c69
|
[
"MIT"
] | 4 |
2019-06-13T18:25:41.000Z
|
2019-08-29T21:20:11.000Z
|
app/src/main/java/com/rifqimfahmi/foorballapps/features/playerdetail/PlayerDetailActivity.kt
|
lazybearkid261/mvvm-clone
|
1014693a7faf49c2fc4cf50934d2cc1790935c69
|
[
"MIT"
] | 42 |
2019-03-05T22:24:37.000Z
|
2022-03-01T10:18:33.000Z
|
package com.rifqimfahmi.foorballapps.features.playerdetail
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
import com.rifqimfahmi.foorballapps.R
import com.rifqimfahmi.foorballapps.util.obtainViewModel
import com.rifqimfahmi.foorballapps.vo.Player
import com.rifqimfahmi.foorballapps.vo.Resource
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.activity_player_detail.*
class PlayerDetailActivity : AppCompatActivity() {
private lateinit var viewModel: PlayerViewModel
private val playerId: String by lazy { intent.getStringExtra(ARG_KEY_PLAYER_ID) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_player_detail)
initToolbar()
initData()
}
private fun initToolbar() {
setSupportActionBar(tbPlayer)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
private fun initData() {
viewModel = obtainViewModel()
viewModel.initData(playerId)
viewModel.player.observe(this, Observer { res -> updateData(res) })
}
private fun updateData(res: Resource<Player>?) {
if (res?.data == null) return
val player = res.data
supportActionBar?.title = player.strPlayer
with(player) {
Picasso.get().load(strFanart1).into(ivArt)
tvWeight.text = getWeight()
tvHeight.text = getHeight()
tvRole.text = strPosition
tvDesc.text = strDescriptionEN
}
}
private fun obtainViewModel(): PlayerViewModel = obtainViewModel(PlayerViewModel::class.java)
companion object {
private const val ARG_KEY_PLAYER_ID = "arg_key_player_id"
fun getStartIntent(context: Context?, playerId: String): Intent =
Intent(context, PlayerDetailActivity::class.java).apply {
putExtra(ARG_KEY_PLAYER_ID, playerId)
}
}
}
| 31.80303 | 97 | 0.707003 |
c08b1795bdfd5ec88aa9f0ec6e675aa8455fb324
| 1,035 |
sql
|
SQL
|
src/Resources/NumericIdGeneratorStoredProcedure.sql
|
satano/Kros.Utils
|
1f7de934cc68819862c48ea669dd1484d22618f2
|
[
"MIT"
] | 3 |
2019-03-01T11:13:44.000Z
|
2022-02-04T08:58:03.000Z
|
src/Resources/NumericIdGeneratorStoredProcedure.sql
|
satano/Kros.Utils
|
1f7de934cc68819862c48ea669dd1484d22618f2
|
[
"MIT"
] | 9 |
2019-03-22T08:17:34.000Z
|
2021-04-14T07:39:30.000Z
|
src/Resources/NumericIdGeneratorStoredProcedure.sql
|
satano/Kros.Utils
|
1f7de934cc68819862c48ea669dd1484d22618f2
|
[
"MIT"
] | 7 |
2019-04-25T12:39:18.000Z
|
2022-03-23T07:07:36.000Z
|
CREATE PROCEDURE [{{StoredProcedureName}}]
(
@TableName nvarchar(100) = '',
@NumberOfItems int = 1
)
AS
BEGIN
set nocount on
begin transaction
save transaction transSavePoint
begin try
declare @lastId {{DataType}}
SELECT @lastId = LastId FROM [{{TableName}}] WITH (XLOCK) WHERE (TableName = @TableName)
if (@lastId is null)
begin
INSERT INTO [{{TableName}}] (TableName, LastId) VALUES (@TableName, @NumberOfItems)
set @lastId = 1
end
else
begin
UPDATE [{{TableName}}] SET LastId = @lastId + @NumberOfItems WHERE (TableName = @TableName)
set @lastId = @lastId + 1
end
select @lastId
end try
begin catch
if @@TRANCOUNT > 0
begin
rollback transaction transSavePoint
end
declare @errorMessage nvarchar(4000)
declare @errorSeverity int
declare @errorState int
select @errorMessage = ERROR_MESSAGE()
select @errorSeverity = ERROR_SEVERITY()
select @errorState = ERROR_STATE()
raiserror (@errorMessage, @errorSeverity, @errorState)
end catch
commit transaction
END
| 19.166667 | 94 | 0.708213 |
53ba3dc260930eb5ec0352073fcdd06667bde1e1
| 676 |
lua
|
Lua
|
TurtleLog.lua
|
mikk809h/TurtleMiner
|
760a98ac3ed2b53a26e598023401b393196f4fe8
|
[
"MIT"
] | null | null | null |
TurtleLog.lua
|
mikk809h/TurtleMiner
|
760a98ac3ed2b53a26e598023401b393196f4fe8
|
[
"MIT"
] | null | null | null |
TurtleLog.lua
|
mikk809h/TurtleMiner
|
760a98ac3ed2b53a26e598023401b393196f4fe8
|
[
"MIT"
] | null | null | null |
local TurtleLog = {}
TurtleLog.RawLog = {}
function TurtleLog:Set(tbl)
self.RawLog = tbl
end
function TurtleLog:Add(tbl)
local newLog = {}
newLog[1] = tbl
for i = 1, #self.RawLog do
newLog[i+1] = self.RawLog[i]
end
newLog[256] = nil
self.RawLog = newLog
end
--[[ Remove: Removes first index (last log/last move)]]
function TurtleLog:Remove()
local newLog = {}
self.RawLog[1] = nil
for i, v in pairs(self.RawLog) do
newLog[i-1] = v
end
self.RawLog = newLog
end
function TurtleLog:Clear()
self.RawLog = {}
end
function TurtleLog:GetLast()
return self.RawLog[1]
end
return setmetatable(TurtleLog, {})
| 18.27027 | 55 | 0.634615 |
18a707435ba0018eb5b0e406f1818579d0180028
| 3,258 |
css
|
CSS
|
assets/css/__productDesc.css
|
MahdiMhqq/e-commerce-digistyle
|
5e7d1efe38e7fefb73e479971956c98beb3c328d
|
[
"MIT"
] | 3 |
2022-02-19T13:27:44.000Z
|
2022-02-20T14:41:30.000Z
|
assets/css/__productDesc.css
|
MahdiMhqq/e-commerce-digistyle
|
5e7d1efe38e7fefb73e479971956c98beb3c328d
|
[
"MIT"
] | null | null | null |
assets/css/__productDesc.css
|
MahdiMhqq/e-commerce-digistyle
|
5e7d1efe38e7fefb73e479971956c98beb3c328d
|
[
"MIT"
] | null | null | null |
.p-bread-main-sec a.digikala-seller::after {
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
font-family: "Font Awesome 5 Free";
font-weight: 900;
content: "\f54f";
margin: 0 9px;
font-size: 13px;
}
.product-desc .icons {
display: inline;
right: 0;
top: 0;
bottom: 30%;
margin: auto;
height: fit-content;
z-index: 10;
background-color: white;
padding: 5px 10px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
border: 1px solid rgba(0, 0, 0, 0.2);
border-right: none;
}
.product-desc .icons a {
display: block;
white-space: nowrap;
color: var(--c-gray-light);
}
.product-desc .icons a::after {
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
font-family: "Font Awesome 5 Free";
font-size: 20px;
margin: 5px 0px;
transition: color 0.3s ease;
}
.product-desc .icons a:nth-child(1)::after {
font-weight: 400;
content: "\f004";
}
.product-desc .icons a:nth-child(2)::after {
font-weight: 900;
content: "\f1e0";
}
.product-desc .icons a:nth-child(3)::after {
font-weight: 400;
content: "\f0f3";
}
.product-desc .icons a:nth-child(4)::after {
font-weight: 900;
content: "\f201";
}
.product-desc .icons a:nth-child(5)::after {
font-weight: 900;
content: "\f422";
}
.product-desc .icons a:nth-child(6)::after {
font-weight: 900;
content: "\f03a";
}
.product-desc .icons a:hover {
color: var(--c-danger);
}
.product-desc .color-pick input {
display: none;
}
.product-desc .color-pick label {
border: 2px solid rgba(255, 255, 255, 0.9);
box-shadow: 0 0 0 1px rgb(184, 184, 184);
border-radius: 100%;
width: 25px;
height: 25px;
margin: 0 5px;
cursor: pointer;
transition: box-shadow 0.3s ease;
}
.product-desc .color-pick label#p-c-red {
background-color: rgb(219, 39, 39);
}
.product-desc .color-pick label#p-c-green {
background-color: rgb(39, 219, 99);
}
.product-desc .color-pick label#p-c-black {
background-color: rgb(10, 9, 9);
}
.product-desc .color-pick label#p-c-gray {
background-color: rgb(46, 46, 46);
}
.product-desc .color-pick label#p-c-yellow {
background-color: rgb(255, 251, 37);
}
.product-desc .color-pick input:checked + label {
box-shadow: 0 0 0 2px rgb(0, 174, 255);
}
.p-price .card-body > a:hover {
background-color: #e2e2e2;
}
.which-seller .hover-popup {
width: 330px;
height: fit-content;
display: none;
z-index: 0;
top: 0;
bottom: 0;
right: -330px;
margin: auto 0;
background-color: var(--c-white);
}
.which-seller .hover-popup::after {
position: absolute;
left: -40px;
top: 0;
bottom: 0;
margin: auto 0;
display: block;
width: 0;
height: 0;
background-color: transparent;
z-index: 1;
content: "";
border: 20px solid transparent;
border-right: 20px solid var(--c-white);
}
@media screen and (min-width: 768px) {
.which-seller:hover .hover-popup {
display: block;
}
}
.product-desc .image > div {
top: 80px;
}
.product-desc .p-min-desc .free-ship-img {
max-height: 70px;
width: auto;
}
.vendor .row > div {
display: flex;
justify-content: flex-start;
align-items: center;
}
| 21.019355 | 49 | 0.652548 |
28e16643a7b2451d931ebc2e9c71355ba5f470c0
| 887 |
podspec
|
Ruby
|
packages/core/RNAicactus.podspec
|
aicactus/aicactus-sdk-reactnative-lib
|
9c90583e505d73bce53014dcfd1f0ee7c0956a40
|
[
"MIT"
] | 1 |
2020-11-20T19:13:23.000Z
|
2020-11-20T19:13:23.000Z
|
packages/core/RNAicactus.podspec
|
aicactus/aicactus-sdk-reactnative-lib
|
9c90583e505d73bce53014dcfd1f0ee7c0956a40
|
[
"MIT"
] | null | null | null |
packages/core/RNAicactus.podspec
|
aicactus/aicactus-sdk-reactnative-lib
|
9c90583e505d73bce53014dcfd1f0ee7c0956a40
|
[
"MIT"
] | null | null | null |
require 'json'
package = JSON.parse(File.read('./package.json'))
Pod::Spec.new do |s|
s.name = 'RNAicactus'
s.version = package['version']
s.summary = package['description']
s.description = <<-DESC
AicactusSDK is a client side module for AiCactus platform.
DESC
s.homepage = 'http://aicactus.io/'
s.social_media_url = 'https://twitter.com/aicactus'
s.license = { :type => 'MIT' }
s.author = { 'Aicactus' => 'contact@tvpsoft.io' }
s.source = { :git => 'https://github.com/aicactus/aicactus-sdk-reactnative-lib.git', :tag => s.version.to_s }
s.platform = :ios, '11.0'
s.source_files = 'ios/**/*.{m,h}'
s.static_framework = true
s.dependency 'AicactusSDK', '~> 1.0'
s.dependency 'React'
end
| 34.115385 | 124 | 0.532131 |
5d7dbc425cdeff14b42c2f4126d8aa92bdc5c1e0
| 165 |
kt
|
Kotlin
|
src/main/kotlin/org/dfreer/designpatterns/intro/designpuzzle/weapons/AxeBehavior.kt
|
Ysoko/design-patterns
|
9bf40dc50e61b50cf3472703c7b62e7a1d378c2a
|
[
"MIT"
] | null | null | null |
src/main/kotlin/org/dfreer/designpatterns/intro/designpuzzle/weapons/AxeBehavior.kt
|
Ysoko/design-patterns
|
9bf40dc50e61b50cf3472703c7b62e7a1d378c2a
|
[
"MIT"
] | 3 |
2018-09-03T21:40:46.000Z
|
2018-09-04T02:26:37.000Z
|
src/main/kotlin/org/dfreer/designpatterns/intro/designpuzzle/weapons/AxeBehavior.kt
|
Ysoko/design-patterns
|
9bf40dc50e61b50cf3472703c7b62e7a1d378c2a
|
[
"MIT"
] | null | null | null |
package org.dfreer.designpatterns.intro.designpuzzle.weapons
class AxeBehavior : WeaponBehavior {
override fun useWeapon() = println("Chopping with an axe!")
}
| 27.5 | 63 | 0.775758 |
98d1c59d8bf2e265f7c7ea52b7e8e6495a04bedf
| 1,229 |
html
|
HTML
|
SemanticChangeGraphMiner/output/patterns/OUTPUT-hybrid/supermine/6/3954/sampleChange.html
|
maldil/CPATMiner2.0
|
743aa8a5b638a1963e621f59f63d794728ab0c79
|
[
"Apache-2.0"
] | 4 |
2021-11-04T02:47:31.000Z
|
2022-01-25T02:04:05.000Z
|
SemanticChangeGraphMiner/output/patterns/OUTPUT-hybrid/supermine/6/3954/sampleChange.html
|
maldil/R-CPATMiner
|
88b96a5af438a9c2ea2dab351cb8b210119132a2
|
[
"Apache-2.0"
] | null | null | null |
SemanticChangeGraphMiner/output/patterns/OUTPUT-hybrid/supermine/6/3954/sampleChange.html
|
maldil/R-CPATMiner
|
88b96a5af438a9c2ea2dab351cb8b210119132a2
|
[
"Apache-2.0"
] | 1 |
2021-09-11T06:52:39.000Z
|
2021-09-11T06:52:39.000Z
|
<link rel="stylesheet" href="../../../../default.css">
<script src="../../../../highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<html><h3></h3><h3>Before Change</h3><pre><code class='java'>
else:
timepoints = None
depth = simple_itk_image.GetDepth()
<a id="change">metadata_keys = simple_itk_image.GetMetaDataKeys()</a>
window_center = <a id="change">(
float(simple_itk_image.GetMetaData("WindowCenter"))
if "WindowCenter" in metadata_keys
else None
)</a>
window_width = (
float(simple_itk_image.GetMetaData("WindowWidth"))
if "WindowWidth" in metadata_keys
else None</code></pre><h3>After Change</h3><pre><code class='java'>
timepoints = None
depth = simple_itk_image.GetDepth()
<a id="change">try:
window_center = float(simple_itk_image.GetMetaData("WindowCenter"))
except (RuntimeError, ValueError):
window_center = None
</a> try:
window_width = float(simple_itk_image.GetMetaData("WindowWidth"))
except (RuntimeError, ValueError):
window_width = None</code></pre>
| 43.892857 | 79 | 0.602116 |
0bb33e48ab4d6a272b6bde36a4ebf8cdf058801b
| 1,309 |
js
|
JavaScript
|
src/components/renderer/renderer.js
|
boopathi/vega-editor
|
f063acdef80872900f0bb66830aee7c2ceab7e0a
|
[
"BSD-3-Clause"
] | null | null | null |
src/components/renderer/renderer.js
|
boopathi/vega-editor
|
f063acdef80872900f0bb66830aee7c2ceab7e0a
|
[
"BSD-3-Clause"
] | null | null | null |
src/components/renderer/renderer.js
|
boopathi/vega-editor
|
f063acdef80872900f0bb66830aee7c2ceab7e0a
|
[
"BSD-3-Clause"
] | null | null | null |
import './index.css';
import 'vega-tooltip/build/vega-tooltip.css';
import PropTypes from 'prop-types';
import React from 'react';
import * as vega from 'vega';
import * as vegaTooltip from 'vega-tooltip';
import {MODES} from '../../constants';
export default class Editor extends React.Component {
static propTypes = {
vegaSpec: PropTypes.object,
renderer: PropTypes.string,
mode: PropTypes.string,
tooltip: PropTypes.bool
}
renderVega(props) {
this.refs.chart.style.width = this.refs.chart.getBoundingClientRect().width + 'px';
let runtime;
let view;
runtime = vega.parse(props.vegaSpec);
view = new vega.View(runtime)
.logLevel(vega.Warn)
.initialize(this.refs.chart)
.renderer(props.renderer)
if (props.mode === MODES.Vega) {
view.hover()
}
view.run();
this.refs.chart.style.width = 'auto';
if (this.props.tooltip) {
vegaTooltip.vega(view);
}
window.VEGA_DEBUG.view = view;
}
componentDidMount() {
this.renderVega(this.props);
}
componentDidUpdate() {
this.renderVega(this.props);
}
render() {
return <div className='chart'>
<div ref='chart'>
</div>
{this.props.tooltip ? <div id='vis-tooltip' className='vg-tooltip'></div> : null}
</div>
}
}
| 21.112903 | 87 | 0.637892 |
f97e9686f02110ac2c18e416e95d5fa35acde8be
| 65 |
sql
|
SQL
|
application/use.sql
|
s-oravec/tapir
|
a3ce8e0ab72e973f1461c20925cfa52c3093d69b
|
[
"MIT"
] | 1 |
2015-05-28T20:21:49.000Z
|
2015-05-28T20:21:49.000Z
|
application/use.sql
|
s-oravec/tapir
|
a3ce8e0ab72e973f1461c20925cfa52c3093d69b
|
[
"MIT"
] | null | null | null |
application/use.sql
|
s-oravec/tapir
|
a3ce8e0ab72e973f1461c20925cfa52c3093d69b
|
[
"MIT"
] | null | null | null |
@&&run_dir_begin
@&&run_script api/synonyms.sql
@&&run_dir_end
| 10.833333 | 30 | 0.738462 |
d008dec26a225082780a1fd7df09925caf81809f
| 173 |
swift
|
Swift
|
test/SILOptimizer/Inputs/cross-module/default-submodule.swift
|
xjc90s/swift
|
cafe5ccbd1b7aa9cc9c837c5be2cdf3d5acd8a49
|
[
"Apache-2.0"
] | 2 |
2022-01-23T20:41:02.000Z
|
2022-01-23T20:41:12.000Z
|
test/SILOptimizer/Inputs/cross-module/default-submodule.swift
|
xjc90s/swift
|
cafe5ccbd1b7aa9cc9c837c5be2cdf3d5acd8a49
|
[
"Apache-2.0"
] | 1 |
2018-08-23T19:35:25.000Z
|
2018-08-23T19:35:25.000Z
|
test/SILOptimizer/Inputs/cross-module/default-submodule.swift
|
xjc90s/swift
|
cafe5ccbd1b7aa9cc9c837c5be2cdf3d5acd8a49
|
[
"Apache-2.0"
] | null | null | null |
public func incrementByOne(_ x: Int) -> Int {
return x + 1
}
@_semantics("optimize.no.crossmodule")
public func incrementByOneNoCMO(_ x: Int) -> Int {
return x + 1
}
| 15.727273 | 50 | 0.67052 |
993f14f4dfe7468270241544400861d0ce9152af
| 305 |
kt
|
Kotlin
|
app/src/main/java/com/adityakamble49/wordlist/ui/common/BaseContract.kt
|
rahulraopune/word-list
|
12414daf546c2dcf6c390b48a4d952eca6340659
|
[
"Apache-2.0"
] | 9 |
2018-04-28T05:51:56.000Z
|
2021-06-11T04:01:01.000Z
|
app/src/main/java/com/adityakamble49/wordlist/ui/common/BaseContract.kt
|
rahulraopune/word-list
|
12414daf546c2dcf6c390b48a4d952eca6340659
|
[
"Apache-2.0"
] | 4 |
2018-06-10T14:52:38.000Z
|
2018-12-20T14:07:55.000Z
|
app/src/main/java/com/adityakamble49/wordlist/ui/common/BaseContract.kt
|
adityakamble49/word-list
|
ea1f7cf58574b4a87dbe689cbf9ce69610b1718d
|
[
"Apache-2.0"
] | null | null | null |
package com.adityakamble49.wordlist.ui.common
import android.arch.lifecycle.LifecycleOwner
/**
* BaseContract
*
* @author Aditya Kamble
* @since 7/4/2018
*/
interface BaseContract {
interface View : LifecycleOwner
interface Presenter {
fun initialize()
fun onStop()
}
}
| 16.944444 | 45 | 0.685246 |
b986da1e7cf0c547094db3b1cfea4f2f7f7ec770
| 4,479 |
h
|
C
|
SourceCode/Classes/BookManagement.h
|
wuwei211x/LibraryManagementByQt
|
ee26bb80ed80898a839cabb23635f0fff872c457
|
[
"MIT"
] | 8 |
2020-07-05T07:32:11.000Z
|
2021-12-24T13:50:31.000Z
|
SourceCode/Classes/BookManagement.h
|
wuwei211x/LibraryManagementByQt
|
ee26bb80ed80898a839cabb23635f0fff872c457
|
[
"MIT"
] | 1 |
2021-11-09T14:53:34.000Z
|
2021-11-25T15:43:57.000Z
|
SourceCode/Classes/BookManagement.h
|
wuwei211x/LibraryManagementByQt
|
ee26bb80ed80898a839cabb23635f0fff872c457
|
[
"MIT"
] | 2 |
2020-12-28T12:27:02.000Z
|
2021-05-29T07:37:58.000Z
|
#pragma once
#include <fstream>
#include "Book.h"
#include <list>
#include "QFile"
#include "QTextStream"
using namespace std;
class BookManagement
{
list<Book> BookMgm;
int BookNums;
public:
BookManagement() {
InputBooksFromFile();
BookNums=static_cast<int>(BookMgm.size());
}
int get_BookNums(){
return BookNums;
}
void AddBook(Book &book)
{
BookMgm.push_front(book);
BookNums ++;
}
void DeletBook(Book &book)
{
BookMgm.remove(book);
BookNums --;
}
void DeletBook(long long ISBN)
{
Book temp;
FindBook(ISBN,temp);
BookMgm.remove(temp);
BookNums --;
}
void ModifyBook(Book &oldBook, Book &newBook)
{
DeletBook(oldBook);
AddBook(newBook);
}
bool FindBook(long long ISBN,Book& ret)
{
for (list<Book>::iterator it = BookMgm.begin(); it != BookMgm.end(); it++) {
if (it->get_ISBN() == ISBN) {
ret= *it;
return true;
}
}
return false;
}
bool FindBook(long long ISBN,Book** ret)
{
for (list<Book>::iterator it = BookMgm.begin(); it != BookMgm.end(); it++) {
if (it->get_ISBN() == ISBN) {
*ret=&(*it);
return true;
}
}
return false;
}
Book& get_Book_ByIndex(int i){
list<Book>::iterator it=BookMgm.begin();
while(i--){
it++;
}
return *it;
}
bool OutputBooksToFile()
{
QFile file("book_data.txt");
file.open(QIODevice::WriteOnly); //使用writeonly访问清空文件
file.close();
if (file.open(QIODevice::ReadWrite | QIODevice::Text))
{
QTextStream stream(&file);
stream.seek(file.size());
stream.setCodec("utf-8");
list<Book>::iterator it;
for (it = BookMgm.begin(); it != BookMgm.end(); it++) {
stream << QString::fromStdString(it->get_bookName()) << "\t";
stream << QString::fromStdString(it->get_author()) << "\t";
stream << QString::fromStdString(it->get_publisher()) << "\t";
stream << it->get_ISBN() << "\t";
stream << QString::fromStdString(it->get_findMark()) << "\t";
stream << QString::fromStdString(it->get_loc()) << "\t";
stream << it->get_curNums() << "\t";
stream << it->get_totalNums() << "\t";
stream << it->get_borrowedTimes() << "\t";
stream << endl;
}
file.close();
}
return true;
}
bool InputBooksFromFile()
{
BookNums=0;
BookMgm.clear();
QFile file("book_data.txt");
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
while (!file.atEnd())
{
QByteArray line = file.readLine();
QString data(line);
// string data=str.toStdString();
QString temp[20];
int j = 0;
for (int i = 0; data[i] != '\0'; i++) {
if (data[i] != '\t') {
temp[j] += data[i];
} else {
j++;
continue;
}
}
Book newbook(temp[0].toStdString(), temp[1].toStdString(), temp[2].toStdString(), temp[3].toLongLong(), temp[4].toStdString(), temp[5].toStdString(),temp[6].toInt(),temp[7].toInt(),temp[8].toInt());
AddBook(newbook);
}
file.close();
}
// char data[1024];
// ifstream infile;
// infile.open(":/data/Classes/Data/book_data.txt");
// while (!infile.eof()) {
// infile.getline(data, 200);
// string temp[20];
// int j = 0;
// for (int i = 0; data[i] != '\0'; i++) {
// if (data[i] != '\t') {
// temp[j] += data[i];
// } else {
// j++;
// continue;
// }
// }
// }
// infile.close();
//BookMgm.pop_front();
return true;
}
};
| 30.060403 | 214 | 0.433132 |
d719785b581e829200638d8d20cc1a9f4f0e93f0
| 960 |
kt
|
Kotlin
|
android-mvi-example/app/src/main/java/com/servicetitan/mviexample/ui/fragment/MovieDetailFragment.kt
|
julkwiec/mvi-examples
|
01b2baf079c49a5e5f6ed4bc93078855eaad7eb3
|
[
"MIT"
] | 1 |
2020-09-18T02:35:43.000Z
|
2020-09-18T02:35:43.000Z
|
android-mvi-example/app/src/main/java/com/servicetitan/mviexample/ui/fragment/MovieDetailFragment.kt
|
julkwiec/mvi-examples
|
01b2baf079c49a5e5f6ed4bc93078855eaad7eb3
|
[
"MIT"
] | 3 |
2022-02-13T19:46:31.000Z
|
2022-02-27T09:55:52.000Z
|
android-mvi-example/app/src/main/java/com/servicetitan/mviexample/ui/fragment/MovieDetailFragment.kt
|
julkwiec/mvi-examples
|
01b2baf079c49a5e5f6ed4bc93078855eaad7eb3
|
[
"MIT"
] | null | null | null |
package com.servicetitan.mviexample.ui.fragment
import android.view.View
import androidx.compose.ui.platform.ComposeView
import androidx.navigation.fragment.navArgs
import com.servicetitan.mviexample.events.MovieDetailEvent
import com.servicetitan.mviexample.state.MovieDetailState
import com.servicetitan.mviexample.ui.view.MovieDetailView
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class MovieDetailFragment : BaseFragment<MovieDetailEvent, MovieDetailState>() {
private val args by navArgs<MovieDetailFragmentArgs>()
override val initialState: MovieDetailState = MovieDetailState.None
override fun composeView(): View {
requestMovieDetails()
return ComposeView(requireContext()).apply {
setContent {
MovieDetailView(viewState) { requestMovieDetails() }
}
}
}
private fun requestMovieDetails() = emitEvent(MovieDetailEvent.Request(args.movieId))
}
| 34.285714 | 89 | 0.767708 |
70b743f28bd6ef5c1b73732a89114f794bae3ca4
| 24,284 |
go
|
Go
|
x/vote/exported/mock/types.go
|
axelarnetwork/axelar-core
|
3286430a37b0706726974eadb95f04d0e1a3fc95
|
[
"Apache-2.0"
] | 18 |
2021-12-16T21:24:40.000Z
|
2022-03-06T14:12:38.000Z
|
x/vote/exported/mock/types.go
|
axelarnetwork/axelar-core
|
3286430a37b0706726974eadb95f04d0e1a3fc95
|
[
"Apache-2.0"
] | 185 |
2021-11-22T18:23:31.000Z
|
2022-03-30T20:28:41.000Z
|
x/vote/exported/mock/types.go
|
axelarnetwork/axelar-core
|
3286430a37b0706726974eadb95f04d0e1a3fc95
|
[
"Apache-2.0"
] | 11 |
2021-11-22T21:38:52.000Z
|
2022-03-25T00:05:14.000Z
|
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package mock
import (
"github.com/axelarnetwork/axelar-core/x/vote/exported"
"github.com/cosmos/cosmos-sdk/codec"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
"sync"
)
// Ensure, that PollMock does implement exported.Poll.
// If this is not the case, regenerate this file with moq.
var _ exported.Poll = &PollMock{}
// PollMock is a mock implementation of exported.Poll.
//
// func TestSomethingThatUsesPoll(t *testing.T) {
//
// // make and configure a mocked exported.Poll
// mockedPoll := &PollMock{
// AllowOverrideFunc: func() {
// panic("mock out the AllowOverride method")
// },
// DeleteFunc: func() error {
// panic("mock out the Delete method")
// },
// GetKeyFunc: func() exported.PollKey {
// panic("mock out the GetKey method")
// },
// GetResultFunc: func() codec.ProtoMarshaler {
// panic("mock out the GetResult method")
// },
// GetRewardPoolNameFunc: func() (string, bool) {
// panic("mock out the GetRewardPoolName method")
// },
// GetTotalVotingPowerFunc: func() github_com_cosmos_cosmos_sdk_types.Int {
// panic("mock out the GetTotalVotingPower method")
// },
// GetVotersFunc: func() []exported.Voter {
// panic("mock out the GetVoters method")
// },
// HasVotedFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
// panic("mock out the HasVoted method")
// },
// HasVotedCorrectlyFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
// panic("mock out the HasVotedCorrectly method")
// },
// HasVotedLateFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
// panic("mock out the HasVotedLate method")
// },
// IsFunc: func(state exported.PollState) bool {
// panic("mock out the Is method")
// },
// SetExpiredFunc: func() {
// panic("mock out the SetExpired method")
// },
// VoteFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress, blockHeight int64, data codec.ProtoMarshaler) (codec.ProtoMarshaler, bool, error) {
// panic("mock out the Vote method")
// },
// }
//
// // use mockedPoll in code that requires exported.Poll
// // and then make assertions.
//
// }
type PollMock struct {
// AllowOverrideFunc mocks the AllowOverride method.
AllowOverrideFunc func()
// DeleteFunc mocks the Delete method.
DeleteFunc func() error
// GetKeyFunc mocks the GetKey method.
GetKeyFunc func() exported.PollKey
// GetResultFunc mocks the GetResult method.
GetResultFunc func() codec.ProtoMarshaler
// GetRewardPoolNameFunc mocks the GetRewardPoolName method.
GetRewardPoolNameFunc func() (string, bool)
// GetTotalVotingPowerFunc mocks the GetTotalVotingPower method.
GetTotalVotingPowerFunc func() github_com_cosmos_cosmos_sdk_types.Int
// GetVotersFunc mocks the GetVoters method.
GetVotersFunc func() []exported.Voter
// HasVotedFunc mocks the HasVoted method.
HasVotedFunc func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool
// HasVotedCorrectlyFunc mocks the HasVotedCorrectly method.
HasVotedCorrectlyFunc func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool
// HasVotedLateFunc mocks the HasVotedLate method.
HasVotedLateFunc func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool
// IsFunc mocks the Is method.
IsFunc func(state exported.PollState) bool
// SetExpiredFunc mocks the SetExpired method.
SetExpiredFunc func()
// VoteFunc mocks the Vote method.
VoteFunc func(voter github_com_cosmos_cosmos_sdk_types.ValAddress, blockHeight int64, data codec.ProtoMarshaler) (codec.ProtoMarshaler, bool, error)
// calls tracks calls to the methods.
calls struct {
// AllowOverride holds details about calls to the AllowOverride method.
AllowOverride []struct {
}
// Delete holds details about calls to the Delete method.
Delete []struct {
}
// GetKey holds details about calls to the GetKey method.
GetKey []struct {
}
// GetResult holds details about calls to the GetResult method.
GetResult []struct {
}
// GetRewardPoolName holds details about calls to the GetRewardPoolName method.
GetRewardPoolName []struct {
}
// GetTotalVotingPower holds details about calls to the GetTotalVotingPower method.
GetTotalVotingPower []struct {
}
// GetVoters holds details about calls to the GetVoters method.
GetVoters []struct {
}
// HasVoted holds details about calls to the HasVoted method.
HasVoted []struct {
// Voter is the voter argument value.
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}
// HasVotedCorrectly holds details about calls to the HasVotedCorrectly method.
HasVotedCorrectly []struct {
// Voter is the voter argument value.
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}
// HasVotedLate holds details about calls to the HasVotedLate method.
HasVotedLate []struct {
// Voter is the voter argument value.
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}
// Is holds details about calls to the Is method.
Is []struct {
// State is the state argument value.
State exported.PollState
}
// SetExpired holds details about calls to the SetExpired method.
SetExpired []struct {
}
// Vote holds details about calls to the Vote method.
Vote []struct {
// Voter is the voter argument value.
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
// BlockHeight is the blockHeight argument value.
BlockHeight int64
// Data is the data argument value.
Data codec.ProtoMarshaler
}
}
lockAllowOverride sync.RWMutex
lockDelete sync.RWMutex
lockGetKey sync.RWMutex
lockGetResult sync.RWMutex
lockGetRewardPoolName sync.RWMutex
lockGetTotalVotingPower sync.RWMutex
lockGetVoters sync.RWMutex
lockHasVoted sync.RWMutex
lockHasVotedCorrectly sync.RWMutex
lockHasVotedLate sync.RWMutex
lockIs sync.RWMutex
lockSetExpired sync.RWMutex
lockVote sync.RWMutex
}
// AllowOverride calls AllowOverrideFunc.
func (mock *PollMock) AllowOverride() {
if mock.AllowOverrideFunc == nil {
panic("PollMock.AllowOverrideFunc: method is nil but Poll.AllowOverride was just called")
}
callInfo := struct {
}{}
mock.lockAllowOverride.Lock()
mock.calls.AllowOverride = append(mock.calls.AllowOverride, callInfo)
mock.lockAllowOverride.Unlock()
mock.AllowOverrideFunc()
}
// AllowOverrideCalls gets all the calls that were made to AllowOverride.
// Check the length with:
// len(mockedPoll.AllowOverrideCalls())
func (mock *PollMock) AllowOverrideCalls() []struct {
} {
var calls []struct {
}
mock.lockAllowOverride.RLock()
calls = mock.calls.AllowOverride
mock.lockAllowOverride.RUnlock()
return calls
}
// Delete calls DeleteFunc.
func (mock *PollMock) Delete() error {
if mock.DeleteFunc == nil {
panic("PollMock.DeleteFunc: method is nil but Poll.Delete was just called")
}
callInfo := struct {
}{}
mock.lockDelete.Lock()
mock.calls.Delete = append(mock.calls.Delete, callInfo)
mock.lockDelete.Unlock()
return mock.DeleteFunc()
}
// DeleteCalls gets all the calls that were made to Delete.
// Check the length with:
// len(mockedPoll.DeleteCalls())
func (mock *PollMock) DeleteCalls() []struct {
} {
var calls []struct {
}
mock.lockDelete.RLock()
calls = mock.calls.Delete
mock.lockDelete.RUnlock()
return calls
}
// GetKey calls GetKeyFunc.
func (mock *PollMock) GetKey() exported.PollKey {
if mock.GetKeyFunc == nil {
panic("PollMock.GetKeyFunc: method is nil but Poll.GetKey was just called")
}
callInfo := struct {
}{}
mock.lockGetKey.Lock()
mock.calls.GetKey = append(mock.calls.GetKey, callInfo)
mock.lockGetKey.Unlock()
return mock.GetKeyFunc()
}
// GetKeyCalls gets all the calls that were made to GetKey.
// Check the length with:
// len(mockedPoll.GetKeyCalls())
func (mock *PollMock) GetKeyCalls() []struct {
} {
var calls []struct {
}
mock.lockGetKey.RLock()
calls = mock.calls.GetKey
mock.lockGetKey.RUnlock()
return calls
}
// GetResult calls GetResultFunc.
func (mock *PollMock) GetResult() codec.ProtoMarshaler {
if mock.GetResultFunc == nil {
panic("PollMock.GetResultFunc: method is nil but Poll.GetResult was just called")
}
callInfo := struct {
}{}
mock.lockGetResult.Lock()
mock.calls.GetResult = append(mock.calls.GetResult, callInfo)
mock.lockGetResult.Unlock()
return mock.GetResultFunc()
}
// GetResultCalls gets all the calls that were made to GetResult.
// Check the length with:
// len(mockedPoll.GetResultCalls())
func (mock *PollMock) GetResultCalls() []struct {
} {
var calls []struct {
}
mock.lockGetResult.RLock()
calls = mock.calls.GetResult
mock.lockGetResult.RUnlock()
return calls
}
// GetRewardPoolName calls GetRewardPoolNameFunc.
func (mock *PollMock) GetRewardPoolName() (string, bool) {
if mock.GetRewardPoolNameFunc == nil {
panic("PollMock.GetRewardPoolNameFunc: method is nil but Poll.GetRewardPoolName was just called")
}
callInfo := struct {
}{}
mock.lockGetRewardPoolName.Lock()
mock.calls.GetRewardPoolName = append(mock.calls.GetRewardPoolName, callInfo)
mock.lockGetRewardPoolName.Unlock()
return mock.GetRewardPoolNameFunc()
}
// GetRewardPoolNameCalls gets all the calls that were made to GetRewardPoolName.
// Check the length with:
// len(mockedPoll.GetRewardPoolNameCalls())
func (mock *PollMock) GetRewardPoolNameCalls() []struct {
} {
var calls []struct {
}
mock.lockGetRewardPoolName.RLock()
calls = mock.calls.GetRewardPoolName
mock.lockGetRewardPoolName.RUnlock()
return calls
}
// GetTotalVotingPower calls GetTotalVotingPowerFunc.
func (mock *PollMock) GetTotalVotingPower() github_com_cosmos_cosmos_sdk_types.Int {
if mock.GetTotalVotingPowerFunc == nil {
panic("PollMock.GetTotalVotingPowerFunc: method is nil but Poll.GetTotalVotingPower was just called")
}
callInfo := struct {
}{}
mock.lockGetTotalVotingPower.Lock()
mock.calls.GetTotalVotingPower = append(mock.calls.GetTotalVotingPower, callInfo)
mock.lockGetTotalVotingPower.Unlock()
return mock.GetTotalVotingPowerFunc()
}
// GetTotalVotingPowerCalls gets all the calls that were made to GetTotalVotingPower.
// Check the length with:
// len(mockedPoll.GetTotalVotingPowerCalls())
func (mock *PollMock) GetTotalVotingPowerCalls() []struct {
} {
var calls []struct {
}
mock.lockGetTotalVotingPower.RLock()
calls = mock.calls.GetTotalVotingPower
mock.lockGetTotalVotingPower.RUnlock()
return calls
}
// GetVoters calls GetVotersFunc.
func (mock *PollMock) GetVoters() []exported.Voter {
if mock.GetVotersFunc == nil {
panic("PollMock.GetVotersFunc: method is nil but Poll.GetVoters was just called")
}
callInfo := struct {
}{}
mock.lockGetVoters.Lock()
mock.calls.GetVoters = append(mock.calls.GetVoters, callInfo)
mock.lockGetVoters.Unlock()
return mock.GetVotersFunc()
}
// GetVotersCalls gets all the calls that were made to GetVoters.
// Check the length with:
// len(mockedPoll.GetVotersCalls())
func (mock *PollMock) GetVotersCalls() []struct {
} {
var calls []struct {
}
mock.lockGetVoters.RLock()
calls = mock.calls.GetVoters
mock.lockGetVoters.RUnlock()
return calls
}
// HasVoted calls HasVotedFunc.
func (mock *PollMock) HasVoted(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
if mock.HasVotedFunc == nil {
panic("PollMock.HasVotedFunc: method is nil but Poll.HasVoted was just called")
}
callInfo := struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}{
Voter: voter,
}
mock.lockHasVoted.Lock()
mock.calls.HasVoted = append(mock.calls.HasVoted, callInfo)
mock.lockHasVoted.Unlock()
return mock.HasVotedFunc(voter)
}
// HasVotedCalls gets all the calls that were made to HasVoted.
// Check the length with:
// len(mockedPoll.HasVotedCalls())
func (mock *PollMock) HasVotedCalls() []struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
} {
var calls []struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}
mock.lockHasVoted.RLock()
calls = mock.calls.HasVoted
mock.lockHasVoted.RUnlock()
return calls
}
// HasVotedCorrectly calls HasVotedCorrectlyFunc.
func (mock *PollMock) HasVotedCorrectly(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
if mock.HasVotedCorrectlyFunc == nil {
panic("PollMock.HasVotedCorrectlyFunc: method is nil but Poll.HasVotedCorrectly was just called")
}
callInfo := struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}{
Voter: voter,
}
mock.lockHasVotedCorrectly.Lock()
mock.calls.HasVotedCorrectly = append(mock.calls.HasVotedCorrectly, callInfo)
mock.lockHasVotedCorrectly.Unlock()
return mock.HasVotedCorrectlyFunc(voter)
}
// HasVotedCorrectlyCalls gets all the calls that were made to HasVotedCorrectly.
// Check the length with:
// len(mockedPoll.HasVotedCorrectlyCalls())
func (mock *PollMock) HasVotedCorrectlyCalls() []struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
} {
var calls []struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}
mock.lockHasVotedCorrectly.RLock()
calls = mock.calls.HasVotedCorrectly
mock.lockHasVotedCorrectly.RUnlock()
return calls
}
// HasVotedLate calls HasVotedLateFunc.
func (mock *PollMock) HasVotedLate(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
if mock.HasVotedLateFunc == nil {
panic("PollMock.HasVotedLateFunc: method is nil but Poll.HasVotedLate was just called")
}
callInfo := struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}{
Voter: voter,
}
mock.lockHasVotedLate.Lock()
mock.calls.HasVotedLate = append(mock.calls.HasVotedLate, callInfo)
mock.lockHasVotedLate.Unlock()
return mock.HasVotedLateFunc(voter)
}
// HasVotedLateCalls gets all the calls that were made to HasVotedLate.
// Check the length with:
// len(mockedPoll.HasVotedLateCalls())
func (mock *PollMock) HasVotedLateCalls() []struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
} {
var calls []struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}
mock.lockHasVotedLate.RLock()
calls = mock.calls.HasVotedLate
mock.lockHasVotedLate.RUnlock()
return calls
}
// Is calls IsFunc.
func (mock *PollMock) Is(state exported.PollState) bool {
if mock.IsFunc == nil {
panic("PollMock.IsFunc: method is nil but Poll.Is was just called")
}
callInfo := struct {
State exported.PollState
}{
State: state,
}
mock.lockIs.Lock()
mock.calls.Is = append(mock.calls.Is, callInfo)
mock.lockIs.Unlock()
return mock.IsFunc(state)
}
// IsCalls gets all the calls that were made to Is.
// Check the length with:
// len(mockedPoll.IsCalls())
func (mock *PollMock) IsCalls() []struct {
State exported.PollState
} {
var calls []struct {
State exported.PollState
}
mock.lockIs.RLock()
calls = mock.calls.Is
mock.lockIs.RUnlock()
return calls
}
// SetExpired calls SetExpiredFunc.
func (mock *PollMock) SetExpired() {
if mock.SetExpiredFunc == nil {
panic("PollMock.SetExpiredFunc: method is nil but Poll.SetExpired was just called")
}
callInfo := struct {
}{}
mock.lockSetExpired.Lock()
mock.calls.SetExpired = append(mock.calls.SetExpired, callInfo)
mock.lockSetExpired.Unlock()
mock.SetExpiredFunc()
}
// SetExpiredCalls gets all the calls that were made to SetExpired.
// Check the length with:
// len(mockedPoll.SetExpiredCalls())
func (mock *PollMock) SetExpiredCalls() []struct {
} {
var calls []struct {
}
mock.lockSetExpired.RLock()
calls = mock.calls.SetExpired
mock.lockSetExpired.RUnlock()
return calls
}
// Vote calls VoteFunc.
func (mock *PollMock) Vote(voter github_com_cosmos_cosmos_sdk_types.ValAddress, blockHeight int64, data codec.ProtoMarshaler) (codec.ProtoMarshaler, bool, error) {
if mock.VoteFunc == nil {
panic("PollMock.VoteFunc: method is nil but Poll.Vote was just called")
}
callInfo := struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
BlockHeight int64
Data codec.ProtoMarshaler
}{
Voter: voter,
BlockHeight: blockHeight,
Data: data,
}
mock.lockVote.Lock()
mock.calls.Vote = append(mock.calls.Vote, callInfo)
mock.lockVote.Unlock()
return mock.VoteFunc(voter, blockHeight, data)
}
// VoteCalls gets all the calls that were made to Vote.
// Check the length with:
// len(mockedPoll.VoteCalls())
func (mock *PollMock) VoteCalls() []struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
BlockHeight int64
Data codec.ProtoMarshaler
} {
var calls []struct {
Voter github_com_cosmos_cosmos_sdk_types.ValAddress
BlockHeight int64
Data codec.ProtoMarshaler
}
mock.lockVote.RLock()
calls = mock.calls.Vote
mock.lockVote.RUnlock()
return calls
}
// Ensure, that VoteHandlerMock does implement exported.VoteHandler.
// If this is not the case, regenerate this file with moq.
var _ exported.VoteHandler = &VoteHandlerMock{}
// VoteHandlerMock is a mock implementation of exported.VoteHandler.
//
// func TestSomethingThatUsesVoteHandler(t *testing.T) {
//
// // make and configure a mocked exported.VoteHandler
// mockedVoteHandler := &VoteHandlerMock{
// HandleCompletedPollFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error {
// panic("mock out the HandleCompletedPoll method")
// },
// HandleExpiredPollFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error {
// panic("mock out the HandleExpiredPoll method")
// },
// HandleResultFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, result codec.ProtoMarshaler) error {
// panic("mock out the HandleResult method")
// },
// IsFalsyResultFunc: func(result codec.ProtoMarshaler) bool {
// panic("mock out the IsFalsyResult method")
// },
// }
//
// // use mockedVoteHandler in code that requires exported.VoteHandler
// // and then make assertions.
//
// }
type VoteHandlerMock struct {
// HandleCompletedPollFunc mocks the HandleCompletedPoll method.
HandleCompletedPollFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error
// HandleExpiredPollFunc mocks the HandleExpiredPoll method.
HandleExpiredPollFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error
// HandleResultFunc mocks the HandleResult method.
HandleResultFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, result codec.ProtoMarshaler) error
// IsFalsyResultFunc mocks the IsFalsyResult method.
IsFalsyResultFunc func(result codec.ProtoMarshaler) bool
// calls tracks calls to the methods.
calls struct {
// HandleCompletedPoll holds details about calls to the HandleCompletedPoll method.
HandleCompletedPoll []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
// Poll is the poll argument value.
Poll exported.Poll
}
// HandleExpiredPoll holds details about calls to the HandleExpiredPoll method.
HandleExpiredPoll []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
// Poll is the poll argument value.
Poll exported.Poll
}
// HandleResult holds details about calls to the HandleResult method.
HandleResult []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
// Result is the result argument value.
Result codec.ProtoMarshaler
}
// IsFalsyResult holds details about calls to the IsFalsyResult method.
IsFalsyResult []struct {
// Result is the result argument value.
Result codec.ProtoMarshaler
}
}
lockHandleCompletedPoll sync.RWMutex
lockHandleExpiredPoll sync.RWMutex
lockHandleResult sync.RWMutex
lockIsFalsyResult sync.RWMutex
}
// HandleCompletedPoll calls HandleCompletedPollFunc.
func (mock *VoteHandlerMock) HandleCompletedPoll(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error {
if mock.HandleCompletedPollFunc == nil {
panic("VoteHandlerMock.HandleCompletedPollFunc: method is nil but VoteHandler.HandleCompletedPoll was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Poll exported.Poll
}{
Ctx: ctx,
Poll: poll,
}
mock.lockHandleCompletedPoll.Lock()
mock.calls.HandleCompletedPoll = append(mock.calls.HandleCompletedPoll, callInfo)
mock.lockHandleCompletedPoll.Unlock()
return mock.HandleCompletedPollFunc(ctx, poll)
}
// HandleCompletedPollCalls gets all the calls that were made to HandleCompletedPoll.
// Check the length with:
// len(mockedVoteHandler.HandleCompletedPollCalls())
func (mock *VoteHandlerMock) HandleCompletedPollCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Poll exported.Poll
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Poll exported.Poll
}
mock.lockHandleCompletedPoll.RLock()
calls = mock.calls.HandleCompletedPoll
mock.lockHandleCompletedPoll.RUnlock()
return calls
}
// HandleExpiredPoll calls HandleExpiredPollFunc.
func (mock *VoteHandlerMock) HandleExpiredPoll(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error {
if mock.HandleExpiredPollFunc == nil {
panic("VoteHandlerMock.HandleExpiredPollFunc: method is nil but VoteHandler.HandleExpiredPoll was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Poll exported.Poll
}{
Ctx: ctx,
Poll: poll,
}
mock.lockHandleExpiredPoll.Lock()
mock.calls.HandleExpiredPoll = append(mock.calls.HandleExpiredPoll, callInfo)
mock.lockHandleExpiredPoll.Unlock()
return mock.HandleExpiredPollFunc(ctx, poll)
}
// HandleExpiredPollCalls gets all the calls that were made to HandleExpiredPoll.
// Check the length with:
// len(mockedVoteHandler.HandleExpiredPollCalls())
func (mock *VoteHandlerMock) HandleExpiredPollCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Poll exported.Poll
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Poll exported.Poll
}
mock.lockHandleExpiredPoll.RLock()
calls = mock.calls.HandleExpiredPoll
mock.lockHandleExpiredPoll.RUnlock()
return calls
}
// HandleResult calls HandleResultFunc.
func (mock *VoteHandlerMock) HandleResult(ctx github_com_cosmos_cosmos_sdk_types.Context, result codec.ProtoMarshaler) error {
if mock.HandleResultFunc == nil {
panic("VoteHandlerMock.HandleResultFunc: method is nil but VoteHandler.HandleResult was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Result codec.ProtoMarshaler
}{
Ctx: ctx,
Result: result,
}
mock.lockHandleResult.Lock()
mock.calls.HandleResult = append(mock.calls.HandleResult, callInfo)
mock.lockHandleResult.Unlock()
return mock.HandleResultFunc(ctx, result)
}
// HandleResultCalls gets all the calls that were made to HandleResult.
// Check the length with:
// len(mockedVoteHandler.HandleResultCalls())
func (mock *VoteHandlerMock) HandleResultCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Result codec.ProtoMarshaler
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Result codec.ProtoMarshaler
}
mock.lockHandleResult.RLock()
calls = mock.calls.HandleResult
mock.lockHandleResult.RUnlock()
return calls
}
// IsFalsyResult calls IsFalsyResultFunc.
func (mock *VoteHandlerMock) IsFalsyResult(result codec.ProtoMarshaler) bool {
if mock.IsFalsyResultFunc == nil {
panic("VoteHandlerMock.IsFalsyResultFunc: method is nil but VoteHandler.IsFalsyResult was just called")
}
callInfo := struct {
Result codec.ProtoMarshaler
}{
Result: result,
}
mock.lockIsFalsyResult.Lock()
mock.calls.IsFalsyResult = append(mock.calls.IsFalsyResult, callInfo)
mock.lockIsFalsyResult.Unlock()
return mock.IsFalsyResultFunc(result)
}
// IsFalsyResultCalls gets all the calls that were made to IsFalsyResult.
// Check the length with:
// len(mockedVoteHandler.IsFalsyResultCalls())
func (mock *VoteHandlerMock) IsFalsyResultCalls() []struct {
Result codec.ProtoMarshaler
} {
var calls []struct {
Result codec.ProtoMarshaler
}
mock.lockIsFalsyResult.RLock()
calls = mock.calls.IsFalsyResult
mock.lockIsFalsyResult.RUnlock()
return calls
}
| 31.910644 | 163 | 0.753953 |
6b69546208e569d29a60ba75ea0dd09edc7fff88
| 6,322 |
c
|
C
|
tests/gl_vertex_buffer.c
|
apportable/emscripten
|
6960d2296299e96d43e694806f5d35799ef8d39c
|
[
"MIT"
] | 2 |
2015-06-26T22:32:16.000Z
|
2020-01-14T13:30:18.000Z
|
tests/gl_vertex_buffer.c
|
firasdib/emscripten
|
df11c6f1fd1636a355b83a1c48b3a890596e6a32
|
[
"MIT"
] | null | null | null |
tests/gl_vertex_buffer.c
|
firasdib/emscripten
|
df11c6f1fd1636a355b83a1c48b3a890596e6a32
|
[
"MIT"
] | 1 |
2018-11-17T14:39:42.000Z
|
2018-11-17T14:39:42.000Z
|
/*******************************************************************
* *
* Using SDL With OpenGL *
* *
* Tutorial by Kyle Foley (sdw) *
* *
* http://gpwiki.org/index.php/SDL:Tutorials:Using_SDL_with_OpenGL *
* *
*******************************************************************/
/*
THIS WORK, INCLUDING THE SOURCE CODE, DOCUMENTATION
AND RELATED MEDIA AND DATA, IS PLACED INTO THE PUBLIC DOMAIN.
THE ORIGINAL AUTHOR IS KYLE FOLEY.
THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY
OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF
MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE,
ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE
RESULTING FROM THE USE, MODIFICATION, OR
REDISTRIBUTION OF THIS SOFTWARE.
*/
#if !EMSCRIPTEN
#define USE_GLEW 0
#endif
#if USE_GLEW
#include "GL/glew.h"
#endif
#include <SDL/SDL.h>
#if !USE_GLEW
#include "SDL/SDL_opengl.h"
#endif
#include <stdio.h>
#include <string.h>
#include <assert.h>
int main(int argc, char *argv[])
{
SDL_Surface *screen;
// Slightly different SDL initialization
if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); // *new*
screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL ); // *changed*
if ( !screen ) {
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
}
// Set the OpenGL state after creating the context with SDL_SetVideoMode
glClearColor( 0, 0, 0, 0 );
#if !EMSCRIPTEN
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
#endif
glViewport( 0, 0, 640, 480 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
// Clear the screen before drawing
glClear( GL_COLOR_BUFFER_BIT );
typedef struct Color {
GLubyte r;
GLubyte g;
GLubyte b;
GLubyte a;
} Color;
typedef struct Vertex {
GLfloat x;
GLfloat y;
Color color;
} Vertex;
Vertex vertices[18] = {
{-1.00, 0.0, {0xFF, 0x00, 0xFF, 0xFF}},
{-1.00, 1.0, {0xFF, 0xFF, 0x00, 0xFF}},
{-0.75, 0.0, {0xFF, 0x00, 0x00, 0xFF}},
{-0.75, 1.0, {0xFF, 0xFF, 0xFF, 0xFF}},
{-0.50, 0.0, {0xFF, 0x00, 0x00, 0xFF}},
{-0.50, 1.0, {0xFF, 0xFF, 0x00, 0xFF}},
{-0.25, 0.0, {0xFF, 0x00, 0xFF, 0xFF}},
{-0.25, 1.0, {0xFF, 0xFF, 0x00, 0xFF}},
{-0.00, 0.0, {0xFF, 0x00, 0x00, 0xFF}},
{-0.00, 1.0, {0xFF, 0xFF, 0xFF, 0xFF}},
{ 0.25, 0.0, {0xFF, 0x00, 0x00, 0xFF}},
{ 0.25, 1.0, {0xFF, 0xFF, 0x00, 0xFF}},
{ 0.50, 0.0, {0xFF, 0x00, 0xFF, 0xFF}},
{ 0.50, 1.0, {0xFF, 0xFF, 0x00, 0xFF}},
{ 0.75, 0.0, {0xFF, 0x00, 0x00, 0xFF}},
{ 0.75, 1.0, {0xFF, 0xFF, 0xFF, 0xFF}},
{ 1.00, 0.0, {0xFF, 0x00, 0x00, 0xFF}},
{ 1.00, 1.0, {0xFF, 0xFF, 0x00, 0xFF}}
};
Vertex vertices2[18] = {
{-1.00, -1.0, {0xFF, 0x00, 0xFF, 0xFF}},
{-1.00, 0.0, {0xFF, 0xFF, 0x00, 0xFF}},
{-0.75, -1.0, {0xFF, 0x00, 0x00, 0xFF}},
{-0.75, 0.0, {0xFF, 0xFF, 0xFF, 0xFF}},
{-0.50, -1.0, {0xFF, 0x00, 0x00, 0xFF}},
{-0.50, 0.0, {0xFF, 0xFF, 0x00, 0xFF}},
{-0.25, -1.0, {0xFF, 0x00, 0xFF, 0xFF}},
{-0.25, 0.0, {0xFF, 0xFF, 0x00, 0xFF}},
{-0.00, -1.0, {0xFF, 0x00, 0x00, 0xFF}},
{-0.00, 0.0, {0xFF, 0xFF, 0xFF, 0xFF}},
{ 0.25, -1.0, {0xFF, 0x00, 0x00, 0xFF}},
{ 0.25, 0.0, {0xFF, 0xFF, 0x00, 0xFF}},
{ 0.50, -1.0, {0xFF, 0x00, 0xFF, 0xFF}},
{ 0.50, 0.0, {0xFF, 0xFF, 0x00, 0xFF}},
{ 0.75, -1.0, {0xFF, 0x00, 0x00, 0xFF}},
{ 0.75, 0.0, {0xFF, 0xFF, 0xFF, 0xFF}},
{ 1.00, -1.0, {0xFF, 0x00, 0x00, 0xFF}},
{ 1.00, 0.0, {0xFF, 0xFF, 0x00, 0xFF}}
};
// make a vertex buffer for the second set of vertices
GLuint vbo = 0;
glGenBuffers(1, &vbo);
// bind to it
glBindBuffer(GL_ARRAY_BUFFER, vbo);
// send it to gl
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices2), vertices2, GL_STATIC_READ); // GL_STATIC_READ is not in WebGL!
// unbind from it
glBindBuffer(GL_ARRAY_BUFFER, 0);
// DRAW
// Clear the screen before drawing
glClear( GL_COLOR_BUFFER_BIT );
// This test ensures that we can use two separate arrays in memory for different
// attributes, and that they each can have different stride.
// The first test shows implicit striding (the zero indicates tightly packed)
// The second test shows explicit striding where the stride is passed in
// even though it also is tightly packed
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
// TEST 1 - clientside data
glVertexPointer(2, GL_FLOAT, sizeof(Vertex), vertices);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), &vertices[0].color);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 6);
glDrawArrays(GL_TRIANGLE_STRIP, 10, 3);
// TEST 2 - bind to array buffer, gl*Pointer calls are offsets into the buffer, which was previously uploaded to
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glVertexPointer(2, GL_FLOAT, sizeof(Vertex), 0);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), (GLvoid*)((GLvoid*)&vertices2[0].color - (GLvoid*)&vertices2[0]));
// gldrawarrays first with a low number of vertices, then with a high number
glDrawArrays(GL_TRIANGLE_STRIP, 0, 6);
glDrawArrays(GL_TRIANGLE_STRIP, 10, 3);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
SDL_GL_SwapBuffers();
#if !EMSCRIPTEN
// Wait for 3 seconds to give us a chance to see the image
SDL_Delay(3000);
#endif
SDL_Quit();
return 0;
}
| 32.255102 | 122 | 0.54255 |
5c511ccbc8c61be155752f4524fb6f49cafed401
| 5,341 |
h
|
C
|
mentos/inc/klib/hashmap.h
|
zfd-progetti-univr-2021-2022/MentOS
|
fc4a9456520a9a79a2c3875aff0f527de51bc6e3
|
[
"MIT"
] | null | null | null |
mentos/inc/klib/hashmap.h
|
zfd-progetti-univr-2021-2022/MentOS
|
fc4a9456520a9a79a2c3875aff0f527de51bc6e3
|
[
"MIT"
] | null | null | null |
mentos/inc/klib/hashmap.h
|
zfd-progetti-univr-2021-2022/MentOS
|
fc4a9456520a9a79a2c3875aff0f527de51bc6e3
|
[
"MIT"
] | null | null | null |
/// MentOS, The Mentoring Operating system project
/// @file hashmap.h
/// @brief Functions for managing a structure that can map keys to values.
/// @copyright (c) 2014-2021 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "klib/list.h"
// == OPAQUE TYPES ============================================================
/// @brief Stores information of an entry of the hashmap.
typedef struct hashmap_entry_t hashmap_entry_t;
/// @brief Stores information of a hashmap.
typedef struct hashmap_t hashmap_t;
// == HASHMAP FUNCTIONS =======================================================
/// @brief Hashing function, used to generate hash keys.
typedef unsigned int (*hashmap_hash_t)(const void *key);
/// @brief Comparison function, used to compare hash keys.
typedef int (*hashmap_comp_t)(const void *a, const void *b);
/// @brief Key duplication function, used to duplicate hash keys.
typedef void *(*hashmap_dupe_t)(const void *);
/// @brief Key deallocation function, used to free the memory occupied by hash keys.
typedef void (*hashmap_free_t)(void *);
// == HASHMAP KEY MANAGEMENT FUNCTIONS ========================================
/// @brief Transforms an integer key into a hash key.
/// @param key The integer key.
/// @return The resulting hash key.
unsigned int hashmap_int_hash(const void *key);
/// @brief Compares two integer hash keys.
/// @param a The first hash key.
/// @param b The second hash key.
/// @return Result of the comparison.
int hashmap_int_comp(const void *a, const void *b);
/// @brief Transforms a string key into a hash key.
/// @param key The string key.
/// @return The resulting hash key.
unsigned int hashmap_str_hash(const void *key);
/// @brief Compares two string hash keys.
/// @param a The first hash key.
/// @param b The second hash key.
/// @return Result of the comparison.
int hashmap_str_comp(const void *a, const void *b);
/// @brief This function can be passed as hashmap_dupe_t, it does nothing.
/// @param value The value to duplicate.
/// @return The duplicated value.
void *hashmap_do_not_duplicate(const void *value);
/// @brief This function can be passed as hashmap_free_t, it does nothing.
/// @param value The value to free.
void hashmap_do_not_free(void *value);
// == HASHMAP CREATION AND DESTRUCTION ========================================
/// @brief User-defined hashmap.
/// @param size Dimension of the hashmap.
/// @param hash_fun The hashing function.
/// @param comp_fun The hash compare function.
/// @param dupe_fun The key duplication function.
/// @param key_free_fun The function used to free memory of keys.
/// @return A pointer to the hashmap.
/// @details
/// (key_free_fun) : No free function.
/// (val_free_fun) : Standard `free` function.
hashmap_t *hashmap_create(
unsigned int size,
hashmap_hash_t hash_fun,
hashmap_comp_t comp_fun,
hashmap_dupe_t dupe_fun,
hashmap_free_t key_free_fun);
/// @brief Standard hashmap with keys of type (char *).
/// @param size Dimension of the hashmap.
/// @return A pointer to the hashmap.
/// @details
/// (key_free_fun) : Standard `free` function.
/// (val_free_fun) : Standard `free` function.
hashmap_t *hashmap_create_str(unsigned int size);
/// @brief Standard hashmap with keys of type (char *).
/// @param size Dimension of the hashmap.
/// @return A pointer to the hashmap.
/// @details
/// (key_free_fun) : No free function.
/// (val_free_fun) : Standard `free` function.
hashmap_t *hashmap_create_int(unsigned int size);
/// @brief Frees the memory of the hashmap.
/// @param map A pointer to the hashmap.
void hashmap_free(hashmap_t *map);
// == HASHMAP ACCESS FUNCTIONS ================================================
/// @brief Sets the `value` for the given `key` in the hashmap `map`.
/// @param map The hashmap.
/// @param key The entry key.
/// @param value The entry value.
/// @return NULL on success, a pointer to an already existing entry if fails.
void *hashmap_set(hashmap_t *map, const void *key, void *value);
/// @brief Access the value for the given key.
/// @param map The hashmap.
/// @param key The key of the entry we are searching.
/// @return The value on success, or NULL on failure.
void *hashmap_get(hashmap_t *map, const void *key);
/// @brief Removes the entry with the given key.
/// @param map The hashmap.
/// @param key The key of the entry we are searching.
/// @return The value on success, or NULL on failure.
void *hashmap_remove(hashmap_t *map, const void *key);
/// @brief Checks if the hashmap is empty.
/// @param map The hashmap.
/// @return 1 if empty, 0 otherwise.
int hashmap_is_empty(hashmap_t *map);
/// @brief Checks if the hashmap contains an entry with the given key.
/// @param map The hashmap.
/// @param key The key of the entry we are searching.
/// @return 1 if the entry is present, 0 otherwise.
int hashmap_has(hashmap_t *map, const void *key);
/// @brief Provides access to all the keys.
/// @param map The hashmap.
/// @return A list with all the keys, remember to destroy the list.
list_t *hashmap_keys(hashmap_t *map);
/// @brief Provides access to all the values.
/// @param map The hashmap.
/// @return A list with all the values, remember to destroy the list.
list_t *hashmap_values(hashmap_t *map);
| 38.985401 | 84 | 0.679835 |
d28e9a4df5b8c75ba0765e5b65de95a2071f47e3
| 175 |
swift
|
Swift
|
Mobile/iOS/Hunter/Hunter/Utils/UI/Extensions/CGSize+Extensions.swift
|
UTN-FRBA-Mobile/Hunter
|
9531a0a1d263fc0af1c168e55e3d4b2a2f32d1d1
|
[
"MIT"
] | null | null | null |
Mobile/iOS/Hunter/Hunter/Utils/UI/Extensions/CGSize+Extensions.swift
|
UTN-FRBA-Mobile/Hunter
|
9531a0a1d263fc0af1c168e55e3d4b2a2f32d1d1
|
[
"MIT"
] | 2 |
2020-09-25T21:04:33.000Z
|
2020-11-01T23:24:50.000Z
|
Mobile/iOS/Hunter/Hunter/Utils/UI/Extensions/CGSize+Extensions.swift
|
UTN-FRBA-Mobile/Hunter
|
9531a0a1d263fc0af1c168e55e3d4b2a2f32d1d1
|
[
"MIT"
] | null | null | null |
import Foundation
import UIKit
extension CGSize {
func adding(_ size: CGSize) -> CGSize {
CGSize(width: width + size.width, height: height + size.height)
}
}
| 19.444444 | 71 | 0.662857 |
1848806a5241a93770e6cc05579d18e4cbf13ae4
| 1,052 |
rb
|
Ruby
|
lib/civu.rb
|
kenglxn/civu
|
b1c5a5709abee0685e78e090512509e2840b5fac
|
[
"MIT"
] | 1 |
2019-01-28T16:39:47.000Z
|
2019-01-28T16:39:47.000Z
|
lib/civu.rb
|
kenglxn/civu
|
b1c5a5709abee0685e78e090512509e2840b5fac
|
[
"MIT"
] | null | null | null |
lib/civu.rb
|
kenglxn/civu
|
b1c5a5709abee0685e78e090512509e2840b5fac
|
[
"MIT"
] | null | null | null |
require "civu/version"
require 'jenkins_api_client'
module Civu
class Client
attr_reader :executor
def initialize(host, uname = nil, pass = nil, debug = false)
@client = JenkinsApi::Client.new(
:server_url => host,
:username => uname,
:password => pass,
:log_level => debug ? Logger::DEBUG : Logger::FATAL
)
@executor = Civu::Executor.new
end
def list(view_name)
urls = []
jobs = @client.view.list_jobs(view_name)
jobs.each do |job|
job_xml = @client.job.get_config(job)
doc = Nokogiri::XML(job_xml)
url_node = doc.xpath('//scm//userRemoteConfigs//hudson.plugins.git.UserRemoteConfig//url')
urls << url_node.first.content unless url_node.empty?
end
urls.uniq
end
def clone(view_name)
urls = list(view_name)
urls.each do |url|
@executor.run("git clone #{url} #{url.partition(':').last}")
end
end
end
class Executor
def run(cmd)
system(cmd)
end
end
end
| 23.909091 | 98 | 0.596958 |
21b665056af677fafa257e2da299e56a1d5807dd
| 4,218 |
rs
|
Rust
|
rustls/src/msgs/fragmenter.rs
|
franziskuskiefer/rustls
|
f87a8483c17a144ff02cdf019e4420031b0dda38
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
rustls/src/msgs/fragmenter.rs
|
franziskuskiefer/rustls
|
f87a8483c17a144ff02cdf019e4420031b0dda38
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
rustls/src/msgs/fragmenter.rs
|
franziskuskiefer/rustls
|
f87a8483c17a144ff02cdf019e4420031b0dda38
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
use crate::msgs::base::Payload;
use crate::msgs::enums::{ContentType, ProtocolVersion};
use crate::msgs::message::{BorrowedOpaqueMessage, OpaqueMessage};
use std::collections::VecDeque;
pub const MAX_FRAGMENT_LEN: usize = 16384;
pub const PACKET_OVERHEAD: usize = 1 + 2 + 2;
pub struct MessageFragmenter {
max_frag: usize,
}
impl MessageFragmenter {
/// Make a new fragmenter. `max_fragment_len` is the maximum
/// fragment size that will be produced -- this does not
/// include overhead (so a `max_fragment_len` of 5 will produce
/// 10 byte packets).
pub fn new(max_fragment_len: usize) -> MessageFragmenter {
debug_assert!(max_fragment_len <= MAX_FRAGMENT_LEN);
MessageFragmenter {
max_frag: max_fragment_len,
}
}
/// Take the Message `msg` and re-fragment it into new
/// messages whose fragment is no more than max_frag.
/// The new messages are appended to the `out` deque.
/// Payloads are copied.
pub fn fragment(&self, msg: OpaqueMessage, out: &mut VecDeque<OpaqueMessage>) {
// Non-fragment path
if msg.payload.0.len() <= self.max_frag {
out.push_back(msg);
return;
}
for chunk in msg.payload.0.chunks(self.max_frag) {
out.push_back(OpaqueMessage {
typ: msg.typ,
version: msg.version,
payload: Payload(chunk.to_vec()),
});
}
}
/// Enqueue borrowed fragments of (version, typ, payload) which
/// are no longer than max_frag onto the `out` deque.
pub fn fragment_borrow<'a>(
&self,
typ: ContentType,
version: ProtocolVersion,
payload: &'a [u8],
out: &mut VecDeque<BorrowedOpaqueMessage<'a>>,
) {
for chunk in payload.chunks(self.max_frag) {
let cm = BorrowedOpaqueMessage {
typ,
version,
payload: chunk,
};
out.push_back(cm);
}
}
}
#[cfg(test)]
mod tests {
use super::{MessageFragmenter, PACKET_OVERHEAD};
use crate::msgs::base::Payload;
use crate::msgs::enums::{ContentType, ProtocolVersion};
use crate::msgs::message::OpaqueMessage;
use std::collections::VecDeque;
fn msg_eq(
mm: Option<OpaqueMessage>,
total_len: usize,
typ: &ContentType,
version: &ProtocolVersion,
bytes: &[u8],
) {
let m = mm.unwrap();
let buf = m.clone().encode();
assert_eq!(&m.typ, typ);
assert_eq!(&m.version, version);
assert_eq!(m.payload.0, bytes.to_vec());
assert_eq!(total_len, buf.len());
}
#[test]
fn smoke() {
let typ = ContentType::Handshake;
let version = ProtocolVersion::TLSv1_2;
let m = OpaqueMessage {
typ,
version,
payload: Payload::new(b"\x01\x02\x03\x04\x05\x06\x07\x08".to_vec()),
};
let frag = MessageFragmenter::new(3);
let mut q = VecDeque::new();
frag.fragment(m, &mut q);
msg_eq(
q.pop_front(),
PACKET_OVERHEAD + 3,
&typ,
&version,
b"\x01\x02\x03",
);
msg_eq(
q.pop_front(),
PACKET_OVERHEAD + 3,
&typ,
&version,
b"\x04\x05\x06",
);
msg_eq(
q.pop_front(),
PACKET_OVERHEAD + 2,
&typ,
&version,
b"\x07\x08",
);
assert_eq!(q.len(), 0);
}
#[test]
fn non_fragment() {
let m = OpaqueMessage {
typ: ContentType::Handshake,
version: ProtocolVersion::TLSv1_2,
payload: Payload::new(b"\x01\x02\x03\x04\x05\x06\x07\x08".to_vec()),
};
let frag = MessageFragmenter::new(8);
let mut q = VecDeque::new();
frag.fragment(m, &mut q);
msg_eq(
q.pop_front(),
PACKET_OVERHEAD + 8,
&ContentType::Handshake,
&ProtocolVersion::TLSv1_2,
b"\x01\x02\x03\x04\x05\x06\x07\x08",
);
assert_eq!(q.len(), 0);
}
}
| 28.5 | 83 | 0.541489 |
a7b148cce37b2c94a21b39f5b1c36bb1e109ae30
| 45 |
sql
|
SQL
|
packages/backend/migrations/0014_user_avatar.up.sql
|
baumandm/insights-explorer
|
3fe346807ebd4808b3234045d1d9a29f81981e33
|
[
"Apache-2.0"
] | 8 |
2021-11-30T17:09:02.000Z
|
2022-03-02T17:14:30.000Z
|
packages/backend/migrations/0014_user_avatar.up.sql
|
baumandm/insights-explorer
|
3fe346807ebd4808b3234045d1d9a29f81981e33
|
[
"Apache-2.0"
] | 576 |
2021-12-01T17:18:52.000Z
|
2022-03-31T20:54:32.000Z
|
packages/backend/migrations/0014_user_avatar.up.sql
|
baumandm/insights-explorer
|
3fe346807ebd4808b3234045d1d9a29f81981e33
|
[
"Apache-2.0"
] | 2 |
2021-12-02T21:19:46.000Z
|
2021-12-16T10:59:16.000Z
|
ALTER TABLE iex.user ADD "avatar" text NULL;
| 22.5 | 44 | 0.755556 |
d905956e2de03511d61b24690ebd2c318a02c1dd
| 404 |
swift
|
Swift
|
SwiftYNAB/SwiftYNAB/models/BudgetSettings.swift
|
michaeldmueller/swiftynab
|
14c8bc98709a02c763148e3acbbb4b74852a5d50
|
[
"MIT"
] | 24 |
2019-05-09T19:51:00.000Z
|
2022-03-21T16:09:54.000Z
|
SwiftYNAB/SwiftYNAB/models/BudgetSettings.swift
|
michaeldmueller/swiftynab
|
14c8bc98709a02c763148e3acbbb4b74852a5d50
|
[
"MIT"
] | 6 |
2019-06-07T12:24:28.000Z
|
2021-10-22T04:09:43.000Z
|
SwiftYNAB/SwiftYNAB/models/BudgetSettings.swift
|
michaeldmueller/swiftynab
|
14c8bc98709a02c763148e3acbbb4b74852a5d50
|
[
"MIT"
] | 14 |
2019-05-11T08:37:35.000Z
|
2022-03-21T21:37:37.000Z
|
//
// BudgetSettings.swift
// SwiftYNAB
//
// Created by Andre Bocchini on 5/4/19.
// Copyright © 2019 Andre Bocchini. All rights reserved.
//
import Foundation
/// Budget settings model
public struct BudgetSettings: Codable {
/// Date formatting settings
public let dateFormat: DateFormat
/// Currency formatting settings
public let currencyFormat: CurrencyFormat
}
| 19.238095 | 57 | 0.695545 |
75c337dac5d7a82724d3e74d49a9ac79b10ae817
| 44 |
rs
|
Rust
|
src/imp/analyzer/mod.rs
|
dochy-ksti/ninja_rpg_simulator
|
60a880371d485c760df9a058b8b410e9c227fc88
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
src/imp/analyzer/mod.rs
|
dochy-ksti/ninja_rpg_simulator
|
60a880371d485c760df9a058b8b410e9c227fc88
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
src/imp/analyzer/mod.rs
|
dochy-ksti/ninja_rpg_simulator
|
60a880371d485c760df9a058b8b410e9c227fc88
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
mod analyze_source;
mod rs_val;
mod rs_item;
| 14.666667 | 19 | 0.818182 |
5435938b596c18462aecc165cf03ad3a6786c693
| 23,546 |
go
|
Go
|
nodes/assets/b0xfile_assets_azure_compute_vm.png.go
|
nikolaymatrosov/go-diagrams
|
3804c0009b1265c1d34ac0a63850787c749d5037
|
[
"MIT"
] | null | null | null |
nodes/assets/b0xfile_assets_azure_compute_vm.png.go
|
nikolaymatrosov/go-diagrams
|
3804c0009b1265c1d34ac0a63850787c749d5037
|
[
"MIT"
] | null | null | null |
nodes/assets/b0xfile_assets_azure_compute_vm.png.go
|
nikolaymatrosov/go-diagrams
|
3804c0009b1265c1d34ac0a63850787c749d5037
|
[
"MIT"
] | null | null | null |
// Code generaTed by fileb0x at "2020-09-25 22:38:52.719788 +0300 MSK m=+3.964945872" from config file "b0x.yml" DO NOT EDIT.
// modified(2020-09-25 20:02:03.902126597 +0300 MSK)
// original path: ../../assets/azure/compute/vm.png
package assets
import (
"bytes"
"compress/gzip"
"io"
"os"
)
// FileAssetsAzureComputeVMPng is "assets/azure/compute/vm.png"
var FileAssetsAzureComputeVMPng = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x97\x67\x50\x13\x40\xdf\xed\x37\x04\x42\x0b\x45\x29\x46\x20\xf4\x50\xa5\x17\x29\x82\x80\x20\xa1\x77\x05\x69\xd2\x44\x84\x00\x2a\x55\x5a\x00\x91\xa2\xa0\x28\xbd\x23\xbd\x48\x07\x35\x40\x08\x52\xa2\xa0\x14\x23\x45\x22\x45\xaa\x74\x02\x22\xa0\x80\x77\x7c\xee\xa7\x3b\xef\xa7\xfb\x3e\xff\x99\xf3\x65\xf7\xcc\xec\xcc\x99\xf9\xed\x9e\x4d\x34\x37\xd5\x67\x62\xe0\x62\x00\x00\x30\x19\xa0\x75\x2d\x01\x80\x80\x7f\xa2\x83\x01\x00\x1c\xee\x55\xde\x02\x00\xd0\xfb\xa3\xed\xee\x03\x60\x94\xf9\x4f\x90\xad\x3e\x3f\x7e\x00\xc0\xf9\x00\x3d\xdb\x00\x2b\xbf\x5b\x01\xc1\x2e\xf7\x3c\x40\x70\x70\xb0\xb4\x97\xaf\xf7\x7d\x37\x17\x7f\x0f\x69\xbf\x7b\x9e\xb9\x5b\x97\xb8\x00\xe0\x2c\x30\xd0\xd5\xb6\x0e\xc9\xdb\x9c\x0e\xf3\x77\xb8\x1e\x41\xbb\xb3\xfd\xb6\x7d\xca\xd1\xa0\x66\x6c\x6d\xb5\x62\xf1\xb5\x8f\xbb\xf1\x06\xb5\xf1\x1d\x1d\x74\xbe\xc8\x25\xc3\xb3\x9f\x6f\x5a\x89\xa5\xca\xb1\xe5\x44\x67\xb7\x19\xab\xbf\x50\x79\x13\x67\xc2\x05\xef\x49\x0b\x52\x23\x65\x9b\x66\xc7\x88\x32\xb3\x9f\xbd\x48\xdd\x40\x79\x46\xab\xdc\x1d\xfa\x8c\xfa\xb9\xd6\x05\xda\x41\xbf\xa3\x57\x07\x5b\xd3\xc4\xe9\xe9\xb0\xed\x55\xbe\xe7\x96\xa2\x91\xba\xbb\x33\xd3\xf7\x0f\x66\xb6\x3d\xfb\x5f\x8c\xde\x69\x3d\x38\x67\xf0\x67\xac\x73\xa5\x60\x56\x15\x9c\xf9\x9f\x63\x23\x23\x97\x2e\x8a\x3a\x4b\x8f\x19\xab\xb6\xb9\xc8\x28\xa0\xc9\x50\x64\xc4\x20\x75\x6d\x19\x97\x70\x9b\xe1\xa7\xb5\x84\x5f\x4e\x86\x00\xbf\x99\xa1\xb8\x53\xeb\xe6\xfc\xd0\x70\xd4\xe9\x9e\x68\xf9\xef\xfd\x4c\x26\x2c\x52\x3d\xa8\x85\x6a\x1e\x42\x5f\xcb\xa6\xd3\x92\xe1\x24\x7d\x46\x55\xdb\x30\x31\xe0\x86\x7e\xb1\x79\xc7\x9c\x15\xeb\xe1\xab\x67\xbb\xed\x8f\x5c\xc2\xb7\xb7\xda\xb7\xf1\x73\xf4\x2b\xed\xb7\x01\x5a\xbc\xcf\x2c\x78\xe3\xb0\x49\xa4\xa5\x9e\x41\x60\xde\x94\xc3\x44\xb7\xac\x19\xc3\x58\x95\xc6\x3c\xd8\x34\xb3\x5a\x15\x5f\x4a\xb8\x8c\xd9\x58\x3d\x1a\x2d\x2b\xf0\xd7\x06\x1b\x5f\x9b\x45\x2b\x2b\x48\x2c\xf4\xc5\x11\xe5\x5f\x74\x12\xdf\xdb\x65\x78\x09\x96\xad\x37\x60\xc2\xb8\x9c\x51\x51\x95\xf4\x94\xb8\x82\x82\x82\x8f\xe4\xcb\x7b\x19\x60\x12\x17\xe8\x5d\xfa\xb6\x6c\x93\xde\x84\x6d\x22\xd3\x41\xfc\x8c\x6a\xb5\xb9\x18\x7f\xbe\xe9\x15\xc3\x50\x94\x33\xde\x6c\x6a\x5c\x8a\xfb\xa2\xef\xa5\xa0\xd3\xd8\xa9\x23\x3e\xc5\xd6\x96\xc8\x4c\xbf\x48\xc1\x03\x39\x38\x14\x57\xe7\xbc\x9a\xcb\x07\x66\xa4\x5a\x08\x24\xfb\xd7\xbe\xf9\xa1\xa7\xb1\x7e\x30\xc2\x70\x64\xdb\x9e\x11\x24\xb9\xe2\x44\xb7\x4e\x10\x25\x9f\x0d\x97\xcf\x66\x1c\x9a\xa9\xef\x15\x2c\xa6\x09\xd6\xfc\xfd\xa3\x64\xf4\x03\xad\x22\x98\x6c\xf5\xbe\x6e\x7c\x7b\xbe\x30\x5f\x85\xea\x6d\x61\xa5\x46\x82\xd6\x9e\x34\x75\x4e\x14\xb3\x05\xb9\x02\xc7\x83\xa3\x16\x47\xfd\x6c\x61\xee\x91\xcd\x0b\x1f\xf3\x6e\x7a\x44\x21\x2c\xea\x73\x01\xdb\x8c\x13\x1b\xf0\x89\x99\x37\xce\x41\x62\xa4\x83\xb1\xfb\x3c\xb9\xa8\xcf\x09\xcb\xf9\x87\x29\x46\x81\xf7\x6a\x91\x47\xfc\x5a\xd3\x0f\x8c\x0f\xf9\xaa\x44\x3a\x6e\x12\x83\xff\x6c\x70\xbc\x79\xc0\x1b\x79\x78\x07\x8c\x04\x6d\x4e\x71\x3c\x62\x75\xf6\x3f\x15\x5b\x54\x16\xbc\xc7\x7e\x63\x23\x8e\x91\x77\x82\xcb\x69\x3e\x1b\xfb\x38\xab\x3c\xd1\x5d\x9e\x9e\xa4\x38\x18\x98\x80\x15\x59\x7a\x0d\xd1\x6a\xc6\xfc\xe9\x01\x2a\xcd\xc3\xb4\x2d\x53\x3d\x99\xa7\x0e\xd3\x7c\x92\xb6\xf4\x8e\x86\xc5\xe6\x5a\x12\xe9\x39\xcb\x18\xbc\x24\xff\xdd\x9e\xf1\x57\xb3\xce\x67\xd2\x2c\x23\xa9\x5c\x0d\x15\x62\xaa\x06\x0c\x42\xdf\x16\x2a\x44\xd1\x5a\x2b\xc0\x7b\xaa\xba\xf1\x55\xa3\xb5\xea\x8a\xf4\x77\x6d\x96\x52\xd0\x12\x1f\x1c\xce\x49\x9f\x5e\x3d\xd7\xa0\x20\x29\xe1\xc8\x6c\x72\x2f\xa8\x34\x6a\x80\xba\x77\x9f\x0b\x0c\x51\x0e\xe8\xb3\xb7\xb1\x1a\x6d\x9c\x21\x83\xd9\x58\x6c\x7a\x07\xef\xe7\xac\xfa\xea\x0b\xce\x92\xc3\xe8\xbf\xd6\x2c\x29\x5b\x45\x60\x4a\x22\xca\xdd\xb2\x8f\xab\x1d\x12\xe4\x7b\xa6\xe5\xf7\xc9\xb3\x67\x5a\xe5\xdc\x41\x78\xab\x40\x3b\xbc\x62\xb2\xea\xc9\x92\xc0\x08\x4f\x9a\x56\xd6\xf5\xa8\x53\xc1\x3d\x64\xc3\x2e\xb2\x7a\x70\x47\x89\xa4\x58\x6c\x16\x66\xda\xb5\x70\x27\x46\xe2\xa9\xe9\xa2\x3e\x6a\x68\x35\x98\x1d\x8a\xad\x8c\x91\xd0\xfc\xfc\x97\x19\x01\x74\xd3\xf9\x51\xf2\x5f\x6b\x73\xba\xf1\x83\x37\x01\x6b\xfa\x57\x8f\x6b\xdb\x16\x43\x14\x30\x62\x01\x45\x2a\x99\x76\x5d\xb0\xb0\x69\xc2\x70\xbf\x75\xe0\x54\x5e\xc3\x9a\x7b\xd5\xdb\x78\x9e\xaf\x6c\xde\x1d\x62\x57\xee\xa6\x00\x95\x18\xc4\x83\xd1\xc5\x9f\x83\x67\x6d\x44\x99\xb4\x3a\x15\x64\x5a\x65\x83\xb9\x8c\x9a\xac\x9c\xb6\xef\x1b\xb6\x04\x47\x32\x9c\x09\xe5\x80\x62\xdf\x13\x11\x40\x57\xb3\x1f\xf0\xef\xca\xc1\x40\xea\x53\x39\x90\x10\xfe\x04\xa2\xb5\xe8\x06\x07\x82\x7c\x6e\x80\xf5\x08\xf1\xff\x5a\xb0\x4f\xa5\x6e\xc3\x4b\x5a\x33\x90\xdf\x23\xfb\x0b\xf1\x2c\x9f\xaa\x59\xbe\x0f\x6d\x29\xd7\xfa\xd4\xc7\xa3\x50\x05\xaa\xa9\xef\x4a\x68\x1f\x3d\x93\x10\xbb\x91\xf7\x3c\xcd\x05\x1c\xa2\x23\x4c\x40\x70\x40\xeb\x5c\x79\x68\x32\x9d\xb1\x0f\x8c\x8d\x95\xca\x5b\x9d\x9b\x72\x6a\x67\x71\x29\xc8\x9f\xda\x0c\xc9\x1d\xbb\x14\xd3\xba\x56\x29\x8f\x00\x9a\xac\xac\x54\x7c\x6b\x09\x2e\x27\x9f\xaf\xf5\xea\x44\x3f\xd6\xac\xc0\x8b\x60\x0b\xb6\x94\x8f\xed\x3c\x85\xf0\x5d\x51\xac\xf5\x4c\x38\xcf\x69\x35\x09\x3e\x18\x96\x28\xe5\x57\x75\x65\x78\x57\x39\x40\xf1\x61\xc5\xcf\xe3\xaf\xa3\xac\x5b\x76\x1a\xb4\xf5\xcc\xee\x0d\xaf\x82\xc1\x4a\xd3\x96\x7d\x7f\x52\x5e\x0f\xd8\xa9\x3c\xbf\xaf\x74\x38\x58\xf6\x2a\xe4\x6f\xed\x23\xc9\xdf\xbf\x6d\x36\xf7\x43\xcc\xc8\xe1\x97\x02\x2f\x25\x6e\xd2\x3e\x7a\xa6\x90\x5e\xe7\x6c\xe6\xf1\x0e\xec\x64\xf9\x6b\xf5\x10\xcf\x29\x7d\x1f\xd7\xfb\x54\x39\x6a\x48\xde\x45\xf1\x53\x6b\xca\x5f\x4e\xf1\xf6\xd4\xa3\x74\x45\xf4\x1c\x8e\x25\x0a\xfb\x30\xb3\x84\x30\x40\x09\x42\xd4\xd8\xf5\xe5\xfe\x9d\x55\x8f\x57\x09\xf1\xf9\x27\x8d\xfd\x3d\xda\xdf\x5a\x5d\x61\xbe\x1b\x3e\xbd\x6d\x27\xb1\x2a\xb2\xcf\xef\xff\xdc\x37\x40\xc2\xb0\xb4\x17\x92\xf4\x1b\x5c\x42\xd5\x39\x89\x42\x1e\x1a\x43\x31\xfd\x74\xf8\xdf\xa2\xc8\x90\xd5\x27\x29\x7c\x1d\x72\x0f\x8b\x79\x88\xb4\xd5\x48\x68\x51\x92\x92\x7e\xcc\xe1\x97\xa6\x6b\x0e\x17\x45\x83\x46\x4d\xba\x06\xb5\x41\xc8\xdf\x5a\x58\xad\xcf\xd3\xf9\x0f\x6e\x25\x21\xc7\x23\x74\xf0\x14\x16\x6b\x29\x98\x16\x07\x03\x0d\xb5\xe6\xa5\x2e\xfa\xd7\x32\xbe\x57\x85\x2b\x6f\xc9\x7b\xaa\xf0\xfb\x0f\xbe\xbc\x15\x7e\xd3\x14\xfe\x94\x07\xf1\xae\x59\xd4\x6a\x6e\x47\x6b\xdf\x05\x58\x67\xd7\x78\x7e\x71\xeb\xd9\x0d\x6a\x19\xc3\xb9\xed\xa5\x2f\xa3\x59\x9d\x3b\xee\x88\xf8\xe6\x9c\x23\xb6\xcd\x40\x78\xb8\xee\x4f\x8c\x5f\x0f\x08\x85\x63\x25\x1a\x8b\xe4\x9e\xa8\xb7\x93\x1b\x6b\xdf\x5e\x0b\x14\x3f\xd7\xaa\xc2\xdb\x7d\xe2\xad\x46\xd9\x58\x65\x3f\x5d\x49\xd6\x16\xde\xcb\xbb\xe6\xc0\x84\x00\xd2\x13\xac\x0c\x73\xbf\x50\x52\x6f\x42\x9d\x78\x50\x33\x63\x92\xea\x02\x58\x96\xa1\xc4\xef\x11\x0a\x2f\x0f\x8f\x46\x2d\x8e\x37\x46\xe8\x92\x3a\xfc\x7e\xdc\x81\x83\x4c\x06\xba\xe8\xdc\x65\x62\x63\x5d\x0d\x4d\x6b\x52\xdd\x5e\xbd\xb5\x70\xe5\xf7\x14\x94\xd4\x21\x61\x03\x76\xe9\xde\x4d\x84\x4c\xc1\xa8\x4d\xa6\x6e\x26\x01\xf8\x17\x07\xbf\x1e\x77\xe9\xd9\x0d\xfa\x98\x98\xf1\x26\xb7\xd4\x55\x61\xfd\xca\x61\x7b\x8d\xa7\xcb\xac\xb9\x10\xef\xcc\xe5\x04\x36\x5c\x33\xb7\xbd\xe5\x2a\x02\x48\xdf\x8b\xcc\xad\xcb\xec\x68\x6f\x65\xb6\xd7\x9c\x4c\xf4\x34\x2d\xdd\x79\x1f\x2d\xf0\xc3\x47\x3d\x88\x09\x86\x65\x74\xa8\x35\x99\xf0\x16\x21\xa7\x5c\x1f\x4e\x9a\x27\xd2\xea\xef\x2c\x36\x5a\x98\x4a\x06\x41\x60\x58\x1d\x2b\x2f\xd2\x7e\xce\x0f\x5d\x32\x25\x99\x0d\x43\xec\xf2\x24\x37\x5a\xc2\x81\x5e\x39\xb9\x7c\x5d\xe9\xfe\x4b\x81\x6f\xea\xa3\x41\xc7\xe6\xdb\x00\x36\x19\x54\x4b\x0d\x2d\x7a\x67\x88\x21\xed\xe7\xd8\x6c\xee\xdb\x8e\xaa\xf1\x99\x1d\x34\x6f\xda\xd2\xc0\xb4\xe2\x54\xbe\x96\xaf\x2b\x69\x6f\xbe\xc2\x10\xc3\x4c\x85\xbb\x6d\x3e\x48\xc4\x42\xcc\x6f\x2d\xf9\x90\xf6\x73\x3e\xb4\x2d\xb4\xe6\x27\x4f\x8e\xab\x27\xe0\x2d\xda\x90\x99\xdc\x51\x42\x83\x95\x96\x18\x9c\x53\x73\x83\x5c\x4c\xfd\xab\x6c\x1f\x75\xde\x5e\xf3\x21\x6b\xc7\xe7\x9e\x72\x60\x40\x4b\x2f\xb7\x6e\x22\x6f\x36\xa8\x63\xef\x3d\x5d\x05\x47\x26\x3d\x94\xa0\xed\x7b\x9b\xb4\x9f\xe3\xaf\x35\x97\x82\x92\x7a\xe3\xe2\x2b\xc4\xbb\xe9\x46\x6e\x24\x21\x00\x73\xe8\xec\x47\xb1\x07\x38\xf2\xe8\xbb\xfc\xa0\x81\x97\x65\x41\x1d\x9b\x87\x57\xee\xbb\x4d\xb6\x45\xb1\x9e\x88\x9b\x4a\x06\x51\xfd\x35\x56\x2d\x2a\x11\x78\x22\xe3\xac\x90\xeb\x77\xca\xf0\xc3\xb7\xaa\xe7\xc4\x5b\xcd\xb1\x99\x57\xa7\xd5\x0d\xa8\xf0\x7b\xde\x10\xb3\xed\x88\x72\x14\x17\x30\xe1\xe7\x59\xfc\x91\xc4\x86\x00\xcc\x88\x81\xec\x43\xa2\xe7\x1f\xca\x6f\xf3\x6b\x81\xe2\x05\x17\xb3\x24\xe7\x9d\xa3\x82\xb9\x44\xf7\x63\xd6\x2c\x2f\x45\xaf\xd4\x32\xab\xa6\x4b\xcf\x71\xcb\x14\xfc\x34\x96\xac\x27\x2f\x4a\x25\xe6\xeb\x5f\x6d\x58\xd8\xa1\x63\xe0\x8c\x87\xe4\xbf\x03\xfe\x93\xf8\xe2\x0b\xca\x27\xbf\x55\x7c\x73\xf8\x88\xa2\xed\x37\xcc\x89\xed\x10\x54\x2a\xc8\x14\x90\x11\x82\x69\x9d\xb7\xb5\x9c\x3f\xa7\xaf\x4f\xd9\xa8\x62\x3f\x7d\x69\x98\xb1\x77\xaf\xa4\xc4\x00\xca\x72\xf7\xea\x4d\x3b\x39\x30\x20\xe6\xd8\xf0\x8f\xb9\x30\x33\x11\xc7\xce\xa2\x0a\xf2\x93\x25\x93\x5f\xd4\xd6\x74\xd0\x22\xaa\x14\x91\xbd\x90\xb9\x38\xb6\x3a\xfb\xcf\x64\x8c\xb1\x7d\x93\x64\xc3\x3b\x04\xe0\xf8\x39\xf0\x16\xfe\x8b\x09\xb9\xe0\xd3\xfd\x78\x0e\x07\xee\xc8\x02\x89\xda\x9b\x06\x1b\x2a\x97\x62\x56\x4c\xcb\x26\x65\xb0\x94\x76\x51\x87\xf3\x68\x24\x8c\xa0\xa8\x77\x05\xb2\x98\xa4\x5c\x7b\x56\xc6\x54\x1f\xce\xf6\xf7\x68\xca\xee\x52\xa8\xcf\xc7\x4c\x64\xec\xea\xcb\xbe\x56\x88\x23\x16\x22\xcb\x24\x79\x63\x7d\x27\x95\xc6\x04\x7d\xee\xc2\x86\x46\xba\xce\xb6\x79\xdb\x62\x7f\x5a\x8f\x1b\x0c\xff\xcb\xa1\xcb\x6f\x1c\xde\x50\x1a\x10\x1e\x38\xc7\x65\x72\x53\xdb\x8d\x9a\xa9\x18\xfc\xbe\x7a\xdf\x21\x30\x84\xab\xe3\x84\xbc\xdc\x10\xda\x48\xd9\xff\xf3\xb2\x18\x68\xe2\x8a\xe8\x25\xc9\x6b\x94\xc1\x53\xe1\x21\x77\xc3\xdc\x74\x11\xc8\x86\x46\xf6\x3b\x23\xcf\xcf\x05\x4e\x4a\xb7\x67\xcd\xc7\x47\x4f\x20\x0f\xc1\xf2\xd5\x1e\xdb\x11\xc4\x55\xff\xf9\x3f\x63\xa3\xac\xfd\xa7\x2e\x43\xef\xf3\x24\x60\x04\xc5\x84\xd7\x52\x5f\x35\x24\xb9\xde\x39\x77\xd6\x30\xd1\x5e\xbd\x1f\xb2\xac\x7b\xb6\xea\xec\xdf\xdd\x45\x29\xee\xa7\xfb\x4c\x0b\x5f\xad\xc4\xcd\x5e\x71\x87\x28\x5b\xf9\x87\xc7\x17\x2d\xa3\x59\x8d\x72\xee\x58\x38\xef\x8d\x47\x5b\xb3\x2c\xdf\xb2\x93\x03\x86\xc2\xd4\x0d\xb5\x6f\x39\x1f\xcf\x9f\xe9\x08\xbf\x4a\x7c\xec\x49\x92\x35\xea\xa8\xd4\xc8\x14\x9f\x9f\x75\x56\x8d\x5d\x92\xfa\x50\xed\xa4\x3a\x29\x8b\x21\x1e\xd0\xd5\x32\xde\xb1\x45\x3c\x2d\xea\x4c\x79\x6d\x99\x4f\x00\xfe\xe8\x64\x91\x86\x5b\xa6\x70\xc9\xa9\xb5\xc6\x03\x77\x86\x3f\xf1\x46\x7c\x7c\x3f\x90\x43\xf3\x92\x61\x7f\x6a\x7c\xb7\x81\xf8\xf7\x43\xe9\x6e\x88\xc0\xc8\x79\x46\x37\xa7\x0b\x1f\xbb\x76\x99\x5d\x81\x4a\xad\x00\x3b\x81\xc8\xa9\xec\xe2\x11\xa6\x11\xa4\x2e\xab\x79\xd3\x20\x71\xfa\xc4\xa0\x23\x44\xc4\x91\xa3\x9d\xb6\x53\x2e\xaf\xa7\xed\x04\xaa\xb2\x35\x12\x83\xa4\x5a\x08\x83\x4b\xa7\xe8\x9b\xb3\xf9\x6f\xff\x0d\x6e\x75\x05\x69\x1f\x36\x12\x29\xd1\x27\x42\x76\xc7\x6b\xba\x67\xbf\xba\x7a\x29\x90\xe5\xfb\x28\x5e\x7d\x66\x7c\x7c\x3d\x9e\xed\xe4\x86\xa6\x4f\x8e\x7f\x68\x53\x10\x22\xbc\xaa\x73\x1b\xcf\x1d\x29\xfe\xac\x8e\x26\x67\x74\x6b\x16\x3f\x56\x70\xc9\x81\x01\x74\x02\x05\x89\xcd\xe8\x15\x3a\xdc\xfc\xaa\x18\x79\x5f\xc4\x71\xf7\x38\x9a\xb4\x4a\x85\xdf\xff\x2c\xee\xa0\x51\xc2\x1b\x1c\xf4\xda\xed\xd1\xbc\xf7\xf7\x7b\x2d\xab\x8f\xa0\x5c\x9c\x7d\x42\x59\x76\xc3\xeb\xc7\xf7\xdc\x80\xb5\x96\x58\x91\xcb\xa7\x3c\xc4\xcc\x98\x65\x7c\x67\x85\xa5\x8a\xac\xe5\x83\x60\xb2\xe4\x8a\xfc\xe1\x09\x41\xee\x9b\xe2\xe5\x94\x40\x47\xa9\xca\x57\x3b\x2d\xf3\xf7\x5a\x56\x77\xd5\xba\x76\x11\x80\xe3\x0b\x3b\xfd\xfc\xb8\xde\x27\x95\x99\x0c\xe2\xd6\xa9\xfb\x07\xbf\xbc\x0f\x6d\x0b\x2b\xa6\x65\xfe\x61\x34\xe4\x94\xc1\xd1\x72\xb2\xd3\xf5\x58\x14\x85\xee\xdd\xc6\xd3\x4a\x31\x18\x96\x6a\xcf\xd5\xc5\xc7\x76\xe6\xd1\x04\x6d\xf3\x64\x98\x84\xcd\xbd\x95\xdc\x48\x27\xf2\x5d\xb3\x60\xf5\x8c\x8c\xaa\xcd\x37\x3c\x18\x1c\x53\x31\xc0\xe5\xdc\x19\x45\x2c\x07\xe2\x19\xe0\x40\x4f\x51\xc0\xdf\x26\x4c\x03\x97\xe3\x4d\x79\xe7\x85\xac\x67\x2e\x35\x2a\x60\x8b\x52\xcc\x26\x9e\xb0\x61\x88\x85\xf6\x33\x29\xd7\xe2\xa7\xfe\x9d\xc1\xcd\xfc\xc4\x6c\x36\xff\x53\x19\x29\xcd\x15\x88\x5d\xe3\xfe\xd2\xd0\xd6\x7c\xe6\x7a\xeb\x98\xdb\x70\xa2\x70\x8a\x48\xf2\x73\xe7\xbd\xf4\xfb\xe7\x7f\x32\x23\x7b\x3e\x31\xb7\x20\xd5\xa7\xcb\xc3\x1a\x57\xdb\x4b\x99\xa1\x04\xd4\x8d\x3b\xb1\x87\xee\xd7\x19\x99\x9f\x9e\x9f\x9c\x2e\xec\xb5\xc5\xb7\x9c\xec\xec\xa2\xda\x90\x85\xa6\xe7\x76\x1a\x7a\x30\xb8\x57\xad\x4a\xb6\x9f\xd9\xab\x0e\xb1\x28\x47\x2e\x28\xc1\xe3\x5f\x4a\x7c\x8c\x0b\xad\xdd\xf0\x02\xf5\x74\x1d\x7c\xaf\xbd\xf7\x0b\x0c\xd1\x0c\xc9\x7d\x65\x98\x7d\x2a\x45\x94\x1c\x50\xa8\xa6\x7c\x6d\x57\x6a\xd0\x20\x50\x89\x0b\x37\xdf\x7a\x7b\xb9\x5f\xbc\xae\xa7\x30\x81\x91\x46\x31\xda\xfb\x96\x6e\x63\x4b\x15\xe7\x70\xe1\x38\x25\xbe\xdb\xf8\xc3\x0b\x6f\xe6\xe4\xf3\x87\x53\x7b\x27\x6f\x7c\x4d\xe1\x85\x76\xe3\x41\xdd\x45\xf6\xaa\xe4\x80\x15\xdd\x2b\xfe\x94\x45\x3d\x67\x37\xf0\xc6\x56\x91\x9d\xf0\x69\x6f\x21\xc4\xcc\x1e\x19\x74\x20\x7a\x57\xc2\xd1\x95\xdc\xc8\xe3\xa7\x1e\x79\xe4\xc3\x15\x85\xdf\xf9\xfb\x9f\x60\xd5\xdb\x35\x1f\xc6\x51\x12\x44\xc9\x39\x9d\x0f\x21\xe6\x34\xb7\xc6\xe3\x77\x56\x3d\x86\x5a\x91\xdc\xcb\x21\x64\x4a\xc1\xa9\x30\x97\x0e\x84\xb8\xbc\x09\xcd\xf4\x25\xa1\x82\x5d\x81\x75\xe2\xbd\x16\xe4\x53\x84\xc8\xd5\x27\x9f\x61\xdc\xa2\x8d\x26\xaf\xd5\xe4\x40\xb5\xb1\xea\x54\x8a\x51\xf7\x6a\xfb\x58\x32\xc4\xbc\xec\xdf\x85\x6e\xfc\x84\xc5\xfa\x81\x2a\xa6\x6d\xf5\x01\x14\x5a\x34\x10\xa8\xf8\x70\x94\x34\xbd\x65\x4b\xa6\x58\x37\x98\x4c\xa8\x23\x00\xaf\x79\x4a\xdb\xc2\x63\x97\xdc\xba\x03\x59\x70\xa9\x94\x07\x43\x04\xf5\x7b\x9d\x4f\x20\x73\xda\x2f\x30\x44\xe2\xd4\xee\xa4\x95\x2b\x59\x8e\x1c\xd0\x99\x0c\x99\x73\xd9\x73\x73\xf9\x19\xf0\xfa\xfb\x58\x34\xbc\xe0\xf2\x2b\x21\x3f\x93\x88\x70\x2c\x06\x77\x4a\x00\x3b\x6f\xb0\x22\x3b\x33\xd9\x16\x1f\x53\x1e\xed\xc4\x5e\x84\x55\xfc\x54\x62\xe4\x12\xb2\x1d\xb1\xcd\x37\x4a\x25\xfd\xdc\xe9\x18\x12\xbd\x65\xe6\xa6\x19\xe9\xf9\x44\xe3\x77\x64\x37\x28\x62\xbc\x8d\x9f\xa9\x9f\x74\xfe\xff\x6a\x44\xff\x9d\x85\xf4\x4c\x41\x6a\x0c\x35\xa2\x2e\x66\x3b\xe4\xf7\x78\xcb\x03\x8e\xf5\x0a\xf9\x95\x96\x82\xb7\xf0\x6c\xfb\x26\xb2\xc2\xb4\x94\xa4\x92\xa3\x68\x9d\x69\x61\xf3\x46\xf5\x87\x22\xa2\x3c\xb9\x90\x97\x4b\xdb\xf3\xc2\x93\x56\x64\xf2\xed\x9a\x1a\x0b\xc7\xb3\x90\xf7\x9c\x18\x1e\xae\x41\x17\x31\xcf\x6a\xe9\xb2\x35\x59\x50\xa7\x15\x25\xf1\x34\xfe\x01\xed\xc8\xb4\x65\x3c\xb7\x9a\x6b\x65\xcd\x77\xce\x29\x89\xac\xb6\xde\x51\x77\x5e\x51\x52\x28\xba\xe0\xc8\xf9\x0c\x8c\xc0\xf1\x1c\x3c\x88\x6f\x56\xc9\x53\x6c\x78\x70\x8b\x7d\x3b\xff\x8c\x9e\xd6\x42\x79\x4e\x3a\x3f\xca\x5f\xc4\x8a\xf0\x5d\x0e\xaa\x97\xbb\x7d\x6c\x29\x0b\x0c\xdd\xb3\x94\x23\x23\xe4\xe3\x22\xae\xd8\x7d\x1b\x19\x4d\xd0\xa3\x24\xac\x3d\xbf\x84\xf9\x22\x7b\xd7\xff\x8b\x16\xee\x3d\xc4\x4e\x54\x16\xf0\xc8\xbb\x66\x1d\x52\xba\x5d\x3e\x3e\x8e\xbb\xeb\xe6\x29\x74\xe3\x8e\xaa\xe6\x5c\x69\x9e\xd7\xc2\x4e\x56\x74\xb4\x8f\x45\xa0\x78\xc1\xbf\x07\x86\x62\xcd\xcb\xb2\xcf\xec\xea\x11\xa6\x31\xfe\xd1\x57\x4b\xf8\x3d\xb7\x54\x59\xc3\xd2\xe1\xc1\xcf\x90\x01\x30\xfc\x2b\x9f\x08\xc4\xa0\x46\x86\xc7\x5b\x0e\x5c\x9d\x3d\x76\xb5\xd9\xd3\x58\x9b\xcd\xfd\x11\x6a\x22\x6d\xf9\xba\x4f\x79\x42\x8f\x9b\xea\x62\xa8\x5f\x97\x0f\x02\x78\xb8\x67\x29\x07\x1d\x88\x36\xfa\x89\x3d\x6e\xcd\x4f\xfe\x71\x9b\xae\x46\xba\x4a\xe2\x07\x0d\x63\x44\x89\xaa\xf0\x5e\xc7\x90\xcc\x45\x98\x16\x0d\xdc\xfd\xf1\xe1\x28\x5f\x7c\x83\x18\x6f\x77\x72\x7e\xf2\x6d\xf8\x1e\x39\x52\x2e\xd4\x68\xfe\x7d\x56\xb4\x42\x76\xcc\x9a\x65\x78\x6c\x57\x22\x47\x40\xc8\x47\x02\xc5\x9a\x77\xe2\x63\xc2\xfc\x94\x9d\xc5\x43\x2a\x1e\x3e\xd0\x5f\xbf\x67\xf6\x23\x94\xc7\x68\xd9\x85\xf2\x28\x52\x4f\x0e\x48\x7c\x6c\x41\x39\x5d\x2a\x29\x09\x56\x79\xbc\xbe\xd2\x3f\x32\xed\x40\x7b\x99\x85\x05\xbe\x62\xcc\x83\xf8\xd4\x2d\x8b\x19\x2b\x3b\x3c\x0b\xd5\x4a\x0d\xe8\x7e\x57\x27\x54\x12\xb2\xe4\x00\xf3\x56\xe7\x96\x13\xe5\xb2\x74\xb4\xd4\x5b\xa5\x61\xa4\xd5\x67\x7a\xb2\xa4\x1a\x71\x1d\x05\xc3\xba\x7a\x2a\xd0\x1c\xef\x24\x6b\x07\xbc\xfe\xf2\xfd\x77\x0a\xe2\x25\x6f\xe1\x35\x87\x16\x54\x0a\x6a\x4f\xa5\x6a\xa5\xfb\x45\xc4\x3e\x02\x48\xcb\xaa\xbe\x7a\xe3\xa7\x18\x3f\xa6\x50\x62\xab\x51\x03\xd1\x7e\x6a\x22\x99\x71\x56\x25\x5d\x7a\x0e\xfd\x19\xfb\x81\xfb\x77\x5d\x37\xf0\x4f\x7d\x29\x45\xf9\xe6\x85\xac\x67\xf1\xb8\x3b\xfd\x0d\x91\xf1\xfa\x4b\x95\xf4\x87\x33\x25\x8f\x12\xf1\x16\xd0\xf3\xa6\xb3\x81\x48\x18\x96\xb1\x4c\xa4\x9f\xf6\x17\x93\x47\x0d\x6e\x53\xc5\x73\x4a\x45\x65\x40\xd9\xf1\xe2\x3f\x9e\x5b\xdb\x90\xb9\x6d\xbd\x14\x6b\xde\x13\x35\x72\xc0\x74\x0a\x64\xee\xde\xd8\x78\x50\xb8\xb2\x55\x6f\x71\x23\x4f\xe6\x72\xf5\x59\x38\x56\xe2\x6e\x24\x99\x52\x18\xa4\xe8\x5a\x3c\x38\x95\xa2\xcf\xc4\x46\x4b\x84\x97\x32\x76\x0c\xd5\x8b\xc0\xb1\x12\x0a\xae\x59\x21\x1f\xf5\x30\xc4\x50\x52\x7f\xaa\x7b\x01\x29\xb8\x86\x1d\x5a\x64\x58\xe5\xab\x7e\x2b\xb7\xee\xa2\x2c\xa8\xce\xaa\x6e\x5b\x88\xf6\x39\x13\xdf\x0f\x37\x9d\xdd\x07\x30\x2c\xad\x71\x1b\xf2\xc0\xb4\x05\x39\x2c\x65\xf5\x1f\x1e\xe3\x21\x73\x02\x2b\x4d\x7a\xc7\x0d\x70\x0c\x91\xc6\x68\xfe\xf6\x67\xc2\x6a\x40\x34\x29\x58\xe3\x11\x64\x4e\x3b\x9e\x08\xff\x59\xb1\x6b\xab\xa1\x90\x74\xf0\xe9\x8e\x56\xb2\x48\xbf\xe7\x77\x13\xca\xb4\x7d\x83\xcf\xc3\x58\x2e\x72\x40\x04\x16\x32\x67\xf1\x82\x94\xf4\x57\x36\x4d\x2f\xd8\x08\x99\x52\xf6\x44\xfc\xef\xfe\xe9\x89\x39\xa7\x54\x2a\xff\x90\xc7\xe3\x8e\xa1\x03\x15\x18\x96\xb8\x4a\xc3\x28\x53\x30\x5a\xb1\xaf\xb4\x1a\xd3\xf7\xe7\x48\xb3\x1b\xe5\xf5\xdf\x12\x4a\x9c\x80\xfe\xd0\x39\x8b\x44\xab\x9f\x34\x35\x48\x31\x66\x1b\xc3\x94\xaf\x97\x0b\x14\x32\x90\x87\x64\x3a\xb7\x42\xc0\x97\x77\xba\x52\x79\xd3\x8c\x75\xff\xf9\x51\x0b\x0d\x5c\xbc\x9c\x5a\xe2\xd0\x25\xf8\xcc\x05\xf1\xde\x5d\xbe\x7a\x90\x7f\x57\xf8\x00\x86\x4d\x7b\xef\xde\x2c\x0b\xbf\x12\x88\xd2\x2d\x58\x1a\x00\xcf\x2c\x05\xf3\xc7\x2d\xc4\xd8\x6d\x32\x75\x16\xbd\xea\x18\x01\xb9\xad\x78\x5d\xcd\xf8\x45\xd8\x00\x5b\xba\xbd\x39\x08\x05\xad\xd5\x8c\x10\x40\x52\x2c\x5e\x57\xf3\xc9\x35\xb2\x60\xb3\xc1\x56\x19\x24\x08\x8c\xd9\x80\x05\xa1\x93\x2a\xeb\x24\xbf\xc8\x97\x86\xa9\x88\x71\xa0\x5a\x84\x63\xee\x91\x2d\x5a\x57\x13\xf6\xdb\x3b\x63\x93\x42\x88\x64\x7a\x16\x65\x7e\x0d\x9b\x86\xae\x20\x75\x7c\xd2\x2f\xc5\x62\x43\xae\x92\x1e\x1e\x26\x26\xc5\x1a\x89\x17\x57\x04\x2e\xee\x85\x72\xc4\x8b\xee\x6a\x08\x2c\xba\xdd\x50\xce\x3d\x89\x63\x15\xb4\xfb\x00\xb5\xcf\x88\x73\x97\xff\x40\x0e\xd7\x4d\xa2\xbb\x19\x6c\x66\x36\xac\x89\x39\xf9\xbd\x4f\x33\xd8\x72\x5a\x63\x49\xab\x6c\xc2\x56\x65\xcd\x90\xd1\xd7\xb9\x92\xc0\x2e\x87\x21\xff\xa6\x9d\xfb\xe4\xab\xf5\x47\x1b\xad\xea\xb0\x55\xc2\xc9\x10\x9a\xf2\x93\x4d\x5c\x44\xa0\xab\xf3\xee\x42\xff\x04\x36\x11\xbc\xd9\x6c\x23\x07\x30\xde\xb3\x52\x65\xc9\x19\x5c\x2a\x5a\xf7\xfa\xb7\x2d\x8c\x5d\x59\xf7\xf6\xde\x2e\x3c\x3e\xfc\xb4\x0f\x34\xef\x0e\x4a\xfd\x95\xc2\x1c\x39\x12\x9f\x8a\xa1\xe4\xb3\xe1\x4d\x5f\x6b\x17\x64\x4c\x74\x49\x9f\xed\x2f\x70\xfa\xda\x75\x45\x46\xf8\xee\x46\xbf\xbe\x40\xe7\x8a\xf8\x2a\x63\xf0\xde\x59\x25\x50\x51\x1c\x65\x89\x1b\x7a\xc4\x2b\xb8\xef\xd4\xf4\x31\x27\x77\x1b\xb7\x5e\x97\xba\xc7\xc7\xee\x17\x95\x91\x66\xb9\xf1\xed\xed\x9e\x33\x7f\x4b\x97\xcc\xd2\xed\x0c\x0f\xed\x89\x40\xe6\x5f\x67\xaa\x44\x76\xf2\x71\xe8\x45\xbf\xf1\x7a\xe7\xa8\xee\x24\xc1\x73\xd4\x84\xd2\xc2\x8d\xc9\xd1\x12\xed\xf0\x2b\x74\x72\x61\x38\xa2\xc2\x63\xbd\x52\x95\xe6\xa7\x68\xa9\xe8\xcc\xb8\x34\xe7\xaf\x0d\x2e\x3d\xa4\xcc\xc8\x01\x8f\x4b\x94\x5e\xb6\xfd\xab\xc5\xfe\xf5\x22\xbd\x15\x60\x54\x29\xdd\x6d\x79\x2f\xd4\x5d\xfe\x3c\xfe\x28\xf1\x8b\x2c\xff\x8e\x11\x7d\xf8\xf6\xfd\xe0\x99\xa3\x37\xac\xf3\x4d\x7e\xbd\x83\x30\xc2\x11\x6f\xd4\x31\x25\x5d\x90\xf5\x30\x8b\xf5\xa5\x11\xba\x85\x4e\x40\xda\xd6\xbc\xc5\x5c\xec\xc6\x6a\xcb\x10\xe3\xa9\xa4\xbb\x5d\x10\x46\x39\xf7\xe8\xcd\x9a\xda\x37\x41\x56\x3a\xde\xfa\x9a\x9a\x08\x83\x40\xa4\xaf\xa8\x00\x89\x6a\xca\xc0\xfe\xfd\xc4\x9a\x50\xaa\xe8\x44\xbd\xf3\xe5\x25\x3d\xd5\x0a\x1e\x60\x7d\x3e\xf7\xa2\x9f\xa6\x50\x59\x5e\x15\x8e\xf9\x22\xab\xce\xb7\x93\xfd\xfa\xa8\x13\xf5\xea\xf5\x1d\x79\x69\xc6\x2d\x79\xcb\x81\x09\x9b\x89\x39\x4e\xcb\x81\xd9\xca\xba\xee\x75\x04\x90\xee\x01\x21\x2f\x22\x77\xe6\xba\x9d\xc6\xf4\x42\x90\x50\x42\xc4\xaf\x2a\x69\x02\x53\x69\x9a\x8c\xdf\x2c\x3e\xff\xe0\xd9\xe0\x13\xc8\x9c\x7c\x4e\x39\x05\x0e\xb0\xe5\x5e\x3c\xc7\x35\x00\x86\x1d\x44\x8b\x9b\x55\xd6\x75\xa3\xbe\x48\x59\x2f\x08\xc1\x41\x26\x7d\x9c\x4e\x0f\x08\xbf\x9c\xa8\x63\x18\xaa\x15\xc8\x14\x49\x00\xfe\xd9\xba\x82\x2e\x54\x08\x2b\xc7\x78\x57\x79\x76\x86\xfd\x2a\xe9\x77\x2c\x08\xb0\xb5\x98\x94\x9e\xc3\xa1\x96\x8e\x16\xce\x9b\x75\xc9\x90\x26\x00\xff\x8a\x6f\xea\x97\xfb\x48\xbf\x6d\xce\xcd\x9d\x83\x83\xe0\x3b\xe6\x8e\x58\x57\x0e\xc7\x92\xcf\xc3\x08\xb0\xc5\x6e\xe5\x88\x35\xb4\x1c\x48\x5b\xe3\x3a\x8e\x81\xcc\x99\xe2\x35\xa1\xac\x3a\x3f\xaa\xbd\x77\x18\x61\xd8\xc1\x6f\xf7\x87\x35\x9a\x21\x0f\xad\x27\x8a\xb3\xd6\x95\x5f\xed\x4b\xc0\xb0\x83\xd4\xb1\xdd\x36\xd5\xde\xe6\x26\x74\xa3\x75\x38\x58\xd7\x4d\xf0\x66\x38\xb9\x9a\xd1\xdc\xc4\xf0\x03\xa8\x64\x85\x61\x1f\x0b\x9f\xa5\x67\x22\x60\xaa\xd7\xcd\x4d\x0c\xbf\x56\xfd\x5f\x03\x5a\xb3\xf0\x2f\x1d\x36\xee\xdf\x1a\xdd\x28\xde\x8b\x54\xde\x57\xbd\xbe\x03\x85\x61\xc3\xe8\x04\x7a\x4f\xb6\x8f\x15\xa3\x46\x14\x37\x83\xc6\x94\x0e\x21\x50\x02\x4a\xd9\x6f\xe6\x58\x0f\x6c\xdb\x38\xc6\x3f\xfe\xd6\xea\x3b\x8d\xc3\xae\x09\x76\xa4\x40\xe6\xa8\x72\x2f\xfa\x39\x49\x95\x1d\xb7\xad\xa9\x39\x94\x7b\x53\xe6\xfb\x0a\xad\x1c\x1f\x4e\xdc\xb5\x30\xef\xdb\xea\x3c\x98\xa9\xa1\x8a\x26\xc8\x40\x5a\x2a\xeb\xfa\xe2\x9e\xe7\x94\xbf\x7a\xb0\xd3\x4d\xfb\xb4\x5a\xba\xb7\x26\x04\x56\x34\x12\x71\x30\x1d\xec\xcd\xcf\x3a\xc9\x88\x3f\x92\x29\x1b\x6d\xdb\x74\x4c\xd4\x8d\x79\x4d\x33\xf8\xd0\x13\x30\xf8\x4c\xb5\x54\x19\x90\x5a\xfc\xc0\xa1\xf7\x8e\xa7\x2c\x87\x3e\xf8\xd6\xe6\x31\xc8\x59\x97\xf9\x43\xf6\x74\xd7\xc6\x5c\x30\x35\x81\x83\x21\xae\x1d\xe2\x43\x35\x52\x8b\x2b\x90\x70\x03\x21\xfc\xec\x0c\x27\xf6\x82\xa9\x73\xcb\x0a\xcc\x2e\x20\xed\x2b\x2e\x70\x9d\xca\x28\x53\xfa\xa4\x08\x43\x5e\x07\xe1\x9c\x9a\xdb\x3f\xef\x6b\x5d\xc6\xfe\x05\x0d\x98\xc1\x0c\xa9\x15\xeb\x73\x56\x9b\x08\xe0\xf1\x0c\x2d\x3c\xff\xc8\xc5\xa1\xc6\x6b\x8a\x18\xc7\x1a\xec\x5f\x51\xd8\x24\x46\x35\x29\xfe\x30\x64\xb2\xa9\xd6\x39\x62\x2f\x77\x96\xc7\xc6\xd1\x5c\xc9\x15\xa4\x89\xa5\xa2\x15\x57\xf6\x8e\x50\x39\xe5\x8e\x34\x73\x37\xc4\x97\x5a\x41\x46\xf4\x2c\xd9\xb0\x49\x0e\x9f\xb4\xa3\x60\x39\xe0\x4c\x4b\x15\x3d\x11\xdb\x3d\x37\x9a\xb8\xcf\xb1\x2a\x7f\x68\xf4\xe0\x7c\xa2\xae\xe0\xad\x9c\xe5\x0b\xe2\x1e\xdc\x58\x65\xd0\x5c\x9a\xb6\x69\x39\xd0\xa7\x93\x80\x02\x9c\xb1\x13\xbb\xbe\x36\xc0\x9f\x8e\xc0\xad\x93\x00\xb5\x1c\x20\xe9\x24\x90\xda\x30\x2c\x68\xf1\x61\x5d\xc1\xd4\xe6\x44\x5d\xc1\x1a\x1c\x7a\xac\x5a\x19\x6c\xb5\x6f\xe3\xed\x95\x4c\x18\x9d\x17\xad\x04\xc0\xfe\xca\xe5\x9b\xe4\x20\x07\x3a\x81\xd2\x34\x88\x80\xee\xc6\xf1\x8a\x81\x38\x77\x1c\xab\x05\xb0\x10\xd0\xb5\x36\x3c\x4f\xcb\x4a\xc3\x4a\xeb\xdf\x38\x21\xba\x8d\x86\x22\xf2\x0f\xeb\xa5\xcb\x8c\xe9\x05\xfa\x45\x34\x87\xa8\xb2\x1c\xb2\x84\xe3\x29\xda\x68\xb4\xb8\x55\x4e\x79\xe7\x5b\xb7\xd4\xb4\xcf\xac\x3a\x0e\x01\x4c\x44\x3c\x1e\xcf\xd7\x1e\x11\x5c\x52\xed\x18\x52\x1c\xd1\xff\x91\xcf\x4b\xe7\x4b\x75\x5d\x6c\xf5\x8d\x80\x79\x67\xbb\x96\xb6\x36\x65\xcc\x2c\x7e\x7a\xcc\xa8\xe3\x3a\x06\xf4\xba\x36\xa2\xf9\x09\x55\xf3\x8b\x4e\x57\x62\xa1\x75\x51\x51\x77\x45\xf8\xff\x77\x5d\x2b\x6b\xbd\x3d\x5d\xba\xcc\x5c\x2c\x6f\x4c\x31\x79\x93\xb0\x78\x63\x35\x00\x57\x84\x83\x09\xfe\xcf\xd9\x6d\xfa\x0b\x9d\x87\xef\xca\x25\xf0\x73\x5c\x00\x00\x00\x03\x3d\x53\xdd\x3a\x9d\x9b\x31\xff\x27\x00\x00\xff\xff\x74\x74\x34\x5e\x11\x17\x00\x00")
func init() {
rb := bytes.NewReader(FileAssetsAzureComputeVMPng)
r, err := gzip.NewReader(rb)
if err != nil {
panic(err)
}
err = r.Close()
if err != nil {
panic(err)
}
f, err := FS.OpenFile(CTX, "assets/azure/compute/vm.png", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
if err != nil {
panic(err)
}
_, err = io.Copy(f, r)
if err != nil {
panic(err)
}
err = f.Close()
if err != nil {
panic(err)
}
}
| 511.869565 | 22,756 | 0.746411 |
9692c1f7812eea253d5cfa58f29dd990699fc9fe
| 333 |
html
|
HTML
|
app/index.html
|
GuilhermeSanches/Babel-ES6
|
0eff6cf01c1fe62c06683d67b0936266f97af8f6
|
[
"MIT"
] | null | null | null |
app/index.html
|
GuilhermeSanches/Babel-ES6
|
0eff6cf01c1fe62c06683d67b0936266f97af8f6
|
[
"MIT"
] | null | null | null |
app/index.html
|
GuilhermeSanches/Babel-ES6
|
0eff6cf01c1fe62c06683d67b0936266f97af8f6
|
[
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test Page</title>
</head>
<body>
<div>Hello ...</div>
<form action="">
<label for="" id="label"></label>
</form>
<div class="users"></div>
<script src="./lib/main.js"></script>
</body>
</html>
| 19.588235 | 45 | 0.477477 |
7b9be8167bbd38a414d0fb8d61aeac17ab05ee84
| 314 |
rb
|
Ruby
|
app/controllers/recommends_controller.rb
|
mitixx/abilitysheet
|
c44111aa64eeeb4fe2a34f007c332e4190d45362
|
[
"MIT"
] | 45 |
2015-04-09T06:42:11.000Z
|
2020-11-21T08:16:40.000Z
|
app/controllers/recommends_controller.rb
|
mitixx/abilitysheet
|
c44111aa64eeeb4fe2a34f007c332e4190d45362
|
[
"MIT"
] | 353 |
2015-01-13T13:05:18.000Z
|
2019-12-11T14:01:42.000Z
|
app/controllers/recommends_controller.rb
|
mitixx/abilitysheet
|
c44111aa64eeeb4fe2a34f007c332e4190d45362
|
[
"MIT"
] | 7 |
2015-05-02T08:57:35.000Z
|
2021-10-30T05:22:19.000Z
|
# frozen_string_literal: true
class RecommendsController < ApplicationController
before_action :load_color
before_action :load_sheets
def index
@title = '地力値表'
end
private
def load_sheets
@sheets = Sheet.active.preload(:ability)
end
def load_color
@color = Static::COLOR
end
end
| 14.952381 | 50 | 0.726115 |
7f6bdbf192ffe62fdf4c5367c9e4f0d00b48ae9d
| 129 |
html
|
HTML
|
bin/hadoop-3.3.0/share/doc/hadoop/hadoop-auth/apidocs/org/apache/hadoop/security/authentication/util/package-frame.html
|
ptrick/hdfs-hive-sql-playground
|
83f2aaa79f022a3c320939eace1fd2d06583187f
|
[
"Apache-2.0"
] | null | null | null |
bin/hadoop-3.3.0/share/doc/hadoop/hadoop-auth/apidocs/org/apache/hadoop/security/authentication/util/package-frame.html
|
ptrick/hdfs-hive-sql-playground
|
83f2aaa79f022a3c320939eace1fd2d06583187f
|
[
"Apache-2.0"
] | null | null | null |
bin/hadoop-3.3.0/share/doc/hadoop/hadoop-auth/apidocs/org/apache/hadoop/security/authentication/util/package-frame.html
|
ptrick/hdfs-hive-sql-playground
|
83f2aaa79f022a3c320939eace1fd2d06583187f
|
[
"Apache-2.0"
] | null | null | null |
version https://git-lfs.github.com/spec/v1
oid sha256:4833b9a07a4bfa1b60831fc6dcef979116ea92abb073408d1657e6f166c763a3
size 3136
| 32.25 | 75 | 0.883721 |
df982ce5f84604aff9095d795d72a835e5a97cf9
| 1,183 |
swift
|
Swift
|
LampUI/LampUI/View/CustomShape.swift
|
recherst/kavsoft-swiftui-animations
|
d60b9c19767c4e5635c9a0fd6cc0ddc09d91e360
|
[
"MIT"
] | 101 |
2021-08-20T09:51:39.000Z
|
2022-03-28T11:15:09.000Z
|
LampUI/LampUI/View/CustomShape.swift
|
stavroschios/kavsoft-swiftui-animations
|
d60b9c19767c4e5635c9a0fd6cc0ddc09d91e360
|
[
"MIT"
] | null | null | null |
LampUI/LampUI/View/CustomShape.swift
|
stavroschios/kavsoft-swiftui-animations
|
d60b9c19767c4e5635c9a0fd6cc0ddc09d91e360
|
[
"MIT"
] | 12 |
2021-08-20T03:45:34.000Z
|
2022-02-23T01:41:40.000Z
|
//
// CustomShape.swift
// LampUI
//
// Created by recherst on 2021/9/12.
//
import SwiftUI
struct CustomShape: Shape {
func path(in rect: CGRect) -> Path {
return Path { path in
path.move(to: CGPoint(x: 0, y: 0))
path.addLine(to: CGPoint(x: rect.width, y: 0))
path.addLine(to: CGPoint(x: rect.width, y: rect.height))
path.addLine(to: CGPoint(x: 0, y: rect.height))
// control points
let center = rect.width / 2
let bottom = UIApplication.shared.windows.first?.safeAreaInsets.bottom ?? 15
path.move(to: CGPoint(x: center - 150, y: 0))
let to1 = CGPoint(x: center, y: bottom + 70)
let control1 = CGPoint(x: center - 70, y: 0)
let control2 = CGPoint(x: center - 70, y: bottom + 70)
let to2 = CGPoint(x: center + 150, y: 0)
let control3 = CGPoint(x: center + 70, y: bottom + 70)
let control4 = CGPoint(x: center + 70, y: 0)
path.addCurve(to: to1, control1: control1, control2: control2)
path.addCurve(to: to2, control1: control3, control2: control4)
}
}
}
| 28.853659 | 88 | 0.553677 |
b2b9128938a7476610fbf31df937ff94978048ae
| 1,514 |
py
|
Python
|
tests/TestMetrics.py
|
gr33ndata/irlib
|
4a518fec994b1a89cdc7d09a8170efec3d7e6615
|
[
"MIT"
] | 80 |
2015-02-16T18:33:57.000Z
|
2021-05-06T02:03:22.000Z
|
tests/TestMetrics.py
|
gr33ndata/irlib
|
4a518fec994b1a89cdc7d09a8170efec3d7e6615
|
[
"MIT"
] | 2 |
2016-02-05T06:30:21.000Z
|
2017-09-24T17:42:58.000Z
|
tests/TestMetrics.py
|
gr33ndata/irlib
|
4a518fec994b1a89cdc7d09a8170efec3d7e6615
|
[
"MIT"
] | 25 |
2015-05-13T17:35:41.000Z
|
2020-06-04T01:52:11.000Z
|
from unittest import TestCase
from irlib.metrics import Metrics
class TestMetrics(TestCase):
def setUp(self):
self.m = Metrics()
def test_jaccard_same_len(self):
with self.assertRaises(ValueError):
self.m.jaccard_vectors(
[0, 1],
[0, 1, 2, 3]
)
def test_jaccard_empty(self):
e = self.m.jaccard_vectors([],[])
self.assertEqual(e,1)
def test_jaccard_int(self):
e = self.m.jaccard_vectors(
[0, 2, 1, 3],
[0, 1, 2, 3]
)
self.assertEqual(e,0.75)
def test_jaccard_bool(self):
e = self.m.jaccard_vectors(
[False, False, True, True, True ],
[False, True , True, True, False]
)
self.assertEqual(e,0.4)
def test_euclid_same_len(self):
with self.assertRaises(ValueError):
self.m.euclid_vectors(
[0, 1, 2, 3],
[0, 1]
)
def test_euclid(self):
e = self.m.euclid_vectors([1,1],[4,5])
self.assertEqual(e,5)
def test_cos_same_len(self):
with self.assertRaises(ValueError):
self.m.cos_vectors(
[0, 1, 2],
[1, 1]
)
def test_cos_0(self):
c = self.m.cos_vectors([1,0,1],[0,1,0])
self.assertEqual(round(c,5),float(0))
def test_cos_1(self):
c = self.m.cos_vectors([1,1,1],[1,1,1])
self.assertEqual(round(c,5),float(1))
| 24.819672 | 47 | 0.515192 |
6b3c71bc33432483f4880c250fbdc66a3ef7ea8d
| 635 |
kt
|
Kotlin
|
myDropDownBox/src/main/java/test/myDropDownBox/recycler_adapter.kt
|
xkdwby/DropdownBox
|
54113087d9fe6b4152a861a6c03d6d923906e9a6
|
[
"Apache-2.0"
] | 1 |
2017-08-25T11:19:10.000Z
|
2017-08-25T11:19:10.000Z
|
myDropDownBox/src/main/java/test/myDropDownBox/recycler_adapter.kt
|
xkdwby/DropdownBox
|
54113087d9fe6b4152a861a6c03d6d923906e9a6
|
[
"Apache-2.0"
] | null | null | null |
myDropDownBox/src/main/java/test/myDropDownBox/recycler_adapter.kt
|
xkdwby/DropdownBox
|
54113087d9fe6b4152a861a6c03d6d923906e9a6
|
[
"Apache-2.0"
] | null | null | null |
package test.myDropDownBox
import android.content.Context
import android.view.ViewGroup
import com.jude.easyrecyclerview.adapter.BaseViewHolder
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter
/**
* Created by wby on 2017/8/21.
*/
internal class recycler_adapter(internal var type: Int, con: Context?,height:Int) : RecyclerArrayAdapter<Any>(con) {
var he=height
override fun OnCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseViewHolder<*>? {
var base: BaseViewHolder<*>? = null
when (type) {
1 -> base = mydown_holder(parent,he)//item
}
return base
}
}
| 30.238095 | 116 | 0.707087 |
c321ec094c30bad57a94193ea93c8bb3ec9b4011
| 326 |
go
|
Go
|
_content/talks/2014/hammers/importpath.go
|
dengqz/website
|
24816dea196a889c0dc9dc2fdad71d04c116082f
|
[
"BSD-3-Clause"
] | 263 |
2019-01-02T22:03:26.000Z
|
2022-03-31T12:58:57.000Z
|
_content/talks/2014/hammers/importpath.go
|
dengqz/website
|
24816dea196a889c0dc9dc2fdad71d04c116082f
|
[
"BSD-3-Clause"
] | 144 |
2019-02-26T17:32:37.000Z
|
2022-03-31T21:48:22.000Z
|
_content/talks/2014/hammers/importpath.go
|
dengqz/website
|
24816dea196a889c0dc9dc2fdad71d04c116082f
|
[
"BSD-3-Clause"
] | 232 |
2019-01-05T11:48:19.000Z
|
2022-03-29T01:39:45.000Z
|
// +build ignore
package main
import (
"fmt"
"golang.org/x/tools/imports"
)
func main() {
iface := "http.Handler"
src := "package hack; var i " + iface // HL
fmt.Println(src, "\n---")
imp, _ := imports.Process("", []byte(src), nil) // HL
// ignoring errors throughout this presentation
fmt.Println(string(imp))
}
| 16.3 | 54 | 0.628834 |
0cde5c372756830b141e6816281e99f572d9eff3
| 3,463 |
py
|
Python
|
tests/required_with_test.py
|
roypeters/spotlight
|
f23818cf7b49aa7a31200c1945ebc2d91656156e
|
[
"MIT"
] | 9 |
2019-03-26T13:21:16.000Z
|
2021-03-21T08:55:49.000Z
|
tests/required_with_test.py
|
roypeters/spotlight
|
f23818cf7b49aa7a31200c1945ebc2d91656156e
|
[
"MIT"
] | 7 |
2019-03-28T17:32:03.000Z
|
2021-09-24T13:17:32.000Z
|
tests/required_with_test.py
|
roypeters/spotlight
|
f23818cf7b49aa7a31200c1945ebc2d91656156e
|
[
"MIT"
] | 4 |
2019-03-30T13:28:22.000Z
|
2020-06-15T13:15:44.000Z
|
from src.spotlight.errors import REQUIRED_WITH_ERROR
from .validator_test import ValidatorTest
class RequiredWithTest(ValidatorTest):
def setUp(self):
self.other_field = "test1"
self.field = "test2"
self.required_with_error = REQUIRED_WITH_ERROR.format(
field=self.field, other=self.other_field
)
self.rules = {"test2": "required_with:test1"}
def test_required_with_rule_with_missing_field_expect_error(self):
data = {"test1": "hello"}
expected = self.required_with_error
errors = self.validator.validate(data, self.rules)
errs = errors.get(self.field)
self.assertEqual(errs[0], expected)
def test_required_with_rule_with_field_present_expect_no_error(self):
data = {"test1": "hello", "test2": "world"}
expected = None
errors = self.validator.validate(data, self.rules)
errs = errors.get(self.field)
self.assertEqual(errs, expected)
def test_required_with_rule_with_boolean_true_expect_no_error(self):
data = {"test1": True, "test2": "world"}
expected = None
errors = self.validator.validate(data, self.rules)
errs = errors.get(self.field)
self.assertEqual(errs, expected)
def test_required_with_rule_with_boolean_false_expect_no_error(self):
data = {"test1": False, "test2": "world"}
expected = None
errors = self.validator.validate(data, self.rules)
errs = errors.get(self.field)
self.assertEqual(errs, expected)
def test_required_with_rule_with_multi_requirement_and_missing_field_expect_error(
self
):
field = "test5"
rules = {"test5": "required_with:test1,test2,test3,test4"}
data = {"test2": "not.missing", "test4": "not.missing"}
expected = REQUIRED_WITH_ERROR.format(
field=field, other="test1, test2, test3, test4"
)
errors = self.validator.validate(data, rules)
errs = errors.get(field)
self.assertEqual(errs[0], expected)
def test_required_with_rule_with_all_present_expect_no_error(self):
rules = {"test5": "required_with:test1,test2,test3,test4"}
data = {
"test1": "test",
"test2": "test",
"test3": "test",
"test4": "test",
"test5": "test",
}
expected = None
errors = self.validator.validate(data, rules)
errs = errors.get("test5")
self.assertEqual(errs, expected)
def test_required_with_rule_with_other_field_present_but_none_expect_error(self):
field = "test2"
rules = {
"test1": "required_with:test2|string",
"test2": "required_with:test1|string",
}
data = {"test1": "test", "test2": None}
expected = REQUIRED_WITH_ERROR.format(field=field, other="test1")
errors = self.validator.validate(data, rules)
errs = errors.get(field)
self.assertEqual(errs[0], expected)
def test_required_with_rule_with_both_none_expect_no_error(self):
field = "test2"
rules = {
"test1": "required_with:test2|string",
"test2": "required_with:test1|string",
}
data = {"test1": None, "test2": None}
expected = None
errors = self.validator.validate(data, rules)
errs = errors.get(field)
self.assertEqual(errs, expected)
| 32.064815 | 86 | 0.626047 |
5b4e0c1e012b667fdd45c88cf276a5cf21297332
| 4,741 |
h
|
C
|
core/include/tee/tee_svc_cryp.h
|
CoasiaNexell/secure_optee_optee-os
|
1243cb51ca265731086106cb7b0d89b3d5a446c9
|
[
"BSD-2-Clause"
] | null | null | null |
core/include/tee/tee_svc_cryp.h
|
CoasiaNexell/secure_optee_optee-os
|
1243cb51ca265731086106cb7b0d89b3d5a446c9
|
[
"BSD-2-Clause"
] | null | null | null |
core/include/tee/tee_svc_cryp.h
|
CoasiaNexell/secure_optee_optee-os
|
1243cb51ca265731086106cb7b0d89b3d5a446c9
|
[
"BSD-2-Clause"
] | null | null | null |
/*
* Copyright (c) 2014, STMicroelectronics International N.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TEE_SVC_CRYP_H
#define TEE_SVC_CRYP_H
#include <tee_api_types.h>
#include <utee_types.h>
struct user_ta_ctx;
TEE_Result syscall_cryp_obj_get_info(unsigned long obj, TEE_ObjectInfo *info);
TEE_Result syscall_cryp_obj_restrict_usage(unsigned long obj,
unsigned long usage);
TEE_Result syscall_cryp_obj_get_attr(unsigned long obj, unsigned long attr_id,
void *buffer, uint64_t *size);
TEE_Result syscall_cryp_obj_alloc(unsigned long obj_type,
unsigned long max_key_size, uint32_t *obj);
TEE_Result syscall_cryp_obj_close(unsigned long obj);
TEE_Result syscall_cryp_obj_reset(unsigned long obj);
TEE_Result syscall_cryp_obj_populate(unsigned long obj,
struct utee_attribute *attrs, unsigned long attr_count);
TEE_Result syscall_cryp_obj_copy(unsigned long dst_obj,
unsigned long src_obj);
TEE_Result syscall_obj_generate_key(unsigned long obj, unsigned long key_size,
const struct utee_attribute *params,
unsigned long param_count);
TEE_Result syscall_cryp_state_alloc(unsigned long algo, unsigned long op_mode,
unsigned long key1, unsigned long key2,
uint32_t *state);
TEE_Result syscall_cryp_state_copy(unsigned long dst, unsigned long src);
TEE_Result syscall_cryp_state_free(unsigned long state);
void tee_svc_cryp_free_states(struct user_ta_ctx *utc);
/* iv and iv_len are ignored for hash algorithms */
TEE_Result syscall_hash_init(unsigned long state, const void *iv,
size_t iv_len);
TEE_Result syscall_hash_update(unsigned long state, const void *chunk,
size_t chunk_size);
TEE_Result syscall_hash_final(unsigned long state, const void *chunk,
size_t chunk_size, void *hash, uint64_t *hash_len);
TEE_Result syscall_cipher_init(unsigned long state, const void *iv,
size_t iv_len);
TEE_Result syscall_cipher_update(unsigned long state, const void *src,
size_t src_len, void *dest, uint64_t *dest_len);
TEE_Result syscall_cipher_final(unsigned long state, const void *src,
size_t src_len, void *dest, uint64_t *dest_len);
TEE_Result syscall_cryp_derive_key(unsigned long state,
const struct utee_attribute *params,
unsigned long param_count, unsigned long derived_key);
TEE_Result syscall_cryp_random_number_generate(void *buf, size_t blen);
TEE_Result syscall_authenc_init(unsigned long state, const void *nonce,
size_t nonce_len, size_t tag_len,
size_t aad_len, size_t payload_len);
TEE_Result syscall_authenc_update_aad(unsigned long state,
const void *aad_data, size_t aad_data_len);
TEE_Result syscall_authenc_update_payload(unsigned long state,
const void *src_data, size_t src_len, void *dest_data,
uint64_t *dest_len);
TEE_Result syscall_authenc_enc_final(unsigned long state,
const void *src_data, size_t src_len, void *dest_data,
uint64_t *dest_len, void *tag, uint64_t *tag_len);
TEE_Result syscall_authenc_dec_final(unsigned long state,
const void *src_data, size_t src_len, void *dest_data,
uint64_t *dest_len, const void *tag, size_t tag_len);
TEE_Result syscall_asymm_operate(unsigned long state,
const struct utee_attribute *usr_params,
size_t num_params, const void *src_data,
size_t src_len, void *dest_data, uint64_t *dest_len);
TEE_Result syscall_asymm_verify(unsigned long state,
const struct utee_attribute *usr_params,
size_t num_params, const void *data, size_t data_len,
const void *sig, size_t sig_len);
#endif /* TEE_SVC_CRYP_H */
| 44.726415 | 78 | 0.801308 |
84b9f51c06237e8b0178c1d845a2b7d9038cded7
| 414 |
h
|
C
|
MachiavelliGame/MachiavelliServer/SocketManager.h
|
RMARomero/Machiavelli
|
9be6d5239a0a6a44e37d90d3b5143482427392bb
|
[
"MIT"
] | null | null | null |
MachiavelliGame/MachiavelliServer/SocketManager.h
|
RMARomero/Machiavelli
|
9be6d5239a0a6a44e37d90d3b5143482427392bb
|
[
"MIT"
] | null | null | null |
MachiavelliGame/MachiavelliServer/SocketManager.h
|
RMARomero/Machiavelli
|
9be6d5239a0a6a44e37d90d3b5143482427392bb
|
[
"MIT"
] | null | null | null |
#pragma once
#include "Socket.h"
#include "Sync_queue.h"
#include "ClientCommand.h"
using std::unique_ptr;
class SocketManager
{
private:
int m_Port;
void getServerInformation();
SocketManager(){}
SocketManager(const SocketManager&);
SocketManager& operator=(const SocketManager&);
public:
Sync_queue<ClientCommand> queue;
void start();
static SocketManager& getInstance();
virtual ~SocketManager(){}
};
| 19.714286 | 48 | 0.76087 |
6bfd18cec0507db4e34ec9a6e1c75d6a0182ed7d
| 28,526 |
rs
|
Rust
|
src/backend/metal/src/command.rs
|
scoopr/gfx
|
c71fe15c1f93a3c0171414aa58ddb1f14b2eb376
|
[
"Apache-2.0"
] | 1 |
2017-11-30T12:52:03.000Z
|
2017-11-30T12:52:03.000Z
|
src/backend/metal/src/command.rs
|
scoopr/gfx
|
c71fe15c1f93a3c0171414aa58ddb1f14b2eb376
|
[
"Apache-2.0"
] | null | null | null |
src/backend/metal/src/command.rs
|
scoopr/gfx
|
c71fe15c1f93a3c0171414aa58ddb1f14b2eb376
|
[
"Apache-2.0"
] | null | null | null |
use {Backend};
use native;
use std::ops::{Deref, Range};
use std::sync::{Arc};
use std::cell::UnsafeCell;
use hal::{memory, pool, pso};
use hal::{VertexCount, VertexOffset, InstanceCount, IndexCount};
use hal::buffer::{IndexBufferView};
use hal::image::{ImageLayout, SubresourceRange};
use hal::command::{
AttachmentClear, ClearColor, ClearDepthStencil, ClearValue,
BufferImageCopy, BufferCopy, ImageCopy, ImageResolve,
SubpassContents, RawCommandBuffer,
ColorValue, StencilValue, Rect, Viewport,
};
use hal::queue::{RawCommandQueue, RawSubmission};
use metal::{self, MTLViewport, MTLScissorRect, MTLPrimitiveType, MTLClearColor, MTLSize, MTLOrigin};
use cocoa::foundation::NSUInteger;
use block::{ConcreteBlock};
pub struct CommandQueue(pub(crate) Arc<QueueInner>);
pub(crate) struct QueueInner {
queue: metal::CommandQueue,
}
unsafe impl Send for QueueInner {}
unsafe impl Sync for QueueInner {}
pub struct CommandPool {
pub(crate) queue: Arc<QueueInner>,
pub(crate) managed: Option<Vec<CommandBuffer>>,
}
unsafe impl Send for CommandPool {
}
unsafe impl Sync for CommandPool {
}
#[derive(Clone)]
pub struct CommandBuffer {
inner: Arc<UnsafeCell<CommandBufferInner>>,
queue: Option<Arc<QueueInner>>,
}
#[derive(Debug)]
struct StageResources {
buffers: Vec<Option<(metal::Buffer, pso::BufferOffset)>>,
textures: Vec<Option<metal::Texture>>,
samplers: Vec<Option<metal::SamplerState>>,
}
impl StageResources {
fn new() -> Self {
StageResources {
buffers: Vec::new(),
textures: Vec::new(),
samplers: Vec::new(),
}
}
fn clear(&mut self) {
self.buffers.clear();
self.textures.clear();
self.samplers.clear();
}
fn add_buffer(&mut self, slot: usize, buffer: &metal::BufferRef, offset: usize) {
while self.buffers.len() <= slot {
self.buffers.push(None)
}
self.buffers[slot] = Some((buffer.to_owned(), offset));
}
fn add_textures(&mut self, start: usize, textures: &[Option<(metal::Texture, ImageLayout)>]) {
while self.textures.len() < start + textures.len() {
self.textures.push(None)
}
for (out, entry) in self.textures[start..].iter_mut().zip(textures.iter()) {
*out = entry.as_ref().map(|&(ref texture, _)| texture.clone());
}
}
fn add_samplers(&mut self, start: usize, samplers: &[Option<metal::SamplerState>]) {
while self.samplers.len() < start + samplers.len() {
self.samplers.push(None)
}
for (out, sampler) in self.samplers[start..].iter_mut().zip(samplers.iter()) {
*out = sampler.clone();
}
}
}
struct CommandBufferInner {
command_buffer: metal::CommandBuffer,
//TODO: would be cleaner to move the cache into `CommandBuffer` iself
// it doesn't have to be in `Inner`
encoder_state: EncoderState,
viewport: Option<MTLViewport>,
scissors: Option<MTLScissorRect>,
pipeline_state: Option<metal::RenderPipelineState>,
primitive_type: MTLPrimitiveType,
resources_vs: StageResources,
resources_fs: StageResources,
}
impl CommandBufferInner {
fn reset(&mut self, queue: &QueueInner) {
self.command_buffer = queue.queue.new_command_buffer().to_owned();
self.resources_vs.clear();
self.resources_fs.clear();
}
fn begin_renderpass(&mut self, encoder: metal::RenderCommandEncoder) {
self.encoder_state = EncoderState::Render(encoder);
let encoder = if let EncoderState::Render(ref encoder) = self.encoder_state {
encoder
} else {
unreachable!()
};
// Apply previously bound values for this command buffer
if let Some(viewport) = self.viewport {
encoder.set_viewport(viewport);
}
if let Some(scissors) = self.scissors {
encoder.set_scissor_rect(scissors);
}
if let Some(ref pipeline_state) = self.pipeline_state {
encoder.set_render_pipeline_state(pipeline_state);
}
// inherit vertex resources
for (i, resource) in self.resources_vs.buffers.iter().enumerate() {
if let Some((ref buffer, offset)) = *resource {
encoder.set_vertex_buffer(i as _, offset as _, Some(buffer));
}
}
for (i, resource) in self.resources_vs.textures.iter().enumerate() {
if let Some(ref texture) = *resource {
encoder.set_vertex_texture(i as _, Some(texture));
}
}
for (i, resource) in self.resources_vs.samplers.iter().enumerate() {
if let Some(ref sampler) = *resource {
encoder.set_vertex_sampler_state(i as _, Some(sampler));
}
}
// inherit fragment resources
for (i, resource) in self.resources_fs.buffers.iter().enumerate() {
if let Some((ref buffer, offset)) = *resource {
encoder.set_fragment_buffer(i as _, offset as _, Some(buffer));
}
}
for (i, resource) in self.resources_fs.textures.iter().enumerate() {
if let Some(ref texture) = *resource {
encoder.set_fragment_texture(i as _, Some(texture));
}
}
for (i, resource) in self.resources_fs.samplers.iter().enumerate() {
if let Some(ref sampler) = *resource {
encoder.set_fragment_sampler_state(i as _, Some(sampler));
}
}
}
}
unsafe impl Send for CommandBuffer {
}
enum EncoderState {
None,
Blit(metal::BlitCommandEncoder),
Render(metal::RenderCommandEncoder),
}
impl CommandQueue {
pub fn new(device: &metal::DeviceRef) -> CommandQueue {
CommandQueue(Arc::new(QueueInner {
queue: device.new_command_queue(),
}))
}
pub unsafe fn device(&self) -> &metal::DeviceRef {
msg_send![&*self.0.queue, device]
}
}
impl RawCommandQueue<Backend> for CommandQueue {
unsafe fn submit_raw(&mut self, submit: RawSubmission<Backend>, fence: Option<&native::Fence>) {
// FIXME: wait for semaphores!
// FIXME: multiple buffers signaling!
let signal_block = if !submit.signal_semaphores.is_empty() {
let semaphores_copy: Vec<_> = submit.signal_semaphores.iter().map(|semaphore| {
semaphore.0
}).collect();
Some(ConcreteBlock::new(move |_cb: *mut ()| -> () {
for semaphore in semaphores_copy.iter() {
native::dispatch_semaphore_signal(*semaphore);
}
}).copy())
} else {
None
};
for buffer in submit.cmd_buffers {
let command_buffer: &metal::CommandBufferRef = &(&mut *buffer.inner.get()).command_buffer;
if let Some(ref signal_block) = signal_block {
msg_send![command_buffer, addCompletedHandler: signal_block.deref() as *const _];
}
// only append the fence handler to the last command buffer
if buffer as *const _ == submit.cmd_buffers.last().unwrap() as *const _ {
if let Some(ref fence) = fence {
let value_ptr = fence.0.clone();
let fence_block = ConcreteBlock::new(move |_cb: *mut ()| -> () {
*value_ptr.lock().unwrap() = true;
}).copy();
msg_send![command_buffer, addCompletedHandler: fence_block.deref() as *const _];
}
}
command_buffer.commit();
}
}
}
impl pool::RawCommandPool<Backend> for CommandPool {
fn reset(&mut self) {
if let Some(ref mut managed) = self.managed {
for cmd_buffer in managed {
cmd_buffer.inner().reset(&self.queue);
}
}
}
fn allocate(&mut self, num: usize) -> Vec<CommandBuffer> {
let buffers: Vec<_> = (0..num).map(|_| CommandBuffer {
inner: Arc::new({
// TODO: maybe use unretained command buffer for efficiency?
let command_buffer = self.queue.queue.new_command_buffer().to_owned();
UnsafeCell::new(CommandBufferInner {
command_buffer,
encoder_state: EncoderState::None,
viewport: None,
scissors: None,
pipeline_state: None,
primitive_type: MTLPrimitiveType::Point,
resources_vs: StageResources::new(),
resources_fs: StageResources::new(),
})
}),
queue: if self.managed.is_some() {
None
} else {
Some(self.queue.clone())
},
}).collect();
if let Some(ref mut managed) = self.managed {
managed.extend_from_slice(&buffers);
}
buffers
}
/// Free command buffers which are allocated from this pool.
unsafe fn free(&mut self, buffers: Vec<CommandBuffer>) {
for mut cmd_buf in buffers {
//TODO: what else here?
let target = &*cmd_buf.inner().command_buffer;
let managed = match self.managed {
Some(ref mut vec) => vec,
None => continue,
};
match managed.iter_mut().position(|b| &*b.inner().command_buffer as *const metal::CommandBufferRef == target as *const metal::CommandBufferRef) {
Some(index) => {
managed.swap_remove(index);
}
None => {
error!("Unable to free a command buffer!")
}
}
}
}
}
impl pool::SubpassCommandPool<Backend> for CommandPool {
}
impl CommandBuffer {
#[inline]
fn inner(&mut self) -> &mut CommandBufferInner {
unsafe {
&mut *self.inner.get()
}
}
fn encode_blit(&mut self) -> &metal::BlitCommandEncoderRef {
let inner = self.inner();
match inner.encoder_state {
EncoderState::None => {},
EncoderState::Blit(ref blit_encoder) => return blit_encoder,
EncoderState::Render(_) => panic!("invalid inside renderpass"),
}
let blit_encoder = inner.command_buffer.new_blit_command_encoder().to_owned();
inner.encoder_state = EncoderState::Blit(blit_encoder);
if let EncoderState::Blit(ref blit_encoder) = inner.encoder_state {
blit_encoder
} else {
unreachable!()
}
}
fn except_renderpass(&mut self) -> &metal::RenderCommandEncoderRef {
if let EncoderState::Render(ref encoder) = self.inner().encoder_state {
encoder
} else {
panic!("only valid inside renderpass")
}
}
}
impl RawCommandBuffer<Backend> for CommandBuffer {
fn begin(&mut self) {
if let Some(ref queue) = self.queue {
unsafe { &mut *self.inner.get() }
.reset(queue);
}
}
fn finish(&mut self) {
match self.inner().encoder_state {
EncoderState::None => {},
EncoderState::Blit(ref blit_encoder) => {
blit_encoder.end_encoding();
},
EncoderState::Render(ref render_encoder) => {
render_encoder.end_encoding();
},
}
self.inner().encoder_state = EncoderState::None;
}
fn reset(&mut self, _release_resources: bool) {
unsafe { &mut *self.inner.get() }
.reset(self.queue.as_ref().unwrap());
}
fn pipeline_barrier(
&mut self,
_stages: Range<pso::PipelineStage>,
_barriers: &[memory::Barrier<Backend>],
) {
// TODO: MTLRenderCommandEncoder.textureBarrier on macOS?
}
fn fill_buffer(
&mut self,
_buffer: &native::Buffer,
_range: Range<u64>,
_data: u32,
) {
unimplemented!()
}
fn update_buffer(
&mut self,
_buffer: &native::Buffer,
_offset: u64,
_data: &[u8],
) {
unimplemented!()
}
fn clear_color_image(
&mut self,
_image: &native::Image,
_layout: ImageLayout,
_range: SubresourceRange,
_value: ClearColor,
) {
unimplemented!()
}
fn clear_depth_stencil_image(
&mut self,
_image: &native::Image,
_layout: ImageLayout,
_range: SubresourceRange,
_value: ClearDepthStencil,
) {
unimplemented!()
}
fn clear_attachments(
&mut self,
_clears: &[AttachmentClear],
_rects: &[Rect],
) {
unimplemented!()
}
fn resolve_image(
&mut self,
_src: &native::Image,
_src_layout: ImageLayout,
_dst: &native::Image,
_dst_layout: ImageLayout,
_regions: &[ImageResolve],
) {
unimplemented!()
}
fn bind_index_buffer(&mut self, _view: IndexBufferView<Backend>) {
unimplemented!()
}
fn bind_vertex_buffers(&mut self, buffer_set: pso::VertexBufferSet<Backend>) {
let inner = self.inner();
let buffers = &mut inner.resources_vs.buffers;
while buffers.len() < buffer_set.0.len() {
buffers.push(None)
}
for (ref mut out, &(ref buffer, offset)) in buffers.iter_mut().zip(buffer_set.0.iter()) {
**out = Some((buffer.0.clone(), offset));
}
if let EncoderState::Render(ref encoder) = inner.encoder_state {
for (i, &(buffer, offset)) in buffer_set.0.iter().enumerate() {
encoder.set_vertex_buffer(i as _, offset as _, Some(&buffer.0));
}
}
}
fn set_viewports(&mut self, vps: &[Viewport]) {
let inner = self.inner();
if vps.len() != 1 {
panic!("Metal supports only one viewport");
}
let vp = &vps[0];
let viewport = MTLViewport {
originX: vp.rect.x as f64,
originY: vp.rect.y as f64,
width: vp.rect.w as f64,
height: vp.rect.h as f64,
znear: vp.depth.start as f64,
zfar: vp.depth.end as f64,
};
inner.viewport = Some(viewport);
if let EncoderState::Render(ref encoder) = inner.encoder_state {
encoder.set_viewport(viewport);
}
}
fn set_scissors(&mut self, rects: &[Rect]) {
let inner = self.inner();
if rects.len() != 1 {
panic!("Metal supports only one scissor");
}
let rect = &rects[0];
let scissor = MTLScissorRect {
x: rect.x as _,
y: rect.y as _,
width: rect.w as _,
height: rect.h as _,
};
inner.scissors = Some(scissor);
if let EncoderState::Render(ref encoder) = inner.encoder_state {
encoder.set_scissor_rect(scissor);
}
}
fn set_stencil_reference(&mut self, _front: StencilValue, _back: StencilValue) {
unimplemented!()
}
fn set_blend_constants(&mut self, _color: ColorValue) {
unimplemented!()
}
fn begin_renderpass(
&mut self,
_render_pass: &native::RenderPass,
frame_buffer: &native::FrameBuffer,
_render_area: Rect,
clear_values: &[ClearValue],
_first_subpass: SubpassContents,
) {
unsafe {
let command_buffer = self.inner();
match command_buffer.encoder_state {
EncoderState::Render(_) => panic!("already in a renderpass"),
EncoderState::Blit(ref blit) => {
blit.end_encoding();
},
EncoderState::None => {},
}
command_buffer.encoder_state = EncoderState::None;
// FIXME: subpasses
let pass_descriptor: metal::RenderPassDescriptor = msg_send![frame_buffer.0, copy];
// TODO: validate number of clear colors
for (i, value) in clear_values.iter().enumerate() {
let color_desc = pass_descriptor.color_attachments().object_at(i).expect("too many clear values");
let mtl_color = match *value {
ClearValue::Color(ClearColor::Float(values)) => MTLClearColor::new(
values[0] as f64,
values[1] as f64,
values[2] as f64,
values[3] as f64,
),
_ => unimplemented!(),
};
color_desc.set_clear_color(mtl_color);
}
let render_encoder = command_buffer.command_buffer.new_render_command_encoder(&pass_descriptor).to_owned();
command_buffer.begin_renderpass(render_encoder);
}
}
fn next_subpass(&mut self, _contents: SubpassContents) {
unimplemented!()
}
fn end_renderpass(&mut self) {
match self.inner().encoder_state {
EncoderState::Render(ref encoder) => {
encoder.end_encoding();
},
_ => panic!("not in a renderpass"),
}
self.inner().encoder_state = EncoderState::None;
}
fn bind_graphics_pipeline(&mut self, pipeline: &native::GraphicsPipeline) {
let inner = self.inner();
let pipeline_state = pipeline.raw.to_owned();
if let EncoderState::Render(ref encoder) = inner.encoder_state {
encoder.set_render_pipeline_state(&pipeline_state);
}
inner.pipeline_state = Some(pipeline_state);
inner.primitive_type = pipeline.primitive_type;
}
fn bind_graphics_descriptor_sets(
&mut self,
layout: &native::PipelineLayout,
first_set: usize,
sets: &[&native::DescriptorSet],
) {
use spirv_cross::{msl, spirv};
let inner = self.inner();
for (set_index, &desc_set) in sets.iter().enumerate() {
let location_vs = msl::ResourceBindingLocation {
stage: spirv::ExecutionModel::Vertex,
desc_set: (first_set + set_index) as _,
binding: 0,
};
let location_fs = msl::ResourceBindingLocation {
stage: spirv::ExecutionModel::Fragment,
desc_set: (first_set + set_index) as _,
binding: 0,
};
match *desc_set {
native::DescriptorSet::Emulated(ref desc_inner) => {
use native::DescriptorSetBinding::*;
let set = desc_inner.lock().unwrap();
for (&binding, values) in set.bindings.iter() {
let desc_layout = set.layout.iter().find(|x| x.binding == binding).unwrap();
if desc_layout.stage_flags.contains(pso::ShaderStageFlags::VERTEX) {
let location = msl::ResourceBindingLocation {
binding: binding as _,
.. location_vs
};
let start = layout.res_overrides[&location].resource_id as usize;
match *values {
Sampler(ref samplers) => {
inner.resources_vs.add_samplers(start, samplers.as_slice());
if let EncoderState::Render(ref encoder) = inner.encoder_state {
for (i, ref sampler) in samplers.iter().enumerate() {
encoder.set_vertex_sampler_state((start + i) as _, sampler.as_ref().map(|x| &**x));
}
}
}
SampledImage(ref images) => {
inner.resources_vs.add_textures(start, images.as_slice());
if let EncoderState::Render(ref encoder) = inner.encoder_state {
for (i, ref texture) in images.iter().enumerate() {
encoder.set_vertex_texture((start + i) as _, texture.as_ref().map(|&(ref texture, _)| &**texture));
}
}
}
}
}
if desc_layout.stage_flags.contains(pso::ShaderStageFlags::FRAGMENT) {
let location = msl::ResourceBindingLocation {
binding: binding as _,
.. location_fs
};
let start = layout.res_overrides[&location].resource_id as usize;
match *values {
Sampler(ref samplers) => {
inner.resources_fs.add_samplers(start, samplers.as_slice());
if let EncoderState::Render(ref encoder) = inner.encoder_state {
for (i, sampler) in samplers.iter().enumerate() {
encoder.set_fragment_sampler_state((start + i) as _, sampler.as_ref().map(|x| &**x));
}
}
}
SampledImage(ref images) => {
inner.resources_fs.add_textures(start, images.as_slice());
if let EncoderState::Render(ref encoder) = inner.encoder_state {
for (i, texture) in images.iter().enumerate() {
encoder.set_fragment_texture((start + i) as _, texture.as_ref().map(|&(ref texture, _)| &**texture));
}
}
}
}
}
}
}
native::DescriptorSet::ArgumentBuffer { ref buffer, offset, stage_flags, .. } => {
if stage_flags.contains(pso::ShaderStageFlags::VERTEX) {
let slot = layout.res_overrides[&location_vs].resource_id;
inner.resources_vs.add_buffer(slot as _, buffer, offset as _);
if let EncoderState::Render(ref encoder) = inner.encoder_state {
encoder.set_vertex_buffer(slot as _, offset as _, Some(buffer))
}
}
if stage_flags.contains(pso::ShaderStageFlags::FRAGMENT) {
let slot = layout.res_overrides[&location_fs].resource_id;
inner.resources_fs.add_buffer(slot as _, &buffer, offset as _);
if let EncoderState::Render(ref encoder) = inner.encoder_state {
encoder.set_fragment_buffer(slot as _, offset as _, Some(buffer))
}
}
}
}
}
}
fn bind_compute_pipeline(&mut self, _pipeline: &native::ComputePipeline) {
unimplemented!()
}
fn bind_compute_descriptor_sets(
&mut self,
_layout: &native::PipelineLayout,
_first_set: usize,
_sets: &[&native::DescriptorSet],
) {
unimplemented!()
}
fn dispatch(&mut self, _x: u32, _y: u32, _z: u32) {
unimplemented!()
}
fn dispatch_indirect(&mut self, _buffer: &native::Buffer, _offset: u64) {
unimplemented!()
}
fn copy_buffer(
&mut self,
_src: &native::Buffer,
_dst: &native::Buffer,
_regions: &[BufferCopy],
) {
unimplemented!()
}
fn copy_image(
&mut self,
_src: &native::Image,
_src_layout: ImageLayout,
_dst: &native::Image,
_dst_layout: ImageLayout,
_regions: &[ImageCopy],
) {
unimplemented!()
}
fn copy_buffer_to_image(
&mut self,
src: &native::Buffer,
dst: &native::Image,
_dst_layout: ImageLayout,
regions: &[BufferImageCopy],
) {
let encoder = self.encode_blit();
let extent = MTLSize {
width: dst.0.width(),
height: dst.0.height(),
depth: dst.0.depth(),
};
// FIXME: layout
for region in regions {
let image_offset = ®ion.image_offset;
let r = ®ion.image_layers;
for layer in r.layers.clone() {
let offset = region.buffer_offset + region.buffer_slice_pitch as NSUInteger * (layer - r.layers.start) as NSUInteger;
unsafe {
msg_send![encoder,
copyFromBuffer: &*src.0
sourceOffset: offset as NSUInteger
sourceBytesPerRow: region.buffer_row_pitch as NSUInteger
sourceBytesPerImage: region.buffer_slice_pitch as NSUInteger
sourceSize: extent
toTexture: &*dst.0
destinationSlice: layer as NSUInteger
destinationLevel: r.level as NSUInteger
destinationOrigin: MTLOrigin { x: image_offset.x as _, y: image_offset.y as _, z: image_offset.z as _ }
]
}
}
}
}
fn copy_image_to_buffer(
&mut self,
src: &native::Image,
_src_layout: ImageLayout,
dst: &native::Buffer,
regions: &[BufferImageCopy],
) {
let encoder = self.encode_blit();
let extent = MTLSize {
width: src.0.width(),
height: src.0.height(),
depth: src.0.depth(),
};
// FIXME: layout
for region in regions {
let image_offset = ®ion.image_offset;
let r = ®ion.image_layers;
for layer in r.layers.clone() {
let offset = region.buffer_offset + region.buffer_slice_pitch as NSUInteger * (layer - r.layers.start) as NSUInteger;
unsafe {
msg_send![encoder,
copyFromTexture: &*src.0
sourceSlice: layer as NSUInteger
sourceLevel: r.level as NSUInteger
sourceOrigin: MTLOrigin { x: image_offset.x as _, y: image_offset.y as _, z: image_offset.z as _ }
sourceSize: extent
toBuffer: &*dst.0
destinationOffset: offset as NSUInteger
destinationBytesPerRow: region.buffer_row_pitch as NSUInteger
destinationBytesPerImage: region.buffer_slice_pitch as NSUInteger
]
}
}
}
}
fn draw(
&mut self,
vertices: Range<VertexCount>,
instances: Range<InstanceCount>,
) {
let primitive_type = self.inner().primitive_type;
let encoder = self.except_renderpass();
unsafe {
msg_send![encoder,
drawPrimitives: primitive_type
vertexStart: vertices.start as NSUInteger
vertexCount: (vertices.end - vertices.start) as NSUInteger
instanceCount: (instances.end - instances.start) as NSUInteger
baseInstance: instances.start as NSUInteger
];
}
}
fn draw_indexed(
&mut self,
_indices: Range<IndexCount>,
_base_vertex: VertexOffset,
_instances: Range<InstanceCount>,
) {
unimplemented!()
}
fn draw_indirect(
&mut self,
_buffer: &native::Buffer,
_offset: u64,
_draw_count: u32,
_stride: u32,
) {
unimplemented!()
}
fn draw_indexed_indirect(
&mut self,
_buffer: &native::Buffer,
_offset: u64,
_draw_count: u32,
_stride: u32,
) {
unimplemented!()
}
}
| 34.958333 | 157 | 0.529762 |
7a76c35dcf7ce79fe63ecb0001244a9e1ed8b62c
| 793 |
rs
|
Rust
|
third_party/rust_crates/vendor/test-case/tests/acceptance_tests.rs
|
casey/fuchsia
|
2b965e9a1e8f2ea346db540f3611a5be16bb4d6b
|
[
"BSD-3-Clause"
] | 14 |
2020-10-25T05:48:36.000Z
|
2021-09-20T02:46:20.000Z
|
third_party/rust_crates/vendor/test-case/tests/acceptance_tests.rs
|
DamieFC/fuchsia
|
f78a4a1326f4a4bb5834500918756173c01bab4f
|
[
"BSD-2-Clause"
] | 1 |
2022-01-14T23:38:40.000Z
|
2022-01-14T23:38:40.000Z
|
third_party/rust_crates/vendor/test-case/tests/acceptance_tests.rs
|
DamieFC/fuchsia
|
f78a4a1326f4a4bb5834500918756173c01bab4f
|
[
"BSD-2-Clause"
] | 4 |
2020-12-28T17:04:45.000Z
|
2022-03-12T03:20:44.000Z
|
#![cfg(test)]
#[macro_use]
extern crate lazy_static;
mod acceptance {
use std::process::{Command, Output};
fn run_tests() -> Output {
Command::new("cargo")
.args(&["test", "test_cases"])
.output()
.expect("cargo command failed to start")
}
lazy_static! {
static ref ACTUAL: String = {
let output = run_tests().stdout;
String::from_utf8_lossy(&output).to_string()
};
}
fn actual<'a>() -> &'a str {
ACTUAL.as_ref()
}
#[test]
fn runs_all_tests() {
let actual = actual();
let mut lines: Vec<_> = actual.lines().collect();
lines.sort();
let lines: String = lines.join("\n");
insta::assert_display_snapshot!(lines);
}
}
| 21.432432 | 57 | 0.523329 |
dd58e0171189d17189ac9f868fbf0e5b2bafc9ba
| 1,012 |
go
|
Go
|
struct.go
|
chenguofan1999/iniReader
|
51619206d581bc565ca2827719167217b174e70f
|
[
"MIT"
] | null | null | null |
struct.go
|
chenguofan1999/iniReader
|
51619206d581bc565ca2827719167217b174e70f
|
[
"MIT"
] | null | null | null |
struct.go
|
chenguofan1999/iniReader
|
51619206d581bc565ca2827719167217b174e70f
|
[
"MIT"
] | 2 |
2020-10-19T14:37:03.000Z
|
2020-10-26T15:44:06.000Z
|
package inireader
var commentSymbol byte
// Cfg : The struct of configuration
type Cfg struct {
Map map[string]*Sec
LastDescription string
UnusedDescription bool
Cur *Sec
}
// Sec : The struct of configuration Section
type Sec struct {
Name string
Descriptions map[string]string
Map map[string]string
}
// Section : Get section by section name
func (c Cfg) Section(name string) *Sec {
if sec, ok := c.Map[name]; ok {
return sec
}
//fmt.Println("Creating Sec: ", name)
c.Map[name] = &Sec{Name: name, Map: map[string]string{}, Descriptions: map[string]string{}}
return c.Map[name]
}
// Key : Get value by key
func (s Sec) Key(key string) string {
return s.Map[key]
}
// ErrReadingIniFile indicates the error type of reading ini file failed
type ErrReadingIniFile struct {
}
// Error implemented by ErrReadingIniFile
func (err ErrReadingIniFile) Error() string {
return "Error in reading init file"
}
| 23 | 93 | 0.660079 |
5016096f67877f45061db26ecb09e777de47c19e
| 4,489 |
go
|
Go
|
server/api/handler.go
|
dpb587/ssoca
|
a7d83d85b30b2d39de31e3859f075b2230cd6bae
|
[
"MIT"
] | 13 |
2017-02-27T06:02:55.000Z
|
2021-04-06T10:24:01.000Z
|
server/api/handler.go
|
dpb587/ssoca
|
a7d83d85b30b2d39de31e3859f075b2230cd6bae
|
[
"MIT"
] | 15 |
2017-03-07T18:17:48.000Z
|
2019-10-04T15:36:30.000Z
|
server/api/handler.go
|
dpb587/ssoca
|
a7d83d85b30b2d39de31e3859f075b2230cd6bae
|
[
"MIT"
] | 3 |
2017-08-03T05:08:29.000Z
|
2019-06-07T09:39:48.000Z
|
package api
import (
"net/http"
"github.com/dpb587/ssoca/auth"
"github.com/dpb587/ssoca/auth/authn"
"github.com/dpb587/ssoca/auth/authz"
apierr "github.com/dpb587/ssoca/server/api/errors"
"github.com/dpb587/ssoca/server/requtil"
"github.com/dpb587/ssoca/server/service"
"github.com/dpb587/ssoca/server/service/req"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
uuid "github.com/nu7hatch/gouuid"
)
type apiHandler struct {
authServices service.AuthServices
apiService service.Service
handler req.RouteHandler
clientIPGetter requtil.ClientIPGetter
logger logrus.FieldLogger
}
func CreateHandler(
authServices service.AuthServices,
apiService service.Service,
handler req.RouteHandler,
clientIPGetter requtil.ClientIPGetter,
logger logrus.FieldLogger,
) (http.Handler, error) {
return apiHandler{
authServices: authServices,
apiService: apiService,
handler: handler,
clientIPGetter: clientIPGetter,
logger: logger,
}, nil
}
func (h apiHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
request := req.Request{
RawRequest: r,
RawResponse: w,
}
requestUUID, err := uuid.NewV4()
if err != nil {
h.sendGenericErrorResponse(request, apierr.WrapError(err, "generating request ID"))
return
}
clientIP, err := h.clientIPGetter(r)
if err != nil {
h.sendGenericErrorResponse(request, apierr.WrapError(err, "determining Client IP"))
}
request.ID = requestUUID.String()
request.LoggerContext = logrus.Fields{
"server.request.id": request.ID,
"server.request.client_ip": clientIP.String(),
"server.request.remote_addr": r.RemoteAddr,
"server.request.x_forwarded_for": r.Header.Get("x-forwarded-for"),
"server.request.user_agent": r.Header.Get("user-agent"),
"service.name": h.apiService.Name(),
"service.type": h.apiService.Type(),
}
var token *auth.Token
for _, authService := range h.authServices {
tryAuth, err := authService.SupportsRequestAuth(*r)
if err != nil {
h.getRequestLogger(request).Warn(errors.Wrap(err, "failed to check request auth"))
} else if tryAuth {
var err error
request.LoggerContext["auth.service"] = authService.Name()
token, err = authService.ParseRequestAuth(*r)
if err != nil {
// never allow a token if there was an error
token = nil
// differentiate unauthorized (essentially unauthorized, aka expired) vs forbidden (apparent auth, but invalid)
if matchederr, matched := err.(apierr.Error); matched {
if matchederr.Status == http.StatusUnauthorized {
h.getRequestLogger(request).Debug(err)
err = nil
}
}
if err != nil {
h.sendGenericErrorResponse(request, apierr.WrapError(err, "parsing authentication"))
return
}
}
break
}
}
request.AuthToken = token
err = h.apiService.VerifyAuthorization(*r, request.AuthToken)
if err != nil {
statusCode := http.StatusInternalServerError
if _, ok := err.(authn.Error); ok {
statusCode = http.StatusUnauthorized
} else if _, ok := err.(authz.Error); ok {
statusCode = http.StatusForbidden
}
h.sendGenericErrorResponse(request, apierr.WrapError(apierr.NewError(err, statusCode, ""), "checking service authorization"))
return
}
if token != nil {
request.LoggerContext["auth.user_id"] = token.ID
}
err = h.handler.Execute(request)
if err != nil {
h.sendGenericErrorResponse(request, apierr.WrapError(err, "executing handler"))
}
h.getRequestLogger(request).Info("finished request")
}
func (h apiHandler) sendGenericErrorResponse(request req.Request, err error) {
h.sendErrorResponse(request, apierr.NewError(err, http.StatusInternalServerError, ""))
}
func (h apiHandler) sendErrorResponse(request req.Request, err apierr.Error) {
request.RawResponse.WriteHeader(err.Status)
var loggerFunc func(args ...interface{})
logger := h.getRequestLogger(request)
if err.Status >= 500 {
loggerFunc = logger.Error
} else {
loggerFunc = logger.Warn
}
loggerFunc(err.Error())
request.WritePayload(map[string]interface{}{
"error": map[string]interface{}{
"status": err.Status,
"message": err.PublicError,
},
})
}
func (h apiHandler) getRequestLogger(request req.Request) *logrus.Entry {
return h.logger.WithFields(request.LoggerContext).WithFields(logrus.Fields{
"server.request.method": request.RawRequest.Method,
"server.request.path": request.RawRequest.URL.Path,
})
}
| 26.56213 | 127 | 0.707062 |
7024732140d5618e7a550fb1a433b2d231dcf87a
| 10,867 |
go
|
Go
|
lars.go
|
go-experimental/lcars
|
4dc376e72ef7f96a295a328f06e83e2b9ab85422
|
[
"MIT"
] | 438 |
2016-01-30T01:10:06.000Z
|
2022-03-23T02:09:18.000Z
|
lars.go
|
go-experimental/lcars
|
4dc376e72ef7f96a295a328f06e83e2b9ab85422
|
[
"MIT"
] | 11 |
2016-04-03T15:19:31.000Z
|
2021-08-20T23:50:53.000Z
|
lars.go
|
go-experimental/lcars
|
4dc376e72ef7f96a295a328f06e83e2b9ab85422
|
[
"MIT"
] | 29 |
2016-03-30T07:02:33.000Z
|
2022-01-24T10:00:52.000Z
|
package lars
import (
"fmt"
"net/http"
"reflect"
"strings"
"sync"
"github.com/go-playground/form"
)
// HTTP Constant Terms and Variables
const (
// CONNECT HTTP method
CONNECT = http.MethodConnect
// DELETE HTTP method
DELETE = http.MethodDelete
// GET HTTP method
GET = http.MethodGet
// HEAD HTTP method
HEAD = http.MethodHead
// OPTIONS HTTP method
OPTIONS = http.MethodOptions
// PATCH HTTP method
PATCH = http.MethodPatch
// POST HTTP method
POST = http.MethodPost
// PUT HTTP method
PUT = http.MethodPut
// TRACE HTTP method
TRACE = http.MethodTrace
//-------------
// Media types
//-------------
ApplicationJSON = "application/json"
ApplicationJSONCharsetUTF8 = ApplicationJSON + "; " + CharsetUTF8
ApplicationJavaScript = "application/javascript"
ApplicationJavaScriptCharsetUTF8 = ApplicationJavaScript + "; " + CharsetUTF8
ApplicationXML = "application/xml"
ApplicationXMLCharsetUTF8 = ApplicationXML + "; " + CharsetUTF8
ApplicationForm = "application/x-www-form-urlencoded"
ApplicationProtobuf = "application/protobuf"
ApplicationMsgpack = "application/msgpack"
TextHTML = "text/html"
TextHTMLCharsetUTF8 = TextHTML + "; " + CharsetUTF8
TextPlain = "text/plain"
TextPlainCharsetUTF8 = TextPlain + "; " + CharsetUTF8
MultipartForm = "multipart/form-data"
OctetStream = "application/octet-stream"
//---------
// Charset
//---------
CharsetUTF8 = "charset=utf-8"
//---------
// Headers
//---------
AcceptedLanguage = "Accept-Language"
AcceptEncoding = "Accept-Encoding"
Authorization = "Authorization"
ContentDisposition = "Content-Disposition"
ContentEncoding = "Content-Encoding"
ContentLength = "Content-Length"
ContentType = "Content-Type"
Location = "Location"
Upgrade = "Upgrade"
Vary = "Vary"
WWWAuthenticate = "WWW-Authenticate"
XForwardedFor = "X-Forwarded-For"
XRealIP = "X-Real-Ip"
Allow = "Allow"
Origin = "Origin"
Gzip = "gzip"
WildcardParam = "*wildcard"
basePath = "/"
blank = ""
slashByte = '/'
paramByte = ':'
wildByte = '*'
)
// Handler is the type used in registering handlers.
// NOTE: these handlers may get wrapped by the HandlerFunc
// type internally.
type Handler interface{}
// HandlerFunc is the internal handler type used for middleware and handlers
type HandlerFunc func(Context)
// HandlersChain is an array of HanderFunc handlers to run
type HandlersChain []HandlerFunc
// ContextFunc is the function to run when creating a new context
type ContextFunc func(l *LARS) Context
// CustomHandlerFunc wraped by HandlerFunc and called where you can type cast both Context and Handler
// and call Handler
type CustomHandlerFunc func(Context, Handler)
// customHandlers is a map of your registered custom CustomHandlerFunc's
// used in determining how to wrap them.
type customHandlers map[reflect.Type]CustomHandlerFunc
// LARS is the main routing instance
type LARS struct {
routeGroup
trees map[string]*node
// function that gets called to create the context object... is total overridable using RegisterContext
contextFunc ContextFunc
pool sync.Pool
http404 HandlersChain // 404 Not Found
http405 HandlersChain // 405 Method Not Allowed
automaticOPTIONS HandlersChain
notFound HandlersChain
customHandlersFuncs customHandlers
// mostParams used to keep track of the most amount of
// params in any URL and this will set the default capacity
// of eachContext Params
mostParams uint8
// Enables automatic redirection if the current route can't be matched but a
// handler for the path with (without) the trailing slash exists.
// For example if /foo/ is requested but a route only exists for /foo, the
// client is redirected to /foo with http status code 301 for GET requests
// and 307 for all other request methods.
redirectTrailingSlash bool
// If enabled, the router checks if another method is allowed for the
// current route, if the current request can not be routed.
// If this is the case, the request is answered with 'Method Not Allowed'
// and HTTP status code 405.
// If no other Method is allowed, the request is delegated to the NotFound
// handler.
handleMethodNotAllowed bool
// if enabled automatically handles OPTION requests; manually configured OPTION
// handlers take presidence. default true
automaticallyHandleOPTIONS bool
}
// RouteMap contains a single routes full path
// and other information
type RouteMap struct {
Depth int `json:"depth"`
Path string `json:"path"`
Method string `json:"method"`
Handler string `json:"handler"`
}
var (
default404Handler = func(c Context) {
http.Error(c.Response(), http.StatusText(http.StatusNotFound), http.StatusNotFound)
}
methodNotAllowedHandler = func(c Context) {
c.Response().WriteHeader(http.StatusMethodNotAllowed)
}
automaticOPTIONSHandler = func(c Context) {
c.Response().WriteHeader(http.StatusOK)
}
formDecoder *form.Decoder
formDecoderInit sync.Once
)
// New Creates and returns a new lars instance
func New() *LARS {
l := &LARS{
routeGroup: routeGroup{
middleware: make(HandlersChain, 0),
},
trees: make(map[string]*node),
contextFunc: func(l *LARS) Context {
return NewContext(l)
},
mostParams: 0,
http404: []HandlerFunc{default404Handler},
http405: []HandlerFunc{methodNotAllowedHandler},
redirectTrailingSlash: true,
handleMethodNotAllowed: false,
automaticallyHandleOPTIONS: false,
}
l.routeGroup.lars = l
l.pool.New = func() interface{} {
c := l.contextFunc(l)
b := c.BaseContext()
b.parent = c
return b
}
return l
}
func initFormDecoder() {
formDecoderInit.Do(func() {
formDecoder = form.NewDecoder()
})
}
// BuiltInFormDecoder returns the built in form decoder github.com/go-playground/form
// in order for custom type to be registered.
func (l *LARS) BuiltInFormDecoder() *form.Decoder {
initFormDecoder()
return formDecoder
}
// RegisterCustomHandler registers a custom handler that gets wrapped by HandlerFunc
func (l *LARS) RegisterCustomHandler(customType interface{}, fn CustomHandlerFunc) {
if l.customHandlersFuncs == nil {
l.customHandlersFuncs = make(customHandlers)
}
t := reflect.TypeOf(customType)
if _, ok := l.customHandlersFuncs[t]; ok {
panic(fmt.Sprint("Custom Type + CustomHandlerFunc already declared: ", t))
}
l.customHandlersFuncs[t] = fn
}
// RegisterContext registers a custom Context function for creation
// and resetting of a global object passed per http request
func (l *LARS) RegisterContext(fn ContextFunc) {
l.contextFunc = fn
}
// Register404 alows for overriding of the not found handler function.
// NOTE: this is run after not finding a route even after redirecting with the trailing slash
func (l *LARS) Register404(notFound ...Handler) {
chain := make(HandlersChain, len(notFound))
for i, h := range notFound {
chain[i] = l.wrapHandler(h)
}
l.http404 = chain
}
// SetAutomaticallyHandleOPTIONS tells lars whether to
// automatically handle OPTION requests; manually configured
// OPTION handlers take precedence. default true
func (l *LARS) SetAutomaticallyHandleOPTIONS(set bool) {
l.automaticallyHandleOPTIONS = set
}
// SetRedirectTrailingSlash tells lars whether to try
// and fix a URL by trying to find it
// lowercase -> with or without slash -> 404
func (l *LARS) SetRedirectTrailingSlash(set bool) {
l.redirectTrailingSlash = set
}
// SetHandle405MethodNotAllowed tells lars whether to
// handle the http 405 Method Not Allowed status code
func (l *LARS) SetHandle405MethodNotAllowed(set bool) {
l.handleMethodNotAllowed = set
}
// Serve returns an http.Handler to be used.
func (l *LARS) Serve() http.Handler {
// reserved for any logic that needs to happen before serving starts.
// i.e. although this router does not use priority to determine route order
// could add sorting of tree nodes here....
l.notFound = make(HandlersChain, len(l.middleware)+len(l.http404))
copy(l.notFound, l.middleware)
copy(l.notFound[len(l.middleware):], l.http404)
if l.automaticallyHandleOPTIONS {
l.automaticOPTIONS = make(HandlersChain, len(l.middleware)+1)
copy(l.automaticOPTIONS, l.middleware)
copy(l.automaticOPTIONS[len(l.middleware):], []HandlerFunc{automaticOPTIONSHandler})
}
return http.HandlerFunc(l.serveHTTP)
}
// Conforms to the http.Handler interface.
func (l *LARS) serveHTTP(w http.ResponseWriter, r *http.Request) {
c := l.pool.Get().(*Ctx)
c.parent.RequestStart(w, r)
if root := l.trees[r.Method]; root != nil {
if c.handlers, c.params, c.handlerName = root.find(r.URL.Path, c.params); c.handlers == nil {
c.params = c.params[0:0]
if l.redirectTrailingSlash && len(r.URL.Path) > 1 {
// find again all lowercase
orig := r.URL.Path
lc := strings.ToLower(orig)
if lc != r.URL.Path {
if c.handlers, _, _ = root.find(lc, c.params); c.handlers != nil {
r.URL.Path = lc
c.handlers = l.redirect(r.Method, r.URL.String())
r.URL.Path = orig
goto END
}
}
if lc[len(lc)-1:] == basePath {
lc = lc[:len(lc)-1]
} else {
lc = lc + basePath
}
if c.handlers, _, _ = root.find(lc, c.params); c.handlers != nil {
r.URL.Path = lc
c.handlers = l.redirect(r.Method, r.URL.String())
r.URL.Path = orig
goto END
}
}
} else {
goto END
}
}
if l.automaticallyHandleOPTIONS && r.Method == OPTIONS {
l.getOptions(c)
goto END
}
if l.handleMethodNotAllowed {
if l.checkMethodNotAllowed(c) {
goto END
}
}
// not found
c.handlers = l.notFound
END:
c.parent.Next()
c.parent.RequestEnd()
l.pool.Put(c)
}
func (l *LARS) getOptions(c *Ctx) {
if c.request.URL.Path == "*" { // check server-wide OPTIONS
for m := range l.trees {
if m == OPTIONS {
continue
}
c.response.Header().Add(Allow, m)
}
} else {
for m, tree := range l.trees {
if m == c.request.Method || m == OPTIONS {
continue
}
if c.handlers, _, _ = tree.find(c.request.URL.Path, c.params); c.handlers != nil {
c.response.Header().Add(Allow, m)
}
}
}
c.response.Header().Add(Allow, OPTIONS)
c.handlers = l.automaticOPTIONS
return
}
func (l *LARS) checkMethodNotAllowed(c *Ctx) (found bool) {
for m, tree := range l.trees {
if m != c.request.Method {
if c.handlers, _, _ = tree.find(c.request.URL.Path, c.params); c.handlers != nil {
// add methods
c.response.Header().Add(Allow, m)
found = true
}
}
}
if found {
c.handlers = l.http405
}
return
}
| 25.390187 | 104 | 0.681329 |
24da8362d7250e284272fe057bc67d492c9fc9d0
| 2,016 |
go
|
Go
|
lib/api/intern.go
|
SmartEnergyPlatform/iot-device-repository
|
c94490ffe20b555c7f6a7a1f611a2341691a8542
|
[
"Apache-2.0"
] | null | null | null |
lib/api/intern.go
|
SmartEnergyPlatform/iot-device-repository
|
c94490ffe20b555c7f6a7a1f611a2341691a8542
|
[
"Apache-2.0"
] | null | null | null |
lib/api/intern.go
|
SmartEnergyPlatform/iot-device-repository
|
c94490ffe20b555c7f6a7a1f611a2341691a8542
|
[
"Apache-2.0"
] | null | null | null |
/*
* Copyright 2018 InfAI (CC SES)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package api
import (
"encoding/json"
"net/http"
"github.com/SmartEnergyPlatform/iot-device-repository/lib/interfaces"
"github.com/SmartEnergyPlatform/jwt-http-router"
"github.com/SmartEnergyPlatform/util/http/response"
)
func intern(router *jwt_http_router.Router, db interfaces.Persistence) {
router.POST("/intern/gatewaynames", func(res http.ResponseWriter, r *http.Request, ps jwt_http_router.Params, jwt jwt_http_router.Jwt) {
ids := []string{}
err := json.NewDecoder(r.Body).Decode(&ids)
if err != nil {
http.Error(res, err.Error(), http.StatusBadRequest)
return
}
result := map[string]string{}
for _, id := range ids {
name, err := db.GetGatewayName(id)
if err != nil {
http.Error(res, err.Error(), http.StatusInternalServerError)
return
}
result[id] = name
}
response.To(res).Json(result)
})
router.POST("/intern/device/gatewaynames", func(res http.ResponseWriter, r *http.Request, ps jwt_http_router.Params, jwt jwt_http_router.Jwt) {
ids := []string{}
err := json.NewDecoder(r.Body).Decode(&ids)
if err != nil {
http.Error(res, err.Error(), http.StatusBadRequest)
return
}
result := map[string]string{}
for _, id := range ids {
name, err := db.GetGatewayNameByDevice(id)
if err != nil {
http.Error(res, err.Error(), http.StatusInternalServerError)
return
}
result[id] = name
}
response.To(res).Json(result)
})
}
| 30.089552 | 144 | 0.701885 |
c91dfddda90f18257fc7a1e51fb39b4c2db55f0a
| 3,999 |
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_929.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9 |
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_929.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1 |
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_929.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3 |
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %rdi
lea addresses_UC_ht+0x18133, %r14
nop
nop
nop
nop
sub %rdi, %rdi
mov (%r14), %r12
cmp $14757, %r15
pop %rdi
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %rbx
push %rdi
push %rsi
// Faulty Load
lea addresses_D+0xee5b, %rbx
clflush (%rbx)
nop
xor %rdi, %rdi
mov (%rbx), %r12
lea oracles, %r14
and $0xff, %r12
shlq $12, %r12
mov (%r14,%r12,1), %r12
pop %rsi
pop %rdi
pop %rbx
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 67.779661 | 2,999 | 0.661665 |
a1bb09e5813486d61aecf91aaea95364e01d651b
| 2,818 |
go
|
Go
|
slices/flatten_test.go
|
golodash/godash
|
59b0c987536624be4521ffc645cde92cee5ada64
|
[
"MIT"
] | null | null | null |
slices/flatten_test.go
|
golodash/godash
|
59b0c987536624be4521ffc645cde92cee5ada64
|
[
"MIT"
] | 8 |
2022-01-20T07:54:27.000Z
|
2022-03-07T15:55:32.000Z
|
slices/flatten_test.go
|
gotorn/godash
|
59b0c987536624be4521ffc645cde92cee5ada64
|
[
"MIT"
] | 2 |
2022-01-04T11:42:52.000Z
|
2022-01-04T14:47:14.000Z
|
package slices
import (
"fmt"
"reflect"
"strconv"
"testing"
)
type TFlatten struct {
name string
arr []interface{}
want []interface{}
}
var tFlattenBenchs = []TFlatten{
{
name: "10",
arr: []interface{}{},
},
{
name: "100",
arr: []interface{}{},
},
{
name: "1000",
arr: []interface{}{},
},
{
name: "10000",
arr: []interface{}{},
},
{
name: "100000",
arr: []interface{}{},
},
{
name: "1000000",
arr: []interface{}{},
},
}
func init() {
for j := 0; j < len(tFlattenBenchs); j++ {
length, _ := strconv.Atoi(tFlattenBenchs[j].name)
for i := 0; i < length/10; i++ {
tFlattenBenchs[j].arr = append(tFlattenBenchs[j].arr, []interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}...)
}
}
}
func TestFlatten(t *testing.T) {
var tests = []TFlatten{
{
name: "nil",
arr: nil,
want: nil,
},
{
name: "empty",
arr: []interface{}{},
want: []interface{}{},
},
{
name: "none",
arr: []interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
want: []interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
},
{
name: "normal",
arr: []interface{}{0, []interface{}{1, 2}, []interface{}{3, 4, 5}, []interface{}{6, 7}, 8, 9},
want: []interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
},
{
name: "more layer",
arr: []interface{}{[]interface{}{0, []interface{}{1, 2}}, 3, []interface{}{4, 5, []interface{}{6, 7}, 8}, []interface{}{9}},
want: []interface{}{0, []interface{}{1, 2}, 3, 4, 5, []interface{}{6, 7}, 8, 9},
},
}
for _, subject := range tests {
t.Run(subject.name, func(t *testing.T) {
got, err := Flatten(subject.arr)
if err != nil {
if subject.want != nil {
t.Errorf("Flatten() got = %v, wanted = %v", got, subject.want)
}
return
}
if len(got) != len(subject.want) {
t.Errorf("Flatten() got = %v, wanted = %v", got, subject.want)
return
}
check := func(subgot, want []interface{}, function interface{}) {
for i := 0; i < len(subgot); i++ {
if gotVal, ok := subgot[i].([]interface{}); ok {
if wantVal, ok := want[i].([]interface{}); ok {
for j := 0; j < len(subgot); j++ {
reflect.ValueOf(function).Call([]reflect.Value{reflect.ValueOf(gotVal), reflect.ValueOf(wantVal), reflect.ValueOf(function)})
}
} else {
t.Errorf("Flatten() got = %v, wanted = %v", got, subject.want)
return
}
} else {
if subgot[i] != want[i] {
t.Errorf("Flatten() got = %v, wanted = %v", got, subject.want)
return
}
}
}
}
check(got, subject.want, check)
})
}
}
func BenchmarkFlatten(b *testing.B) {
for j := 0; j < len(tFlattenBenchs); j++ {
b.Run(fmt.Sprintf("slice_size_%s", tFlattenBenchs[j].name), func(b *testing.B) {
for i := 0; i < b.N; i++ {
Flatten(tFlattenBenchs[j].arr)
}
})
}
}
| 21.51145 | 133 | 0.518453 |
a88920777b05fe94ed1ce125e7cf9f5e9c5a2003
| 3,097 |
rs
|
Rust
|
src/flash/fcfg_b6_start.rs
|
jeandudey/cc13x2-rs
|
215918099301ec75e9dfad531f5cf46e13077a39
|
[
"MIT"
] | null | null | null |
src/flash/fcfg_b6_start.rs
|
jeandudey/cc13x2-rs
|
215918099301ec75e9dfad531f5cf46e13077a39
|
[
"MIT"
] | null | null | null |
src/flash/fcfg_b6_start.rs
|
jeandudey/cc13x2-rs
|
215918099301ec75e9dfad531f5cf46e13077a39
|
[
"MIT"
] | null | null | null |
#[doc = "Reader of register FCFG_B6_START"]
pub type R = crate::R<u32, super::FCFG_B6_START>;
#[doc = "Writer for register FCFG_B6_START"]
pub type W = crate::W<u32, super::FCFG_B6_START>;
#[doc = "Register FCFG_B6_START `reset()`'s with value 0"]
impl crate::ResetValue for super::FCFG_B6_START {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `B6_MAX_SECTOR`"]
pub type B6_MAX_SECTOR_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `B6_MAX_SECTOR`"]
pub struct B6_MAX_SECTOR_W<'a> {
w: &'a mut W,
}
impl<'a> B6_MAX_SECTOR_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x0f << 28)) | (((value as u32) & 0x0f) << 28);
self.w
}
}
#[doc = "Reader of field `B6_MUX_FACTOR`"]
pub type B6_MUX_FACTOR_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `B6_MUX_FACTOR`"]
pub struct B6_MUX_FACTOR_W<'a> {
w: &'a mut W,
}
impl<'a> B6_MUX_FACTOR_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x0f << 24)) | (((value as u32) & 0x0f) << 24);
self.w
}
}
#[doc = "Reader of field `B6_START_ADDR`"]
pub type B6_START_ADDR_R = crate::R<u32, u32>;
#[doc = "Write proxy for field `B6_START_ADDR`"]
pub struct B6_START_ADDR_W<'a> {
w: &'a mut W,
}
impl<'a> B6_START_ADDR_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !0x00ff_ffff) | ((value as u32) & 0x00ff_ffff);
self.w
}
}
impl R {
#[doc = "Bits 28:31 - 31:28\\]
Internal. Only to be used through TI provided API."]
#[inline(always)]
pub fn b6_max_sector(&self) -> B6_MAX_SECTOR_R {
B6_MAX_SECTOR_R::new(((self.bits >> 28) & 0x0f) as u8)
}
#[doc = "Bits 24:27 - 27:24\\]
Internal. Only to be used through TI provided API."]
#[inline(always)]
pub fn b6_mux_factor(&self) -> B6_MUX_FACTOR_R {
B6_MUX_FACTOR_R::new(((self.bits >> 24) & 0x0f) as u8)
}
#[doc = "Bits 0:23 - 23:0\\]
Internal. Only to be used through TI provided API."]
#[inline(always)]
pub fn b6_start_addr(&self) -> B6_START_ADDR_R {
B6_START_ADDR_R::new((self.bits & 0x00ff_ffff) as u32)
}
}
impl W {
#[doc = "Bits 28:31 - 31:28\\]
Internal. Only to be used through TI provided API."]
#[inline(always)]
pub fn b6_max_sector(&mut self) -> B6_MAX_SECTOR_W {
B6_MAX_SECTOR_W { w: self }
}
#[doc = "Bits 24:27 - 27:24\\]
Internal. Only to be used through TI provided API."]
#[inline(always)]
pub fn b6_mux_factor(&mut self) -> B6_MUX_FACTOR_W {
B6_MUX_FACTOR_W { w: self }
}
#[doc = "Bits 0:23 - 23:0\\]
Internal. Only to be used through TI provided API."]
#[inline(always)]
pub fn b6_start_addr(&mut self) -> B6_START_ADDR_W {
B6_START_ADDR_W { w: self }
}
}
| 32.6 | 86 | 0.604456 |
4905009d57cff19e66575a7bfdba66a5dbebafe6
| 6,310 |
py
|
Python
|
bird_classify.py
|
google-coral/project-birdfeeder
|
3bcb9bfd4123a0c6f16a09087a8ccdfe0c6dd80e
|
[
"Apache-2.0"
] | 26 |
2019-07-23T22:32:08.000Z
|
2022-01-09T15:15:50.000Z
|
bird_classify.py
|
hjonnala/project-birdfeeder
|
4375a9370d7567b756b6cc68f4dfcb4c8183b118
|
[
"Apache-2.0"
] | 13 |
2019-07-26T17:10:48.000Z
|
2022-03-01T04:11:48.000Z
|
bird_classify.py
|
hjonnala/project-birdfeeder
|
4375a9370d7567b756b6cc68f4dfcb4c8183b118
|
[
"Apache-2.0"
] | 19 |
2019-11-05T03:01:31.000Z
|
2022-03-29T01:13:46.000Z
|
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/usr/bin/python3
"""
Coral Smart Bird Feeder
Uses ClassificationEngine from the EdgeTPU API to analyze animals in
camera frames. Sounds a deterrent if a squirrel is detected.
Users define model, labels file, storage path, deterrent sound, and
optionally can set this to training mode for collecting images for a custom
model.
"""
import argparse
import time
import logging
from PIL import Image
from playsound import playsound
from pycoral.utils.dataset import read_label_file
from pycoral.utils.edgetpu import make_interpreter
from pycoral.adapters import common
from pycoral.adapters.classify import get_classes
import gstreamer
def save_data(image, results, path, ext='png'):
"""Saves camera frame and model inference results
to user-defined storage directory."""
tag = '%010d' % int(time.monotonic()*1000)
name = '%s/img-%s.%s' % (path, tag, ext)
image.save(name)
print('Frame saved as: %s' % name)
logging.info('Image: %s Results: %s', tag, results)
def print_results(start_time, last_time, end_time, results):
"""Print results to terminal for debugging."""
inference_rate = ((end_time - start_time) * 1000)
fps = (1.0/(end_time - last_time))
print('\nInference: %.2f ms, FPS: %.2f fps' % (inference_rate, fps))
for label, score in results:
print(' %s, score=%.2f' % (label, score))
def do_training(results, last_results, top_k):
"""Compares current model results to previous results and returns
true if at least one label difference is detected. Used to collect
images for training a custom model."""
new_labels = [label[0] for label in results]
old_labels = [label[0] for label in last_results]
shared_labels = set(new_labels).intersection(old_labels)
if len(shared_labels) < top_k:
print('Difference detected')
return True
return False
def user_selections():
parser = argparse.ArgumentParser()
parser.add_argument('--model', required=True,
help='.tflite model path')
parser.add_argument('--labels', required=True,
help='label file path')
parser.add_argument('--videosrc', help='Which video source to use', default='/dev/video0')
parser.add_argument('--top_k', type=int, default=3,
help='number of classes with highest score to display')
parser.add_argument('--threshold', type=float, default=0.1,
help='class score threshold')
parser.add_argument('--storage', required=True,
help='File path to store images and results')
parser.add_argument('--sound', required=True,
help='File path to deterrent sound')
parser.add_argument('--print', default=False, required=False,
help='Print inference results to terminal')
parser.add_argument('--training', action='store_true',
help='Training mode for image collection')
args = parser.parse_args()
return args
def main():
"""Creates camera pipeline, and pushes pipeline through ClassificationEngine
model. Logs results to user-defined storage. Runs either in training mode to
gather images for custom model creation or in deterrent mode that sounds an
'alarm' if a defined label is detected."""
args = user_selections()
print("Loading %s with %s labels." % (args.model, args.labels))
interpreter = make_interpreter(args.model)
interpreter.allocate_tensors()
labels = read_label_file(args.labels)
input_tensor_shape = interpreter.get_input_details()[0]['shape']
if (input_tensor_shape.size != 4 or
input_tensor_shape[0] != 1):
raise RuntimeError(
'Invalid input tensor shape! Expected: [1, height, width, channel]')
output_tensors = len(interpreter.get_output_details())
if output_tensors != 1:
raise ValueError(
('Classification model should have 1 output tensor only!'
'This model has {}.'.format(output_tensors)))
storage_dir = args.storage
# Initialize logging file
logging.basicConfig(filename='%s/results.log' % storage_dir,
format='%(asctime)s-%(message)s',
level=logging.DEBUG)
last_time = time.monotonic()
last_results = [('label', 0)]
def user_callback(image, svg_canvas):
nonlocal last_time
nonlocal last_results
start_time = time.monotonic()
common.set_resized_input(
interpreter, image.size, lambda size: image.resize(size, Image.NEAREST))
interpreter.invoke()
results = get_classes(interpreter, args.top_k, args.threshold)
end_time = time.monotonic()
play_sounds = [labels[i] for i, score in results]
results = [(labels[i], score) for i, score in results]
if args.print:
print_results(start_time, last_time, end_time, results)
if args.training:
if do_training(results, last_results, args.top_k):
save_data(image, results, storage_dir)
else:
# Custom model mode:
# The labels can be modified to detect/deter user-selected items
if len(results):
if results[0][0] != 'background':
save_data(image, results, storage_dir)
if FOX_SQUIRREL_LABEL in play_sounds:
playsound(args.sound)
logging.info('Deterrent sounded')
last_results = results
last_time = end_time
gstreamer.run_pipeline(user_callback, videosrc=args.videosrc)
if __name__ == '__main__':
FOX_SQUIRREL_LABEL = 'fox squirrel, eastern fox squirrel, Sciurus niger'
main()
| 38.711656 | 94 | 0.666878 |
cdc9e84e192df932418e3644f89fa0cc47800599
| 1,426 |
swift
|
Swift
|
SubscMemo/UI/SubscCategoryPickerView.swift
|
yyokii/SubscMemo
|
673cac56fe6998828b89958bd82b72d5a1175abb
|
[
"MIT"
] | null | null | null |
SubscMemo/UI/SubscCategoryPickerView.swift
|
yyokii/SubscMemo
|
673cac56fe6998828b89958bd82b72d5a1175abb
|
[
"MIT"
] | 5 |
2021-08-29T16:12:47.000Z
|
2021-09-24T13:03:11.000Z
|
SubscMemo/UI/SubscCategoryPickerView.swift
|
yyokii/SubscMemo
|
673cac56fe6998828b89958bd82b72d5a1175abb
|
[
"MIT"
] | null | null | null |
//
// SubscCategoryPickerView.swift
// SubscMemo
//
// Created by Higashihara Yoki on 2021/05/23.
//
import SwiftUI
struct SubscCategoryPickerView: View {
let datas: [SubscCategory]
@Binding var selectedData: SubscCategory
let title: String
var body: some View {
VStack {
Picker(title, selection: $selectedData) {
ForEach(datas) { data in
Text(data.name)
.foregroundColor(.adaptiveBlack)
}
}
.adaptiveFont(.matterSemiBold, size: 8)
.foregroundColor(.placeholderGray)
}
}
}
#if DEBUG
struct OptionalablePickerView_Previews: PreviewProvider {
struct ContentView01: View {
var datas = demoSubscCategories
@ObservedObject var vm = demoCreateCustomSubscItemVM
var body: some View {
NavigationView {
VStack {
SubscCategoryPickerView(
datas: vm.categories,
selectedData: $vm.mainCategory,
title: "プレビュー"
)
}
}
}
}
static var previews: some View {
Group {
ContentView01()
.environment(\.colorScheme, .light)
ContentView01()
.environment(\.colorScheme, .dark)
}
}
}
#endif
| 22.634921 | 60 | 0.518233 |
caf766cf50d7f179d91a1718a0e0862d5ac3fb2a
| 5,562 |
swift
|
Swift
|
Example/AndesUI/TextFieldsCode/Views/TextFieldsCodeViewController.swift
|
oesierra/fury_andesui-ios
|
ea26f816ac1f4346c590613f766d4d07b3a0bd03
|
[
"MIT"
] | 2 |
2020-12-16T20:57:41.000Z
|
2021-02-19T02:42:31.000Z
|
Example/AndesUI/TextFieldsCode/Views/TextFieldsCodeViewController.swift
|
javff/fury_andesui-ios
|
e82858d00691133b42c080c4397adcb687f23041
|
[
"MIT"
] | 3 |
2020-10-01T12:23:43.000Z
|
2020-10-19T14:11:13.000Z
|
Example/AndesUI/TextFieldsCode/Views/TextFieldsCodeViewController.swift
|
javff/fury_andesui-ios
|
e82858d00691133b42c080c4397adcb687f23041
|
[
"MIT"
] | null | null | null |
//
// TextFieldsCodeViewController.swift
// AndesUI-demoapp
//
// Created by Esteban Adrian Boffa on 16/09/2020.
// Copyright © 2020 MercadoLibre. All rights reserved.
//
import Foundation
import AndesUI
final class TextFieldsCodeViewController: UIViewController {
// MARK: IBOutlets
@IBOutlet weak var andesTextFieldCode: AndesTextFieldCode!
@IBOutlet weak var textFieldCodeTitle: UILabel!
@IBOutlet weak var stateTextField: UITextField!
@IBOutlet weak var styleTextField: UITextField!
@IBOutlet weak var textTextField: UITextField!
@IBOutlet weak var labelTextField: UITextField!
@IBOutlet weak var helpLabelTextField: UITextField!
@IBOutlet weak var updateButton: AndesButton!
var statePicker: UIPickerView = UIPickerView()
var stylePicker: UIPickerView = UIPickerView()
var state: AndesTextFieldCodeState = .IDLE
var style: AndesTextFieldCodeStyle = .THREESOME
// AndesTextFieldCode programatically
var textFieldCode: AndesTextFieldCode?
override func viewDidLoad() {
super.viewDidLoad()
renderViews()
}
}
// MARK: UI
private extension TextFieldsCodeViewController {
func renderViews() {
// Uncomment for instantiate AndesTextFieldCode programatically
// andesTextFieldCode.removeFromSuperview()
// textFieldCode = AndesTextFieldCode(label: nil, helpLabel: nil, style: .THREESOME, state: .IDLE)
// if let textFieldCode = textFieldCode {
// view.addSubview(textFieldCode)
// NSLayoutConstraint.activate([
// textFieldCode.topAnchor.constraint(equalTo: textFieldCodeTitle.bottomAnchor, constant: 24),
// textFieldCode.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 32),
// textFieldCode.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -32)
// ])
// }
andesTextFieldCode.delegate = self
createPickerViews()
}
func createPickerViews() {
statePicker.delegate = self
statePicker.dataSource = self
stateTextField.inputView = statePicker
stylePicker.delegate = self
stylePicker.dataSource = self
styleTextField.inputView = stylePicker
}
}
// MARK: Actions
private extension TextFieldsCodeViewController {
@IBAction func updateTapped(_ sender: Any) {
andesTextFieldCode?.style = style
andesTextFieldCode?.state = state
andesTextFieldCode?.text = textTextField.text ?? ""
andesTextFieldCode?.label = labelTextField.text
andesTextFieldCode?.helpLabel = helpLabelTextField.text
// AndesTextFieldCode programatically
textFieldCode?.style = style
textFieldCode?.state = state
textFieldCode?.text = textTextField.text ?? ""
textFieldCode?.label = labelTextField.text
textFieldCode?.helpLabel = helpLabelTextField.text
}
@IBAction func clearTapped(_ sender: Any) {
andesTextFieldCode?.text = ""
andesTextFieldCode?.label = ""
andesTextFieldCode?.helpLabel = ""
andesTextFieldCode?.state = .IDLE
andesTextFieldCode?.style = .THREESOME
// AndesTextFieldCode programatically
textFieldCode?.text = ""
textFieldCode?.label = ""
textFieldCode?.helpLabel = ""
textFieldCode?.state = .IDLE
textFieldCode?.style = .THREESOME
textTextField.text = ""
labelTextField.text = ""
helpLabelTextField.text = ""
statePicker.selectRow(0, inComponent: 0, animated: true)
pickerView(statePicker, didSelectRow: 0, inComponent: 0)
stylePicker.selectRow(0, inComponent: 0, animated: true)
pickerView(stylePicker, didSelectRow: 0, inComponent: 0)
}
}
// MARK: UIPickerViewDelegate & UIPickerViewDataSource
extension TextFieldsCodeViewController: UIPickerViewDelegate, UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if pickerView == statePicker {
stateTextField.resignFirstResponder()
state = AndesTextFieldCodeState.init(rawValue: row)!
stateTextField.text = state.toString()
} else if pickerView == stylePicker {
styleTextField.resignFirstResponder()
style = AndesTextFieldCodeStyle.init(rawValue: row)!
styleTextField.text = style.toString()
}
}
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
if pickerView == statePicker {
return 3
}
if pickerView == stylePicker {
return 3
}
return 0
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if pickerView == statePicker {
let state = AndesTextFieldCodeState.init(rawValue: row)!
return state.toString()
}
if pickerView == stylePicker {
let style = AndesTextFieldCodeStyle.init(rawValue: row)!
return style.toString()
}
return ""
}
}
// MARK: AndesTextFieldCodeDelegate
extension TextFieldsCodeViewController: AndesTextFieldCodeDelegate {
func textDidChange(_ text: String) {
print("textDidChange: \(text)")
}
func textDidComplete(_ isComplete: Bool) {
print("textDidComplete: \(isComplete)")
}
}
| 34.981132 | 111 | 0.67242 |
1586cd5f87afe4b813004f24665563c6c0455eb6
| 689 |
rb
|
Ruby
|
db/migrate/20150818144913_create_roles.rb
|
JamesGlover/event_warehouse
|
628b3b3be94e574db6868f73177fac4ffe7ce7ad
|
[
"MIT"
] | 1 |
2017-09-08T08:04:35.000Z
|
2017-09-08T08:04:35.000Z
|
db/migrate/20150818144913_create_roles.rb
|
JamesGlover/event_warehouse
|
628b3b3be94e574db6868f73177fac4ffe7ce7ad
|
[
"MIT"
] | 184 |
2019-06-04T12:14:52.000Z
|
2022-03-30T21:56:50.000Z
|
db/migrate/20150818144913_create_roles.rb
|
sanger/event_warehouse
|
39cab66290e6df98e52131c9c4c8db9744c0912f
|
[
"MIT"
] | 4 |
2015-11-02T11:18:46.000Z
|
2018-11-14T09:16:14.000Z
|
# frozen_string_literal: true
# Add the roles table to associated subjects with events
class CreateRoles < ActiveRecord::Migration
def change
create_table :roles do |t|
t.integer :event_id,
null: false,
comment: 'Associate with the event (what happened)',
index: true
t.integer :subject_id,
null: false,
comment: 'Associate with the subject (what it happened to, or what might care)',
index: true
t.integer :role_type_id,
null: false,
comment: 'References the role_types table, describing the role'
t.timestamps
end
end
end
| 31.318182 | 96 | 0.593614 |
c19d4293a873176baef1718c3739e552e38a293f
| 332 |
sql
|
SQL
|
Tests/materials/pl-sql/jrxml2pdf-release/install/upgrade_0700_to_0800.sql
|
RomanBelkov/YaccConstructor
|
f3422cf5d152a63ceff13609c5bfd271958bf345
|
[
"Apache-2.0"
] | null | null | null |
Tests/materials/pl-sql/jrxml2pdf-release/install/upgrade_0700_to_0800.sql
|
RomanBelkov/YaccConstructor
|
f3422cf5d152a63ceff13609c5bfd271958bf345
|
[
"Apache-2.0"
] | null | null | null |
Tests/materials/pl-sql/jrxml2pdf-release/install/upgrade_0700_to_0800.sql
|
RomanBelkov/YaccConstructor
|
f3422cf5d152a63ceff13609c5bfd271958bf345
|
[
"Apache-2.0"
] | 1 |
2020-01-21T17:39:33.000Z
|
2020-01-21T17:39:33.000Z
|
SET SCAN OFF
SET TIMING ON
PROMPT install tables
@JRXML_RESOURCE_FILES.sql
@JRXML_RESOURCE_ENTRIES.sql
@JRXML_NLS_PARAMETERS.sql
PROMPT install packages
@AS_PDF3_MOD.pls
@PK_JRXML2PDF_LOG.pls
@PK_JRXML2PDF_UTIL.pls
@PK_JRXML2PDF_REPGEN.pls
PROMPT install NLS-seed-data
@INSERT_NLS_DATA.sql
PROMPT finished
| 15.809524 | 29 | 0.792169 |
c463f4d1763ce831c43ebcb925886fa7ed8399cf
| 4,734 |
c
|
C
|
main/c_sysinfo/sysinfo.c
|
SteversJE/OSSILE
|
43858871c0c2149a9d98a9be304a40c8a46ebff1
|
[
"MIT"
] | 66 |
2016-10-10T12:52:11.000Z
|
2022-02-20T22:18:03.000Z
|
main/c_sysinfo/sysinfo.c
|
SteversJE/OSSILE
|
43858871c0c2149a9d98a9be304a40c8a46ebff1
|
[
"MIT"
] | 52 |
2016-10-10T09:48:44.000Z
|
2021-09-25T19:22:17.000Z
|
main/c_sysinfo/sysinfo.c
|
SteversJE/OSSILE
|
43858871c0c2149a9d98a9be304a40c8a46ebff1
|
[
"MIT"
] | 54 |
2016-10-10T08:05:03.000Z
|
2022-03-09T03:28:03.000Z
|
#include <stdio.h> // Standard I/O
#include <stdlib.h> // Standard Lib
#include <recio.h> // File Record level access
#include <xxcvt.h> // Conversion of int etc to zoned/packed
#include <decimal.h> // needed for mapping custdets file
#include <qwcrssts.h> // ret syssts
#include <qusec.h> // Error Code Structures
// error struct define
typedef struct EC_x {
Qus_EC_t EC;
char Exception_Data[48];
}EC_t;
// definitions
#define _1KB 1024
#define _8K _1KB * 8
#define _32K _1KB * 32
#define _64K _1KB * 64
#define _1MB _1KB * _1KB
#define _1GB ((long)_1MB * _1KB)
#define _CPYRGHT "Copyright (c) Chris Hird 2016 Made available under the terms of the license of the containing project"
#pragma comment(copyright,_CPYRGHT)
int main(int argc, char **argv) {
int List_Info_Len = 0; // list info len
float pct_avail; // available percent
float dasd_avail; // dasd available
char Reset[10] = "*NO "; // reset info
char Fmt_Name[8] = "SSTS0200"; // request format
Qwc_SSTS0200_t List_Info; // list info struct
EC_t Error_Code = {0}; // error struct
Error_Code.EC.Bytes_Provided = sizeof(Error_Code);
List_Info_Len = sizeof(List_Info);
QWCRSSTS(&List_Info,
List_Info_Len,
Fmt_Name,
Reset,
&Error_Code);
if(Error_Code.EC.Bytes_Available > 0) {
printf("Error code QWCRSSTS %.7s\n",Error_Code.EC.Exception_Id);
exit(-1);
}
// convert the information and push to stdout
pct_avail = (float)100 - (List_Info.Pct_System_ASP_used/10000);
dasd_avail = List_Info.Total_Aux_Storage * pct_avail/100000;
// print the information to stdout
printf("Percentage Available disk %.1f%%\n",pct_avail);
printf("Total %.3fGB\n",(float)List_Info.Total_Aux_Storage/1000);
printf("Dasd available = %.3fGB\n",dasd_avail);
printf("System Name %.8s\n",List_Info.System_Name);
if(*List_Info.Restricted_State == '0')
printf("System not in Restricted State\n");
if(*List_Info.Restricted_State == '1')
printf("System in Restricted State\n");
printf("Processor Used %.1f%%\n",(float)List_Info.Pct_Processing_Unit_Used/1000);
printf("Jobs in System %d\n",List_Info.Jobs_In_System);
printf("%% Perm Addresses %.3f%%\n",(float)List_Info.Pct_Perm_Addresses/1000);
printf("%% Temp Addresses %.3f%%\n",(float)List_Info.Pct_Temp_Addresses/1000);
printf("System ASP %.3fGB\n",List_Info.System_ASP/1000);
printf("%% System ASP Used %.3f%%\n",(float)List_Info.Pct_System_ASP_used/10000);
printf("Total Storage %.3fGB\n",(float)List_Info.Total_Aux_Storage/1000);
printf("Unprotected %dMB\n",List_Info.Current_Unprotect_Storage);
printf("Max Unprotected %dMB\n",List_Info.Maximum_Unprotect_Storage);
if(List_Info.DB_Capability == -1)
printf("DB Capability not reported\n");
else
printf("%% DB Capability %.1f%%\n",(float)List_Info.DB_Capability/1000);
printf("Number of partitions %d\n",List_Info.Number_Of_Partitions);
printf("Partition Identifier %d\n",List_Info.Partition_Identifier);
printf("Current Processor Capacity %.2f\n",(float)List_Info.Current_Processing_Capacity/100);
if(List_Info.Processor_Sharing_Attribute == '0')
printf("Processor Sharing *NONE\n");
if(List_Info.Processor_Sharing_Attribute == '1')
printf("Processor Sharing *CAPPED\n");
if(List_Info.Processor_Sharing_Attribute == '2')
printf("Processor Sharing *UNCAPPED\n");
printf("Number of processors %d\n",List_Info.Number_Of_Processors);
printf("Number Active Jobs %d\n",List_Info.Active_Jobs_In_System);
printf("Active Threads %d\n",List_Info.Active_Threads_In_System);
printf("Max jobs in System %d\n",List_Info.Maximum_Jobs_In_System);
printf("Temp 256MB segments %.2f%%\n",(float)List_Info.Temp_256MB_Segments/100);
printf("Temp 4GB Segments %.2f%%\n",(float)List_Info.Temp_4GB_Segments/100);
printf("Perm 256MB Segments %.2f%%\n",(float)List_Info.Perm_256MB_Segments/100);
printf("Perm 4GB Segments %.2f%%\n",(float)List_Info.Perm_4GB_Segments/100);
printf("Curr Interactive Perf %d%%\n",List_Info.Cur_Interactive_Performance);
printf("Uncapped CPU Used %.2f%%\n",(float)List_Info.Uncapped_CPU_Capacity_Used/10);
if(List_Info.Shared_Processor_Pool_Used == -1)
printf("Shared Processor not used\n");
else
printf("Shared processor used %.2f%%\n",(float)List_Info.Shared_Processor_Pool_Used/10);
printf("Main memory %.3fGB\n",(float)List_Info.Main_Storage_Size/1048576);
exit(0);
}
| 49.831579 | 121 | 0.677229 |
dc3576c0bb76034dc8e4bc5846d8bee950e47e0b
| 678 |
lua
|
Lua
|
config.lua
|
kibradev/kibra-kokain
|
7e02cf36b3b380ce6a927b90750a918a65868eaa
|
[
"MIT"
] | null | null | null |
config.lua
|
kibradev/kibra-kokain
|
7e02cf36b3b380ce6a927b90750a918a65868eaa
|
[
"MIT"
] | null | null | null |
config.lua
|
kibradev/kibra-kokain
|
7e02cf36b3b380ce6a927b90750a918a65868eaa
|
[
"MIT"
] | null | null | null |
Config = {}
-- Kordinat
Config.KokainTopla = {x = 1125.38, y= -1231.3, z = 16.4185}
Config.KokainAyristir = {x = 1120.95, y = -1234.8, z = 16.4185}
Config.KokainKurutma = {x = 1119.92, y = -1233.4, z = 16.4185}
Config.KokainPaketleme = {x = 1116.89, y = -1239.5, z = 16.4185}
--Satıcı
Config.Satici = {x = 751.791, y = 6458.68, z = 30.5270}
Config.heading = 64.28
Config.Para = 30000 -- 5 Tanesi için
-- Info
Config.KokainBlip = true -- true olması durumunda Kokain blibi aktif hale gelir.
Config.KaraPara = true --- True olması durumunda karapara verir. Aksi taktirde nakit verir.
Config.SaticiBlip = true -- false olunca Satıcı blibini kapatır
| 29.478261 | 92 | 0.654867 |
9bfde1ef2987bbe2e1a1f4205370fa7a6db8e5f8
| 2,093 |
js
|
JavaScript
|
js/main.js
|
stauffenbits/warp-wars
|
91d0ee54022531355bb3e3d4a366533cd72db43e
|
[
"MIT"
] | null | null | null |
js/main.js
|
stauffenbits/warp-wars
|
91d0ee54022531355bb3e3d4a366533cd72db43e
|
[
"MIT"
] | null | null | null |
js/main.js
|
stauffenbits/warp-wars
|
91d0ee54022531355bb3e3d4a366533cd72db43e
|
[
"MIT"
] | null | null | null |
import * as Game from '/js/Universe.js';
import * as $ from 'jquery';
var universe = new Game.Universe(20, 50);
universe.draw();
var CURRENT_STAR = null;
var CURRENT_PLANET = null;
var CURRENT_BUILDING = null;
Game.$fourd.make_resolve_click(function(vertex){
if(!vertex){
return;
}
if(vertex.game_object instanceof Game.Star){
starClick(vertex);
}else if(vertex.game_object instanceof Game.Planet){
planetClick(vertex);
}
updateHUD();
})
var starClick = function(vertex){
if(CURRENT_STAR !== null){
CURRENT_STAR.collapse();
}
if(vertex.game_object == CURRENT_STAR){
if(CURRENT_PLANET !== null){
CURRENT_PLANET.collapse();
CURRENT_PLANET = null;
}
CURRENT_STAR = null;
return;
}
CURRENT_STAR = vertex.game_object;
Game.$fourd.toggle_controls('orbit', vertex);
CURRENT_STAR.expand();
}
var planetClick = function(vertex){
if(CURRENT_PLANET !== null){
CURRENT_PLANET.collapse();
}
if(vertex.game_object == CURRENT_PLANET){
CURRENT_PLANET = null;
return;
}
CURRENT_PLANET = vertex.game_object;
Game.$fourd.toggle_controls('orbit', vertex);
CURRENT_PLANET.expand();
}
var updateHUD = function(){
document.querySelector('#selected-star').textContent =
CURRENT_STAR ? CURRENT_STAR.universe.stars.indexOf(CURRENT_STAR) : "None";
document.querySelector('#selected-planet').textContent =
CURRENT_PLANET ? CURRENT_PLANET.star.planets.indexOf(CURRENT_PLANET) : "None";
updateBuildMenu();
}
var updateBuildMenu = function(){
CURRENT_PLANET ? showBuildMenu() : hideBuildMenu();
}
var showBuildMenu = function(){
document.querySelector('.build').classList.remove('hidden');
}
var hideBuildMenu = function(){
document.querySelector('.build').classList.add('hidden');
}
window.buildHousing = function(){
var building = new Game.Building(CURRENT_PLANET);
CURRENT_PLANET.buildings.push(building)
building.draw();
}
window.buildGenerator = function(){
var building = new Game.Building(CURRENT_PLANET);
CURRENT_PLANET.buildings.push(building)
building.draw();
}
| 22.505376 | 82 | 0.707597 |
22ab71ce8b36061ea30f3ddb8ba338a8c9e1e7cd
| 437 |
swift
|
Swift
|
macOS/Launcher/MainApplication/ViewController.swift
|
DuongToBSV/tutorials
|
4908cc11b641de3e219d66ef61c1b61e6d63d10c
|
[
"WTFPL"
] | 122 |
2019-09-05T14:27:42.000Z
|
2022-03-29T19:49:05.000Z
|
macOS/Launcher/MainApplication/ViewController.swift
|
DuongToBSV/tutorials
|
4908cc11b641de3e219d66ef61c1b61e6d63d10c
|
[
"WTFPL"
] | 1 |
2019-09-30T11:21:58.000Z
|
2019-09-30T11:21:58.000Z
|
macOS/Launcher/MainApplication/ViewController.swift
|
DuongToBSV/tutorials
|
4908cc11b641de3e219d66ef61c1b61e6d63d10c
|
[
"WTFPL"
] | 32 |
2019-11-14T11:50:08.000Z
|
2022-03-02T16:09:19.000Z
|
//
// ViewController.swift
// MainApplication
//
// Created by Tibor Bodecs on 2015. 09. 17..
// Copyright © 2015. Tibor Bodecs. All rights reserved.
//
import Cocoa
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
}
| 16.807692 | 56 | 0.672769 |
b2cacff06725bd2d9718bd414438fed14a74ef43
| 589 |
py
|
Python
|
src/django_version_checks/apps.py
|
adamchainz/django-version-checks
|
94f6d696f5279a7bb579c7d2a177a231d6b61e45
|
[
"MIT"
] | 33 |
2020-12-13T23:02:39.000Z
|
2022-03-28T06:19:09.000Z
|
src/django_version_checks/apps.py
|
adamchainz/django-version-checks
|
94f6d696f5279a7bb579c7d2a177a231d6b61e45
|
[
"MIT"
] | 47 |
2020-12-14T01:33:56.000Z
|
2021-11-06T09:17:38.000Z
|
src/django_version_checks/apps.py
|
adamchainz/django-version-checks
|
94f6d696f5279a7bb579c7d2a177a231d6b61e45
|
[
"MIT"
] | 2 |
2021-11-13T22:56:21.000Z
|
2022-02-15T14:24:53.000Z
|
from django.apps import AppConfig
from django.core.checks import Tags, register
from django_version_checks import checks
class DjangoVersionChecksAppConfig(AppConfig):
name = "django_version_checks"
verbose_name = "django-version-checks"
def ready(self) -> None:
register(Tags.compatibility)(checks.check_config)
register(Tags.compatibility)(checks.check_python_version)
register(Tags.database)(checks.check_postgresql_version)
register(Tags.database)(checks.check_mysql_version)
register(Tags.database)(checks.check_sqlite_version)
| 34.647059 | 65 | 0.7691 |
993caf5ec5f3bfb69ed5f2ced47cced0ed573acc
| 502 |
h
|
C
|
VBSample/oee_sammple.h
|
teamprodev/MYOE
|
2f36c1a3e631f385154b4e94873416f2b24439a1
|
[
"Apache-2.0"
] | null | null | null |
VBSample/oee_sammple.h
|
teamprodev/MYOE
|
2f36c1a3e631f385154b4e94873416f2b24439a1
|
[
"Apache-2.0"
] | null | null | null |
VBSample/oee_sammple.h
|
teamprodev/MYOE
|
2f36c1a3e631f385154b4e94873416f2b24439a1
|
[
"Apache-2.0"
] | null | null | null |
// oee_sammple.h : main header file for the PROJECT_NAME application
//
#pragma once
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
// Coee_sammpleApp:
// See oee_sammple.cpp for the implementation of this class
//
class Coee_sammpleApp : public CWinApp
{
public:
Coee_sammpleApp();
// Overrides
public:
virtual BOOL InitInstance();
// Implementation
DECLARE_MESSAGE_MAP()
};
extern Coee_sammpleApp theApp;
| 16.193548 | 68 | 0.752988 |
fb0979427417b09321f505f3227d7251e05283b1
| 565 |
swift
|
Swift
|
ITEventsTests/FullEventPresenterTests/FullEventViewMock.swift
|
SRozhina/Meetuper
|
5145b27a33b4e9f5cb965659c31ce9c83f075d26
|
[
"MIT"
] | 2 |
2018-04-06T20:16:28.000Z
|
2018-06-08T20:03:14.000Z
|
ITEventsTests/FullEventPresenterTests/FullEventViewMock.swift
|
SRozhina/Meetuper
|
5145b27a33b4e9f5cb965659c31ce9c83f075d26
|
[
"MIT"
] | 51 |
2018-01-27T22:21:26.000Z
|
2018-07-01T15:36:21.000Z
|
ITEventsTests/FullEventPresenterTests/FullEventViewMock.swift
|
SRozhina/Meetuper
|
5145b27a33b4e9f5cb965659c31ce9c83f075d26
|
[
"MIT"
] | 1 |
2018-03-04T23:02:08.000Z
|
2018-03-04T23:02:08.000Z
|
@testable import ITEvents
class FullEventViewMock: IFullEventView {
var showMoreEventsButtonCount = 0
var similarEventsViewsCount = 0
var createdViewsCount = 0
var eventViewModel: EventViewModel!
func createEventView(with event: EventViewModel, isSimilar: Bool) {
if isSimilar {
similarEventsViewsCount += 1
} else {
createdViewsCount += 1
}
eventViewModel = event
}
func createShowMoreEventsButton(for eventsCount: Int) {
showMoreEventsButtonCount += 1
}
}
| 25.681818 | 71 | 0.654867 |
fe54ca8db2c833029675e18ef0a7d1ec22fc6cbd
| 7,282 |
c
|
C
|
src/FWlib/peripheral_pinctrl.c
|
ingchips/ING918XX_SDK_SOURCE
|
32a87c3809bb4218abe3b75ca8b5a29d702eb325
|
[
"Apache-2.0"
] | 9 |
2020-01-15T07:42:08.000Z
|
2021-12-06T06:56:09.000Z
|
src/FWlib/peripheral_pinctrl.c
|
ingchips/ING918XX_SDK_SOURCE
|
32a87c3809bb4218abe3b75ca8b5a29d702eb325
|
[
"Apache-2.0"
] | null | null | null |
src/FWlib/peripheral_pinctrl.c
|
ingchips/ING918XX_SDK_SOURCE
|
32a87c3809bb4218abe3b75ca8b5a29d702eb325
|
[
"Apache-2.0"
] | null | null | null |
#include "peripheral_pinctrl.h"
#define bsPINCTRL_PULL_UP 0
#define bwPINCTRL_PULL_UP 1
#define bsPINCTRL_PULL_DOWN 1
#define bwPINCTRL_PULL_DOWN 1
#define bsPINCTRL_SCHMITT_TRIGGER 2
#define bwPINCTRL_SCHMITT_TRIGGER 1
#define bsPINCTRL_SLEW_RATE 3
#define bwPINCTRL_SLEW_RATE 1
#define bsPINCTRL_DRIVER_STRENGTH 4
#define bwPINCTRL_DRIVER_STRENGTH 3
#define bsPINCTRL_FUNC_MUX 8
#define bwPINCTRL_FUNC_MUX 2
#define PINCTRL_PULL_UP (1<<bsPINCTRL_PULL_UP)
#define PINCTRL_PULL_DOWN (1<<bsPINCTRL_PULL_DOWN)
#define PINCTRL_SCHMITT_TRIGGER (1<<bsPINCTRL_SCHMITT_TRIGGER)
#define PINCTRL_SLEW_RATE (1<<bsPINCTRL_SLEW_RATE)
#define PINCTRL_DS_0 0
#define PINCTRL_DS_1 1
#define PINCTRL_DS_2 2
#define PINCTRL_DS_4 4
#define PINCTRL_FUNC_0 0
#define PINCTRL_FUNC_1 1
#define PINCTRL_FUNC_2 2
#define PINCTRL_FUNC_3 3
#define OFFSET_MUX_CTRL0 (0x44)
#define IO_MUX_CTRL5 (0x54)
#define IO_MUX_CTRL6 (0x58)
#define IO_MUX_CTRL7 (0x68)
#define OFFSET_PWM_OUT_IO_SEL0 (0x80)
#define OFFSET_PWM_OUT_IO_SEL1 (0x84)
#define OFFSET_ANT_SEL (0x88)
void PINCTRL_SetPadMux(const uint8_t io_pin_index, const io_source_t source)
{
volatile uint32_t * reg = (volatile uint32_t *)(SYSCTRL_BASE + OFFSET_MUX_CTRL0) + (io_pin_index >> 3);
uint8_t offset = (io_pin_index & 0x7) << 2;
*reg = (*reg & ~(IO_SOURCE_MASK << offset)) | (source << offset);
}
void PINCTRL_SetPadPwmSel(const uint8_t io_pin_index, const uint8_t pwm1_gpio0)
{
volatile uint32_t * reg = (volatile uint32_t *)(SYSCTRL_BASE + IO_MUX_CTRL7);
if (pwm1_gpio0)
*reg = *reg | (1 << io_pin_index);
else
*reg = *reg & ~(1 << io_pin_index);
}
static int PINCTRL_AntSelIndex(const uint8_t io_pin_index)
{
switch (io_pin_index)
{
case 7:
return 0;
case 8:
return 1;
case 10:
return 2;
case 11:
return 3;
case 16:
return 4;
case 17:
return 5;
case 18:
return 6;
case 19:
return 7;
}
return -1;
}
void PINCTRL_SetGeneralPadMode(const uint8_t io_pin_index, const gio_mode_t mode,
const uint8_t pwm_channel, const uint8_t pwm_neg)
{
int index;
switch (mode)
{
case IO_MODE_GPIO:
if (io_pin_index <= 11)
{
volatile uint32_t * reg = (volatile uint32_t *)(SYSCTRL_BASE + IO_MUX_CTRL7);
*reg = *reg & ~(1 << io_pin_index);
}
index = PINCTRL_AntSelIndex(io_pin_index);
if (index >= 0)
{
volatile uint32_t * reg = (volatile uint32_t *)(SYSCTRL_BASE + OFFSET_ANT_SEL);
*reg = *reg & ~(1 << index);
}
break;
case IO_MODE_PWM:
if (io_pin_index <= 11)
{
uint8_t shift;
volatile uint32_t * reg = (volatile uint32_t *)(SYSCTRL_BASE + IO_MUX_CTRL7);
*reg |= 1 << io_pin_index;
if (io_pin_index <= 7)
{
reg = (volatile uint32_t *)(SYSCTRL_BASE + OFFSET_PWM_OUT_IO_SEL0);
shift = io_pin_index * 4;
}
else
{
reg = (volatile uint32_t *)(SYSCTRL_BASE + OFFSET_PWM_OUT_IO_SEL1);
shift = (io_pin_index - 8) * 4;
}
*reg &= ~(0xf << shift);
*reg |= (pwm_channel * 2 + pwm_neg) << shift;
}
break;
case IO_MODE_ANT_SEL:
index = PINCTRL_AntSelIndex(io_pin_index);
if (index >= 0)
{
volatile uint32_t * reg = (volatile uint32_t *)(SYSCTRL_BASE + OFFSET_ANT_SEL);
*reg |= 1 << index;
reg = (volatile uint32_t *)(SYSCTRL_BASE + IO_MUX_CTRL7);
*reg &= ~(1 << io_pin_index);
}
break;
}
}
static void PINCTRL_SelIn(const uint32_t mux_offset, uint8_t offset, const uint8_t io_pin_index)
{
volatile uint32_t * reg = (volatile uint32_t *)(SYSCTRL_BASE + mux_offset);
const uint32_t mask = 0x3f << offset;
*reg = (*reg & ~mask) | (io_pin_index << offset);
}
// Select input io_pin for UART RXD
void PINCTRL_SelUartRxdIn(const uart_port_t port, const uint8_t io_pin_index)
{
PINCTRL_SelIn(IO_MUX_CTRL5, port == UART_PORT_0 ? 0 : 18, io_pin_index);
}
// Select input io_pin for UART CTS
void PINCTRL_SelUartCtsIn(const uart_port_t port, const uint8_t io_pin_index)
{
PINCTRL_SelIn(IO_MUX_CTRL5, port == UART_PORT_0 ? 6 : 12, io_pin_index);
}
// Select input io_pin for SPI DI
void PINCTRL_SelSpiDiIn(const spi_port_t port, const uint8_t io_pin_index)
{
PINCTRL_SelIn(IO_MUX_CTRL6, port == SPI_PORT_0 ? 6 : 24, io_pin_index);
}
// Select input io_pin for SPI CLK
void PINCTRL_SelSpiClkIn(const spi_port_t port, const uint8_t io_pin_index)
{
if (port == SPI_PORT_1)
PINCTRL_SelIn(IO_MUX_CTRL5, 24, io_pin_index);
else
PINCTRL_SelIn(IO_MUX_CTRL6, 12, io_pin_index);
}
void PINCTRL_SelI2cSclIn(const i2c_port_t port, const uint8_t io_pin_index)
{
PINCTRL_SelIn(IO_MUX_CTRL6, port == I2C_PORT_0 ? 0 : 18, io_pin_index);
}
void PINCTRL_DisableAllInputs(void)
{
*(volatile uint32_t *)(SYSCTRL_BASE + IO_MUX_CTRL5) = 0x3fffffff;
*(volatile uint32_t *)(SYSCTRL_BASE + IO_MUX_CTRL6) = 0x3fffffff;
}
void PINCTRL_Pull(const uint8_t io_pin_index, const pinctrl_pull_mode_t mode)
{
volatile uint32_t *pe = (volatile uint32_t *)(APB_PINC_BASE + 0x10);
volatile uint32_t *ps = (volatile uint32_t *)(APB_PINC_BASE + 0x18);
if (PINCTRL_PULL_DISABLE == mode)
{
*pe = *pe & ~(1 << io_pin_index);
}
else
{
if (PINCTRL_PULL_UP == mode)
*ps = *ps | (1 << io_pin_index);
else
*ps = *ps & ~(1 << io_pin_index);
*pe = *pe | (1 << io_pin_index);
}
}
void PINCTRL_SetSlewRate(const uint8_t io_pin_index, const pinctrl_slew_rate_t rate)
{
volatile uint32_t *sr = (volatile uint32_t *)(APB_PINC_BASE + 0x20);
if (rate)
{
*sr = *sr | (1 << io_pin_index);
}
else
{
*sr = *sr & ~(1 << io_pin_index);
}
}
void PINCTRL_SetDriveStrength(const uint8_t io_pin_index, const pinctrl_drive_strenght_t strenght)
{
volatile uint32_t *ds0= (volatile uint32_t *)(APB_PINC_BASE + 0x28);
volatile uint32_t *ds1= (volatile uint32_t *)(APB_PINC_BASE + 0x30);
if (((int)strenght) & 1)
{
*ds0 = *ds0 | (1 << io_pin_index);
}
else
{
*ds0 = *ds0 & ~(1 << io_pin_index);
}
if (((int)strenght) & 2)
{
*ds1 = *ds1 | (1 << io_pin_index);
}
else
{
*ds1 = *ds1 & ~(1 << io_pin_index);
}
}
void PINCTRL_EnableAllAntSelPins(void)
{
int i;
static const int ant_pins[] = {7, 8, 10, 11, 16, 17, 18, 19};
for (i = 0; i < sizeof(ant_pins) / sizeof(ant_pins[0]); i++)
{
PINCTRL_SetPadMux(ant_pins[i], IO_SOURCE_GENERAL);
PINCTRL_SetGeneralPadMode(ant_pins[i], IO_MODE_ANT_SEL, 0, 0);
}
}
| 29.481781 | 107 | 0.602307 |
fe092d76da6dcd230746083ffff46c0f6f95e782
| 6,819 |
h
|
C
|
velox/dwio/dwrf/reader/SelectiveIntegerColumnReader.h
|
amitkdutta/velox
|
fc63e45bab6deda1d3ef5a77e743acd7d10ec79c
|
[
"Apache-2.0"
] | null | null | null |
velox/dwio/dwrf/reader/SelectiveIntegerColumnReader.h
|
amitkdutta/velox
|
fc63e45bab6deda1d3ef5a77e743acd7d10ec79c
|
[
"Apache-2.0"
] | null | null | null |
velox/dwio/dwrf/reader/SelectiveIntegerColumnReader.h
|
amitkdutta/velox
|
fc63e45bab6deda1d3ef5a77e743acd7d10ec79c
|
[
"Apache-2.0"
] | null | null | null |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "velox/dwio/dwrf/reader/SelectiveColumnReaderInternal.h"
namespace facebook::velox::dwrf {
// Abstract class for format and encoding-independent parts of reading ingeger
// columns.
class SelectiveIntegerColumnReader : public SelectiveColumnReader {
public:
SelectiveIntegerColumnReader(
std::shared_ptr<const dwio::common::TypeWithId> requestedType,
StripeStreams& stripe,
common::ScanSpec* scanSpec,
const TypePtr& type)
: SelectiveColumnReader(
std::move(requestedType),
stripe,
scanSpec,
type) {}
void getValues(RowSet rows, VectorPtr* result) override {
getIntValues(rows, nodeType_->type.get(), result);
}
protected:
// Switches based on filter type between different readHelper instantiations.
template <typename Reader, bool isDense, typename ExtractValues>
void processFilter(
common::Filter* filter,
ExtractValues extractValues,
RowSet rows);
// Switches based on the type of ValueHook between different readWithVisitor
// instantiations.
template <typename Reader, bool isDence>
void processValueHook(RowSet rows, ValueHook* hook);
// Instantiates a Visitor based on type, isDense, value processing.
template <
typename Reader,
typename TFilter,
bool isDense,
typename ExtractValues>
void
readHelper(common::Filter* filter, RowSet rows, ExtractValues extractValues);
// The common part of integer reading. calls the appropriate
// instantiation of processValueHook or processFilter based on
// possible value hook, filter and denseness.
template <typename Reader>
void readCommon(RowSet rows);
};
template <
typename Reader,
typename TFilter,
bool isDense,
typename ExtractValues>
void SelectiveIntegerColumnReader::readHelper(
common::Filter* filter,
RowSet rows,
ExtractValues extractValues) {
switch (valueSize_) {
case 2:
reinterpret_cast<Reader*>(this)->Reader::readWithVisitor(
rows,
ColumnVisitor<int16_t, TFilter, ExtractValues, isDense>(
*reinterpret_cast<TFilter*>(filter), this, rows, extractValues));
break;
case 4:
reinterpret_cast<Reader*>(this)->Reader::readWithVisitor(
rows,
ColumnVisitor<int32_t, TFilter, ExtractValues, isDense>(
*reinterpret_cast<TFilter*>(filter), this, rows, extractValues));
break;
case 8:
reinterpret_cast<Reader*>(this)->Reader::readWithVisitor(
rows,
ColumnVisitor<int64_t, TFilter, ExtractValues, isDense>(
*reinterpret_cast<TFilter*>(filter), this, rows, extractValues));
break;
default:
VELOX_FAIL("Unsupported valueSize_ {}", valueSize_);
}
}
template <typename Reader, bool isDense, typename ExtractValues>
void SelectiveIntegerColumnReader::processFilter(
common::Filter* filter,
ExtractValues extractValues,
RowSet rows) {
switch (filter ? filter->kind() : common::FilterKind::kAlwaysTrue) {
case common::FilterKind::kAlwaysTrue:
readHelper<Reader, common::AlwaysTrue, isDense>(
filter, rows, extractValues);
break;
case common::FilterKind::kIsNull:
filterNulls<int64_t>(
rows,
true,
!std::is_same<decltype(extractValues), DropValues>::value);
break;
case common::FilterKind::kIsNotNull:
if (std::is_same<decltype(extractValues), DropValues>::value) {
filterNulls<int64_t>(rows, false, false);
} else {
readHelper<Reader, common::IsNotNull, isDense>(
filter, rows, extractValues);
}
break;
case common::FilterKind::kBigintRange:
readHelper<Reader, common::BigintRange, isDense>(
filter, rows, extractValues);
break;
case common::FilterKind::kBigintValuesUsingHashTable:
readHelper<Reader, common::BigintValuesUsingHashTable, isDense>(
filter, rows, extractValues);
break;
case common::FilterKind::kBigintValuesUsingBitmask:
readHelper<Reader, common::BigintValuesUsingBitmask, isDense>(
filter, rows, extractValues);
break;
default:
readHelper<Reader, common::Filter, isDense>(filter, rows, extractValues);
break;
}
}
template <typename Reader, bool isDense>
void SelectiveIntegerColumnReader::processValueHook(
RowSet rows,
ValueHook* hook) {
switch (hook->kind()) {
case aggregate::AggregationHook::kSumBigintToBigint:
readHelper<Reader, common::AlwaysTrue, isDense>(
&alwaysTrue(),
rows,
ExtractToHook<aggregate::SumHook<int64_t, int64_t>>(hook));
break;
case aggregate::AggregationHook::kBigintMax:
readHelper<Reader, common::AlwaysTrue, isDense>(
&alwaysTrue(),
rows,
ExtractToHook<aggregate::MinMaxHook<int64_t, false>>(hook));
break;
case aggregate::AggregationHook::kBigintMin:
readHelper<Reader, common::AlwaysTrue, isDense>(
&alwaysTrue(),
rows,
ExtractToHook<aggregate::MinMaxHook<int64_t, true>>(hook));
break;
default:
readHelper<Reader, common::AlwaysTrue, isDense>(
&alwaysTrue(), rows, ExtractToGenericHook(hook));
}
}
template <typename Reader>
void SelectiveIntegerColumnReader::readCommon(RowSet rows) {
bool isDense = rows.back() == rows.size() - 1;
common::Filter* filter =
scanSpec_->filter() ? scanSpec_->filter() : &alwaysTrue();
if (scanSpec_->keepValues()) {
if (scanSpec_->valueHook()) {
if (isDense) {
processValueHook<Reader, true>(rows, scanSpec_->valueHook());
} else {
processValueHook<Reader, false>(rows, scanSpec_->valueHook());
}
return;
}
if (isDense) {
processFilter<Reader, true>(filter, ExtractToReader(this), rows);
} else {
processFilter<Reader, false>(filter, ExtractToReader(this), rows);
}
} else {
if (isDense) {
processFilter<Reader, true>(filter, DropValues(), rows);
} else {
processFilter<Reader, false>(filter, DropValues(), rows);
}
}
}
} // namespace facebook::velox::dwrf
| 32.942029 | 79 | 0.675319 |
38e497d2eb8646f57a55aa37d5ea05d9496ed955
| 3,348 |
h
|
C
|
HLPWebView/HLPWebView.h
|
hulop/HLPWebView
|
6d1e0715ff9968f4da24c0fb7d60143c3aaf4da5
|
[
"MIT"
] | null | null | null |
HLPWebView/HLPWebView.h
|
hulop/HLPWebView
|
6d1e0715ff9968f4da24c0fb7d60143c3aaf4da5
|
[
"MIT"
] | null | null | null |
HLPWebView/HLPWebView.h
|
hulop/HLPWebView
|
6d1e0715ff9968f4da24c0fb7d60143c3aaf4da5
|
[
"MIT"
] | 3 |
2019-08-20T15:41:47.000Z
|
2019-09-17T11:29:27.000Z
|
/*******************************************************************************
* Copyright (c) 2014, 2016 IBM Corporation, Carnegie Mellon University and others
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*******************************************************************************/
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
//! Project version number for HLPWebView.
FOUNDATION_EXPORT double HLPWebViewVersionNumber;
//! Project version string for HLPWebView.
FOUNDATION_EXPORT const unsigned char HLPWebViewVersionString[];
#import <HLPWebView/HLPWebViewCore.h>
typedef NS_ENUM(NSInteger, HLPWebviewControl) {
HLPWebviewControlRouteSearchOptionButton,
HLPWebviewControlRouteSearchButton,
HLPWebviewControlDoneButton,
HLPWebviewControlEndNavigation,
HLPWebviewControlBackToControl,
HLPWebviewControlNone,
};
@class HLPWebView;
@protocol HLPWebViewDelegate <HLPWebViewCoreDelegate>
@optional
- (void)webView:(HLPWebView *_Nonnull)webView didChangeLatitude:(double)lat longitude:(double)lng floor:(double)floor synchronized:(BOOL)sync;
- (void)webView:(HLPWebView *_Nonnull)webView didChangeBuilding:(NSString *_Nonnull)building;
- (void)webView:(HLPWebView *_Nonnull)webView didChangeUIPage:(NSString *_Nonnull)page inNavigation:(BOOL)inNavigation;
- (void)webView:(HLPWebView *_Nonnull)webView didFinishNavigationStart:(NSTimeInterval)start end:(NSTimeInterval)end from:(NSString *_Nonnull)from to:(NSString *_Nonnull)to;
@end
@protocol HLPTTSProtocol <NSObject>
@required
- (void)speak:(NSString *_Nonnull)text force:(BOOL)isForce completionHandler:(void(^_Nullable)(void))completion;
- (BOOL)isSpeaking;
- (void)vibrate;
@end
@interface HLPWebView : HLPWebViewCore <WKUIDelegate, WKNavigationDelegate>
@property (nullable, nonatomic, assign) id<HLPWebViewDelegate> delegate;
@property (nullable, nonatomic, assign) id<HLPTTSProtocol> tts;
@property (nonatomic) BOOL isDeveloperMode;
@property (nonatomic) BOOL isAccessible;
@property (nonatomic) NSString *_Nullable userMode;
- (void)triggerWebviewControl:(HLPWebviewControl)control;
- (void)sendData:(NSObject *_Nonnull)data withName:(NSString *_Nonnull)name;
- (void)getStateWithCompletionHandler:(void(^_Nonnull)(NSDictionary *_Nullable))completion;
- (void)setFullScreenForView:(UIView* _Nonnull)view;
@end
| 44.64 | 173 | 0.755078 |
7ab0604e0de21280d69773e061e6b7540e2dbf53
| 93 |
rb
|
Ruby
|
spec/models/api_user_spec.rb
|
BrycenGit/Dinder
|
06337d766fa781f2b61a100e31f8ce802fedc0a4
|
[
"Unlicense"
] | null | null | null |
spec/models/api_user_spec.rb
|
BrycenGit/Dinder
|
06337d766fa781f2b61a100e31f8ce802fedc0a4
|
[
"Unlicense"
] | null | null | null |
spec/models/api_user_spec.rb
|
BrycenGit/Dinder
|
06337d766fa781f2b61a100e31f8ce802fedc0a4
|
[
"Unlicense"
] | null | null | null |
require 'rails_helper'
describe ApiUser do
it { should validate_presence_of :user_id }
end
| 18.6 | 45 | 0.795699 |
1624310ed265b7f1d8eaeb31fa8dbc01289b419a
| 1,318 |
c
|
C
|
Labs/Lab1/1.03.c
|
ZamaPower/Algorithms-ProgrammingLabs
|
c32c6571aa3bfc256d9c1251c93f4a9a589d12be
|
[
"Unlicense"
] | null | null | null |
Labs/Lab1/1.03.c
|
ZamaPower/Algorithms-ProgrammingLabs
|
c32c6571aa3bfc256d9c1251c93f4a9a589d12be
|
[
"Unlicense"
] | null | null | null |
Labs/Lab1/1.03.c
|
ZamaPower/Algorithms-ProgrammingLabs
|
c32c6571aa3bfc256d9c1251c93f4a9a589d12be
|
[
"Unlicense"
] | null | null | null |
/* Exercise 03
-----------
Write a C program able to:
- Read a matrix m1 of R rows and C columns of integer values
- Compute a matrix m2 of R rows and C columns such that
- m2[i][j] is equal to zero
if m1[i][j] is equal to zero.
- m2[i][j] is the factorial number of -m1[i][j]
if m1[i][j] is a negative number.
- m2[i][j] is the smallest power of 10 larger than m1[r][j]
if m1[i][j] is a positive number.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define R 5
#define C 5
unsigned factorial(int n);
int findclosepower(int n);
int main(int argc, char const *argv[]) {
int m1[R][C],m2[R][C];
for (int i=0; i<R; i++) {
for (int j=0; j<C; j++) {
fscanf(stdin, "%d",&m1[i][j]);
if (m1[i][j]== 0) {
m2[i][j]=0;
}
if (m1[i][j]<0) {
m2[i][j]= factorial(m1[i][j]);
}
if (m1[i][j]>0) {
m2[i][j]= findclosepower(m1[i][j]);
}
}
}
return EXIT_SUCCESS;
}
unsigned factorial(int n)
{
n=abs(n);
if (n == 1)
return 1;
else
return n * factorial(n - 1);
}
int findclosepower(int n){
int power=1;
while (power<n) {
power=power*10;
}
return (power);
}
| 19.671642 | 61 | 0.49393 |
9690547d0923cf3ec9e74827cfc4eba238c12a0d
| 101 |
htm
|
HTML
|
index.htm
|
jhuamani/jhuamani.github.io
|
9d768ded0e0591a7de9a42be73c7d1aae7ca1032
|
[
"MIT"
] | null | null | null |
index.htm
|
jhuamani/jhuamani.github.io
|
9d768ded0e0591a7de9a42be73c7d1aae7ca1032
|
[
"MIT"
] | null | null | null |
index.htm
|
jhuamani/jhuamani.github.io
|
9d768ded0e0591a7de9a42be73c7d1aae7ca1032
|
[
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html>
<head>
<title>Hello!</title>
</head>
<body>
<h1>Anays!</h1>
</body>
</html>
| 8.416667 | 21 | 0.584158 |
2c21e63708545cfabfcaf25bf85f9fd9ce49c0b5
| 2,242 |
swift
|
Swift
|
Assignment II_More Memorize/Memorize/EmojiMemoryGame.swift
|
Qxt-circle/CS193p-Developing-Apps-for-iOS-Spring-2020
|
52c8477bbbd8434458bb3df5d95b054003f9f95c
|
[
"MIT"
] | null | null | null |
Assignment II_More Memorize/Memorize/EmojiMemoryGame.swift
|
Qxt-circle/CS193p-Developing-Apps-for-iOS-Spring-2020
|
52c8477bbbd8434458bb3df5d95b054003f9f95c
|
[
"MIT"
] | null | null | null |
Assignment II_More Memorize/Memorize/EmojiMemoryGame.swift
|
Qxt-circle/CS193p-Developing-Apps-for-iOS-Spring-2020
|
52c8477bbbd8434458bb3df5d95b054003f9f95c
|
[
"MIT"
] | null | null | null |
//
// EmojiMemorryGame.swift
// Memorize
//
// Created by Qxt_circle on 2020/9/25.
//
import SwiftUI
class EmojiMemoryGame: ObservableObject {
@Published private var model: MemoryGame<String> = createMemoryGame()
//MARK: - 6 different themes
static let themeOfHalloween = Theme<String>(themeName: "Halloween", cardContents: ["👻","🎃","🕷️","🍬","🥩"], numberOfPairsOfCards: nil, themeColor: .orange)
static let themeOfAnimals = Theme<String>(themeName: "Animals", cardContents: ["🐼", "🐶", "🐔", "🦊"], numberOfPairsOfCards: 4, themeColor: .gray)
static let themeOfSports = Theme<String>(themeName: "Sports", cardContents: ["⚽️", "🏀", "🏈", "⚾️", "🎾", "🏐", "🏉", "🥏", "🎱", "🏓", "🏸"], numberOfPairsOfCards: nil, themeColor: .red)
static let themeOfFaces = Theme<String>(themeName: "Faces", cardContents: ["😀","🤣", "🤬", "😇", "😎", "🥺", "🥰","😭"], numberOfPairsOfCards: 6, themeColor: .yellow)
static let themeOfFruit = Theme<String>(themeName: "Fruit", cardContents: ["🍎","🍐","🍊","🍋","🍇"], numberOfPairsOfCards: nil, themeColor: .green)
static let themeOfVehicles = Theme<String>(themeName: "Vehicles", cardContents: ["🚗","🚲","✈️","🚄","🚌"], numberOfPairsOfCards: nil, themeColor: .blue)
//MARK: - Initialization
static let themeList = [themeOfHalloween, themeOfAnimals, themeOfSports, themeOfFaces, themeOfFruit, themeOfVehicles]
static var themeChosen = themeList.randomElement()!
static func createMemoryGame() -> MemoryGame<String> {
var emojis: Array<String> = themeChosen.cardContents
emojis = emojis.shuffled()
//Have the emoji be randomly chosen
return MemoryGame<String>(numberOfPairsOfCards: themeChosen.numberOfPairsOfCards) { pairIndex in
return emojis[pairIndex]
}
}
//MARK: - Access to the Model
var cards: Array<MemoryGame<String>.Card> {
model.cards
}
var score: Int {
model.score
}
//MARK: - Intents
func choose(card: MemoryGame<String>.Card) {
model.choose(card: card)
}
func newGame() {
EmojiMemoryGame.themeChosen = EmojiMemoryGame.themeList.randomElement()!
model = EmojiMemoryGame.createMemoryGame()
}
}
| 40.763636 | 183 | 0.636931 |
26ee712dc242bc79e427a2f02a9a30b162387c43
| 3,688 |
kt
|
Kotlin
|
tflservice/src/test/kotlin/com/tiago/tflcodingchallenge/service/RoadStatusServiceImplTest.kt
|
tiagoalmeida92/TFLCodingChallenge
|
1c81ad27b8c576b76058c7e764d941f85d2cfb1d
|
[
"MIT"
] | null | null | null |
tflservice/src/test/kotlin/com/tiago/tflcodingchallenge/service/RoadStatusServiceImplTest.kt
|
tiagoalmeida92/TFLCodingChallenge
|
1c81ad27b8c576b76058c7e764d941f85d2cfb1d
|
[
"MIT"
] | null | null | null |
tflservice/src/test/kotlin/com/tiago/tflcodingchallenge/service/RoadStatusServiceImplTest.kt
|
tiagoalmeida92/TFLCodingChallenge
|
1c81ad27b8c576b76058c7e764d941f85d2cfb1d
|
[
"MIT"
] | null | null | null |
package com.tiago.tflcodingchallenge.service
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.given
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.verify
import com.tiago.tflcodingchallenge.service.responses.RawRoadStatusSuccessResponse
import com.tiago.tflcodingchallenge.testdata.RoadStatusBuilder.Companion.aRoadStatus
import com.tiago.usecases.tflcodingchallenge.dataaccess.FailureReason
import com.tiago.usecases.tflcodingchallenge.dataaccess.RoadStatusResponse
import io.reactivex.Single
import java.io.IOException
import okhttp3.ResponseBody
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import retrofit2.Response
class RoadStatusServiceImplTest {
private val roadStatusApi: RoadStatusApi = mock()
private val parser: RoadStatusResponseParser = mock()
private lateinit var roadStatusServiceImpl: RoadStatusService
@Before
fun setUp() {
roadStatusServiceImpl = RoadStatusService(roadStatusApi, parser)
}
@Test
fun givenRequestSucceeds_whenFetchRoadStatus_thenSuccessIsReturned() {
val roadId = "A1"
val roadStatus = aRoadStatus().withId(roadId).build()
val expectedResponse = RoadStatusResponse.createSuccess(roadStatus)
val rawRoadStatusSuccessResponse = RawRoadStatusSuccessResponse(
roadStatus.id,
roadStatus.roadName,
roadStatus.statusSeverity,
roadStatus.statusSeverityDescription
)
given(roadStatusApi.roadStatus(any()))
.willReturn(Single.just(Response.success(200, listOf(rawRoadStatusSuccessResponse))))
given(parser.parse(any())).willReturn(expectedResponse)
val response = roadStatusServiceImpl.getRoadStatus(roadId).blockingGet()
verify(roadStatusApi).roadStatus(roadId)
verify(parser).parse(any())
assertEquals(expectedResponse, response)
}
@Test
fun givenRequestReturns404_whenFetchRoadStatus_thenFailureNotFoundIsReturned() {
val roadId = "A1"
val expectedResponse = RoadStatusResponse.createFailure(
FailureReason.ROAD_NOT_FOUND)
given(roadStatusApi.roadStatus(any())).willReturn(
Single.just(Response.error(404, ResponseBody.create(null, "")))
)
given(parser.parse(any())).willReturn(expectedResponse)
val response = roadStatusServiceImpl.getRoadStatus(roadId).blockingGet()
verify(roadStatusApi).roadStatus(roadId)
verify(parser).parse(any())
assertEquals(expectedResponse, response)
}
@Test
fun givenRequestReturns500_whenFetchRoadStatus_thenFailureServerErrorIsReturned() {
val roadId = "A1"
val expectedResponse = RoadStatusResponse.createFailure(
FailureReason.SERVER_ERROR)
given(roadStatusApi.roadStatus(any())).willReturn(
Single.just(Response.error(500, ResponseBody.create(null, "")))
)
given(parser.parse(any())).willReturn(expectedResponse)
val response = roadStatusServiceImpl.getRoadStatus(roadId).blockingGet()
verify(roadStatusApi).roadStatus(roadId)
verify(parser).parse(any())
assertEquals(expectedResponse, response)
}
@Test
fun givenNetworkError_whenFetchRoadStatus_thenNetworkErrorReturned() {
val roadId = "A1"
given(roadStatusApi.roadStatus(any())).willReturn(
Single.error(IOException()))
val testSubscriber = roadStatusServiceImpl.getRoadStatus(roadId).test()
verify(roadStatusApi).roadStatus(roadId)
testSubscriber.assertError(IOException::class.java)
}
}
| 35.805825 | 97 | 0.730477 |
74c1d9735d74ac6eba2668e462928bb5c72c2c61
| 414 |
js
|
JavaScript
|
public/js/custom.js
|
jhonchristian/contosouniversity
|
8a5791d75030f86f20a8734187629d77d1eeda4f
|
[
"MIT"
] | null | null | null |
public/js/custom.js
|
jhonchristian/contosouniversity
|
8a5791d75030f86f20a8734187629d77d1eeda4f
|
[
"MIT"
] | null | null | null |
public/js/custom.js
|
jhonchristian/contosouniversity
|
8a5791d75030f86f20a8734187629d77d1eeda4f
|
[
"MIT"
] | null | null | null |
function hideSuffix()
{
var gender = document.getElementById('gender');
var divSuffix = document.getElementById('forSuffix');
var suffix = document.getElementById('suffix');
var classname = "hidden";
if(gender.value == "Female")
{
divSuffix.classList.add(classname);
suffix.selectedIndex = 0;
}
else
{
divSuffix.classList.remove(classname);
}
}
| 25.875 | 57 | 0.625604 |
7bc199dfb73ccaa782c38411c77329f2781107d3
| 232 |
asm
|
Assembly
|
03-hybrid/f.asm
|
MKuranowski/STUD-ARKO
|
24398315221203bd917f4b0005359d063423bbf8
|
[
"MIT"
] | null | null | null |
03-hybrid/f.asm
|
MKuranowski/STUD-ARKO
|
24398315221203bd917f4b0005359d063423bbf8
|
[
"MIT"
] | null | null | null |
03-hybrid/f.asm
|
MKuranowski/STUD-ARKO
|
24398315221203bd917f4b0005359d063423bbf8
|
[
"MIT"
] | null | null | null |
section .text
global f
f:
push ebp
mov ebp, esp
mov eax, [ebp+8] ; eax contains the first argument (char*)
begin: mov cl, [eax]
cmp cl, 0
jz end
add cl, 1
mov [eax], cl
inc eax
jmp begin
end: mov esp, ebp
pop ebp
ret
| 11.047619 | 59 | 0.642241 |
58df4a8f7249d0de4c7999b0a4f14b4b2049c703
| 2,403 |
lua
|
Lua
|
user_libraries/cf_chain_flow/appScripts/publishSubscribe.lua
|
glenn-edgar/lua_frame_work
|
417b72fe254a4359f89f77570733aead2552dfaf
|
[
"MIT"
] | null | null | null |
user_libraries/cf_chain_flow/appScripts/publishSubscribe.lua
|
glenn-edgar/lua_frame_work
|
417b72fe254a4359f89f77570733aead2552dfaf
|
[
"MIT"
] | null | null | null |
user_libraries/cf_chain_flow/appScripts/publishSubscribe.lua
|
glenn-edgar/lua_frame_work
|
417b72fe254a4359f89f77570733aead2552dfaf
|
[
"MIT"
] | null | null | null |
---
--- File: publishSubscribe.lua
--- Lua Publish Subscribe.lua
---
---
---
publishSubscribe = {}
publishSubscribe.queue = {}
function publishSubscribe.initializePublishSubscribe()
-- null function right now
end
function publishSubscribe.flush( event )
publishSubscribe.queue[event] = {}
end
function publishSubscribe.number( event )
local returnValue
if publishSubscribe.queue[event] == nil then
returnValue = 0
else
returnValue = #(publishSubscribe.queue[event])
end
return returnValue
end
function publishSubscribe.attach( event,queueId )
local temp
if publishSubscribe.queue[event] == nil then
publishSubscribe.queue[event] = {}
end
temp = publishSubscribe.queue[event]
temp[queueId] = 1
end
function publishSubscribe.remove( event, queueId )
local temp
if publishSubscribe.queue[event] ~= nil then
temp = publishSubscribe.queue[event]
temp[queueId] = nil
end
end
function publishSubscribe.post( event, data )
if publishSubscribe.queue[ event] ~= nil then
for i,k in pairs( publishSubscribe.queue[event]) do
eventSystem.queue(i,event,data)
end
end
end
function publishSubscribe.dump()
printf("dumping Publish Subscribe Queue")
for i,k in pairs(publishSubscribe.queue) do
print("event",i)
end
end
function publishSubscribe.dumpEventQueue( event )
print("dumping Publish Subscribe Queue for event ", event)
print("printing a list of queues")
if publishSubscribe.queue[event] == nil then
print("empty queue")
else
for i,k in pairs(publishSubscribe.queue[event]) do
print("queue ",i)
end
end
end
function publishSubscribe.description()
return "publish and subscribe functionality")
end
function publishSubscribe.help()
print(".init .. initialize")
print(".flush(event) .. remove subscribers for a specific event")
print(".number(event) .. number of subscribers for an event")
print(".attach(event, queue) .. attach a queue to an event ")
print(".remove(queue) .. removes a queue attached to an event")
print(".post(event,data) .. post an event ")
print(".dump() .. dump register events ")
print(".dumpEventQueue( event ) .. dump queue registered to an event")
print(".help() .. displays commands ")
end
| 21.455357 | 79 | 0.668747 |
7ba10a1ede9082a1c232f68acc0e9d8140d5be62
| 8,975 |
css
|
CSS
|
public/dist/ionic/rivvbutlfcti.css
|
jthoms1/react-ionic-conference-app
|
a643d704c208c3f1cd5687c7670880561d3bbba0
|
[
"MIT"
] | 1 |
2018-07-20T16:41:39.000Z
|
2018-07-20T16:41:39.000Z
|
public/dist/ionic/rivvbutlfcti.css
|
jthoms1/react-ionic-conference-app
|
a643d704c208c3f1cd5687c7670880561d3bbba0
|
[
"MIT"
] | null | null | null |
public/dist/ionic/rivvbutlfcti.css
|
jthoms1/react-ionic-conference-app
|
a643d704c208c3f1cd5687c7670880561d3bbba0
|
[
"MIT"
] | null | null | null |
/*!
* (C) Ionic http://ionicframework.com - MIT License
* Built with http://stenciljs.com
*/
ion-card{display:block;overflow:hidden}ion-card img{display:block;width:100%}.card-md{margin:10px;border-radius:2px;width:calc(100% - 20px);font-size:1.4rem;background:#fff;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12)}.card-md ion-list{margin-bottom:0}.card-md>.item-wrapper:last-child .item,.card-md>.item:last-child,.card-md>.item:last-child .item-inner{border-bottom:0}.card-md .item-md.item-block .item-inner{border:0}.card .note-md{font-size:1.3rem}.card-md h1{margin:0 0 2px;font-size:2.4rem;font-weight:400;color:#222}.card-md h2{margin:2px 0;font-size:1.6rem;font-weight:400;color:#222}.card-md h3,.card-md h4,.card-md h5,.card-md h6{margin:2px 0;font-size:1.4rem;font-weight:400;color:#222}.card-md p{margin:0 0 2px;font-size:1.4rem;font-weight:400;line-height:1.5;color:#222}.card-md+ion-card{margin-top:0}.card-md .text-md-primary{color:#327eff}.card-md-primary{color:#fff;background-color:#327eff}.card-md-primary h1,.card-md-primary h2,.card-md-primary h3,.card-md-primary h4,.card-md-primary h5,.card-md-primary h6,.card-md-primary p{color:#fff}.card-md-primary .text-md-primary{color:#327eff}.card-md-primary .text-md-secondary{color:#32db64}.card-md-primary .text-md-danger{color:#f53d3d}.card-md-primary .text-md-light{color:#f4f4f4}.card-md-primary .text-md-dark{color:#222}.card-md .text-md-secondary{color:#32db64}.card-md-secondary{color:#fff;background-color:#32db64}.card-md-secondary h1,.card-md-secondary h2,.card-md-secondary h3,.card-md-secondary h4,.card-md-secondary h5,.card-md-secondary h6,.card-md-secondary p{color:#fff}.card-md-secondary .text-md-primary{color:#327eff}.card-md-secondary .text-md-secondary{color:#32db64}.card-md-secondary .text-md-danger{color:#f53d3d}.card-md-secondary .text-md-light{color:#f4f4f4}.card-md-secondary .text-md-dark{color:#222}.card-md .text-md-danger{color:#f53d3d}.card-md-danger{color:#fff;background-color:#f53d3d}.card-md-danger h1,.card-md-danger h2,.card-md-danger h3,.card-md-danger h4,.card-md-danger h5,.card-md-danger h6,.card-md-danger p{color:#fff}.card-md-danger .text-md-primary{color:#327eff}.card-md-danger .text-md-secondary{color:#32db64}.card-md-danger .text-md-danger{color:#f53d3d}.card-md-danger .text-md-light{color:#f4f4f4}.card-md-danger .text-md-dark{color:#222}.card-md .text-md-light{color:#f4f4f4}.card-md-light{color:#000;background-color:#f4f4f4}.card-md-light h1,.card-md-light h2,.card-md-light h3,.card-md-light h4,.card-md-light h5,.card-md-light h6,.card-md-light p{color:#000}.card-md-light .text-md-primary{color:#327eff}.card-md-light .text-md-secondary{color:#32db64}.card-md-light .text-md-danger{color:#f53d3d}.card-md-light .text-md-light{color:#f4f4f4}.card-md-light .text-md-dark{color:#222}.card-md .text-md-dark{color:#222}.card-md-dark{color:#fff;background-color:#222}.card-md-dark h1,.card-md-dark h2,.card-md-dark h3,.card-md-dark h4,.card-md-dark h5,.card-md-dark h6,.card-md-dark p{color:#fff}.card-md-dark .text-md-primary{color:#327eff}.card-md-dark .text-md-secondary{color:#32db64}.card-md-dark .text-md-danger{color:#f53d3d}.card-md-dark .text-md-light{color:#f4f4f4}.card-md-dark .text-md-dark{color:#222}ion-card-content{display:block}.card-content-md{padding:13px 16px;font-size:1.4rem;line-height:1.5}.card-header-md+.card-content-md,.card-md .item+.card-content-md{padding-top:0}.card-md-primary .card-content-md{color:#fff}.card-md-primary .card-content-md-primary{color:#327eff}.card-md-primary .card-content-md-secondary{color:#32db64}.card-md-primary .card-content-md-danger{color:#f53d3d}.card-md-primary .card-content-md-light{color:#f4f4f4}.card-md-primary .card-content-md-dark{color:#222}.card-content-md-primary{color:#327eff}.card-md-secondary .card-content-md{color:#fff}.card-md-secondary .card-content-md-primary{color:#327eff}.card-md-secondary .card-content-md-secondary{color:#32db64}.card-md-secondary .card-content-md-danger{color:#f53d3d}.card-md-secondary .card-content-md-light{color:#f4f4f4}.card-md-secondary .card-content-md-dark{color:#222}.card-content-md-secondary{color:#32db64}.card-md-danger .card-content-md{color:#fff}.card-md-danger .card-content-md-primary{color:#327eff}.card-md-danger .card-content-md-secondary{color:#32db64}.card-md-danger .card-content-md-danger{color:#f53d3d}.card-md-danger .card-content-md-light{color:#f4f4f4}.card-md-danger .card-content-md-dark{color:#222}.card-content-md-danger{color:#f53d3d}.card-md-light .card-content-md{color:#000}.card-md-light .card-content-md-primary{color:#327eff}.card-md-light .card-content-md-secondary{color:#32db64}.card-md-light .card-content-md-danger{color:#f53d3d}.card-md-light .card-content-md-light{color:#f4f4f4}.card-md-light .card-content-md-dark{color:#222}.card-content-md-light{color:#f4f4f4}.card-md-dark .card-content-md{color:#fff}.card-md-dark .card-content-md-primary{color:#327eff}.card-md-dark .card-content-md-secondary{color:#32db64}.card-md-dark .card-content-md-danger{color:#f53d3d}.card-md-dark .card-content-md-light{color:#f4f4f4}.card-md-dark .card-content-md-dark{color:#222}.card-content-md-dark{color:#222}ion-card-header{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.card-header-md{font-size:1.6rem;color:#222;padding:16px}.card-md-primary .card-header-md{color:#fff}.card-md-primary .card-header-md-primary{color:#327eff}.card-md-primary .card-header-md-secondary{color:#32db64}.card-md-primary .card-header-md-danger{color:#f53d3d}.card-md-primary .card-header-md-light{color:#f4f4f4}.card-md-primary .card-header-md-dark{color:#222}.card-header-md-primary{color:#327eff}.card-md-secondary .card-header-md{color:#fff}.card-md-secondary .card-header-md-primary{color:#327eff}.card-md-secondary .card-header-md-secondary{color:#32db64}.card-md-secondary .card-header-md-danger{color:#f53d3d}.card-md-secondary .card-header-md-light{color:#f4f4f4}.card-md-secondary .card-header-md-dark{color:#222}.card-header-md-secondary{color:#32db64}.card-md-danger .card-header-md{color:#fff}.card-md-danger .card-header-md-primary{color:#327eff}.card-md-danger .card-header-md-secondary{color:#32db64}.card-md-danger .card-header-md-danger{color:#f53d3d}.card-md-danger .card-header-md-light{color:#f4f4f4}.card-md-danger .card-header-md-dark{color:#222}.card-header-md-danger{color:#f53d3d}.card-md-light .card-header-md{color:#000}.card-md-light .card-header-md-primary{color:#327eff}.card-md-light .card-header-md-secondary{color:#32db64}.card-md-light .card-header-md-danger{color:#f53d3d}.card-md-light .card-header-md-light{color:#f4f4f4}.card-md-light .card-header-md-dark{color:#222}.card-header-md-light{color:#f4f4f4}.card-md-dark .card-header-md{color:#fff}.card-md-dark .card-header-md-primary{color:#327eff}.card-md-dark .card-header-md-secondary{color:#32db64}.card-md-dark .card-header-md-danger{color:#f53d3d}.card-md-dark .card-header-md-light{color:#f4f4f4}.card-md-dark .card-header-md-dark{color:#222}.card-header-md-dark{color:#222}ion-card-title{display:block}.card-title-md{display:block;font-size:2.4rem;line-height:1.2;color:#222;margin:2px 0;padding:8px 0}.card-md-primary .card-title-md{color:#fff}.card-md-primary .card-title-md-primary{color:#327eff}.card-md-primary .card-title-md-secondary{color:#32db64}.card-md-primary .card-title-md-danger{color:#f53d3d}.card-md-primary .card-title-md-light{color:#f4f4f4}.card-md-primary .card-title-md-dark{color:#222}.card-title-md-primary{color:#327eff}.card-md-secondary .card-title-md{color:#fff}.card-md-secondary .card-title-md-primary{color:#327eff}.card-md-secondary .card-title-md-secondary{color:#32db64}.card-md-secondary .card-title-md-danger{color:#f53d3d}.card-md-secondary .card-title-md-light{color:#f4f4f4}.card-md-secondary .card-title-md-dark{color:#222}.card-title-md-secondary{color:#32db64}.card-md-danger .card-title-md{color:#fff}.card-md-danger .card-title-md-primary{color:#327eff}.card-md-danger .card-title-md-secondary{color:#32db64}.card-md-danger .card-title-md-danger{color:#f53d3d}.card-md-danger .card-title-md-light{color:#f4f4f4}.card-md-danger .card-title-md-dark{color:#222}.card-title-md-danger{color:#f53d3d}.card-md-light .card-title-md{color:#000}.card-md-light .card-title-md-primary{color:#327eff}.card-md-light .card-title-md-secondary{color:#32db64}.card-md-light .card-title-md-danger{color:#f53d3d}.card-md-light .card-title-md-light{color:#f4f4f4}.card-md-light .card-title-md-dark{color:#222}.card-title-md-light{color:#f4f4f4}.card-md-dark .card-title-md{color:#fff}.card-md-dark .card-title-md-primary{color:#327eff}.card-md-dark .card-title-md-secondary{color:#32db64}.card-md-dark .card-title-md-danger{color:#f53d3d}.card-md-dark .card-title-md-light{color:#f4f4f4}.card-md-dark .card-title-md-dark{color:#222}.card-title-md-dark{color:#222}ion-card-content.💎,ion-card-header.💎,ion-card-title.💎,ion-card.💎{visibility:inherit}
| 1,795 | 8,879 | 0.762563 |
fe419b3fb741808459dc64b3c0b5df01321c3878
| 335 |
h
|
C
|
XCCuke/XCCuke.h
|
sshrpe/XCCuke
|
036e2e5725e7a0f6ede13187537f0ce9e4e8b6a9
|
[
"Apache-2.0"
] | 4 |
2016-02-01T19:54:54.000Z
|
2016-03-14T12:02:45.000Z
|
XCCuke/XCCuke.h
|
sshrpe/XCCuke
|
036e2e5725e7a0f6ede13187537f0ce9e4e8b6a9
|
[
"Apache-2.0"
] | null | null | null |
XCCuke/XCCuke.h
|
sshrpe/XCCuke
|
036e2e5725e7a0f6ede13187537f0ce9e4e8b6a9
|
[
"Apache-2.0"
] | null | null | null |
//
// XCCuke.h
// XCCuke
//
// Created by Stuart Sharpe on 14/02/2015.
// Copyright (c) 2015 initWithStyle. All rights reserved.
//
#import <XCCuke/XCQTestSuite.h>
#import <XCCuke/XCQScenarioTestSuite.h>
#import <XCCuke/XCQFeature.h>
#import <XCCuke/XCQScenario.h>
#import <XCCuke/XCQStep.h>
#import <XCCuke/XCQStepDefinition.h>
| 20.9375 | 58 | 0.725373 |
116c31e417de255dd31b9fbb524723d94d783bcc
| 1,778 |
rs
|
Rust
|
src/dio/peout.rs
|
klanmiko/msp432p401r
|
f21410cf79fa268fe78714b7e8a367c10374055a
|
[
"MIT"
] | null | null | null |
src/dio/peout.rs
|
klanmiko/msp432p401r
|
f21410cf79fa268fe78714b7e8a367c10374055a
|
[
"MIT"
] | null | null | null |
src/dio/peout.rs
|
klanmiko/msp432p401r
|
f21410cf79fa268fe78714b7e8a367c10374055a
|
[
"MIT"
] | null | null | null |
#[doc = "Reader of register PEOUT"]
pub type R = crate::R<u16, super::PEOUT>;
#[doc = "Writer for register PEOUT"]
pub type W = crate::W<u16, super::PEOUT>;
#[doc = "Register PEOUT `reset()`'s with value 0"]
impl crate::ResetValue for super::PEOUT {
type Type = u16;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `P9OUT`"]
pub type P9OUT_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `P9OUT`"]
pub struct P9OUT_W<'a> {
w: &'a mut W,
}
impl<'a> P9OUT_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0xff) | ((value as u16) & 0xff);
self.w
}
}
#[doc = "Reader of field `P10OUT`"]
pub type P10OUT_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `P10OUT`"]
pub struct P10OUT_W<'a> {
w: &'a mut W,
}
impl<'a> P10OUT_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0xff << 8)) | (((value as u16) & 0xff) << 8);
self.w
}
}
impl R {
#[doc = "Bits 0:7 - Port 9 Output"]
#[inline(always)]
pub fn p9out(&self) -> P9OUT_R {
P9OUT_R::new((self.bits & 0xff) as u8)
}
#[doc = "Bits 8:15 - Port 10 Output"]
#[inline(always)]
pub fn p10out(&self) -> P10OUT_R {
P10OUT_R::new(((self.bits >> 8) & 0xff) as u8)
}
}
impl W {
#[doc = "Bits 0:7 - Port 9 Output"]
#[inline(always)]
pub fn p9out(&mut self) -> P9OUT_W {
P9OUT_W { w: self }
}
#[doc = "Bits 8:15 - Port 10 Output"]
#[inline(always)]
pub fn p10out(&mut self) -> P10OUT_W {
P10OUT_W { w: self }
}
}
| 27.353846 | 84 | 0.545557 |
6b724022497479505a15c7eb9e91734e01e1fb91
| 292 |
h
|
C
|
Lamp/src/Lamp/AssetSystem/RenderGraphLoader.h
|
ChunkTreasure1/Lamp
|
65be1544322949d6640e1fd108ed5a018387d0eb
|
[
"MIT"
] | 2 |
2021-09-13T17:37:34.000Z
|
2021-11-17T18:52:42.000Z
|
Lamp/src/Lamp/AssetSystem/RenderGraphLoader.h
|
ChunkTreasure1/Lamp
|
65be1544322949d6640e1fd108ed5a018387d0eb
|
[
"MIT"
] | 20 |
2020-09-30T13:44:46.000Z
|
2021-12-03T14:30:04.000Z
|
Lamp/src/Lamp/AssetSystem/RenderGraphLoader.h
|
ChunkTreasure1/Lamp
|
65be1544322949d6640e1fd108ed5a018387d0eb
|
[
"MIT"
] | null | null | null |
#pragma once
#include "AssetLoader.h"
namespace Lamp
{
class RenderNode;
class RenderGraphLoader : public AssetLoader
{
public:
virtual void Save(const Ref<Asset>& asset) const override;
virtual bool Load(const std::filesystem::path& path, Ref<Asset>& asset) const override;
};
}
| 18.25 | 89 | 0.736301 |
9cf8636648858de15c2c1b51d5e8d151c6bf9d10
| 4,404 |
swift
|
Swift
|
musli/Classes/StepItem.swift
|
CommonSenseDTU/musli
|
0dfaac1e5fc4f2385340c3baf79b0029c891b9ed
|
[
"MIT"
] | null | null | null |
musli/Classes/StepItem.swift
|
CommonSenseDTU/musli
|
0dfaac1e5fc4f2385340c3baf79b0029c891b9ed
|
[
"MIT"
] | null | null | null |
musli/Classes/StepItem.swift
|
CommonSenseDTU/musli
|
0dfaac1e5fc4f2385340c3baf79b0029c891b9ed
|
[
"MIT"
] | null | null | null |
//
// StepItem.swift
// Pods
//
// Created by Anders Borch on 4/20/17.
//
//
import Foundation
import ResearchKit
import RestKit
open class StepItem: NSObject {
public var id = ""
public var format = ""
public var question = ""
public var imageUrls = [URL]()
public var selectedImageUrls = [URL]()
public var values = [String]()
public static let attributeMap: Dictionary<String, String> = [
"id": "id",
"format": "format",
"question": "question",
"urls": "imageUrls",
"selected_urls": "selecteImageUrls",
"values": "values"
]
internal static let mapping: RKObjectMapping = {
let mapping = RKObjectMapping(for: StepItem.self)!
mapping.addAttributeMappings(from: StepItem.attributeMap)
return mapping
}()
/*
"horizontalscale"
"boolean"
"picker"
"singletextchoice"
"multitextchoice"
"numeric"
"timeofday"
"date"
"textarea"
"textinput"
"validated"
"verticalscale"
"email"
"location"
*/
internal var visualFormat: ORKAnswerFormat? {
switch format {
case "horizontalscale":
return ORKAnswerFormat.scale(withMaximumValue: 10,
minimumValue: 1,
defaultValue: 5,
step: 1,
vertical: false,
maximumValueDescription: "",
minimumValueDescription: "")
case "boolean":
return ORKAnswerFormat.booleanAnswerFormat()
case "picker":
return ORKAnswerFormat.valuePickerAnswerFormat(with: [ORKTextChoice(text: "", value: "" as NSCoding & NSCopying & NSObjectProtocol)])
case "singletextchoice":
return ORKAnswerFormat.choiceAnswerFormat(with: .singleChoice, textChoices: [ORKTextChoice(text: question, value: "" as NSCoding & NSCopying & NSObjectProtocol)])
case "multitextchoice":
return ORKAnswerFormat.choiceAnswerFormat(with: .singleChoice, textChoices: [ORKTextChoice(text: question, value: "" as NSCoding & NSCopying & NSObjectProtocol)])
case "numeric":
return ORKAnswerFormat.integerAnswerFormat(withUnit: nil)
case "timeofday":
return ORKAnswerFormat.timeOfDayAnswerFormat()
case "date":
return ORKAnswerFormat.dateAnswerFormat()
case "textarea":
return ORKAnswerFormat.textAnswerFormat(withMaximumLength: 0)
case "textinput":
let format = ORKAnswerFormat.textAnswerFormat(withMaximumLength: 0)
format.multipleLines = false
return format
//case "validated":
case "verticalscale":
return ORKAnswerFormat.scale(withMaximumValue: 10,
minimumValue: 1,
defaultValue: 5,
step: 1,
vertical: true,
maximumValueDescription: "",
minimumValueDescription: "")
case "email":
return ORKAnswerFormat.emailAnswerFormat()
case "location":
return ORKAnswerFormat.locationAnswerFormat()
case "imagechoice":
var choices = [ORKImageChoice]()
for index in 0..<imageUrls.count {
choices.append(ORKImageChoice(normalImageURL: imageUrls[index],
selectedImageURL: selectedImageUrls[index],
placeHolderImage: nil,
selectedPlaceHolderImage: nil,
text: nil,
value: values[index] as NSCoding & NSCopying & NSObjectProtocol))
}
return ORKAnswerFormat.choiceAnswerFormat(with: choices)
default:
return nil
}
}
public var visual: ORKFormItem {
return ORKFormItem(identifier: id,
text: question,
answerFormat: visualFormat)
}
}
| 37.008403 | 174 | 0.527929 |
eb0a4e3cc6d05d8bd2c78a6142f1d20756c235ea
| 125 |
asm
|
Assembly
|
libsrc/_DEVELOPMENT/font/fzx/fonts/dkud2/Bold/_ff_dkud2_UltraBold.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
libsrc/_DEVELOPMENT/font/fzx/fonts/dkud2/Bold/_ff_dkud2_UltraBold.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
libsrc/_DEVELOPMENT/font/fzx/fonts/dkud2/Bold/_ff_dkud2_UltraBold.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
SECTION rodata_font_fzx
PUBLIC _ff_dkud2_UltraBold
_ff_dkud2_UltraBold:
BINARY "font/fzx/fonts/dkud2/Bold/ultrabold.fzx"
| 13.888889 | 48 | 0.84 |
ebf80312d223d289afa10a7538c1449adfecbde1
| 638 |
kt
|
Kotlin
|
app/src/main/java/io/aethibo/fireshare/usecases/FeedAddLike.kt
|
primepixel/Fireshare
|
137d534bccba6e24073de7f01dd0a8aa9e569cba
|
[
"Apache-2.0"
] | 1 |
2021-04-06T16:29:55.000Z
|
2021-04-06T16:29:55.000Z
|
app/src/main/java/io/aethibo/fireshare/usecases/FeedAddLike.kt
|
primepixel/Fireshare
|
137d534bccba6e24073de7f01dd0a8aa9e569cba
|
[
"Apache-2.0"
] | 2 |
2021-04-17T09:18:56.000Z
|
2021-04-17T09:22:01.000Z
|
app/src/main/java/io/aethibo/fireshare/usecases/FeedAddLike.kt
|
primepixel/Fireshare
|
137d534bccba6e24073de7f01dd0a8aa9e569cba
|
[
"Apache-2.0"
] | 1 |
2021-05-26T16:02:06.000Z
|
2021-05-26T16:02:06.000Z
|
/*
* Created by Karic Kenan on 21.3.2021
* Copyright (c) 2021 . All rights reserved.
*/
package io.aethibo.fireshare.usecases
import io.aethibo.fireshare.data.remote.main.MainRepository
import io.aethibo.fireshare.framework.utils.Resource
interface FeedAddLikeUseCase {
suspend operator fun invoke(ownerId: String, postId: String, postImage: String): Resource<Any>
}
class FeedAddLikeUseCaseImpl(private val repository: MainRepository) : FeedAddLikeUseCase {
override suspend fun invoke(ownerId: String, postId: String, postImage: String): Resource<Any> =
repository.addLikeToFeed(ownerId, postId, postImage)
}
| 33.578947 | 100 | 0.769592 |
56f4e5dc454e9e31512ccd489868af846b08d2dc
| 561 |
sql
|
SQL
|
cat-server/src/main/resources/db/migration/V20200923110000__add_view_for_code_text.sql
|
baloise/cut
|
d38479b9957f680ea67b436c3395b255f16e4bb4
|
[
"Apache-2.0"
] | 4 |
2019-10-14T09:41:50.000Z
|
2020-09-28T08:19:25.000Z
|
cat-server/src/main/resources/db/migration/V20200923110000__add_view_for_code_text.sql
|
baloise/cut
|
d38479b9957f680ea67b436c3395b255f16e4bb4
|
[
"Apache-2.0"
] | 37 |
2019-10-25T20:20:34.000Z
|
2022-02-19T00:13:43.000Z
|
cat-server/src/main/resources/db/migration/V20200923110000__add_view_for_code_text.sql
|
baloise/cut
|
d38479b9957f680ea67b436c3395b255f16e4bb4
|
[
"Apache-2.0"
] | null | null | null |
CREATE VIEW CodeText (id, type_id, value, name, text_nr, text_d, text_f, text_i, text_e, creator, created) As
SELECT concat_ws(':', cw.codetyp_nr, cw.wert), cw.codetyp_nr, cw.wert, cw.name, ct.text_nr, t.wert_d, t.wert_f, t.wert_i, t.wert_e, ct.erfasser, ct.erfassungszeit
FROM tbti_codetext AS ct
INNER JOIN tbti_codewert AS cw
ON ct.codetyp_nr = cw.codetyp_nr AND ct.codewert = cw.wert
INNER JOIN tbti_text AS t
ON t.lauf_nr = ct.text_nr AND ct.stil_nr = 1 AND t.typ = 3
ORDER BY cw.codetyp_nr, cw.wert;
| 70.125 | 162 | 0.679144 |
c4b69c47fe7bf668f329721f8de80cf1896efe43
| 200 |
swift
|
Swift
|
Code/SwiftObserver/Variable/Variable+Comparable.swift
|
flowtoolz/SwiftObserver
|
37e56842fbdde40e5f42528cf7c02010156fcf38
|
[
"MIT"
] | 15 |
2018-05-15T09:07:42.000Z
|
2022-01-10T11:49:44.000Z
|
Code/SwiftObserver/Variable/Variable+Comparable.swift
|
flowtoolz/SwiftObserver
|
37e56842fbdde40e5f42528cf7c02010156fcf38
|
[
"MIT"
] | 2 |
2019-01-15T09:30:57.000Z
|
2019-12-14T18:02:41.000Z
|
Code/SwiftObserver/Variable/Variable+Comparable.swift
|
flowtoolz/SwiftObserver
|
37e56842fbdde40e5f42528cf7c02010156fcf38
|
[
"MIT"
] | 1 |
2018-12-19T12:12:24.000Z
|
2018-12-19T12:12:24.000Z
|
extension Var: Comparable where Value: Comparable
{
public static func < (lhs: Variable<Value>,
rhs: Variable<Value>) -> Bool
{
lhs.value < rhs.value
}
}
| 22.222222 | 55 | 0.55 |
2fb312bcf8f3a207d2a7c744014823b84323d945
| 217 |
rs
|
Rust
|
cdc-mysql/src/messages/mod.rs
|
warycat/fluvio-demo-apps-rust
|
0591c9b765474cf3954def0fb432dae2d00844d3
|
[
"Apache-2.0"
] | 5 |
2020-10-09T19:24:15.000Z
|
2022-03-17T13:10:34.000Z
|
cdc-mysql/src/messages/mod.rs
|
warycat/fluvio-demo-apps-rust
|
0591c9b765474cf3954def0fb432dae2d00844d3
|
[
"Apache-2.0"
] | 5 |
2020-10-13T15:18:33.000Z
|
2021-03-31T14:32:22.000Z
|
cdc-mysql/src/messages/mod.rs
|
warycat/fluvio-demo-apps-rust
|
0591c9b765474cf3954def0fb432dae2d00844d3
|
[
"Apache-2.0"
] | 4 |
2021-02-09T13:01:14.000Z
|
2021-03-31T14:12:19.000Z
|
mod bn_file;
mod bn_message;
mod flv_message;
mod operations;
mod row_ops;
mod values;
pub use bn_file::*;
pub use bn_message::*;
pub use flv_message::*;
pub use operations::*;
pub use row_ops::*;
pub use values::*;
| 15.5 | 23 | 0.718894 |
9aae0f2375eefaac88c4d9957a049731ab4c7179
| 338 |
css
|
CSS
|
css/base/_variables.css
|
BrianQMclaren/Real-Estate-App
|
3948925ac34ccf575d126ce1199837b743e59d6d
|
[
"MIT"
] | 9 |
2018-01-25T20:49:32.000Z
|
2020-06-26T23:12:30.000Z
|
css/base/_variables.css
|
BrianQMclaren/Real-Estate-App
|
3948925ac34ccf575d126ce1199837b743e59d6d
|
[
"MIT"
] | null | null | null |
css/base/_variables.css
|
BrianQMclaren/Real-Estate-App
|
3948925ac34ccf575d126ce1199837b743e59d6d
|
[
"MIT"
] | 15 |
2018-01-25T20:49:43.000Z
|
2021-01-09T22:57:02.000Z
|
$pink: #ff718e;
$purple: #0c002b;
$blue: #4dc0f9;
$offwhite: #fffeff;
$offgray: #f9f8f4;
$gray: #faf7f5;
$lightgray: #dadde2;
$darkgray: #828d9d;
$boldgray: #50555c;
// Grid
$g-col-width: 65px;
$g-gutter-width: 20px;
$g-col-count: 12;
$g-cont-max-w: 1050px;
// Breakpoints
$brkpoint-sm: 1px;
$brkpoint-md: 768px;
$brkpoint-lg: 1100px;
| 15.363636 | 22 | 0.668639 |
b99f782a725a2e23ff540b06fe3051f2cd0e6191
| 700 |
h
|
C
|
Sources/ViewModels_ObjC/ViewModels.h
|
hiep-nd/nd-mvvm
|
91a8e9d43bce21900f473a4ff537bbcd3baab71c
|
[
"MIT"
] | null | null | null |
Sources/ViewModels_ObjC/ViewModels.h
|
hiep-nd/nd-mvvm
|
91a8e9d43bce21900f473a4ff537bbcd3baab71c
|
[
"MIT"
] | null | null | null |
Sources/ViewModels_ObjC/ViewModels.h
|
hiep-nd/nd-mvvm
|
91a8e9d43bce21900f473a4ff537bbcd3baab71c
|
[
"MIT"
] | null | null | null |
//
// ViewModels.h
// NDMVVM
//
// Created by Nguyen Duc Hiep on 11/5/20.
//
#import <NDMVVM/ViewModels_NDAppearableItemViewModel.h>
#import <NDMVVM/ViewModels_NDContentHeightAdjustableItemViewModel.h>
#import <NDMVVM/ViewModels_NDContentHeightAdjustableViewModel.h>
#import <NDMVVM/ViewModels_NDItemViewModel.h>
#import <NDMVVM/ViewModels_NDListViewModel.h>
#import <NDMVVM/ViewModels_NDMutableListViewModel.h>
#import <NDMVVM/ViewModels_NDSelectableContentHeightAdjustableItemViewModel.h>
#import <NDMVVM/ViewModels_NDSelectableItemViewModel.h>
#import <NDMVVM/ViewModels_NDSelectableViewModel.h>
#import <NDMVVM/ViewModels_NDSingleSubItemViewModel.h>
#import <NDMVVM/ViewModels_NDViewModel.h>
| 36.842105 | 78 | 0.84 |
e73836a517d4626add1c3eee3c61f3898d7d8796
| 1,351 |
js
|
JavaScript
|
HttpServer/routes/register/asGuest.js
|
yasintuncel/BTO-Server-Node
|
3b06957b1639da92f9c2e2f76426e9060a38d8c8
|
[
"MIT"
] | null | null | null |
HttpServer/routes/register/asGuest.js
|
yasintuncel/BTO-Server-Node
|
3b06957b1639da92f9c2e2f76426e9060a38d8c8
|
[
"MIT"
] | 34 |
2022-01-02T18:12:23.000Z
|
2022-02-21T05:43:32.000Z
|
HttpServer/routes/register/asGuest.js
|
yasintuncel/BTO-Server-Node
|
3b06957b1639da92f9c2e2f76426e9060a38d8c8
|
[
"MIT"
] | null | null | null |
const config = require('../../config');
const createNewGuestUser = require('common/database/functions/createNewGuestUser');
const { User } = require('common/database/models/user');
const tokenGenerator = require('common/utils/tokenGenerator');
const asGuest = async function (req, res) {
const { nickName } = req.body;
if (!(nickName)) {
res.status(400).send("A nick name is required");
return;
}
try {
let registeredUser = await User.findOne({ 'uid': nickName });
if (registeredUser) {
let newToken = tokenGenerator(registeredUser._id, config.tokenScreetKey, config.tokenDuration);
registeredUser.token = newToken;
registeredUser.save();
res.status(200).json({ "token": newToken });
}
else {
const newUserStatus = await createNewGuestUser(nickName, config.tokenScreetKey, config.tokenDuration);
console.log(newUserStatus.message + ` Request ip: + ${req.ip}`);
if (newUserStatus.isCreated) {
res.status(200).json({ "token": newUserStatus.token });
}
else {
res.status(500).json(newUserStatus.message);
}
}
}
catch (e) {
res.status(500).json({ 'error': 'an unkown error' });
}
};
module.exports = asGuest;
| 36.513514 | 114 | 0.595855 |
9bee341f317ef6e3a40ff878d1f30c8fe9d513ca
| 355 |
js
|
JavaScript
|
src/index.js
|
DanielSilva33/API_saveUsers
|
ba014a8512793a4113a2b5ddb365ea041ebbf921
|
[
"MIT"
] | null | null | null |
src/index.js
|
DanielSilva33/API_saveUsers
|
ba014a8512793a4113a2b5ddb365ea041ebbf921
|
[
"MIT"
] | null | null | null |
src/index.js
|
DanielSilva33/API_saveUsers
|
ba014a8512793a4113a2b5ddb365ea041ebbf921
|
[
"MIT"
] | null | null | null |
const express = require('express');
const enderecoRoutes = require('./routes/enderecoUsuarios.routes');
const usuariosRoutes = require('./routes/usuarios.routes');
const app = express();
app.use(express.json());
app.use(enderecoRoutes);
app.use(usuariosRoutes);
app.listen(3333, () => {
console.log("Server is running, http://localhost:3333");
});
| 25.357143 | 67 | 0.712676 |
9c06f598ae50df2d9516b023910297e29948b6f7
| 794 |
js
|
JavaScript
|
src/Tests/Common/UI/Card/CardHeader.test.js
|
protofire/livepeer-alerts
|
ce5275d4d5cedaf718052df32f8fceb373839e43
|
[
"MIT"
] | 4 |
2019-01-29T20:56:34.000Z
|
2021-05-13T08:42:57.000Z
|
src/Tests/Common/UI/Card/CardHeader.test.js
|
protofire/livepeer-alerts-frontend
|
ce5275d4d5cedaf718052df32f8fceb373839e43
|
[
"MIT"
] | 63 |
2018-12-18T13:34:21.000Z
|
2022-01-20T17:04:27.000Z
|
src/Tests/Common/UI/Card/CardHeader.test.js
|
protofire/livepeer-alerts
|
ce5275d4d5cedaf718052df32f8fceb373839e43
|
[
"MIT"
] | 2 |
2018-12-19T14:05:58.000Z
|
2019-01-21T20:38:35.000Z
|
import React from 'react'
import Adapter from 'enzyme-adapter-react-16'
import { configure, mount } from 'enzyme'
import CardHeader from '../../../../Components/Common/UI/Card/CardHeader'
import render from 'react-test-renderer'
configure({ adapter: new Adapter() })
describe('CardHeader test', () => {
it(`Should render cardHeader`, () => {
// Given
const wrapper = mount(
<CardHeader>
<div />
</CardHeader>
)
// When
const cardAvatar = wrapper.find('CardHeader')
// Then
expect(cardAvatar).toHaveLength(1)
})
it(`Should render a cardHeader and check snapshot`, () => {
// Given
let wrapper = render.create(<CardHeader />)
// When
const tree = wrapper.toJSON()
// Then
expect(tree).toMatchSnapshot()
})
})
| 22.055556 | 73 | 0.623426 |
d5f1c976667830f29cd9dc55013bb29989458265
| 274 |
h
|
C
|
iOSProject/AllInCode/iOSTech/UI/UINavigationController/CustomNavigationBar/CPActivityController.h
|
RiverYangZiJiang/iOSAllInCode
|
cf174deb0332ad3899150afbfc35e87de104ca9a
|
[
"MIT"
] | 2 |
2019-03-09T09:19:55.000Z
|
2019-03-25T02:43:48.000Z
|
iOSProject/AllInCode/iOSTech/UI/UINavigationController/CustomNavigationBar/CPActivityController.h
|
RiverYangZiJiang/iOSAllInCode
|
cf174deb0332ad3899150afbfc35e87de104ca9a
|
[
"MIT"
] | null | null | null |
iOSProject/AllInCode/iOSTech/UI/UINavigationController/CustomNavigationBar/CPActivityController.h
|
RiverYangZiJiang/iOSAllInCode
|
cf174deb0332ad3899150afbfc35e87de104ca9a
|
[
"MIT"
] | 1 |
2019-03-25T02:43:54.000Z
|
2019-03-25T02:43:54.000Z
|
//
// CPActivityController.h
// ChargePlatform
//
// Created by HMDS on 2021/1/5.
// Copyright © 2021 EverGrande. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CPActivityController : UIViewController
@end
NS_ASSUME_NONNULL_END
| 14.421053 | 53 | 0.748175 |
f944d8038d041ae292ce2b3a4ba68d3870e2d45e
| 334 |
kt
|
Kotlin
|
FinFamily/src/main/java/com/bandtec/finfamily/utils/DateValidation.kt
|
Thiago-Kuhl/FinFamily
|
13b5d44e5cff959d3551db6fec6cf08a42ee422d
|
[
"MIT"
] | 1 |
2021-04-19T13:54:13.000Z
|
2021-04-19T13:54:13.000Z
|
FinFamily/src/main/java/com/bandtec/finfamily/utils/DateValidation.kt
|
Thiago-Kuhl/FinFamily
|
13b5d44e5cff959d3551db6fec6cf08a42ee422d
|
[
"MIT"
] | 1 |
2020-06-20T02:01:12.000Z
|
2020-06-20T02:01:12.000Z
|
FinFamily/src/main/java/com/bandtec/finfamily/utils/DateValidation.kt
|
Thiago-Kuhl/FinFamily
|
13b5d44e5cff959d3551db6fec6cf08a42ee422d
|
[
"MIT"
] | 1 |
2020-06-24T23:13:37.000Z
|
2020-06-24T23:13:37.000Z
|
package com.bandtec.finfamily.utils
import java.text.SimpleDateFormat
import java.util.*
object DateValidation {
fun isValid(birthday : String) : Boolean{
val sdf = SimpleDateFormat("dd/MM/yyyy")
val date = sdf.parse(birthday)
val currentDate = Date()
return !currentDate.before(date)
}
}
| 19.647059 | 48 | 0.670659 |
6b7e9bee0f8686f77c1680a2060f3234786421bd
| 1,709 |
c
|
C
|
srcs/pars/check_rotation.c
|
alexbayc/rtsept
|
f993bf22e348262dfec5ef1f7e6279c7909623db
|
[
"Apache-2.0"
] | null | null | null |
srcs/pars/check_rotation.c
|
alexbayc/rtsept
|
f993bf22e348262dfec5ef1f7e6279c7909623db
|
[
"Apache-2.0"
] | null | null | null |
srcs/pars/check_rotation.c
|
alexbayc/rtsept
|
f993bf22e348262dfec5ef1f7e6279c7909623db
|
[
"Apache-2.0"
] | 1 |
2019-09-28T11:47:23.000Z
|
2019-09-28T11:47:23.000Z
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_rotation.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: odale-dr <odale-dr@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/09/07 16:14:31 by odale-dr #+# #+# */
/* Updated: 2019/09/07 16:17:44 by odale-dr ### ########.fr */
/* */
/* ************************************************************************** */
#include "rtv1.h"
int check_rotation2(int i, int j, t_objpoint *f)
{
if (check_num_of_param(f->file[numb_of_line(i, j,
"x", f->file)], "x") != 0)
return (-1);
if (check_num_of_param(f->file[numb_of_line(i, j,
"y", f->file)], "y") != 0)
return (-1);
if (check_num_of_param(f->file[numb_of_line(i, j,
"z", f->file)], "z") != 0)
return (-1);
return (0);
}
int check_rotation(t_objpoint *f)
{
int i;
int j;
int k;
i = numb_of_line(f->start, f->end, "Rotation", f->file);
if ((j = find_end_of_block(i, f)) == -1)
{
ft_putstrv1("You have problem with block 'Rotation'");
return (-1);
}
if (repit(i, j, "x", f->file) != 1 ||
repit(i, j, "y", f->file) != 1 ||
repit(i, j, "z", f->file) != 1)
return (-1);
if (check_rotation2(i, j, f) != 0)
return (-1);
return (0);
}
| 34.877551 | 80 | 0.325336 |
07383124c7c12e1af62f09c4e6b08a56f0ea5e12
| 347 |
sql
|
SQL
|
BD/Laborator/lab04/12.sql
|
mihai-constantin/ACS
|
098c99d82dad8fb5d0e909da930c72f1185a99e2
|
[
"Apache-2.0"
] | null | null | null |
BD/Laborator/lab04/12.sql
|
mihai-constantin/ACS
|
098c99d82dad8fb5d0e909da930c72f1185a99e2
|
[
"Apache-2.0"
] | null | null | null |
BD/Laborator/lab04/12.sql
|
mihai-constantin/ACS
|
098c99d82dad8fb5d0e909da930c72f1185a99e2
|
[
"Apache-2.0"
] | null | null | null |
-- SELECT
-- id_ang AS ecuson,
-- nume,
-- functie,
-- salariu + nvl(comision, 0) AS "Venit lunar"
-- FROM angajati
-- WHERE id_ang IN (7499, 7902, 7876)
-- ORDER BY nume;
SELECT
id_ang AS ecuson,
nume,
functie,
salariu + nvl(comision, 0) AS "Venit lunar"
FROM angajati
WHERE id_ang = 7499 OR id_ang = 7902 OR id_ang = 7876
ORDER BY nume;
| 20.411765 | 53 | 0.674352 |
0b4772665a5a43688e79771eafbcfa9e4db57a1a
| 6,661 |
py
|
Python
|
postgres_connector/splitters.py
|
sandboxws/beam-postgres-connector
|
d08ed08e96991704fc234dd1e4d2ddf13f1885c1
|
[
"MIT"
] | null | null | null |
postgres_connector/splitters.py
|
sandboxws/beam-postgres-connector
|
d08ed08e96991704fc234dd1e4d2ddf13f1885c1
|
[
"MIT"
] | null | null | null |
postgres_connector/splitters.py
|
sandboxws/beam-postgres-connector
|
d08ed08e96991704fc234dd1e4d2ddf13f1885c1
|
[
"MIT"
] | null | null | null |
import re
from abc import ABCMeta, abstractmethod
from datetime import datetime
from typing import Callable, Iterator
from apache_beam.io import iobase
from apache_beam.io.range_trackers import (LexicographicKeyRangeTracker,
OffsetRangeTracker,
UnsplittableRangeTracker)
from dateutil.relativedelta import relativedelta
class BaseSplitter(metaclass=ABCMeta):
"""Splitters abstract class."""
def build_source(self, source):
"""Build source on runtime."""
self.source = source
@abstractmethod
def estimate_size(self):
"""Wrap :class:`~apache_beam.io.iobase.BoundedSource.estimate_size`"""
raise NotImplementedError()
@abstractmethod
def get_range_tracker(self, start_position, stop_position):
"""Wrap :class:`~apache_beam.io.iobase.BoundedSource.get_range_tracker`"""
raise NotImplementedError()
@abstractmethod
def read(self, range_tracker):
"""Wrap :class:`~apache_beam.io.iobase.BoundedSource.read`"""
raise NotImplementedError()
def split(self, desired_bundle_size, start_position=None, stop_position=None):
"""Wrap :class:`~apache_beam.io.iobase.BoundedSource.split`"""
raise NotImplementedError()
class DateSplitter(BaseSplitter):
"""Split bounded source by dates."""
pass
class IdsSplitter(BaseSplitter):
"""Split bounded source by any ids."""
def __init__(self, generate_ids_fn: Callable[[], Iterator], batch_size: int = 1000000):
self._generate_ids_fn = generate_ids_fn
self._batch_size = batch_size
def estimate_size(self):
# TODO: unify the method of estimating
return 0
def get_range_tracker(self, start_position, stop_position):
self._validate_query()
return LexicographicKeyRangeTracker(start_position, stop_position)
def read(self, range_tracker):
if range_tracker.start_position() is None:
ids = ",".join([f"'{id}'" for id in self._generate_ids_fn()])
else:
ids = range_tracker.start_position()
query = self.source.query.format(ids=ids)
for record in self.source.client.record_generator(query):
yield record
def split(self, desired_bundle_size, start_position=None, stop_position=None):
self._validate_query()
ids = []
for generated_id in self._generate_ids_fn():
ids.append(generated_id)
if len(ids) == self._batch_size:
yield self._create_bundle_source(desired_bundle_size, self.source, ids)
ids.clear()
yield self._create_bundle_source(desired_bundle_size, self.source, ids)
def _validate_query(self):
condensed_query = self.source.query.lower().replace(" ", "")
if re.search(r"notin\({ids}\)", condensed_query):
raise ValueError(f"Not support 'not in' phrase: {self.source.query}")
if not re.search(r"in\({ids}\)", condensed_query):
example = "SELECT * FROM tests WHERE id IN ({ids})"
raise ValueError(f"Require 'in' phrase and 'ids' key on query: {self.source.query}, e.g. '{example}'")
@staticmethod
def _create_bundle_source(desired_bundle_size, source, ids):
if isinstance(ids, list):
ids_str = ",".join([f"'{id}'" for id in ids])
elif isinstance(ids, str):
ids_str = ids
else:
raise ValueError(f"Unexpected ids: {ids}")
return iobase.SourceBundle(
weight=desired_bundle_size, source=source, start_position=ids_str, stop_position=None
)
class LimitOffsetSplitter(BaseSplitter):
"""Split bounded source by limit and offset."""
def __init__(self, batch_size: int = 1000000):
self._batch_size = batch_size
self._counts = 0
def estimate_size(self):
self._counts = self.source.client.counts_estimator(self.source.query)
return self._counts
def get_range_tracker(self, start_position, stop_position):
if self._counts == 0:
self._counts = self.source.client.counts_estimator(self.source.query)
if start_position is None:
start_position = 0
if stop_position is None:
stop_position = self._counts
return LexicographicKeyRangeTracker(start_position, stop_position)
def read(self, range_tracker):
offset, limit = range_tracker.start_position(), range_tracker.stop_position()
query = f"SELECT * FROM ({self.source.query}) as subq LIMIT {limit} OFFSET {offset}"
for record in self.source.client.record_generator(query):
yield record
def split(self, desired_bundle_size, start_position=None, stop_position=None):
if self._counts == 0:
self._counts = self.source.client.counts_estimator(self.source.query)
if start_position is None:
start_position = 0
if stop_position is None:
stop_position = self._counts
last_position = 0
for offset in range(start_position, stop_position, self._batch_size):
yield iobase.SourceBundle(
weight=desired_bundle_size, source=self.source, start_position=offset, stop_position=self._batch_size
)
last_position = offset + self._batch_size
yield iobase.SourceBundle(
weight=desired_bundle_size,
source=self.source,
start_position=last_position + 1,
stop_position=stop_position,
)
class NoSplitter(BaseSplitter):
"""No split bounded source so not work parallel."""
def estimate_size(self):
return self.source.client.rough_counts_estimator(self.source.query)
def get_range_tracker(self, start_position, stop_position):
if start_position is None:
start_position = 0
if stop_position is None:
stop_position = OffsetRangeTracker.OFFSET_INFINITY
return UnsplittableRangeTracker(OffsetRangeTracker(start_position, stop_position))
def read(self, range_tracker):
for record in self.source.client.record_generator(self.source.query):
yield record
def split(self, desired_bundle_size, start_position=None, stop_position=None):
if start_position is None:
start_position = 0
if stop_position is None:
stop_position = OffsetRangeTracker.OFFSET_INFINITY
yield iobase.SourceBundle(
weight=desired_bundle_size, source=self.source, start_position=start_position, stop_position=stop_position
)
| 37.632768 | 118 | 0.664465 |
69d6491df6eafe1d0efe76ec188898aa0d3315a4
| 23,720 |
asm
|
Assembly
|
ugbc/src/hw/gtia/plot.asm
|
Samuel-DEVULDER/ugbasic
|
61971d500d2290512fbdd3d7e487806bc34f617d
|
[
"Apache-2.0"
] | null | null | null |
ugbc/src/hw/gtia/plot.asm
|
Samuel-DEVULDER/ugbasic
|
61971d500d2290512fbdd3d7e487806bc34f617d
|
[
"Apache-2.0"
] | 3 |
2021-11-27T14:19:16.000Z
|
2021-12-21T14:44:50.000Z
|
ugbc/src/hw/gtia/plot.asm
|
Samuel-DEVULDER/ugbasic
|
61971d500d2290512fbdd3d7e487806bc34f617d
|
[
"Apache-2.0"
] | null | null | null |
; /*****************************************************************************
; * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
; *****************************************************************************
; * Copyright 2021 Marco Spedaletti (asimov@mclink.it)
; *
; * Licensed under the Apache License, Version 2.0 (the "License");
; * you may not use this file eXcept in compliance with the License.
; * You may obtain a copy of the License at
; *
; * http://www.apache.org/licenses/LICENSE-2.0
; *
; * Unless required by applicable law or agreed to in writing, software
; * distributed under the License is distributed on an "AS IS" BASIS,
; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either eXpress or implied.
; * See the License for the specific language governing permissions and
; * limitations under the License.
; *----------------------------------------------------------------------------
; * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
; * (la "Licenza"); è proibito usare questo file se non in conformità alla
; * Licenza. Una copia della Licenza è disponibile all'indirizzo:
; *
; * http://www.apache.org/licenses/LICENSE-2.0
; *
; * Se non richiesto dalla legislazione vigente o concordato per iscritto,
; * il software distribuito nei termini della Licenza è distribuito
; * "COSì COM'è", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
; * implicite. Consultare la Licenza per il testo specifico che regola le
; * autorizzazioni e le limitazioni previste dalla medesima.
; ****************************************************************************/
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;* *
;* PLOT ROUTINE ON GTIA *
;* *
;* by Marco Spedaletti *
;* *
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
PLOTX = $90 ; $91
PLOTY = $92
PLOTM = $93
PLOTOMA = $94
PLOTAMA = $95
;--------------
PLOT:
CLC
LDA PLOTY
CMP CLIPY2
BCC PLOT2
BEQ PLOT2
JMP PLOTP
PLOT2:
CMP CLIPY1
BEQ PLOT3
BCS PLOT3
JMP PLOTP
PLOT3:
LDA PLOTX+1
CMP CLIPX2+1
BCC PLOT4
BEQ PLOT3B
JMP PLOTP
PLOT3B:
LDA PLOTX
CMP CLIPX2
BCC PLOT4
BEQ PLOT4
JMP PLOTP
PLOT4:
LDA PLOTX+1
CMP CLIPX1+1
BCS PLOT5
BEQ PLOT4B
JMP PLOTP
PLOT4B:
LDA PLOTX
CMP CLIPX1
BCS PLOT5
BEQ PLOT5
JMP PLOTP
PLOT5:
LDA CURRENTMODE
CMP #8
BEQ PLOTANTIC8
CMP #9
BNE PLOTANTIC9X
JMP PLOTANTIC9
PLOTANTIC9X:
CMP #10
BNE PLOTANTIC10X
JMP PLOTANTIC10
PLOTANTIC10X:
CMP #11
BNE PLOTANTIC11X
JMP PLOTANTIC11
PLOTANTIC11X:
CMP #13
BNE PLOTANTIC13X
JMP PLOTANTIC13
PLOTANTIC13X:
CMP #15
BNE PLOTANTIC15X
JMP PLOTANTIC15
PLOTANTIC15X:
CMP #12
BNE PLOTANTIC12X
JMP PLOTANTIC12
PLOTANTIC12X:
CMP #14
BNE PLOTANTIC14X
JMP PLOTANTIC14
PLOTANTIC14X:
JMP PLOTP
; Graphics 3 (ANTIC 8)
; This four-color graphics mode turns a split screen into 20 rows of 40 graphics cells or pixels.
; Each pixel is 8 x 8 or the size of a normal character. The data in each pixel is encoded as two bit pairs,
; four per byte. The four possible bit pair combinations 00, 01, 10, and 11 point to one of the four color registers.
; The bits 00 is assigned to the background color register and the rest refer to the three foreground color registers.
; When the CTIA/GTIA chip interprets the data for the four adjacent pixels stored within the byte, it refers to the color
; register encoded in the bit pattern to plot the color.
PLOTANTIC8:
LDA _PEN
CMP $2C4
BEQ PLOTANTIC8C1
CMP $2C5
BEQ PLOTANTIC8C2
CMP $2C6
BEQ PLOTANTIC8C3
LDA LASTCOLOR
CMP #1
BEQ PLOTANTIC8SC1
CMP #2
BEQ PLOTANTIC8SC2
CMP #3
BEQ PLOTANTIC8SC3
LDA #2
STA LASTCOLOR
JMP PLOTANTIC8SC1
; PLOTANTIC8SC0:
; LDA _PEN
; STA $2C4
; INC LASTCOLOR
; PLOTANTIC8C0:
; LDA #<PLOTORBIT40
; STA TMPPTR
; LDA #>PLOTORBIT40
; STA TMPPTR+1
; JMP PLOTANTIC8PEN
PLOTANTIC8SC1:
LDA _PEN
STA $2C4
INC LASTCOLOR
PLOTANTIC8C1:
LDA #<PLOTORBIT41
STA TMPPTR
LDA #>PLOTORBIT41
STA TMPPTR+1
JMP PLOTANTIC8PEN
PLOTANTIC8SC2:
LDA _PEN
STA $2C5
INC LASTCOLOR
PLOTANTIC8C2:
LDA #<PLOTORBIT42
STA TMPPTR
LDA #>PLOTORBIT42
STA TMPPTR+1
JMP PLOTANTIC8PEN
PLOTANTIC8SC3:
LDA _PEN
STA $2C6
LDA #1
STA LASTCOLOR
PLOTANTIC8C3:
LDA #<PLOTORBIT43
STA TMPPTR
LDA #>PLOTORBIT43
STA TMPPTR+1
JMP PLOTANTIC8PEN
PLOTANTIC8PEN:
CLC
;------------------------
;calc X-cell, divide by 4
;------------------------
LDA PLOTX
AND #$03
CLC
ADC TMPPTR
STA TMPPTR
LDA #0
ADC TMPPTR+1
STA TMPPTR+1
LDY #0
LDA (TMPPTR),Y
STA PLOTOMA
LDA PLOTX
AND #$03
TAX
LDA PLOTANDBIT4,x
STA PLOTAMA
LDA PLOTX
LSR ;lo byte / 2
LSR ;lo byte / 4
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA PLOTY
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
LDA PLOT4VBASELO,Y ;table of $9C40 row base addresses
ADC PLOT4LO,X ;+ (4 * Xcell)
STA PLOTDEST ;= cell address
LDA PLOT4VBASEHI,Y ;do the high byte
ADC PLOT4HI,X
STA PLOTDEST+1
JMP PLOTGENERIC
; Graphics 4 (ANTIC 9)
; This is a two-color graphics mode with four times the resolution of GRAPHICS 3. The pixels are 4 x 4, and 48 rows of 80
; pixels fit on a full screen. A single bit is used to store each pixel's color register. A zero refers to the background
; color register and a one to the foreground color register. The mode is used primarily to conserve screen memory.
; Only one bit is used for the color, so eight adjacent pixels are encoded within one byte, and only half as much screen
; memory is needed for a display of similiar-sized pixels.
; 80x48, 2 colors
PLOTANTIC9:
LDA _PEN
CMP $2C5
BEQ PLOTANTIC9C1
PLOTANTIC9SC1:
LDA _PEN
STA $2C5
PLOTANTIC9C1:
LDA #<PLOTORBIT21
STA TMPPTR
LDA #>PLOTORBIT21
STA TMPPTR+1
JMP PLOTANTIC9PEN
PLOTANTIC9PEN:
CLC
;------------------------
;calc X-cell, divide by 8
;------------------------
LDA PLOTX
AND #$07
CLC
ADC TMPPTR
STA TMPPTR
LDA #0
ADC TMPPTR+1
STA TMPPTR+1
LDY #0
LDA (TMPPTR),Y
STA PLOTOMA
LDA PLOTX
AND #$07
TAX
LDA PLOTANDBIT2,x
STA PLOTAMA
LDA PLOTX
LSR ;lo byte / 2
LSR ;lo byte / 4
LSR ;lo byte / 8
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA PLOTY
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT4VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT4VBASEHI,Y ;do the high byte
STA PLOTDEST+1
JMP PLOTGENERIC
; Graphics 5 (ANTIC A or 10)
; This is the four color equivalent of GRAPHICS 4 sized pixels. The pixels are 4 x 4, but two bits are required to address
; the four color registers. With only four adjacent pixels encoded within a byte, the screen uses twice as much memory,
; about 1K.
; 80x48, 4 colors
PLOTANTIC10:
LDA _PEN
CMP $2C4
BEQ PLOTANTIC10C1
CMP $2C5
BEQ PLOTANTIC10C2
CMP $2C6
BEQ PLOTANTIC10C3
LDA LASTCOLOR
CMP #1
BEQ PLOTANTIC10SC1
CMP #2
BEQ PLOTANTIC10SC2
CMP #3
BEQ PLOTANTIC10SC3
LDA #1
STA LASTCOLOR
JMP PLOTANTIC10SC1
; PLOTANTIC8SC0:
; LDA _PEN
; STA $2C4
; INC LASTCOLOR
; PLOTANTIC8C0:
; LDA #<PLOTORBIT40
; STA TMPPTR
; LDA #>PLOTORBIT40
; STA TMPPTR+1
; JMP PLOTANTIC8PEN
PLOTANTIC10SC1:
LDA _PEN
STA $2C4
INC LASTCOLOR
PLOTANTIC10C1:
LDA #<PLOTORBIT41
STA TMPPTR
LDA #>PLOTORBIT41
STA TMPPTR+1
JMP PLOTANTIC10PEN
PLOTANTIC10SC2:
LDA _PEN
STA $2C5
INC LASTCOLOR
PLOTANTIC10C2:
LDA #<PLOTORBIT42
STA TMPPTR
LDA #>PLOTORBIT42
STA TMPPTR+1
JMP PLOTANTIC10PEN
PLOTANTIC10SC3:
LDA _PEN
STA $2C6
LDA #1
STA LASTCOLOR
PLOTANTIC10C3:
LDA #<PLOTORBIT43
STA TMPPTR
LDA #>PLOTORBIT43
STA TMPPTR+1
JMP PLOTANTIC10PEN
PLOTANTIC10PEN:
CLC
;------------------------
;calc X-cell, divide by 4
;------------------------
LDA PLOTX
AND #$03
CLC
ADC TMPPTR
STA TMPPTR
LDA #0
ADC TMPPTR+1
STA TMPPTR+1
LDY #0
LDA (TMPPTR),Y
STA PLOTOMA
LDA PLOTX
AND #$03
TAX
LDA PLOTANDBIT4,x
STA PLOTAMA
LDA PLOTX
LSR ;lo byte / 2
LSR ;lo byte / 4
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA PLOTY
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT5VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT5VBASEHI,Y ;do the high byte
STA PLOTDEST+1
JMP PLOTGENERIC
; Graphics 6 (ANTIC B or 11)
; This two color graphics mode has reasonably fine resolution. The 2 x 2 sized pixels allow 96 rows of 160 pixels to fit
; on a full screen. Although only a single bit is used to encode the color, screen memory still requires approximately 2K.
; 160x96, 2 colors
PLOTANTIC11:
LDA _PEN
CMP $2C5
BEQ PLOTANTIC11C1
PLOTANTIC11SC1:
LDA _PEN
STA $2C5
PLOTANTIC11C1:
LDA #<PLOTORBIT21
STA TMPPTR
LDA #>PLOTORBIT21
STA TMPPTR+1
JMP PLOTANTIC11PEN
PLOTANTIC11PEN:
CLC
;------------------------
;calc X-cell, divide by 8
;------------------------
LDA PLOTX
AND #$07
CLC
ADC TMPPTR
STA TMPPTR
LDA #0
ADC TMPPTR+1
STA TMPPTR+1
LDY #0
LDA (TMPPTR),Y
STA PLOTOMA
LDA PLOTX
AND #$07
TAX
LDA PLOTANDBIT2,x
STA PLOTAMA
LDA PLOTX
LSR ;lo byte / 2
LSR ;lo byte / 4
LSR ;lo byte / 8
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA PLOTY
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT5VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT5VBASEHI,Y ;do the high byte
STA PLOTDEST+1
JMP PLOTGENERIC
;;;;;;;;;;;;;;;;;;;
PLOTANTIC13:
LDA _PEN
CMP $2C4
BEQ PLOTANTIC13C1
CMP $2C5
BEQ PLOTANTIC13C2
CMP $2C6
BEQ PLOTANTIC13C3
LDA LASTCOLOR
CMP #1
BEQ PLOTANTIC13SC1
CMP #2
BEQ PLOTANTIC13SC2
CMP #3
BEQ PLOTANTIC13SC3
LDA #1
STA LASTCOLOR
JMP PLOTANTIC13SC1
PLOTANTIC13SC1:
LDA _PEN
STA $2C4
INC LASTCOLOR
PLOTANTIC13C1:
LDA #<PLOTORBIT41
STA TMPPTR
LDA #>PLOTORBIT41
STA TMPPTR+1
JMP PLOTANTIC13PEN
PLOTANTIC13SC2:
LDA _PEN
STA $2C5
INC LASTCOLOR
PLOTANTIC13C2:
LDA #<PLOTORBIT42
STA TMPPTR
LDA #>PLOTORBIT42
STA TMPPTR+1
JMP PLOTANTIC13PEN
PLOTANTIC13SC3:
LDA _PEN
STA $2C6
LDA #1
STA LASTCOLOR
PLOTANTIC13C3:
LDA #<PLOTORBIT43
STA TMPPTR
LDA #>PLOTORBIT43
STA TMPPTR+1
JMP PLOTANTIC13PEN
PLOTANTIC13PEN:
CLC
;------------------------
;calc X-cell, divide by 8
;------------------------
LDA PLOTX
AND #$03
CLC
ADC TMPPTR
STA TMPPTR
LDA #0
ADC TMPPTR+1
STA TMPPTR+1
LDY #0
LDA (TMPPTR),Y
STA PLOTOMA
LDA PLOTX
AND #$03
TAX
LDA PLOTANDBIT4,x
STA PLOTAMA
LDA PLOTX
LSR ;lo byte / 2
LSR ;lo byte / 4
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA PLOTY
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT6VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT6VBASEHI,Y ;do the high byte
STA PLOTDEST+1
JMP PLOTGENERIC
; Graphics 8 (ANTIC F or 15)
; This mode is definitely the finest resolution available on the Atari. Individual dot-sized pixels can be addressed in
; this one-color, two-luminance mode. There are 192 rows of 320 dots in the full screen mode. Graphics 8 is memory
; intensive; it takes 8K bytes (eight pixels/byte) to address an entire screen. The color scheme is quite similar to that
; in GRAPHICS mode 0. Color register #2 sets the background color. Color register #1 sets the luminance. Changing the color
; in this register has no effect, but, this doesn't mean that you are limited to just one color.
; Fortunately, the pixels are each one half of a color clock. It takes two pixels to span one color clock made up of
; alternating columns of complementary colors. If the background is set to black, these columns consist of blue and
; green stripes. If only the odd-columned pixels are plotted, you get blue pixels. If only the odd-columned pixels
; are plotted, you get green pixels. And if pairs of adjacent pixels are plotted, you get white. So by cleverly
; staggering the pixel patterns, you can achieve three colors. This method is called artifacting. This all depends
; on background color and luminance.
; 320x192, 3 colors
PLOTANTIC15:
LDA _PEN
AND #$F0
CMP $2C6
BEQ PLOTANTIC15B1
STA $2C6
PLOTANTIC15B1:
LDA _PEN
AND #$0F
CMP $2C5
BEQ PLOTANTIC15B2
STA $2C5
PLOTANTIC15B2:
LDA #<PLOTORBIT21
STA TMPPTR
LDA #>PLOTORBIT21
STA TMPPTR+1
PLOTANTIC15PEN:
CLC
;------------------------
;calc X-cell, divide by 8
;------------------------
LDA PLOTX
AND #$07
CLC
ADC TMPPTR
STA TMPPTR
LDA #0
ADC TMPPTR+1
STA TMPPTR+1
LDY #0
LDA (TMPPTR),Y
STA PLOTOMA
LDA PLOTX
AND #$07
TAX
LDA PLOTANDBIT2,x
STA PLOTAMA
LDA PLOTX
ROR PLOTX+1 ;rotate the high byte into carry flag
ROR ;lo byte / 2
LSR ;lo byte / 4
LSR ;lo byte / 8
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA PLOTY
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT6VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT6VBASEHI,Y ;do the high byte
STA PLOTDEST+1
JMP PLOTGENERIC
; Antic C (Graphics 14-XL computers only)
; This two-color, bit-mapped mode the eight bits correspond directly to the pixels on the screen. If a pixel is lit
; it receives its color information from color register #0, otherwise the color is set to the background color
; register #4. Each pixel is one scan line high and one color clock wide. This mode's advantages are that it
; only uses 4K of screen memory and doesn't have artifacting problems.
; 320x192, 2 colors
PLOTANTIC12:
LDA _PEN
CMP $2C5
BEQ PLOTANTIC12B1
STA $2C5
PLOTANTIC12B1:
LDA #<PLOTORBIT21
STA TMPPTR
LDA #>PLOTORBIT21
STA TMPPTR+1
PLOTANTIC12PEN:
CLC
;------------------------
;calc X-cell, divide by 8
;------------------------
LDA PLOTX
AND #$07
CLC
ADC TMPPTR
STA TMPPTR
LDA #0
ADC TMPPTR+1
STA TMPPTR+1
LDY #0
LDA (TMPPTR),Y
STA PLOTOMA
LDA PLOTX
AND #$07
TAX
LDA PLOTANDBIT2,x
STA PLOTAMA
LDA PLOTX
ROR PLOTX+1 ;rotate the high byte into carry flag
ROR ;lo byte / 2
LSR ;lo byte / 4
LSR ;lo byte / 8
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA PLOTY
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT5VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT5VBASEHI,Y ;do the high byte
STA PLOTDEST+1
JMP PLOTGENERIC
; Antic E (Graphics 15-XL computers only)
; This four-color, bit-mapped mode is sometimes known as BASIC 7 1/2. Its resolution is 160 x 192 or twice that of
; GRAPHIC 7. Each byte is divided into four pairs of bits. Like the character data in ANTIC 4, the bit pairs point to a
; particular color register. The screen data, however, is not character data but individual bytes. The user has a lot
; more control, but this mode uses a lot more memory, approximately
; 160x192, 4 colors
PLOTANTIC14:
LDA _PEN
CMP $2C5
BEQ PLOTANTIC14C1
CMP $2C6
BEQ PLOTANTIC14C2
CMP $2C7
BEQ PLOTANTIC14C3
LDA LASTCOLOR
CMP #1
BEQ PLOTANTIC14SC1
CMP #2
BEQ PLOTANTIC14SC2
CMP #3
BEQ PLOTANTIC14SC3
LDA #1
STA LASTCOLOR
JMP PLOTANTIC14SC1
; PLOTANTIC8SC0:
; LDA _PEN
; STA $2C4
; INC LASTCOLOR
; PLOTANTIC8C0:
; LDA #<PLOTORBIT40
; STA TMPPTR
; LDA #>PLOTORBIT40
; STA TMPPTR+1
; JMP PLOTANTIC8PEN
PLOTANTIC14SC1:
LDA _PEN
STA $2C5
INC LASTCOLOR
PLOTANTIC14C1:
LDA #<PLOTORBIT41
STA TMPPTR
LDA #>PLOTORBIT41
STA TMPPTR+1
JMP PLOTANTIC14PEN
PLOTANTIC14SC2:
LDA _PEN
STA $2C6
INC LASTCOLOR
PLOTANTIC14C2:
LDA #<PLOTORBIT42
STA TMPPTR
LDA #>PLOTORBIT42
STA TMPPTR+1
JMP PLOTANTIC14PEN
PLOTANTIC14SC3:
LDA _PEN
STA $2C7
LDA #1
STA LASTCOLOR
PLOTANTIC14C3:
LDA #<PLOTORBIT43
STA TMPPTR
LDA #>PLOTORBIT43
STA TMPPTR+1
JMP PLOTANTIC14PEN
PLOTANTIC14PEN:
CLC
;------------------------
;calc X-cell, divide by 4
;------------------------
LDA PLOTX
AND #$03
CLC
ADC TMPPTR
STA TMPPTR
LDA #0
ADC TMPPTR+1
STA TMPPTR+1
LDY #0
LDA (TMPPTR),Y
STA PLOTOMA
LDA PLOTX
AND #$03
TAX
LDA PLOTANDBIT4,x
STA PLOTAMA
LDA PLOTX
LSR ;lo byte / 2
LSR ;lo byte / 4
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA PLOTY
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT5VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT5VBASEHI,Y ;do the high byte
STA PLOTDEST+1
JMP PLOTGENERIC
PLOTGENERIC:
;---------------------------------
;get in-cell offset to point (0-3)
;---------------------------------
; LDA PLOTX ;get PLOTX offset from cell topleft
; AND #%00000011 ;2 lowest bits = (0-3)
; TAX ;put into index register
; LDA PLOTY ;get PLOTY offset from cell topleft
; AND #%00000111 ;3 lowest bits = (0-7)
; TAY ;put into index register
;----------------------------------------------
;depending on PLOTM, routine draws or erases
;----------------------------------------------
LDA PLOTM ;(0 = erase, 1 = set, 2 = get pixel, 3 = get color)
CMP #0
BEQ PLOTE4 ;if = 0 then branch to clear the point
CMP #1
BEQ PLOTD4 ;if = 1 then branch to draw the point
CMP #2
BEQ PLOTG4 ;if = 2 then branch to get the point (0...3)
CMP #3
BEQ PLOTC4 ;if = 3 then branch to get the color index (0...15)
JMP PLOTP
PLOTD4:
;---------
;set point
;---------
LDY #0
LDA (PLOTDEST),y ;get row with point in it
AND PLOTAMA
ORA PLOTOMA
STA (PLOTDEST),y ;write back to $A000
JMP PLOTP ;skip the erase-point section
;-----------
;erase point
;-----------
PLOTE4: ;handled same way as setting a point
LDY #0
LDA (PLOTDEST),y ;just with opposite bit-mask
AND PLOTAMA
STA (PLOTDEST),y ;write back to $A000
JMP PLOTP
PLOTG4:
LDY #0
LDA (PLOTDEST),y
AND PLOTAMA
ORA PLOTOMA
CPX #0
BEQ PLOTG0
PLOTG1:
LSR A
LSR A
DEX
BNE PLOTG1
PLOTG0:
STA PLOTM
JMP PLOTP
PLOTC4:
JSR PLOTG4
LDX PLOTM
JMP PLOTP
PLOTP:
RTS
;----------------------------------------------------------------
PLOTORBIT:
.byte %10000000
.byte %01000000
.byte %00100000
.byte %00010000
.byte %00001000
.byte %00000100
.byte %00000010
.byte %00000001
PLOTANDBIT:
.byte %01111111
.byte %10111111
.byte %11011111
.byte %11101111
.byte %11110111
.byte %11111011
.byte %11111101
.byte %11111110
PLOTANDBIT4:
.byte %00111111
.byte %11001111
.byte %11110011
.byte %11111100
PLOTORBIT40:
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
PLOTORBIT41:
.byte %01000000
.byte %00010000
.byte %00000100
.byte %00000001
PLOTORBIT42:
.byte %10000000
.byte %00100000
.byte %00001000
.byte %00000010
PLOTORBIT43:
.byte %11000000
.byte %00110000
.byte %00001100
.byte %00000011
PLOTORBIT21:
.byte %10000000
.byte %01000000
.byte %00100000
.byte %00010000
.byte %00001000
.byte %00000100
.byte %00000010
.byte %00000001
PLOTANDBIT2:
.byte %01111111
.byte %10111111
.byte %11011111
.byte %11101111
.byte %11110111
.byte %11111011
.byte %11111101
.byte %11111110
| 22.085661 | 123 | 0.532715 |
1e9fe497a6c0f205d71a14721f3a9454dcf3be1b
| 822 |
kts
|
Kotlin
|
simplebenchmark/build.gradle.kts
|
lesterw1/RoaringBitmap
|
e7ccc39d20073366bf7e9f08cf9fd51311877634
|
[
"Apache-2.0"
] | 2,350 |
2016-01-10T20:55:19.000Z
|
2022-03-31T13:17:16.000Z
|
simplebenchmark/build.gradle.kts
|
liuyonggen/RoaringBitmap
|
ab5398126f7aed1e85ba3831e9d0f05372738c28
|
[
"Apache-2.0"
] | 471 |
2016-01-12T00:25:49.000Z
|
2022-03-29T13:28:50.000Z
|
simplebenchmark/build.gradle.kts
|
liuyonggen/RoaringBitmap
|
ab5398126f7aed1e85ba3831e9d0f05372738c28
|
[
"Apache-2.0"
] | 401 |
2016-01-21T14:00:28.000Z
|
2022-03-22T08:53:42.000Z
|
dependencies {
implementation(project(":RoaringBitmap"))
}
tasks {
val runAll by registering {}
val rootDir = File(rootProject.projectDir, "/real-roaring-dataset/src/main/resources/real-roaring-dataset/")
rootDir.list()
.sorted()
.filter { it.endsWith(".zip") }
.forEach { zipFile ->
val niceName = zipFile.replace(".zip", "")
val childTask = project.tasks.create("runBenchmark${niceName.capitalize()}", JavaExec::class) {
main = "simplebenchmark"
classpath = sourceSets.main.get().runtimeClasspath
dependsOn(compileJava)
args = listOf(File(rootDir, zipFile).toString())
}
runAll.get().dependsOn(childTask)
}
}
| 34.25 | 112 | 0.553528 |
7bcf0135a194a847b1ca5c5ed7691be3b1ce2c4d
| 1,304 |
rb
|
Ruby
|
app/presenters/topico_presenter.rb
|
rakeshrajwar/cidadedemocratica
|
83bce9e30830a7d23d5c4941f856d21f42eae1af
|
[
"MIT"
] | 2 |
2015-09-09T16:46:26.000Z
|
2018-10-02T00:19:15.000Z
|
app/presenters/topico_presenter.rb
|
prefeiturasp/controladoriacidada
|
efbfb4c0639c50c24c0028b87ff00408359d0bfc
|
[
"MIT"
] | null | null | null |
app/presenters/topico_presenter.rb
|
prefeiturasp/controladoriacidada
|
efbfb4c0639c50c24c0028b87ff00408359d0bfc
|
[
"MIT"
] | 1 |
2018-11-26T02:11:56.000Z
|
2018-11-26T02:11:56.000Z
|
module TopicoPresenter
def display_location
locais.collect { |l| l.descricao }.join(', ')
end
def keywords
keywords = display_name.downcase
keywords += ",#{tags.collect{|t| t.name}.join(',')}" if tags
end
def nome_do_tipo(options = {})
str = ""
my_options = {
:artigo => false, # pode ser :definido, :indefinido
:possessivo => false, #se true, "seu", "sua"
:demonstrativo => false, #se true, "esse", "essa"
:plural => false
}.merge!(options)
if my_options[:demonstrativo]
str += "esse" if self.type.to_s == "Problema"
str += "essa" if self.type.to_s == "Proposta"
end
if my_options[:artigo] == :indefinido
str += "um" if self.type.to_s == "Problema"
str += "uma" if self.type.to_s == "Proposta"
elsif my_options[:artigo] == :definido
str += self.artigo_definido
end
if my_options[:possessivo]
str += "seu" if self.type.to_s == "Problema"
str += "sua" if self.type.to_s == "Proposta"
end
if my_options[:indefinido]
str += "outro" if self.type.to_s == "Problema"
str += "outra" if self.type.to_s == "Proposta"
end
return "#{str} #{self.display_name.downcase}"
end
def artigo_definido
"o"
end
def display_name
type.to_s
end
end
| 24.603774 | 64 | 0.595859 |
3ef6252d3ca0cd842a8d0bd8dc422c00d1acd388
| 1,559 |
kt
|
Kotlin
|
app/src/main/java/com/chhemsronglong/together/Common/BaseFragement.kt
|
sronglongchhem/Together
|
56fd2f99fbe2e8d010180acd84eaf36a8d47a8b2
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/chhemsronglong/together/Common/BaseFragement.kt
|
sronglongchhem/Together
|
56fd2f99fbe2e8d010180acd84eaf36a8d47a8b2
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/chhemsronglong/together/Common/BaseFragement.kt
|
sronglongchhem/Together
|
56fd2f99fbe2e8d010180acd84eaf36a8d47a8b2
|
[
"MIT"
] | null | null | null |
package com.chhemsronglong.together.Common
import android.arch.lifecycle.ViewModelProviders
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.View
import android.widget.ProgressBar
import com.chhemsronglong.together.ViewLayout.TogetherApp
import com.chhemsronglong.together.Common.ViewModelFactory
open class BaseFragement : Fragment() {
// TODO: Rename and change types of parameters
open var progressBar : ProgressBar? = null
lateinit var commonViewModel: CommonViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// performDependencyInjection()
// setHasOptionsMenu(false)
commonViewModel = ViewModelProviders.of(this).get(CommonViewModel::class.java)
// commonViewModel.errorMessage.observe(this,android.arch.lifecycle.Observer{
// it?.let {
// toast(it)
// }
// }
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// setUp()
}
fun showProgressDialog() {
progressBar?.visibility = View.VISIBLE
}
fun hideProgressDialog() {
progressBar?.visibility = View.GONE
}
inline fun <reified T : BaseViewModel> initViewModel(): T =
ViewModelProviders.of(this, ViewModelFactory(
activity!!.application as TogetherApp,
commonViewModel,
commonViewModel)).get(T::class.java)
}
| 29.415094 | 86 | 0.680564 |
753160af1e541cff7044049850ee7e593bcf7745
| 558 |
h
|
C
|
bTraits.h
|
raduteo/framespaces
|
18a9d7621634ee59546629faba598c989096c4ab
|
[
"Apache-2.0"
] | null | null | null |
bTraits.h
|
raduteo/framespaces
|
18a9d7621634ee59546629faba598c989096c4ab
|
[
"Apache-2.0"
] | null | null | null |
bTraits.h
|
raduteo/framespaces
|
18a9d7621634ee59546629faba598c989096c4ab
|
[
"Apache-2.0"
] | null | null | null |
#ifndef EXPERIMENTS_BTRAITS_H
#define EXPERIMENTS_BTRAITS_H
template<template<typename...> class, typename>
struct is_template_instance : std::false_type {
};
template<template<typename...> class T, class... ARGS>
struct is_template_instance<T, T<ARGS...>> : std::true_type {
};
template<class T>
constexpr bool is_unique_ptr_v = is_template_instance<std::unique_ptr, std::remove_cvref_t<T>>::value;
template<class T>
constexpr bool is_shared_ptr_v = is_template_instance<std::shared_ptr, std::remove_cvref_t<T>>::value;
#endif //EXPERIMENTS_BTRAITS_H
| 27.9 | 102 | 0.77957 |
16879bf47e6bfb2180abdd20126019af2b066ebb
| 154 |
c
|
C
|
tests/clds_sorted_list_int/nothing.c
|
anporumb/clds
|
35c51b89265bd6389e3e07369351149f7b7ed501
|
[
"MIT"
] | 1 |
2018-03-09T08:22:29.000Z
|
2018-03-09T08:22:29.000Z
|
tests/clds_sorted_list_int/nothing.c
|
anporumb/clds
|
35c51b89265bd6389e3e07369351149f7b7ed501
|
[
"MIT"
] | 11 |
2018-04-04T05:35:33.000Z
|
2020-05-06T22:12:53.000Z
|
tests/clds_sorted_list_int/nothing.c
|
anporumb/clds
|
35c51b89265bd6389e3e07369351149f7b7ed501
|
[
"MIT"
] | 2 |
2018-04-10T16:33:37.000Z
|
2019-03-08T21:35:20.000Z
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
int nothing4C553292_5C39_4118_8AC6_62EEB4E366C9 = 0;
| 77 | 101 | 0.831169 |
bcc5fce7f6a724cc43e76a6a7bc70918e0ebf652
| 3,391 |
js
|
JavaScript
|
app/controller/v1/lovemail.js
|
Love-mail/love-mail
|
01ca1beed24843dc26d9434d7a2a61ad686f8aec
|
[
"Apache-2.0"
] | 2 |
2018-03-24T02:24:11.000Z
|
2018-03-26T04:59:27.000Z
|
app/controller/v1/lovemail.js
|
Love-mail/Lovemail-Server
|
01ca1beed24843dc26d9434d7a2a61ad686f8aec
|
[
"Apache-2.0"
] | null | null | null |
app/controller/v1/lovemail.js
|
Love-mail/Lovemail-Server
|
01ca1beed24843dc26d9434d7a2a61ad686f8aec
|
[
"Apache-2.0"
] | null | null | null |
'use strict';
const Controller = require('egg').Controller;
class LovemailController extends Controller {
// 保存用户 Lovemail 设置
async save() {
const { ctx, app } = this;
const model = ctx.request.body;
const rule = {
nickname: {
type: 'string',
max: 20,
required: false,
},
love_email: {
type: 'email',
},
love_time: {
type: 'string',
},
love_date: {
type: 'string',
},
love_city: {
type: 'string',
required: false,
},
love_color: {
type: 'string',
},
love_temp: {
type: 'number',
},
isStart: {
type: 'boolean',
},
};
ctx.validate(rule);
const isLimit = await app.redis.get('setEmailLimit').exists(ctx.state.user.data.userId);
const isOccupy = await ctx.service.v1.lovemail.findByLovemail(model.love_email);
if (isOccupy) {
ctx.body = {
msg: 'Email is occupied',
};
ctx.status = 409;
} else if (isLimit) {
ctx.body = {
msg: 'Cannot repeatedly modify lover mailbox within 24 hours',
};
ctx.status = 500;
} else {
await ctx.service.v1.lovemail.save(ctx.state.user.data.userId, model);
ctx.body = {
msg: 'Set up Successfully',
};
ctx.status = 200;
}
}
// 更新用户 Lovemail 设置
async update() {
const { ctx, app } = this;
const model = ctx.request.body;
const rule = {
nickname: {
type: 'string',
max: 20,
required: false,
},
love_email: {
type: 'email',
required: false,
},
love_time: {
type: 'string',
required: false,
},
love_date: {
type: 'string',
required: false,
},
love_city: {
type: 'string',
required: false,
},
love_color: {
type: 'string',
required: false,
},
love_temp: {
type: 'number',
required: false,
},
isStart: {
type: 'boolean',
required: false,
},
};
ctx.validate(rule);
const user = await ctx.service.v1.user.findById(ctx.state.user.data.userId);
const isLimit = await app.redis.get('setEmailLimit').exists(ctx.state.user.data.userId);
const isOccupied = await ctx.service.v1.lovemail.findByLovemail(model.love_email);
if (model.love_email && isOccupied) {
ctx.body = {
msg: 'Email is occupied',
};
ctx.status = 409;
} else if (model.love_email && isLimit) {
ctx.body = {
msg: 'Cannot repeatedly modify lover mailbox within 24 hours',
};
ctx.status = 500;
} else if (model.isStart && !user.love_email) {
await ctx.service.v1.lovemail.update(ctx.state.user.data.userId, model);
ctx.body = {
msg: 'Please set lovemail first',
};
ctx.status = 500;
} else {
await ctx.service.v1.lovemail.update(ctx.state.user.data.userId, model);
ctx.body = {
msg: 'Set up Successfully',
};
ctx.status = 200;
}
}
// 解绑对象邮箱
async untie() {
const { ctx } = this;
await ctx.service.v1.lovemail.untie(ctx.state.user.data.userId);
ctx.body = {
msg: 'Untie email Successfully',
};
ctx.status = 200;
}
}
module.exports = LovemailController;
| 23.226027 | 92 | 0.534651 |
36e207171341cb25840f6f3bf10c10ba42adaace
| 342 |
swift
|
Swift
|
Sources/ResponseParser.swift
|
JuanjoArreola/Apic
|
0ac166aace6d08c4d2ec9012b82f0b1b09795978
|
[
"MIT"
] | 1 |
2016-07-09T19:31:55.000Z
|
2016-07-09T19:31:55.000Z
|
Sources/ResponseParser.swift
|
JuanjoArreola/Apic
|
0ac166aace6d08c4d2ec9012b82f0b1b09795978
|
[
"MIT"
] | 1 |
2021-11-07T16:57:23.000Z
|
2021-11-07T16:57:23.000Z
|
Sources/ResponseParser.swift
|
JuanjoArreola/Apic
|
0ac166aace6d08c4d2ec9012b82f0b1b09795978
|
[
"MIT"
] | 2 |
2019-02-13T21:04:36.000Z
|
2021-11-07T16:57:38.000Z
|
import Foundation
public protocol ResponseParser {
func success(from data: Data?, response: URLResponse?, error: Error?) throws -> Bool
func object<T: Decodable>(from data: Data?, response: URLResponse?, error: Error?) throws -> T
func array<T: Decodable>(from data: Data?, response: URLResponse?, error: Error?) throws -> [T]
}
| 42.75 | 99 | 0.704678 |
e764ccb2cf08326465c02b30461f7788531c3641
| 2,269 |
js
|
JavaScript
|
packages/server/usecase/application/node-generator/templates/cleanCode/utils/messages.js
|
shubhamkhunt04/dhiwise-nodejs
|
d04262a8a82441e23026f5b49dd0ce397edd587c
|
[
"Apache-2.0"
] | null | null | null |
packages/server/usecase/application/node-generator/templates/cleanCode/utils/messages.js
|
shubhamkhunt04/dhiwise-nodejs
|
d04262a8a82441e23026f5b49dd0ce397edd587c
|
[
"Apache-2.0"
] | null | null | null |
packages/server/usecase/application/node-generator/templates/cleanCode/utils/messages.js
|
shubhamkhunt04/dhiwise-nodejs
|
d04262a8a82441e23026f5b49dd0ce397edd587c
|
[
"Apache-2.0"
] | null | null | null |
// eslint-disable-next-line no-multi-assign
const messages = module.exports = {};
messages.successResponse = (headers, statusCode, data) => ({
headers,
statusCode,
data: {
status: 'SUCCESS',
message: 'Your request is successfully executed',
data,
},
});
messages.failureResponse = (headers, statusCode) => ({
headers,
statusCode,
data: {
status: 'FAILURE',
message: 'Internal Server Error',
data: {},
},
});
messages.badRequest = (headers, statusCode) => ({
headers,
statusCode,
data: {
status: 'BAD_REQUEST',
message: 'The request cannot be fulfilled due to bad syntax',
data: {},
},
});
messages.isDuplicate = (headers, statusCode) => ({
headers,
statusCode,
data: {
status: 'VALIDATION_ERROR',
message: 'Data duplication Found',
data: {},
},
});
messages.recordNotFound = (headers, statusCode) => ({
headers,
statusCode,
data: {
status: 'RECORD_NOT_FOUND',
message: 'Record not found with specified criteria.',
data: {},
},
});
messages.insufficientParameters = (headers, statusCode) => ({
headers,
statusCode,
data: {
status: 'BAD_REQUEST',
message: 'Insufficient parameters',
data: {},
},
});
messages.inValidParam = (headers, statusCode, error) => ({
headers,
statusCode,
data: {
status: 'VALIDATION_ERROR',
message: error,
data: {},
},
});
messages.unAuthorizedRequest = (headers, statusCode) => ({
headers,
statusCode,
data: {
status: 'UNAUTHORIZED',
message: 'You are not authorized to access the request',
data: {},
},
});
messages.loginSuccess = (headers, statusCode, data) => ({
headers,
statusCode,
data: {
status: 'SUCCESS',
message: 'Login Successful',
data,
},
});
messages.loginFailed = (headers, statusCode, error) => ({
headers,
statusCode,
data: {
status: 'BAD_REQUEST',
message: `Login Failed, ${error}`,
data: {},
},
});
messages.invalidRequest = (headers, statusCode, data) => ({
headers,
statusCode,
data: {
status: 'FAILURE',
message: data,
data: {},
},
});
messages.requestValidated = (headers, statusCode, data) => ({
headers,
statusCode,
data: {
status: 'SUCCESS',
message: data,
data: {},
},
});
| 19.730435 | 65 | 0.613486 |
5000afd31c169b913cb04bcea45a2e49a2cdebe7
| 1,112 |
js
|
JavaScript
|
wrappers/md.js
|
florapdx/gatsby-bloggy-starter
|
35abd3a40ba3dca5068cc14a5905efe90e9ac051
|
[
"MIT"
] | 6 |
2016-11-03T01:26:11.000Z
|
2019-08-15T04:44:17.000Z
|
wrappers/md.js
|
florapdx/gatsby-bloggy-starter
|
35abd3a40ba3dca5068cc14a5905efe90e9ac051
|
[
"MIT"
] | 1 |
2018-04-13T10:52:44.000Z
|
2018-04-13T10:52:44.000Z
|
wrappers/md.js
|
florapdx/gatsby-bloggy-starter
|
35abd3a40ba3dca5068cc14a5905efe90e9ac051
|
[
"MIT"
] | 3 |
2016-11-13T19:39:42.000Z
|
2020-12-26T20:37:22.000Z
|
import React, { PropTypes, Component } from 'react';
import Helmet from 'react-helmet';
import { config } from 'config';
import DisqusThread from '../components/shared/disqus-threads';
import Post from '../components/blog/post';
import 'stylesheets/markdown-styles.css';
class MarkdownWrapper extends Component {
constructor(props) {
super(props);
}
render () {
const { route: { page } } = this.props;
const post = page.data;
return (
<div className="post-page">
<Helmet
title={`${config.siteTitle} | ${post.title}`}
/>
<Post post={post} slug={page.file.name} />
{
config.ENABLE_DISQUS ? (
<DisqusThread
shortname={config.DISQUS_SHORTNAME}
identifier={postMeta.title}
title={postMeta.title}
url={`${config.SITE_ROOT_URL}/posts/${page.file.name}`}
category_id={config.DISQUS_CATEGORY}
/>
) : null
}
</div>
);
}
}
MarkdownWrapper.propTypes = {
body: PropTypes.string
};
export default MarkdownWrapper;
| 24.711111 | 69 | 0.58723 |
33299ffe9a3bcae73b7f087adb90f942699dff82
| 466 |
py
|
Python
|
ABC/abc051-abc100/abc093/b.py
|
KATO-Hiro/AtCoder
|
cbbdb18e95110b604728a54aed83a6ed6b993fde
|
[
"CC0-1.0"
] | 2 |
2020-06-12T09:54:23.000Z
|
2021-05-04T01:34:07.000Z
|
ABC/abc051-abc100/abc093/b.py
|
KATO-Hiro/AtCoder
|
cbbdb18e95110b604728a54aed83a6ed6b993fde
|
[
"CC0-1.0"
] | 961 |
2020-06-23T07:26:22.000Z
|
2022-03-31T21:34:52.000Z
|
ABC/abc051-abc100/abc093/b.py
|
KATO-Hiro/AtCoder
|
cbbdb18e95110b604728a54aed83a6ed6b993fde
|
[
"CC0-1.0"
] | null | null | null |
'''input
4 8 3
4
5
6
7
8
3 8 2
3
4
7
8
2 9 100
2
3
4
5
6
7
8
9
'''
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == '__main__':
a, b, k = list(map(int, input().split()))
if (b - a + 1) <= 2 * k:
for i in range(a, b + 1):
print(i)
else:
for j in range(a, a + k):
print(j)
for j in range(b - k + 1, b + 1):
print(j)
| 10.590909 | 46 | 0.401288 |
c2d7883445592654dd685a93a3e6cca892201a60
| 2,654 |
sql
|
SQL
|
web/db/mysql/filemanager.sql
|
JxcChen/JeeSite4
|
5ce16994f446535d94524df00c0b125a1203dc0e
|
[
"Apache-2.0"
] | 10 |
2020-10-11T08:16:46.000Z
|
2022-01-25T07:56:18.000Z
|
web/db/mysql/filemanager.sql
|
JxcChen/JeeSite4
|
5ce16994f446535d94524df00c0b125a1203dc0e
|
[
"Apache-2.0"
] | null | null | null |
web/db/mysql/filemanager.sql
|
JxcChen/JeeSite4
|
5ce16994f446535d94524df00c0b125a1203dc0e
|
[
"Apache-2.0"
] | 70 |
2020-07-03T23:01:45.000Z
|
2022-02-27T13:57:51.000Z
|
SET SESSION FOREIGN_KEY_CHECKS=0;
/* Drop Tables */
DROP TABLE IF EXISTS js_filemanager_shared;
DROP TABLE IF EXISTS js_filemanager_folder;
/* Create Tables */
-- 文件管理文件夹
CREATE TABLE js_filemanager_folder
(
id varchar(64) NOT NULL COMMENT '编号',
parent_code varchar(64) NOT NULL COMMENT '父级编号',
parent_codes varchar(1000) NOT NULL COMMENT '所有父级编号',
tree_sort decimal(10) NOT NULL COMMENT '本级排序号(升序)',
tree_sorts varchar(1000) NOT NULL COMMENT '所有级别排序号',
tree_leaf char(1) NOT NULL COMMENT '是否最末级',
tree_level decimal(4) NOT NULL COMMENT '层次级别',
tree_names varchar(1000) NOT NULL COMMENT '全节点名',
folder_name varchar(100) NOT NULL COMMENT '文件夹名',
group_type varchar(64) NOT NULL COMMENT '文件分组类型',
office_code varchar(64) COMMENT '部门编码',
status char(1) DEFAULT '0' NOT NULL COMMENT '状态(0正常 1删除 2停用)',
create_by varchar(64) NOT NULL COMMENT '创建者',
create_date datetime NOT NULL COMMENT '创建时间',
update_by varchar(64) NOT NULL COMMENT '更新者',
update_date datetime NOT NULL COMMENT '更新时间',
remarks varchar(500) COMMENT '备注信息',
corp_code varchar(64) DEFAULT '0' NOT NULL COMMENT '租户代码',
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL COMMENT '租户名称',
PRIMARY KEY (id)
) COMMENT = '文件管理文件夹';
-- 文件管理共享表
CREATE TABLE js_filemanager_shared
(
id varchar(64) NOT NULL COMMENT '编号',
folder_id varchar(64) COMMENT '文件夹编码',
file_upload_id varchar(64) COMMENT '文件上传编码',
file_name varchar(500) NOT NULL COMMENT '文件或文件夹名',
receive_user_code varchar(100) NOT NULL COMMENT '接受者用户编码',
receive_user_name varchar(200) NOT NULL COMMENT '接收者用户名称',
click_num numeric(10) COMMENT '点击次数',
status char(1) DEFAULT '0' NOT NULL COMMENT '状态(0正常 1删除 2停用)',
create_by varchar(64) NOT NULL COMMENT '创建者',
create_date datetime NOT NULL COMMENT '创建时间',
update_by varchar(64) NOT NULL COMMENT '更新者',
update_date datetime NOT NULL COMMENT '更新时间',
remarks varchar(500) COMMENT '备注信息',
PRIMARY KEY (id)
) COMMENT = '文件管理共享表';
/* Create Indexes */
CREATE INDEX idx_sys_file_tree_pc ON js_filemanager_folder (parent_code ASC);
CREATE INDEX idx_sys_file_tree_ts ON js_filemanager_folder (tree_sort ASC);
CREATE INDEX idx_sys_file_tree_tss ON js_filemanager_folder (tree_sorts ASC);
CREATE INDEX idx_sys_file_tree_gt ON js_filemanager_folder (group_type ASC);
CREATE INDEX idx_sys_file_tree_oc ON js_filemanager_folder (office_code ASC);
CREATE INDEX idx_sys_file_tree_cb ON js_filemanager_folder (create_by ASC);
CREATE INDEX idx_sys_file_share_ruc ON js_filemanager_shared (receive_user_code ASC);
CREATE INDEX idx_sys_file_share_cb ON js_filemanager_shared (create_by ASC);
| 36.356164 | 86 | 0.756217 |
20b54f616b3da0eda4fceb74783daaa4ad7238fd
| 2,861 |
css
|
CSS
|
data/usercss/148557.user.css
|
33kk/uso-archive
|
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
|
[
"MIT"
] | 118 |
2020-08-28T19:59:28.000Z
|
2022-03-26T16:28:40.000Z
|
data/usercss/148557.user.css
|
33kk/uso-archive
|
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
|
[
"MIT"
] | 38 |
2020-09-02T01:08:45.000Z
|
2022-01-23T02:47:24.000Z
|
data/usercss/148557.user.css
|
33kk/uso-archive
|
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
|
[
"MIT"
] | 21 |
2020-08-19T01:12:43.000Z
|
2022-03-15T21:55:17.000Z
|
/* ==UserStyle==
@name SupportXMR Dark
@namespace USO Archive
@author Techjar
@description `Relatively quickly whipped up dark theme for SupportXMR. Enjoy!<br><br><b>Suggestions? Issues? Did I miss something?</b> Contact me via one of a few methods, found on my contact page: <a href="https://www.techjargaming.com/contact/">https://www.techjargaming.com/contact/</a><br><br>Like this style a lot and feel the urge to donate? Send me some cryptocurrency!<br>XMR: 44ZeUxo7Y1XfAH3tfRFkmjjX19hx9EQqt89aMPiGmRaG9hzPJ4Ux9RY1txDxsJiFPPToh48Q1bzNm4WqkuZSvSNbELAxFTL<br>BTC: 1BmAqGBJBJpBcYf69FUstKw5aBCY3Wha4J<br>BCH: 1CaXaaNd7uDEcU2hpdEb3Qtx31ZfYThsXS<br>ETH: 0x6DFFc78A73232083AeDa3B3854aAA81dE8EdFa93<br>ETC: 0xd8170b8A004A8F0538D7183b152bD88F980038a4<br>LTC: LNTeAKcez425iJdiTmTSebKdEfhEwLwUfw`
@version 20170928.6.50
@license CC-BY-4.0
@preprocessor uso
==/UserStyle== */
@-moz-document domain("supportxmr.com") {
body, #content, .footer, #main {
background: #181818 !important;
color: #cccccc !important;
}
md-dialog, .md-subheader, md-content.login {
background: #282828 !important;
color: #cccccc !important;
}
md-card {
background: #282828 !important;
color: #cccccc !important;
}
md-input-container * {
color: #ffffff !important;
}
td.md-cell, th.md-column, .md-subhead {
color: #cccccc !important;
}
.md-tab {
color: rgba(158,158,158,0.54) !important;
}
.md-tab.md-active {
color: #cccccc !important;
}
md-checkbox.md-default-theme:not(.md-checked) .md-icon, md-checkbox:not(.md-checked) .md-icon {
border-color: rgba(255,255,255,0.54);
}
.chart .axis > .tick > text {
fill: #cccccc !important;
}
.chart .axis > .tick > line, .chart .axis > path, .chart .grid .tick > line {
stroke: #888888 !important;
}
table.md-table.md-row-select tbody.md-body > tr.md-row:not([disabled]):hover {
background: #3d3d3d !important;
}
table.md-table.md-row-select tbody.md-body > tr.md-row.md-selected {
background: #484848 !important;
}
.chart-tooltip {
background: #383838 !important;
}
md-list md-list-item.md-3-line .md-list-item-text h4, md-list md-list-item.md-3-line .md-list-item-text p {
color: rgba(204, 204, 204, 0.8) !important;
}
md-table-pagination, .md-select-icon, md-table-pagination md-icon, .md-table-pagination md-select:not([disabled]):focus .md-select-value {
color: rgba(204, 204, 204, 0.8) !important;
}
md-table-pagination .md-button[disabled] md-icon {
color: rgba(204, 204, 204, 0.4) !important;
}
md-select-menu md-content, md-select-menu md-option {
background: #383838 !important;
color: rgba(204, 204, 204, 0.7) !important;
}
md-select-menu md-content md-option[selected] {
color: rgba(224, 224, 224, 1.0) !important;
}
}
| 33.267442 | 715 | 0.682978 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.