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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c7b9733b060cc9b37fca779e60d6b2175becba75 | 2,113 | py | Python | Week03/Assignment/gmorbioli.py | annap84/SkillsWorkshop2018 | 19cc76abd9b0ea15ee2823dd36698475b08b0217 | [
"BSD-3-Clause"
] | 1 | 2020-04-18T03:30:46.000Z | 2020-04-18T03:30:46.000Z | Week03/Assignment/gmorbioli.py | annap84/SkillsWorkshop2018 | 19cc76abd9b0ea15ee2823dd36698475b08b0217 | [
"BSD-3-Clause"
] | 21 | 2018-07-12T19:12:23.000Z | 2018-08-10T13:52:45.000Z | Week03/Assignment/gmorbioli.py | annap84/SkillsWorkshop2018 | 19cc76abd9b0ea15ee2823dd36698475b08b0217 | [
"BSD-3-Clause"
] | 60 | 2018-05-08T16:59:20.000Z | 2018-08-01T14:28:28.000Z | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 28 16:46:29 2018
@author: morbi
"""
#importing the libraries
import pandas as pd
import matplotlib.pyplot as plt, matplotlib,numpy as np
#creating the dataframes - MAKE SURE YOU'RE IN THE SAME DIRECTORY OF THE FILES
surveys_df = pd.read_csv("surveys.csv",
keep_default_na=False, na_values=[""])
species_df = pd.read_csv("species.csv",
keep_default_na=False, na_values=[""])
#creating the merged document containing the info from both documents
merged_inner = pd.merge(left=surveys_df,right=species_df,
left_on='species_id', right_on='species_id')
#merged_inner.to_csv('out.csv', index=False) #save a .csv of the merged data
#plot the figure
def figure_bar(arg, title = None):
''' Plots a bar graph using the dataset provided'''
axes = arg
axes.set_xlabel('plot_id') #gives name to the x-axis
axes.set_ylabel('Number of counts') #gives name to the y-axis
axes.set_title(title) #gives a title to the graph
# Only show ticks on the left and bottom spines
axes.yaxis.set_ticks_position('left')
axes.xaxis.set_ticks_position('bottom')
#places the legend outside the plot
axes.legend(loc='center left', bbox_to_anchor=(1, 0.5), fancybox=True, shadow=True, ncol=1)
plt.show() # shows the figure
dataset = merged_inner.groupby(['plot_id','taxa']) #groups the dataset by the site and the taxa
Counts_PT = dataset.count()['record_id'] #count the number of obs for the grouped data
axes1 = Counts_PT.unstack().plot(kind='bar', stacked=True) #plots the bar graph, stacking the data
datasetMF = merged_inner.groupby(['plot_id','taxa','sex']) #groups the dataset by the site and the taxa and the sex
Counts_PTMF = datasetMF.count()['record_id'] #count the number of obs for the grouped data
axes2 = Counts_PTMF.unstack(level=[1, 2]).plot(kind='bar', stacked=True) #plots the bar graph, stacking the data
figure_bar(axes1,'Number of species of each taxa per site')
figure_bar(axes2,'Number of species of each taxa per site per sex')
| 38.418182 | 115 | 0.703739 |
5f558d0fb0a62b79b43a2372c0b6ab2fdfd13ef7 | 2,270 | ts | TypeScript | src/app.ts | jasonhaxstuff/chat | aa03883a976d65e07cf3c14c4a4a1e7725c02536 | [
"MIT"
] | null | null | null | src/app.ts | jasonhaxstuff/chat | aa03883a976d65e07cf3c14c4a4a1e7725c02536 | [
"MIT"
] | null | null | null | src/app.ts | jasonhaxstuff/chat | aa03883a976d65e07cf3c14c4a4a1e7725c02536 | [
"MIT"
] | null | null | null | import { remote } from 'electron'
import * as jetpack from 'fs-jetpack'
import * as WebSocket from 'ws'
import env from './env'
import * as M from 'materialize-css'
const ws = new WebSocket('wss://www.macho.ninja/chat/')
console.log('Loaded environment variables:', env)
let app = remote.app
let appDir = jetpack.cwd(app.getAppPath())
let nickname: string
let instances: M.Modal[]
console.log('The author of this app is:', appDir.read('package.json', 'json').author)
document.addEventListener('DOMContentLoaded', function () {
const nicknameInput = document.getElementById('nickname') as HTMLInputElement
const nickname = window.localStorage.getItem('nickname')
const elems = document.querySelectorAll('.modal')
instances = M.Modal.init(elems, { dismissible: false, onCloseEnd: onNicknameChange })
if (nickname) {
nicknameInput.value = nickname
onNicknameChange()
} else {
instances[0].open()
}
const form = document.getElementById('form') as HTMLFormElement
form.onsubmit = event => {
event.preventDefault()
const message = document.getElementById('message') as HTMLInputElement
if (message.value === '' || nickname === '') {
return
}
ws.send(JSON.stringify({ message: message.value, nickname }))
console.log(`Sent message ${message.value}`)
message.value = ''
}
ws.on('message', (message: string) => {
const msg: { message: string, nickname: string } = JSON.parse(message)
if (msg.message) {
const messages = document.getElementById('messages') as HTMLUListElement
messages.appendChild(document.createElement('li')).textContent = msg.nickname + ' - ' + msg.message
if (msg.nickname === 'Socket') {
messages.lastElementChild.setAttribute('style', 'color:green;')
}
} else {
console.log('Message from websocket: ' + message)
}
})
})
function onNicknameChange () {
nickname = (document.getElementById('nickname') as HTMLInputElement).value
if (nickname === '' || nickname.toLowerCase() === 'socket') {
return instances[0].open()
}
if (nickname.length > 20) {
nickname = nickname.substring(0, nickname.length - 19)
}
window.localStorage.setItem('nickname', nickname)
console.log('Nickname: ' + nickname)
}
| 28.734177 | 105 | 0.678414 |
d2db0a61eaaf90f67deec68ec9f9e4181404aa9b | 916 | php | PHP | console/migrations/m170925_134823_page_translate.php | justyork/cms | 707ba6b0eccca1b9502ace6804e4579b3f0974bc | [
"MIT"
] | null | null | null | console/migrations/m170925_134823_page_translate.php | justyork/cms | 707ba6b0eccca1b9502ace6804e4579b3f0974bc | [
"MIT"
] | null | null | null | console/migrations/m170925_134823_page_translate.php | justyork/cms | 707ba6b0eccca1b9502ace6804e4579b3f0974bc | [
"MIT"
] | null | null | null | <?php
use yii\db\Migration;
class m170925_134823_page_translate extends Migration
{
public function safeUp()
{
$this->createTable('page_translate', [
'id' => $this->primaryKey(),
'parent_id' => $this->integer(),
'language' => $this->string(6),
'title' => $this->string(255),
'text' => $this->text(),
]);
$this->addForeignKey(
'idx-page_translate-parent_id',
'page_translate',
'parent_id',
'pages',
'id'
);
}
public function safeDown()
{
$this->dropTable('page_translate');
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m170925_134823_page_translate cannot be reverted.\n";
return false;
}
*/
}
| 20.355556 | 67 | 0.509825 |
1222f1506979c915e36c0719a6e3861d290b6e07 | 1,074 | h | C | src/engine_core/wme_base/UIMarkup.h | segafan/wme1_jankavan_tlc_edition-repo | 72163931f348d5a2132577930362d297cc375a26 | [
"MIT"
] | 3 | 2021-03-28T00:11:48.000Z | 2022-01-12T13:10:52.000Z | src/engine_core/wme_base/UIMarkup.h | segafan/wme1_jankavan_tlc_edition-repo | 72163931f348d5a2132577930362d297cc375a26 | [
"MIT"
] | null | null | null | src/engine_core/wme_base/UIMarkup.h | segafan/wme1_jankavan_tlc_edition-repo | 72163931f348d5a2132577930362d297cc375a26 | [
"MIT"
] | null | null | null | // This file is part of Wintermute Engine
// For conditions of distribution and use, see copyright notice in license.txt
// http://dead-code.org/redir.php?target=wme
#if !defined(AFX_UIMARKUP_H__FAE8DFBB_1FBE_49D2_B600_378D8DC59EB2__INCLUDED_)
#define AFX_UIMARKUP_H__FAE8DFBB_1FBE_49D2_B600_378D8DC59EB2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "UIObject.h"
class CUIMarkup : public CUIObject
{
public:
DECLARE_PERSISTENT(CUIMarkup, CUIObject);
CUIMarkup(CBGame* InGame);
virtual ~CUIMarkup();
virtual HRESULT Display(int OffsetX=0, int OffsetY=0);
HRESULT LoadFile(char* Filename);
HRESULT LoadBuffer(BYTE* Buffer, bool Complete=true);
// scripting interface
virtual CScValue* ScGetProperty(char* Name);
virtual HRESULT ScSetProperty(char *Name, CScValue *Value);
virtual HRESULT ScCallMethod(CScScript* Script, CScStack *Stack, CScStack *ThisStack, char *Name);
virtual char* ScToString();
};
#endif // !defined(AFX_UIMARKUP_H__FAE8DFBB_1FBE_49D2_B600_378D8DC59EB2__INCLUDED_)
| 30.685714 | 100 | 0.766294 |
e17d008bbe4b92b47366dde79a228f77ee32b06c | 1,493 | kt | Kotlin | domain/src/main/java/com/foobarust/domain/models/order/OrderDetail.kt | foobar-UST/foobar-android | b4358ef0323a0b7a95483223496164e616a01da5 | [
"MIT"
] | 2 | 2021-06-07T11:04:24.000Z | 2021-08-24T11:50:08.000Z | domain/src/main/java/com/foobarust/domain/models/order/OrderDetail.kt | foobar-UST/foobar-android | b4358ef0323a0b7a95483223496164e616a01da5 | [
"MIT"
] | null | null | null | domain/src/main/java/com/foobarust/domain/models/order/OrderDetail.kt | foobar-UST/foobar-android | b4358ef0323a0b7a95483223496164e616a01da5 | [
"MIT"
] | 3 | 2021-08-02T19:20:15.000Z | 2021-08-28T14:06:57.000Z | package com.foobarust.domain.models.order
import com.foobarust.domain.models.common.Geolocation
import com.foobarust.domain.models.common.GeolocationPoint
import com.foobarust.domain.models.map.TravelMode
import java.util.*
/**
* Created by kevin on 1/28/21
*/
data class OrderDetail(
val id: String,
val title: String,
val titleZh: String?,
val sellerId: String,
val sellerName: String,
val sellerNameZh: String?,
val sectionId: String?,
val sectionTitle: String?,
val sectionTitleZh: String?,
val delivererId: String?,
val delivererLocation: GeolocationPoint?,
val delivererTravelMode: TravelMode?,
val identifier: String,
val imageUrl: String?,
val type: OrderType,
val orderItems: List<OrderItem>,
val orderItemsCount: Int,
val state: OrderState,
val isPaid: Boolean,
val paymentMethod: String,
val message: String?,
val deliveryLocation: Geolocation,
val subtotalCost: Double,
val deliveryCost: Double,
val totalCost: Double,
val verifyCode: String,
val createdAt: Date,
val updatedAt: Date,
)
fun OrderDetail.getNormalizedTitle(): String {
return if (titleZh != null) "$title $titleZh" else title
}
fun OrderDetail.getNormalizedSellerName(): String {
return if (sellerNameZh != null) "$sellerName $sellerNameZh" else sellerName
}
fun OrderDetail.getNormalizedDeliveryAddress(): String {
return "${deliveryLocation.address} ${deliveryLocation.addressZh}"
} | 28.169811 | 80 | 0.720697 |
5f2b08d692ba0eb3045d2235898321ce61dbc56d | 205 | ts | TypeScript | src/controller/helpers/getState.ts | BiosBoy/carradar-staging | 55e5cf60d503fd273a979499f302267578cf3ff1 | [
"MIT"
] | null | null | null | src/controller/helpers/getState.ts | BiosBoy/carradar-staging | 55e5cf60d503fd273a979499f302267578cf3ff1 | [
"MIT"
] | null | null | null | src/controller/helpers/getState.ts | BiosBoy/carradar-staging | 55e5cf60d503fd273a979499f302267578cf3ff1 | [
"MIT"
] | null | null | null | import { select } from 'redux-saga/effects';
import { IStore } from '../../interfaces/IStore';
function* getState() {
const state: IStore = yield select();
return state;
}
export default getState;
| 17.083333 | 49 | 0.678049 |
c2032acde9b3c8bd603ed2d4cdd73bc84921029d | 4,057 | go | Go | services/customerdb/client/reseller_management/get_reseller_responses.go | Cyclops-Labs/cyclops-4-hpc | 0ea0435502e8908dd85294241585e88b1a074a90 | [
"Apache-2.0"
] | null | null | null | services/customerdb/client/reseller_management/get_reseller_responses.go | Cyclops-Labs/cyclops-4-hpc | 0ea0435502e8908dd85294241585e88b1a074a90 | [
"Apache-2.0"
] | null | null | null | services/customerdb/client/reseller_management/get_reseller_responses.go | Cyclops-Labs/cyclops-4-hpc | 0ea0435502e8908dd85294241585e88b1a074a90 | [
"Apache-2.0"
] | null | null | null | // Code generated by go-swagger; DO NOT EDIT.
package reseller_management
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/Cyclops-Labs/cyclops-4-hpc.git/services/customerdb/models"
)
// GetResellerReader is a Reader for the GetReseller structure.
type GetResellerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetResellerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetResellerOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetResellerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetResellerInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetResellerOK creates a GetResellerOK with default headers values
func NewGetResellerOK() *GetResellerOK {
return &GetResellerOK{}
}
/*GetResellerOK handles this case with default header values.
Reseller with the id given in the system returned
*/
type GetResellerOK struct {
Payload *models.Reseller
}
func (o *GetResellerOK) Error() string {
return fmt.Sprintf("[GET /reseller/{id}][%d] getResellerOK %+v", 200, o.Payload)
}
func (o *GetResellerOK) GetPayload() *models.Reseller {
return o.Payload
}
func (o *GetResellerOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Reseller)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetResellerNotFound creates a GetResellerNotFound with default headers values
func NewGetResellerNotFound() *GetResellerNotFound {
return &GetResellerNotFound{}
}
/*GetResellerNotFound handles this case with default header values.
The reseller with the given id wasn't found
*/
type GetResellerNotFound struct {
Payload *models.ErrorResponse
}
func (o *GetResellerNotFound) Error() string {
return fmt.Sprintf("[GET /reseller/{id}][%d] getResellerNotFound %+v", 404, o.Payload)
}
func (o *GetResellerNotFound) GetPayload() *models.ErrorResponse {
return o.Payload
}
func (o *GetResellerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ErrorResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetResellerInternalServerError creates a GetResellerInternalServerError with default headers values
func NewGetResellerInternalServerError() *GetResellerInternalServerError {
return &GetResellerInternalServerError{}
}
/*GetResellerInternalServerError handles this case with default header values.
Something unexpected happend, error raised
*/
type GetResellerInternalServerError struct {
Payload *models.ErrorResponse
}
func (o *GetResellerInternalServerError) Error() string {
return fmt.Sprintf("[GET /reseller/{id}][%d] getResellerInternalServerError %+v", 500, o.Payload)
}
func (o *GetResellerInternalServerError) GetPayload() *models.ErrorResponse {
return o.Payload
}
func (o *GetResellerInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ErrorResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
| 27.412162 | 146 | 0.754991 |
9bb78e5dd56c4ecf3e874bf0e8eae7acb49eac3f | 6,162 | js | JavaScript | test/exists.spec.js | lykmapipo/mongoose-exists | 49524ec0aa66421fa7930d398306a12d25e43d4d | [
"MIT"
] | 9 | 2017-07-06T14:29:19.000Z | 2020-07-17T08:17:26.000Z | test/exists.spec.js | lykmapipo/mongoose-exists | 49524ec0aa66421fa7930d398306a12d25e43d4d | [
"MIT"
] | 15 | 2018-05-03T13:49:31.000Z | 2021-11-12T04:56:55.000Z | test/exists.spec.js | lykmapipo/mongoose-exists | 49524ec0aa66421fa7930d398306a12d25e43d4d | [
"MIT"
] | 3 | 2018-03-31T13:46:44.000Z | 2019-04-27T10:23:53.000Z | import _ from 'lodash';
import { Schema, ObjectId } from '@lykmapipo/mongoose-common';
import {
create,
clear,
expect,
faker,
createTestModel,
} from '@lykmapipo/mongoose-test-helpers';
import exists from '../src';
const Friend = new Schema({
type: { type: String },
person: { type: ObjectId, ref: 'Person', exists: true },
});
const Person = createTestModel(
{
father: { type: ObjectId, ref: 'Person', exists: true },
mother: { type: ObjectId, ref: 'Person', exists: [true, 'NOT EXIST'] },
relatives: { type: [ObjectId], ref: 'Person', exists: true },
referees: [{ type: ObjectId, ref: 'Person', exists: true }],
friends: { type: [Friend] },
neighbours: [Friend],
sister: {
type: ObjectId,
ref: 'Person',
exists: { refresh: true, message: 'NOT EXIST' },
},
coach: {
type: ObjectId,
ref: 'Person',
exists: { default: true, match: { father: null }, select: { name: 1 } },
},
},
{ modelName: 'Person' },
exists
);
describe('mongoose-exists', () => {
const father = Person.fake();
const mother = Person.fake();
const sister = Person.fake();
const relatives = [Person.fake(), Person.fake()];
const referees = [Person.fake(), Person.fake()];
let friends = [Person.fake(), Person.fake()];
let neighbours = [Person.fake(), Person.fake()];
before((done) => create(father, mother, sister, done));
before((done) => create(relatives, referees, done));
before((done) => {
create(friends, (error, created) => {
friends = _.map(created, (friend) => {
return { type: faker.hacker.ingverb(), person: friend };
});
done(error, created);
});
});
before((done) => {
create(neighbours, (error, created) => {
neighbours = _.map(created, (neighbour) => {
return { type: faker.hacker.ingverb(), person: neighbour };
});
done(error, created);
});
});
it('should be able to create with refs that already exists', (done) => {
const person = {
name: faker.company.companyName(),
father: father._id,
mother: mother._id,
sister: sister._id,
relatives,
referees,
friends,
neighbours,
coach: null,
};
Person.create(person, (error, created) => {
expect(error).to.not.exist;
expect(created).to.exist;
expect(created._id).to.exist;
expect(created.coach).to.exist;
expect(created.name).to.be.equal(person.name);
expect(created.father).to.be.eql(person.father);
expect(created.mother).to.be.eql(person.mother);
expect(created.sister._id).to.be.eql(person.sister);
done(error, created);
});
});
it('should fail to save with ref that not exists', (done) => {
const person = {
name: faker.company.companyName(),
father: Person.fake()._id,
};
Person.create(person, (error /* , created */) => {
expect(error).to.exist;
expect(error.errors.father).to.exist;
expect(error.name).to.be.equal('ValidationError');
expect(error.errors.father.message).to.be.equal(
`father with id ${person.father} does not exists`
);
done();
});
});
it('should fail to save with ref that not exists - custom error message', (done) => {
const person = {
name: faker.company.companyName(),
father,
mother: Person.fake()._id,
};
Person.create(person, (error /* , created */) => {
expect(error).to.exist;
expect(error.errors.mother).to.exist;
expect(error.name).to.be.equal('ValidationError');
expect(error.errors.mother.message).to.be.equal('NOT EXIST');
done();
});
});
it('should fail to save with ref that not exists - custom error message', (done) => {
const person = {
name: faker.company.companyName(),
father,
mother,
sister: Person.fake()._id,
};
Person.create(person, (error /* , created */) => {
expect(error).to.exist;
expect(error.errors.sister).to.exist;
expect(error.name).to.be.equal('ValidationError');
expect(error.errors.sister.message).to.be.equal('NOT EXIST');
done();
});
});
it('should fail to save with ref that not exists', (done) => {
const person = {
name: faker.company.companyName(),
father: father._id,
mother: mother._id,
sister: sister._id,
relatives: [Person.fake()._id, Person.fake()._id],
};
Person.create(person, (error /* , created */) => {
expect(error).to.exist;
expect(error.errors.relatives).to.exist;
expect(error.name).to.be.equal('ValidationError');
expect(error.errors.relatives.message).to.be.equal(
`relatives with id ${person.relatives} does not exists`
);
done();
});
});
it('should fail to save with ref that not exists', (done) => {
const person = {
name: faker.company.companyName(),
father: father._id,
mother: mother._id,
sister: sister._id,
referees: [Person.fake()._id, Person.fake()._id],
};
Person.create(person, (error /* , created */) => {
expect(error).to.exist;
expect(error.errors.referees).to.exist;
expect(error.name).to.be.equal('ValidationError');
expect(error.errors.referees.message).to.be.equal(
`referees with id ${person.referees} does not exists`
);
done();
});
});
it('should fail to save with ref that not exists', (done) => {
const person = {
name: faker.company.companyName(),
father: father._id,
mother: mother._id,
sister: sister._id,
friends: [
{
type: faker.hacker.ingverb(),
person: Person.fake()._id,
},
],
};
Person.create(person, (error /* , created */) => {
expect(error).to.exist;
expect(error.errors['friends.0.person']).to.exist;
expect(error.name).to.be.equal('ValidationError');
expect(error.errors['friends.0.person'].message).to.be.equal(
`person with id ${person.friends[0].person} does not exists`
);
done();
});
});
after((done) => clear(done));
});
| 28.929577 | 87 | 0.588121 |
8f301c88652762ed60ac49fe9d21355622830a68 | 1,748 | swift | Swift | recoveryservicessiterecovery/resource-manager/Sources/recoveryservicessiterecovery/protocols/HyperVReplicaAzureReplicationDetailsProtocol.swift | Azure/azure-libraries-for-swift | b7321f3c719c381894e3ee96c5808dbcc97629d7 | [
"MIT"
] | 9 | 2018-03-13T00:10:01.000Z | 2021-02-04T16:16:48.000Z | recoveryservicessiterecovery/resource-manager/Sources/recoveryservicessiterecovery/protocols/HyperVReplicaAzureReplicationDetailsProtocol.swift | Azure/azure-libraries-for-swift | b7321f3c719c381894e3ee96c5808dbcc97629d7 | [
"MIT"
] | 1 | 2018-03-31T05:08:07.000Z | 2018-04-09T19:54:43.000Z | recoveryservicessiterecovery/resource-manager/Sources/recoveryservicessiterecovery/protocols/HyperVReplicaAzureReplicationDetailsProtocol.swift | Azure/azure-libraries-for-swift | b7321f3c719c381894e3ee96c5808dbcc97629d7 | [
"MIT"
] | 5 | 2018-03-13T00:27:36.000Z | 2021-01-10T11:17:48.000Z | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// HyperVReplicaAzureReplicationDetailsProtocol is hyper V Replica Azure provider specific settings.
public protocol HyperVReplicaAzureReplicationDetailsProtocol : ReplicationProviderSpecificSettingsProtocol {
var azureVmDiskDetails: [AzureVmDiskDetailsProtocol?]? { get set }
var recoveryAzureVmName: String? { get set }
var recoveryAzureVMSize: String? { get set }
var recoveryAzureStorageAccount: String? { get set }
var recoveryAzureLogStorageAccountId: String? { get set }
var lastReplicatedTime: Date? { get set }
var rpoInSeconds: Int64? { get set }
var lastRpoCalculatedTime: Date? { get set }
var vmId: String? { get set }
var vmProtectionState: String? { get set }
var vmProtectionStateDescription: String? { get set }
var initialReplicationDetails: InitialReplicationDetailsProtocol? { get set }
var vmNics: [VMNicDetailsProtocol?]? { get set }
var selectedRecoveryAzureNetworkId: String? { get set }
var selectedSourceNicId: String? { get set }
var encryption: String? { get set }
var oSDetails: OSDetailsProtocol? { get set }
var sourceVmRamSizeInMB: Int32? { get set }
var sourceVmCpuCount: Int32? { get set }
var enableRdpOnTargetOption: String? { get set }
var recoveryAzureResourceGroupId: String? { get set }
var recoveryAvailabilitySetId: String? { get set }
var useManagedDisks: String? { get set }
var licenseType: String? { get set }
}
| 52.969697 | 109 | 0.715103 |
3edbb803daa05c8e3e68569e04d9276b6fe888ce | 13,668 | c | C | drivers/net/wireless/bcmdhd_1_77/wl_roam.c | CaelestisZ/HeraQ | 2804afc99bf59c43740038833077ef7b14993592 | [
"MIT"
] | null | null | null | drivers/net/wireless/bcmdhd_1_77/wl_roam.c | CaelestisZ/HeraQ | 2804afc99bf59c43740038833077ef7b14993592 | [
"MIT"
] | null | null | null | drivers/net/wireless/bcmdhd_1_77/wl_roam.c | CaelestisZ/HeraQ | 2804afc99bf59c43740038833077ef7b14993592 | [
"MIT"
] | null | null | null | /*
* Linux roam cache
*
* Copyright (C) 1999-2018, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: wl_roam.c 731718 2017-11-14 08:10:43Z $
*/
#ifdef ROAM_CHANNEL_CACHE
#include <typedefs.h>
#include <osl.h>
#include <bcmwifi_channels.h>
#include <wlioctl.h>
#include <bcmutils.h>
#ifdef WL_CFG80211
#include <wl_cfg80211.h>
#endif
#include <wldev_common.h>
#define MAX_ROAM_CACHE 200
#define MAX_SSID_BUFSIZE 36
#define ROAMSCAN_MODE_NORMAL 0
#define ROAMSCAN_MODE_WES 1
typedef struct {
chanspec_t chanspec;
int ssid_len;
char ssid[MAX_SSID_BUFSIZE];
} roam_channel_cache;
static int n_roam_cache = 0;
static int roam_band = WLC_BAND_AUTO;
static roam_channel_cache roam_cache[MAX_ROAM_CACHE];
static uint band2G, band5G, band_bw;
#ifdef WES_SUPPORT
static int roamscan_mode = ROAMSCAN_MODE_NORMAL;
#endif /* WES_SUPPORT */
int init_roam_cache(struct bcm_cfg80211 *cfg, int ioctl_ver)
{
int err;
struct net_device *dev = bcmcfg_to_prmry_ndev(cfg);
s32 mode;
/* Check support in firmware */
err = wldev_iovar_getint(dev, "roamscan_mode", &mode);
if (err && (err == BCME_UNSUPPORTED)) {
/* If firmware doesn't support, return error. Else proceed */
WL_ERR(("roamscan_mode iovar failed. %d\n", err));
return err;
}
#ifdef D11AC_IOTYPES
if (ioctl_ver == 1) {
/* legacy chanspec */
band2G = WL_LCHANSPEC_BAND_2G;
band5G = WL_LCHANSPEC_BAND_5G;
band_bw = WL_LCHANSPEC_BW_20 | WL_LCHANSPEC_CTL_SB_NONE;
} else {
band2G = WL_CHANSPEC_BAND_2G;
band5G = WL_CHANSPEC_BAND_5G;
band_bw = WL_CHANSPEC_BW_20;
}
#else
band2G = WL_CHANSPEC_BAND_2G;
band5G = WL_CHANSPEC_BAND_5G;
band_bw = WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
#endif /* D11AC_IOTYPES */
n_roam_cache = 0;
roam_band = WLC_BAND_AUTO;
#ifdef WES_SUPPORT
roamscan_mode = ROAMSCAN_MODE_NORMAL;
#endif /* WES_SUPPORT */
return 0;
}
#ifdef WES_SUPPORT
int get_roamscan_mode(struct net_device *dev, int *mode)
{
*mode = roamscan_mode;
return 0;
}
int set_roamscan_mode(struct net_device *dev, int mode)
{
int error = 0;
roamscan_mode = mode;
n_roam_cache = 0;
error = wldev_iovar_setint(dev, "roamscan_mode", mode);
if (error) {
WL_ERR(("Failed to set roamscan mode to %d, error = %d\n", mode, error));
}
return error;
}
int get_roamscan_channel_list(struct net_device *dev, unsigned char channels[],
int n_channels)
{
int n = 0;
int max_channel_number = MIN(n_channels, n_roam_cache);
if (roamscan_mode == ROAMSCAN_MODE_WES) {
for (n = 0; n < max_channel_number; n++) {
channels[n] = roam_cache[n].chanspec & WL_CHANSPEC_CHAN_MASK;
WL_DBG(("channel[%d] - [%02d] \n", n, channels[n]));
}
}
return n;
}
int set_roamscan_channel_list(struct net_device *dev,
unsigned char n, unsigned char channels[], int ioctl_ver)
{
int i;
int error;
wl_roam_channel_list_t channel_list;
char iobuf[WLC_IOCTL_SMLEN];
roamscan_mode = ROAMSCAN_MODE_WES;
if (n > MAX_ROAM_CHANNEL)
n = MAX_ROAM_CHANNEL;
for (i = 0; i < n; i++) {
chanspec_t chanspec;
if (channels[i] <= CH_MAX_2G_CHANNEL) {
chanspec = band2G | band_bw | channels[i];
} else {
chanspec = band5G | band_bw | channels[i];
}
roam_cache[i].chanspec = chanspec;
channel_list.channels[i] = chanspec;
WL_DBG(("channel[%d] - [%02d] \n", i, channels[i]));
}
n_roam_cache = n;
channel_list.n = n;
/* need to set ROAMSCAN_MODE_NORMAL to update roamscan_channels,
* otherwise, it won't be updated
*/
wldev_iovar_setint(dev, "roamscan_mode", ROAMSCAN_MODE_NORMAL);
error = wldev_iovar_setbuf(dev, "roamscan_channels", &channel_list,
sizeof(channel_list), iobuf, sizeof(iobuf), NULL);
if (error) {
WL_DBG(("Failed to set roamscan channels, error = %d\n", error));
}
wldev_iovar_setint(dev, "roamscan_mode", ROAMSCAN_MODE_WES);
return error;
}
#endif /* WES_SUPPORT */
void set_roam_band(int band)
{
roam_band = band;
}
void reset_roam_cache(struct bcm_cfg80211 *cfg)
{
if (!cfg->rcc_enabled) {
return;
}
#ifdef WES_SUPPORT
if (roamscan_mode == ROAMSCAN_MODE_WES)
return;
#endif /* WES_SUPPORT */
n_roam_cache = 0;
}
void add_roam_cache(struct bcm_cfg80211 *cfg, wl_bss_info_t *bi)
{
int i;
uint8 channel;
char chanbuf[CHANSPEC_STR_LEN];
if (!cfg->rcc_enabled) {
return;
}
#ifdef WES_SUPPORT
if (roamscan_mode == ROAMSCAN_MODE_WES)
return;
#endif /* WES_SUPPORT */
if (n_roam_cache >= MAX_ROAM_CACHE)
return;
for (i = 0; i < n_roam_cache; i++) {
if ((roam_cache[i].ssid_len == bi->SSID_len) &&
(roam_cache[i].chanspec == bi->chanspec) &&
(memcmp(roam_cache[i].ssid, bi->SSID, bi->SSID_len) == 0)) {
/* identical one found, just return */
return;
}
}
roam_cache[n_roam_cache].ssid_len = bi->SSID_len;
channel = wf_chspec_ctlchan(bi->chanspec);
WL_DBG(("CHSPEC = %s, CTL %d\n", wf_chspec_ntoa_ex(bi->chanspec, chanbuf), channel));
roam_cache[n_roam_cache].chanspec =
(channel <= CH_MAX_2G_CHANNEL ? band2G : band5G) | band_bw | channel;
memcpy(roam_cache[n_roam_cache].ssid, bi->SSID, bi->SSID_len);
n_roam_cache++;
}
static bool is_duplicated_channel(const chanspec_t *channels, int n_channels, chanspec_t new)
{
int i;
for (i = 0; i < n_channels; i++) {
if (channels[i] == new)
return TRUE;
}
return FALSE;
}
int get_roam_channel_list(int target_chan,
chanspec_t *channels, int n_channels, const wlc_ssid_t *ssid, int ioctl_ver)
{
int i, n = 1;
char chanbuf[CHANSPEC_STR_LEN];
/* first index is filled with the given target channel */
if (target_chan) {
channels[0] = (target_chan & WL_CHANSPEC_CHAN_MASK) |
(target_chan <= CH_MAX_2G_CHANNEL ? band2G : band5G) | band_bw;
} else {
/* If target channel is not provided, set the index to 0 */
n = 0;
}
WL_DBG((" %s: %03d 0x%04X\n", __FUNCTION__, target_chan, channels[0]));
#ifdef WES_SUPPORT
if (roamscan_mode == ROAMSCAN_MODE_WES) {
for (i = 0; i < n_roam_cache; i++) {
chanspec_t ch = roam_cache[i].chanspec;
bool is_2G = ioctl_ver == 1 ? LCHSPEC_IS2G(ch) : CHSPEC_IS2G(ch);
bool is_5G = ioctl_ver == 1 ? LCHSPEC_IS5G(ch) : CHSPEC_IS5G(ch);
bool band_match = ((roam_band == WLC_BAND_AUTO) ||
((roam_band == WLC_BAND_2G) && is_2G) ||
((roam_band == WLC_BAND_5G) && is_5G));
ch = CHSPEC_CHANNEL(ch) | (is_2G ? band2G : band5G) | band_bw;
if (band_match && !is_duplicated_channel(channels, n, ch)) {
WL_DBG(("%s: Chanspec = %s\n", __FUNCTION__,
wf_chspec_ntoa_ex(ch, chanbuf)));
channels[n++] = ch;
if (n >= n_channels) {
WL_ERR(("Too many roam scan channels\n"));
return n;
}
}
}
return n;
}
#endif /* WES_SUPPORT */
for (i = 0; i < n_roam_cache; i++) {
chanspec_t ch = roam_cache[i].chanspec;
bool is_2G = ioctl_ver == 1 ? LCHSPEC_IS2G(ch) : CHSPEC_IS2G(ch);
bool is_5G = ioctl_ver == 1 ? LCHSPEC_IS5G(ch) : CHSPEC_IS5G(ch);
bool band_match = ((roam_band == WLC_BAND_AUTO) ||
((roam_band == WLC_BAND_2G) && is_2G) ||
((roam_band == WLC_BAND_5G) && is_5G));
ch = CHSPEC_CHANNEL(ch) | (is_2G ? band2G : band5G) | band_bw;
if ((roam_cache[i].ssid_len == ssid->SSID_len) &&
band_match && !is_duplicated_channel(channels, n, ch) &&
(memcmp(roam_cache[i].ssid, ssid->SSID, ssid->SSID_len) == 0)) {
/* match found, add it */
WL_DBG(("%s: Chanspec = %s\n", __FUNCTION__,
wf_chspec_ntoa_ex(ch, chanbuf)));
channels[n++] = ch;
if (n >= n_channels) {
WL_ERR(("Too many roam scan channels\n"));
return n;
}
}
}
return n;
}
void print_roam_cache(struct bcm_cfg80211 *cfg)
{
int i;
if (!cfg->rcc_enabled) {
return;
}
WL_DBG((" %d cache\n", n_roam_cache));
for (i = 0; i < n_roam_cache; i++) {
roam_cache[i].ssid[roam_cache[i].ssid_len] = 0;
WL_DBG(("0x%02X %02d %s\n", roam_cache[i].chanspec,
roam_cache[i].ssid_len, roam_cache[i].ssid));
}
}
static void add_roamcache_channel(wl_roam_channel_list_t *channels, chanspec_t ch)
{
int i;
if (channels->n >= MAX_ROAM_CHANNEL) /* buffer full */
return;
for (i = 0; i < channels->n; i++) {
if (channels->channels[i] == ch) /* already in the list */
return;
}
channels->channels[i] = ch;
channels->n++;
WL_DBG((" RCC: %02d 0x%04X\n",
ch & WL_CHANSPEC_CHAN_MASK, ch));
}
void update_roam_cache(struct bcm_cfg80211 *cfg, int ioctl_ver)
{
int error, i, prev_channels;
wl_roam_channel_list_t channel_list;
char iobuf[WLC_IOCTL_SMLEN];
struct net_device *dev = bcmcfg_to_prmry_ndev(cfg);
wlc_ssid_t ssid;
if (!cfg->rcc_enabled) {
return;
}
#ifdef WES_SUPPORT
if (roamscan_mode == ROAMSCAN_MODE_WES) {
/* no update when ROAMSCAN_MODE_WES */
return;
}
#endif /* WES_SUPPORT */
if (!wl_get_drv_status(cfg, CONNECTED, dev)) {
WL_DBG(("Not associated\n"));
return;
}
/* need to read out the current cache list
as the firmware may change dynamically
*/
error = wldev_iovar_getbuf(dev, "roamscan_channels", 0, 0,
(void *)&channel_list, sizeof(channel_list), NULL);
if (error) {
WL_ERR(("Failed to get roamscan channels, error = %d\n", error));
return;
}
error = wldev_get_ssid(dev, &ssid);
if (error) {
WL_ERR(("Failed to get SSID, err=%d\n", error));
return;
}
prev_channels = channel_list.n;
for (i = 0; i < n_roam_cache; i++) {
chanspec_t ch = roam_cache[i].chanspec;
bool is_2G = ioctl_ver == 1 ? LCHSPEC_IS2G(ch) : CHSPEC_IS2G(ch);
bool is_5G = ioctl_ver == 1 ? LCHSPEC_IS5G(ch) : CHSPEC_IS5G(ch);
bool band_match = ((roam_band == WLC_BAND_AUTO) ||
((roam_band == WLC_BAND_2G) && is_2G) ||
((roam_band == WLC_BAND_5G) && is_5G));
if ((roam_cache[i].ssid_len == ssid.SSID_len) &&
band_match && (memcmp(roam_cache[i].ssid, ssid.SSID, ssid.SSID_len) == 0)) {
/* match found, add it */
ch = CHSPEC_CHANNEL(ch) | (is_2G ? band2G : band5G) | band_bw;
add_roamcache_channel(&channel_list, ch);
}
}
if (prev_channels != channel_list.n) {
/* channel list updated */
error = wldev_iovar_setbuf(dev, "roamscan_channels", &channel_list,
sizeof(channel_list), iobuf, sizeof(iobuf), NULL);
if (error) {
WL_ERR(("Failed to update roamscan channels, error = %d\n", error));
}
}
WL_DBG(("%d AP, %d cache item(s), err=%d\n", n_roam_cache, channel_list.n, error));
}
void wl_update_roamscan_cache_by_band(struct net_device *dev, int band)
{
int i, error, ioctl_ver, wes_mode;
wl_roam_channel_list_t chanlist_before, chanlist_after;
char iobuf[WLC_IOCTL_SMLEN];
roam_band = band;
error = wldev_iovar_getint(dev, "roamscan_mode", &wes_mode);
if (error) {
WL_ERR(("Failed to get roamscan mode, error = %d\n", error));
return;
}
ioctl_ver = wl_cfg80211_get_ioctl_version();
/* in case of WES mode, update channel list by band based on the cache in DHD */
if (wes_mode) {
int n = 0;
chanlist_before.n = n_roam_cache;
for (n = 0; n < n_roam_cache; n++) {
chanspec_t ch = roam_cache[n].chanspec;
bool is_2G = ioctl_ver == 1 ? LCHSPEC_IS2G(ch) : CHSPEC_IS2G(ch);
chanlist_before.channels[n] = CHSPEC_CHANNEL(ch) |
(is_2G ? band2G : band5G) | band_bw;
}
} else {
if (band == WLC_BAND_AUTO) {
return;
}
error = wldev_iovar_getbuf(dev, "roamscan_channels", 0, 0,
(void *)&chanlist_before, sizeof(wl_roam_channel_list_t), NULL);
if (error) {
WL_ERR(("Failed to get roamscan channels, error = %d\n", error));
return;
}
}
chanlist_after.n = 0;
/* filtering by the given band */
for (i = 0; i < chanlist_before.n; i++) {
chanspec_t chspec = chanlist_before.channels[i];
bool is_2G = ioctl_ver == 1 ? LCHSPEC_IS2G(chspec) : CHSPEC_IS2G(chspec);
bool is_5G = ioctl_ver == 1 ? LCHSPEC_IS5G(chspec) : CHSPEC_IS5G(chspec);
bool band_match = ((band == WLC_BAND_AUTO) ||
((band == WLC_BAND_2G) && is_2G) ||
((band == WLC_BAND_5G) && is_5G));
if (band_match) {
chanlist_after.channels[chanlist_after.n++] = chspec;
}
}
if (wes_mode) {
/* need to set ROAMSCAN_MODE_NORMAL to update roamscan_channels,
* otherwise, it won't be updated
*/
wldev_iovar_setint(dev, "roamscan_mode", ROAMSCAN_MODE_NORMAL);
error = wldev_iovar_setbuf(dev, "roamscan_channels", &chanlist_after,
sizeof(wl_roam_channel_list_t), iobuf, sizeof(iobuf), NULL);
if (error) {
WL_ERR(("Failed to update roamscan channels, error = %d\n", error));
}
wldev_iovar_setint(dev, "roamscan_mode", ROAMSCAN_MODE_WES);
} else {
if (chanlist_before.n == chanlist_after.n) {
return;
}
error = wldev_iovar_setbuf(dev, "roamscan_channels", &chanlist_after,
sizeof(wl_roam_channel_list_t), iobuf, sizeof(iobuf), NULL);
if (error) {
WL_ERR(("Failed to update roamscan channels, error = %d\n", error));
}
}
}
#endif /* ROAM_CHANNEL_CACHE */
| 27.227092 | 93 | 0.688396 |
b1776641aca067963e62a6c27628ae3d50aaa47d | 397 | kt | Kotlin | src/test/kotlin/ch/veehait/devicecheck/appattest/KotestConfig.kt | veehaitch/devicecheck-appattest | 6c0cdadc5e381e46eb19fc1692062b0289d81315 | [
"Apache-2.0"
] | 40 | 2020-09-19T13:10:07.000Z | 2022-03-22T08:13:55.000Z | src/test/kotlin/ch/veehait/devicecheck/appattest/KotestConfig.kt | veehaitch/devicecheck-appattest | 6c0cdadc5e381e46eb19fc1692062b0289d81315 | [
"Apache-2.0"
] | 18 | 2021-04-24T20:27:53.000Z | 2022-01-04T15:30:20.000Z | src/test/kotlin/ch/veehait/devicecheck/appattest/KotestConfig.kt | veehaitch/devicecheck-appattest | 6c0cdadc5e381e46eb19fc1692062b0289d81315 | [
"Apache-2.0"
] | 5 | 2021-07-12T15:07:57.000Z | 2021-12-15T14:53:54.000Z | package ch.veehait.devicecheck.appattest
import io.kotest.core.config.AbstractProjectConfig
import org.bouncycastle.jce.provider.BouncyCastleProvider
import java.security.Security
@Suppress("unused")
object KotestConfig : AbstractProjectConfig() {
override val parallelism = Runtime.getRuntime().availableProcessors()
init {
Security.addProvider(BouncyCastleProvider())
}
}
| 26.466667 | 73 | 0.788413 |
a0a502ed87049b5420fa43c6bdf0266492e12e00 | 880 | kt | Kotlin | day21/Part2.kt | anthaas/Advent-of-Code-2020 | aba452e0f6dd207e34d17b29e2c91ee21c1f3e41 | [
"MIT"
] | null | null | null | day21/Part2.kt | anthaas/Advent-of-Code-2020 | aba452e0f6dd207e34d17b29e2c91ee21c1f3e41 | [
"MIT"
] | null | null | null | day21/Part2.kt | anthaas/Advent-of-Code-2020 | aba452e0f6dd207e34d17b29e2c91ee21c1f3e41 | [
"MIT"
] | null | null | null | import java.io.File
fun main(args: Array<String>) {
val input = File("input.txt").readLines().map {
it.split(" (contains ").let { (ingredients, allergens) ->
ingredients.split(" ") to allergens.replace(")", "").split(", ")
}
}
val translator = input.map { it.second.toSet() }.reduce { acc, set -> acc.union(set) }.map { allergen ->
allergen to input.filter { it.second.contains(allergen) }.map { it.first.toSet() }
.reduce { acc, set -> acc.intersect(set) }.toMutableSet()
}
while (!translator.map { it.second.size == 1 }.all { it }) {
val toRemove = translator.filter { it.second.size == 1 }.map { it.second }.flatten()
translator.forEach { if (it.second.size != 1) it.second.removeAll(toRemove) }
}
println(translator.sortedBy { it.first }.joinToString(",") { it.second.first() })
} | 41.904762 | 108 | 0.593182 |
39e67f9da1b3975473f115312196b8e15a8e3d0a | 1,448 | java | Java | src/main/java/com/emarte/regurgitator/extensions/FreemarkerBuilderJsonLoader.java | talmeym/regurgitator-extensions-json | 223eef09f472c61771ca3b1db4dd5adb33138819 | [
"MIT"
] | null | null | null | src/main/java/com/emarte/regurgitator/extensions/FreemarkerBuilderJsonLoader.java | talmeym/regurgitator-extensions-json | 223eef09f472c61771ca3b1db4dd5adb33138819 | [
"MIT"
] | null | null | null | src/main/java/com/emarte/regurgitator/extensions/FreemarkerBuilderJsonLoader.java | talmeym/regurgitator-extensions-json | 223eef09f472c61771ca3b1db4dd5adb33138819 | [
"MIT"
] | null | null | null | /*
* Copyright (C) 2017 Miles Talmey.
* Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
*/
package com.emarte.regurgitator.extensions;
import com.emarte.regurgitator.core.JsonLoader;
import com.emarte.regurgitator.core.Log;
import com.emarte.regurgitator.core.RegurgitatorException;
import com.emarte.regurgitator.core.ValueBuilder;
import net.sf.json.JSONObject;
import java.util.Set;
import static com.emarte.regurgitator.core.CoreConfigConstants.*;
import static com.emarte.regurgitator.core.JsonConfigUtil.loadOptionalBool;
import static com.emarte.regurgitator.core.JsonConfigUtil.loadOptionalStr;
import static com.emarte.regurgitator.core.Log.getLog;
import static com.emarte.regurgitator.extensions.ExtensionsConfigConstants.ALL_CONTEXTS;
public class FreemarkerBuilderJsonLoader extends FreemarkerBuilderLoader implements JsonLoader<ValueBuilder> {
private static final Log log = getLog(FreemarkerBuilderJsonLoader.class);
@Override
public ValueBuilder load(JSONObject jsonObject, Set<Object> allIds) throws RegurgitatorException {
String source = loadOptionalStr(jsonObject, SOURCE);
String value = loadOptionalStr(jsonObject, VALUE);
String file = loadOptionalStr(jsonObject, FILE);
boolean allContexts = loadOptionalBool(jsonObject, ALL_CONTEXTS);
return buildFreemarkerValueBuilder(source, value, file, allContexts, log);
}
}
| 43.878788 | 110 | 0.800414 |
458987d6a1ce6569b3c98abedfb75af4c5241eed | 620 | kt | Kotlin | src/main/kotlin/net/lomeli/minewell/potion/PotionSkyTouch.kt | Lomeli12/Minewell | 4378a86bba82ac8772dd9bbc7c28f3964a964630 | [
"MIT"
] | null | null | null | src/main/kotlin/net/lomeli/minewell/potion/PotionSkyTouch.kt | Lomeli12/Minewell | 4378a86bba82ac8772dd9bbc7c28f3964a964630 | [
"MIT"
] | null | null | null | src/main/kotlin/net/lomeli/minewell/potion/PotionSkyTouch.kt | Lomeli12/Minewell | 4378a86bba82ac8772dd9bbc7c28f3964a964630 | [
"MIT"
] | null | null | null | package net.lomeli.minewell.potion
import net.lomeli.minewell.Minewell
import net.minecraft.entity.EntityLivingBase
class PotionSkyTouch : PotionBase(false, 0x630063) {
init {
setIconIndex(0, 0)
setPotionName("potion.${Minewell.MOD_ID}.sky_touch")
setRegName("sky_touch")
}
override fun performEffect(entityLivingBaseIn: EntityLivingBase, amplifier: Int) {
if (entityLivingBaseIn.isPotionActive(ModPotions.VOID_TOUCH))
entityLivingBaseIn.removePotionEffect(ModPotions.VOID_TOUCH)
}
override fun isReady(duration: Int, amplifier: Int): Boolean = true
} | 31 | 86 | 0.732258 |
16a11e0a7b5644bcf363fc603d3beace6628eee0 | 818 | ts | TypeScript | packages/site-api/__test__/util/snapshot.ts | guanghechen/static-site-api | 654fb7bc8dffd21a0c44816625638559b9f84b74 | [
"MIT"
] | null | null | null | packages/site-api/__test__/util/snapshot.ts | guanghechen/static-site-api | 654fb7bc8dffd21a0c44816625638559b9f84b74 | [
"MIT"
] | null | null | null | packages/site-api/__test__/util/snapshot.ts | guanghechen/static-site-api | 654fb7bc8dffd21a0c44816625638559b9f84b74 | [
"MIT"
] | null | null | null | import path from 'path'
import stripAnsi from 'strip-ansi'
const WORKSPACE_ROOT_DIR = path.resolve(__dirname, '../..')
/**
*
* @param key
* @param value
*/
export const assetDataReplacer = (
key: string,
value: unknown,
): unknown | undefined => {
if (['createAt', 'lastModifiedTime', 'updateAt'].includes(key)) {
return '<' + typeof value + '>'
}
return typeof value === 'string' ? stripAnsi(value) : value
}
/**
* Remove sensitive data
*
* @param data
*/
export function desensitize<D extends unknown = unknown>(
data: D,
replacer?: (key: string, value: unknown) => unknown | undefined,
): D {
// No replaceAll, so use .split().join as a alternative
const str = JSON.stringify(data, replacer)
.split(WORKSPACE_ROOT_DIR)
.join('<PACKAGE_ROOT_DIR>')
return JSON.parse(str)
}
| 22.722222 | 67 | 0.655257 |
b7666a2d4c5613636e8a9b713548b3ebbf5be5e2 | 7,665 | swift | Swift | Classes/LuTopAlertView.swift | RamboLouis/LuKit | b84afd85d2cd10b71a4390aecbe9158d902cd60a | [
"MIT"
] | null | null | null | Classes/LuTopAlertView.swift | RamboLouis/LuKit | b84afd85d2cd10b71a4390aecbe9158d902cd60a | [
"MIT"
] | null | null | null | Classes/LuTopAlertView.swift | RamboLouis/LuKit | b84afd85d2cd10b71a4390aecbe9158d902cd60a | [
"MIT"
] | null | null | null | //
// LuTopAlertView.swift
// LuDemo
//
// Created by 路政浩 on 2017/3/23.
// Copyright © 2017年 RamboLu. All rights reserved.
//
import UIKit
let SCREENW = UIScreen.main.bounds.width
let SCREENH = UIScreen.main.bounds.height
let SCREEN_SCALE_WIDTH = UIScreen.main.bounds.width / 750.0
let SCREEN_SCALE_HEIGHT = UIScreen.main.bounds.height / 1334.0
private let topFilterAlertViewCellID = "topAlertViewCellID"
fileprivate enum topAlertType : Int {
case FilterAlertView
case SelectAlertView
}
class LuTopAlertView: UIViewController,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout{
fileprivate var strongSelf : UIViewController?
fileprivate var clickIndexPath : IndexPath = IndexPath(item: 0, section: 0)
fileprivate var filterAlertTextArr : [String]?
/// 弹出筛选器
fileprivate var topFilterAlertView : UICollectionView!
func showFilterAlertView(textArr: [String]){
showTopBaseView(topAlertType: .FilterAlertView, textArr: textArr)
}
private func showTopBaseView(topAlertType:topAlertType,textArr: [String]?){
let window = UIApplication.shared.keyWindow!
window.addSubview(view)
window.bringSubview(toFront:view)
strongSelf = self
switch topAlertType {
case .FilterAlertView:
filterAlertTextArr = textArr
setFilterAlertView()
showAnimation(topFilterAlertView)
break
default:
break
}
}
}
extension LuTopAlertView{
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
// dismissAlert()
hideAnimation(topFilterAlertView)
}
}
// MARK: - 设置顶部筛选弹框视图
extension LuTopAlertView{
fileprivate func setFilterAlertView(){
view.frame = CGRect.init(x: 0, y: 64, width: SCREENW, height: SCREENH - 64)
view.backgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.5)
let flowLayout = UICollectionViewFlowLayout()
flowLayout.itemSize = CGSize(width: UIScreen.main.bounds.width / 750.0 * 120, height: UIScreen.main.bounds.height / 1334.0 * 60)
flowLayout.sectionInset = UIEdgeInsets(top: SCREEN_SCALE_HEIGHT * 20, left: SCREEN_SCALE_WIDTH * 45, bottom: SCREEN_SCALE_HEIGHT * 20, right: SCREEN_SCALE_WIDTH * 45)
flowLayout.minimumInteritemSpacing = SCREEN_SCALE_WIDTH * 40
topFilterAlertView = UICollectionView(frame: CGRect.init(x: 0, y: 0, width: SCREENW, height: 0), collectionViewLayout: flowLayout)
topFilterAlertView.backgroundColor = UIColor.white
topFilterAlertView.delegate = self
topFilterAlertView.dataSource = self
topFilterAlertView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0)
topFilterAlertView.register(LuTopFilterAlertViewCell.self, forCellWithReuseIdentifier: topFilterAlertViewCellID)
view.addSubview(topFilterAlertView)
}
}
extension LuTopAlertView{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
debugPrint("数组数量\(filterAlertTextArr?.count)")
return filterAlertTextArr!.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: topFilterAlertViewCellID, for: indexPath) as! LuTopFilterAlertViewCell
if indexPath.row == 0{
cell.filterCellimageView.isHidden = false
cell.filterCellLabel.textColor = UIColor.white
}
cell.filterCellLabel.text = filterAlertTextArr?[indexPath.row]
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let cell = collectionView.cellForItem(at: indexPath) as? LuTopFilterAlertViewCell
if clickIndexPath != indexPath {
let otherCell = collectionView.cellForItem(at: clickIndexPath) as? LuTopFilterAlertViewCell
otherCell?.filterCellimageView.isHidden = true
otherCell?.filterCellLabel.textColor = UIColor.colorWithString("#888888")
}
clickIndexPath = indexPath
cell?.filterCellimageView.isHidden = false
cell?.filterCellLabel.textColor = UIColor.white
debugPrint("这是\(indexPath.row)个item")
// if indexNumBlock != nil{
// indexNumBlock!(indexPath.row)
// }
// DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(0.5 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: {
// self.disAlert()
// })
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
var itemSize = CGSize(width: SCREEN_SCALE_WIDTH * 120, height: SCREEN_SCALE_HEIGHT * 60)
// if filterAlertTextArr?[indexPath.row].characters.count == 4 {
// itemSize = CGSize(width: SCREEN_SCALE_WIDTH * 160 , height: SCREEN_SCALE_HEIGHT * 60)
// }
let count = Int((filterAlertTextArr?[indexPath.row].characters.count)!)
switch count {
case 4 :
itemSize = CGSize(width: SCREEN_SCALE_WIDTH * 160 , height: SCREEN_SCALE_HEIGHT * 60)
break
default:
break
}
return itemSize
}
}
extension LuTopAlertView{
fileprivate func showAnimation(_ view: UIView){
UIView.animate(withDuration: 0.2) {
var frame = view.frame
frame.size.height = 100
view.frame = frame
}
}
fileprivate func hideAnimation(_ view: UIView){
UIView.animate(withDuration: 0.2, animations: {
var frame = view.frame
frame.size.height = 0
view.frame = frame
}) { (complete) in
self.dismissAlert()
}
}
fileprivate func dismissAlert(){
view.removeFromSuperview()
strongSelf = nil
}
}
class LuTopFilterAlertViewCell: UICollectionViewCell{
override init(frame: CGRect) {
super.init(frame: frame)
setUI()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var filterCellLabel = UILabel()
lazy var filterCellimageView: UIView = {
let filterCellimageView = UIView()
filterCellimageView.backgroundColor = UIColor.colorWithString("#888888")
filterCellimageView.layer.cornerRadius = SCREEN_SCALE_WIDTH * 5
filterCellimageView.layer.masksToBounds = true
filterCellimageView.isUserInteractionEnabled = true
return filterCellimageView
}()
func setUI(){
backgroundColor = UIColor.white
filterCellLabel.text = "测试"
filterCellLabel.font = UIFont.systemFont(ofSize: SCREEN_SCALE_WIDTH * 30)
filterCellLabel.textColor = UIColor.colorWithString("#888888")
filterCellimageView.isHidden = true
filterCellimageView.frame = self.bounds
contentView.addSubview(filterCellimageView)
contentView.addSubview(filterCellLabel)
filterCellLabel.snp.makeConstraints { (make) in
make.center.equalToSuperview()
}
}
}
| 37.758621 | 174 | 0.649315 |
39f8fddaf3eb234edf04c9e4071079b044803f7c | 3,053 | swift | Swift | tests/box_convert2abq.swift | parallelworks/welding | eb1fe04e9f1be1d374782f7476767dcf2197fe36 | [
"MIT"
] | null | null | null | tests/box_convert2abq.swift | parallelworks/welding | eb1fe04e9f1be1d374782f7476767dcf2197fe36 | [
"MIT"
] | null | null | null | tests/box_convert2abq.swift | parallelworks/welding | eb1fe04e9f1be1d374782f7476767dcf2197fe36 | [
"MIT"
] | null | null | null | import "stdlib.v2";
type file;
# ------ INPUT / OUTPUT DEFINITIONS -------#
string geomFileName = arg("geomFile", "box.step");
string meshFileName = arg("meshFile", "box_mesh");
string simParamsFileName = arg("simParamsFile", "boxSimFile");
string sweepParamsFileName = arg("sweepParamFile", "sweepParams.run");
file fgeom <strcat("inputs/",geomFileName)>;
file fsweepParams <strcat("inputs/",sweepParamsFileName)>;
file meshScript <"utils/boxMesh_inputFile.py">;
file utils[] <filesys_mapper;location="utils">; #, suffix=".py">;
file convertScript <"utils/unv2abaqus.py">;
# ------ APP DEFINITIONS --------------------#
# Read parameters from the sweepParams file and write to cases file
app (file cases) expandSweep (file sweepParams, file[] utils) {
python2 "utils/expandSweep.py" filename(sweepParams) filename(cases);
}
# Read the cases file and generate a simFileParams file for each case
app (file[] simFileParams) writeSimParamFiles (file cases, file[] utils, string simFilesDir, string simFileRootName) {
python "utils/writeSimParamFiles.py" filename(cases) simFilesDir simFileRootName;
}
#
# Generate mesh by running a Salome Python script
# Example of running Python mesh script by Salome :
# salome start -t -w 1 boxMesh_inputFile.py args:inputs/geomMeshParams.in,inputs/box.step,outputs/box_mesh.unv
#
app (file fmesh, file ferr) makeMesh (file meshScript, file fgeom, file utils[], file fsimParams ) {
salome "start" "-t" "-w 1" filename(meshScript) stderr=filename(ferr) strcat("args:",
filename(fsimParams), ",", filename(fgeom), ",", filename(fmesh));
}
(string nameNoSuffix) trimSuffix (string nameWithSuffix){
int suffixStartLoc = lastIndexOf(nameWithSuffix, ".", -1);
nameNoSuffix = substring(nameWithSuffix, 0, suffixStartLoc);
}
# Convert the mesh to abaqus format
app (file fmeshInp, file ferr) convertMesh (file convertScript, file fmesh, file utils[], string meshInpName){
python2 filename(convertScript) filename(fmesh) meshInpName stderr=filename(ferr);
}
#----------------workflow-------------------#
file caseFile <"inputs/cases.list">;
caseFile = expandSweep(fsweepParams, utils);
string simFilesDir = "inputs/simParamFiles/";
file[] simFileParams <filesys_mapper;location=simFilesDir>;
simFileParams = writeSimParamFiles(caseFile, utils, simFilesDir, simParamsFileName);
file[] fmeshes;
file[] fAbqMeshes;
foreach fsimParams,i in simFileParams{
file fmesh <strcat("outputs/", meshFileName,i,".unv")>;
file salomeErr <strcat("outputs/salome",i,".err")>;
(fmesh, salomeErr) = makeMesh(meshScript, fgeom, utils, fsimParams);
fmeshes[i] = fmesh;
string AbqMeshName = strcat("outputs/", meshFileName,i);
file fAbqMesh <strcat(AbqMeshName, ".inp")>;
file meshConvErr <strcat("outputs/meshConv", i, ".err")>;
(fAbqMesh, meshConvErr) = convertMesh(convertScript, fmesh, utils, AbqMeshName);
trace(trimSuffix(filename(fAbqMesh)));
fAbqMeshes[i] = fAbqMesh;
}
| 39.649351 | 118 | 0.700622 |
cb636f070c49662252a2d93d33e2ab7fb769d34b | 2,405 | go | Go | core/peer/msp/mgmt.go | memoutng/BlockchainTesteo | d40e10cb07ae76b823785690ee01767d86469b00 | [
"Apache-2.0"
] | null | null | null | core/peer/msp/mgmt.go | memoutng/BlockchainTesteo | d40e10cb07ae76b823785690ee01767d86469b00 | [
"Apache-2.0"
] | null | null | null | core/peer/msp/mgmt.go | memoutng/BlockchainTesteo | d40e10cb07ae76b823785690ee01767d86469b00 | [
"Apache-2.0"
] | null | null | null | /*
Copyright IBM Corp. 2017 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package mspmgmt
import (
"sync"
"github.com/hyperledger/fabric/msp"
"github.com/op/go-logging"
)
// FIXME: AS SOON AS THE CHAIN MANAGEMENT CODE IS COMPLETE,
// THESE MAPS AND HELPSER FUNCTIONS SHOULD DISAPPEAR BECAUSE
// OWNERSHIP OF PER-CHAIN MSP MANAGERS WILL BE HANDLED BY IT;
// HOWEVER IN THE INTERIM, THESE HELPER FUNCTIONS ARE REQUIRED
var m sync.Mutex
var localMsp msp.MSP
var mspMap map[string]msp.MSPManager = make(map[string]msp.MSPManager)
var peerLogger = logging.MustGetLogger("peer")
// GetManagerForChain returns the msp manager for the supplied
// chain; if no such manager exists, one is created
func GetManagerForChain(ChainID string) msp.MSPManager {
var mspMgr msp.MSPManager
var created bool = false
{
m.Lock()
defer m.Unlock()
mspMgr = mspMap[ChainID]
if mspMgr == nil {
created = true
mspMgr = msp.NewMSPManager()
mspMap[ChainID] = mspMgr
}
}
if created {
peerLogger.Infof("Created new msp manager for chain %s", ChainID)
} else {
peerLogger.Infof("Returinging existing manager for chain %s", ChainID)
}
return mspMgr
}
// GetLocalMSP returns the local msp (and creates it if it doesn't exist)
func GetLocalMSP() msp.MSP {
var lclMsp msp.MSP
var created bool = false
{
m.Lock()
defer m.Unlock()
lclMsp = localMsp
if lclMsp == nil {
var err error
created = true
lclMsp, err = msp.NewBccspMsp()
if err != nil {
peerLogger.Fatalf("Failed to initlaize local MSP, received err %s", err)
}
localMsp = lclMsp
}
}
if created {
peerLogger.Infof("Created new local MSP")
} else {
peerLogger.Infof("Returning existing local MSP")
}
return lclMsp
}
//GetMSPCommon returns the common interface
func GetMSPCommon(chainID string) msp.Common {
if chainID == "" {
return GetLocalMSP()
}
return GetManagerForChain(chainID)
}
| 24.292929 | 76 | 0.731393 |
4ab8ec4e885cdfb1ae6bcd0d834d62d7359cdcba | 294 | swift | Swift | FlickrSlideShow/Classes/Services/NetworkProvider.swift | hsleedevelop/FlickrSlideShowDemo | e88e092577551cc75414e1c0a8b33f8c83879f4f | [
"MIT"
] | null | null | null | FlickrSlideShow/Classes/Services/NetworkProvider.swift | hsleedevelop/FlickrSlideShowDemo | e88e092577551cc75414e1c0a8b33f8c83879f4f | [
"MIT"
] | null | null | null | FlickrSlideShow/Classes/Services/NetworkProvider.swift | hsleedevelop/FlickrSlideShowDemo | e88e092577551cc75414e1c0a8b33f8c83879f4f | [
"MIT"
] | null | null | null | //
// NetworkProvider.swift
// FlickrSlideShow
//
// Created by HS Lee on 01/05/2019.
// Copyright © 2019 HS Lee. All rights reserved.
//
import Foundation
///API 프로바이더 관리 목적
final class NetworkProvider {
static let shared = NetworkProvider()
let flickr = FlickrProvider()
}
| 17.294118 | 49 | 0.680272 |
12d0c7c50ce364bef988c1a79252d13aeede67f8 | 398 | swift | Swift | Pods/Loggie/Loggie/Classes/Utility/URLSessionConfiguration+Loggie.swift | Anteo95/iOS-Nuts-And-Bolts | dc8412e1fb60cbfde06c06026c5f15d1d56c4296 | [
"MIT"
] | 185 | 2019-10-07T18:06:43.000Z | 2022-03-30T23:12:22.000Z | Pods/Loggie/Loggie/Classes/Utility/URLSessionConfiguration+Loggie.swift | Anteo95/iOS-Nuts-And-Bolts | dc8412e1fb60cbfde06c06026c5f15d1d56c4296 | [
"MIT"
] | 9 | 2017-03-27T17:47:18.000Z | 2022-03-08T10:57:21.000Z | Pods/Loggie/Loggie/Classes/Utility/URLSessionConfiguration+Loggie.swift | Anteo95/iOS-Nuts-And-Bolts | dc8412e1fb60cbfde06c06026c5f15d1d56c4296 | [
"MIT"
] | 12 | 2019-10-10T20:12:19.000Z | 2021-11-10T17:28:12.000Z | //
// Loggie.swift
// Pods
//
// Created by Filip Bec on 14/03/2017.
//
//
import UIKit
public extension URLSessionConfiguration {
@objc(loggieSessionConfiguration)
static var loggie: URLSessionConfiguration {
let configuration = URLSessionConfiguration.default
configuration.protocolClasses?.insert(LoggieURLProtocol.self, at: 0)
return configuration
}
}
| 19.9 | 76 | 0.708543 |
6bae85cb6a9e2b5bffcc3808552ffcebbde8db5a | 470 | swift | Swift | Sources/MovieDB/Media/TV/Season/SeasonData.swift | JCofman/tmdb | bca1233a70cd2b615e769ab70139eda7d3cecb71 | [
"MIT"
] | 16 | 2020-04-03T05:39:47.000Z | 2021-12-10T11:26:33.000Z | Sources/MovieDB/Media/TV/Season/SeasonData.swift | JCofman/tmdb | bca1233a70cd2b615e769ab70139eda7d3cecb71 | [
"MIT"
] | 8 | 2020-12-07T19:10:46.000Z | 2022-01-02T21:48:09.000Z | Sources/MovieDB/Media/TV/Season/SeasonData.swift | JCofman/tmdb | bca1233a70cd2b615e769ab70139eda7d3cecb71 | [
"MIT"
] | 1 | 2020-11-13T08:53:33.000Z | 2020-11-13T08:53:33.000Z |
import Foundation
import GraphZahl
import ContextKit
import NIO
class SeasonData: Decodable, GraphQLObject {
let airDate: OptionalDate?
let id: Int
let name: String
let overview: String?
let poster: Image<PosterSize>?
let seasonNumber: Int
private enum CodingKeys: String, CodingKey {
case airDate = "air_date"
case id, name, overview
case poster = "poster_path"
case seasonNumber = "season_number"
}
}
| 21.363636 | 48 | 0.676596 |
2f4119be2b5c29ff0a1583c0cd60a2ea5084b318 | 2,423 | php | PHP | src/CMSBundle/Entity/HotelAcc.php | kamoun/etourisme | a9772c945cfc64cc5c8090f851c2cbee4730248f | [
"MIT"
] | null | null | null | src/CMSBundle/Entity/HotelAcc.php | kamoun/etourisme | a9772c945cfc64cc5c8090f851c2cbee4730248f | [
"MIT"
] | null | null | null | src/CMSBundle/Entity/HotelAcc.php | kamoun/etourisme | a9772c945cfc64cc5c8090f851c2cbee4730248f | [
"MIT"
] | null | null | null | <?php
namespace CMSBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* HotelAcc
*
* @ORM\Table(name="hotelacc")
* @ORM\Entity(repositoryClass="CMSBundle\Repository\HotelAccRepository")
*/
class HotelAcc
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="titre", type="string", length=50, nullable=true)
*/
private $titre;
/**
* @var string
*
* @ORM\Column(name="entete1", type="string", length=50, nullable=true)
*/
private $entete1;
/**
* @var string
*
* @ORM\Column(name="entete2", type="string", length=50, nullable=true)
*/
private $entete2;
/**
* @var bool
*
* @ORM\Column(name="etat", type="boolean", nullable=true)
*/
private $etat;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set titre
*
* @param string $titre
*
* @return HotelAcc
*/
public function setTitre($titre)
{
$this->titre = $titre;
return $this;
}
/**
* Get titre
*
* @return string
*/
public function getTitre()
{
return $this->titre;
}
/**
* Set entete1
*
* @param string $entete1
*
* @return HotelAcc
*/
public function setEntete1($entete1)
{
$this->entete1 = $entete1;
return $this;
}
/**
* Get entete1
*
* @return string
*/
public function getEntete1()
{
return $this->entete1;
}
/**
* Set entete2
*
* @param string $entete2
*
* @return HotelAcc
*/
public function setEntete2($entete2)
{
$this->entete2 = $entete2;
return $this;
}
/**
* Get entete2
*
* @return string
*/
public function getEntete2()
{
return $this->entete2;
}
/**
* Set etat
*
* @param boolean $etat
*
* @return HotelAcc
*/
public function setEtat($etat)
{
$this->etat = $etat;
return $this;
}
/**
* Get etat
*
* @return bool
*/
public function getEtat()
{
return $this->etat;
}
}
| 15.14375 | 75 | 0.47792 |
7f6fd929fe43fee99cb914b87b5d45cf0094ad10 | 1,032 | go | Go | internal/pkg/archer/workspace.go | gitter-badger/amazon-ecs-cli-v2 | ec3efdaf5b11977cfe7d37e085351ea175bcb525 | [
"Apache-2.0"
] | 2 | 2020-02-06T15:21:29.000Z | 2020-06-08T16:35:19.000Z | internal/pkg/archer/workspace.go | datadotworld/amazon-ecs-cli-v2 | 14bf9cf87dcf534cb0945b26fb449135b8cf99d8 | [
"Apache-2.0"
] | 139 | 2019-12-16T02:38:55.000Z | 2021-08-02T02:43:45.000Z | internal/pkg/archer/workspace.go | datadotworld/amazon-ecs-cli-v2 | 14bf9cf87dcf534cb0945b26fb449135b8cf99d8 | [
"Apache-2.0"
] | null | null | null | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package archer
// WorkspaceSummary is a description of what's associated with this workspace.
type WorkspaceSummary struct {
ProjectName string `yaml:"project"`
}
// Workspace can bootstrap a workspace with a manifest directory and workspace summary
// and it can manage manifest files.
type Workspace interface {
ManifestIO
Create(projectName string) error
Summary() (*WorkspaceSummary, error)
Apps() ([]Manifest, error)
}
// ManifestIO can read, write and list local manifest files.
type ManifestIO interface {
WorkspaceFileReadWriter
ListManifestFiles() ([]string, error)
AppManifestFileName(appName string) string
DeleteFile(name string) error
}
// WorkspaceFileReadWriter is the interface to read and write files to the project directory in the workspace.
type WorkspaceFileReadWriter interface {
WriteFile(blob []byte, filename string) (string, error)
ReadFile(filename string) ([]byte, error)
}
| 31.272727 | 110 | 0.780039 |
2694e893395eb5fb2e7ec7d00774dfdf8c965352 | 2,315 | java | Java | src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ThresholdingResult.java | weicongs-amazon/anomaly-detection | 48ac4f78fdea29cd3a8ba6797eb37e6882f679be | [
"Apache-2.0"
] | 82 | 2019-11-26T22:55:03.000Z | 2022-01-20T12:44:10.000Z | src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ThresholdingResult.java | weicongs-amazon/anomaly-detection | 48ac4f78fdea29cd3a8ba6797eb37e6882f679be | [
"Apache-2.0"
] | 284 | 2019-12-03T18:59:27.000Z | 2022-03-25T20:50:26.000Z | src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ThresholdingResult.java | weicongs-amazon/anomaly-detection | 48ac4f78fdea29cd3a8ba6797eb37e6882f679be | [
"Apache-2.0"
] | 41 | 2019-12-03T18:46:10.000Z | 2022-03-28T15:49:30.000Z | /*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazon.opendistroforelasticsearch.ad.ml;
import java.util.Objects;
/**
* Data object containing thresholding results.
*/
public class ThresholdingResult {
private final double grade;
private final double confidence;
private final double rcfScore;
/**
* Constructor with all arguments.
*
* @param grade anomaly grade
* @param confidence confidence for the grade
* @param rcfScore rcf score associated with the grade and confidence. Used
* by multi-entity detector to differentiate whether the result is worth
* saving or not.
*/
public ThresholdingResult(double grade, double confidence, double rcfScore) {
this.grade = grade;
this.confidence = confidence;
this.rcfScore = rcfScore;
}
/**
* Returns the anomaly grade.
*
* @return the anoamly grade
*/
public double getGrade() {
return grade;
}
/**
* Returns the confidence for the grade.
*
* @return confidence for the grade
*/
public double getConfidence() {
return confidence;
}
public double getRcfScore() {
return rcfScore;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ThresholdingResult that = (ThresholdingResult) o;
return Objects.equals(this.grade, that.grade)
&& Objects.equals(this.confidence, that.confidence)
&& Objects.equals(this.rcfScore, that.rcfScore);
}
@Override
public int hashCode() {
return Objects.hash(grade, confidence, rcfScore);
}
}
| 27.891566 | 81 | 0.64838 |
f0fa60fe6b260f4517c86f0883c1e46a33ae1bbe | 886 | sql | SQL | custom/icds_reports/migrations/sql_templates/update_tables21.sql | rochakchauhan/commcare-hq | aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236 | [
"BSD-3-Clause"
] | 1 | 2020-05-05T13:10:01.000Z | 2020-05-05T13:10:01.000Z | custom/icds_reports/migrations/sql_templates/update_tables21.sql | rochakchauhan/commcare-hq | aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236 | [
"BSD-3-Clause"
] | 1 | 2021-06-02T04:45:16.000Z | 2021-06-02T04:45:16.000Z | custom/icds_reports/migrations/sql_templates/update_tables21.sql | rochakchauhan/commcare-hq | aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236 | [
"BSD-3-Clause"
] | 5 | 2015-11-30T13:12:45.000Z | 2019-07-01T19:27:07.000Z | ALTER TABLE child_health_monthly ADD COLUMN zscore_grading_hfa smallint;
ALTER TABLE child_health_monthly ADD COLUMN zscore_grading_hfa_recorded_in_month smallint;
ALTER TABLE child_health_monthly ADD COLUMN zscore_grading_wfh smallint;
ALTER TABLE child_health_monthly ADD COLUMN zscore_grading_wfh_recorded_in_month smallint;
ALTER TABLE child_health_monthly ADD COLUMN muac_grading smallint;
ALTER TABLE child_health_monthly ADD COLUMN muac_grading_recorded_in_month smallint;
ALTER TABLE agg_child_health ADD COLUMN zscore_grading_hfa_normal int;
ALTER TABLE agg_child_health ADD COLUMN zscore_grading_hfa_moderate int;
ALTER TABLE agg_child_health ADD COLUMN zscore_grading_hfa_severe int;
ALTER TABLE agg_child_health ADD COLUMN wasting_normal_v2 int;
ALTER TABLE agg_child_health ADD COLUMN wasting_moderate_v2 int;
ALTER TABLE agg_child_health ADD COLUMN wasting_severe_v2 int;
| 68.153846 | 90 | 0.891648 |
ad2f0a27a212f67d351beb9b003e05aa6a6c588e | 1,833 | swift | Swift | Tests/ModelTests/EvidenceVariableTests.swift | mariusom/Swift-FHIR | 96afcb7b5dfcad33a75857d4e081098089e481ef | [
"Apache-2.0"
] | null | null | null | Tests/ModelTests/EvidenceVariableTests.swift | mariusom/Swift-FHIR | 96afcb7b5dfcad33a75857d4e081098089e481ef | [
"Apache-2.0"
] | null | null | null | Tests/ModelTests/EvidenceVariableTests.swift | mariusom/Swift-FHIR | 96afcb7b5dfcad33a75857d4e081098089e481ef | [
"Apache-2.0"
] | null | null | null | //
// EvidenceVariableTests.swift
// SwiftFHIR
//
// Generated from FHIR 4.0.1-9346c8cc45 on 2019-11-19.
// 2019, SMART Health IT.
//
import XCTest
#if !NO_MODEL_IMPORT
import Models
typealias SwiftFHIREvidenceVariable = Models.EvidenceVariable
#else
import SwiftFHIR
typealias SwiftFHIREvidenceVariable = SwiftFHIR.EvidenceVariable
#endif
class EvidenceVariableTests: XCTestCase {
func instantiateFrom(filename: String) throws -> SwiftFHIREvidenceVariable {
return try instantiateFrom(json: try readJSONFile(filename))
}
func instantiateFrom(json: FHIRJSON) throws -> SwiftFHIREvidenceVariable {
return try SwiftFHIREvidenceVariable(json: json)
}
func testEvidenceVariable1() {
do {
let instance = try runEvidenceVariable1()
try runEvidenceVariable1(instance.asJSON())
}
catch let error {
XCTAssertTrue(false, "Must instantiate and test EvidenceVariable successfully, but threw:\n---\n\(error)\n---")
}
}
@discardableResult
func runEvidenceVariable1(_ json: FHIRJSON? = nil) throws -> SwiftFHIREvidenceVariable {
let inst = (nil != json) ? try instantiateFrom(json: json!) : try instantiateFrom(filename: "evidencevariable-example.json")
XCTAssertEqual(inst.characteristic?[0].definitionCodeableConcept?.text, "Diabetic patients over 65")
XCTAssertEqual(inst.id, "example")
XCTAssertEqual(inst.meta?.tag?[0].code, "HTEST")
XCTAssertEqual(inst.meta?.tag?[0].display, "test health data")
XCTAssertEqual(inst.meta?.tag?[0].system?.absoluteString, "http://terminology.hl7.org/CodeSystem/v3-ActReason")
XCTAssertEqual(inst.status, PublicationStatus(rawValue: "draft")!)
XCTAssertEqual(inst.text?.div, "<div xmlns=\"http://www.w3.org/1999/xhtml\">[Put rendering here]</div>")
XCTAssertEqual(inst.text?.status, NarrativeStatus(rawValue: "generated")!)
return inst
}
}
| 33.327273 | 126 | 0.75341 |
90d5b40949b70e1cee69eb5a88184ce2de96aaca | 5,324 | py | Python | tests/test_testing.py | RioAtHome/falcon | edd9352e630dbbb6272370281fc5fa6d792df057 | [
"Apache-2.0"
] | null | null | null | tests/test_testing.py | RioAtHome/falcon | edd9352e630dbbb6272370281fc5fa6d792df057 | [
"Apache-2.0"
] | null | null | null | tests/test_testing.py | RioAtHome/falcon | edd9352e630dbbb6272370281fc5fa6d792df057 | [
"Apache-2.0"
] | null | null | null | import pytest
import falcon
from falcon import App, status_codes, testing
from _util import create_app # NOQA: I100
class CustomCookies:
def items(self):
return [('foo', 'bar'), ('baz', 'foo')]
def another_dummy_wsgi_app(environ, start_response):
start_response(status_codes.HTTP_OK, [('Content-Type', 'text/plain')])
yield b'It works!'
def test_testing_client_handles_wsgi_generator_app():
client = testing.TestClient(another_dummy_wsgi_app)
response = client.simulate_get('/nevermind')
assert response.status == status_codes.HTTP_OK
assert response.text == 'It works!'
@pytest.mark.parametrize(
'items',
[
(),
(b'1',),
(b'1', b'2'),
(b'Hello, ', b'World', b'!\n'),
],
)
def test_closed_wsgi_iterable(items):
assert tuple(testing.closed_wsgi_iterable(items)) == items
@pytest.mark.parametrize(
'version, valid',
[
('1', True),
('1.0', True),
('1.1', True),
('2', True),
('2.0', True),
('', False),
('0', False),
('1.2', False),
('2.1', False),
('3', False),
('3.1', False),
('11', False),
('22', False),
],
)
def test_simulate_request_http_version(version, valid):
app = App()
if valid:
testing.simulate_request(app, http_version=version)
else:
with pytest.raises(ValueError):
testing.simulate_request(app, http_version=version)
def test_simulate_request_content_type():
class Foo:
def on_post(self, req, resp):
resp.text = req.content_type
app = App()
app.add_route('/', Foo())
headers = {'Content-Type': falcon.MEDIA_TEXT}
result = testing.simulate_post(app, '/', headers=headers)
assert result.text == falcon.MEDIA_TEXT
result = testing.simulate_post(app, '/', content_type=falcon.MEDIA_HTML)
assert result.text == falcon.MEDIA_HTML
result = testing.simulate_post(
app, '/', content_type=falcon.MEDIA_HTML, headers=headers
)
assert result.text == falcon.MEDIA_HTML
result = testing.simulate_post(app, '/', json={})
assert result.text == falcon.MEDIA_JSON
result = testing.simulate_post(app, '/', json={}, content_type=falcon.MEDIA_HTML)
assert result.text == falcon.MEDIA_JSON
result = testing.simulate_post(app, '/', json={}, headers=headers)
assert result.text == falcon.MEDIA_JSON
result = testing.simulate_post(
app, '/', json={}, headers=headers, content_type=falcon.MEDIA_HTML
)
assert result.text == falcon.MEDIA_JSON
@pytest.mark.parametrize('cookies', [{'foo': 'bar', 'baz': 'foo'}, CustomCookies()])
def test_create_environ_cookies(cookies):
environ = testing.create_environ(cookies=cookies)
assert environ['HTTP_COOKIE'] in ('foo=bar; baz=foo', 'baz=foo; foo=bar')
def test_create_environ_cookies_options_method():
environ = testing.create_environ(method='OPTIONS', cookies={'foo': 'bar'})
assert 'HTTP_COOKIE' not in environ
def test_cookies_jar():
class Foo:
def on_get(self, req, resp):
# NOTE(myusko): In the future we shouldn't change the cookie
# a test depends on the input.
# NOTE(kgriffs): This is the only test that uses a single
# cookie (vs. multiple) as input; if this input ever changes,
# a separate test will need to be added to explicitly verify
# this use case.
resp.set_cookie('has_permission', 'true')
def on_post(self, req, resp):
if req.cookies['has_permission'] == 'true':
resp.status = falcon.HTTP_200
else:
resp.status = falcon.HTTP_403
app = App()
app.add_route('/jars', Foo())
client = testing.TestClient(app)
response_one = client.simulate_get('/jars')
response_two = client.simulate_post('/jars', cookies=response_one.cookies)
assert response_two.status == falcon.HTTP_200
def test_create_environ_default_ua():
default_ua = 'falcon-client/' + falcon.__version__
environ = testing.create_environ()
assert environ['HTTP_USER_AGENT'] == default_ua
req = falcon.request.Request(environ)
assert req.user_agent == default_ua
def test_create_environ_default_ua_override():
ua = 'curl/7.64.1'
environ = testing.create_environ(headers={'user-agent': ua})
assert environ['HTTP_USER_AGENT'] == ua
req = falcon.request.Request(environ)
assert req.user_agent == ua
def test_missing_header_is_none():
req = testing.create_req()
assert req.auth is None
@pytest.mark.parametrize(
'method', ['DELETE', 'GET', 'HEAD', 'LOCK', 'OPTIONS', 'PATCH', 'POST', 'PUT']
)
def test_client_simulate_aliases(asgi, method):
def capture_method(req, resp):
resp.content_type = falcon.MEDIA_TEXT
resp.text = req.method
app = create_app(asgi)
app.add_sink(capture_method)
client = testing.TestClient(app)
if method == 'LOCK':
result = client.request(method, '/')
else:
simulate_alias = getattr(client, method.lower())
result = simulate_alias('/')
assert result.status_code == 200
expected = '' if method == 'HEAD' else method
assert result.text == expected
| 27.585492 | 85 | 0.6358 |
6b0034421d9283ccefe66ebb88983f8adc31a3b0 | 221 | sql | SQL | database/dbchangelog_005.sql | dwp/ClaimCapture | 95a19496d20923e04e80d5a766cf5fba112fcbd9 | [
"MIT"
] | 2 | 2015-11-26T15:31:49.000Z | 2016-10-10T12:57:17.000Z | database/dbchangelog_005.sql | Department-for-Work-and-Pensions/ClaimCapture | 95a19496d20923e04e80d5a766cf5fba112fcbd9 | [
"MIT"
] | null | null | null | database/dbchangelog_005.sql | Department-for-Work-and-Pensions/ClaimCapture | 95a19496d20923e04e80d5a766cf5fba112fcbd9 | [
"MIT"
] | 1 | 2021-04-10T22:26:05.000Z | 2021-04-10T22:26:05.000Z | --liquibase formatted sql
--changeset pwhitehead:005_1
ALTER TABLE public.transactionstatus ADD COLUMN saveforlateremail INTEGER;
--rollback ALTER TABLE public.transactionstatus DROP COLUMN IF EXISTS saveforlateremail;
| 31.571429 | 88 | 0.846154 |
ab05a65587fccc027fc17c378b0ccf39596fa6c5 | 4,810 | sql | SQL | db/procedures/PROC_CUSTOMER_PAYMENT.sql | maidulTech/ukshop | 19b86d5283ca688796dd35de510e432dea4c0e26 | [
"MIT"
] | null | null | null | db/procedures/PROC_CUSTOMER_PAYMENT.sql | maidulTech/ukshop | 19b86d5283ca688796dd35de510e432dea4c0e26 | [
"MIT"
] | null | null | null | db/procedures/PROC_CUSTOMER_PAYMENT.sql | maidulTech/ukshop | 19b86d5283ca688796dd35de510e432dea4c0e26 | [
"MIT"
] | null | null | null | CREATE PROCEDURE PROC_CUSTOMER_PAYMENT(IN_PK_NO Integer(11), IN_TYPE VarChar(20))
NO SQL
BEGIN
-- INSET A NEW ENTRY IN ACC_BANK_TXN
-- UPDATE ACC_PAYMENT_BANK_ACC BALACNE_BUFFER (INCREMENT)
-- UPDATE SLS_CUSTOMERS CUSTOMER_BALANCE_BUFFER (INCREMENT)
DECLARE VAR_ACC_CUSTOMER_PAYMENTS_PK_NO INT DEFAULT 0;
DECLARE VAR_F_CUSTOMER_NO INT DEFAULT 0;
DECLARE VAR_F_PAYMENT_ACC_NO INT DEFAULT 0;
DECLARE VAR_F_SS_CREATED_BY INT DEFAULT 0;
DECLARE VAR_IS_MATCHED INT DEFAULT 0;
DECLARE VAR_MR_AMOUNT FLOAT DEFAULT 0;
DECLARE VAR_AMOUNT_ACTUAL FLOAT DEFAULT 0;
DECLARE VAR_PAYMENT_TYPE FLOAT DEFAULT 1;
DECLARE VAR_TOTAL_PAYMENT_REMAINING_MR FLOAT DEFAULT 0;
DECLARE VAR_PAYMENT_DATE DATE DEFAULT NULL;
IF IN_TYPE = 'customer' THEN
SELECT PK_NO, F_CUSTOMER_NO,F_PAYMENT_ACC_NO,MR_AMOUNT,PAYMENT_DATE,F_SS_CREATED_BY,PAYMENT_TYPE INTO VAR_ACC_CUSTOMER_PAYMENTS_PK_NO, VAR_F_CUSTOMER_NO, VAR_F_PAYMENT_ACC_NO, VAR_MR_AMOUNT, VAR_PAYMENT_DATE,VAR_F_SS_CREATED_BY,VAR_PAYMENT_TYPE FROM ACC_CUSTOMER_PAYMENTS WHERE PK_NO = IN_PK_NO;
-- SELECT SUM(PAYMENT_REMAINING_MR) INTO VAR_TOTAL_PAYMENT_REMAINING_MR
-- FROM ACC_CUSTOMER_PAYMENTS WHERE PK_NO = IN_PK_NO;
IF VAR_PAYMENT_TYPE = 3 THEN
SET VAR_IS_MATCHED = 1;
END IF;
INSERT INTO ACC_BANK_TXN(TXN_REF, TXN_TYPE_IN_OUT, TXN_DATE,AMOUNT_ACTUAL, AMOUNT_BUFFER, IS_CUS_RESELLER_BANK_RECONCILATION, F_ACC_PAYMENT_BANK_NO, F_CUSTOMER_NO, F_CUSTOMER_PAYMENT_NO,F_SS_CREATED_BY,SS_CREATED_ON,PAYMENT_TYPE,IS_MATCHED)
VALUES(NULL, 1, VAR_PAYMENT_DATE,VAR_AMOUNT_ACTUAL, VAR_MR_AMOUNT, 1, VAR_F_PAYMENT_ACC_NO, VAR_F_CUSTOMER_NO,VAR_ACC_CUSTOMER_PAYMENTS_PK_NO,VAR_F_SS_CREATED_BY,NOW(),VAR_PAYMENT_TYPE,VAR_IS_MATCHED);
IF VAR_PAYMENT_TYPE = 3 THEN
UPDATE ACC_PAYMENT_BANK_ACC
SET BALACNE_BUFFER = IFNULL(BALACNE_BUFFER,0) + VAR_MR_AMOUNT
,BALANCE_ACTUAL = IFNULL(BALANCE_ACTUAL,0) + VAR_MR_AMOUNT
WHERE PK_NO = VAR_F_PAYMENT_ACC_NO;
UPDATE SLS_CUSTOMERS
SET CUSTOMER_BALANCE_BUFFER = IFNULL(CUSTOMER_BALANCE_BUFFER,0) + VAR_MR_AMOUNT
,CUSTOMER_BALANCE_ACTUAL = IFNULL(CUSTOMER_BALANCE_ACTUAL,0) + VAR_MR_AMOUNT
,CUM_BALANCE = IFNULL(CUM_BALANCE,0) + VAR_MR_AMOUNT
WHERE PK_NO = VAR_F_CUSTOMER_NO;
ELSEIF VAR_PAYMENT_TYPE = 2 THEN
UPDATE ACC_PAYMENT_BANK_ACC
SET BALACNE_BUFFER = IFNULL(BALACNE_BUFFER,0) + VAR_MR_AMOUNT
,BALANCE_ACTUAL = IFNULL(BALANCE_ACTUAL,0) + VAR_MR_AMOUNT
WHERE PK_NO = VAR_F_PAYMENT_ACC_NO;
UPDATE SLS_CUSTOMERS
SET CUSTOMER_BALANCE_BUFFER = IFNULL(CUSTOMER_BALANCE_BUFFER,0) + VAR_MR_AMOUNT
,CUSTOMER_BALANCE_ACTUAL = IFNULL(CUSTOMER_BALANCE_ACTUAL,0) + VAR_MR_AMOUNT
,CUM_BALANCE = IFNULL(CUM_BALANCE,0) + VAR_MR_AMOUNT
WHERE PK_NO = VAR_F_CUSTOMER_NO;
ELSEIF VAR_PAYMENT_TYPE = 1 THEN
UPDATE ACC_PAYMENT_BANK_ACC
SET BALACNE_BUFFER = IFNULL(BALACNE_BUFFER,0) + VAR_MR_AMOUNT
WHERE PK_NO = VAR_F_PAYMENT_ACC_NO;
UPDATE SLS_CUSTOMERS
SET CUSTOMER_BALANCE_BUFFER = IFNULL(CUSTOMER_BALANCE_BUFFER,0) + VAR_MR_AMOUNT
WHERE PK_NO = VAR_F_CUSTOMER_NO;
END IF;
ELSEIF IN_TYPE = 'reseller' THEN
SELECT PK_NO, F_RESELLER_NO,F_PAYMENT_ACC_NO,MR_AMOUNT,PAYMENT_DATE,F_SS_CREATED_BY INTO VAR_ACC_CUSTOMER_PAYMENTS_PK_NO, VAR_F_CUSTOMER_NO, VAR_F_PAYMENT_ACC_NO, VAR_MR_AMOUNT, VAR_PAYMENT_DATE,VAR_F_SS_CREATED_BY
FROM ACC_RESELLER_PAYMENTS WHERE PK_NO = IN_PK_NO;
-- SELECT SUM(PAYMENT_REMAINING_MR) INTO VAR_TOTAL_PAYMENT_REMAINING_MR
-- FROM ACC_RESELLER_PAYMENTS WHERE PK_NO = IN_PK_NO;
INSERT INTO ACC_BANK_TXN(TXN_REF, TXN_TYPE_IN_OUT, TXN_DATE, AMOUNT_BUFFER, IS_CUS_RESELLER_BANK_RECONCILATION, F_ACC_PAYMENT_BANK_NO, F_RESELLER_NO, F_RESELLER_PAYMENT_NO,F_SS_CREATED_BY,SS_CREATED_ON)
VALUES(NULL, 1, VAR_PAYMENT_DATE, VAR_MR_AMOUNT, 2, VAR_F_PAYMENT_ACC_NO, VAR_F_CUSTOMER_NO,VAR_ACC_CUSTOMER_PAYMENTS_PK_NO,VAR_F_SS_CREATED_BY,NOW());
UPDATE ACC_PAYMENT_BANK_ACC
SET BALACNE_BUFFER = IFNULL(BALACNE_BUFFER,0) + VAR_MR_AMOUNT
WHERE PK_NO = VAR_F_PAYMENT_ACC_NO;
UPDATE SLS_RESELLERS
SET CUM_BALANCE_BUFFER = IFNULL(CUM_BALANCE_BUFFER,0) + VAR_MR_AMOUNT
WHERE PK_NO = VAR_F_CUSTOMER_NO;
END IF;
END
/
| 45.377358 | 307 | 0.704782 |
b16becfef23ae06874654d7c2daf5f3dbface31d | 51,892 | h | C | head/sys/contrib/octeon-sdk/cvmx-l2t-defs.h | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | 91 | 2018-11-24T05:33:58.000Z | 2022-03-16T05:58:05.000Z | head/sys/contrib/octeon-sdk/cvmx-l2t-defs.h | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | 21 | 2016-08-11T09:43:43.000Z | 2017-01-29T12:52:56.000Z | head/sys/contrib/octeon-sdk/cvmx-l2t-defs.h | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | 18 | 2018-11-24T10:35:29.000Z | 2021-04-22T07:22:10.000Z | /***********************license start***************
* Copyright (c) 2003-2012 Cavium Inc. (support@cavium.com). All rights
* reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Cavium Inc. nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
* This Software, including technical data, may be subject to U.S. export control
* laws, including the U.S. Export Administration Act and its associated
* regulations, and may be subject to export or import regulations in other
* countries.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
* AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
***********************license end**************************************/
/**
* cvmx-l2t-defs.h
*
* Configuration and status register (CSR) type definitions for
* Octeon l2t.
*
* This file is auto generated. Do not edit.
*
* <hr>$Revision$<hr>
*
*/
#ifndef __CVMX_L2T_DEFS_H__
#define __CVMX_L2T_DEFS_H__
#if CVMX_ENABLE_CSR_ADDRESS_CHECKING
#define CVMX_L2T_ERR CVMX_L2T_ERR_FUNC()
static inline uint64_t CVMX_L2T_ERR_FUNC(void)
{
if (!(OCTEON_IS_MODEL(OCTEON_CN3XXX) || OCTEON_IS_MODEL(OCTEON_CN5XXX)))
cvmx_warn("CVMX_L2T_ERR not supported on this chip\n");
return CVMX_ADD_IO_SEG(0x0001180080000008ull);
}
#else
#define CVMX_L2T_ERR (CVMX_ADD_IO_SEG(0x0001180080000008ull))
#endif
/**
* cvmx_l2t_err
*
* L2T_ERR = L2 Tag Errors
*
* Description: L2 Tag ECC SEC/DED Errors and Interrupt Enable
*/
union cvmx_l2t_err {
uint64_t u64;
struct cvmx_l2t_err_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_29_63 : 35;
uint64_t fadru : 1; /**< Failing L2 Tag Upper Address Bit (Index[10])
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the FADRU contains the upper(MSB bit) cacheline index
into the L2 Tag Store. */
uint64_t lck_intena2 : 1; /**< L2 Tag Lock Error2 Interrupt Enable bit */
uint64_t lckerr2 : 1; /**< HW detected a case where a Rd/Wr Miss from PP#n
could not find an available/unlocked set (for
replacement).
Most likely, this is a result of SW mixing SET
PARTITIONING with ADDRESS LOCKING. If SW allows
another PP to LOCKDOWN all SETs available to PP#n,
then a Rd/Wr Miss from PP#n will be unable
to determine a 'valid' replacement set (since LOCKED
addresses should NEVER be replaced).
If such an event occurs, the HW will select the smallest
available SET(specified by UMSK'x)' as the replacement
set, and the address is unlocked. */
uint64_t lck_intena : 1; /**< L2 Tag Lock Error Interrupt Enable bit */
uint64_t lckerr : 1; /**< SW attempted to LOCK DOWN the last available set of
the INDEX (which is ignored by HW - but reported to SW).
The LDD(L1 load-miss) for the LOCK operation is completed
successfully, however the address is NOT locked.
NOTE: 'Available' sets takes the L2C_SPAR*[UMSK*]
into account. For example, if diagnostic PPx has
UMSKx defined to only use SETs [1:0], and SET1 had
been previously LOCKED, then an attempt to LOCK the
last available SET0 would result in a LCKERR. (This
is to ensure that at least 1 SET at each INDEX is
not LOCKED for general use by other PPs). */
uint64_t fset : 3; /**< Failing L2 Tag Hit Set# (1-of-8)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set and
(FSYN != 0), the FSET specifies the failing hit-set.
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit-set
is specified by the L2C_DBG[SET]. */
uint64_t fadr : 10; /**< Failing L2 Tag Address (10-bit Index)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the FADR contains the lower 10bit cacheline index
into the L2 Tag Store. */
uint64_t fsyn : 6; /**< When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the contents of this register contain the 6-bit
syndrome for the hit set only.
If (FSYN = 0), the SBE or DBE reported was for one of
the "non-hit" sets at the failing index(FADR).
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit set
is specified by the L2C_DBG[SET].
If (FSYN != 0), the SBE or DBE reported was for the
hit set at the failing index(FADR) and failing
set(FSET).
SW NOTE: To determine which "non-hit" set was in error,
SW can use the L2C_DBG[L2T] debug feature to explicitly
read the other sets at the failing index(FADR). When
(FSYN !=0), then the FSET contains the failing hit-set.
NOTE: A DED Error will always overwrite a SEC Error
SYNDROME and FADR). */
uint64_t ded_err : 1; /**< L2T Double Bit Error detected (DED)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for double bit errors(DBEs).
This bit is set if ANY of the 8 sets contains a DBE.
DBEs also generated an interrupt(if enabled). */
uint64_t sec_err : 1; /**< L2T Single Bit Error corrected (SEC)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for single bit errors(SBEs).
This bit is set if ANY of the 8 sets contains an SBE.
SBEs are auto corrected in HW and generate an
interrupt(if enabled). */
uint64_t ded_intena : 1; /**< L2 Tag ECC Double Error Detect(DED) Interrupt
Enable bit. When set, allows interrupts to be
reported on double bit (uncorrectable) errors from
the L2 Tag Arrays. */
uint64_t sec_intena : 1; /**< L2 Tag ECC Single Error Correct(SEC) Interrupt
Enable bit. When set, allows interrupts to be
reported on single bit (correctable) errors from
the L2 Tag Arrays. */
uint64_t ecc_ena : 1; /**< L2 Tag ECC Enable
When set, enables 6-bit SEC/DED codeword for 19-bit
L2 Tag Arrays [V,D,L,TAG[33:18]] */
#else
uint64_t ecc_ena : 1;
uint64_t sec_intena : 1;
uint64_t ded_intena : 1;
uint64_t sec_err : 1;
uint64_t ded_err : 1;
uint64_t fsyn : 6;
uint64_t fadr : 10;
uint64_t fset : 3;
uint64_t lckerr : 1;
uint64_t lck_intena : 1;
uint64_t lckerr2 : 1;
uint64_t lck_intena2 : 1;
uint64_t fadru : 1;
uint64_t reserved_29_63 : 35;
#endif
} s;
struct cvmx_l2t_err_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_28_63 : 36;
uint64_t lck_intena2 : 1; /**< L2 Tag Lock Error2 Interrupt Enable bit */
uint64_t lckerr2 : 1; /**< HW detected a case where a Rd/Wr Miss from PP#n
could not find an available/unlocked set (for
replacement).
Most likely, this is a result of SW mixing SET
PARTITIONING with ADDRESS LOCKING. If SW allows
another PP to LOCKDOWN all SETs available to PP#n,
then a Rd/Wr Miss from PP#n will be unable
to determine a 'valid' replacement set (since LOCKED
addresses should NEVER be replaced).
If such an event occurs, the HW will select the smallest
available SET(specified by UMSK'x)' as the replacement
set, and the address is unlocked. */
uint64_t lck_intena : 1; /**< L2 Tag Lock Error Interrupt Enable bit */
uint64_t lckerr : 1; /**< SW attempted to LOCK DOWN the last available set of
the INDEX (which is ignored by HW - but reported to SW).
The LDD(L1 load-miss) for the LOCK operation is
completed successfully, however the address is NOT
locked.
NOTE: 'Available' sets takes the L2C_SPAR*[UMSK*]
into account. For example, if diagnostic PPx has
UMSKx defined to only use SETs [1:0], and SET1 had
been previously LOCKED, then an attempt to LOCK the
last available SET0 would result in a LCKERR. (This
is to ensure that at least 1 SET at each INDEX is
not LOCKED for general use by other PPs). */
uint64_t reserved_23_23 : 1;
uint64_t fset : 2; /**< Failing L2 Tag Hit Set# (1-of-4)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set and
(FSYN != 0), the FSET specifies the failing hit-set.
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit-set
is specified by the L2C_DBG[SET]. */
uint64_t reserved_19_20 : 2;
uint64_t fadr : 8; /**< Failing L2 Tag Store Index (8-bit)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the FADR contains the 8bit cacheline index into the
L2 Tag Store. */
uint64_t fsyn : 6; /**< When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the contents of this register contain the 6-bit
syndrome for the hit set only.
If (FSYN = 0), the SBE or DBE reported was for one of
the "non-hit" sets at the failing index(FADR).
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit set
is specified by the L2C_DBG[SET].
If (FSYN != 0), the SBE or DBE reported was for the
hit set at the failing index(FADR) and failing
set(FSET).
SW NOTE: To determine which "non-hit" set was in error,
SW can use the L2C_DBG[L2T] debug feature to explicitly
read the other sets at the failing index(FADR). When
(FSYN !=0), then the FSET contains the failing hit-set.
NOTE: A DED Error will always overwrite a SEC Error
SYNDROME and FADR). */
uint64_t ded_err : 1; /**< L2T Double Bit Error detected (DED)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for double bit errors(DBEs).
This bit is set if ANY of the 8 sets contains a DBE.
DBEs also generated an interrupt(if enabled). */
uint64_t sec_err : 1; /**< L2T Single Bit Error corrected (SEC)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for single bit errors(SBEs).
This bit is set if ANY of the 8 sets contains an SBE.
SBEs are auto corrected in HW and generate an
interrupt(if enabled). */
uint64_t ded_intena : 1; /**< L2 Tag ECC Double Error Detect(DED) Interrupt
Enable bit. When set, allows interrupts to be
reported on double bit (uncorrectable) errors from
the L2 Tag Arrays. */
uint64_t sec_intena : 1; /**< L2 Tag ECC Single Error Correct(SEC) Interrupt
Enable bit. When set, allows interrupts to be
reported on single bit (correctable) errors from
the L2 Tag Arrays. */
uint64_t ecc_ena : 1; /**< L2 Tag ECC Enable
When set, enables 6-bit SEC/DED codeword for 22-bit
L2 Tag Arrays [V,D,L,TAG[33:15]] */
#else
uint64_t ecc_ena : 1;
uint64_t sec_intena : 1;
uint64_t ded_intena : 1;
uint64_t sec_err : 1;
uint64_t ded_err : 1;
uint64_t fsyn : 6;
uint64_t fadr : 8;
uint64_t reserved_19_20 : 2;
uint64_t fset : 2;
uint64_t reserved_23_23 : 1;
uint64_t lckerr : 1;
uint64_t lck_intena : 1;
uint64_t lckerr2 : 1;
uint64_t lck_intena2 : 1;
uint64_t reserved_28_63 : 36;
#endif
} cn30xx;
struct cvmx_l2t_err_cn31xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_28_63 : 36;
uint64_t lck_intena2 : 1; /**< L2 Tag Lock Error2 Interrupt Enable bit */
uint64_t lckerr2 : 1; /**< HW detected a case where a Rd/Wr Miss from PP#n
could not find an available/unlocked set (for
replacement).
Most likely, this is a result of SW mixing SET
PARTITIONING with ADDRESS LOCKING. If SW allows
another PP to LOCKDOWN all SETs available to PP#n,
then a Rd/Wr Miss from PP#n will be unable
to determine a 'valid' replacement set (since LOCKED
addresses should NEVER be replaced).
If such an event occurs, the HW will select the smallest
available SET(specified by UMSK'x)' as the replacement
set, and the address is unlocked. */
uint64_t lck_intena : 1; /**< L2 Tag Lock Error Interrupt Enable bit */
uint64_t lckerr : 1; /**< SW attempted to LOCK DOWN the last available set of
the INDEX (which is ignored by HW - but reported to SW).
The LDD(L1 load-miss) for the LOCK operation is completed
successfully, however the address is NOT locked.
NOTE: 'Available' sets takes the L2C_SPAR*[UMSK*]
into account. For example, if diagnostic PPx has
UMSKx defined to only use SETs [1:0], and SET1 had
been previously LOCKED, then an attempt to LOCK the
last available SET0 would result in a LCKERR. (This
is to ensure that at least 1 SET at each INDEX is
not LOCKED for general use by other PPs). */
uint64_t reserved_23_23 : 1;
uint64_t fset : 2; /**< Failing L2 Tag Hit Set# (1-of-4)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set and
(FSYN != 0), the FSET specifies the failing hit-set.
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit-set
is specified by the L2C_DBG[SET]. */
uint64_t reserved_20_20 : 1;
uint64_t fadr : 9; /**< Failing L2 Tag Address (9-bit Index)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the FADR contains the 9-bit cacheline index into the
L2 Tag Store. */
uint64_t fsyn : 6; /**< When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the contents of this register contain the 6-bit
syndrome for the hit set only.
If (FSYN = 0), the SBE or DBE reported was for one of
the "non-hit" sets at the failing index(FADR).
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit set
is specified by the L2C_DBG[SET].
If (FSYN != 0), the SBE or DBE reported was for the
hit set at the failing index(FADR) and failing
set(FSET).
SW NOTE: To determine which "non-hit" set was in error,
SW can use the L2C_DBG[L2T] debug feature to explicitly
read the other sets at the failing index(FADR). When
(FSYN !=0), then the FSET contains the failing hit-set.
NOTE: A DED Error will always overwrite a SEC Error
SYNDROME and FADR). */
uint64_t ded_err : 1; /**< L2T Double Bit Error detected (DED)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for double bit errors(DBEs).
This bit is set if ANY of the 8 sets contains a DBE.
DBEs also generated an interrupt(if enabled). */
uint64_t sec_err : 1; /**< L2T Single Bit Error corrected (SEC)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for single bit errors(SBEs).
This bit is set if ANY of the 8 sets contains an SBE.
SBEs are auto corrected in HW and generate an
interrupt(if enabled). */
uint64_t ded_intena : 1; /**< L2 Tag ECC Double Error Detect(DED) Interrupt
Enable bit. When set, allows interrupts to be
reported on double bit (uncorrectable) errors from
the L2 Tag Arrays. */
uint64_t sec_intena : 1; /**< L2 Tag ECC Single Error Correct(SEC) Interrupt
Enable bit. When set, allows interrupts to be
reported on single bit (correctable) errors from
the L2 Tag Arrays. */
uint64_t ecc_ena : 1; /**< L2 Tag ECC Enable
When set, enables 6-bit SEC/DED codeword for 21-bit
L2 Tag Arrays [V,D,L,TAG[33:16]] */
#else
uint64_t ecc_ena : 1;
uint64_t sec_intena : 1;
uint64_t ded_intena : 1;
uint64_t sec_err : 1;
uint64_t ded_err : 1;
uint64_t fsyn : 6;
uint64_t fadr : 9;
uint64_t reserved_20_20 : 1;
uint64_t fset : 2;
uint64_t reserved_23_23 : 1;
uint64_t lckerr : 1;
uint64_t lck_intena : 1;
uint64_t lckerr2 : 1;
uint64_t lck_intena2 : 1;
uint64_t reserved_28_63 : 36;
#endif
} cn31xx;
struct cvmx_l2t_err_cn38xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_28_63 : 36;
uint64_t lck_intena2 : 1; /**< L2 Tag Lock Error2 Interrupt Enable bit */
uint64_t lckerr2 : 1; /**< HW detected a case where a Rd/Wr Miss from PP#n
could not find an available/unlocked set (for
replacement).
Most likely, this is a result of SW mixing SET
PARTITIONING with ADDRESS LOCKING. If SW allows
another PP to LOCKDOWN all SETs available to PP#n,
then a Rd/Wr Miss from PP#n will be unable
to determine a 'valid' replacement set (since LOCKED
addresses should NEVER be replaced).
If such an event occurs, the HW will select the smallest
available SET(specified by UMSK'x)' as the replacement
set, and the address is unlocked. */
uint64_t lck_intena : 1; /**< L2 Tag Lock Error Interrupt Enable bit */
uint64_t lckerr : 1; /**< SW attempted to LOCK DOWN the last available set of
the INDEX (which is ignored by HW - but reported to SW).
The LDD(L1 load-miss) for the LOCK operation is completed
successfully, however the address is NOT locked.
NOTE: 'Available' sets takes the L2C_SPAR*[UMSK*]
into account. For example, if diagnostic PPx has
UMSKx defined to only use SETs [1:0], and SET1 had
been previously LOCKED, then an attempt to LOCK the
last available SET0 would result in a LCKERR. (This
is to ensure that at least 1 SET at each INDEX is
not LOCKED for general use by other PPs). */
uint64_t fset : 3; /**< Failing L2 Tag Hit Set# (1-of-8)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set and
(FSYN != 0), the FSET specifies the failing hit-set.
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit-set
is specified by the L2C_DBG[SET]. */
uint64_t fadr : 10; /**< Failing L2 Tag Address (10-bit Index)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the FADR contains the 10bit cacheline index into the
L2 Tag Store. */
uint64_t fsyn : 6; /**< When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the contents of this register contain the 6-bit
syndrome for the hit set only.
If (FSYN = 0), the SBE or DBE reported was for one of
the "non-hit" sets at the failing index(FADR).
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit set
is specified by the L2C_DBG[SET].
If (FSYN != 0), the SBE or DBE reported was for the
hit set at the failing index(FADR) and failing
set(FSET).
SW NOTE: To determine which "non-hit" set was in error,
SW can use the L2C_DBG[L2T] debug feature to explicitly
read the other sets at the failing index(FADR). When
(FSYN !=0), then the FSET contains the failing hit-set.
NOTE: A DED Error will always overwrite a SEC Error
SYNDROME and FADR). */
uint64_t ded_err : 1; /**< L2T Double Bit Error detected (DED)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for double bit errors(DBEs).
This bit is set if ANY of the 8 sets contains a DBE.
DBEs also generated an interrupt(if enabled). */
uint64_t sec_err : 1; /**< L2T Single Bit Error corrected (SEC)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for single bit errors(SBEs).
This bit is set if ANY of the 8 sets contains an SBE.
SBEs are auto corrected in HW and generate an
interrupt(if enabled). */
uint64_t ded_intena : 1; /**< L2 Tag ECC Double Error Detect(DED) Interrupt
Enable bit. When set, allows interrupts to be
reported on double bit (uncorrectable) errors from
the L2 Tag Arrays. */
uint64_t sec_intena : 1; /**< L2 Tag ECC Single Error Correct(SEC) Interrupt
Enable bit. When set, allows interrupts to be
reported on single bit (correctable) errors from
the L2 Tag Arrays. */
uint64_t ecc_ena : 1; /**< L2 Tag ECC Enable
When set, enables 6-bit SEC/DED codeword for 20-bit
L2 Tag Arrays [V,D,L,TAG[33:17]] */
#else
uint64_t ecc_ena : 1;
uint64_t sec_intena : 1;
uint64_t ded_intena : 1;
uint64_t sec_err : 1;
uint64_t ded_err : 1;
uint64_t fsyn : 6;
uint64_t fadr : 10;
uint64_t fset : 3;
uint64_t lckerr : 1;
uint64_t lck_intena : 1;
uint64_t lckerr2 : 1;
uint64_t lck_intena2 : 1;
uint64_t reserved_28_63 : 36;
#endif
} cn38xx;
struct cvmx_l2t_err_cn38xx cn38xxp2;
struct cvmx_l2t_err_cn50xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_28_63 : 36;
uint64_t lck_intena2 : 1; /**< L2 Tag Lock Error2 Interrupt Enable bit */
uint64_t lckerr2 : 1; /**< HW detected a case where a Rd/Wr Miss from PP#n
could not find an available/unlocked set (for
replacement).
Most likely, this is a result of SW mixing SET
PARTITIONING with ADDRESS LOCKING. If SW allows
another PP to LOCKDOWN all SETs available to PP#n,
then a Rd/Wr Miss from PP#n will be unable
to determine a 'valid' replacement set (since LOCKED
addresses should NEVER be replaced).
If such an event occurs, the HW will select the smallest
available SET(specified by UMSK'x)' as the replacement
set, and the address is unlocked. */
uint64_t lck_intena : 1; /**< L2 Tag Lock Error Interrupt Enable bit */
uint64_t lckerr : 1; /**< SW attempted to LOCK DOWN the last available set of
the INDEX (which is ignored by HW - but reported to SW).
The LDD(L1 load-miss) for the LOCK operation is completed
successfully, however the address is NOT locked.
NOTE: 'Available' sets takes the L2C_SPAR*[UMSK*]
into account. For example, if diagnostic PPx has
UMSKx defined to only use SETs [1:0], and SET1 had
been previously LOCKED, then an attempt to LOCK the
last available SET0 would result in a LCKERR. (This
is to ensure that at least 1 SET at each INDEX is
not LOCKED for general use by other PPs). */
uint64_t fset : 3; /**< Failing L2 Tag Hit Set# (1-of-8)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set and
(FSYN != 0), the FSET specifies the failing hit-set.
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit-set
is specified by the L2C_DBG[SET]. */
uint64_t reserved_18_20 : 3;
uint64_t fadr : 7; /**< Failing L2 Tag Address (7-bit Index)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the FADR contains the lower 7bit cacheline index
into the L2 Tag Store. */
uint64_t fsyn : 6; /**< When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the contents of this register contain the 6-bit
syndrome for the hit set only.
If (FSYN = 0), the SBE or DBE reported was for one of
the "non-hit" sets at the failing index(FADR).
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit set
is specified by the L2C_DBG[SET].
If (FSYN != 0), the SBE or DBE reported was for the
hit set at the failing index(FADR) and failing
set(FSET).
SW NOTE: To determine which "non-hit" set was in error,
SW can use the L2C_DBG[L2T] debug feature to explicitly
read the other sets at the failing index(FADR). When
(FSYN !=0), then the FSET contains the failing hit-set.
NOTE: A DED Error will always overwrite a SEC Error
SYNDROME and FADR). */
uint64_t ded_err : 1; /**< L2T Double Bit Error detected (DED)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for double bit errors(DBEs).
This bit is set if ANY of the 8 sets contains a DBE.
DBEs also generated an interrupt(if enabled). */
uint64_t sec_err : 1; /**< L2T Single Bit Error corrected (SEC)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for single bit errors(SBEs).
This bit is set if ANY of the 8 sets contains an SBE.
SBEs are auto corrected in HW and generate an
interrupt(if enabled). */
uint64_t ded_intena : 1; /**< L2 Tag ECC Double Error Detect(DED) Interrupt
Enable bit. When set, allows interrupts to be
reported on double bit (uncorrectable) errors from
the L2 Tag Arrays. */
uint64_t sec_intena : 1; /**< L2 Tag ECC Single Error Correct(SEC) Interrupt
Enable bit. When set, allows interrupts to be
reported on single bit (correctable) errors from
the L2 Tag Arrays. */
uint64_t ecc_ena : 1; /**< L2 Tag ECC Enable
When set, enables 6-bit SEC/DED codeword for 23-bit
L2 Tag Arrays [V,D,L,TAG[33:14]] */
#else
uint64_t ecc_ena : 1;
uint64_t sec_intena : 1;
uint64_t ded_intena : 1;
uint64_t sec_err : 1;
uint64_t ded_err : 1;
uint64_t fsyn : 6;
uint64_t fadr : 7;
uint64_t reserved_18_20 : 3;
uint64_t fset : 3;
uint64_t lckerr : 1;
uint64_t lck_intena : 1;
uint64_t lckerr2 : 1;
uint64_t lck_intena2 : 1;
uint64_t reserved_28_63 : 36;
#endif
} cn50xx;
struct cvmx_l2t_err_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_28_63 : 36;
uint64_t lck_intena2 : 1; /**< L2 Tag Lock Error2 Interrupt Enable bit */
uint64_t lckerr2 : 1; /**< HW detected a case where a Rd/Wr Miss from PP#n
could not find an available/unlocked set (for
replacement).
Most likely, this is a result of SW mixing SET
PARTITIONING with ADDRESS LOCKING. If SW allows
another PP to LOCKDOWN all SETs available to PP#n,
then a Rd/Wr Miss from PP#n will be unable
to determine a 'valid' replacement set (since LOCKED
addresses should NEVER be replaced).
If such an event occurs, the HW will select the smallest
available SET(specified by UMSK'x)' as the replacement
set, and the address is unlocked. */
uint64_t lck_intena : 1; /**< L2 Tag Lock Error Interrupt Enable bit */
uint64_t lckerr : 1; /**< SW attempted to LOCK DOWN the last available set of
the INDEX (which is ignored by HW - but reported to SW).
The LDD(L1 load-miss) for the LOCK operation is completed
successfully, however the address is NOT locked.
NOTE: 'Available' sets takes the L2C_SPAR*[UMSK*]
into account. For example, if diagnostic PPx has
UMSKx defined to only use SETs [1:0], and SET1 had
been previously LOCKED, then an attempt to LOCK the
last available SET0 would result in a LCKERR. (This
is to ensure that at least 1 SET at each INDEX is
not LOCKED for general use by other PPs). */
uint64_t fset : 3; /**< Failing L2 Tag Hit Set# (1-of-8)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set and
(FSYN != 0), the FSET specifies the failing hit-set.
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit-set
is specified by the L2C_DBG[SET]. */
uint64_t reserved_20_20 : 1;
uint64_t fadr : 9; /**< Failing L2 Tag Address (9-bit Index)
When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the FADR contains the lower 9bit cacheline index
into the L2 Tag Store. */
uint64_t fsyn : 6; /**< When L2T_ERR[SEC_ERR] or L2T_ERR[DED_ERR] are set,
the contents of this register contain the 6-bit
syndrome for the hit set only.
If (FSYN = 0), the SBE or DBE reported was for one of
the "non-hit" sets at the failing index(FADR).
NOTE: During a force-hit (L2T/L2D/L2T=1), the hit set
is specified by the L2C_DBG[SET].
If (FSYN != 0), the SBE or DBE reported was for the
hit set at the failing index(FADR) and failing
set(FSET).
SW NOTE: To determine which "non-hit" set was in error,
SW can use the L2C_DBG[L2T] debug feature to explicitly
read the other sets at the failing index(FADR). When
(FSYN !=0), then the FSET contains the failing hit-set.
NOTE: A DED Error will always overwrite a SEC Error
SYNDROME and FADR). */
uint64_t ded_err : 1; /**< L2T Double Bit Error detected (DED)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for double bit errors(DBEs).
This bit is set if ANY of the 8 sets contains a DBE.
DBEs also generated an interrupt(if enabled). */
uint64_t sec_err : 1; /**< L2T Single Bit Error corrected (SEC)
During every L2 Tag Probe, all 8 sets Tag's (at a
given index) are checked for single bit errors(SBEs).
This bit is set if ANY of the 8 sets contains an SBE.
SBEs are auto corrected in HW and generate an
interrupt(if enabled). */
uint64_t ded_intena : 1; /**< L2 Tag ECC Double Error Detect(DED) Interrupt
Enable bit. When set, allows interrupts to be
reported on double bit (uncorrectable) errors from
the L2 Tag Arrays. */
uint64_t sec_intena : 1; /**< L2 Tag ECC Single Error Correct(SEC) Interrupt
Enable bit. When set, allows interrupts to be
reported on single bit (correctable) errors from
the L2 Tag Arrays. */
uint64_t ecc_ena : 1; /**< L2 Tag ECC Enable
When set, enables 6-bit SEC/DED codeword for 21-bit
L2 Tag Arrays [V,D,L,TAG[33:16]] */
#else
uint64_t ecc_ena : 1;
uint64_t sec_intena : 1;
uint64_t ded_intena : 1;
uint64_t sec_err : 1;
uint64_t ded_err : 1;
uint64_t fsyn : 6;
uint64_t fadr : 9;
uint64_t reserved_20_20 : 1;
uint64_t fset : 3;
uint64_t lckerr : 1;
uint64_t lck_intena : 1;
uint64_t lckerr2 : 1;
uint64_t lck_intena2 : 1;
uint64_t reserved_28_63 : 36;
#endif
} cn52xx;
struct cvmx_l2t_err_cn52xx cn52xxp1;
struct cvmx_l2t_err_s cn56xx;
struct cvmx_l2t_err_s cn56xxp1;
struct cvmx_l2t_err_s cn58xx;
struct cvmx_l2t_err_s cn58xxp1;
};
typedef union cvmx_l2t_err cvmx_l2t_err_t;
#endif
| 79.833846 | 114 | 0.393953 |
1e4fbd711187ef389f5f555798a3bfb8beb74425 | 3,320 | css | CSS | resources/assets/css/small.css | lcmjr/clinica-personnalite | 0c3a589dcbf967603ee4385c480f47dd9fb662a5 | [
"MIT"
] | 1 | 2016-11-04T16:09:28.000Z | 2016-11-04T16:09:28.000Z | resources/assets/css/small.css | lcmjr/clinica-personnalite | 0c3a589dcbf967603ee4385c480f47dd9fb662a5 | [
"MIT"
] | null | null | null | resources/assets/css/small.css | lcmjr/clinica-personnalite | 0c3a589dcbf967603ee4385c480f47dd9fb662a5 | [
"MIT"
] | null | null | null | body{
margin:0;
font:16px/1.2 'Raleway', sans-serif;
color: #414042;
}
a {
color: #414042;
}
a:hover {
color: #6C1E3E;
}
b{
font-weight: 500;
}
h1{
font-size: 30px;
}
h2{
font-size: 23px;
}
h3{
font-size: 18px;
font-weight: 500;
}
h1, h2{
font-weight: 400;
}
.clear{
clear: both;
}
.central{
max-width: 960px;
margin: 0 auto;
}
.borda-dashed {
border-bottom: 1px dashed #808285;
border-top: 1px dashed #808285;
}
.icone-telefone{
height: 35px;
width: 28px;
background: url(../imagens/phone.png);
}
.icone-relogio{
width: 35px;
height: 35px;
background: url(../imagens/relogio-cinza.png);
}
#topo-principal {
border-bottom: 4px solid #B58E9E;
padding-bottom: 0;
margin-bottom: 50px;
}
#topo-principal.seta-vinho::after{
margin-bottom: -30px;
}
.page-home #topo-principal{
padding-bottom: 19px;
margin-bottom: 0px;
}
.page-home #topo-principal::after{
display:none;
}
.topo-barra {
border-top: 0;
margin-bottom: 25px;
padding: 15px 0;
text-align: left;
}
.icone-relogio, .container-telefone .icone-telefone {
float:left;
margin-right: 10px;
}
.content-horario, .content-telefone {
float: left;
}
.container-telefone, #topo-principal .container-horario-atendimento{
float: right;
}
.container-telefone{
margin-right:30px;
}
#logo {
width: 233px;
height: 118px;
background: url(../imagens/logo.png);
float: left;
}
#menu-principal {
float: left;
margin: 87px 0 0 40px;
}
.link-menu:hover, .page-clinica .link-menu-clinica, .page-home .link-menu-home, .page-especializacoes .link-menu-especializacoes, .page-doutores .link-menu-doutores, .blog .link-menu-blog, .page-contato .link-menu-contato{
color: #6C1E3E;
background-position: center 0;
}
.link-menu {
font-size: 15px;
font-weight: 500;
text-decoration: none;
margin: 0 11px;
background: url(../imagens/seta-menu.png) center -11px no-repeat;
padding-top: 13px;
transition: 0.15s;
display: inline-block;
}
#topo-principal .rede-facebook {
width: 20px;
height: 20px;
float: right;
margin: 94px 20px 0 0;
}
#topo-principal .agende-consulta {
width: 115px;
height: 115px;
float: right;
}
.rede-facebook {
width: 25px;
height: 25px;
background: url(../imagens/facebook.png);
}
.agende-consulta {
width: 140px;
float: right;
height: 140px;
background: url(../imagens/btn-agende-consulta.png);
}
.rede-facebook, .agende-consulta{
background-size: contain;
}
.cor-vinho{
color: #6C1E3E;
}
.cor-verde{
color: #4D6574;
}
.fundo-vinho{
background: #B58E9E;
color: white;
}
.fundo-vinho h1, .fundo-vinho h2,.fundo-vinho h3{
color: white;
}
.btn-reset.cor-vinho:hover,#newsletter-box .btn-reset:hover {
color: #CCCAC2;
background: #6C1E3E;
}
.fundo-vinho::before, .seta-vinho::after{
content: "";
display: inline-block;
height: 22px;
width: 50px;
margin: 0 auto;
}
.seta-vinho::after {
background: url(../imagens/seta-vinho.png);
margin-bottom: -53px;
}
.fundo-vinho::before {
background: url(../imagens/seta-branco.png);
}
.ctd-texto {
text-align: left;
}
.seta-vinho{
padding-bottom:30px;
text-align:center;
margin-bottom:60px;
} | 19.529412 | 222 | 0.636747 |
1659f994a4a2409a7ce04e65bbacc554e55b0b69 | 745 | ts | TypeScript | src/redux/Events/hooks/useFetchUserParticipateEvents.ts | EnMarche/Coalitions | e638383b9f81ac7da6d50993589f8523cab50d71 | [
"Apache-2.0"
] | 3 | 2021-04-03T20:15:29.000Z | 2021-09-20T16:18:11.000Z | src/redux/Events/hooks/useFetchUserParticipateEvents.ts | EnMarche/Coalitions | e638383b9f81ac7da6d50993589f8523cab50d71 | [
"Apache-2.0"
] | 54 | 2021-02-22T17:45:48.000Z | 2022-03-30T19:17:19.000Z | src/redux/Events/hooks/useFetchUserParticipateEvents.ts | EnMarche/Coalitions | e638383b9f81ac7da6d50993589f8523cab50d71 | [
"Apache-2.0"
] | 2 | 2021-03-26T14:40:23.000Z | 2021-09-20T16:18:04.000Z | import { isUserLogged } from 'redux/Login';
import useSelector from 'redux/useSelector';
import { useTypedAsyncFn } from 'redux/useTypedAsyncFn';
import { authenticatedApiClient } from 'services/networking/client';
export const useFetchUserParticipateEvents = () => {
const isUserLoggedIn = Boolean(useSelector(isUserLogged));
const [{ loading, error }, doFetchUserParticipateEvents] = useTypedAsyncFn(
async (uuids: string[]) => {
if (!isUserLoggedIn) {
return [];
}
try {
return await authenticatedApiClient.post('v3/events/registered', { uuids });
} catch (error) {
return [];
}
},
[],
);
return { loading, error, doFetchUserParticipateEvents, isUserLoggedIn };
};
| 29.8 | 84 | 0.665772 |
83e8e891cb7c97aedebb582961cc670c49cb3665 | 773 | go | Go | testcases/testcases_test.go | Blockdaemon/metadata-registry-tools | dc511b52494fd8678c562f0cbbc0a4045b9323ec | [
"Apache-2.0"
] | null | null | null | testcases/testcases_test.go | Blockdaemon/metadata-registry-tools | dc511b52494fd8678c562f0cbbc0a4045b9323ec | [
"Apache-2.0"
] | 95 | 2020-09-24T08:31:27.000Z | 2022-03-29T07:06:17.000Z | testcases/testcases_test.go | Blockdaemon/metadata-registry-tools | dc511b52494fd8678c562f0cbbc0a4045b9323ec | [
"Apache-2.0"
] | 7 | 2020-10-13T15:13:38.000Z | 2021-11-26T16:08:48.000Z | package testcases
import (
"testing"
"github.com/stretchr/testify/require"
)
func entityMetadataValidateBasic(require *require.Assertions, tc EntityMetadataTestCase) {
err := tc.EntityMeta.ValidateBasic()
switch tc.Valid {
case true:
require.NoError(err, "ValidateBasic should not fail on %s", tc.Name)
case false:
require.Error(err, "ValidateBasic should fail on %s", tc.Name)
}
}
func TestEntityMetadata(t *testing.T) {
require := require.New(t)
for _, tc := range EntityMetadataBasicVersionAndSize {
entityMetadataValidateBasic(require, tc)
}
for _, tc := range EntityMetadataExtendedVersionAndSize {
entityMetadataValidateBasic(require, tc)
}
for _, tc := range EntityMetadataFieldSemantics {
entityMetadataValidateBasic(require, tc)
}
}
| 22.735294 | 90 | 0.754204 |
58612d9e1ca8317bc5ca858e3c02c140493c1c35 | 382 | kt | Kotlin | src/main/kotlin/com/example/happybaby/dao/CatergoryDao.kt | feilongjiang/babyappadmin | 22d344089fffc9c724c894709a7ff6c3c9ff5660 | [
"MIT"
] | null | null | null | src/main/kotlin/com/example/happybaby/dao/CatergoryDao.kt | feilongjiang/babyappadmin | 22d344089fffc9c724c894709a7ff6c3c9ff5660 | [
"MIT"
] | null | null | null | src/main/kotlin/com/example/happybaby/dao/CatergoryDao.kt | feilongjiang/babyappadmin | 22d344089fffc9c724c894709a7ff6c3c9ff5660 | [
"MIT"
] | null | null | null | package com.example.happybaby.dao
import org.springframework.stereotype.Repository
import org.hibernate.SessionFactory
import com.example.happybaby.entity.Catergory;
@Repository("CatergoryDao")
open class CatergoryDao(sessionFactory: SessionFactory) :BaseDao<Catergory>(sessionFactory){
override fun getTable(): Class<Catergory> {
return Catergory::class.java
}
}
| 25.466667 | 92 | 0.793194 |
46d582a27125e6aff8d163d4a0e36799face617a | 415 | css | CSS | Site/HTMLCSS/Hotel/css/hotel.css | geovanasimaosousa/htmlbasico | 581185150945ad6d05cf8cab9cd25be71239e361 | [
"MIT"
] | null | null | null | Site/HTMLCSS/Hotel/css/hotel.css | geovanasimaosousa/htmlbasico | 581185150945ad6d05cf8cab9cd25be71239e361 | [
"MIT"
] | null | null | null | Site/HTMLCSS/Hotel/css/hotel.css | geovanasimaosousa/htmlbasico | 581185150945ad6d05cf8cab9cd25be71239e361 | [
"MIT"
] | null | null | null | a{
color:white;
}
a:hover{
color:black
}
.fundonav{
background-color:#263238;
}
.imgLogo img{
width:100px;
height:100px;
}
.imgLogo{
text-align: center
}
.linkcentro{
margin:0 auto;
}
#redes li a{
color:white;
}
ul{
list-style: none;/*retirar os marcadores da lista*/
}
#redes li{
display: inline-block;
margin: 10px;
}
.fundofooter{
background-color: #455a64;
} | 12.205882 | 55 | 0.616867 |
2f5911e6769606a41443dd515119f38f0c2f4817 | 1,967 | php | PHP | resources/views/mypricingtable.blade.php | Germangalia/solid_laravel | 8de4bcc6fc33449134569024c2878735936b5c52 | [
"MIT"
] | 2 | 2020-11-15T20:54:41.000Z | 2021-09-24T16:40:17.000Z | resources/views/mypricingtable.blade.php | Germangalia/solid_laravel | 8de4bcc6fc33449134569024c2878735936b5c52 | [
"MIT"
] | null | null | null | resources/views/mypricingtable.blade.php | Germangalia/solid_laravel | 8de4bcc6fc33449134569024c2878735936b5c52 | [
"MIT"
] | null | null | null | @extends('layouts.app')
@section('htmlheader_title')
My Pricing Table
@endsection
@section('main-content')
<div class="pricing pricing--sonam">
<div class="pricing__item">
<h3 class="pricing__title">Startup</h3>
<div class="pricing__price"><span class="pricing__currency">€</span>9.90</div>
<p class="pricing__sentence">Small business solution</p>
<ul class="pricing__feature-list">
<li class="pricing__feature">Unlimited calls</li>
<li class="pricing__feature">Free hosting</li>
<li class="pricing__feature">40MB of storage space</li>
</ul>
<button class="pricing__action">Choose plan</button>
</div>
<div class="pricing__item">
<h3 class="pricing__title">Standard</h3>
<div class="pricing__price"><span class="pricing__currency">€</span>29,90</div>
<p class="pricing__sentence">Medium business solution</p>
<ul class="pricing__feature-list">
<li class="pricing__feature">Unlimited calls</li>
<li class="pricing__feature">Free hosting</li>
<li class="pricing__feature">10 hours of support</li>
<li class="pricing__feature">Social media integration</li>
<li class="pricing__feature">1GB of storage space</li>
</ul>
<button class="pricing__action">Choose plan</button>
</div>
<div class="pricing__item">
<h3 class="pricing__title">Professional</h3>
<div class="pricing__price"><span class="pricing__currency">€</span>59,90</div>
<p class="pricing__sentence">Gigantic business solution</p>
<ul class="pricing__feature-list">
<li class="pricing__feature">Unlimited calls</li>
<li class="pricing__feature">Free hosting</li>
<li class="pricing__feature">Unlimited hours of support</li>
<li class="pricing__feature">Social media integration</li>
<li class="pricing__feature">Anaylitcs integration</li>
<li class="pricing__feature">Unlimited storage space</li>
</ul>
<button class="pricing__action">Choose plan</button>
</div>
</div>
@endsection
| 39.34 | 82 | 0.712761 |
1a8cd12284dc46f8107f6b3645ceb459e06e8698 | 736 | sql | SQL | models/stg_lever__user.sql | fivetran-chloe/dbt_lever_source | 47cb949859c4756b0f88c752f046f23e391c3dd1 | [
"Apache-2.0"
] | null | null | null | models/stg_lever__user.sql | fivetran-chloe/dbt_lever_source | 47cb949859c4756b0f88c752f046f23e391c3dd1 | [
"Apache-2.0"
] | 2 | 2021-02-28T17:08:36.000Z | 2021-03-17T02:55:20.000Z | models/stg_lever__user.sql | fivetran-chloe/dbt_lever_source | 47cb949859c4756b0f88c752f046f23e391c3dd1 | [
"Apache-2.0"
] | 3 | 2021-01-28T22:21:45.000Z | 2022-03-29T11:33:48.000Z |
with base as (
select *
from {{ ref('stg_lever__user_tmp') }}
),
fields as (
select
{{
fivetran_utils.fill_staging_columns(
source_columns=adapter.get_columns_in_relation(ref('stg_lever__user_tmp')),
staging_columns=get_user_columns()
)
}}
from base
),
final as (
select
_fivetran_synced,
access_role,
created_at,
deactivated_at,
email,
external_directory_id as external_directory_user_id,
id as user_id,
name as full_name
-- username is just taken from the email
from fields
where not coalesce(_fivetran_deleted, false)
)
select * from final
| 17.95122 | 91 | 0.588315 |
57b82cb44f583f26df5db109de2af2661a34c96c | 499 | swift | Swift | Bank/Managers/API/Responses/ErrorResponse.swift | ayisiaddo4/Bank | 2e2471677ce5a7df33528f45266f11e322a6465d | [
"MIT"
] | 2 | 2019-02-27T06:00:11.000Z | 2021-07-10T05:58:46.000Z | Bank/Managers/API/Responses/ErrorResponse.swift | jesuasir007/Bank | 2e2471677ce5a7df33528f45266f11e322a6465d | [
"MIT"
] | null | null | null | Bank/Managers/API/Responses/ErrorResponse.swift | jesuasir007/Bank | 2e2471677ce5a7df33528f45266f11e322a6465d | [
"MIT"
] | 1 | 2019-06-02T10:58:43.000Z | 2019-06-02T10:58:43.000Z | //
// ErrorResponse.swift
// Bank
//
// Created by Ayden Panhuyzen on 2017-12-02.
// Copyright © 2017 Ayden Panhuyzen. All rights reserved.
//
import Foundation
struct ErrorResponse: PlaidResponse {
let errorType: String, code: String, message: String, displayMessage: String?
enum CodingKeys: String, CodingKey {
case errorType = "error_type"
case code = "error_code"
case message = "error_message"
case displayMessage = "display_message"
}
}
| 23.761905 | 81 | 0.671343 |
40a00df064f201cb7890e1e014e3e9d43600f0d4 | 4,311 | py | Python | tutorials/model_parallelism/step_5_tp_zdp_training.py | Mehrad0711/oslo | 873d771a68bc380903947010da0b66f58f60e496 | [
"Apache-2.0"
] | null | null | null | tutorials/model_parallelism/step_5_tp_zdp_training.py | Mehrad0711/oslo | 873d771a68bc380903947010da0b66f58f60e496 | [
"Apache-2.0"
] | null | null | null | tutorials/model_parallelism/step_5_tp_zdp_training.py | Mehrad0711/oslo | 873d771a68bc380903947010da0b66f58f60e496 | [
"Apache-2.0"
] | null | null | null | """
Model parallelism tutorial step 5:
How to use the tensor + ZeRO data parallelism for training?
"""
import deepspeed
import torch
from datasets import load_dataset
from torch.utils.data import DataLoader, DistributedSampler
from transformers import AutoModelForCausalLM, AutoTokenizer
import oslo
# NOTE: This script must be executed with multiprocessing
# I strongly recommend to use torch.distributed.launch like this:
# ``python -m torch.distributed.launch --nproc_per_node 4 step_2_tp_training.py``
# 1. Initialize some variables
BATCH_SIZE = 4
SEQ_LEN = 64
SAVE_INTERVAL = 50
TRAIN_STEP = 100
# 2. Create model and tokenizer
model = AutoModelForCausalLM.from_pretrained("gpt2")
tokenizer = AutoTokenizer.from_pretrained("gpt2")
# Add pad token for batch training (GPT2 tokenizer doesn't have pad token)
tokenizer.pad_token = tokenizer.eos_token
# 3. Parallelize the model
# Note that tp size * dp size must be same or smaller than total num of gpus.
# If you have 4 GPUs, you can set tp size = 2 * dp size = 2.
# If you specify the tp size, the dp size will be determined automatically.
model = oslo.initialize(
model, config={"model_parallelism": {"enable": True, "tensor_parallel_size": 2}}
)
# 4. Make the model ZeRO data parallelizable
# We can use ``deepspeed.initialize`` with OSLO TP, you should input ``model.mpu`` together.
# You can access various process groups and world sizes and ranks using ``model.mpu``.
# Refer to https://github.com/tunib-ai/oslo/blob/master/oslo/pytorch/model_parallelism/network/mpu.py
# NOTE: In addition to ZeRO DP, various functions can be used together.
# Deep Speed is constantly adding features, so we haven't checked all the features,
# but most of the features can be used together.
# If some errors occurs while using DeepSpeed, please report it through an issue.
engine, _, _, _ = deepspeed.initialize(
model=model,
model_parameters=model.parameters(),
mpu=model.mpu,
config={
"train_batch_size": BATCH_SIZE,
"fp16": {"enabled": True},
"optimizer": {
"type": "Adam",
"params": {
"lr": 3e-5,
"weight_decay": 3e-7,
},
},
"scheduler": {
"type": "WarmupDecayLR",
"params": {
"warmup_min_lr": 0,
"warmup_max_lr": 3e-5,
"warmup_num_steps": TRAIN_STEP // 10,
"total_num_steps": TRAIN_STEP,
},
},
"zero_optimization": {
"stage": 3,
"allgather_partitions": True,
"allgather_bucket_size": 5e8,
"overlap_comm": True,
"reduce_scatter": True,
"reduce_bucket_size": 5e8,
"contiguous_gradients": True,
"offload_param": {"device": "cpu"},
"offload_optimizer": {"device": "cpu"},
},
},
)
# 5. Load dataset
datasets = load_dataset("squad").data["train"]["context"]
datasets = [str(_) for _ in datasets[: TRAIN_STEP * BATCH_SIZE]]
# 6. Create DistributedSampler to parallelize dataset
# You must specify the ``num_replicas`` and ``rank`` using ``model.mpu``.
sampler = DistributedSampler(
dataset=datasets,
num_replicas=model.mpu.get_data_parallel_world_size(),
rank=model.mpu.get_data_parallel_rank(),
shuffle=True,
)
# 7. Create data loader with sampler
dataloader = DataLoader(
datasets,
batch_size=BATCH_SIZE,
shuffle=False,
sampler=sampler,
)
for step, batch in enumerate(dataloader):
# 8. Make batch
input_batch = tokenizer(
batch,
return_tensors="pt",
padding=True,
truncation=True,
max_length=SEQ_LEN,
).to("cuda")
# 9. Forward-Backward-Step
loss = engine(**input_batch, labels=input_batch["input_ids"]).loss
if torch.distributed.get_rank() == 0:
print(f"step:{step}, loss={loss}")
engine.backward(loss)
engine.step()
# 10. Save parallelized model
# We support ``save_parallelized`` method.
# This is similar with ``save_pretrained`` in the Transformers.
# Checkpoints like 'pytorch_model_tp_0_pp_0.bin' will be saved.
if step % SAVE_INTERVAL == 0:
model.save_parallelized(save_directory="./parallel_ckpt")
if step > TRAIN_STEP:
break
| 32.659091 | 101 | 0.660868 |
53c2f93b8311770468967ad12fdaae924c89f274 | 1,917 | java | Java | src/org/enemies/Lava.java | Koen-Moore/RangerHale | 1be000f2f808118804f314e67fc684879fc311a7 | [
"Apache-2.0"
] | null | null | null | src/org/enemies/Lava.java | Koen-Moore/RangerHale | 1be000f2f808118804f314e67fc684879fc311a7 | [
"Apache-2.0"
] | null | null | null | src/org/enemies/Lava.java | Koen-Moore/RangerHale | 1be000f2f808118804f314e67fc684879fc311a7 | [
"Apache-2.0"
] | null | null | null | package org.enemies;
import java.awt.Color;
import static java.lang.System.*;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import org.items.Health;
import org.players.Player;
import org.resources.Collisions;
import org.resources.ImagePack;
import static java.lang.Math.*;
public class Lava extends Enemy {
private int counter = 10 * (int) Math.round(1000f * Math.random());
private int[][] values = new int[0][];
private static final BufferedImage[] ani = new BufferedImage[]{ImagePack.getImage("lava/lava1.png"),
ImagePack.getImage("lava/lava2.png"), ImagePack.getImage("lava/lava3.png"), ImagePack.getImage("lava/lava4.png"),
ImagePack.getImage("lava/lavamid1.png"), ImagePack.getImage("lava/lavamid2.png"), ImagePack.getImage("lava/lavamid3.png"),
ImagePack.getImage("lava/lavamid4.png"),};
public Lava(int a, int b, int W, int H) {
x = a;
y = b;
w = W;
h = H;
values = new int[1 + h / 16][1 + w / 16];
for (int i = 0; i < values.length; i++) {
for (int x = 0; x < values[i].length; x++) {
values[i][x] = (int) (random() * 4);
}
}
}
public void run() {
if (Collisions.collides(this, Player.player)) {
Health.add(this, .5f);
Player.damage(5);
}
}
public void draw(Graphics g) {
counter++;
// g.setColor(new Color(216,0,0));
// g.fillRect(round(x),round(y)+17, w,h-17);
// g.clipRect(round(x), round(y), w, h);
if (counter % 15 == 0)
for (int i = 0; i < values.length; i++) {
for (int x = 0; x < values[i].length; x++) {
values[i][x] = (int) ((values[i][x] + 1) % 4);
}
}
for (int i = round(x); i < x + w; i += 16) {
g.drawImage(ani[values[0][(i - round(x)) / 16]], i, round(y), null);
for (int a = 0; a + 1 < values.length; a++) {
g.drawImage(ani[4 + (values[1 + a][(i - round(x)) / 16])], i, (int) round(y + 14 + a * 16), null);
}
}
}
public boolean preventsNextRoom() {
return false;
}
}
| 30.428571 | 125 | 0.610329 |
271c1f4d4fe4cf34288efe4870612f7b8a4cfc7e | 854 | h | C | src/render.h | VVingerfly/Toucan | 3ca3cd9c7152905ba8b75eadb110e9d2dcb0f4b1 | [
"MIT"
] | 12 | 2020-12-14T10:07:18.000Z | 2022-01-12T04:32:56.000Z | src/render.h | VVingerfly/Toucan | 3ca3cd9c7152905ba8b75eadb110e9d2dcb0f4b1 | [
"MIT"
] | 1 | 2021-06-21T12:13:06.000Z | 2021-06-21T12:13:06.000Z | src/render.h | VVingerfly/Toucan | 3ca3cd9c7152905ba8b75eadb110e9d2dcb0f4b1 | [
"MIT"
] | 1 | 2021-04-02T16:19:38.000Z | 2021-04-02T16:19:38.000Z | #pragma once
#include "internal.h"
namespace Toucan {
bool update_framebuffer_2d(Figure2D& figure_2d, Toucan::Vector2i size);
void draw_element_2d(Element2D& element_2d, const Matrix4f& model_to_world_matrix, const Matrix4f& world_to_camera_matrix, ToucanContext* context);
bool update_framebuffer_3d(Figure3D& figure_3d, Toucan::Vector2i size);
void draw_element_3d(Toucan::Element3D& element_3d, const Matrix4f& model_to_world_matrix, const Matrix4f& orientation_and_handedness_matrix, const Matrix4f& world_to_camera_matrix, const Matrix4f& projection_matrix,
Toucan::ToucanContext* context);
void draw_axis_gizmo_3d(const Toucan::RigidTransform3Df& camera_transform, const Toucan::Vector2i& framebuffer_size, const Toucan::Matrix4f& orientation_and_handedness_matrix, Toucan::ToucanContext* context);
} // namespace Toucan
| 50.235294 | 216 | 0.816159 |
4c9b4eed62d305b1ea8224429e8a6596303986fa | 4,167 | lua | Lua | Assets/LuaScript/graphic/camera/GCamera.lua | luxiaodong/Game | b5ec2b7b3506c9b9f8cf048aee894c308c29e491 | [
"MIT"
] | 1 | 2021-07-05T05:42:47.000Z | 2021-07-05T05:42:47.000Z | Assets/LuaScript/graphic/camera/GCamera.lua | luxiaodong/Game | b5ec2b7b3506c9b9f8cf048aee894c308c29e491 | [
"MIT"
] | 3 | 2021-08-09T02:50:00.000Z | 2021-08-09T05:48:26.000Z | Assets/LuaScript/graphic/camera/GCamera.lua | luxiaodong/Game | b5ec2b7b3506c9b9f8cf048aee894c308c29e491 | [
"MIT"
] | null | null | null | local GObject = require("graphic.core.GObject")
local GCamera = class("GCamera", GObject)
-- ui相机用Gamma空间, 场景相机用Linear空间是否可行
function GCamera:ctor()
self._testInstanceId = nil
self._type = nil -- 相机类型 enum.camera.ui or enum.camera.main
self._material = nil -- 后处理所用的材质
self._camera = nil -- 相机组件, self._camera.gameObject 相机, self._go --相机父节点
GObject.ctor(self)
end
function GCamera:createGameObject()
error("base class, must be inherit")
end
function GCamera:init()
local t = {
event.camera.bindRender,
event.camera.unbindRender,
event.camera.replaceShader,
}
self:registerEvents(t)
end
function GCamera:handleEvent(e)
--一个类型也有可能多个相机,可能需要id判断
if not self._type then return end
if self._type ~= e.data.cameraType then
return
end
if e.name == event.camera.bindRender then
-- self._camera.depthTextureMode = DepthTextureMode.Depth
self._camera.depthTextureMode = DepthTextureMode.DepthNormals
self._previousViewProjectionMatrix = self._camera.projectionMatrix * self._camera.worldToCameraMatrix;
self._material = e.data.material
self:bindRender()
elseif e.name == event.camera.unbindRender then
self:unbindRender()
elseif e.name == event.camera.replaceShader then
if e.data.shader then
self._camera.depthTextureMode = DepthTextureMode.Depth
self._camera:SetReplacementShader(e.data.shader, e.data.tag or "")
else
self._camera:ResetReplacementShader()
end
end
end
function GCamera:camera()
return self._camera
end
--使用相机组件不可见,可能有其他组件
function GCamera:setVisible(isShow)
self._camera.enabled = isShow
end
function GCamera:isVisible()
return self._camera.enabled
end
function GCamera:setClearFlag(flag)
self._camera.clearFlags = flag
end
function GCamera:bindRender()
if not self._components.render then
self._components.render = CS.Game.CRender.Add(self._camera.gameObject, self)
else
self._components.render.enabled = true
end
end
function GCamera:unbindRender(isRemove)
if self._components.render then
if isRemove then
Object.Destroy(self._components.render)
self._components.render = nil
else
self._components.render.enabled = false
end
end
end
------- unity回调函数 ----------
-- function GCamera:OnWillRenderObject()
-- print("1. GCamera:OnWillRenderObject")
-- end
-- function GCamera:OnPreCull()
-- print("2. GCamera:OnPreCull")
-- end
-- 给gameObject
-- function GCamera:OnBecameVisible()
-- print("3. GCamera:OnBecameVisible")
-- end
-- function GCamera:OnBecameInvisible()
-- print("4. GCamera:OnBecameInvisible")
-- end
-- function GCamera:OnPreRender()
-- print("5. GCamera:OnPreRender")
-- end
-- function GCamera:OnRenderObject()
-- print("6. GCamera:OnRenderObject")
-- end
-- function GCamera:OnPostRender()
-- print("7. GCamera:OnPostRender")
-- end
-- Unity引擎后处理性能优化方案解析
-- https://www.jianshu.com/p/8808664d87b9
function GCamera:OnRenderImage(src, dst)
Graphics.Blit(src, dst, self._material)
-- self:GaussianBlur(src, dst)
-- self:MotionBlurWithDepthTexture(src,dst)
end
-- 测试函数
function GCamera:GaussianBlur(src, dst)
local srcW = src.width
local srcH = src.height
local buffer = RenderTexture.GetTemporary(srcW, srcH, 0) --这个尺寸可以小一点
Graphics.Blit(src, buffer, self._material, 0)
Graphics.Blit(buffer, dst, self._material, 1)
RenderTexture.ReleaseTemporary(buffer)
end
function GCamera:MotionBlurWithDepthTexture(src, dst)
self._material:SetMatrix("_PreviousViewProjectionMatrix", self._previousViewProjectionMatrix)
local currentViewProjectionMatrix = self._camera.projectionMatrix * self._camera.worldToCameraMatrix
local currentViewProjectionInverseMatrix = currentViewProjectionMatrix.inverse
self._material:SetMatrix("_CurrentViewProjectionInverseMatrix", currentViewProjectionInverseMatrix)
self._previousViewProjectionMatrix = currentViewProjectionMatrix
Graphics.Blit(src, dst, self._material)
end
return GCamera
| 28.541096 | 110 | 0.715143 |
9d281d72072b5c6565b48a3f40fc2b08a715b77a | 4,726 | htm | HTML | _data/Vol12_Ch0501-0588/HRS0514B/HRS_0514B-0153.htm | bronsonavila/hrsscraper | ecbb1048ab284af361fae78adb481eff554b067a | [
"MIT"
] | 1 | 2019-02-22T10:35:29.000Z | 2019-02-22T10:35:29.000Z | _data/Vol12_Ch0501-0588/HRS0514B/HRS_0514B-0153.htm | bronsonavila/hrsscraper | ecbb1048ab284af361fae78adb481eff554b067a | [
"MIT"
] | null | null | null | _data/Vol12_Ch0501-0588/HRS0514B/HRS_0514B-0153.htm | bronsonavila/hrsscraper | ecbb1048ab284af361fae78adb481eff554b067a | [
"MIT"
] | null | null | null | <div class="WordSection1">
<p class="RegularParagraphs"><b><span style="layout-grid-mode:line"> §514B-153 Association records; records to be maintained.</span></b><span style="layout-grid-mode:line"> (a) An accurate copy of the declaration, bylaws, house rules, if any, master lease, if any, a sample original conveyance document, all public reports and any amendments thereto, shall be kept at the managing agent's office.</span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"> (b) The managing agent or board shall keep detailed, accurate records in chronological order, of the receipts and expenditures affecting the common elements, specifying and itemizing the maintenance and repair expenses of the common elements and any other expenses incurred. The managing agent or board shall also keep monthly statements indicating the total current delinquent dollar amount of any unpaid assessments for common expenses.</span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"> (c) Subject to section 514B‑152, all records and the vouchers </span>authorizing<span style="layout-grid-mode:line"> the payments and statements shall be kept and maintained at the address of the project, or elsewhere within the State as determined by the board.</span></p>
<p class="RegularParagraphs"><span style="color:black;layout-grid-mode:line"> (d) </span>The developer or affiliate of the developer, board, and managing agent shall ensure that there is a written contract for managing the operation of the property, expressing the agreements of all parties, including but not limited to financial and accounting obligations, services provided, and any compensation arrangements, including any subsequent amendments. Copies of the executed contract and any amendments shall be provided to all parties to the contract.</p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"> (e) The </span>managing<span style="layout-grid-mode:line"> agent, resident manager, or board shall keep an accurate and current list of members of the association and their current addresses, and the names and addresses of the vendees under an agreement of sale, if any. The list shall be maintained at a place designated by the board, and a copy shall be available, at cost, to any member of the association as provided in the declaration or bylaws or rules and regulations or, in any case, to any member who furnishes to the managing agent or resident manager or the board a duly executed and acknowledged affidavit stating that the list:</span></p>
<p class="1Paragraph"><span style="layout-grid-mode:line"> (1) Will be used by the owner personally and only for the purpose of soliciting votes or proxies or providing information to other owners with respect to association matters; and</span></p>
<p class="1Paragraph"><span style="layout-grid-mode:line"> (2) Shall not be used by the owner or furnished to anyone else for any other purpose.</span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"> A board may prohibit commercial solicitations.</span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"> Where the condominium project or any units within the project are subject to a time share plan under chapter 514E, the association shall only be required to maintain in its records the name and address of the time share association as the representative agent for the individual time share owners unless the association receives a request by a time share owner to maintain in its records the name and address of the time share owner.</span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"> (f) The managing agent or resident manager shall not use or distribute any membership list, including for commercial or political purposes, without the prior written consent of the board.</span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"> (g) All membership lists are the property of the association and any membership lists contained in the managing agent's or resident manager's records are subject to subsections (e) and (f), and this subsection. A managing agent, resident manager, or board may not use the information contained in the lists to create any separate list for the purpose of evading this section.</span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"> (h) Subsections (f) and (g) shall not apply to any time share plan regulated under chapter 514E. [L 2004, c 164, pt of §2; am L 2007, c 243, §2; am L 2011, c 98, §1]</span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"></span></p>
<p class="RegularParagraphs"><span style="layout-grid-mode:line"></span></p>
</div> | 295.375 | 718 | 0.781634 |
40c08275e15f612812944c4fabec4db0b61dac4c | 3,231 | py | Python | tests/module/module_formatdetect_test.py | codacy-badger/graphit | 7fcfed114875466179ed3d4848dd9098fa3e60fb | [
"Apache-2.0"
] | null | null | null | tests/module/module_formatdetect_test.py | codacy-badger/graphit | 7fcfed114875466179ed3d4848dd9098fa3e60fb | [
"Apache-2.0"
] | null | null | null | tests/module/module_formatdetect_test.py | codacy-badger/graphit | 7fcfed114875466179ed3d4848dd9098fa3e60fb | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
file: module_formatdetect_test.py
Unit tests for the FormatDetect class
"""
import sys
import unittest
from unittest_baseclass import UnittestPythonCompatibility
from graphit.graph_io.io_helpers import FormatDetect
MAJOR_PY_VERSION = sys.version_info[0]
class TestFormatDetect(UnittestPythonCompatibility):
@unittest.skipIf(MAJOR_PY_VERSION > 2, 'In Python 3.x strings are always unicode')
def test_internal_unicode_handling(self):
"""
Strings should be converted to unicode internally
"""
fp = FormatDetect()
for test in ('notunicode', u'unicode'):
self.assertEqual(type(fp.parse(test)), unicode)
@unittest.skipIf(MAJOR_PY_VERSION > 2, 'In Python 3.x strings are always unicode')
def test_unicode_parse(self):
"""
Test return of string or unicode values that could not be parsed to
another type.
"""
test_cases = ['mixed123', u'bel12.2']
fp = FormatDetect()
for test in test_cases:
self.assertEqual(fp.parse(test), unicode(test))
def test_int_parse(self):
"""
Test detection of integer values
TODO: not working ('34,88', '34,88'), (u'22.334.450', 22334450)
"""
test_cases = [(45, 45), ('1', 1), ('188362', 188362), (u'18832', 18832), ('1e3', 1000), ('1E3', 1000),
(u'٥', 5), (u'๒', 2), ('-45', -45)]
fp = FormatDetect()
for test in test_cases:
self.assertEqual(fp.parse(test[0]), test[1])
def test_float_parse(self):
"""
Test detection of float values
"""
test_cases = [('1.3', 1.3), ('-1.37', -1.37), (34.56, 34.56), (-45.6, -45.6), (u'1.3e2', 130.0),
('34,12', 3412), (u'3.561e+02', 356.1)]
fp = FormatDetect()
for test in test_cases:
self.assertEqual(fp.parse(test[0]), test[1])
def test_boolean_parse(self):
"""
Test detection of boolean values
"""
test_cases = [('true', True), ('True', True), (True, True), ('TRUE', True), (1, 1),
('false', False), ('False', False), (False, False), ('FALSE', False), (0, 0)]
fp = FormatDetect()
for test in test_cases:
self.assertEqual(fp.parse(test[0]), test[1])
def test_custom_boolean_parse(self):
"""
Test detection of custom defined boolean values
"""
test_cases = [('true', True), ('Yes', True), ('y', True), ('false', False), ('no', False), ('n', False)]
fp = FormatDetect()
fp.true_types = ['true', 'yes', 'y']
fp.false_types = ['false', 'no', 'n']
for test in test_cases:
self.assertEqual(fp.parse(test[0]), test[1])
def test_locality_specific_parse(self):
test_cases = [(u'23.3450,00', 23.345)]
fp = FormatDetect()
for test in test_cases:
self.assertEqual(fp.parse(test[0]), test[1])
def test_int_detect(self):
test_cases = [(12, 12), ('12', 12)]
fp = FormatDetect()
for test in test_cases:
self.assertEqual(fp.parse(test[0], target_type='integer'), test[1])
| 29.642202 | 112 | 0.564841 |
b3c3ea1e61d85b07117c4764756c0d7825651385 | 180 | lua | Lua | __resource.lua | undergroundrp/ugrp-uptime | e0e72c1493b007b255ddeaa84f411dcbc205ecd8 | [
"Unlicense"
] | null | null | null | __resource.lua | undergroundrp/ugrp-uptime | e0e72c1493b007b255ddeaa84f411dcbc205ecd8 | [
"Unlicense"
] | null | null | null | __resource.lua | undergroundrp/ugrp-uptime | e0e72c1493b007b255ddeaa84f411dcbc205ecd8 | [
"Unlicense"
] | 1 | 2019-12-15T16:16:31.000Z | 2019-12-15T16:16:31.000Z | resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
description 'Display server uptime on the FiveM server browser'
version '1.0.0'
server_script 'server/main.lua'
| 22.5 | 64 | 0.811111 |
15a11114b6dd2efcfc41f409e969224e030d51eb | 149 | jbuilder | Ruby | app/views/attendances/_attendance.json.jbuilder | elberthcorniell/private-events | 95d8f07f4b57ca8a8e2bf464daba8bb2ca61c392 | [
"MIT"
] | 2 | 2021-01-03T17:11:14.000Z | 2021-01-15T19:26:24.000Z | app/views/attendances/_attendance.json.jbuilder | elberthcorniell/private-events | 95d8f07f4b57ca8a8e2bf464daba8bb2ca61c392 | [
"MIT"
] | 1 | 2020-12-10T00:26:22.000Z | 2020-12-10T00:26:22.000Z | app/views/attendances/_attendance.json.jbuilder | elberthcorniell/private-events | 95d8f07f4b57ca8a8e2bf464daba8bb2ca61c392 | [
"MIT"
] | null | null | null | json.extract! attandance, :id, :attendee_id, :users, :attended_event_id, :created_at, :updated_at
json.url attandance_url(attandance, format: :json)
| 49.666667 | 97 | 0.785235 |
3b52883f2b7b2d6c2c1ca910bde5a6d3427267f6 | 794 | h | C | src/main/c/include/obp2_cesmi.h | plug-obp/obp2-divine | a8ae9027ddedc22cc446597bc8671ff60d4ea992 | [
"MIT"
] | null | null | null | src/main/c/include/obp2_cesmi.h | plug-obp/obp2-divine | a8ae9027ddedc22cc446597bc8671ff60d4ea992 | [
"MIT"
] | null | null | null | src/main/c/include/obp2_cesmi.h | plug-obp/obp2-divine | a8ae9027ddedc22cc446597bc8671ff60d4ea992 | [
"MIT"
] | null | null | null | //
// Created by Ciprian TEODOROV on 22/12/2021.
//
#ifndef C_OBP2_CESMI_H
#define C_OBP2_CESMI_H
#include "obp2_cesmi_loader.h"
struct obp2_cesmi_context_s {
cesmi_library_t* m_library;
cesmi_setup m_setup;
};
typedef struct obp2_cesmi_context_s obp2_cesmi_context_t;
obp2_cesmi_context_t* obp2_cesmi_create_context(const char *in_cesmi_path, char has_buchi);
void obp2_cesmi_free_context(obp2_cesmi_context_t *context);
int obp2_cesmi_initial(obp2_cesmi_context_t *context, int in_handle, cesmi_node *out_target);
int obp2_cesmi_successor(obp2_cesmi_context_t *context, int in_handle, cesmi_node in_source, cesmi_node *out_target);
uint64_t obp2_cesmi_flags(obp2_cesmi_context_t *context, cesmi_node in_node);
void obp2_free_node(cesmi_node *node);
#endif //C_OBP2_CESMI_H
| 31.76 | 117 | 0.823678 |
f006fbe45b51ef1385646726c0bcb4e13e4e3fe2 | 974 | kt | Kotlin | app/src/main/java/com/urmwsk/core/android/BaseFragmentActivity.kt | usura-software-industries/ShoppingListExample | 79cbb81242836fc6d8a174429a96291a4fef7579 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/urmwsk/core/android/BaseFragmentActivity.kt | usura-software-industries/ShoppingListExample | 79cbb81242836fc6d8a174429a96291a4fef7579 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/urmwsk/core/android/BaseFragmentActivity.kt | usura-software-industries/ShoppingListExample | 79cbb81242836fc6d8a174429a96291a4fef7579 | [
"Apache-2.0"
] | null | null | null | package com.urmwsk.core.android
import android.os.Bundle
import android.support.v4.app.Fragment
import com.urmwsk.core.R
abstract class BaseFragmentActivity : BaseActivity() {
private val fragmentKey = "fragmentKey"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (savedInstanceState != null) {
supportFragmentManager.getFragment(savedInstanceState, fragmentKey)
} else {
if (supportFragmentManager.findFragmentById(R.id.container) == null) {
supportFragmentManager.beginTransaction().replace(R.id.container, instantiateFragment()).commit()
}
}
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
supportFragmentManager.putFragment(outState, fragmentKey, supportFragmentManager.findFragmentById(R.id.container))
}
abstract fun instantiateFragment(): Fragment
}
| 32.466667 | 122 | 0.714579 |
31eba9042d99c25fd75049289fa9856b7c60ce0a | 2,731 | lua | Lua | resources/[PSZMTA]/[obiekty]/psz-burdel/burdel.lua | XJMLN/Project | 123cf0313acdcf0c45fa878fe9d6c988a5d012b2 | [
"MIT"
] | 7 | 2017-09-05T20:18:07.000Z | 2020-05-10T09:57:22.000Z | resources/[PSZMTA]/[obiekty]/psz-burdel/burdel.lua | XJMLN/Project | 123cf0313acdcf0c45fa878fe9d6c988a5d012b2 | [
"MIT"
] | null | null | null | resources/[PSZMTA]/[obiekty]/psz-burdel/burdel.lua | XJMLN/Project | 123cf0313acdcf0c45fa878fe9d6c988a5d012b2 | [
"MIT"
] | 2 | 2019-09-30T18:07:51.000Z | 2020-02-16T17:00:24.000Z | local marker = createMarker(2410.87,-1205.33,2000,"cylinder",1,255,0,0,100)
setElementInterior(marker,2)
setElementDimension(marker,6)
local zajete = false
local skiny_dziwek = { 63, 64, 87, 92, 138, 140, 145, 178, 199 }
function burdelAkcja(plr, matchingDimension)
if (not matchingDimension) then return end
if (zajete) then
outputChatBox("Pokój miłości jest aktualnie zajęty. :>",plr,255,0,0,true)
return
end
if (getPlayerMoney(plr)<500) then
outputChatBox("500$ za miłość! Zdobądź tyle i wtedy przyjdź tutaj.",plr,255,0,0,true)
return
end
setElementFrozen(plr,true)
toggleAllControls(plr,false,true,false)
fadeCamera(plr,false)
zajete = true
local dziwka=createPed(skiny_dziwek[math.random(1,#skiny_dziwek)], 1203.74, 19.93, 1000.92)
setTimer(function()
fadeCamera(plr,true)
setElementInterior(dziwka,2)
setElementDimension(dziwka,1)
setElementRotation(dziwka,0,0,185)
setCameraMatrix(plr,1201.92, 13.58, 1002.0, 1204.03, 16.60, 1000.92,0, 100)
setElementInterior(plr,2,1204.20, 16.89, 1000.92)
setElementDimension(plr,1)
setElementPosition(plr,1204.20, 16.89, 1000.92)
setElementRotation(plr,0,0,155)
setElementPosition(dziwka, 1203.74, 16.36, 1000.92)
setElementRotation(dziwka, 0,0,322)
setPedAnimation(plr, "BLOWJOBZ", "BJ_COUCH_START_P",-1,false,false)
setPedAnimation(dziwka, "BLOWJOBZ", "BJ_COUCH_START_W",-1,false,false)
end, 1000, 1)
setTimer(function()
setPedAnimation(plr, "BLOWJOBZ", "BJ_COUCH_LOOP_P",-1,true,false);
setPedAnimation(dziwka, "BLOWJOBZ", "BJ_COUCH_LOOP_W",-1,true,false);
end, 3000,1)
local odstep=math.random(4000,12000)
setTimer(function()
setPedAnimation(plr, "BLOWJOBZ", "BJ_COUCH_END_P", -1, false, false);
setPedAnimation(dziwka, "BLOWJOBZ", "BJ_COUCH_END_W", -1, false, false);
end, 7000+odstep,1)
setTimer(function()
fadeCamera(plr,false)
end, 14000+odstep,1)
setTimer(function()
destroyElement(dziwka)
fadeCamera(plr,true)
setPedAnimation(plr)
setElementPosition(plr,2410.81,-1208.29,2000.92)
setElementDimension(plr,6)
setElementInterior(plr,2)
setElementRotation(plr,0,0,181)
setElementFrozen(plr,false)
toggleAllControls(plr,true)
setCameraTarget(plr,plr)
zajete=false
takePlayerMoney(plr,500)
end, 14000+odstep+1000,1)
end
addEventHandler("onMarkerHit", marker, burdelAkcja) | 37.410959 | 95 | 0.635665 |
2647fb750b67b74686719436e5d36fafdc30f75a | 1,543 | java | Java | live/src/main/java/com/sky/live/cam/cams/CameraInterface.java | SkyZhang007/Sky-Base | aba207f335e4577bbe52b9c6ef9f3ee3590da811 | [
"Apache-2.0"
] | null | null | null | live/src/main/java/com/sky/live/cam/cams/CameraInterface.java | SkyZhang007/Sky-Base | aba207f335e4577bbe52b9c6ef9f3ee3590da811 | [
"Apache-2.0"
] | null | null | null | live/src/main/java/com/sky/live/cam/cams/CameraInterface.java | SkyZhang007/Sky-Base | aba207f335e4577bbe52b9c6ef9f3ee3590da811 | [
"Apache-2.0"
] | null | null | null | package com.sky.live.cam.cams;
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.view.SurfaceView;
import android.view.View;
import java.util.List;
public interface CameraInterface {
int CAMERA_BACK = Camera.CameraInfo.CAMERA_FACING_BACK;
int CAMERA_FRONT = Camera.CameraInfo.CAMERA_FACING_FRONT;
void init(Context context);
boolean open(int position,CameraListener listener);
void enableTorch(boolean enable);
void close();
void stopPreview();
void startPreview(SurfaceTexture surfaceTexture);
void addPreview(SurfaceView surface);
void changeCamera(int cameraPosition, CameraListener cameraListener);
// {zh} 返回size {en} Return size
int[] initCameraParam();
int[] getPreviewWH();
boolean isTorchSupported();
void cancelAutoFocus();
boolean currentValid();
boolean setFocusAreas(View previewView, float[] pos, int rotation);
List<int[]> getSupportedPreviewSizes();
void setZoom(float scaleFactor);
int getCameraPosition();
boolean setVideoStabilization(boolean toggle);
// {zh} 检测video稳定性 {en} Detect video stability
boolean isVideoStabilizationSupported();
int getOrientation();
boolean isFlipHorizontal();
// {zh} 获取相机fov数组 {en} Get camera fov array
float[] getFov();
// {zh} 设置相机捕获的分辨率 {en} Set the resolution of camera capture
void setPreviewSize(SurfaceTexture texture, int height, int width);
}
| 23.738462 | 74 | 0.714193 |
6e0786bb84133e06369d98b8adbe38069361ef34 | 14,837 | html | HTML | index.html | BurlingtonCodeAcademy/remock-CoffeeScript1 | 5e883bb7a1174745dab569f42d8eeae6bec03088 | [
"CC-BY-3.0"
] | null | null | null | index.html | BurlingtonCodeAcademy/remock-CoffeeScript1 | 5e883bb7a1174745dab569f42d8eeae6bec03088 | [
"CC-BY-3.0"
] | null | null | null | index.html | BurlingtonCodeAcademy/remock-CoffeeScript1 | 5e883bb7a1174745dab569f42d8eeae6bec03088 | [
"CC-BY-3.0"
] | 1 | 2020-11-06T23:06:12.000Z | 2020-11-06T23:06:12.000Z | <!DOCTYPE html>
<html>
<head>
<title>Mockup Home</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no"
/>
<link rel="stylesheet" type="text/css" href="./remockstyle.css" />
<style>
@import url("https://fonts.googleapis.com/css2?family=Lora&display=swap");
</style>
</head>
<body>
<!-- ----------------------------Top part of the homepage ------------->
<div id="allPagesTop">
<!-- ------------header/title and subtitle ------------------------->
<div id="allPagesHeader">
<a href ="./index.html"></a><h1>HOME PAGE</h1></a>
<a href ="./index.html"><h2>THE PAGE FOR THE HOME</h2></a>
<div id = "line"></div>
</div>
<!-- Three images in a row at the top -->
<div id="imageWrapper">
<p>Take a Look at This Amazing <span id = "bold">Homepage!</span></p>
<div id="imageRow">
<img src="./images/purple-gradation.jpg" />
<img src="./images/purple-gradation.jpg" />
<img src="./images/purple-gradation.jpg" />
</div>
</div>
<button id="redButton"><a href="./learn-more.html">TELL ME MORE</a></button>
</div>
<!----------------------------- CENTER OF THE HOME PAGE ---------------->
<div id="centerWrapper">
<div id="quoteBanner">
<h5>USE THIS SPACE FOR A GREAT QUOTE.</h5>
</div>
<!--------CONTAINER OF COLUMNS AT CENTER OF THE PAGE----------------->
<div class="postColumns">
<!-------------------WIDE COLUMN ON THE LEFT------------------------->
<div id= "wide-column">
<div> I DON'T WANT TO SAY IT'S <span id = "bold">THE ALIENS</span><br>... BUT IT'S THE ALIENS.</br>
<div class="purpleImage">
<img id = "rectangle" src="./images/purple-gradation.jpg" />
</div>
<h5>TOTALLY...</h5>
<p>Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
Completum est, quod dixi de operatione Solis.
Verum sine mendacio, certum, et verissimum.
Quod est inferius, est sicut quod est superius.
Et quod est superius, est sicut quod est inferius, ad perpetranda miracula rei unius.
Et sicut res omnes fuerunt ab uno, meditatione [sic] unius, sic omnes res natae ab hac una re, adaptatione.
Pater eius est Sol, mater eius est Luna.
Portavit illud ventus in ventre suo.
Nutrix eius terra est. Pater omnis telesmi totius mundi est hic.
Vis eius integra est, si versa fuerit in terram.
Separabis terram ab igne, subtile ab spisso, suaviter cum magno ingenio.
Ascendit a terra in coelum, iterumque descendit in terram, et recipit vim superiorum et inferiorum.
Sic habebis gloriam totius mundi.
Ideo fugiet a te omnis obscuritas.</p>
<button id="redButton"><a href="./continue-reading.html">CONTINUE READING</a></button>
</div>
<div id = "lineWideColumn"></div>
<div id = "demoPhotoContainer">
<h5> AWESOME DEMO PHOTO</h5>
<img id = "rectangle" src = "./images/purple-gradation.jpg">
<p>Verum sine mendacio, certum, et verissimum.
Quod est inferius, est sicut quod est superius.
Et quod est superius, est sicut quod est inferius, ad perpetranda miracula rei unius.
Et sicut res omnes fuerunt ab uno, meditatione [sic] unius, sic omnes res natae ab hac una re, adaptatione.
Pater eius est Sol, mater eius est Luna.
Portavit illud ventus in ventre suo.
Nutrix eius terra est. Pater omnis telesmi totius mundi est hic.
Vis eius integra est, si versa fuerit in terram.
Separabis terram ab igne, subtile ab spisso, suaviter cum magno ingenio.
Ascendit a terra in coelum, iterumque descendit in terram, et recipit vim superiorum et inferiorum.
Sic habebis gloriam totius mundi.
Ideo fugiet a te omnis obscuritas.
Haec est totius fortitudinis fortitudo fortis, quia vincet omnem rem subtilem, omnemque solidam penetrabit.
Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
Completum est, quod dixi de operatione Solis.
Verum sine mendacio, certum, et verissimum.
Quod est inferius, est sicut quod est superius.
Et quod est superius, est sicut quod est inferius, ad perpetranda miracula rei unius.
Et sicut res omnes fuerunt ab uno, meditatione [sic] unius, sic omnes res natae ab hac una re, adaptatione.
Pater eius est Sol, mater eius est Luna.
Portavit illud ventus in ventre suo.
Nutrix eius terra est. Pater omnis telesmi totius mundi est hic.
Vis eius integra est, si versa fuerit in terram.
Separabis terram ab igne, subtile ab spisso, suaviter cum magno ingenio.
Ascendit a terra in coelum, iterumque descendit in terram, et recipit vim superiorum et inferiorum.
Sic habebis gloriam totius mundi.
Ideo fugiet a te omnis obscuritas.
Haec est totius fortitudinis fortitudo fortis, quia vincet omnem rem subtilem, omnemque solidam penetrabit.
Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
Completum est, quod dixi de operatione Solis.
</p>
<br/>
<p>Verum sine mendacio, certum, et verissimum.
Quod est inferius, est sicut quod est superius.
Et quod est superius, est sicut quod est inferius, ad perpetranda miracula rei unius.
Et sicut res omnes fuerunt ab uno, meditatione [sic] unius, sic omnes res natae ab hac una re, adaptatione.
Pater eius est Sol, mater eius est Luna.
Portavit illud ventus in ventre suo.
Nutrix eius terra est. Pater omnis telesmi totius mundi est hic.
Vis eius integra est, si versa fuerit in terram.
Separabis terram ab igne, subtile ab spisso, suaviter cum magno ingenio.
Ascendit a terra in coelum, iterumque descendit in terram, et recipit vim superiorum et inferiorum.
Sic habebis gloriam totius mundi.
Ideo fugiet a te omnis obscuritas.
Haec est totius fortitudinis fortitudo fortis, quia vincet omnem rem subtilem, omnemque solidam penetrabit.
Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
Completum est, quod dixi de operatione Solis.</p>
<button id="redButton"><a href="./continue-reading.html">CONTINUE READING</a></button>
</div>
</div>
<!------------------- END OF WIDE COLUMN ON THE LEFT------------------------->
<!---------------------------NARROW COLUMN ON THE RIGHT --------------- -->
<div id= "narrow-column">
<div class="datePost">
<!-- grey buttons with dates on left side small posts -->
<button id = "dateButton"><a href = "./postonly.html">JULY 30</a></button>
<h5>JUST ANOTHER POST</h5>
<P>Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
Completum est, quod dixi de operatione Solis. Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
Completum est, quod dixi de operatione Solis.
</P>
<div id = "smallLine"></div>
</div>
<!-- small posts with little date buttons -->
<div class="datePost">
<!-- grey buttons with dates side small posts -->
<button id = "dateButton"><a href = "./postonly.html">JULY 28</a></button>
<h2>JUST ANOTHER POST</h2>
<P>Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
</P>
<!-- small divider line -->
<div id = "smallLine"></div>
</div>
<div class="datePost">
<!-- small posts with tiny date buttons linking to blog post page -->
<button id = "dateButton"><a href = "./postonly.html">JULY 24</a></button>
<h5>JUST ANOTHER POST</h5>
<P>
Completum est, quod dixi de operatione Solis.Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
</P>
<div id = "smallLine"></div>
</div>
<div class = "linkPostContainer">
<div class="linkPost">
<h5>SOMETHING OF NOTE</h5>
<img id = "square" src="./images/turquoise-gradation.jpg" />
<P> Verum sine mendacio, certum, et verissimum.
Quod est inferius, est sicut quod est superius.
Et quod est superius, est sicut quod est inferius, ad perpetranda miracula rei unius.
Et sicut res omnes fuerunt ab uno, meditatione [sic] unius, sic omnes res natae ab hac una re, adaptatione.
Pater eius est Sol, mater eius est Luna.
Portavit illud ventus in ventre suo.
Nutrix eius terra est. Pater omnis telesmi totius mundi est hic.
Vis eius integra est, si versa fuerit in terram.
Separabis terram ab igne, subtile ab spisso, suaviter cum magno ingenio.
Ascendit a terra in coelum, iterumque descendit in terram, et recipit vim superiorum et inferiorum.
Sic habebis gloriam totius mundi.
</P>
<div id="redButton"><a href="./learn-more.html">Learn More</a></div>
<div id = "smallLine"></div>
</div>
<div class="linkPost">
<h5> SOMETHING OF LESS NOTE</h5>
<img id = "square" src="./images/orange-gradation.jpg"/>
<P> Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
Completum est, quod dixi de operatione Solis. Sic mundus creatus est.
Hinc erunt adaptationes mirabiles, quarum modus hic est.
Itaque vocatus sum Hermes Trismegistus, habens tres partes philosophiae totius mundi.
Completum est, quod dixi de operatione Solis.
</P>
<div id="redButton"><a href="./learn-more.html">Learn More</a></div>
</div>
</div>
</div>
<!--------------------------END OF NARROW COLUMN ON THE RIGHT --------------- -->
<!-- closing divs for the center post container and the wrapper of the center post container -->
</div>
</div>
<!-- Bottom, repeats across all website pages -->
<div id="footerWrapper">
<div id="footer">
<p>QUESTIONS OR COMMENTS? <span id = "bold">GET IN TOUCH:</span></p>
<div id="footerBody">
<!-----Left side of footer body--->
<div id="footer-left">
<div id="name-email">
<form id = "formFooter">
<input type="text" id="name" placeholder="Enter name" />
<input type="text" id="email" placeholder="Enter email" />
</form>
</div>
<textarea
name="message-form"
placeholder="type message..."
id="textArea"
cols="30"
rows="10"
></textarea>
<button id="msgButton">
Send Message
</button>
</div>
<!-------------Contact Information and social media logos container------------->
<div id = loremAndLinks>
<p>Sic mundus creatus est. Hinc erunt adaptationes mirabiles, quarum modus hic est!</p>
<div id = logosWrapper>
<!-------------contact links left------------------------------------->
<div id="logosLeft">
<div class = "logo-contact" id = "address">
<img id = "footerlink" src = "./images/footerlink-home.png"/>
<p>123 West Street <br/> Burlington VT 00000 <br/>USA</p>
</p>
</div>
<div class="logo-contact" id="number">
<img id = "footerlink" src = "./images/footerlink-phone.png"/>
<p>000-000-000</p>
</div>
<div class="logo-contact" id ="email">
<img id = "footerlink" src = "./images/footerlink-email.png"/>
<p>JaneDoe@fakemail.com</p>
</div>
</div>
<!---------------contact links right-------------------->
<div id="logosRight">
<div class = "logo-contact">
<img id = "footerlink" src = "./images/footerlink-twitter.png"/>
<p>Twitter</p>
</div>
<div class = "logo-contact">
<img id = "footerlink" src = "./images/footerlink-instagram.png"/>
<p>Instagram</p>
</div>
<div class = "logo-contact">
<img id = "footerlink" src = "./images/footerlink-dribbble.png"/>
<p>Dribble</p>
</div>
<div class = "logo-contact">
<img id = "footerlink" src = "./images/footerlink-facebook.png"/>
<p>Facebook</p>
</div>
</div>
<!-- end of contact links right -->
</div>
<!-- logos wrapper div closes above -->
</div>
<!-------------close of social media logos container------------->
</div>
<!-- closing div of footer body container above -->
</div>
</div>
<!-- closing div of footer wrapper container above -->
</body>
</html>
| 43.005797 | 118 | 0.564265 |
641ff2b0a406ef4469d0c1bd5d2ac35c2c3a80d6 | 966 | kt | Kotlin | api/src/main/kotlin/hr/from/josipantolis/seriouscallersonly/api/Blocks.kt | Antolius/serious-callers-only | 49bca9f3edb7d386fae77a6404babc6ace18a87f | [
"MIT"
] | 4 | 2020-04-21T07:18:17.000Z | 2020-07-15T06:40:16.000Z | api/src/main/kotlin/hr/from/josipantolis/seriouscallersonly/api/Blocks.kt | Antolius/serious-callers-only | 49bca9f3edb7d386fae77a6404babc6ace18a87f | [
"MIT"
] | null | null | null | api/src/main/kotlin/hr/from/josipantolis/seriouscallersonly/api/Blocks.kt | Antolius/serious-callers-only | 49bca9f3edb7d386fae77a6404babc6ace18a87f | [
"MIT"
] | null | null | null | package hr.from.josipantolis.seriouscallersonly.api
import java.net.URL
interface MessageBlock
interface ModalBlock
interface HomeTabBlock
interface UniversalBlock : MessageBlock, ModalBlock, HomeTabBlock
sealed class Block {
class Actions(val elements: List<ActionElement>) : Block(), UniversalBlock
class Context(val elements: List<ContextElement>) : Block(), UniversalBlock
object Divider : Block(), UniversalBlock
class Image(
val url: URL,
val altText: String,
val title: Element.Text.Plain? = null
) : Block(), UniversalBlock
class Input(
val label: Element.Text.Plain,
val element: InputElement,
val optional: Boolean = false,
val hint: Element.Text.Plain? = null
) : Block(), ModalBlock
class Section(
val text: Element.Text,
val fields: List<Element.Text>? = null,
val accessory: SectionElement? = null
) : Block(), UniversalBlock
}
| 26.833333 | 79 | 0.680124 |
5f09d46c6d09e2a607ae4b4a46cc30af1eef2248 | 2,440 | ts | TypeScript | src/user/user.dto.ts | MSU-Students/mbaling-project-server | 0bdc239577f6d685139c0a2ba175bf9aa3fcf6c2 | [
"MIT"
] | null | null | null | src/user/user.dto.ts | MSU-Students/mbaling-project-server | 0bdc239577f6d685139c0a2ba175bf9aa3fcf6c2 | [
"MIT"
] | 1 | 2022-01-25T07:47:23.000Z | 2022-01-25T07:47:23.000Z | src/user/user.dto.ts | MSU-Students/mbaling-project-server | 0bdc239577f6d685139c0a2ba175bf9aa3fcf6c2 | [
"MIT"
] | null | null | null | import { ApiProperty } from '@nestjs/swagger';
import { Column, PrimaryGeneratedColumn } from 'typeorm';
export interface IUser {
id?: number;
username?: string;
password?: string;
fName: string;
mName?: string;
lName: string;
isStudent: boolean;
email: string;
birthdate: string;
degree: string;
department: string;
college: string;
status: 'active' | 'inactive'
}
export class RegisterUserDto implements IUser {
@PrimaryGeneratedColumn()
id?: number;
@ApiProperty({ example: 'Nahed' })
@Column({ length: 100 })
fName: string;
@ApiProperty({ example: 'G', required: false })
@Column({ length: 100, nullable: true })
mName?: string;
@ApiProperty({ example: 'Solaiman' })
@Column({ length: 100 })
lName: string;
@ApiProperty({ example: 'example@gmail.com', required: false })
@Column({ length: 100, nullable: true })
email: string;
@ApiProperty({ example: 'True' })
@Column({ length: 100 })
isStudent: boolean;
@ApiProperty({ example: 'active' })
@Column({ length: 100 })
status: 'active' | 'inactive';
@ApiProperty({ example: 'user' })
@Column({ length: 100 })
username: string;
@ApiProperty({ example: 'password' })
@Column({ length: 100 })
password: string;
@ApiProperty({ example: 'password' })
@Column({ length: 100 })
birthdate: string;
@ApiProperty({ example: 'password' })
@Column({ length: 100 })
degree: string;
@ApiProperty({ example: 'password' })
@Column({ length: 100 })
college: string;
@ApiProperty({ example: 'password' })
@Column({ length: 100 })
department: string;
}
export class LoginUserDto implements IUser {
id?: number;
@ApiProperty()
username?: string;
@ApiProperty()
password?: string;
fName: string;
mName?: string;
lName: string;
isStudent: boolean;
email: string;
birthdate: string;
degree: string;
department: string;
college: string;
status: 'active' | 'inactive'
}
export class RefreshDto {
@ApiProperty({
required: true,
minLength: 5,
})
refresh_token: string;
}
export class AccessTokenDto {
@ApiProperty({
required: false,
minLength: 5,
})
accessToken?: string;
@ApiProperty({
required: false,
minLength: 5,
})
refreshToken?: string;
}
export class ChangePasswordDto {
@ApiProperty()
oldPassword: string;
@ApiProperty()
newPassword: string;
}
| 20 | 65 | 0.636066 |
bcc6d7597b5922f8103d49faff3377300271d38a | 1,475 | js | JavaScript | tailwind.config.js | ashcolor/score-share-front | e47a9d594c02d18e81530e845fcb3081927860e9 | [
"MIT"
] | null | null | null | tailwind.config.js | ashcolor/score-share-front | e47a9d594c02d18e81530e845fcb3081927860e9 | [
"MIT"
] | null | null | null | tailwind.config.js | ashcolor/score-share-front | e47a9d594c02d18e81530e845fcb3081927860e9 | [
"MIT"
] | null | null | null | module.exports = {
content: ["./components/**/*.{vue,js}", "./layouts/**/*.vue", "./pages/**/*.vue", "./plugins/**/*.{js,ts}", "./nuxt.config.{js,ts}"],
plugins: [require("@tailwindcss/typography"), require("daisyui")],
theme: {
fontFamily: {
sans: ["ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", "Meiryo"],
},
},
daisyui: {
themes: [
{
mytheme: {
primary: "#ff9999",
secondary: "#f6d860",
accent: "#37cdbe",
neutral: "#3d4451",
"base-100": "#ffffff",
"--rounded-box": "0rem", // border radius rounded-box utility class, used in card and other large boxes
"--rounded-btn": "0rem", // border radius rounded-btn utility class, used in buttons and similar element
"--rounded-badge": "1.9rem", // border radius rounded-badge utility class, used in badges and similar
"--animation-btn": "0.25s", // duration of animation when you click on button
"--animation-input": "0.2s", // duration of animation for inputs like checkbox, toggle, radio, etc
"--btn-text-case": "uppercase", // set default text transform for buttons
"--btn-focus-scale": "0.95", // scale transform of button when you focus on it
"--border-btn": "1px", // border width of buttons
"--tab-border": "1px", // border width of tabs
"--tab-radius": "0.5rem", // border radius of tabs
},
},
],
},
};
| 43.382353 | 135 | 0.562034 |
fb8be038534d48442d1652eb907d7fa9456be9f2 | 4,369 | h | C | thirdparty/spark/spark/include/Core/IO/SPK_IO_Buffer.h | elix22/GPlayEngine | 5b73da393ddfc30905dcaca678a62d642b7d8912 | [
"Apache-2.0"
] | 175 | 2018-06-26T04:40:00.000Z | 2022-03-31T11:15:57.000Z | thirdparty/spark/spark/include/Core/IO/SPK_IO_Buffer.h | elix22/GPlayEngine | 5b73da393ddfc30905dcaca678a62d642b7d8912 | [
"Apache-2.0"
] | 51 | 2018-11-01T12:46:25.000Z | 2021-12-14T15:16:15.000Z | thirdparty/spark/spark/include/Core/IO/SPK_IO_Buffer.h | elix22/GPlayEngine | 5b73da393ddfc30905dcaca678a62d642b7d8912 | [
"Apache-2.0"
] | 72 | 2018-10-31T13:50:02.000Z | 2022-03-14T09:10:35.000Z | //
// SPARK particle engine
//
// Copyright (C) 2008-2011 - Julien Fryer - julienfryer@gmail.com
// Copyright (C) 2017 - Frederic Martin - fredakilla@gmail.com
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef H_SPK_IOBUFFER
#define H_SPK_IOBUFFER
namespace SPK
{
namespace IO
{
class IOBuffer
{
public :
IOBuffer(size_t capacity);
IOBuffer(size_t,std::istream& is);
~IOBuffer();
const char* getData() const { return buf; }
////////////////////
// Size operators //
////////////////////
size_t getSize() const { return size; }
size_t getCapacity() const { return capacity; }
size_t getPosition() const { return position; }
void skip(size_t nb) const { position += nb; }
void setPosition(size_t pos) const { position = pos; }
void clear() { position = size = 0; }
bool isAtEnd() const { return position >= size; }
//////////////////////////////
// Primitive get operations //
//////////////////////////////
const char* get(size_t length) const;
int32 get32() const
{
if (USE_LITTLE_ENDIANS)
return *reinterpret_cast<const int32*>(get(4));
else
return swap32(*reinterpret_cast<const int32*>(get(4)));
}
template<class T> T get() const;
//////////////////////////////
// Primitive put operations //
//////////////////////////////
void put(char c);
void put(const char* c,size_t length);
void put32(int32 i)
{
if (USE_LITTLE_ENDIANS)
put(reinterpret_cast<char*>(&i),4);
else
put(reinterpret_cast<char*>(swap32(i)),4);
}
////////////////////////////
// Generic put operations //
////////////////////////////
void put(float f) { put32(*reinterpret_cast<int32*>(&f)); }
void put(uint32 i) { put32(*reinterpret_cast<int32*>(&i)); }
void put(int32 i) { put32(i); }
void put(std::string s) { put(s.data(),s.size()); put('\0'); }
void put(const Vector3D& v) { put(v.x); put(v.y); put(v.z); }
void put(const Color& c) { put32(*reinterpret_cast<const int32*>(&c)); }
void put(bool b) { put(static_cast<char>(b ? 0x01 : 0x00)); }
template<class T>
void putArray(const std::vector<T>& t)
{
put(static_cast<uint32>(t.size()));
for (size_t i = 0; i < t.size(); ++i)
put(t[i]);
}
void putBuffer(const IOBuffer& buffer)
{
put(buffer.getData(),buffer.getSize());
}
private :
IOBuffer(const IOBuffer& buffer);
static const bool USE_LITTLE_ENDIANS;
char* buf;
size_t capacity;
size_t size;
mutable size_t position;
static int32 swap32(int32 i)
{
return ((i & 0xFF000000 >> 24) & 0xFF) |
(i & 0x00FF0000 >> 8) |
(i & 0x0000FF00 << 8) |
(i & 0x000000FF << 24) ;
}
void updateSize(size_t newPosition);
static bool isLittleEndians();
};
////////////////////////////
// Generic get operations //
////////////////////////////
template<> inline char IOBuffer::get() const { return *get(1); }
template<> inline float IOBuffer::get() const { int32 i = get32(); return *reinterpret_cast<float*>(&i); }
template<> inline uint32 IOBuffer::get() const { int32 i = get32(); return *reinterpret_cast<uint32*>(&i); }
template<> inline int32 IOBuffer::get() const { return get32(); }
template<> inline Color IOBuffer::get() const { int32 i = get32(); return *reinterpret_cast<Color*>(&i); }
template<> inline bool IOBuffer::get() const { return get<char>() != 0; }
template<> SPK_PREFIX std::string IOBuffer::get<std::string>() const;
template<> SPK_PREFIX Vector3D IOBuffer::get<Vector3D>() const;
}}
#endif
| 28.933775 | 111 | 0.617762 |
1ea7b20c0c0baaa7e15f5424e0005debeb138eb6 | 214 | kt | Kotlin | src/main/kotlin/de/claudioaltamura/kotlin/examples/ddd/Foo.kt | claudioaltamura/kotlin-examples | 1ec4be095fbba9b238f9b2c52884a136ff1775fd | [
"MIT"
] | null | null | null | src/main/kotlin/de/claudioaltamura/kotlin/examples/ddd/Foo.kt | claudioaltamura/kotlin-examples | 1ec4be095fbba9b238f9b2c52884a136ff1775fd | [
"MIT"
] | null | null | null | src/main/kotlin/de/claudioaltamura/kotlin/examples/ddd/Foo.kt | claudioaltamura/kotlin-examples | 1ec4be095fbba9b238f9b2c52884a136ff1775fd | [
"MIT"
] | null | null | null | package de.claudioaltamura.kotlin.examples.ddd
class Foo (val functionalId: FunctionalId, val someValue : String) {
override fun toString(): String {
return "Foo(id='$functionalId', value=$someValue)"
}
}
| 26.75 | 68 | 0.728972 |
4669232be51bbd7d96ba1b12b1d0cbadea9e635d | 172 | kt | Kotlin | src/main/kotlin/com/max/contactbyweather/domain/DateToOutreachMap.kt | ZeusAndHisBeard/contact-by-weather | d3f32a3f865458a994700c1ae199f73d6fc766df | [
"MIT"
] | null | null | null | src/main/kotlin/com/max/contactbyweather/domain/DateToOutreachMap.kt | ZeusAndHisBeard/contact-by-weather | d3f32a3f865458a994700c1ae199f73d6fc766df | [
"MIT"
] | null | null | null | src/main/kotlin/com/max/contactbyweather/domain/DateToOutreachMap.kt | ZeusAndHisBeard/contact-by-weather | d3f32a3f865458a994700c1ae199f73d6fc766df | [
"MIT"
] | null | null | null | package com.max.contactbyweather.domain
import java.time.LocalDate
data class DateToOutreachMap(
internal val dateToOutreachMethod: Map<LocalDate, OutreachMethod>?
)
| 21.5 | 70 | 0.819767 |
928326d6324f22747b874c3bd27718778d864596 | 904 | h | C | Savanna/SVApp.h | yang2507366/Savanna | ad1b03acdbe4ff433253f8f1465aad00cb450b9d | [
"Apache-2.0"
] | null | null | null | Savanna/SVApp.h | yang2507366/Savanna | ad1b03acdbe4ff433253f8f1465aad00cb450b9d | [
"Apache-2.0"
] | null | null | null | Savanna/SVApp.h | yang2507366/Savanna | ad1b03acdbe4ff433253f8f1465aad00cb450b9d | [
"Apache-2.0"
] | null | null | null | //
// LuaApp.h
// Queries
//
// Created by yangzexin on 11/2/12.
// Copyright (c) 2012 yangzexin. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SVScriptBundle.h"
#import "SVScriptInteraction.h"
@interface SVApp : NSObject
@property(nonatomic, readonly)id<SVScriptBundle> scriptBundle;
@property(nonatomic, retain)id<SVScriptInteraction> scriptInteraction;
@property(nonatomic, retain)UIWindow *baseWindow;
@property(nonatomic, retain)UIViewController *relatedViewController;
@property(nonatomic, copy)void(^consoleOutputBlock)(NSString *output);
- (id)initWithScriptBundle:(id<SVScriptBundle>)scriptBundle;
- (id)initWithScriptBundle:(id<SVScriptBundle>)scriptBundle baseWindow:(UIWindow *)baseWindow;
- (id)initWithScriptBundle:(id<SVScriptBundle>)scriptBundle relatedViewController:(UIViewController *)relatedViewController;
- (void)consoleOutput:(NSString *)output;
@end
| 33.481481 | 124 | 0.793142 |
d5c1cca8e1b2a4cb56e60b4c9acb5c0247b5a9dc | 466 | sql | SQL | queries/stackoverflow/q11/638d2025ac6368bda6945538deda7f544fc1dd96.sql | christophanneser/Bao-for-Presto | b1d93689025d51cdea1a2e81edb8f077df8afcc1 | [
"MIT"
] | null | null | null | queries/stackoverflow/q11/638d2025ac6368bda6945538deda7f544fc1dd96.sql | christophanneser/Bao-for-Presto | b1d93689025d51cdea1a2e81edb8f077df8afcc1 | [
"MIT"
] | null | null | null | queries/stackoverflow/q11/638d2025ac6368bda6945538deda7f544fc1dd96.sql | christophanneser/Bao-for-Presto | b1d93689025d51cdea1a2e81edb8f077df8afcc1 | [
"MIT"
] | null | null | null | SELECT COUNT(*)
FROM
tag as t,
site as s,
question as q,
tag_question as tq
WHERE
t.site_id = s.site_id
AND q.site_id = s.site_id
AND tq.site_id = s.site_id
AND tq.question_id = q.id
AND tq.tag_id = t.id
AND (s.site_name in ('stackoverflow'))
AND (t.name in ('amazon-s3','async-await','clojure','concurrency','configuration','database-design','error-handling','file-io','flask','hash','indexing','ipad','npm','null','orm'))
AND (q.score >= 10)
AND (q.score <= 1000)
| 27.411765 | 180 | 0.693133 |
53c8d43e05d8eb6001f5d64f37725d64597ae7c2 | 145 | java | Java | src/jsortie/quicksort/selector/SinglePivotSelector.java | JamesBarbetti/jsortie | 8086675235a598f6b081a4edd591012bf5408abf | [
"MIT"
] | null | null | null | src/jsortie/quicksort/selector/SinglePivotSelector.java | JamesBarbetti/jsortie | 8086675235a598f6b081a4edd591012bf5408abf | [
"MIT"
] | null | null | null | src/jsortie/quicksort/selector/SinglePivotSelector.java | JamesBarbetti/jsortie | 8086675235a598f6b081a4edd591012bf5408abf | [
"MIT"
] | null | null | null | package jsortie.quicksort.selector;
public interface SinglePivotSelector
{
public int selectPivotIndex(int [] vArray, int start, int stop);
}
| 20.714286 | 65 | 0.786207 |
c920c81aba2bf60d42554e7548497931d7dfd89e | 73 | swift | Swift | swift-101/03_random.swift | liona24/lets-get-swifty | aa07c9491eb72202ca8daba12340ad5f278a89f7 | [
"MIT"
] | null | null | null | swift-101/03_random.swift | liona24/lets-get-swifty | aa07c9491eb72202ca8daba12340ad5f278a89f7 | [
"MIT"
] | null | null | null | swift-101/03_random.swift | liona24/lets-get-swifty | aa07c9491eb72202ca8daba12340ad5f278a89f7 | [
"MIT"
] | null | null | null | for _ in 0..<5 {
let r = Int.random(in: 0...10)
print("\(r)")
}
| 12.166667 | 34 | 0.438356 |
e949b237892e4fcc888fff03720b23ada0d9fa6d | 231 | swift | Swift | MVVMC/Extensions/UIKit/Button+SetTitle.swift | hiromina72/RxSwift-MVVMC-Demo | b44b3c0f5e256f36a5ce89128eb77aebaf9f8169 | [
"MIT"
] | null | null | null | MVVMC/Extensions/UIKit/Button+SetTitle.swift | hiromina72/RxSwift-MVVMC-Demo | b44b3c0f5e256f36a5ce89128eb77aebaf9f8169 | [
"MIT"
] | null | null | null | MVVMC/Extensions/UIKit/Button+SetTitle.swift | hiromina72/RxSwift-MVVMC-Demo | b44b3c0f5e256f36a5ce89128eb77aebaf9f8169 | [
"MIT"
] | null | null | null | import Foundation
import UIKit
extension UIButton {
func setTitle(_ title: String?) {
UIView.performWithoutAnimation {
self.setTitle(title, for: .normal)
self.layoutIfNeeded()
}
}
}
| 19.25 | 46 | 0.61039 |
104f2b628f78c202e34b529ef40ac11034f0294a | 76 | sql | SQL | db/Querries.sql | ncastaldi/template-full_stack | 5ef782ee1a57fc3772a6c05ec8580a9d911b87c3 | [
"MIT"
] | null | null | null | db/Querries.sql | ncastaldi/template-full_stack | 5ef782ee1a57fc3772a6c05ec8580a9d911b87c3 | [
"MIT"
] | null | null | null | db/Querries.sql | ncastaldi/template-full_stack | 5ef782ee1a57fc3772a6c05ec8580a9d911b87c3 | [
"MIT"
] | null | null | null | -- Create querries
-- Read querries
-- Update querries
-- Delete querries | 10.857143 | 18 | 0.710526 |
c91cfd2f507fe5dfee613df337f3e304377021b2 | 2,011 | swift | Swift | Self-Sizing-Hell-Square/Classes/TableViewController.swift | danmunoz/self-sizing-hell | 4df5ef88a170f3c51ce20cb295d71896eb9364a9 | [
"MIT"
] | 13 | 2019-11-04T07:36:07.000Z | 2022-03-14T11:14:36.000Z | Self-Sizing-Hell-Square/Classes/TableViewController.swift | danmunoz/self-sizing-hell | 4df5ef88a170f3c51ce20cb295d71896eb9364a9 | [
"MIT"
] | null | null | null | Self-Sizing-Hell-Square/Classes/TableViewController.swift | danmunoz/self-sizing-hell | 4df5ef88a170f3c51ce20cb295d71896eb9364a9 | [
"MIT"
] | 2 | 2019-11-16T00:57:49.000Z | 2019-12-27T22:52:39.000Z | //
// TableViewController.swift
// Self-Sizing-Hell-Square
//
// Created by Daniel Munoz on 22.10.19.
// Copyright © 2019 Daniel Munoz. All rights reserved.
//
import UIKit
class TableViewController: UIViewController {
private lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.translatesAutoresizingMaskIntoConstraints = false
return tableView
}()
override func viewDidLoad() {
super.viewDidLoad()
self.setupTableView()
self.setupUI()
}
private func setupTableView() {
self.tableView.register(TableViewCell.self, forCellReuseIdentifier: TableViewCell.reuseIdentifier)
self.tableView.rowHeight = UITableView.automaticDimension
self.tableView.dataSource = self
}
private func setupUI() {
self.view.addSubview(self.tableView)
NSLayoutConstraint.activate([
self.tableView.topAnchor.constraint(equalTo: self.view.topAnchor),
self.tableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
self.tableView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
self.tableView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor)
])
}
}
// MARK: - UITableViewDataSource
extension TableViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: TableViewCell.reuseIdentifier, for: indexPath) as? TableViewCell else {
assertionFailure("TableViewCell is nil")
return UITableViewCell()
}
// Defines the number of squares to be displayed on the collection view
cell.update(numberOfSquares: 4)
return cell
}
}
| 34.672414 | 142 | 0.687718 |
46750cccc86af09943d6899284c02c64de691d22 | 2,333 | swift | Swift | MetalSwiftUI/Sources/{{PACKAGE}}/Renderers/RenderCoordinator.swift | stackotter/swift-bundler-templates | 8ada6d4676c0bd3caf692b6b2abb59c2dc0d3439 | [
"MTLL"
] | null | null | null | MetalSwiftUI/Sources/{{PACKAGE}}/Renderers/RenderCoordinator.swift | stackotter/swift-bundler-templates | 8ada6d4676c0bd3caf692b6b2abb59c2dc0d3439 | [
"MTLL"
] | null | null | null | MetalSwiftUI/Sources/{{PACKAGE}}/Renderers/RenderCoordinator.swift | stackotter/swift-bundler-templates | 8ada6d4676c0bd3caf692b6b2abb59c2dc0d3439 | [
"MTLL"
] | null | null | null | import Foundation
import MetalKit
enum RenderCoordinatorError: LocalizedError {
case failedToGetMetalDevice
case failedToCreateRenderCommandQueue
var errorDescription: String? {
switch self {
case .failedToGetMetalDevice:
return "Failed to get Metal device"
case .failedToCreateRenderCommandQueue:
return "Failed to create render command queue"
}
}
}
final class RenderCoordinator<R: Renderer>: NSObject, MTKViewDelegate {
var device: MTLDevice
var commandQueue: MTLCommandQueue
var renderer: R
var errorHandler: (String) -> Void
required init(
rendererType: R.Type,
rendererContext: R.Context,
errorHandler: @escaping (String) -> Void
) throws {
// Get Metal device
guard let device = MTLCreateSystemDefaultDevice() else {
throw RenderCoordinatorError.failedToGetMetalDevice
}
// Create a command queue (and reuse it as much as possible)
guard let commandQueue = device.makeCommandQueue() else {
throw RenderCoordinatorError.failedToCreateRenderCommandQueue
}
self.device = device
self.commandQueue = commandQueue
self.errorHandler = errorHandler
renderer = try rendererType.init(context: rendererContext, device: device, commandQueue: commandQueue)
super.init()
}
func draw(in view: MTKView) {
// Get render pass descriptor
guard let renderPassDescriptor = view.currentRenderPassDescriptor else {
errorHandler("Failed to get the current render pass descriptor")
return
}
// Create command buffer
guard let commandBuffer = commandQueue.makeCommandBuffer() else {
errorHandler("Failed to create command buffer")
return
}
// Create render encoder
guard let renderEncoder = commandBuffer.makeRenderCommandEncoder(descriptor: renderPassDescriptor) else {
errorHandler("Failed to create render encoder")
return
}
// Run the renderer
do {
try renderer.encodeFrame(into: renderEncoder)
} catch {
errorHandler("Failed to encode frame: \(error)")
return
}
// Get the current drawable
guard let drawable = view.currentDrawable else {
errorHandler("Failed to get current drawable")
return
}
// Finish encoding the frame
renderEncoder.endEncoding()
commandBuffer.present(drawable)
commandBuffer.commit()
}
func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {}
}
| 26.213483 | 107 | 0.748393 |
f796f0aa251566be9f0c4af747effe5c2d34da39 | 11,523 | h | C | aws-cpp-sdk-ec2/include/aws/ec2/model/ImageDiskContainer.h | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | 1 | 2020-03-11T05:36:20.000Z | 2020-03-11T05:36:20.000Z | aws-cpp-sdk-ec2/include/aws/ec2/model/ImageDiskContainer.h | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | null | null | null | aws-cpp-sdk-ec2/include/aws/ec2/model/ImageDiskContainer.h | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/ec2/model/UserBucket.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Xml
{
class XmlNode;
} // namespace Xml
} // namespace Utils
namespace EC2
{
namespace Model
{
/**
* <p>Describes the disk container object for an import image task.</p><p><h3>See
* Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ImageDiskContainer">AWS
* API Reference</a></p>
*/
class AWS_EC2_API ImageDiskContainer
{
public:
ImageDiskContainer();
ImageDiskContainer(const Aws::Utils::Xml::XmlNode& xmlNode);
ImageDiskContainer& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);
void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const;
void OutputToStream(Aws::OStream& oStream, const char* location) const;
/**
* <p>The description of the disk image.</p>
*/
inline const Aws::String& GetDescription() const{ return m_description; }
/**
* <p>The description of the disk image.</p>
*/
inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; }
/**
* <p>The description of the disk image.</p>
*/
inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; }
/**
* <p>The description of the disk image.</p>
*/
inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); }
/**
* <p>The description of the disk image.</p>
*/
inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); }
/**
* <p>The description of the disk image.</p>
*/
inline ImageDiskContainer& WithDescription(const Aws::String& value) { SetDescription(value); return *this;}
/**
* <p>The description of the disk image.</p>
*/
inline ImageDiskContainer& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;}
/**
* <p>The description of the disk image.</p>
*/
inline ImageDiskContainer& WithDescription(const char* value) { SetDescription(value); return *this;}
/**
* <p>The block device mapping for the disk.</p>
*/
inline const Aws::String& GetDeviceName() const{ return m_deviceName; }
/**
* <p>The block device mapping for the disk.</p>
*/
inline bool DeviceNameHasBeenSet() const { return m_deviceNameHasBeenSet; }
/**
* <p>The block device mapping for the disk.</p>
*/
inline void SetDeviceName(const Aws::String& value) { m_deviceNameHasBeenSet = true; m_deviceName = value; }
/**
* <p>The block device mapping for the disk.</p>
*/
inline void SetDeviceName(Aws::String&& value) { m_deviceNameHasBeenSet = true; m_deviceName = std::move(value); }
/**
* <p>The block device mapping for the disk.</p>
*/
inline void SetDeviceName(const char* value) { m_deviceNameHasBeenSet = true; m_deviceName.assign(value); }
/**
* <p>The block device mapping for the disk.</p>
*/
inline ImageDiskContainer& WithDeviceName(const Aws::String& value) { SetDeviceName(value); return *this;}
/**
* <p>The block device mapping for the disk.</p>
*/
inline ImageDiskContainer& WithDeviceName(Aws::String&& value) { SetDeviceName(std::move(value)); return *this;}
/**
* <p>The block device mapping for the disk.</p>
*/
inline ImageDiskContainer& WithDeviceName(const char* value) { SetDeviceName(value); return *this;}
/**
* <p>The format of the disk image being imported.</p> <p>Valid values:
* <code>VHD</code> | <code>VMDK</code> | <code>OVA</code> </p>
*/
inline const Aws::String& GetFormat() const{ return m_format; }
/**
* <p>The format of the disk image being imported.</p> <p>Valid values:
* <code>VHD</code> | <code>VMDK</code> | <code>OVA</code> </p>
*/
inline bool FormatHasBeenSet() const { return m_formatHasBeenSet; }
/**
* <p>The format of the disk image being imported.</p> <p>Valid values:
* <code>VHD</code> | <code>VMDK</code> | <code>OVA</code> </p>
*/
inline void SetFormat(const Aws::String& value) { m_formatHasBeenSet = true; m_format = value; }
/**
* <p>The format of the disk image being imported.</p> <p>Valid values:
* <code>VHD</code> | <code>VMDK</code> | <code>OVA</code> </p>
*/
inline void SetFormat(Aws::String&& value) { m_formatHasBeenSet = true; m_format = std::move(value); }
/**
* <p>The format of the disk image being imported.</p> <p>Valid values:
* <code>VHD</code> | <code>VMDK</code> | <code>OVA</code> </p>
*/
inline void SetFormat(const char* value) { m_formatHasBeenSet = true; m_format.assign(value); }
/**
* <p>The format of the disk image being imported.</p> <p>Valid values:
* <code>VHD</code> | <code>VMDK</code> | <code>OVA</code> </p>
*/
inline ImageDiskContainer& WithFormat(const Aws::String& value) { SetFormat(value); return *this;}
/**
* <p>The format of the disk image being imported.</p> <p>Valid values:
* <code>VHD</code> | <code>VMDK</code> | <code>OVA</code> </p>
*/
inline ImageDiskContainer& WithFormat(Aws::String&& value) { SetFormat(std::move(value)); return *this;}
/**
* <p>The format of the disk image being imported.</p> <p>Valid values:
* <code>VHD</code> | <code>VMDK</code> | <code>OVA</code> </p>
*/
inline ImageDiskContainer& WithFormat(const char* value) { SetFormat(value); return *this;}
/**
* <p>The ID of the EBS snapshot to be used for importing the snapshot.</p>
*/
inline const Aws::String& GetSnapshotId() const{ return m_snapshotId; }
/**
* <p>The ID of the EBS snapshot to be used for importing the snapshot.</p>
*/
inline bool SnapshotIdHasBeenSet() const { return m_snapshotIdHasBeenSet; }
/**
* <p>The ID of the EBS snapshot to be used for importing the snapshot.</p>
*/
inline void SetSnapshotId(const Aws::String& value) { m_snapshotIdHasBeenSet = true; m_snapshotId = value; }
/**
* <p>The ID of the EBS snapshot to be used for importing the snapshot.</p>
*/
inline void SetSnapshotId(Aws::String&& value) { m_snapshotIdHasBeenSet = true; m_snapshotId = std::move(value); }
/**
* <p>The ID of the EBS snapshot to be used for importing the snapshot.</p>
*/
inline void SetSnapshotId(const char* value) { m_snapshotIdHasBeenSet = true; m_snapshotId.assign(value); }
/**
* <p>The ID of the EBS snapshot to be used for importing the snapshot.</p>
*/
inline ImageDiskContainer& WithSnapshotId(const Aws::String& value) { SetSnapshotId(value); return *this;}
/**
* <p>The ID of the EBS snapshot to be used for importing the snapshot.</p>
*/
inline ImageDiskContainer& WithSnapshotId(Aws::String&& value) { SetSnapshotId(std::move(value)); return *this;}
/**
* <p>The ID of the EBS snapshot to be used for importing the snapshot.</p>
*/
inline ImageDiskContainer& WithSnapshotId(const char* value) { SetSnapshotId(value); return *this;}
/**
* <p>The URL to the Amazon S3-based disk image being imported. The URL can either
* be a https URL (https://..) or an Amazon S3 URL (s3://..)</p>
*/
inline const Aws::String& GetUrl() const{ return m_url; }
/**
* <p>The URL to the Amazon S3-based disk image being imported. The URL can either
* be a https URL (https://..) or an Amazon S3 URL (s3://..)</p>
*/
inline bool UrlHasBeenSet() const { return m_urlHasBeenSet; }
/**
* <p>The URL to the Amazon S3-based disk image being imported. The URL can either
* be a https URL (https://..) or an Amazon S3 URL (s3://..)</p>
*/
inline void SetUrl(const Aws::String& value) { m_urlHasBeenSet = true; m_url = value; }
/**
* <p>The URL to the Amazon S3-based disk image being imported. The URL can either
* be a https URL (https://..) or an Amazon S3 URL (s3://..)</p>
*/
inline void SetUrl(Aws::String&& value) { m_urlHasBeenSet = true; m_url = std::move(value); }
/**
* <p>The URL to the Amazon S3-based disk image being imported. The URL can either
* be a https URL (https://..) or an Amazon S3 URL (s3://..)</p>
*/
inline void SetUrl(const char* value) { m_urlHasBeenSet = true; m_url.assign(value); }
/**
* <p>The URL to the Amazon S3-based disk image being imported. The URL can either
* be a https URL (https://..) or an Amazon S3 URL (s3://..)</p>
*/
inline ImageDiskContainer& WithUrl(const Aws::String& value) { SetUrl(value); return *this;}
/**
* <p>The URL to the Amazon S3-based disk image being imported. The URL can either
* be a https URL (https://..) or an Amazon S3 URL (s3://..)</p>
*/
inline ImageDiskContainer& WithUrl(Aws::String&& value) { SetUrl(std::move(value)); return *this;}
/**
* <p>The URL to the Amazon S3-based disk image being imported. The URL can either
* be a https URL (https://..) or an Amazon S3 URL (s3://..)</p>
*/
inline ImageDiskContainer& WithUrl(const char* value) { SetUrl(value); return *this;}
/**
* <p>The S3 bucket for the disk image.</p>
*/
inline const UserBucket& GetUserBucket() const{ return m_userBucket; }
/**
* <p>The S3 bucket for the disk image.</p>
*/
inline bool UserBucketHasBeenSet() const { return m_userBucketHasBeenSet; }
/**
* <p>The S3 bucket for the disk image.</p>
*/
inline void SetUserBucket(const UserBucket& value) { m_userBucketHasBeenSet = true; m_userBucket = value; }
/**
* <p>The S3 bucket for the disk image.</p>
*/
inline void SetUserBucket(UserBucket&& value) { m_userBucketHasBeenSet = true; m_userBucket = std::move(value); }
/**
* <p>The S3 bucket for the disk image.</p>
*/
inline ImageDiskContainer& WithUserBucket(const UserBucket& value) { SetUserBucket(value); return *this;}
/**
* <p>The S3 bucket for the disk image.</p>
*/
inline ImageDiskContainer& WithUserBucket(UserBucket&& value) { SetUserBucket(std::move(value)); return *this;}
private:
Aws::String m_description;
bool m_descriptionHasBeenSet;
Aws::String m_deviceName;
bool m_deviceNameHasBeenSet;
Aws::String m_format;
bool m_formatHasBeenSet;
Aws::String m_snapshotId;
bool m_snapshotIdHasBeenSet;
Aws::String m_url;
bool m_urlHasBeenSet;
UserBucket m_userBucket;
bool m_userBucketHasBeenSet;
};
} // namespace Model
} // namespace EC2
} // namespace Aws
| 35.024316 | 121 | 0.644624 |
cb9181c87017400be32f25e2395282c1fca01304 | 110 | sql | SQL | sql/update6.sql | aalextok/summit_test | 50b422df30f35b366a94599966da52ebb845bbf1 | [
"BSD-3-Clause"
] | null | null | null | sql/update6.sql | aalextok/summit_test | 50b422df30f35b366a94599966da52ebb845bbf1 | [
"BSD-3-Clause"
] | null | null | null | sql/update6.sql | aalextok/summit_test | 50b422df30f35b366a94599966da52ebb845bbf1 | [
"BSD-3-Clause"
] | null | null | null | ALTER TABLE `image`
ADD `name` VARCHAR(255) NULL AFTER `location`,
ADD `description` TEXT NULL AFTER `name`; | 36.666667 | 47 | 0.727273 |
16bf463d25244c91afca87f0f570deb22293ac3e | 830 | c | C | luogu.com.cn/P2436/a.c | jyi2ya/artifacts | c227d170592d1fec94a09b20e2f1f75a46dfdf1f | [
"MIT"
] | null | null | null | luogu.com.cn/P2436/a.c | jyi2ya/artifacts | c227d170592d1fec94a09b20e2f1f75a46dfdf1f | [
"MIT"
] | null | null | null | luogu.com.cn/P2436/a.c | jyi2ya/artifacts | c227d170592d1fec94a09b20e2f1f75a46dfdf1f | [
"MIT"
] | null | null | null | #include <stdio.h>
int min(int a, int b);
int max(int a, int b);
int N, M, s[1009], j[1009];
int main(void)
{
while (scanf("%d%d", &N, &M) == 2) {
int i, sum, a, b, limit = (N + M + 1) * 10;
for (i = 0; i < N; ++i) {
scanf("%d", s + i);
--s[i];
}
for (i = 0; i < M; ++i) {
scanf("%d", j + i);
--j[i];
}
a = 0x7f7f7f7f, b = 0x7f7f7f7f;
for (sum = 2; sum <= limit; ++sum) {
int mx = -0x7f7f7f7f, mn = 0x7f7f7f7f;
for (i = 0; i < N; ++i)
mx = max(s[i] % sum, mx);
for (i = 0; i < M; ++i)
mn = min(j[i] % sum, mn);
if (mx < mn && mx + 1 < a) {
a = mx + 1;
b = sum - mx - 1;
}
}
if (a != 0x7f7f7f7f)
printf("%d %d\n", a, b);
else
puts("NO");
}
return 0;
}
int min(int a, int b)
{
return a < b ? a : b;
}
int max(int a, int b)
{
return a > b ? a : b;
}
| 15.660377 | 45 | 0.426506 |
133bc06fd6a262b8639fba9135c69429c1b59eeb | 2,111 | h | C | libmqtt/src/samples/pubsub_opts.h | cypernex/location | 7e124ca6fb18a3461f5d1bfc6bccf1670d6ca11f | [
"Apache-2.0"
] | null | null | null | libmqtt/src/samples/pubsub_opts.h | cypernex/location | 7e124ca6fb18a3461f5d1bfc6bccf1670d6ca11f | [
"Apache-2.0"
] | null | null | null | libmqtt/src/samples/pubsub_opts.h | cypernex/location | 7e124ca6fb18a3461f5d1bfc6bccf1670d6ca11f | [
"Apache-2.0"
] | 2 | 2020-11-18T08:29:20.000Z | 2021-07-30T07:14:34.000Z | /*******************************************************************************
* Copyright (c) 2012, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* https://www.eclipse.org/legal/epl-2.0/
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial contribution
* Guilherme Maciel Ferreira - add keep alive option
*******************************************************************************/
#if !defined(PUBSUB_OPTS_H)
#define PUBSUB_OPTS_H
#include "MQTTAsync.h"
#include "MQTTClientPersistence.h"
struct pubsub_opts
{
/* debug app options */
int publisher; /* publisher app? */
int quiet;
int verbose;
int tracelevel;
char* delimiter;
int maxdatalen;
/* message options */
char* message;
char* filename;
int stdin_lines;
int stdlin_complete;
int null_message;
/* MQTT options */
int MQTTVersion;
char* topic;
char* clientid;
int qos;
int retained;
char* username;
char* password;
char* host;
char* port;
char* connection;
int keepalive;
/* will options */
char* will_topic;
char* will_payload;
int will_qos;
int will_retain;
/* TLS options */
int insecure;
char* capath;
char* cert;
char* cafile;
char* key;
char* keypass;
char* ciphers;
char* psk_identity;
char* psk;
/* MQTT V5 options */
int message_expiry;
struct {
char *name;
char *value;
} user_property;
};
typedef struct
{
const char* name;
const char* value;
} pubsub_opts_nameValue;
//void usage(struct pubsub_opts* opts, const char* version, const char* program_name);
void usage(struct pubsub_opts* opts, pubsub_opts_nameValue* name_values, const char* program_name);
int getopts(int argc, char** argv, struct pubsub_opts* opts);
char* readfile(int* data_len, struct pubsub_opts* opts);
void logProperties(MQTTProperties *props);
#endif
| 23.719101 | 99 | 0.670298 |
f70f20269678252e95ab8d65236cf90630719847 | 369 | kt | Kotlin | src/main/kotlin/com/realworld/springmongo/article/Tag.kt | revfactory/realworld-spring-webflux-kt | a9b3701d847fd92c55716ce2f1dacb85a851562c | [
"MIT"
] | 15 | 2021-10-18T06:21:35.000Z | 2022-03-16T20:01:21.000Z | src/main/kotlin/com/realworld/springmongo/article/Tag.kt | revfactory/realworld-spring-webflux-kt | a9b3701d847fd92c55716ce2f1dacb85a851562c | [
"MIT"
] | 1 | 2021-10-30T09:09:54.000Z | 2021-10-30T09:09:54.000Z | src/main/kotlin/com/realworld/springmongo/article/Tag.kt | revfactory/realworld-spring-webflux-kt | a9b3701d847fd92c55716ce2f1dacb85a851562c | [
"MIT"
] | 3 | 2021-10-30T05:53:46.000Z | 2022-03-16T16:38:52.000Z | package com.realworld.springmongo.article
import org.springframework.data.annotation.Id
import org.springframework.data.mongodb.core.index.Indexed
import org.springframework.data.mongodb.core.mapping.Document
@Document
data class Tag(
@Id
val id: String? = null,
@Indexed(unique = true)
val tagName: String,
)
fun String.toTag() = Tag(tagName = this) | 24.6 | 61 | 0.758808 |
c9100b1f4eef88301e9e91df7c70d992960d82bc | 92 | sql | SQL | src/test/resources/sql/delete/7093c32d.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 66 | 2018-06-15T11:34:03.000Z | 2022-03-16T09:24:49.000Z | src/test/resources/sql/delete/7093c32d.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 13 | 2019-03-19T11:56:28.000Z | 2020-08-05T04:20:50.000Z | src/test/resources/sql/delete/7093c32d.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 28 | 2019-01-05T19:59:02.000Z | 2022-03-24T11:55:50.000Z | -- file:updatable_views.sql ln:907 expect:true
DELETE FROM rw_view1 WHERE NOT snoop(person)
| 30.666667 | 46 | 0.804348 |
b95687e9ec8879b05eb586bc082a67a0eaa56595 | 2,218 | h | C | Meniga/Meniga-ios-sdk/External/LifeGoals/MNFLifeGoalHistory.h | meniga/mobile-sdk-ios | 3c4a4de13868b9129920cab2ce5d0e6f2de8d1d6 | [
"MIT"
] | 3 | 2017-04-12T08:51:24.000Z | 2018-01-30T18:15:55.000Z | Meniga/Meniga-ios-sdk/External/LifeGoals/MNFLifeGoalHistory.h | meniga/mobile-sdk-ios | 3c4a4de13868b9129920cab2ce5d0e6f2de8d1d6 | [
"MIT"
] | 75 | 2018-04-11T14:28:41.000Z | 2022-03-24T13:09:50.000Z | Meniga/Meniga-ios-sdk/External/LifeGoals/MNFLifeGoalHistory.h | meniga/mobile-sdk-ios | 3c4a4de13868b9129920cab2ce5d0e6f2de8d1d6 | [
"MIT"
] | 1 | 2019-05-22T14:04:11.000Z | 2019-05-22T14:04:11.000Z | //
// MNFLifeGoalHistory.h
// Meniga-ios-sdk
//
// Created by Haukur Ísfeld on 15/03/2018.
// Copyright © 2018 Meniga. All rights reserved.
//
#import "MNFObject.h"
NS_ASSUME_NONNULL_BEGIN
@interface MNFLifeGoalHistory : MNFObject
/**
The id of the life goal.
*/
@property (nonatomic, strong, readonly) NSNumber *lifeGoalId;
/**
The time stamp of the change that generated this record.
*/
@property (nonatomic, strong, readonly) NSDate *processingDate;
/**
The name of the life goal at the time of the change.
*/
@property (nonatomic, copy, readonly) NSString *name;
/**
The priority of the life goal at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *priority;
/**
The target date of the life goal at the time of the change.
*/
@property (nonatomic, strong, readonly) NSDate *targetDate;
/**
The account balance at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *accountBalance;
/**
The id of the icon for the life goal at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *iconId;
/**
The intercept amount of the life goal at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *interceptAmount;
/**
The target amount of the life goal at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *targetAmount;
/**
The amount allocated to the life goal at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *currentAmount;
/**
The estimated recurring amount for the life goal at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *recurringAmount;
/**
Whether the life goal has been deleted at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *isDeleted;
/**
Whether the life goal is achieved at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *isAchieved;
/**
Whether the life goal is withdrawn at the time of the change.
*/
@property (nonatomic, strong, readonly) NSNumber *isWithdrawn;
/**
The life goal data at the time of the change.
*/
@property (nonatomic, copy, readonly) NSString *lifeGoalData;
@end
NS_ASSUME_NONNULL_END
| 23.849462 | 76 | 0.72633 |
28657f842476ae652a7b226effdf3382c068da6c | 367 | swift | Swift | Meditation Warrior/Views/AboutView.swift | pedantix/vet-meditation-app-ios | 068b8fb171059a516367af2dd5f6ccb0c4c4245f | [
"MIT"
] | null | null | null | Meditation Warrior/Views/AboutView.swift | pedantix/vet-meditation-app-ios | 068b8fb171059a516367af2dd5f6ccb0c4c4245f | [
"MIT"
] | 3 | 2020-01-20T16:51:44.000Z | 2020-01-28T02:14:43.000Z | Meditation Warrior/Views/AboutView.swift | pedantix/vet-meditation-app-ios | 068b8fb171059a516367af2dd5f6ccb0c4c4245f | [
"MIT"
] | null | null | null | //
// AboutView.swift
// Meditation Warrior
//
// Created by Shaun Hubbard on 1/20/20.
// Copyright © 2020 Adept Apps. All rights reserved.
//
import SwiftUI
struct AboutView: View {
var body: some View {
Text("About").font(.title)
}
}
struct AboutView_Previews: PreviewProvider {
static var previews: some View {
AboutView()
}
}
| 16.681818 | 53 | 0.643052 |
45643f065c91127dae1c14f8795568e9e2cb4f0a | 155 | swift | Swift | Tests/Modules/Foo/FooStyle.swift | locationlabs/Cobra | b60e8f6fd842e71acecb822694fd3a7d70948097 | [
"Apache-2.0"
] | 12 | 2016-10-12T04:16:18.000Z | 2019-11-01T15:24:02.000Z | Tests/Modules/Foo/FooStyle.swift | locationlabs/Cobra | b60e8f6fd842e71acecb822694fd3a7d70948097 | [
"Apache-2.0"
] | null | null | null | Tests/Modules/Foo/FooStyle.swift | locationlabs/Cobra | b60e8f6fd842e71acecb822694fd3a7d70948097 | [
"Apache-2.0"
] | 5 | 2016-12-17T00:51:15.000Z | 2021-09-08T09:33:33.000Z | import UIKit
public class FooStyle {
}
public protocol FooStyleType: class {
}
// MARK: - FooStyleType
extension FooStyle: FooStyleType {
}
| 9.6875 | 37 | 0.683871 |
7e8ba1c8c5e4a57aa849a00c9a252d525330f6f3 | 415 | swift | Swift | TestMusic/Application/Main/MainRouter.swift | GlisboaDev/Youtube-Facebook_test | 858fdac323c6088501f2df6014a93255d23afe71 | [
"MIT"
] | null | null | null | TestMusic/Application/Main/MainRouter.swift | GlisboaDev/Youtube-Facebook_test | 858fdac323c6088501f2df6014a93255d23afe71 | [
"MIT"
] | null | null | null | TestMusic/Application/Main/MainRouter.swift | GlisboaDev/Youtube-Facebook_test | 858fdac323c6088501f2df6014a93255d23afe71 | [
"MIT"
] | null | null | null | //
// LoginRouter.swift
// TestMusic
//
// Created by Guilherme Lisboa on 09/04/17.
// Copyright © 2017 LDevelopment. All rights reserved.
//
import Foundation
class MainScreenRouter: Router {
override init(parent: Router) {
super.init(parent: parent)
let dataManager = MainScreenDataManager()
self.controller = MainScreenController(router: self, dataManager: dataManager)
}
}
| 23.055556 | 86 | 0.693976 |
84bf78502f5963b9b5b88a4fa67a464ef2ab78bf | 654 | c | C | findpat/test/test_interv.c | kapow-argentina/findpat | 6975efb4414197bf91babd7775bb8c48d2befd0f | [
"MIT"
] | null | null | null | findpat/test/test_interv.c | kapow-argentina/findpat | 6975efb4414197bf91babd7775bb8c48d2befd0f | [
"MIT"
] | null | null | null | findpat/test/test_interv.c | kapow-argentina/findpat | 6975efb4414197bf91babd7775bb8c48d2befd0f | [
"MIT"
] | 1 | 2021-12-13T03:01:32.000Z | 2021-12-13T03:01:32.000Z | #include <stdio.h>
#include <stdlib.h>
#include "interv.h"
void print_interval(uint start, uint end) {
printf("%i\t%i\n", start, end);
}
int main(int argc, char **argv) {
if (argc != 2) {
fprintf(stderr, "Usage: %s <max>\n", argv[0]);
fprintf(stderr, " reads intervals from stdin in the range [0, <max>)\n");
fprintf(stderr, " and prints their union in stdout.\n"
" format: one interval per line: %%i\\t%%i\n");
exit(1);
}
int mx = atoi(argv[1]);
int start, end;
interv *in = interv_new(mx);
while (fscanf(stdin, "%i\t%i\n", &start, &end) == 2) {
interv_add(in, start, end);
}
interv_union(in, print_interval);
return 0;
}
| 21.8 | 75 | 0.617737 |
7139a6957eab412a0d3510d3e97aea34c0e242d8 | 1,062 | tsx | TypeScript | components/g/UI/SearchBox.tsx | eudpna/chord-search | cca7cd4bb3e9ac02fc178dd6fd08563ec1571baa | [
"MIT"
] | null | null | null | components/g/UI/SearchBox.tsx | eudpna/chord-search | cca7cd4bb3e9ac02fc178dd6fd08563ec1571baa | [
"MIT"
] | null | null | null | components/g/UI/SearchBox.tsx | eudpna/chord-search | cca7cd4bb3e9ac02fc178dd6fd08563ec1571baa | [
"MIT"
] | null | null | null | import { useEffect } from "react"
import { GCtx } from "../../../g/GCtx"
import { guitarChords, ukuleleChords } from "../../../lib/chords"
const getChords = (instrument: 'guitar' | 'ukulele') => instrument === 'guitar' ? guitarChords : ukuleleChords
export const SearchBox: React.FC<{
gctx: GCtx
}> = (props) => {
useEffect(() => {
setTimeout(() => {
search(props.gctx)
props.gctx.render()
}, 0)
}, [])
return <div className="max-w-sm mx-auto">
<input
className="mb-4 w-full p-2 px-5 rounded-full border-gray border-2"
type="text"
value={props.gctx.state.q}
placeholder={"コードを検索"}
onChange={e => {
props.gctx.state.q = e.target.value
search(props.gctx)
props.gctx.render()
}}
/>
</div>
}
export function search(gctx: GCtx) {
const results = getChords(gctx.state.instrument).search(gctx.state.q)
gctx.state.chords = results.slice(0, 10)
} | 28.702703 | 110 | 0.53484 |
96115cb8cd033b0666f11a8a7fe5a992dc4e32a7 | 1,568 | swift | Swift | SwiftI18n/Polyglot/PolyglotSwiftI18Extensions.swift | infinum/iOS-SwiftI18n | 8db47dbfe0075000cb1a60004aa0b1843f82dd69 | [
"MIT"
] | null | null | null | SwiftI18n/Polyglot/PolyglotSwiftI18Extensions.swift | infinum/iOS-SwiftI18n | 8db47dbfe0075000cb1a60004aa0b1843f82dd69 | [
"MIT"
] | 1 | 2021-05-11T17:27:13.000Z | 2021-05-11T17:27:13.000Z | SwiftI18n/Polyglot/PolyglotSwiftI18Extensions.swift | infinum/iOS-SwiftI18n | 8db47dbfe0075000cb1a60004aa0b1843f82dd69 | [
"MIT"
] | null | null | null | //
// I18n.swift
// SwiftI18n
//
// Created by Vlaho Poluta on 17/04/18.
// Copyright © 2016 Infinum. All rights reserved.
//
import UIKit
import SwiftI18n
extension String {
public var localized: String {
return localised
}
public func localizedFormat(with args: CVarArg...) -> String {
return String(format: self.localised, arguments: args)
}
}
extension Language: Equatable {
static func == (lhs: Language, rhs: Language) -> Bool {
return lhs.languageCode == rhs.languageCode
}
}
extension Localizable {
var titleKey: Strings? {
get { return base.locTitleKey.flatMap { Strings(rawValue: $0) } }
set { base.locTitleKey = newValue?.rawValue }
}
}
extension Localizable where Base: UIButton {
func titleKey(for state: UIControl.State) -> Strings? {
return base.locTitleKey(for: state).flatMap { Strings(rawValue: $0) }
}
func setTitleKey(_ key: Strings, for state: UIControl.State) {
return base.setLocTitleKey(key.rawValue, for: state)
}
}
extension Localizable where Base: UITextField {
var placeholderKey: Strings? {
get { return base.locPlaceholderKey.flatMap { Strings(rawValue: $0) } }
set { base.locPlaceholderKey = newValue?.rawValue }
}
}
extension Localizable where Base: UISearchBar {
var placeholderKey: Strings? {
get { return base.locPlaceholderKey.flatMap { Strings(rawValue: $0) } }
set { base.locPlaceholderKey = newValue?.rawValue }
}
}
| 23.757576 | 79 | 0.640944 |
04b5fe8a6f3f42bbcec8a313a6b41a99a6da3948 | 2,944 | html | HTML | src/main/resources/html/treeview.html | NormanDunbar/asciidoc-antlr | cb00e6cb3619b2f6a79324d196b5edf6751a17e5 | [
"MIT"
] | 10 | 2017-09-01T11:08:11.000Z | 2021-06-26T11:40:36.000Z | src/main/resources/html/treeview.html | NormanDunbar/asciidoc-antlr | cb00e6cb3619b2f6a79324d196b5edf6751a17e5 | [
"MIT"
] | 3 | 2018-07-24T22:38:15.000Z | 2020-06-14T15:47:29.000Z | src/main/resources/html/treeview.html | venkatperi/asciidoc-antlr | cb00e6cb3619b2f6a79324d196b5edf6751a17e5 | [
"MIT"
] | 5 | 2018-08-29T10:16:08.000Z | 2021-01-19T12:59:24.000Z | <html>
<head>
</head>
<body>
<script src="lodash.core.min.js"></script>
<script src="inspire-tree.min.js"></script>
<script>
new InspireTree( {
target: "#tree",
data: [
{ "text": asciidoc, "children": [{ "text": doc_header, "children": [{ "text": doc_title_line, "children": [{ "text": [H0] = }, { "text": doc_title_def, "children": [{ "text": doc_title, "children": [{ "text": [DOCTITLE_PART] This is the title}]}, { "text": [DOCTITLE_CSP] : }, { "text": doc_subtitle, "children": [{ "text": [DOCTITLE_PART] this is the subtitle}]}, { "text": [DOCTITLE_EOL] \n}]}]}, { "text": doc_author_rev_line, "children": [{ "text": doc_author_line, "children": [{ "text": doc_authors, "children": [{ "text": doc_authors, "children": [{ "text": doc_author, "children": [{ "text": doc_author_name, "children": [{ "text": doc_author_firstname, "children": [{ "text": [DOCAUTHOR_NAME] First}]}, { "text": doc_author_lastname, "children": [{ "text": [DOCAUTHOR_NAME] Author}]}]}, { "text": doc_author_contact, "children": [{ "text": [DOCAUTHOR_CONTACT] <author1@gmail.com>}]}]}]}, { "text": [DOCAUTHOR_SEP] ;}, { "text": doc_author, "children": [{ "text": doc_author_name, "children": [{ "text": doc_author_firstname, "children": [{ "text": [DOCAUTHOR_NAME] Second}]}, { "text": doc_author_lastname, "children": [{ "text": [DOCAUTHOR_NAME] Author}]}]}, { "text": doc_author_contact, "children": [{ "text": [DOCAUTHOR_CONTACT] <author2@gmail.com>}]}]}]}, { "text": [DOCAUTHOR_EOL] \n}]}, { "text": doc_revision_line, "children": [{ "text": [DOCREV_NUMPREFIX] v}, { "text": doc_rev_number, "children": [{ "text": [DOCREV_NUMBER] 1.0}]}, { "text": [DOCREV_COMMA] ,}, { "text": [DOCREV_EOL] \n}]}]}, { "text": global_attrs, "children": [{ "text": global_attr, "children": [{ "text": [ATTR_BEGIN] :}, { "text": attr_def, "children": [{ "text": attr_set, "children": [{ "text": attr_id, "children": [{ "text": [ATTR_ID] leveloffset}]}, { "text": [ATTR_SEP] : }, { "text": attr_value, "children": [{ "text": [ATTR_VALUE] 3}]}]}]}, { "text": [ATTR_EOL] \n}]}]}, { "text": [END_OF_HEADER] \n}]}, { "text": doc_sections, "children": [{ "text": doc_section, "children": [{ "text": section_start_lines, "children": [{ "text": section_title_line, "children": [{ "text": [CONTENT_SEC_TITLE_START] == }, { "text": section_title, "children": [{ "text": [SECTITLE_TEXT] Chapter 1}]}, { "text": [SECTITLE_EOL] \n\n}]}]}, { "text": sec_content_items, "children": [{ "text": sec_content_items, "children": [{ "text": sec_content_item, "children": [{ "text": paragraph, "children": [{ "text": [CONTENT_PARA] This is a sample paragraph.\nThis is the second line of the first para\nAlso part of first para.\n\n}]}]}]}, { "text": sec_content_item, "children": [{ "text": paragraph, "children": [{ "text": [CONTENT_PARA] This is the second para.\n\n\n}]}]}]}]}]}, { "text": [EOF] <EOF>}]}
]
});
</script>
<div id="tree"></div>
</body>
</html>
| 154.947368 | 2,679 | 0.617527 |
013d6ac1e7179824c9095d2f7723761519f96a39 | 901 | rs | Rust | relayer-cli/src/commands/create.rs | yihuang/ibc-rs | 5ea7e84647c69795c169d8cce0b798ea1e925c27 | [
"Apache-2.0"
] | 191 | 2020-02-24T21:12:13.000Z | 2022-03-30T02:10:46.000Z | relayer-cli/src/commands/create.rs | yihuang/ibc-rs | 5ea7e84647c69795c169d8cce0b798ea1e925c27 | [
"Apache-2.0"
] | 1,523 | 2020-02-26T16:37:42.000Z | 2022-03-31T20:27:23.000Z | relayer-cli/src/commands/create.rs | yihuang/ibc-rs | 5ea7e84647c69795c169d8cce0b798ea1e925c27 | [
"Apache-2.0"
] | 88 | 2020-03-04T00:48:22.000Z | 2022-03-20T12:35:33.000Z | //! `create` subcommand
use abscissa_core::{Command, Help, Options, Runnable};
use crate::commands::create::channel::CreateChannelCommand;
use crate::commands::create::connection::CreateConnectionCommand;
use crate::commands::tx::client::TxCreateClientCmd;
mod channel;
mod connection;
/// `create` subcommands
#[derive(Command, Debug, Options, Runnable)]
pub enum CreateCmds {
/// Generic `help`
#[options(help = "Get usage information")]
Help(Help<Self>),
/// Subcommand for creating a `client`
#[options(help = "Create a new IBC client")]
Client(TxCreateClientCmd),
/// Subcommand for creating a `connection`
#[options(help = "Create a new connection between two chains")]
Connection(CreateConnectionCommand),
/// Subcommand for creating a `channel`
#[options(help = "Create a new channel between two chains")]
Channel(CreateChannelCommand),
}
| 30.033333 | 67 | 0.709212 |
e6299a9ce7702a7caad8dd5fd69c0f7c6549beed | 14,195 | go | Go | pkg/cfg/repository_test.go | whiteboxio/msgrelay | 508d75d68a2c1932fdbb240b72a1a48880d18ed5 | [
"MIT"
] | 10 | 2019-01-14T10:00:48.000Z | 2021-08-25T03:27:02.000Z | pkg/cfg/repository_test.go | whiteboxio/msgrelay | 508d75d68a2c1932fdbb240b72a1a48880d18ed5 | [
"MIT"
] | 30 | 2019-01-14T13:06:35.000Z | 2019-09-07T15:22:28.000Z | pkg/cfg/repository_test.go | whiteboxio/flow | 508d75d68a2c1932fdbb240b72a1a48880d18ed5 | [
"MIT"
] | 4 | 2019-01-14T09:23:46.000Z | 2019-02-23T17:48:53.000Z | package cfg
import (
"fmt"
"reflect"
"testing"
"github.com/awesome-flow/flow/pkg/cast"
"github.com/awesome-flow/flow/pkg/types"
)
func strptr(v string) *string { return &v }
func boolptr(v bool) *bool { return &v }
func intptr(v int) *int { return &v }
func flushMappers() {
mappersMx.Lock()
defer mappersMx.Unlock()
mappers = cast.NewMapperNode()
}
type queueItem struct {
k types.Key
n *node
}
// Visits all nodes in the repo and maps flattened keys to provider list.
func flattenRepo(repo *Repository) map[string][]Provider {
res := make(map[string][]Provider)
queue := make([]queueItem, 0, 1)
queue = append(queue, queueItem{nil, repo.root})
var head queueItem
for len(queue) > 0 {
head, queue = queue[0], queue[1:]
if len(head.n.providers) > 0 {
res[head.k.String()] = head.n.providers
} else if len(head.n.children) > 0 {
for k, n := range head.n.children {
queue = append(queue, queueItem{append(head.k, k), n})
}
}
}
return res
}
type TestProv struct {
val types.Value
weight int
isSetUp bool
}
func NewTestProv(val types.Value, weight int) *TestProv {
return &TestProv{
val: val,
weight: weight,
isSetUp: false,
}
}
func (tp *TestProv) SetUp(_ *Repository) error {
tp.isSetUp = true
return nil
}
func (tp *TestProv) TearDown(_ *Repository) error { return nil }
func (tp *TestProv) Get(key types.Key) (*types.KeyValue, bool) {
return &types.KeyValue{
Key: key,
Value: tp.val,
}, true
}
func (tp *TestProv) Weight() int { return tp.weight }
func (tp *TestProv) Name() string { return "test" }
func (tp *TestProv) Depends() []string { return []string{} }
func TestGetSingleProvider(t *testing.T) {
repo := NewRepository()
prov := NewTestProv(42, 10)
key := types.NewKey("foo.bar.baz")
repo.RegisterKey(key, prov)
tests := []struct {
key types.Key
ok bool
val types.Value
}{
{
key: types.NewKey("foo"),
ok: true,
val: map[string]types.Value{
"bar": map[string]types.Value{
"baz": 42,
},
},
},
{
key: types.NewKey("foo.bar"),
ok: true,
val: map[string]types.Value{"baz": 42},
},
{
key: types.NewKey("foo.bar.baz"),
ok: true,
val: 42,
},
{
key: types.NewKey("foo.bar.baz.boo"),
ok: false,
val: nil,
},
}
for _, testCase := range tests {
val, ok := repo.Get(testCase.key)
if ok != testCase.ok {
t.Fatalf("Unexpected key %q lookup result: want %t, got: %t", testCase.key, testCase.ok, ok)
}
if !ok {
continue
}
if !reflect.DeepEqual(val, testCase.val) {
t.Fatalf("Unexpected value for key %q: want %v, got %v", testCase.key, testCase.val, val)
}
}
}
func TestTrioProviderSingleKey(t *testing.T) {
repo := NewRepository()
prov1 := NewTestProv(10, 10)
prov2 := NewTestProv(20, 20)
prov3 := NewTestProv(30, 30)
key := types.NewKey("foo.bar.baz")
repo.RegisterKey(key, prov1)
repo.RegisterKey(key, prov2)
repo.RegisterKey(key, prov3)
tests := []struct {
key types.Key
ok bool
val types.Value
}{
{
key: types.NewKey("foo"),
ok: true,
val: map[string]types.Value{
"bar": map[string]types.Value{
"baz": 30,
},
},
},
{
key: types.NewKey("foo.bar"),
ok: true,
val: map[string]types.Value{"baz": 30},
},
{
key: types.NewKey("foo.bar.baz"),
ok: true,
val: 30,
},
{
key: types.NewKey("foo.bar.baz.boo"),
ok: false,
val: nil,
},
}
for _, testCase := range tests {
val, ok := repo.Get(testCase.key)
if ok != testCase.ok {
t.Fatalf("Unexpected key %q lookup result: want %t, got: %t", testCase.key, testCase.ok, ok)
}
if !reflect.DeepEqual(val, testCase.val) {
t.Fatalf("Unexpected value for key %q: want %#v, got %#v", testCase.key, testCase.val, val)
}
}
}
func TestTrioProviderThreeKeys(t *testing.T) {
repo := NewRepository()
prov1 := NewTestProv(10, 10)
prov2 := NewTestProv(20, 20)
prov3 := NewTestProv(30, 30)
key1 := types.NewKey("k1.k1.k1")
key2 := types.NewKey("k2.k2.k2")
key3 := types.NewKey("k3.k3.k3")
repo.RegisterKey(key1, prov1)
repo.RegisterKey(key2, prov2)
repo.RegisterKey(key3, prov3)
tests := []struct {
key types.Key
ok bool
val types.Value
}{
{
key: types.NewKey("k1.k1.k1"),
ok: true,
val: prov1.val,
},
{
key: types.NewKey("k2.k2.k2"),
ok: true,
val: prov2.val,
},
{
key: types.NewKey("k3.k3.k3"),
ok: true,
val: prov3.val,
},
{
key: types.NewKey(""),
ok: false,
val: nil,
},
{
key: types.NewKey("k1.k2.k3"),
ok: false,
val: nil,
},
{
key: types.NewKey("k1"),
ok: true,
val: map[string]types.Value{
"k1": map[string]types.Value{
"k1": prov1.val,
},
},
},
{
key: types.NewKey("k2.k2"),
ok: true,
val: map[string]types.Value{"k2": prov2.val},
},
{
key: types.NewKey("k3.k3.k3.k3"),
ok: false,
val: nil,
},
}
for _, testCase := range tests {
val, ok := repo.Get(testCase.key)
if ok != testCase.ok {
t.Fatalf("Unexpected key %q lookup result: want %t, got: %t", testCase.key, testCase.ok, ok)
}
if !reflect.DeepEqual(val, testCase.val) {
t.Fatalf("Unexpected value for key %q: want %v, got %v", testCase.key, testCase.val, val)
}
}
}
func TestTrioProviderNestingKey(t *testing.T) {
repo := NewRepository()
prov1 := NewTestProv(10, 10)
prov2 := NewTestProv(20, 20)
prov3 := NewTestProv(30, 30)
key1 := types.NewKey("foo")
key2 := types.NewKey("foo.bar")
key3 := types.NewKey("foo.bar.baz")
repo.RegisterKey(key1, prov1)
repo.RegisterKey(key2, prov2)
repo.RegisterKey(key3, prov3)
tests := []struct {
key types.Key
ok bool
val types.Value
}{
{
key: key1,
ok: true,
val: prov1.val,
},
{
key: key2,
ok: true,
val: prov2.val,
},
{
key: key3,
ok: true,
val: prov3.val,
},
{
key: types.NewKey(""),
ok: false,
val: nil,
},
{
key: types.NewKey("foo.bar.baz.boo"),
ok: false,
val: nil,
},
}
for _, testCase := range tests {
val, ok := repo.Get(testCase.key)
if ok != testCase.ok {
t.Fatalf("Unexpected key %q lookup result: want %t, got: %t", testCase.key, testCase.ok, ok)
}
if !reflect.DeepEqual(val, testCase.val) {
t.Fatalf("Unexpected value for key %q: want %v, got %v", testCase.key, testCase.val, val)
}
}
}
func Test_getAll(t *testing.T) {
repo := NewRepository()
n := &node{
children: map[string]*node{
"foo": &node{
children: map[string]*node{
"baz": &node{
providers: []Provider{
NewTestProv(10, 10),
NewTestProv(5, 5),
},
},
},
},
"bar": &node{
providers: []Provider{
NewTestProv(20, 20),
},
},
},
}
want := map[string]types.Value{
"foo": map[string]types.Value{
"baz": 10,
},
"bar": 20,
}
got := n.getAll(repo, nil).Value
if !reflect.DeepEqual(want, got) {
t.Fatalf("Unexpcted traversal value: want: %#v, got: %#v", want, got)
}
}
type admincfg struct {
enabled bool
}
type systemcfg struct {
maxproc int
admincfg *admincfg
}
type admincfgmapper struct{}
var _ cast.Mapper = (*admincfgmapper)(nil)
func (acm *admincfgmapper) Map(kv *types.KeyValue) (*types.KeyValue, error) {
if vmap, ok := kv.Value.(map[string]types.Value); ok {
res := &admincfg{}
if enabled, ok := vmap["enabled"]; ok {
res.enabled = enabled.(bool)
}
return &types.KeyValue{Key: kv.Key, Value: res}, nil
}
return nil, fmt.Errorf("Conversion to admincfg failed for key: %q value: %#v", kv.Key.String(), kv.Value)
}
type systemcfgmapper struct{}
var _ cast.Mapper = (*systemcfgmapper)(nil)
func (scm *systemcfgmapper) Map(kv *types.KeyValue) (*types.KeyValue, error) {
if vmap, ok := kv.Value.(map[string]types.Value); ok {
res := &systemcfg{}
if ac, ok := vmap["admin"]; ok {
if acptr, ok := ac.(*admincfg); ok {
res.admincfg = acptr
} else {
return nil, fmt.Errorf("Wrong format for admincfg value: %#v", ac)
}
}
if maxproc, ok := vmap["maxprocs"]; ok {
res.maxproc = maxproc.(int)
}
return &types.KeyValue{Key: kv.Key, Value: res}, nil
}
return nil, fmt.Errorf("Conversion to systemcfg failed for key: %q value: %#v", kv.Key.String(), kv.Value)
}
func Test_DefineSchema_Primitive(t *testing.T) {
repoSchema := cast.Schema(map[string]cast.Schema{
"system": map[string]cast.Schema{
"__self__": nil,
"maxproc": cast.ToInt,
"admin": map[string]cast.Schema{
"__self__": nil,
"enabled": cast.ToBool,
},
},
})
tests := []struct {
name string
input map[string]types.Value
expected map[string]types.Value
}{
{
name: "No casting",
input: map[string]types.Value{
"system.maxproc": 4,
"system.admin.enabled": true,
},
expected: map[string]types.Value{
"system.maxproc": 4,
"system.admin.enabled": true,
"system.admin": map[string]types.Value{
"enabled": true,
},
"system": map[string]types.Value{
"maxproc": 4,
"admin": map[string]types.Value{
"enabled": true,
},
},
},
},
{
name: "Casting from all-strings",
input: map[string]types.Value{
"system.maxproc": "4",
"system.admin.enabled": "true",
},
expected: map[string]types.Value{
"system.maxproc": 4,
"system.admin.enabled": true,
"system.admin": map[string]types.Value{
"enabled": true,
},
"system": map[string]types.Value{
"maxproc": 4,
"admin": map[string]types.Value{
"enabled": true,
},
},
},
},
{
name: "Casting from ptrs",
input: map[string]types.Value{
"system.maxproc": intptr(4),
"system.admin.enabled": boolptr(true),
},
expected: map[string]types.Value{
"system.maxproc": 4,
"system.admin.enabled": true,
"system.admin": map[string]types.Value{
"enabled": true,
},
"system": map[string]types.Value{
"maxproc": 4,
"admin": map[string]types.Value{
"enabled": true,
},
},
},
},
}
t.Parallel()
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
repo := NewRepository()
repo.DefineSchema(repoSchema)
for path, value := range testCase.input {
repo.RegisterKey(types.NewKey(path), NewTestProv(value, DefaultWeight))
}
for lookupPath, expVal := range testCase.expected {
gotVal, gotOk := repo.Get(types.NewKey(lookupPath))
if !gotOk {
t.Fatalf("Expected lookup for key %q to find a value, none returned", lookupPath)
}
if !reflect.DeepEqual(gotVal, expVal) {
t.Fatalf("Unexpected value returned by lookup for key %q: got: %#v, want: %#v", lookupPath, gotVal, expVal)
}
}
})
}
}
func Test_DefineSchema_Struct(t *testing.T) {
repoSchema := cast.Schema(map[string]cast.Schema{
"system": map[string]cast.Schema{
"__self__": &systemcfgmapper{},
"maxprocs": cast.ToInt,
"admin": map[string]cast.Schema{
"__self__": &admincfgmapper{},
"enabled": cast.ToBool,
},
},
})
tests := []struct {
name string
input map[string]types.Value
expected map[string]types.Value
}{
{
name: "No casting",
input: map[string]types.Value{
"system.maxprocs": 4,
"system.admin.enabled": true,
},
expected: map[string]types.Value{
"system.maxprocs": 4,
"system.admin.enabled": true,
"system.admin": &admincfg{enabled: true},
"system": &systemcfg{admincfg: &admincfg{enabled: true}, maxproc: 4},
},
},
{
name: "Casting from all-strings",
input: map[string]types.Value{
"system.maxprocs": "4",
"system.admin.enabled": "true",
},
expected: map[string]types.Value{
"system.maxprocs": 4,
"system.admin.enabled": true,
"system.admin": &admincfg{enabled: true},
"system": &systemcfg{admincfg: &admincfg{enabled: true}, maxproc: 4},
},
},
{
name: "Casting from ptrs",
input: map[string]types.Value{
"system.maxprocs": intptr(4),
"system.admin.enabled": boolptr(true),
},
expected: map[string]types.Value{
"system.maxprocs": 4,
"system.admin.enabled": true,
"system.admin": &admincfg{enabled: true},
"system": &systemcfg{admincfg: &admincfg{enabled: true}, maxproc: 4},
},
},
}
t.Parallel()
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
repo := NewRepository()
repo.DefineSchema(repoSchema)
for path, value := range testCase.input {
repo.RegisterKey(types.NewKey(path), NewTestProv(value, DefaultWeight))
}
for lookupPath, expVal := range testCase.expected {
gotVal, gotOk := repo.Get(types.NewKey(lookupPath))
if !gotOk {
t.Fatalf("Expected lookup for key %q to find a value, none returned", lookupPath)
}
if !reflect.DeepEqual(gotVal, expVal) {
t.Fatalf("Unexpected value returned by lookup for key %q: got: %#v, want: %#v", lookupPath, gotVal, expVal)
}
}
})
}
}
func TestExplain(t *testing.T) {
repo := NewRepository()
prov1 := NewTestProv("foo", 10)
prov2 := NewTestProv("bar", 20)
repo.RegisterKey(types.NewKey("foo.bar.1"), prov1)
repo.RegisterKey(types.NewKey("foo.baz.2"), prov2)
repo.RegisterKey(types.NewKey("foo.moo.3"), prov1)
repo.RegisterKey(types.NewKey("foo.moo.3"), prov2)
got := repo.Explain()
want := map[string]interface{}{
"foo": map[string]interface{}{
"bar": map[string]interface{}{
"1": map[string]interface{}{
"__value__": []map[string]interface{}{
{"provider_name": "test", "provider_weight": 10, "value": "foo"},
},
},
},
"baz": map[string]interface{}{
"2": map[string]interface{}{
"__value__": []map[string]interface{}{
{"provider_name": "test", "provider_weight": 20, "value": "bar"},
},
},
},
"moo": map[string]interface{}{
"3": map[string]interface{}{
"__value__": []map[string]interface{}{
{"provider_name": "test", "provider_weight": 20, "value": "bar"},
{"provider_name": "test", "provider_weight": 10, "value": "foo"},
},
},
},
},
}
if !reflect.DeepEqual(want, got) {
t.Fatalf("repo.Explain() = %#v, want: %#v", got, want)
}
}
| 22.784912 | 112 | 0.60472 |
dde046743f9ba0d4c1bb7edddebb0c5154f84f69 | 372 | h | C | include/pirate/http.h | lmjohns3/lib8266 | c8400d2061ae1ceb5054b5f4cea512a7e09a6ddb | [
"MIT"
] | null | null | null | include/pirate/http.h | lmjohns3/lib8266 | c8400d2061ae1ceb5054b5f4cea512a7e09a6ddb | [
"MIT"
] | null | null | null | include/pirate/http.h | lmjohns3/lib8266 | c8400d2061ae1ceb5054b5f4cea512a7e09a6ddb | [
"MIT"
] | null | null | null | #ifndef PIRATE__HTTP__H__
#define PIRATE__HTTP__H__
#include "esp_http_client.h"
#include "pirate/base.h"
typedef void (* ahoy_http_poll_cb)(esp_http_client_config_t *, esp_http_client_handle_t);
void ahoy_http_poll(uint32_t period_ms,
const char *url,
const char *cert,
ahoy_http_poll_cb callback);
#endif
| 23.25 | 89 | 0.680108 |
71d3c131468671f4e521f5e58d48ba3a5c493838 | 253 | ts | TypeScript | src/app/core/interfaces/customer.ts | jackoschoonderwoerd/stripe-course-two | 01eb06a33f3d864257a9583ad149b60abc0e9f2b | [
"MIT"
] | null | null | null | src/app/core/interfaces/customer.ts | jackoschoonderwoerd/stripe-course-two | 01eb06a33f3d864257a9583ad149b60abc0e9f2b | [
"MIT"
] | null | null | null | src/app/core/interfaces/customer.ts | jackoschoonderwoerd/stripe-course-two | 01eb06a33f3d864257a9583ad149b60abc0e9f2b | [
"MIT"
] | null | null | null | import { Order } from './order'
export interface Customer {
firstName: string;
lastName: string;
email: string;
street: string;
houseNumber: number;
addition: string;
zipCode: string;
city: string;
country: string
orders: Order[]
} | 18.071429 | 31 | 0.683794 |
7535638ddcb363dd242cfbf9b14e90427e2bfcbf | 1,645 | h | C | XInternetTest/_IncludeClient/PhoneDevice.h | kirainstorm/InternetofthingsServer | 3a18ccb337c5556b01ce9fb51dac35ba16182257 | [
"Apache-2.0"
] | null | null | null | XInternetTest/_IncludeClient/PhoneDevice.h | kirainstorm/InternetofthingsServer | 3a18ccb337c5556b01ce9fb51dac35ba16182257 | [
"Apache-2.0"
] | null | null | null | XInternetTest/_IncludeClient/PhoneDevice.h | kirainstorm/InternetofthingsServer | 3a18ccb337c5556b01ce9fb51dac35ba16182257 | [
"Apache-2.0"
] | 1 | 2020-05-28T08:32:11.000Z | 2020-05-28T08:32:11.000Z | #ifndef PHONE_DEVICE_X_456W34324
#define PHONE_DEVICE_X_456W34324
#include <stdio.h>
#include <stdlib.h>
#include "PlatformDefine.h"
#include "XStream.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/shared_array.hpp>
#include <boost/pool/pool.hpp>
#include "XDefineMediaChannelStruct.h"
#define MAX_MSG_4_PHONE_DEVICE_SESSION (1*1024*1024)
struct MyStruct4PhoneDeviceSession
{
ST_XMEDIA_HEAD head;
char buffer[MAX_MSG_4_PHONE_DEVICE_SESSION - sizeof(ST_XMEDIA_HEAD)];
};
enum emPhoneDeviceNetSendStep
{
NET_SEND_STEP_SLEEP = 0,
NET_SEND_STEP_SEND
};
class CPhoneDevice :public CXNetStreamData
{
public:
CPhoneDevice();
~CPhoneDevice();
//////////////////////////////////////////////////////////////////////////
public:
void Start();
void Stop();
void InputData(int avtype, int isKey, char * buffer, int len);
public:
virtual void OnPacketCompleteNetStreamData(int32_t bytesTransferred, emXStreamTansferKey transferKey);
private:
int LoginPlat();
void LogoutPlat();
void DoMsg();
//
BOOL m_bLogin;
BOOL m_bStreamIsError;
uint32_t m_nSession;
//
boost::pool<> m_plMsg;
//
emNetRecieveStep m_nRcvStep;
ST_XMEDIA_HEAD m_head;
int m_dataLen;
unsigned char * m_szBuffer;
//
CXNetStream* m_pTcpStream;
CrossCriticalSection m_csTcp;
list<MyStruct4PhoneDeviceSession *> m_msgList;
CrossCriticalSection m_csMsg;
//
//emPhoneDeviceNetSendStep m_nSendStep;
static int WorkerThread(void*);
void Worker();
CROSS_THREAD_HANDLE m_hWorkerThread;
BOOL m_hEvtWorkerStop;
CROSS_DWORD64 m_dTickHearbeat;
};
#endif //PHONE_DEVICE_X_456W34324
| 22.534247 | 104 | 0.716109 |
8e34c15098b9b5acab40892eb01ed8b02ef7f250 | 7,246 | swift | Swift | Tests/TripKitTests/polygon/ASPolygonKitTests.swift | skedgo/tripkit-ios | c25d9af9df42e69b4fbbd56069701b0c1844988e | [
"Apache-2.0"
] | 4 | 2018-10-22T22:16:24.000Z | 2019-10-30T23:32:30.000Z | Tests/TripKitTests/polygon/ASPolygonKitTests.swift | skedgo/tripkit-ios | c25d9af9df42e69b4fbbd56069701b0c1844988e | [
"Apache-2.0"
] | 23 | 2017-09-18T10:26:45.000Z | 2022-01-25T03:01:00.000Z | Tests/TripKitTests/polygon/ASPolygonKitTests.swift | skedgo/tripkit-ios | c25d9af9df42e69b4fbbd56069701b0c1844988e | [
"Apache-2.0"
] | 1 | 2019-06-14T13:17:31.000Z | 2019-06-14T13:17:31.000Z | //
// ASPolygonKitTests.swift
// ASPolygonKitExampleTests
//
// Created by Adrian Schoenig on 18/2/17.
// Copyright © 2017 Adrian Schönig. All rights reserved.
//
import XCTest
import MapKit
@testable import TripKit
class ASPolygonKitTests: XCTestCase {
func testAll() throws {
let polygons = try polygonsFromJSON(named: "polygons-tripgo-170217")
XCTAssertEqual(154, polygons.count)
}
func testCH() throws {
let polygons = try polygonsFromJSON(named: "polygons-ch-170224")
XCTAssertEqual(5, polygons.count)
let merged = try MKPolygon.union(polygons)
XCTAssertEqual(1, merged.count)
XCTAssertEqual(merged.first.map(Polygon.init)?.encodeCoordinates(), """
iobcHyvps@j~cAoquEhgj@jWA{AxzAnCzgD~A@hDlpb@`w@_JehAjVoheDb{xCucAjqlBtpmHo`^`zyBtrAlvzA~|IfwsArvX?{iv@htlIuj`ChvB?~P{MqPcaRpP?saVk`aDyn~DeiXoy{D`gC?
""")
}
func testUK() throws {
let polygons = try polygonsFromJSON(named: "polygons-uk-170217")
XCTAssertEqual(19, polygons.count)
let merged = try MKPolygon.union(polygons)
XCTAssertEqual(1, merged.count)
XCTAssertEqual(merged.first.map(Polygon.init)?.encodeCoordinates(), """
_aisJ~nyo@?_oyo@~nh\\??`f{@nyo@lblH~tAboL~|bKs_kN?nh\\npxD??ovmHnxtI??~s`BnnqC??~m|Qn}}B??~hsXoezG??_ry@_ulL??_ulLo{vA??~dtBoljB??~{|FkkmCrkt@zoJz|x@i_@vaAxzbCgjiAnfrB??~qy@ntfG??ppHnaoA|z`BnpxDnl{U?~hbE_c{X??cro[_msCznqH?fdS
""")
}
func testScandinavia() throws {
let polygons = try polygonsFromJSON(named: "polygons-scandinavia-170217")
XCTAssertEqual(16, polygons.count)
let merged = try MKPolygon.union(polygons)
XCTAssertEqual(1, merged.count)
XCTAssertEqual(merged.first.map(Polygon.init)?.encodeCoordinates(), """
{musLul~eCzizB}w|z@lxrGr|uD|diB~_uJd~zF{{_F|lq[cngJn`wFncpJyPvl@xdiGvtyK~yxA~olG||]l`nW`I`DiA~}DhA~y@aBi@w~E`k|P`{x@ubiA`z_G??j`mArwrFz|H?vqvE`bgClhtGnkuCnsqHnyo@~tiP_t`Boh\\odkA~wq@_{m@~tu@qrqB|juA?|ypAwapFzcn@hFf~|@_osCkF_}BcoDj|Ll_dEbiSnkkBfv{Ct~MlbLlxx\\{ftK_mEwdvD|x{@?tEcG_Cq_Cti@?}hBcv{Fsj{BempDyloH|VmfDanw^_jug@bRcxB
""")
}
func testStaya() throws {
let polygons = try polygonsFromJSON(named: "polygons-au-211102")
XCTAssertEqual(7, polygons.count)
let merged = try MKPolygon.union(polygons)
XCTAssertEqual(1, merged.count)
XCTAssertEqual(merged.first.map(Polygon.init)?.encodeCoordinates(), """
~ghgCai|h[ykhBmhuOprjAecdOfjpc@nbq@w@yBxd@w|C|fkB}hRxwzLzbyAx`bF~j{AjBjcMnrzQ??vtyK`udMhq`Bw{DbbNh`_IjqqGyKns|Mwr~BfgaFbcMpsY}~t@`ym@~{xBfl~A`J~`gRovq]?`qd@eeqBctKww\\eMkb_AlpPq~j@rn^o_d@z_k@q|H~ab@_bOaoh@iyYbMirVpeTapJlrGwvn@vcVqpo@|vc@hhCj~d@apJd~@}re@daYewB`zi@mhtAzil@wr{@xkZghNttc@yn}@w_m@mu[{oJ}oU?inX{@?ym@wkcAzzXuyiArbMykx@sbM_`~@~aW}xeA}yJcyd@c}Ij}Hw|zHswg@do@mcxLuu~K?j}@reeGeunRg`]kButH
""")
}
func testInvariantToShuffling() throws {
let polygons = try polygonsFromJSON(named: "polygons-uk-170217")
XCTAssertEqual(19, polygons.count)
let _ = try (1...100).map { _ in
let shuffled = polygons.shuffle()
let merged = try MKPolygon.union(shuffled)
XCTAssertEqual(1, merged.count)
XCTAssertEqual(merged.first.map(Polygon.init)?.encodeCoordinates(), """
_aisJ~nyo@?_oyo@~nh\\??`f{@nyo@lblH~tAboL~|bKs_kN?nh\\npxD??ovmHnxtI??~s`BnnqC??~m|Qn}}B??~hsXoezG??_ry@_ulL??_ulLo{vA??~dtBoljB??~{|FkkmCrkt@zoJz|x@i_@vaAxzbCgjiAnfrB??~qy@ntfG??ppHnaoA|z`BnpxDnl{U?~hbE_c{X??cro[_msCznqH?fdS
""")
}
}
func testOCFailure() throws {
var grower = Polygon(pairs: [ (4,0), (4,3), (1,3), (1,0) ])
let addition = Polygon(pairs: [ (5,1), (5,4), (3,4), (3,2), (2,2), (2,4), (0,4), (0,1) ])
try _ = grower.union(addition)
XCTAssertEqual(12, grower.points.count)
}
func testSinglePointFailure() throws {
var grower = Polygon(pairs: [ (53.5,-7.77), (52.15,-6.25), (51.2,-10) ])
let addition = Polygon(pairs: [ (53.4600,-7.77), (54,-10), (55,-7.77) ])
try _ = grower.union(addition)
XCTAssert(grower.points.count > 1)
}
func testPolygonContains() {
let addition = Polygon(pairs: [ (53.4600,-7.77), (54,-10), (55,-7.77) ])
XCTAssert( addition.contains(Point(ll: (53.5,-7.77)), onLine: true))
XCTAssert(!addition.contains(Point(ll: (53.5,-7.77)), onLine: false))
}
func testUnsuccessfulUnion() throws {
var grower = Polygon(pairs: [ (60.0000,-5.0000), (60.0000,0.0000), (56.2000,0.0000), (56.2000,-5.0000) ] )
let addition = Polygon(pairs: [ (56.2500,-5.0000), (56.2500,0.0000), (55.9500,-1.8500), (55.1700,-5.7700) ] )
try _ = grower.union(addition)
XCTAssert(grower.points.count > 1)
}
}
extension ASPolygonKitTests {
func polygonsFromJSON(named name: String) throws -> [MKPolygon] {
guard
let dict = try contentFromJSON(named: name) as? [String: Any],
let encodedPolygons = dict ["polygons"] as? [String]
else { preconditionFailure() }
return encodedPolygons.map { MKPolygon(encoded: $0) }
}
func contentFromJSON(named name: String) throws -> Any {
let jsonPath: URL
#if SWIFT_PACKAGE
let thisSourceFile = URL(fileURLWithPath: #file)
let thisDirectory = thisSourceFile.deletingLastPathComponent()
jsonPath = thisDirectory
.appendingPathComponent("data", isDirectory: true)
.appendingPathComponent(name).appendingPathExtension("json")
#else
let bundle = Bundle(for: ASPolygonKitTests.self)
let filePath = bundle.path(forResource: name, ofType: "json")
jsonPath = URL(fileURLWithPath: filePath!)
#endif
let data = try Data(contentsOf: jsonPath)
return try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions(rawValue: 0))
}
}
extension Collection {
/// Return a copy of `self` with its elements shuffled
func shuffle() -> [Iterator.Element] {
var list = Array(self)
list.shuffleInPlace()
return list
}
}
extension MutableCollection where Index == Int {
/// Shuffle the elements of `self` in-place.
mutating func shuffleInPlace() {
// empty and single-element collections don't shuffle
if count < 2 { return }
for i in 0..<count - 1 {
let j = Int(arc4random_uniform(UInt32(count - i))) + i
guard i != j else { continue }
swapAt(i, j)
}
}
}
extension MKPolygon {
convenience init(encoded: String) {
let coordinates = CLLocationCoordinate2D.decodePolyline(encoded)
self.init(coordinates: coordinates, count: coordinates.count)
}
}
#if os(iOS)
extension MKPolygon : CustomPlaygroundDisplayConvertible {
public var playgroundDescription: Any {
return quickLookImage ?? description
}
fileprivate var quickLookImage: UIImage? {
let options = MKMapSnapshotter.Options()
options.mapRect = self.boundingMapRect
let snapshotter = MKMapSnapshotter(options: options)
var image: UIImage?
let semaphore = DispatchSemaphore(value: 1)
snapshotter.start() { snapshot, error in
image = snapshot?.image
semaphore.signal()
}
semaphore.wait()
return image
}
public var debugQuickLookObject: Any {
return quickLookImage ?? description
}
}
#endif
| 33.238532 | 403 | 0.669749 |
3fa4d637696a022d618ae6a84a245f5fba82a16e | 1,321 | h | C | src/mqtt-core/src/dxl/SetConnectionLimitRunner.h | chrissmith-mcafee/opendxl-broker | a3f985fc19699ab8fcff726bbd1974290eb6e044 | [
"Apache-2.0",
"MIT"
] | 13 | 2017-10-15T14:32:34.000Z | 2022-02-17T08:25:26.000Z | src/mqtt-core/src/dxl/SetConnectionLimitRunner.h | vkrish-mcafee/opendxl-broker | 39c5d06c233dbe01146f0db781eccfd67bbaafbf | [
"Apache-2.0",
"MIT"
] | 14 | 2017-10-17T18:23:50.000Z | 2021-12-10T22:05:25.000Z | src/mqtt-core/src/dxl/SetConnectionLimitRunner.h | vkrish-mcafee/opendxl-broker | 39c5d06c233dbe01146f0db781eccfd67bbaafbf | [
"Apache-2.0",
"MIT"
] | 26 | 2017-10-27T00:27:29.000Z | 2021-09-02T16:57:55.000Z | /******************************************************************************
* Copyright (c) 2018 McAfee, LLC - All Rights Reserved.
*****************************************************************************/
#ifndef SETCONNECTIONLIMITRUNNER_H_
#define SETCONNECTIONLIMITRUNNER_H_
#include "MqttWorkQueue.h"
#include "logging_mosq.h"
namespace dxl {
namespace broker {
namespace core {
/**
* Sets the connection limit for the broker
*/
class SetConnectionLimitRunner : public MqttWorkQueue::Runnable
{
public:
/**
* Constructs the runner
*
* @param limit The connection limit for the broker
*/
SetConnectionLimitRunner( uint32_t limit ) : m_limit( limit )
{
if( IS_DEBUG_ENABLED )
_mosquitto_log_printf( NULL, MOSQ_LOG_DEBUG, "SetConnectionLimitRunner::SetConnectionLimitRunner()" );
};
/** Destructor */
virtual ~SetConnectionLimitRunner()
{
if( IS_DEBUG_ENABLED )
_mosquitto_log_printf( NULL, MOSQ_LOG_DEBUG, "SetConnectionLimitRunner::~SetConnectionLimitRunner()" );
}
/** {@inheritDoc} */
void run();
private:
/** The connection limit */
uint32_t m_limit;
};
} /* namespace core */
} /* namespace broker */
} /* namespace dxl */
#endif /* SETCONNECTIONLIMITRUNNER_H_ */
| 24.462963 | 119 | 0.583649 |
17160caa7a16051a910c524b35c396b390565526 | 646 | swift | Swift | Example/Git/Sources/Git/Commit.swift | atsushi130/Commandy | 7f2af91c2bee54c626cb6fdb70c1320df26699d8 | [
"MIT"
] | 1 | 2018-07-29T13:32:27.000Z | 2018-07-29T13:32:27.000Z | Example/Git/Sources/Git/Commit.swift | atsushi130/Commandy | 7f2af91c2bee54c626cb6fdb70c1320df26699d8 | [
"MIT"
] | 4 | 2018-07-29T09:33:36.000Z | 2019-03-24T10:20:58.000Z | Example/Git/Sources/Git/Commit.swift | atsushi130/Commandy | 7f2af91c2bee54c626cb6fdb70c1320df26699d8 | [
"MIT"
] | null | null | null | //
// Commit.swift
// Commandy
//
// Created by Atsushi Miyake on 2018/07/28.
//
import Commandy
enum Commit: String, Command {
case message
case allowEmpty
var shortOption: String? {
switch self {
case .message: return "m"
default: return nil
}
}
static func run() throws {
let matchOptions = Commit.matchOptions
switch matchOptions {
case _ where matchOptions[.message]:
print("git commit -m")
case _ where matchOptions[.allowEmpty, .message]:
print("git commit --allow-empty -m")
default: break
}
}
}
| 19.575758 | 57 | 0.568111 |
266a624b4372c25b0037020d3881bd8405eb69c4 | 1,048 | java | Java | src/main/java/com/github/et118/El_Macho/Events/MusicEvent.java | et118/El_Macho | 856481af6ca1f6312f2c51bf705a4360cb33fa08 | [
"MIT"
] | 1 | 2022-01-30T00:01:33.000Z | 2022-01-30T00:01:33.000Z | src/main/java/com/github/et118/El_Macho/Events/MusicEvent.java | et118/El_Macho | 856481af6ca1f6312f2c51bf705a4360cb33fa08 | [
"MIT"
] | null | null | null | src/main/java/com/github/et118/El_Macho/Events/MusicEvent.java | et118/El_Macho | 856481af6ca1f6312f2c51bf705a4360cb33fa08 | [
"MIT"
] | null | null | null | package com.github.et118.El_Macho.Events;
import com.github.et118.El_Macho.Commands.Music.MusicManager;
import discord4j.core.event.domain.guild.GuildCreateEvent;
import discord4j.core.event.domain.guild.GuildDeleteEvent;
import reactor.core.publisher.Mono;
public class MusicEvent extends Event{
public MusicEvent(EventInfo info) {
super(info);
}
@Override
public Class[] getEventSubscriptions() {
return new Class[]{GuildCreateEvent.class, GuildDeleteEvent.class};
}
@Override
public Mono<Void> execute(Class eventType, discord4j.core.event.domain.Event rawEvent) {
if(eventType.equals(GuildCreateEvent.class)) {
return MusicManager.addMusicPlayer(((GuildCreateEvent)rawEvent).getGuild());
}
if(eventType.equals(GuildDeleteEvent.class)) { //TODO Check if leaving and joining same guild multiple times messes up something
return MusicManager.removeMusicPlayer(((GuildDeleteEvent)rawEvent).getGuildId());
}
return Mono.empty();
}
}
| 36.137931 | 136 | 0.723282 |
95b4b217cf914f8bab011aba04ef2d557d42dfec | 2,797 | html | HTML | blogs/others/fortnite-building-quick-reference.html | JackRBlack/JackRBlack.github.io | 546c4e1beff1eb0f79edbc20e24ed13f8754ba13 | [
"MIT"
] | 2 | 2018-10-17T14:31:31.000Z | 2019-03-27T10:45:22.000Z | blogs/others/fortnite-building-quick-reference.html | JackRBlack/JackRBlack.github.io | 546c4e1beff1eb0f79edbc20e24ed13f8754ba13 | [
"MIT"
] | 2 | 2018-06-12T07:40:19.000Z | 2018-06-22T01:11:56.000Z | blogs/others/fortnite-building-quick-reference.html | JackRBlack/JackRBlack.github.io | 546c4e1beff1eb0f79edbc20e24ed13f8754ba13 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Blogs - Others - FortNite Building Quick Reference</title>
<!-- Bootstrap core CSS -->
<link href="../../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../../css/simple-sidebar.css" rel="stylesheet">
</head>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="../../index.html">
Home
</a>
<li>
<a href="../../blogs.html">Blogs</a>
</li>
<li>
<a href="../../about.html">About</a>
</li>
</ul>
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<!-- title -->
<h1 style="font-family:courier;">FortNite Building Quick Reference</h1>
<!-- date & author -->
<h4 style="font-family:courier;">Jun 21st, 2018 <em>Jack Black</em></h4>
<hr>
<!-- article starts here -->
<p>This reference is created by Abyssalheaven. The two images below are downloaded from his <a href="https://imgur.com/a/m20kt">imgur post</a>.</p>
<img src="../../src/blogs/fortnite-edit_A.png" alt="FortNite Building Quick Reference (page 1)" style='height: 100%; width: 100%; object-fit: contain'>
<br>
<img src="../../src/blogs/fortnite-edit_B.png" alt="FortNite Building Quick Reference (page 2)" style='height: 100%; width: 100%; object-fit: contain'>
<hr>
<p style="color:MediumSeaGreen">Written & published @Peking University, 11:45 AM (UTC+08:00)</p>
<hr>
<a href="#menu-toggle" class="btn btn-secondary" id="menu-toggle">See All Blogs</a>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
<!-- Bootstrap core JavaScript -->
<script src="../../vendor/jquery/jquery.min.js"></script>
<script src="../../vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
</body>
</html>
| 32.523256 | 167 | 0.504469 |
66a2c62fc893ad23ca9cc4e3ed9113f744b0a9d8 | 2,486 | swift | Swift | cmd-eikana/ExclusionAppsController.swift | ryanmoongit/cmd-eikana | baba7d5b0f390fc62d785ddde588f627df2b737e | [
"MIT"
] | null | null | null | cmd-eikana/ExclusionAppsController.swift | ryanmoongit/cmd-eikana | baba7d5b0f390fc62d785ddde588f627df2b737e | [
"MIT"
] | null | null | null | cmd-eikana/ExclusionAppsController.swift | ryanmoongit/cmd-eikana | baba7d5b0f390fc62d785ddde588f627df2b737e | [
"MIT"
] | null | null | null | //
// ExclusionAppsController.swift
// ⌘英かな
//
// MIT License
// Copyright (c) 2016 iMasanari
//
import Cocoa
class ExclusionAppsController: NSViewController, NSTableViewDataSource, NSTableViewDelegate {
@IBOutlet weak var tableView: NSTableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
NotificationCenter.default.addObserver(self,
selector: #selector(ExclusionAppsController.tableReload),
name: NSApplication.didBecomeActiveNotification,
object: nil)
}
func numberOfRows(in tableView: NSTableView) -> Int {
return exclusionAppsList.count + activeAppsList.count
}
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
let id = tableColumn!.identifier
let isExclusion = row < exclusionAppsList.count
if id.rawValue == "checkbox" {
return isExclusion
}
let value = isExclusion ? exclusionAppsList[row] : activeAppsList[row - exclusionAppsList.count]
if id.rawValue == "appName" {
return value.name
}
if id.rawValue == "appId" {
return value.id
}
return nil
}
func tableView(_ tableView: NSTableView, setObjectValue object: Any?, for tableColumn: NSTableColumn?, row: Int) {
let id = tableColumn!.identifier
let isExclusion = row < exclusionAppsList.count
if id.rawValue != "checkbox" {
return
}
if isExclusion {
let item = exclusionAppsList.remove(at: row)
activeAppsList.insert(item, at: 0)
}
else {
let item = activeAppsList.remove(at: row - exclusionAppsList.count)
exclusionAppsList.append(item)
}
exclusionAppsDict = [:]
for val in exclusionAppsList {
exclusionAppsDict[val.id] = val.name
}
tableReload()
saveExclusionApps()
}
@objc func tableReload() {
tableView.reloadData()
}
func saveExclusionApps() {
UserDefaults.standard.set(exclusionAppsList.map {$0.toDictionary()} , forKey: "exclusionApps")
}
}
| 29.595238 | 118 | 0.567578 |
c46e04f073e0a3d874850b6406522afee40943ab | 199 | c | C | Exercicios do URI Online Judge/media_2.c | TheMath123/exerciciosemc | 3894f0ed81ed8be4de2e2e66f012db646e6e2523 | [
"MIT"
] | null | null | null | Exercicios do URI Online Judge/media_2.c | TheMath123/exerciciosemc | 3894f0ed81ed8be4de2e2e66f012db646e6e2523 | [
"MIT"
] | null | null | null | Exercicios do URI Online Judge/media_2.c | TheMath123/exerciciosemc | 3894f0ed81ed8be4de2e2e66f012db646e6e2523 | [
"MIT"
] | null | null | null | #include <stdio.h>
int main(){
float n1,n2,n3,media;
scanf("%f %f %f",&n1,&n2,&n3);
n1=n1*2;
n2=n2*3;
n3=n3*5;
media=(n1+n2+n3)/10;
printf("MEDIA = %.1f\n",media);
return 0;
}
| 14.214286 | 33 | 0.522613 |
db5d14edaef487a6d3029eff1722332a996ebbab | 37 | sql | SQL | migrations/mysql/000003_flavor_stash.down.sql | jeradM/everyflavor-api | 185313c0d32e30e8556260c98d20453aa20e7802 | [
"MIT"
] | null | null | null | migrations/mysql/000003_flavor_stash.down.sql | jeradM/everyflavor-api | 185313c0d32e30e8556260c98d20453aa20e7802 | [
"MIT"
] | null | null | null | migrations/mysql/000003_flavor_stash.down.sql | jeradM/everyflavor-api | 185313c0d32e30e8556260c98d20453aa20e7802 | [
"MIT"
] | null | null | null | DROP TABLE IF EXISTS flavor_stashes;
| 18.5 | 36 | 0.837838 |
16942960c2bf97a65eaebb940e0f1b128faba8d5 | 1,981 | h | C | engines/ep/src/conflict_resolution.h | BenHuddleston/kv_engine | 78123c9aa2c2feb24b7c31eecc862bf2ed6325e4 | [
"MIT",
"BSD-3-Clause"
] | 104 | 2017-05-22T20:41:57.000Z | 2022-03-24T00:18:34.000Z | engines/ep/src/conflict_resolution.h | BenHuddleston/kv_engine | 78123c9aa2c2feb24b7c31eecc862bf2ed6325e4 | [
"MIT",
"BSD-3-Clause"
] | 3 | 2017-11-14T08:12:46.000Z | 2022-03-03T11:14:17.000Z | engines/ep/src/conflict_resolution.h | BenHuddleston/kv_engine | 78123c9aa2c2feb24b7c31eecc862bf2ed6325e4 | [
"MIT",
"BSD-3-Clause"
] | 71 | 2017-05-22T20:41:59.000Z | 2022-03-29T10:34:32.000Z | /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2013-Present Couchbase, Inc.
*
* Use of this software is governed by the Business Source License included
* in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
* in that file, in accordance with the Business Source License, use of this
* software will be governed by the Apache License, Version 2.0, included in
* the file licenses/APL2.txt.
*/
#pragma once
#include <mcbp/protocol/datatype.h>
class ItemMetaData;
class StoredValue;
/**
* An abstract class for doing conflict resolution for documents sent from
* different datacenters.
*/
class ConflictResolution {
public:
ConflictResolution() {}
virtual ~ConflictResolution() {}
/**
* Resolves a conflict between two documents.
*
* @param v the local document meta data
* @param meta the remote document's meta data
* @param meta_dataype datatype of remote document
* @param isDelete the flag indicating if conflict resolution is
* for delete operations
* @return true is the remote document is the winner, false otherwise
*/
virtual bool resolve(const StoredValue& v,
const ItemMetaData& meta,
const protocol_binary_datatype_t meta_datatype,
bool isDelete = false) const = 0;
};
class RevisionSeqnoResolution : public ConflictResolution {
public:
bool resolve(const StoredValue& v,
const ItemMetaData& meta,
const protocol_binary_datatype_t meta_datatype,
bool isDelete = false) const override;
};
class LastWriteWinsResolution : public ConflictResolution {
public:
bool resolve(const StoredValue& v,
const ItemMetaData& meta,
const protocol_binary_datatype_t meta_datatype,
bool isDelete = false) const override;
};
| 33.016667 | 79 | 0.661787 |
43735adc9bc043caa07fa1409330312c1b79ce5d | 324 | go | Go | pkg/yogoa/unit.go | lovefcaaa/yogoa | 78796720fd6a1a642f66e87be20e2afe0b7f0b17 | [
"Apache-2.0"
] | 4 | 2018-10-03T22:13:45.000Z | 2021-02-01T13:37:35.000Z | pkg/yogoa/unit.go | lovefcaaa/yogoa | 78796720fd6a1a642f66e87be20e2afe0b7f0b17 | [
"Apache-2.0"
] | 2 | 2020-12-02T01:29:30.000Z | 2021-05-20T20:54:24.000Z | pkg/yogoa/unit.go | lovefcaaa/yogoa | 78796720fd6a1a642f66e87be20e2afe0b7f0b17 | [
"Apache-2.0"
] | 1 | 2020-10-16T07:34:54.000Z | 2020-10-16T07:34:54.000Z | package yogoa
import "github.com/jackwakefield/yogoa/pkg/yoga"
type Unit int32
const (
UnitUndefined = Unit(yoga.UnitUndefined)
UnitPoint = Unit(yoga.UnitPoint)
UnitPercent = Unit(yoga.UnitPercent)
UnitAuto = Unit(yoga.UnitAuto)
)
func (u Unit) String() string {
return yoga.UnitToString(yoga.Unit(u))
}
| 19.058824 | 48 | 0.728395 |
4123b942dd780e90d455276d52e288bd2a00f62a | 848 | h | C | filterdesigner.h | aliihsancengiz/FirFilterDesigner | 64aec54ae19e86df099f225805cbc68da3163d47 | [
"MIT"
] | 1 | 2020-12-10T13:35:42.000Z | 2020-12-10T13:35:42.000Z | filterdesigner.h | aliihsancengiz/FirFilterDesigner | 64aec54ae19e86df099f225805cbc68da3163d47 | [
"MIT"
] | null | null | null | filterdesigner.h | aliihsancengiz/FirFilterDesigner | 64aec54ae19e86df099f225805cbc68da3163d47 | [
"MIT"
] | null | null | null | #ifndef FILTERDESIGNER_H
#define FILTERDESIGNER_H
#include <QMainWindow>
#include <QDebug>
#include <QtMath>
#include <QFileDialog>
#include <algorithm>
#include <numeric>
#include <fstream>
#include "fft/FFTReal.h"
#include "qcustomplot.h"
#include "windowfunction.h"
#include "filtercoeffgenrator.h"
QT_BEGIN_NAMESPACE
namespace Ui { class FilterDesigner; }
QT_END_NAMESPACE
class FilterDesigner : public QMainWindow
{
Q_OBJECT
public:
FilterDesigner(QWidget *parent = nullptr);
~FilterDesigner();
private slots:
void on_DesignButton_clicked();
void on_pushButton_clicked();
private:
Ui::FilterDesigner *ui;
QVector<double> coeff,window;
WindowFunction mWindowDesigner;
FilterCoeffGenrator mCoeffGenerator;
void performFilterBuilding();
bool isDesigned=false;
};
#endif // FILTERDESIGNER_H
| 18.042553 | 46 | 0.753538 |
c67324734cd5d142015db9699493c89da4c7d43b | 526 | kt | Kotlin | app/src/main/java/com/roverdream/kothub/ui/list/RepoViewModel.kt | ngominhtrint/Kothub | 25a2012cad7fcdd693e03eedf29a26df04c52126 | [
"Apache-2.0"
] | 1 | 2020-05-16T20:29:40.000Z | 2020-05-16T20:29:40.000Z | app/src/main/java/com/roverdream/kothub/ui/list/RepoViewModel.kt | ngominhtrint/Kothub | 25a2012cad7fcdd693e03eedf29a26df04c52126 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/roverdream/kothub/ui/list/RepoViewModel.kt | ngominhtrint/Kothub | 25a2012cad7fcdd693e03eedf29a26df04c52126 | [
"Apache-2.0"
] | null | null | null | package com.roverdream.kothub.ui.list
import com.roverdream.kothub.data.remote.model.Repo
import com.roverdream.kothub.ui.base.AbstractViewModel
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
class RepoViewModel(val repo: Repo) : AbstractViewModel() {
private val clicks = PublishSubject.create<Unit>()
fun getName() = repo.fullName
fun getDescription() = repo.description
fun onClick() {
clicks.onNext(Unit)
}
fun clicks(): Observable<Unit> = clicks.hide()
} | 25.047619 | 59 | 0.739544 |
a18a4208f71fcefc82ac638e91668bd33143aa65 | 5,943 | h | C | linux/libs/common/var.h | cassioberni/Inex_linux | 12eca26304ac5e57cf75a59d29412782b868bd04 | [
"MIT"
] | null | null | null | linux/libs/common/var.h | cassioberni/Inex_linux | 12eca26304ac5e57cf75a59d29412782b868bd04 | [
"MIT"
] | null | null | null | linux/libs/common/var.h | cassioberni/Inex_linux | 12eca26304ac5e57cf75a59d29412782b868bd04 | [
"MIT"
] | null | null | null | #ifndef VAR_H_
#define VAR_H_
//****************************************
union unsigned_char
{
struct //char_1
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
};
//-----
struct //char_2
{
unsigned char bit1_0:2;
unsigned char bit3_2:2;
unsigned char bit5_4:2;
unsigned char bit7_6:2;
};
//-----
struct //char_3
{
unsigned char bit3_0:4;
unsigned char bit7_4:4;
};
//-----
struct //char_4
{
unsigned char nibble0:4;
unsigned char nibble1:4;
};
//-----
struct //char_5
{
unsigned char nibble_low:4;
unsigned char nibble_high:4;
};
//-----
struct //char_6
{
unsigned char value;
};
//-----
struct //char_7
{
unsigned char uc;
};
//-----
struct //char_8
{
unsigned char byte;
};
struct
{
unsigned char bits;
};
};
//*********************************
union unsigned_int
{
struct //int_1
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
unsigned char bit8:1;
unsigned char bit9:1;
unsigned char bit10:1;
unsigned char bit11:1;
unsigned char bit12:1;
unsigned char bit13:1;
unsigned char bit14:1;
unsigned char bit15:1;
};
//-----
struct //int_2
{
unsigned char bit1_0:2;
unsigned char bit3_2:2;
unsigned char bit5_4:2;
unsigned char bit7_6:2;
unsigned char bit9_8:2;
unsigned char bit11_10:2;
unsigned char bit13_12:2;
unsigned char bit15_14:2;
};
//-----
struct //int_3
{
unsigned char bit3_0:4;
unsigned char bit7_4:4;
unsigned char bit11_8:4;
unsigned char bit15_12:4;
};
//-----
struct //int_4
{
unsigned char nibble0:4;
unsigned char nibble1:4;
unsigned char nibble2:4;
unsigned char nibble3:4;
};
//-----
struct //int_9
{
unsigned char uc0;
unsigned char uc1;
};
//-----
struct //int_10
{
unsigned char uc_low;
unsigned char uc_high;
};
//-----
struct //int_11
{
unsigned char uc[2];
};
//-----
struct //int_12
{
unsigned char byte0;
unsigned char byte1;
};
//-----
struct //int_13
{
unsigned char byte_low;
unsigned char byte_high;
};
//-----
struct //int_14
{
unsigned char byte[2];
};
//-----
struct //int_15
{
unsigned int value;
};
//-----
struct //int_16
{
unsigned int ui;
};
//-----
struct //int_17
{
unsigned int word;
};
};
//*********************************
union unsigned_long
{
struct //long_1
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
unsigned char bit8:1;
unsigned char bit9:1;
unsigned char bit10:1;
unsigned char bit11:1;
unsigned char bit12:1;
unsigned char bit13:1;
unsigned char bit14:1;
unsigned char bit15:1;
unsigned char bit16:1;
unsigned char bit17:1;
unsigned char bit18:1;
unsigned char bit19:1;
unsigned char bit20:1;
unsigned char bit21:1;
unsigned char bit22:1;
unsigned char bit23:1;
unsigned char bit24:1;
unsigned char bit25:1;
unsigned char bit26:1;
unsigned char bit27:1;
unsigned char bit28:1;
unsigned char bit29:1;
unsigned char bit30:1;
unsigned char bit31:1;
};
//-----
struct //long_2
{
unsigned char bit1_0:2;
unsigned char bit3_2:2;
unsigned char bit5_4:2;
unsigned char bit7_6:2;
unsigned char bit9_8:2;
unsigned char bit11_10:2;
unsigned char bit13_12:2;
unsigned char bit15_14:2;
unsigned char bit17_16:2;
unsigned char bit19_18:2;
unsigned char bit21_20:2;
unsigned char bit23_22:2;
unsigned char bit25_24:2;
unsigned char bit27_26:2;
unsigned char bit29_28:2;
unsigned char bit31_30:2;
};
//-----
struct //long_3
{
unsigned char bit3_0:4;
unsigned char bit7_4:4;
unsigned char bit11_8:4;
unsigned char bit15_12:4;
unsigned char bit19_16:4;
unsigned char bit23_20:4;
unsigned char bit27_24:4;
unsigned char bit31_28:4;
};
//-----
struct //long_4
{
unsigned char nibble0:4;
unsigned char nibble1:4;
unsigned char nibble2:4;
unsigned char nibble3:4;
unsigned char nibble4:4;
unsigned char nibble5:4;
unsigned char nibble6:4;
unsigned char nibble7:4;
};
//-----
struct //long_9
{
unsigned char uc0;
unsigned char uc1;
unsigned char uc2;
unsigned char uc3;
};
//-----
struct //long_10
{
unsigned char uc_low;
unsigned char uc_high;
unsigned char uc_medium;
unsigned char uc_upper;
};
//-----
struct //long_11
{
};
//-----
struct //long_12
{
unsigned char byte0;
unsigned char byte1;
unsigned char byte2;
unsigned char byte3;
};
//-----
struct //long_13
{
unsigned char byte_low;
unsigned char byte_high;
unsigned char byte_medium;
unsigned char byte_upper;
};
//-----
struct //long_14
{
unsigned char byte[4];
};
//-----
struct //long_18
{
unsigned int ui0;
unsigned int ui1;
};
//-----
struct //long_19
{
unsigned int ui_low;
unsigned int ui_high;
};
//-----
struct //long_20
{
unsigned int ui[2];
};
//-----
struct //long_21
{
unsigned int word0;
unsigned int word1;
};
//-----
struct //long_22
{
unsigned int word_low;
unsigned int word_high;
};
//-----
struct //long_23
{
unsigned int word[2];
};
//-----
struct //long_24
{
unsigned long value;
};
//-----
struct //long_25
{
unsigned long ul;
};
//-----
struct //long_26
{
unsigned long dword;
};
};
#endif /* VAR_H_ */
| 17.377193 | 43 | 0.594313 |
9f00bccc6fea05455c64011efea96e762b4d1fd4 | 1,921 | go | Go | internal/databases/postgres/pg_control_data.go | igorwwwwwwwwwwwwwwwwwwww/wal-g | 5292dd8cf6c1eb504f9a7152bc5a1b1efb87cc51 | [
"Apache-2.0"
] | null | null | null | internal/databases/postgres/pg_control_data.go | igorwwwwwwwwwwwwwwwwwwww/wal-g | 5292dd8cf6c1eb504f9a7152bc5a1b1efb87cc51 | [
"Apache-2.0"
] | 3 | 2017-07-19T22:42:10.000Z | 2017-08-10T21:42:18.000Z | internal/databases/postgres/pg_control_data.go | igorwwwwwwwwwwwwwwwwwwww/wal-g | 5292dd8cf6c1eb504f9a7152bc5a1b1efb87cc51 | [
"Apache-2.0"
] | null | null | null | package postgres
import (
"encoding/binary"
"io"
"os"
"path"
"github.com/wal-g/tracelog"
)
const pgControlSize = 8192
// PgControlData represents data contained in pg_control file
type PgControlData struct {
systemIdentifier uint64 // systemIdentifier represents system ID of PG cluster (f.e. [0-8] bytes in pg_control)
currentTimeline uint32 // currentTimeline represents current timeline of PG cluster (f.e. [48-52] bytes in pg_control v. 1100+)
// Any data from pg_control
}
// ExtractPgControl extract pg_control data of cluster by storage
func ExtractPgControl(folder string) (*PgControlData, error) {
pgControlReadCloser, err := os.Open(path.Join(folder, PgControlPath))
if err != nil {
return nil, err
}
result, err := extractPgControlData(pgControlReadCloser)
if err != nil {
closeErr := pgControlReadCloser.Close()
tracelog.WarningLogger.Printf("Error on closing pg_control file: %v\n", closeErr)
return nil, err
}
err = pgControlReadCloser.Close()
if err != nil {
return nil, err
}
return result, nil
}
func extractPgControlData(pgControlReader io.Reader) (*PgControlData, error) {
bytes := make([]byte, pgControlSize)
_, err := io.ReadAtLeast(pgControlReader, bytes, pgControlSize)
if err != nil {
return nil, err
}
systemID := binary.LittleEndian.Uint64(bytes[0:8])
pgControlVersion := binary.LittleEndian.Uint32(bytes[8:12])
currentTimeline := uint32(0)
if pgControlVersion < 1100 {
currentTimeline = binary.LittleEndian.Uint32(bytes[56:60])
} else {
currentTimeline = binary.LittleEndian.Uint32(bytes[48:52])
}
// Parse bytes from pg_control file and share this data
return &PgControlData{
systemIdentifier: systemID,
currentTimeline: currentTimeline,
}, nil
}
func (data *PgControlData) GetSystemIdentifier() uint64 {
return data.systemIdentifier
}
func (data *PgControlData) GetCurrentTimeline() uint32 {
return data.currentTimeline
}
| 25.613333 | 129 | 0.744925 |
9d3a456c6da094b63549d8b5cd87e415a27671d5 | 5,758 | html | HTML | user_guide/installation/upgrade_b11.html | virgenherrera/DescubreTapalpa1 | 06e590e87b00cb9837501f55e6fa343f1cf29fa3 | [
"MIT"
] | null | null | null | user_guide/installation/upgrade_b11.html | virgenherrera/DescubreTapalpa1 | 06e590e87b00cb9837501f55e6fa343f1cf29fa3 | [
"MIT"
] | 1 | 2019-06-02T10:56:16.000Z | 2019-06-02T10:56:16.000Z | user_guide/installation/upgrade_b11.html | virgenherrera/DescubreTapalpa1 | 06e590e87b00cb9837501f55e6fa343f1cf29fa3 | [
"MIT"
] | null | null | null | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Guía de Usuario del CodeIgniter</title>
<style type='text/css' media='all'>@import url('../userguide.css');</style>
<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
<script type="text/javascript" src="../nav/nav.js"></script>
<script type="text/javascript" src="../nav/prototype.lite.js"></script>
<script type="text/javascript" src="../nav/moo.fx.js"></script>
<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
<meta http-equiv='expires' content='-1' />
<meta http-equiv= 'pragma' content='no-cache' />
<meta name='robots' content='all' />
<meta name='author' content='ExpressionEngine Dev Team' />
<meta name='description' content='Guía de Usuario del CodeIgniter' />
</head>
<body>
<!-- START NAVIGATION -->
<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Mostrar Tabla de Contenido" alt="Mostrar Tabla de Contenido" /></a></div>
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><h1>Guía del Usuario de CodeIgniter Versión 2.1.3</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Tabla de Contenido</a></td>
</tr>
</table>
</div>
<!-- END NAVIGATION -->
<!-- START BREADCRUMB -->
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td id="breadcrumb">
<a href="http://codeigniter.com/">CodeIgniter</a> ›
<a href="../index.html">Guía del Usuario</a> ›
Actualizar de Beta 1.0 to Beta 1.1
</td>
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="escodeigniter.com/guia_usuario/" />Buscar en la Guía del Usuario <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" /> <input type="submit" class="submit" name="sa" value="Go" /></form></td>
</tr>
</table>
<!-- END BREADCRUMB -->
<br clear="all" />
<!-- START CONTENT -->
<div id="content"><h1>Actualizar de Beta 1.0 to Beta 1.1</h1>
<p>Para actualizar a Beta 1.1 por favor realice los siguientes pasos:</p>
<h2>Paso 1: Reemplace su archivo índice</h2>
<p>Remplace su archivo principal <kbd>index.php</kbd> con el nuevo archivo index.php. Nota: Si ha renombrado la carpeta "system" necesitará editar esta información en el nuevo archivo.</p>
<h2>Paso 2: Reubique la carpeta de configuración</h2>
<p>Esta versión de CodeIgniter ahora le permite a múltiples juegos de "applicaciones" compartir el juego de archivos comunes. Para permitir
a cada aplicación tener sus valores de configuración propios, el directorio <kbd>config</kbd> debe residir dentro de la carpeta <dfn>application</dfn>, así que por favor muévalo aquí.</p>
<h2>Paso 3: Remplace directorios</h2>
<p>Remplace los siguientes directorios con las nuevas versiones:</p>
<ul>
<li>drivers</li>
<li>helpers</li>
<li>init</li>
<li>libraries</li>
<li>scaffolding</li>
</ul>
<h2>Paso 4: Agregue el archivo de lenguaje de calendario</h2>
<p>Hay un nuevo archivo de lenguaje correspondiente a la nueva clase de calendario la cual debe ser agregado a la carpeta de lenguaje. Agregue el siguiente item a tu versión: <dfn>language/english/calendar_lang.php</dfn></p>
<h2>Paso 5: Edite su archivo de configuración</h2>
<p>El archivo original <kbd>application/config/config.php</kbd> tiene un error tipográfico en él. Abra el archivo y mire los items relacionados a las cookies:</p>
<code>$conf['cookie_prefix'] = "";<br />
$conf['cookie_domain'] = "";<br />
$conf['cookie_path'] = "/";</code>
<p>Cambie el nombre del arreglo de <kbd>$conf</kbd> a <kbd>$config</kbd>, así:</p>
<code>$config['cookie_prefix'] = "";<br />
$config['cookie_domain'] = "";<br />
$config['cookie_path'] = "/";</code>
<p>Por último, agregue los siguientes items al archivo de configuración (y edite la opcion si necesita):</p>
<code><br />
/*<br />
|------------------------------------------------<br />
| URI PROTOCOL<br />
|------------------------------------------------<br />
|<br />
| This item determines which server global <br />
| should be used to retrieve the URI string. The <br />
| default setting of "auto" works for most servers.<br />
| If your links do not seem to work, try one of <br />
| the other delicious flavors:<br />
| <br />
| 'auto' Default - auto detects<br />
| 'path_info' Uses the PATH_INFO <br />
| 'query_string' Uses the QUERY_STRING<br />
*/<br />
<br />
$config['uri_protocol'] = "auto";</code>
</div>
<!-- END CONTENT -->
<div id="footer">
<p>
Tema anterior: <a href="index.html">Instrucciones de Instalacións</a>
·
<a href="#top">Subir</a> ·
<a href="../index.html">Guía del Usuario</a> ·
Próximo tema: <a href="troubleshooting.html">Solución de Problemas</a>
</p>
<p><a href="http://codeigniter.com">CodeIgniter</a> · Copyright © 2006 - 2012 · <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
</div>
</body>
</html> | 48.79661 | 406 | 0.678361 |
2871b5f025e8df7416eb25327d482022d3425faa | 3,046 | swift | Swift | Aurora/AppDelegate.swift | barrymcandrews/aurora-ios | 7b472dbb739bc995664ef82944ee5af6c4abe2fe | [
"BSD-2-Clause"
] | null | null | null | Aurora/AppDelegate.swift | barrymcandrews/aurora-ios | 7b472dbb739bc995664ef82944ee5af6c4abe2fe | [
"BSD-2-Clause"
] | null | null | null | Aurora/AppDelegate.swift | barrymcandrews/aurora-ios | 7b472dbb739bc995664ef82944ee5af6c4abe2fe | [
"BSD-2-Clause"
] | null | null | null | //
// AppDelegate.swift
// Aurora
//
// Created by Barry McAndrews on 3/23/17.
// Copyright © 2017 Barry McAndrews. All rights reserved.
//
let DEBUG = false
import UIKit
import AuroraCore
import Alamofire
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if let hostname = UserDefaults.standard.string(forKey: "lastHostname"), let port = UserDefaults.standard.string(forKey: "lastPort") {
Request.hostname = hostname
Request.port = port
}
print("Loaded?: \(RequestContainer.loadRequests())")
WatchSessionManager.shared.startSession()
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
print("Saved?: \(RequestContainer.saveRequests())")
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
print("Loaded?: \(RequestContainer.loadRequests())")
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
print("Saved?: \(RequestContainer.saveRequests())")
}
func application(_ application: UIApplication, handleWatchKitExtensionRequest userInfo: [AnyHashable : Any]?, reply: @escaping ([AnyHashable : Any]?) -> Void) {
reply(["Requests": RequestContainer.shared.requests,
"hostname": Request.hostname,
"port": Request.port
])
}
}
| 44.144928 | 285 | 0.714051 |