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
2d49a1b7e15a37ba05606dd58322a0c712ff7505
1,623
css
CSS
main.css
davidpoore/random-wiki-articles
011be7f6f4f633fcee343573a942ed26b227ab0f
[ "Unlicense" ]
null
null
null
main.css
davidpoore/random-wiki-articles
011be7f6f4f633fcee343573a942ed26b227ab0f
[ "Unlicense" ]
null
null
null
main.css
davidpoore/random-wiki-articles
011be7f6f4f633fcee343573a942ed26b227ab0f
[ "Unlicense" ]
null
null
null
body { background-color: #bbb; } .Title { text-align: center; font-size: 30px; padding: 10px 0 20px 0; font-weight: bold; margin: 0 auto; } .RandomArticles, .RandomImages { font-size: 16px; position: absolute; top: 20px; right: 20px; } .Controls { text-align: center; } .Controls__numberInput--error { border: 1px darkred solid; } .Controls__errorMessage { display: none; color: darkred; font-size: 12px; margin-top: 5px; } .Articles { width: 1000px; margin: auto; margin-top: 40px; display: flex; flex-wrap: wrap; } .Article { width: 430px; display: inline-flex; flex-direction: column; margin: 20px 5px; vertical-align: top; padding: 15px 30px; font-size: 14px; background-color: #eee; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .Article__titleSection { display: flex; } .Article__title { font-size: 18px; font-weight: bold; flex: 1 0 auto; max-width: 80%; } .Article__link { font-size: 12px; flex: 0 1 auto; } .Article__summary { padding: 12px 0px; max-height: 300px; overflow: auto; } .Article__categories { text-align: left; margin-top: 15px; flex: 1 0 auto; } .Article__categories ul { list-style: none; font-size: 12px; padding-left: 10px; margin-top: 5px; } .Article__categoriesTitle { font-size: 16px; } .Article__noCategories { font-style: italic; margin-top: 15px; } .MainImageContainer { text-align: center; width: 80%; margin: auto; } .MainImageContainer__image { display: block; max-width: 100%; margin: 10px auto; border: 2px solid black; }
14.236842
31
0.664202
2d0a4c568075204823a6a0e36786944ee40c5aae
618
css
CSS
style.css
c99koder/exist-tag-mood-score
2ded4666f28b52f82a89a8830a77f35c47000281
[ "Apache-2.0" ]
null
null
null
style.css
c99koder/exist-tag-mood-score
2ded4666f28b52f82a89a8830a77f35c47000281
[ "Apache-2.0" ]
null
null
null
style.css
c99koder/exist-tag-mood-score
2ded4666f28b52f82a89a8830a77f35c47000281
[ "Apache-2.0" ]
null
null
null
body { --mdc-theme-primary: #017cb1; --mdc-theme-secondary: #017cb1; margin: 0; } .mdc-form-field { width: 300px; } .mdc-text-field { background-color: transparent !important; } .mdc-text-field--focused { background-color: transparent !important; } .mdc-form-field label { text-transform: capitalize; } .mdc-floating-label--float-above { color: #017cb1 !important; } .score1 { color: #DF3E3E; } .score2 { color: #DF953E; } .score3 { color: #B1D020; } .score4 { color: #68DB36; } .score5 { color: #00B50C; } .positive { background-color: #00B50C; } .negative { background-color: #DF3E3E; }
15.073171
43
0.658576
1abc05173a9d61e694136033106eb349d0c9ef6d
1,745
py
Python
kh_site/group_coaching/migrations/0004_auto_20171226_0914.py
nhuntwalker/kyeisha-site
ccccc4a277f354a5f64c38476885a499483f80fc
[ "MIT" ]
null
null
null
kh_site/group_coaching/migrations/0004_auto_20171226_0914.py
nhuntwalker/kyeisha-site
ccccc4a277f354a5f64c38476885a499483f80fc
[ "MIT" ]
7
2020-06-05T18:51:41.000Z
2022-03-11T23:28:14.000Z
kh_site/group_coaching/migrations/0004_auto_20171226_0914.py
nhuntwalker/kyeisha-site
ccccc4a277f354a5f64c38476885a499483f80fc
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-12-26 09:14 from __future__ import unicode_literals from django.db import migrations import redactor.fields class Migration(migrations.Migration): dependencies = [ ('group_coaching', '0003_auto_20171225_1144'), ] operations = [ migrations.AlterField( model_name='coachingevent', name='logistics', field=redactor.fields.RedactorField(default='<ul>\n <li><p>8 group sessions total</p></li>\n <li><p>Weekly “office hours” (TBD in the new year) over the phone where I’m available for troubleshooting, Q&A, and check-ins</p></li>\n <li><p>Formation of daily self-care practice-exercises (Monday through Friday) to help you stay focused, build momentum, and move forward throughout the week</p></li>\n <li><p>Tailored invitations to work on between sessions to help you get stronger and more free</p></li>\n</ul>'), ), migrations.AlterField( model_name='coachingevent', name='outline', field=redactor.fields.RedactorField(default='<ul>\n <li><p>Session 1 &amp; 2 - Liberate our minds by understanding and REMOVING the negative effects of historical and individual trauma.</p></li>\n\n <li><p>Session 3 &amp; 4 Understand your current self-care practices and design ones that support you in developing you ideal self.</p></li>\n\n <li><p>Session 5 &amp; 6 Clarify your values and beliefs (including the limiting ones) in order to begin living an intentional, joy filled life.</p></li>\n\n <li><p>Session 7 &amp; 8 - Begin designing life goals in order to crate clarity, purpose and restore passion.</p></li>\n </ul>'), ), ]
64.62963
667
0.674499
e86263460d4599a6f6d82b3fb5d2326d013523ac
840
asm
Assembly
programs/oeis/147/A147991.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/147/A147991.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/147/A147991.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A147991: Sequence S such that 1 is in S and if x is in S, then 3x-1 and 3x+1 are in S. ; 1,2,4,5,7,11,13,14,16,20,22,32,34,38,40,41,43,47,49,59,61,65,67,95,97,101,103,113,115,119,121,122,124,128,130,140,142,146,148,176,178,182,184,194,196,200,202,284,286,290,292,302,304,308,310,338,340,344,346,356,358,362,364,365,367,371,373,383,385,389,391,419,421,425,427,437,439,443,445,527,529,533,535,545,547,551,553,581,583,587,589,599,601,605,607,851,853,857,859,869 mov $2,$0 add $2,1 mov $4,$0 lpb $2 mov $0,$4 sub $2,1 sub $0,$2 seq $0,80940 ; Smallest proper divisor of n which is a suffix of n in binary representation; a(n) = 0 if no such divisor exists. seq $0,191106 ; Increasing sequence generated by these rules: a(1)=1, and if x is in a then 3x-2 and 3x are in a. mov $3,$0 div $3,2 add $3,1 add $1,$3 lpe mov $0,$1
44.210526
371
0.677381
a38774ac29a9fd97005c5903bbff13e22b11737f
278
java
Java
src/main/java/com/artezio/forms/formio/exceptions/NodeJsException.java
Artezio/camunda-formio
084999e5f358b34c0335ae89361f4b707f716dda
[ "Apache-2.0" ]
3
2020-07-26T06:29:32.000Z
2020-08-19T14:27:19.000Z
src/main/java/com/artezio/forms/formio/exceptions/NodeJsException.java
Artezio/camunda-formio
084999e5f358b34c0335ae89361f4b707f716dda
[ "Apache-2.0" ]
6
2020-08-19T14:27:16.000Z
2022-01-22T11:59:31.000Z
src/main/java/com/artezio/forms/formio/exceptions/NodeJsException.java
Artezio/camunda-formio
084999e5f358b34c0335ae89361f4b707f716dda
[ "Apache-2.0" ]
2
2020-04-14T15:23:20.000Z
2021-01-20T15:46:30.000Z
package com.artezio.forms.formio.exceptions; public class NodeJsException extends RuntimeException { public NodeJsException(String message, Throwable cause) { super(message, cause); } public NodeJsException(String message) { super(message); } }
25.272727
61
0.71223
cdcb42fddc5e151d198c4eddac471677daea8689
1,104
cs
C#
Source/Miio.Devices/Implementations/Yeelight/IYeelightDevice.cs
Koli96/Miio.NET
519d4f51f1e85c53e49f061e4dd79a6497f9fda9
[ "MIT" ]
6
2020-09-30T20:50:23.000Z
2022-03-10T08:50:42.000Z
Source/Miio.Devices/Implementations/Yeelight/IYeelightDevice.cs
Koli96/Miio.NET
519d4f51f1e85c53e49f061e4dd79a6497f9fda9
[ "MIT" ]
null
null
null
Source/Miio.Devices/Implementations/Yeelight/IYeelightDevice.cs
Koli96/Miio.NET
519d4f51f1e85c53e49f061e4dd79a6497f9fda9
[ "MIT" ]
null
null
null
using Miio.Devices.Models; using System.Threading.Tasks; namespace Miio.Devices.Implementations.Yeelight { public interface IYeelightDevice : ISmartDevice { Task<Response> TurnOnSmoothly(uint duration); Task<Response> TurnOffSmoothly(uint duration); Task<Response> SwitchMode(Mode mode); Task<Response> SwitchMode(Mode mode, uint duration); Task<Response> SetBrightness(ushort value); Task<Response> SetBrightness(ushort value, uint duration); Task<Response> SetColorTemperature(uint temperature); Task<Response> SetColorTemperature(uint temperature, uint duration); Task<Response> SetHSVColor(ushort hue, ushort saturation); Task<Response> SetHSVColor(ushort hue, ushort saturation, uint duration); Task<Response> SetRGBColor(ushort red, ushort green, ushort blue, uint duration); Task<(ushort red, ushort green, ushort blue)> GetCurrentRGBColor(); Task<(ushort hue, ushort saturation)> GetCurrentHSVColor(); Task<int> GetBrightness(); Task<Mode> GetCurrentMode(); } }
44.16
89
0.709239
8ec4f13c63c2bea17b2bb9d3adabe14377aca69b
8,974
js
JavaScript
js/editor/ui/textures-view.js
Korshunov-Egor/thing-editor
c6af432ef5d848ded8c5edb4e189cd777b83515d
[ "MIT" ]
null
null
null
js/editor/ui/textures-view.js
Korshunov-Egor/thing-editor
c6af432ef5d848ded8c5edb4e189cd777b83515d
[ "MIT" ]
null
null
null
js/editor/ui/textures-view.js
Korshunov-Egor/thing-editor
c6af432ef5d848ded8c5edb4e189cd777b83515d
[ "MIT" ]
null
null
null
import Lib from "thing-editor/js/engine/lib.js"; import group from "./group.js"; import Window from "./window.js"; import SelectEditor from "./props-editor/select-editor.js"; import game from "thing-editor/js/engine/game.js"; import {upload} from "./props-editor/uploadFile.js"; /*loading bits 1 - on demand 2 - early precache */ const FILTER_ALL = 1000; const DEFAULT_LOADING = 1001; let view; const LOADING_TYPES = [ { name:'default', value:1001 }, { name:'On Demand', value: 1 }, { name:'Early Precache', value: 2 } ]; const FILTER_SELECT = LOADING_TYPES.slice(); FILTER_SELECT.unshift({ name: 'All', value: FILTER_ALL }); let labelProps = { className: 'selectable-text', title: 'Ctrl+click to copy texture`s name', onMouseDown: window.copyTextByClick }; const isParentFolderPropsDefined = (path) => { for(let f in editor.projectDesc.__loadOnDemandTexturesFolders) { if(path.startsWith(f + '/')) { return editor.projectDesc.__loadOnDemandTexturesFolders[f]; } } }; export default class TexturesView extends React.Component { static refresh() { if(view) { view.forceUpdate(); } } constructor(props) { super(props); this.state = {}; this.onToggleClick = this.onToggleClick.bind(this); } onToggleClick() { let t = !this.state.toggled; this.setState({ toggled: t }); } static applyFoldersPropsToAllImages() { let opt = editor.projectDesc.loadOnDemandTextures; for(let i of Lib.__texturesList) { let name = i.value; let folderProps = isParentFolderPropsDefined(name); if(folderProps && (opt[name] != folderProps)) { opt[name] = folderProps; editor.saveProjectDesc(); } } } render() { let btn = R.btn(this.state.toggled ? 'Close Textures Viewer (Ctrl+I)' : 'Open Textures Viewer (Ctrl+I)', this.onToggleClick, undefined, 'menu-btn', 1073); let table; if (this.state.toggled) { table = editor.ui.renderWindow('texturesviewer', 'Textures', 'Textures Viewer', R.fragment( R.btn('×', this.onToggleClick, 'Hide Textures Viewer', 'close-window-btn'), React.createElement(TexturesViewerBody)), 200, 100, 620, 300, 900, 800); } return R.fragment(btn, table); } } class TexturesViewerBody extends React.Component { constructor(props) { super(props); this.renderItem = this.renderItem.bind(this); this.imagesRoot = '/games/' + editor.currentProjectDir + 'img/'; this.state = {filter: FILTER_ALL}; this.refreshView = this.refreshView.bind(this); this.checkForUnusedImages = this.checkForUnusedImages.bind(this); this.uploadFile = { type: 'file', accept: 'image/*', name: 'UploadImg', className: 'forms', id: 'input-img' }; } onUpload() { let flip = document.getElementById('input-img'); flip.click(); flip.addEventListener('change', (event) => { editor.askSceneToSaveIfNeed().then(() => { editor.ui.status.clear(); event.preventDefault(); console.log(event.target.files[0]); upload(event.target.files[0]); }); }); } refreshView() { this.forceUpdate(); } componentDidMount() { view = this; Window.bringWindowForward('#window-texturesviewer', true); } componentWillUnmount() { view = null; } renderItem(item) { let name = item.value; var opt = editor.projectDesc.loadOnDemandTextures; let isOnDemandLoading = opt.hasOwnProperty(name); let onDemandSwitcher; let folderProps = isParentFolderPropsDefined(name); if(!folderProps) { onDemandSwitcher = R.span({ className: 'texture-preload-checkbox', title: 'Texture preloading mode' }, React.createElement(SelectEditor, {onChange:(ev) => { if(opt[name] !== ev.target.value) { if(ev.target.value !== DEFAULT_LOADING) { opt[name] = ev.target.value; game.__loadDynamicTextures(); } else { game.__loadImageIfUnloaded(name); delete opt[name]; } this.setState({filter: FILTER_ALL}); editor.saveProjectDesc(); this.forceUpdate(); } }, value:opt[name], select: LOADING_TYPES}), ); } else { if(opt[name] != folderProps) { opt[name] = folderProps; editor.saveProjectDesc(); window.debouncedCall(this.refreshView); window.debouncedCall(game.__loadDynamicTextures); } } let size; if(Lib.hasTexture(name)) { let texture = Lib.getTexture(name); if(texture.__noIncludeInToBuild) { return undefined; } size = texture.width + 'x' + texture.height; } else { size = '(unloaded)'; } let path = this.getImagePath(name) + '?noCache=' + Lib.__noCacheCounter; return R.div({key:name, className:isOnDemandLoading ? 'textures-viewer-item red-frame' : 'textures-viewer-item'}, R.img({src: path, className:'textures-viewer-image', onDoubleClick:() => { editor.fs.editFile(path.split('?')[0]); }, onDragStart(ev) { ev.dataTransfer.setData("text/thing-editor-image-id", name); } }), R.b(labelProps, name), R.br(), size, onDemandSwitcher ); } getImagePath(name) { return this.imagesRoot + name; } render() { let list = Lib.__texturesList; if(this.state.filter !== FILTER_ALL) { let filter = this.state.filter; list = list.filter((t) => { return (editor.projectDesc.loadOnDemandTextures[t.name] || 1001) === filter; }); } list = list.map(this.renderItem).filter(i => i); let folders = {}; for(let i of list) { let folderName = i.key.substring(0, i.key.lastIndexOf('/')); if(folderName) { folders[folderName] = true; } } for(let folderName in folders) { if(!isParentFolderPropsDefined(folderName)) { list.unshift(R.div({className:'folder-loading-settings', title:"Folder preloading mode", key: folderName +'/ folder-props ::'}, React.createElement(SelectEditor, {onChange:(ev) => { let opt = editor.projectDesc.__loadOnDemandTexturesFolders; if(opt[folderName] !== ev.target.value) { if(ev.target.value !== DEFAULT_LOADING) { let a = Object.keys(opt); for(let f of a) { if(f.startsWith(folderName + '/')) { delete opt[f]; } } opt[folderName] = ev.target.value; } else { delete opt[folderName]; let optImg = editor.projectDesc.loadOnDemandTextures; let a = Object.keys(optImg); for(let f of a) { if(f.startsWith(folderName + '/')) { game.__loadImageIfUnloaded(f); delete optImg[f]; } } } editor.saveProjectDesc(); this.setState({filter: FILTER_ALL}); this.forceUpdate(); } }, value:editor.projectDesc.__loadOnDemandTexturesFolders[folderName], select: LOADING_TYPES}), )); } } return R.div(null, R.btn(R.icon('reload-assets'), editor.ui.viewport.onReloadAssetsClick, 'Reload game assets', 'big-btn'), R.btn(R.icon('cleanup-assets'), this.checkForUnusedImages, 'Auto-clean. Check for images unused in prefabs and scenes. It is still can be used in code or in not standard fields', 'big-btn'), R.input(this.uploadFile), R.btn(R.icon('img-upload'), this.onUpload, 'Upload file', 'big-btn'), R.span(null, "Filter by loading mode: ", React.createElement(SelectEditor, {onChange:(ev) => { this.setState({filter: ev.target.value}); }, value:this.state.filter, select: FILTER_SELECT}) ), R.div({className:'list-view'}, group.groupArray(list) ) ); } checkForUnusedImages() { editor.askSceneToSaveIfNeed().then(() => { editor.ui.status.clear(); let allTextures = new Set(Object.values(Lib.__texturesList).map(i => i.name)); function checkValue(key, value) { if(value && (typeof value === 'string')) { if(allTextures.has(value)) { allTextures.delete(value); } } return value; } function checkDataForImages(data) { JSON.stringify(data, checkValue); } function checkListForImages(list) { for(let key in list) { checkDataForImages(list[key]); } } checkListForImages(Lib.prefabs); checkListForImages(Lib.scenes); for(let imageName of allTextures) { let texture = Lib.getTexture(imageName); if(texture.__noIncludeInToBuild && (texture !== PIXI.Texture.EMPTY)) { continue; } let fileInfo = editor.fs.filesExt.img.find((fn) => { return fn.name.substring(4) === imageName; }); if(fileInfo && fileInfo.lib) { continue; } editor.ui.status.warn('No refs to: ' + imageName, 32043, () => { let path = this.getImagePath(imageName); let view = R.img({src: path, className:'textures-viewer-image'}); editor.ui.modal.showEditorQuestion('Are you sure?', R.span({className:'danger'}, 'Are you sure you want to delete image: ', R.b(null, imageName), ' ?', R.br(), 'You cannot undo this action.', R.br(), view ),() => { Lib._unloadTexture(imageName); editor.fs.deleteFile('img/' + imageName); }, 'Delete'); }); } }); } }
25.861671
193
0.6423
38a029fb771d9ae3a06cbfcd718874b098559341
1,952
php
PHP
application/controllers/DiagnosisController.php
safiullahzuri/thesis
ddbe2fc567b1864c9c80390a8b93d981713bf82f
[ "MIT" ]
null
null
null
application/controllers/DiagnosisController.php
safiullahzuri/thesis
ddbe2fc567b1864c9c80390a8b93d981713bf82f
[ "MIT" ]
3
2020-07-17T19:57:18.000Z
2022-03-02T04:56:57.000Z
application/controllers/DiagnosisController.php
safiullahzuri/thesis
ddbe2fc567b1864c9c80390a8b93d981713bf82f
[ "MIT" ]
null
null
null
<?php class DiagnosisController extends CI_Controller { function __construct() { parent::__construct(); } function saveDiagnosis(){ $appointment_id = $this->input->post("appointment_id"); $diagnosis_text = $this->input->post("diagnosis_text"); $data["wrote"] = "no"; if (!is_dir("Uploads/diagnosis/$appointment_id")){ mkdir("./Uploads/diagnosis/$appointment_id", 0777, true); } $date = date("Y-m-d-h-i-s"); $file_name = $date.'diagnosis.txt'; if (write_file("./Uploads/diagnosis/$appointment_id/$file_name", $diagnosis_text)){ //check if there is a diagnosis for this appointment before, //if so update rather than saving it again if ($this->DiagnosisModel->isDiagnosisForAppointment($appointment_id)){ $this->DiagnosisModel->updateDiagnosis($appointment_id, $file_name); $data["wrote"] = "yes"; }else{ if ($this->DiagnosisModel->addDiagnosis($appointment_id, $file_name)){ $data["wrote"] = "yes"; } } $this->AppointmentModel->closeAppointment($appointment_id); } echo json_encode($data); } function getDiagnosis(){ $appointment_id = $this->input->post("id"); $contents = ""; $contents = file_get_contents($this->DiagnosisModel->getDiagnosisPath($appointment_id), true); echo $contents; } function editDiagnosis(){ $appointmentId = $this->input->post("appointmentId"); $diagnosisText = $this->input->post("diagnosisText"); if (write_file($this->DiagnosisModel->getDiagnosisPath($appointmentId), $diagnosisText, 'w+')){ echo "edited"; }else{ echo FCPATH; echo "not edited".$this->DiagnosisModel->getDiagnosisPath($appointmentId); } } }
29.575758
103
0.579918
cd732e2099dd57fd391ca36b3dd10b48143758ec
184
csx
C#
Functions.Templates/Templates/ExternalFileTrigger-CSharp/run.csx
ElleTojaroon/AzurePortalTemplate
275f6e7958b301618c97b022e0813b9c94331d31
[ "MIT" ]
null
null
null
Functions.Templates/Templates/ExternalFileTrigger-CSharp/run.csx
ElleTojaroon/AzurePortalTemplate
275f6e7958b301618c97b022e0813b9c94331d31
[ "MIT" ]
null
null
null
Functions.Templates/Templates/ExternalFileTrigger-CSharp/run.csx
ElleTojaroon/AzurePortalTemplate
275f6e7958b301618c97b022e0813b9c94331d31
[ "MIT" ]
null
null
null
using System; public static string Run(string inputFile, string name, TraceWriter log) { log.Info($"C# External trigger function processed file: " + name); return inputFile; }
26.285714
72
0.728261
ae231a48e42fd817c771e2ad55a64cc40094925e
7,167
cs
C#
Assets/JMO Assets/Cartoon FX Remaster/CFXR Assets/Scripts/CFXR_Effect.CameraShake.cs
lordvlads77/Fighting-Game
29688c3ea9df784746e1f86dc8b9d91bf42fcd39
[ "MIT" ]
null
null
null
Assets/JMO Assets/Cartoon FX Remaster/CFXR Assets/Scripts/CFXR_Effect.CameraShake.cs
lordvlads77/Fighting-Game
29688c3ea9df784746e1f86dc8b9d91bf42fcd39
[ "MIT" ]
29
2021-01-15T02:31:51.000Z
2021-01-18T21:25:10.000Z
Assets/JMO Assets/Cartoon FX Remaster/CFXR Assets/Scripts/CFXR_Effect.CameraShake.cs
lordvlads77/Fighting-Game
29688c3ea9df784746e1f86dc8b9d91bf42fcd39
[ "MIT" ]
null
null
null
using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; #if UNITY_EDITOR using UnityEditor; #endif namespace CartoonFX { public partial class CFXR_Effect : MonoBehaviour { [System.Serializable] public class CameraShake { public enum ShakeSpace { Screen, World } static public bool editorPreview = true; //-------------------------------------------------------------------------------------------------------------------------------- public bool enabled = false; [Space] public bool useMainCamera = true; public List<Camera> cameras = new List<Camera>(); [Space] public float delay = 0.0f; public float duration = 1.0f; public ShakeSpace shakeSpace = ShakeSpace.Screen; public Vector3 shakeStrength = new Vector3(0.1f, 0.1f, 0.1f); public AnimationCurve shakeCurve = AnimationCurve.Linear(0, 1, 1, 0); [Space] [Range(0, 0.1f)] public float shakesDelay = 0; [System.NonSerialized] public bool isShaking; Dictionary<Camera, Vector3> camerasPreRenderPosition = new Dictionary<Camera, Vector3>(); Vector3 shakeVector; float delaysTimer; //-------------------------------------------------------------------------------------------------------------------------------- // STATIC // Use static methods to dispatch the Camera callbacks, to ensure that ScreenShake components are called in an order in PreRender, // and in the _reverse_ order for PostRender, so that the final Camera position is the same as it is originally (allowing concurrent // screen shake to be active) static bool s_CallbackRegistered; static List<CameraShake> s_CameraShakes = new List<CameraShake>(); #if UNITY_2019_1_OR_NEWER static void OnPreRenderCamera_Static_URP(ScriptableRenderContext context, Camera cam) { OnPreRenderCamera_Static(cam); } static void OnPostRenderCamera_Static_URP(ScriptableRenderContext context, Camera cam) { OnPostRenderCamera_Static(cam); } #endif static void OnPreRenderCamera_Static(Camera cam) { int count = s_CameraShakes.Count; for (int i = 0; i < count; i++) { var ss = s_CameraShakes[i]; ss.onPreRenderCamera(cam); } } static void OnPostRenderCamera_Static(Camera cam) { int count = s_CameraShakes.Count; for (int i = count-1; i >= 0; i--) { var ss = s_CameraShakes[i]; ss.onPostRenderCamera(cam); } } static void RegisterStaticCallback(CameraShake cameraShake) { s_CameraShakes.Add(cameraShake); if (!s_CallbackRegistered) { #if UNITY_2019_1_OR_NEWER #if UNITY_2019_3_OR_NEWER if (GraphicsSettings.currentRenderPipeline == null) #else if (GraphicsSettings.renderPipelineAsset == null) #endif { // Built-in Render Pipeline Camera.onPreRender += OnPreRenderCamera_Static; Camera.onPostRender += OnPostRenderCamera_Static; } else { // URP RenderPipelineManager.beginCameraRendering += OnPreRenderCamera_Static_URP; RenderPipelineManager.endCameraRendering += OnPostRenderCamera_Static_URP; } #else Camera.onPreRender += OnPreRenderCamera_Static; Camera.onPostRender += OnPostRenderCamera_Static; #endif s_CallbackRegistered = true; } } static void UnregisterStaticCallback(CameraShake cameraShake) { s_CameraShakes.Remove(cameraShake); if (s_CallbackRegistered && s_CameraShakes.Count == 0) { #if UNITY_2019_1_OR_NEWER #if UNITY_2019_3_OR_NEWER if (GraphicsSettings.currentRenderPipeline == null) #else if (GraphicsSettings.renderPipelineAsset == null) #endif { // Built-in Render Pipeline Camera.onPreRender -= OnPreRenderCamera_Static; Camera.onPostRender -= OnPostRenderCamera_Static; } else { // URP RenderPipelineManager.beginCameraRendering -= OnPreRenderCamera_Static_URP; RenderPipelineManager.endCameraRendering -= OnPostRenderCamera_Static_URP; } #else Camera.onPreRender -= OnPreRenderCamera_Static; Camera.onPostRender -= OnPostRenderCamera_Static; #endif s_CallbackRegistered = false; } } //-------------------------------------------------------------------------------------------------------------------------------- void onPreRenderCamera(Camera cam) { #if UNITY_EDITOR //add scene view camera if necessary if (SceneView.currentDrawingSceneView != null && SceneView.currentDrawingSceneView.camera == cam && !camerasPreRenderPosition.ContainsKey(cam)) { camerasPreRenderPosition.Add(cam, cam.transform.localPosition); } #endif if (isShaking && camerasPreRenderPosition.ContainsKey(cam)) { camerasPreRenderPosition[cam] = cam.transform.localPosition; switch (shakeSpace) { case ShakeSpace.Screen: cam.transform.localPosition += cam.transform.rotation * shakeVector; break; case ShakeSpace.World: cam.transform.localPosition += shakeVector; break; } } } void onPostRenderCamera(Camera cam) { if (camerasPreRenderPosition.ContainsKey(cam)) { cam.transform.localPosition = camerasPreRenderPosition[cam]; } } public void fetchCameras() { #if UNITY_EDITOR if (!EditorApplication.isPlayingOrWillChangePlaymode) { return; } #endif foreach (var cam in cameras) { if (cam == null) continue; camerasPreRenderPosition.Remove(cam); } cameras.Clear(); if (useMainCamera && Camera.main != null) { cameras.Add(Camera.main); } foreach (var cam in cameras) { if (cam == null) continue; if (!camerasPreRenderPosition.ContainsKey(cam)) { camerasPreRenderPosition.Add(cam, Vector3.zero); } } } public void StartShake() { if (isShaking) { StopShake(); } isShaking = true; RegisterStaticCallback(this); } public void StopShake() { isShaking = false; shakeVector = Vector3.zero; UnregisterStaticCallback(this); } public void animate(float time) { #if UNITY_EDITOR if (!editorPreview && !EditorApplication.isPlaying) { shakeVector = Vector3.zero; return; } #endif float totalDuration = duration + delay; if (time < totalDuration) { if (time < delay) { return; } if (!isShaking) { this.StartShake(); } // duration of the camera shake float delta = Mathf.Clamp01(time/totalDuration); // delay between each camera move if (shakesDelay > 0) { delaysTimer += Time.deltaTime; if (delaysTimer < shakesDelay) { return; } else { while (delaysTimer >= shakesDelay) { delaysTimer -= shakesDelay; } } } var randomVec = new Vector3(Random.value, Random.value, Random.value); var shakeVec = Vector3.Scale(randomVec, shakeStrength) * (Random.value > 0.5f ? -1 : 1); shakeVector = shakeVec * shakeCurve.Evaluate(delta) * GLOBAL_CAMERA_SHAKE_MULTIPLIER; } else if (isShaking) { StopShake(); } } } } }
25.059441
147
0.63597
f3f3a4704338ca6849cce2761b952207cbd81018
1,129
ts
TypeScript
03_ProcessEngineCore/process_engine_core.endpoints.http/src/endpoints/correlations/correlations_router.ts
atlas-engine/atlas_engine_poc
7c2ba1ed94f2e62d968ced822139567531776b2a
[ "MIT" ]
null
null
null
03_ProcessEngineCore/process_engine_core.endpoints.http/src/endpoints/correlations/correlations_router.ts
atlas-engine/atlas_engine_poc
7c2ba1ed94f2e62d968ced822139567531776b2a
[ "MIT" ]
null
null
null
03_ProcessEngineCore/process_engine_core.endpoints.http/src/endpoints/correlations/correlations_router.ts
atlas-engine/atlas_engine_poc
7c2ba1ed94f2e62d968ced822139567531776b2a
[ "MIT" ]
null
null
null
import {BaseRouter} from '@essential-projects/http_node'; import {IIdentityService} from '@essential-projects/iam_contracts'; import {wrap} from 'async-middleware'; import {MiddlewareFunction, createResolveIdentityMiddleware} from '../../middlewares/resolve_identity'; import {CorrelationsController} from './correlations_controller'; export class CorrelationsRouter extends BaseRouter { private identityService: IIdentityService; private correlationsController: CorrelationsController; constructor(correlationsController: CorrelationsController, identityService: IIdentityService) { super(); this.correlationsController = correlationsController; this.identityService = identityService; } public get baseRoute(): string { return 'api/process-engine-runtime/v1'; } public initializeRouter(): void { this.registerMiddlewares(); this.registerRoutes(); } private registerMiddlewares(): void { const resolveIdentity: MiddlewareFunction = createResolveIdentityMiddleware(this.identityService); this.router.use(wrap(resolveIdentity)); } private registerRoutes(): void {} }
31.361111
103
0.776794
09c247ae084437d79e1b471712cff07a3ea14ff0
2,915
dart
Dart
lib/src/core/controller/pagamento_controller.g.dart
ofertasbv/ofertaflutterweb
9eb1339021aceef1dcf2ea94b7808f1d9a34dd1b
[ "Apache-2.0" ]
null
null
null
lib/src/core/controller/pagamento_controller.g.dart
ofertasbv/ofertaflutterweb
9eb1339021aceef1dcf2ea94b7808f1d9a34dd1b
[ "Apache-2.0" ]
null
null
null
lib/src/core/controller/pagamento_controller.g.dart
ofertasbv/ofertaflutterweb
9eb1339021aceef1dcf2ea94b7808f1d9a34dd1b
[ "Apache-2.0" ]
null
null
null
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'pagamento_controller.dart'; // ************************************************************************** // StoreGenerator // ************************************************************************** // ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic mixin _$PagamentoController on PagamentoControllerBase, Store { final _$pagamentosAtom = Atom(name: 'PagamentoControllerBase.pagamentos'); @override List<Pagamento> get pagamentos { _$pagamentosAtom.reportRead(); return super.pagamentos; } @override set pagamentos(List<Pagamento> value) { _$pagamentosAtom.reportWrite(value, super.pagamentos, () { super.pagamentos = value; }); } final _$pagamentoAtom = Atom(name: 'PagamentoControllerBase.pagamento'); @override int get pagamento { _$pagamentoAtom.reportRead(); return super.pagamento; } @override set pagamento(int value) { _$pagamentoAtom.reportWrite(value, super.pagamento, () { super.pagamento = value; }); } final _$errorAtom = Atom(name: 'PagamentoControllerBase.error'); @override Exception get error { _$errorAtom.reportRead(); return super.error; } @override set error(Exception value) { _$errorAtom.reportWrite(value, super.error, () { super.error = value; }); } final _$dioErrorAtom = Atom(name: 'PagamentoControllerBase.dioError'); @override DioError get dioError { _$dioErrorAtom.reportRead(); return super.dioError; } @override set dioError(DioError value) { _$dioErrorAtom.reportWrite(value, super.dioError, () { super.dioError = value; }); } final _$mensagemAtom = Atom(name: 'PagamentoControllerBase.mensagem'); @override String get mensagem { _$mensagemAtom.reportRead(); return super.mensagem; } @override set mensagem(String value) { _$mensagemAtom.reportWrite(value, super.mensagem, () { super.mensagem = value; }); } final _$getAllAsyncAction = AsyncAction('PagamentoControllerBase.getAll'); @override Future<List<Pagamento>> getAll() { return _$getAllAsyncAction.run(() => super.getAll()); } final _$createAsyncAction = AsyncAction('PagamentoControllerBase.create'); @override Future<int> create(Pagamento p) { return _$createAsyncAction.run(() => super.create(p)); } final _$updateAsyncAction = AsyncAction('PagamentoControllerBase.update'); @override Future<int> update(int id, Pagamento p) { return _$updateAsyncAction.run(() => super.update(id, p)); } @override String toString() { return ''' pagamentos: ${pagamentos}, pagamento: ${pagamento}, error: ${error}, dioError: ${dioError}, mensagem: ${mensagem} '''; } }
24.495798
211
0.662093
af230658dd3bb2a8ea6ec5c62e21552c1a9c0ccc
11,320
py
Python
advent_of_code/solvers/day_06.py
jdswalker/Advent-of-Code-2015
2e9a1e1441db92eee318c9ddb357f4e4b1f2f76c
[ "MIT" ]
2
2020-03-22T16:15:03.000Z
2021-06-07T08:22:37.000Z
advent_of_code/solvers/day_06.py
jdswalker/Advent-of-Code-2015
2e9a1e1441db92eee318c9ddb357f4e4b1f2f76c
[ "MIT" ]
null
null
null
advent_of_code/solvers/day_06.py
jdswalker/Advent-of-Code-2015
2e9a1e1441db92eee318c9ddb357f4e4b1f2f76c
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """Puzzle Solver for Advent of Code 2015 Day 6 Author: James Walker Copyright: MIT license Description (https://adventofcode.com/2015/day/6): --- Day 6: Probably a Fire Hazard --- Because your neighbors keep defeating you in the holiday house decorating contest year after year, you've decided to deploy one million lights in a 1000x1000 grid. Furthermore, because you've been especially nice this year, Santa has mailed you instructions on how to display the ideal lighting configuration. Lights in your grid are numbered from 0 to 999 in each direction; the lights at each corner are at 0,0, 0,999, 999,999, and 999,0. The instructions include whether to turn on, turn off, or toggle various inclusive ranges given as coordinate pairs. Each coordinate pair represents opposite corners of a rectangle, inclusive; a coordinate pair like 0,0 through 2,2 therefore refers to 9 lights in a 3x3 square. The lights all start turned off. To defeat your neighbors this year, all you have to do is set up your lights by doing the instructions Santa sent you in order. For example: turn on 0,0 through 999,999 would turn on (or leave on) every light. toggle 0,0 through 999,0 would toggle the first line of 1000 lights, turning off the ones that were on, and turning on the ones that were off. turn off 499,499 through 500,500 would turn off (or leave off) the middle four lights. After following the instructions, how many lights are lit? Answer: 400,410 --- Day 6: Part Two --- You just finish implementing your winning light pattern when you realize you mistranslated Santa's message from Ancient Nordic Elvish. The light grid you bought actually has individual brightness controls; each light can have a brightness of zero or more. The lights all start at zero. The phrase turn on actually means that you should increase the brightness of those lights by 1. The phrase turn off actually means that you should decrease the brightness of those lights by 1, to a minimum of zero. The phrase toggle actually means that you should increase the brightness of those lights by 2. For example: turn on 0,0 through 0,0 would increase the total brightness by 1. toggle 0,0 through 999,999 would increase the total brightness by 2000000. What is the total brightness of all lights combined after following Santa's instructions? Answer: 15,343,601 """ # Standard Library Imports from collections import namedtuple import re # Application-specific Imports from advent_of_code.solvers import solver # Stores a pair of light grid coordinates Point = namedtuple('Point', 'x y') class LightGrid(object): """Abstract class for representing a 2D grid of lights Attributes: grid_size (Point): Stores maximum x- and y-coordinate of the light grid light_grid (list): Lights in the grid as a list of rows """ def __init__(self, width=1000, height=1000): self._grid_size = Point(width, height) self._light_grid = [None] * height self.reset_grid() def reset_grid(self): """Turns off every light in the grid Args: None Returns: None """ for row in range(0, self._grid_size.y): self._light_grid[row] = bytearray(self._grid_size.x) def count_lights(self): """Counts the number or total intensity of turned on lights in the grid Args: None Returns: int: The number or intensity of turned on lights in the grid """ return sum(sum(row) for row in self._light_grid) def set_light_state(self, start, end, light_state): """Sets a row of lights to a specific state Args: start (int): The grid index for the light to begin setting states end (int): The grid index for the light to stop setting states light_state (str): Whether the lights should be 'on' or 'off' Returns: None """ raise NotImplementedError() class SimpleLightGrid(LightGrid): """Represents a 2D grid of lights that can be turned on and off Attributes: grid_size (Point): Stores maximum x- and y-coordinate of the light grid light_grid (list): Lights in the grid as a list of rows """ def set_light_state(self, start, end, light_state): """Sets a row of lights to a specific state Args: start (int): The grid index for the light to begin setting states end (int): The grid index for the light to stop setting states light_state (str): Whether the lights should be 'on' or 'off' Returns: None """ state = 1 if light_state == 'on' else 0 for row in range(start.y, end.y + 1): for column in range(start.x, end.x + 1): self._light_grid[row][column] = state def toggle_light_state(self, start, end): """Toggles lights between on and off along indices of a grid row Args: start (int): The grid index for the light to begin toggling lights end (int): The grid index for the light to stop toggling lights Returns: None """ for row in range(start.y, end.y + 1): for column in range(start.x, end.x + 1): self._light_grid[row][column] ^= 1 class ComplexLightGrid(LightGrid): """Represents a 2D grid of lights that can change intensity Attributes: grid_size (Point): Stores maximum x- and y-coordinate of the light grid light_grid (list): Lights in the grid as a list of rows """ def set_light_state(self, start, end, light_state): """Sets a row of lights to a specific state Args: start (int): The grid index for the light to begin setting states end (int): The grid index for the light to stop setting states light_state (str): Whether the lights should be 'on' or 'off' Returns: None """ if light_state == 'on': self.toggle_light_state(start, end, 1) else: for row in range(start.y, end.y + 1): for column in range(start.x, end.x + 1): if self._light_grid[row][column]: self._light_grid[row][column] -= 1 def toggle_light_state(self, start, end, increment=2): """Increases the intensity for a row of lights between two indices Args: start (int): The grid index for the light to begin toggling lights end (int): The grid index for the light to stop toggling lights increment (int): The amount to increase each light's intensity Returns: None """ end_x = end.x + 1 for row in range(start.y, end.y + 1): for column in range(start.x, end_x): self._light_grid[row][column] += increment class Solver(solver.AdventOfCodeSolver): """Advent of Code 2015 Day 6: Probably a Fire Hazard Attributes: puzzle_input (list): A list of instructions for solving the puzzle puzzle_title (str): Name of the Advent of Code puzzle solved_output (str): A template string for solution output toggle (RegexObject): Pattern for matching toggle instructions turn (RegexObject): Pattern for matching turn instructions """ def __init__(self, *args): solver.AdventOfCodeSolver.__init__(self, *args) self._solved_output = '\n'.join(( 'The first grid had {0} lights lit and', 'the second grid had a total brightness of {1}', )) toggle_pattern = 'toggle {0}' turn_pattern = 'turn (?P<state>on|off) {0}' overlap = r'(?P<x1>\d+),(?P<y1>\d+) through (?P<x2>\d+),(?P<y2>\d+)' self._toggle = re.compile(toggle_pattern.format(overlap)) self._turn = re.compile(turn_pattern.format(overlap)) @staticmethod def _parse_points(instruction): """Parses start and end points from the instruction Args: instruction (dict): Parsed coordinates for which lights to change Returns: tuple: Start and end coordinates for the intruction """ start = Point(int(instruction['x1']), int(instruction['y1'])) end = Point(int(instruction['x2']), int(instruction['y2'])) return (start, end) def toggle_lights(self, light_grid, toggle_instr): """Changes the given lights based on their state (i.e., on or off) Args: light_grid (LightGrid): Represents a 2D grid of lights toggle_instr (MatchObject): Parsed coordinates for lights to change Returns: None """ start, end = self._parse_points(toggle_instr.groupdict()) light_grid.toggle_light_state(start, end) def change_light_state(self, light_grid, turn_instr): """Sets the given lights to a particular state (i.e., on or off) Args: light_grid (LightGrid): Represents a 2D grid of lights turn_instr (MatchObject): Parsed coordinates for lights to change Returns: None """ light_instr = turn_instr.groupdict() start, end = self._parse_points(light_instr) light_grid.set_light_state(start, end, light_instr['state']) def _solve_puzzle_parts(self): """Solves each part of a Advent of Code 2015 puzzle Args: None Returns: tuple: Pair of solutions for the two parts of the puzzle """ simple_grid = SimpleLightGrid(width=1000, height=1000) complex_grid = ComplexLightGrid(width=1000, height=1000) for instruction in self._puzzle_input.splitlines(): if instruction.startswith('toggle'): toggle_instr = self._toggle.match(instruction) self.toggle_lights(simple_grid, toggle_instr) self.toggle_lights(complex_grid, toggle_instr) elif instruction.startswith('turn'): turn_instr = self._turn.match(instruction) self.change_light_state(simple_grid, turn_instr) self.change_light_state(complex_grid, turn_instr) return (simple_grid.count_lights(), complex_grid.count_lights()) def run_test_cases(self): """Runs a series of inputs and compares against expected outputs Args: None Returns: None """ input1 = 'turn on 0,0 through 999,999' input2 = 'toggle 0,0 through 999,0' input3 = '\n'.join((input1, input2)) input4 = 'turn off 499,499 through 500,500' input5 = '\n'.join((input1, input4)) input6 = 'turn on 0,0 through 0,0' input7 = 'toggle 0,0 through 999,999' test_cases = ( solver.TestCase(input1, '1000000', '1000000'), solver.TestCase(input2, '1000', '2000'), solver.TestCase(input3, '999000', '1002000'), solver.TestCase(input4, '0', '0'), solver.TestCase(input5, '999996', '999996'), solver.TestCase(input6, '1', '1'), solver.TestCase(input7, '1000000', '2000000'), ) for test_case in test_cases: self._run_test_case(test_case)
39.305556
79
0.644876
7f2c2cc2e1a3be25cfed21d2a20c887e5a879a15
2,662
swift
Swift
Sources/SwiftcraftLibrary/Networking/Packet/Handshake.swift
marzvrover/Swiftcraft
4e88bd5831b54a0e2958efed236caa5bb53270b4
[ "Apache-2.0" ]
2
2020-12-16T02:20:31.000Z
2021-04-09T15:23:50.000Z
Sources/SwiftcraftLibrary/Networking/Packet/Handshake.swift
marzvrover/Swiftcraft
4e88bd5831b54a0e2958efed236caa5bb53270b4
[ "Apache-2.0" ]
14
2020-12-02T23:20:06.000Z
2020-12-20T10:07:21.000Z
Sources/SwiftcraftLibrary/Networking/Packet/Handshake.swift
marzvrover/Swiftcraft
4e88bd5831b54a0e2958efed236caa5bb53270b4
[ "Apache-2.0" ]
2
2020-12-20T10:32:11.000Z
2021-09-13T09:00:13.000Z
import Foundation import NIO // swiftlint:disable line_length /// # The Minecraft Handshake `Packet` /// /// ## ID /// The `Packet`.`id` for the Minecraft Handshake Packet is 0x00 /// /// ## Definition /// /// Field Name | Datatype | Decoder Arguments | Notes /// -----------------|-------------------------------------------|-------------------|------------------------------------------------- /// protocol_version | `PacketData`.`varInt` aka `Int32` | | The Minecraft Protocol version number. /// server_address | `PacketData`.`varString` aka `String` | | The server address the client is connecting to. /// server_port | `PacketData`.`unsignedShort` aka `UInt16` | | The server port the client is connecting to. /// intention | `PacketData`.`varInt` aka `Int32` | | 1 for status, 2 for login class Handshake: Packet { // swiftlint:enable line_length /// Handshake Initializer init() { super.init( id: 0x00, definition: [ (name: "protocol_version", type: .varInt, args: nil), (name: "server_address", type: .varString, args: nil), (name: "server_port", type: .unsignedShort, args: nil), (name: "intention", type: .varInt, args: nil), ], data: [:] ) } /// Getter and setter for `Handshake`.`data["protocol_version"]`. var version: Int32 { get { // swiftlint:disable:next force_cast return self.data["protocol_version"] as! Int32 } set(value) { self.data["protocol_version"] = value } } /// Getter and setter for `Handshake`.`data["server_address"]`. var address: String { get { // swiftlint:disable:next force_cast return self.data["server_address"] as! String } set(value) { self.data["server_address"] = value } } /// Getter and setter for `Handshake`.`data["server_port"]`. var port: UInt16 { get { // swiftlint:disable:next force_cast return self.data["server_port"] as! UInt16 } set(value) { self.data["server_port"] = value } } /// Getter and setter for `Handshake`.`data["intention"]`. var intention: Int32 { get { // swiftlint:disable:next force_cast return self.data["intention"] as! Int32 } set(value) { self.data["intention"] = value } } }
36.465753
135
0.503757
53638e0eb663611638c184b5906229994d381e3b
685
swift
Swift
Herald/CurriculumTableViewCell.swift
seuzl/Herald_iOS
9d70f06accadf0c9571a3c7c16d4b38d2f407ad7
[ "MIT" ]
2
2016-02-26T02:01:45.000Z
2016-07-04T05:49:47.000Z
Herald/CurriculumTableViewCell.swift
seuzl/Herald_iOS
9d70f06accadf0c9571a3c7c16d4b38d2f407ad7
[ "MIT" ]
null
null
null
Herald/CurriculumTableViewCell.swift
seuzl/Herald_iOS
9d70f06accadf0c9571a3c7c16d4b38d2f407ad7
[ "MIT" ]
1
2019-09-30T17:53:24.000Z
2019-09-30T17:53:24.000Z
// // CurriculumTableViewCell.swift // 先声 // // Created by Wangshuo on 14-8-21. // Copyright (c) 2014年 WangShuo. All rights reserved. // import UIKit class CurriculumTableViewCell: UITableViewCell { @IBOutlet var timeofLesson: UILabel! @IBOutlet var nameofLesson: UILabel! @IBOutlet var placeofLesson: UILabel! @IBOutlet var weekofLesson: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
20.147059
63
0.656934
93857090dffa7a1a503c47b139be660f8ad94e65
2,174
cs
C#
test/Opdex.Platform.WebApi.Tests/Middleware/MaintenanceLockFilterTests.cs
Opdex/opdex-v1-api
de56e1de1f6fee95cf0a58acb2b72ad5af90aebe
[ "MIT" ]
7
2021-10-30T21:08:29.000Z
2022-01-06T23:46:32.000Z
test/Opdex.Platform.WebApi.Tests/Middleware/MaintenanceLockFilterTests.cs
Opdex/opdex-v1-api
de56e1de1f6fee95cf0a58acb2b72ad5af90aebe
[ "MIT" ]
37
2021-10-29T22:30:13.000Z
2022-03-11T04:23:12.000Z
test/Opdex.Platform.WebApi.Tests/Middleware/MaintenanceLockFilterTests.cs
Opdex/opdex-v1-api
de56e1de1f6fee95cf0a58acb2b72ad5af90aebe
[ "MIT" ]
null
null
null
using FluentAssertions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Options; using Moq; using Opdex.Platform.WebApi.Exceptions; using Opdex.Platform.WebApi.Middleware; using System.Collections.Generic; using Xunit; namespace Opdex.Platform.WebApi.Tests.Middleware; public class MaintenanceLockFilterTests { [Fact] public void OnActionExecuting_MaintenanceLockFalse_DoNotThrow() { var maintenanceConfiguration = new MaintenanceConfiguration { Locked = false }; var maintenanceOptionsMock = new Mock<IOptionsSnapshot<MaintenanceConfiguration>>(); maintenanceOptionsMock.Setup(callTo => callTo.Value).Returns(maintenanceConfiguration); var filter = new MaintenanceLockFilter(maintenanceOptionsMock.Object); filter.Invoking(h => h.OnActionExecuting(CreateActionExecutingContext())).Should().NotThrow(); } [Fact] public void OnActionExecuting_MaintenanceLockTrue_ThrowMaintenanceLockException() { var maintenanceConfiguration = new MaintenanceConfiguration { Locked = true }; var maintenanceOptionsMock = new Mock<IOptionsSnapshot<MaintenanceConfiguration>>(); maintenanceOptionsMock.Setup(callTo => callTo.Value).Returns(maintenanceConfiguration); var filter = new MaintenanceLockFilter(maintenanceOptionsMock.Object); filter.Invoking(h => h.OnActionExecuting(CreateActionExecutingContext())).Should().ThrowExactly<MaintenanceLockException>(); } private static ActionExecutingContext CreateActionExecutingContext() { var actionContext = new ActionContext( Mock.Of<HttpContext>(), Mock.Of<RouteData>(), Mock.Of<ActionDescriptor>(), new ModelStateDictionary() ); return new ActionExecutingContext( actionContext, new List<IFilterMetadata>(), new Dictionary<string, object>(), Mock.Of<Controller>() ); } }
36.233333
132
0.731831
9395c1517ec932b9d1f93d0a58a512725bf71607
5,707
cs
C#
src/_DomainDriven/Framework.DomainDriven.Core/BLL/Validation/Validators/UniqueGroupDatabaseValidator.cs
Luxoft/BSSFramework
e060a42db5b1a96cc915b30c09e4e5751543e8af
[ "MIT" ]
18
2021-12-22T09:28:06.000Z
2022-01-20T19:48:41.000Z
src/_DomainDriven/Framework.DomainDriven.Core/BLL/Validation/Validators/UniqueGroupDatabaseValidator.cs
Luxoft/BSSFramework
e060a42db5b1a96cc915b30c09e4e5751543e8af
[ "MIT" ]
44
2021-12-28T08:36:17.000Z
2022-03-22T09:17:28.000Z
src/_DomainDriven/Framework.DomainDriven.Core/BLL/Validation/Validators/UniqueGroupDatabaseValidator.cs
Luxoft/BSSFramework
e060a42db5b1a96cc915b30c09e4e5751543e8af
[ "MIT" ]
2
2021-12-23T15:30:01.000Z
2021-12-28T01:26:36.000Z
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using Framework.Core; using Framework.Persistent; using Framework.Validation; namespace Framework.DomainDriven.BLL { /// <summary> /// Класс для проверки уникальности полей доменного объекта через запрос к БД. /// </summary> /// <seealso cref="IDynamicClassValidator" /> public class UniqueGroupDatabaseValidator : IDynamicClassValidator { private static readonly ILambdaCompileCache LambdaCompileCache = new LambdaCompileCache(); private readonly string groupKey; /// <summary> /// Создаёт экземпляр класса <see cref="UniqueGroupDatabaseValidator"/> class. /// </summary> /// <param name="groupKey">Ключ группы уникальности.</param> public UniqueGroupDatabaseValidator(string groupKey) { this.groupKey = groupKey; } /// <summary> /// Возвращает экземпляр валидатора.. /// </summary> /// <param name="domainObjectType">Тип доменного объекта.</param> /// <param name="extendedValidationData">Данные, необходимые для создания валидатора.</param> /// <returns>Экземпляр <see cref="IClassValidator"/>.</returns> /// <exception cref="ArgumentNullException">Аргумент /// <paramref name="domainObjectType"/> /// или /// <paramref name="extendedValidationData"/> равен null. /// </exception> public IClassValidator GetValidator(Type domainObjectType, IDynamicSource extendedValidationData) { if (domainObjectType == null) throw new ArgumentNullException(nameof(domainObjectType)); if (extendedValidationData == null) throw new ArgumentNullException(nameof(extendedValidationData)); var contexTypeData = extendedValidationData.GetValue<BLLContextTypeData>(true); var internalValidatorType = typeof(UniqueGroupDatabaseValidator<,,,>) .MakeGenericType( contexTypeData.ContextType, contexTypeData.PersistentDomainObjectBaseType, domainObjectType, contexTypeData.IdentType); var uniProperties = domainObjectType.GetUniqueElementPropeties(this.groupKey, true); var propertyNames = uniProperties.GetUniqueElementString(false); var getFilterExpression = this.GetGetFilterExpression( domainObjectType, contexTypeData.IdentType, uniProperties).Compile(LambdaCompileCache); var getPropertyValuesFunc = GetGetPropertyValuesExpression(domainObjectType, uniProperties).Compile(LambdaCompileCache); var validator = (IClassValidator)internalValidatorType.GetConstructors().Single().Invoke( new object[] { getFilterExpression, getPropertyValuesFunc, propertyNames }); return validator; } private static LambdaExpression GetGetPropertyValuesExpression( Type domainObjectType, IEnumerable<PropertyInfo> properties) { var domainObjectParameter = Expression.Parameter(domainObjectType); var newValuesArrExpr = Expression.NewArrayInit( typeof(object), properties.Select( property => Expression.Property(domainObjectParameter, property).Pipe(propExpr => propExpr.Type.IsClass ? (Expression)propExpr : Expression.Convert(propExpr, typeof(object))))); return Expression.Lambda(newValuesArrExpr, domainObjectParameter); } private LambdaExpression GetGetFilterExpression(Type domainObjectType, Type identType, IEnumerable<PropertyInfo> properties) { if (domainObjectType == null) throw new ArgumentNullException(nameof(domainObjectType)); if (identType == null) throw new ArgumentNullException(nameof(identType)); if (properties == null) throw new ArgumentNullException(nameof(properties)); var idProp = typeof(IIdentityObject<>).MakeGenericType(identType).GetProperties().Single(); var sourceDomainObjectParameter = Expression.Parameter(domainObjectType); var filterDomainObjectParameter = Expression.Parameter(domainObjectType); Func<PropertyInfo, Func<Expression, Expression, Expression>, Expression> getBinaryExpr = (property, buildFunc) => buildFunc( Expression.Property(sourceDomainObjectParameter, property), Expression.Property(filterDomainObjectParameter, property)); var duplicateFilter = properties.Aggregate(getBinaryExpr(idProp, Expression.NotEqual), (filter, property) => Expression.AndAlso(filter, getBinaryExpr(property, (e1, e2) => this.GetEqualityMethod(property, e1, e2)))); var duplicateLambda = Expression.Lambda(duplicateFilter, filterDomainObjectParameter); return Expression.Lambda(Expression.Quote(duplicateLambda), sourceDomainObjectParameter); } private Expression GetEqualityMethod(PropertyInfo property, Expression e1, Expression e2) { if (property == null) throw new ArgumentNullException(nameof(property)); var eqMethod = property.PropertyType.GetEqualityMethod(true); return Expression.Equal(e1, e2, property.PropertyType.IsNullable(), eqMethod); } } }
47.558333
186
0.655511
1ab957f1c02022b1e16808ece063ffc00a8778cc
196
py
Python
src/tests/test_MST.py
xiaonanln/study-the-algorithm-design-manual
0b9654564f9cffe58232b5e7759d21c8486ebd0a
[ "MIT" ]
10
2018-01-10T22:27:41.000Z
2022-02-08T12:18:47.000Z
src/tests/test_MST.py
xiaonanln/study-the-algorithm-design-manual
0b9654564f9cffe58232b5e7759d21c8486ebd0a
[ "MIT" ]
null
null
null
src/tests/test_MST.py
xiaonanln/study-the-algorithm-design-manual
0b9654564f9cffe58232b5e7759d21c8486ebd0a
[ "MIT" ]
2
2018-05-07T15:07:59.000Z
2018-10-29T12:50:56.000Z
import unittest class TestMST(unittest.TestCase): pass def testPrim(self): pass def testPrimPQ(self): pass def testKruskal(self): pass if __name__ == '__main__': unittest.main()
10.315789
33
0.704082
c4955571aefc5079c40b018bebfb0641ce381545
696
lua
Lua
Dictionary.lua
cyrus01337/objects
1229b80d554e505d8173f83213db3244ced6d517
[ "Unlicense" ]
1
2022-01-02T07:05:40.000Z
2022-01-02T07:05:40.000Z
Dictionary.lua
cyrus01337/objects
1229b80d554e505d8173f83213db3244ced6d517
[ "Unlicense" ]
1
2022-01-02T07:05:28.000Z
2022-01-15T12:38:02.000Z
Dictionary.lua
cyrus01337/objects
1229b80d554e505d8173f83213db3244ced6d517
[ "Unlicense" ]
null
null
null
local RS = game:GetService("ReplicatedStorage") local Mapping = require(RS.Objects.Mapping) local Utils = require(RS.Utils) local Dictionary = {} Dictionary.__index = Dictionary function Dictionary.new(mapping) mapping = if mapping ~= nil then mapping else {} local count = 0 for _, _ in pairs(mapping) do count += 1 end local self = Mapping.new(mapping) rawset(self, "Count", count) return setmetatable(self, Dictionary) end function Dictionary:__newindex(key, value) if self.Internal[key] then return end self.Count += 1 self.Internal[key] = value end function Dictionary:__len() return self.Count end return Dictionary
16.97561
52
0.688218
b2a51fd206e76cec43689bfab38d84e4cb23b309
45
css
CSS
modules/mod_jagooglechart/asset/style.css
huge2015/meter_object
5c3911a862022579882d00f18acbb266ff39a3c0
[ "Apache-2.0" ]
null
null
null
modules/mod_jagooglechart/asset/style.css
huge2015/meter_object
5c3911a862022579882d00f18acbb266ff39a3c0
[ "Apache-2.0" ]
null
null
null
modules/mod_jagooglechart/asset/style.css
huge2015/meter_object
5c3911a862022579882d00f18acbb266ff39a3c0
[ "Apache-2.0" ]
null
null
null
.ja-google-chart {} .ja-google-chart-intro {}
22.5
25
0.688889
5bed94fa87686035907ac9b02559e7a70a94d6a4
1,787
lua
Lua
scribbles/archlinux_package_db_finder.lua
thetaepsilon/luamono
626e5012d017ddcb237609dd39716f283ed1666b
[ "CC0-1.0" ]
null
null
null
scribbles/archlinux_package_db_finder.lua
thetaepsilon/luamono
626e5012d017ddcb237609dd39716f283ed1666b
[ "CC0-1.0" ]
null
null
null
scribbles/archlinux_package_db_finder.lua
thetaepsilon/luamono
626e5012d017ddcb237609dd39716f283ed1666b
[ "CC0-1.0" ]
null
null
null
#!/usr/bin/env lua5.3 local _usage = [[ Usage: archlinux_package_db_finder name_of_package fieldname < core.db.after_gunzip ]] local _getline = io.stdin:lines() local _lineno = 0 local getline = function() local line = _getline() if line ~= nil then _lineno = _lineno + 1 end return line end local lineno = function() return "line " .. tostring(_lineno) end local function find_plain(str) local start = lineno() for line in getline do if line == str then return end end error( "string \"" .. str .. "\" not found after " .. start .. " (incorrect input format?)" ) end local function find_pattern(pat) local start = lineno() for line in getline do -- varargs handling is hard... thankfully we only really need one local match = line:match(pat) if match then return line, match end end error( "no line matching " .. pat .. " after " .. start .. " (incorrect input format?)" ) end local function find_field(fieldname) local start = lineno() while true do local line, match = find_pattern("^%%([A-Z]*)%%$") if match == fieldname then -- ... then the next line should be the value of interest, -- but just check we didn't hit EOF first. local v = assert(getline(), "end of file reached while reading field value") return v end end -- if evidence was even needed I was shotgun parsing this... error("unreachable!?") end local function find_package_field(packagename, fieldname) while true do find_plain("%NAME%") local name = getline() if name == packagename then return find_field(fieldname) end end error("package " .. packagename .. " not found") end assert(select("#", ...) == 2, _usage) local packagename, fieldname = ... local v = find_package_field(packagename, fieldname) print(v)
19.215054
83
0.677112
7d8586589ae688b903454c33cd9db8589886af27
288
lua
Lua
scripts/filters/init.lua
nanderv/heatshields
4953100b64f31c8e561d7ad44eb2c14c243dd8bd
[ "BSD-3-Clause" ]
null
null
null
scripts/filters/init.lua
nanderv/heatshields
4953100b64f31c8e561d7ad44eb2c14c243dd8bd
[ "BSD-3-Clause" ]
null
null
null
scripts/filters/init.lua
nanderv/heatshields
4953100b64f31c8e561d7ad44eb2c14c243dd8bd
[ "BSD-3-Clause" ]
null
null
null
local a = core.filter.add a("ship_component", { "componentType", "shipNumber", "position" }) a("massSoure", {"oX", "oY", "mass"}) a("orbital", {"oX", "oY", "dx", "dy", "ax", "ay", "mass"}) a("ship", {"isShip"}) a("planet", {"isPlanet"}) a("star", {"isStar"}) a("fuelTank", {"isFuelTank"})
36
66
0.565972
2c8a92dd2ff54199969492778a2b81a81cd5182d
533
py
Python
serpapi/google_search_results.py
BarryByers349/google-search-results-python
33fefced052f0afadd6f497bad6e243adb3bd34b
[ "MIT" ]
1
2020-03-16T01:09:45.000Z
2020-03-16T01:09:45.000Z
serpapi/google_search_results.py
BarryByers349/google-search-results-python
33fefced052f0afadd6f497bad6e243adb3bd34b
[ "MIT" ]
1
2021-04-20T01:54:53.000Z
2021-04-20T01:54:53.000Z
serpapi/google_search_results.py
BarryByers349/google-search-results-python
33fefced052f0afadd6f497bad6e243adb3bd34b
[ "MIT" ]
null
null
null
from serpapi.serp_api_client import * class GoogleSearchResults(SerpApiClient): """GoogleSearchResults enables to search google and parse the result. ```python from serpapi.google_search_results import GoogleSearchResults query = GoogleSearchResults({"q": "coffee", "location": "Austin,Texas"}) data = query.get_json() ``` https://github.com/serpapi/google-search-results-python """ def __init__(self, params_dict): super(GoogleSearchResults, self).__init__(params_dict, GOOGLE_ENGINE)
33.3125
77
0.727955
a12035c7c5155da0c9a7cd9ed06991f801fae9df
578
ts
TypeScript
src/frame/visual/roomInf/type.ts
Ureimu/manual-screeps
eb9f537fb38f56f4455567dff43a88c6c2409131
[ "Unlicense" ]
null
null
null
src/frame/visual/roomInf/type.ts
Ureimu/manual-screeps
eb9f537fb38f56f4455567dff43a88c6c2409131
[ "Unlicense" ]
null
null
null
src/frame/visual/roomInf/type.ts
Ureimu/manual-screeps
eb9f537fb38f56f4455567dff43a88c6c2409131
[ "Unlicense" ]
null
null
null
declare global { interface RoomMemory { stats: { upgradeSpeed: string; creepNum: number; creepBodySizeInSpawnQueue: { [key: string]: number; }; ticksToUpgrade: string; }; } namespace NodeJS { interface Global { monitor: { [roomName: string]: { upgradeSpeed: number[]; level: number; time: number; }; }; } } } export const adminEast = 1;
22.230769
43
0.415225
b0b5780133096a70f82c57c79479b6261cb928ba
893
py
Python
training.py
luish18/aula_de_ambientes_turing
747c28b34a5bd19ed51c78c8845208982cb71caa
[ "Unlicense" ]
null
null
null
training.py
luish18/aula_de_ambientes_turing
747c28b34a5bd19ed51c78c8845208982cb71caa
[ "Unlicense" ]
null
null
null
training.py
luish18/aula_de_ambientes_turing
747c28b34a5bd19ed51c78c8845208982cb71caa
[ "Unlicense" ]
null
null
null
from stable_baselines3.ppo.ppo import PPO from snake_ruim.envs.snake_ruim import snake_env import gym def main(): #creating env env = gym.make("SnakeRuim-v0", size=20) #creating and training model model = PPO("MultiInputPolicy", env, verbose=1).learn(500000) # Test the trained agent obs = env.reset() n_steps = 100 for step in range(n_steps): action, _ = model.predict(obs, deterministic=True) print("Step {}".format(step + 1)) print("Action: ", action) obs, reward, done, _ = env.step(action) print('obs=', obs, 'reward=', reward, 'done=', done) env.render(mode='console') if done: # Note that the VecEnv resets automatically # when a done signal is encountered print("Goal reached!", "reward=", reward) break if __name__ == "__main__": main()
27.060606
65
0.608063
b2a404aacefa2a4ddf0ece264bd7c5866901a048
779
css
CSS
src/ChatScreen.css
lakshh07/tinder-clone
c4254306b8d11fe1949db97f82ccadc872410aa7
[ "MIT" ]
null
null
null
src/ChatScreen.css
lakshh07/tinder-clone
c4254306b8d11fe1949db97f82ccadc872410aa7
[ "MIT" ]
null
null
null
src/ChatScreen.css
lakshh07/tinder-clone
c4254306b8d11fe1949db97f82ccadc872410aa7
[ "MIT" ]
null
null
null
.chatScreen_chat { margin-left: 10px; background-color: lightgray; padding: 15px; border-radius: 20px; } .chatScreen { padding-bottom: 40px; } .chatScreen_chatUser { margin-left: auto; padding: 15px; background-color: #29b3cd; color: white; border-radius: 20px; } .chatScreen_timestamp { text-align: center; padding: 20px; color: gray; } .chatScreen_message { display: flex; align-items: center; padding: 20px; } .chatScreen_input { display: flex; padding: 5px; position: fixed; bottom: 0; width: 100%; border-top: 1px solid lightgrey; } .chatScreen_inputField { flex: 1; padding: 10px; border: none; } .input_button { border: none; margin-right: 20px; background-color: white; font-weight: bolder; color: #fe3d71; }
15.897959
34
0.681643
4db1a08640be1d3ae79665423a39e9d088c4b5be
1,730
cs
C#
Obscur.Core/Cryptography/KeyDerivation/KdfInformationStore.cs
xorxornop/ObscurCore
198e3b41fd85250ffa07c6c30616432074908445
[ "Apache-2.0" ]
3
2016-09-06T20:31:43.000Z
2019-06-13T00:21:55.000Z
Obscur.Core/Cryptography/KeyDerivation/KdfInformationStore.cs
zenith-nz/ObscurCore
198e3b41fd85250ffa07c6c30616432074908445
[ "Apache-2.0" ]
null
null
null
Obscur.Core/Cryptography/KeyDerivation/KdfInformationStore.cs
zenith-nz/ObscurCore
198e3b41fd85250ffa07c6c30616432074908445
[ "Apache-2.0" ]
3
2017-11-01T05:26:56.000Z
2018-03-06T19:33:20.000Z
// // Copyright 2013 Matthew Ducker // // 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. using System.Collections.Generic; using System.Collections.Immutable; using Obscur.Core.Cryptography.KeyDerivation.Information; namespace Obscur.Core.Cryptography.KeyDerivation { internal static class KdfInformationStore { internal static readonly ImmutableDictionary<KeyDerivationFunction, KdfInformation> KdfDictionary; static KdfInformationStore() { KdfDictionary = ImmutableDictionary.CreateRange(new[] { new KeyValuePair<KeyDerivationFunction, KdfInformation>( KeyDerivationFunction.Pbkdf2, new KdfInformation { Name = KeyDerivationFunction.Pbkdf2.ToString(), DisplayName = "Password-Based Key Derivation Function 2 (PBKDF2)" }), new KeyValuePair<KeyDerivationFunction, KdfInformation>( KeyDerivationFunction.Scrypt, new KdfInformation { Name = KeyDerivationFunction.Scrypt.ToString(), DisplayName = "Scrypt" }) }); } } }
40.232558
106
0.653179
dc02116e62d24d63faa40822f4de2f2f7c58368f
868
gemspec
Ruby
local_tunnel.gemspec
lloeki/localtunnel-rb
4c012495ffcc7be9476ff559d7526704791663f4
[ "BSD-3-Clause" ]
1
2017-12-08T16:33:02.000Z
2017-12-08T16:33:02.000Z
local_tunnel.gemspec
lloeki/local_tunnel
4c012495ffcc7be9476ff559d7526704791663f4
[ "BSD-3-Clause" ]
null
null
null
local_tunnel.gemspec
lloeki/local_tunnel
4c012495ffcc7be9476ff559d7526704791663f4
[ "BSD-3-Clause" ]
null
null
null
# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'local_tunnel' s.version = '0.2.0' s.licenses = ['3BSD'] s.summary = 'Expose yourself to the world from Ruby' s.authors = ['Loic Nageleisen'] s.email = 'loic.nageleisen@gmail.com' s.bindir = 'bin' s.executables << 'local_tunnel' s.files = Dir['lib/**/*.rb'] + Dir['bin/*'] s.files += Dir['[A-Z]*'] + Dir['test/**/*'] s.description = <<-EOT Localtunnel allows you to easily share a web service on your local development machine without messing with DNS and firewall settings. EOT s.required_ruby_version = '>= 2.3' s.add_development_dependency 'minitest', '~> 5.10' s.add_development_dependency 'sinatra', '~> 2.0' s.add_development_dependency 'pry' s.add_development_dependency 'rake', '~> 12.0' end
33.384615
71
0.629032
b18dff3e93d1d1cf652430d972246f3905bb1fda
2,482
swift
Swift
src/xcode/ENA/ENA/Source/Scenes/Checkin/Overview/Cells/__tests__/CheckinCellModelTests.swift
ssp/cwa-app-ios
e40534ba11c72144e11dffa3ca72e5e64c09ef29
[ "Apache-2.0", "MIT" ]
null
null
null
src/xcode/ENA/ENA/Source/Scenes/Checkin/Overview/Cells/__tests__/CheckinCellModelTests.swift
ssp/cwa-app-ios
e40534ba11c72144e11dffa3ca72e5e64c09ef29
[ "Apache-2.0", "MIT" ]
null
null
null
src/xcode/ENA/ENA/Source/Scenes/Checkin/Overview/Cells/__tests__/CheckinCellModelTests.swift
ssp/cwa-app-ios
e40534ba11c72144e11dffa3ca72e5e64c09ef29
[ "Apache-2.0", "MIT" ]
null
null
null
//// // 🦠 Corona-Warn-App // import XCTest @testable import ENA class CheckinCellModelTests: XCTestCase { func testGIVEN_CheckInCellModel_THEN_InitialStateIsAsExpected() { // GIVEN let checkin = Checkin.mock( id: 0, traceLocationDescription: "Sportstudio", traceLocationAddress: "Musterstraße 1a, 01234 Musterstadt", checkinStartDate: Date(timeIntervalSince1970: 1616074184) ) let cellViewModel = CheckinCellModel( checkin: checkin, eventCheckoutService: EventCheckoutService(eventStore: MockEventStore(), contactDiaryStore: MockDiaryStore()), onUpdate: {} ) // THEN XCTAssertEqual(cellViewModel.checkin, checkin) XCTAssertTrue(cellViewModel.isInactiveIconHiddenPublisher.value) XCTAssertFalse(cellViewModel.isActiveContainerViewHiddenPublisher.value) XCTAssertTrue(cellViewModel.isActiveIconHidden) XCTAssertFalse(cellViewModel.isDurationStackViewHidden) XCTAssertFalse(cellViewModel.isButtonHiddenPublisher.value) XCTAssertEqual(cellViewModel.title, "Sportstudio") XCTAssertEqual(cellViewModel.address, "Musterstraße 1a, 01234 Musterstadt") } func testGIVEN_CheckInCellModel_WHEN_UpdateWithChecking_THEN_NewCheckInIsSet() { // GIVEN let checkin = Checkin.mock( id: 0, traceLocationDescription: "Sportstudio", traceLocationAddress: "Musterstraße 1a, 01234 Musterstadt", checkinStartDate: Date(timeIntervalSince1970: 1616074184) ) let cellViewModel = CheckinCellModel( checkin: checkin, eventCheckoutService: EventCheckoutService(eventStore: MockEventStore(), contactDiaryStore: MockDiaryStore()), onUpdate: {} ) // WHEN let updatedCheckin = Checkin.mock( id: 0, traceLocationDescription: "Sportstudio", traceLocationAddress: "Musterstraße 1a, 01234 Musterstadt", checkinStartDate: Date(timeIntervalSince1970: 1616074184), checkinEndDate: Date(timeIntervalSince1970: 1616074530), checkinCompleted: true ) cellViewModel.update(with: updatedCheckin) // THEN XCTAssertEqual(cellViewModel.checkin, updatedCheckin) XCTAssertFalse(cellViewModel.isInactiveIconHiddenPublisher.value) XCTAssertTrue(cellViewModel.isActiveContainerViewHiddenPublisher.value) XCTAssertTrue(cellViewModel.isActiveIconHidden) XCTAssertFalse(cellViewModel.isDurationStackViewHidden) XCTAssertTrue(cellViewModel.isButtonHiddenPublisher.value) XCTAssertEqual(cellViewModel.title, "Sportstudio") XCTAssertEqual(cellViewModel.address, "Musterstraße 1a, 01234 Musterstadt") } }
32.657895
113
0.800161
c6b4f11b30af14592615d05eb0ac498471e97e29
10,078
java
Java
src/model/agent/DecisionContext.java
epedroni/crime-prevention-model
895b76f1b62b0ea62f478fbaab73bcc9eda5d268
[ "MIT" ]
null
null
null
src/model/agent/DecisionContext.java
epedroni/crime-prevention-model
895b76f1b62b0ea62f478fbaab73bcc9eda5d268
[ "MIT" ]
null
null
null
src/model/agent/DecisionContext.java
epedroni/crime-prevention-model
895b76f1b62b0ea62f478fbaab73bcc9eda5d268
[ "MIT" ]
null
null
null
package model.agent; import java.util.List; import java.util.logging.Logger; import model.Model; import model.Parameters; import model.action.Direction; import model.pathfinding.PathFinder; import model.world.Cell; import model.world.WorldWrapper; import utils.Utils; /** * This class provides a number of helper methods for agents to assess their * surroundings when making their move. */ public class DecisionContext { private static Logger log = Utils.getConsoleLogger(DecisionContext.class); private WorldWrapper world; private Agent agent; private PathFinder pathFinder; private Parameters parameters; private Cell randomDestination = null; DecisionContext(WorldWrapper worldWrapper, PathFinder pathFinder, Parameters parameters) { this.world = worldWrapper; this.pathFinder = pathFinder; this.parameters = parameters; } /** * DI due to the circular dependency between this and Agent. * Do not call this more than once! */ void setAgent(Agent agent) { if (this.agent == null) { this.agent = agent; // get the first random route here (or at least get the computation started) randomDestination = world.getRandomCell(c -> !world.isMovementObstruction(c.x, c.y)); } else { throw new IllegalStateException("RTFM!"); } } /** * Returns true if the cell at the specified position is of a type that * obstructs movement. This does not take into account cell occupancy; in * other words, an occupied cell is NOT a movement obstruction, even though * it cannot be entered. * * This is not very useful on its own, but it is used as a primitive for the * more sophisticated context helpers. * * Also returns true if the coordinates provided are out of bounds. */ public boolean isMovementObstruction(Direction direction) { return world.isMovementObstruction(agent.x + direction.x, agent.y + direction.y); } /** * Returns true if the cell at the specified position is of a type that * obstructs view. * * This is not very useful on its own, but it is used as a primitive for the * more sophisticated context helpers. * * Also returns true if the coordinates provided are out of bounds. */ public boolean isViewObstruction(Direction direction) { return world.isViewObstruction(agent.x + direction.x, agent.y + direction.y); } /** * Returns true if the cell at the specified position has an assigned * occupant. This is not very useful on its own, but it is used as a * primitive for the more sophisticated context helpers. * * Returns false if the coordinates provided are out of bounds. */ public boolean isOccupied(Direction direction) { return world.isOccupied(agent.x + direction.x, agent.y + direction.y); } /** * Returns true if the specified cell is free to be occupied. This takes * into account both whether the cell type is an obstruction and whether the * cell is already occupied by another agent. * * If the coordinate is not within the bounds of the world, this returns * false. */ public boolean isFree(Direction direction) { return world.isFree(agent.x + direction.x, agent.y + direction.y); } /** * Returns the light value at the agent's current position. */ public double getLight() { return world.getLight(agent.x, agent.y); } /** * Returns the light value at the specified position. If the position is not * within the bounds of the world, this returns 0. */ public double getLight(Direction direction) { return world.getLight(agent.x + direction.x, agent.y + direction.y); } /** * Returns a list of every cell the agent sees if it looks at the specified * coordinates. This takes into account view obstructions; the agent cannot * see past cells which obstruct its view. The first cell in the list is the * cell where the agent is located. If no obstructions are found, the * returned list contains the line of cells up to the agent's vision range. * If the specified coordinate is reached within the agent's vision range, * only the cells up to the coordinate are returned. * * If the specified position is not within the bounds of the map, an empty * list is returned. */ public List<Cell> look(int x, int y) { return world.look(agent.x, agent.y, x, y, agent.visionRange); } /** * Returns true if the specified cell is visible, false otherwise. This * takes into account visibility obstructions and the agent's vision range. */ public boolean isVisible(int x, int y) { return world.isVisible(agent.x, agent.y, x, y, agent.visionRange); } /** * Returns a list of agents surrounding this agent, in ascending order of * proximity. */ public List<Agent> getAgentsInSight() { return world.getAgentsAround(agent.x, agent.y, agent.visionRange, agent -> true); } /** * Returns a list of agents surrounding this agent, in descending order of * proximity (nearest first). */ public List<Agent> getWitnessesInSight() { return world.getAgentsAround(agent.x, agent.y, agent.visionRange, a -> a.getState() != AgentState.STALKING); } /** * Returns a list of agents around this agent which satisfy this agent's * criminal preconditions, in descending order of proximity (nearest first). */ public List<Agent> getPotentialVictims() { return world.getAgentsAround(agent.x, agent.y, agent.visionRange, this::wouldRobAgent); } /** * Returns a potential victim, if any are around. Otherwise, returns null. */ public Agent getVictim() { // TODO could optimise this by first checking if the agent is likely to commit crimes at all List<Agent> victims = getPotentialVictims(); if (victims.isEmpty()) { return null; } else { victims.sort((a1, a2) -> a1.apparentWealth > a2.apparentWealth ? -1 : a1.apparentWealth < a2.apparentWealth ? 1 : 0); log.fine(String.format("Found victim for %s: %s", agent, victims.get(0))); return victims.get(0); } } /** * Returns a route to the specified position, from the agent's location. * This may return null if the route is not ready yet. When a route is * computed, this will return it. */ public List<Direction> getRoute(int x, int y) { return world.withinBounds(x, y) && !world.isMovementObstruction(x, y) ? pathFinder.computePath(agent.x, agent.y, x, y) : null; } /** * Requests a route to a random, valid position in the world, starting from * the agent's position. The route might be computed in parallel to the model, * so this method may null until the route is ready. At that point, it * returns the route. */ public List<Direction> getRandomRoute() { // if we are not waiting for a route, request one if (randomDestination == null) { randomDestination = world.getRandomCell(c -> !world.isMovementObstruction(c.x, c.y)); log.finest(String.format("New random destination: [%s, %s]", randomDestination.x, randomDestination.y)); } List<Direction> route = getRoute(randomDestination.x, randomDestination.y); if (route != null) { randomDestination = null; } return route; } /** * Returns the necessary steps for the agent to get to the position of the * provided target agent, in order. * * This may return null if the route is not ready yet. When a route is * computed, this will return it. */ public List<Direction> getRouteToAgent(Agent targetAgent) { return getRoute(targetAgent.x, targetAgent.y); } /** * Prepends additional steps to the specified route in order to avoid * an immediate obstruction. This only works within the agent's vision * range; if the detour would exceed that, then this returns false and * the route is unchanged. Otherwise, this returns true and the route * is changed. */ public boolean dodgeObstruction(List<Direction> currentRoute) { return pathFinder.computeDetour(agent.x, agent.y, (int) agent.visionRange, currentRoute); } /** * Returns the occupant of the specified cell, if any. If the cell has no * occupant, returns null. */ public Agent getOccupant(Direction direction) { return world.getOccupant(agent.x + direction.x, agent.y + direction.y); } /** * Returns true if this agent would rob the provided victim, false otherwise. */ public boolean wouldRobAgent(Agent victim) { // this is the agent's inclination to rob double wouldRob = ((agent.age * parameters.ageWeight) + (agent.education * parameters.educationWeight) + (agent.income * parameters.incomeWeight) + (Model.rand.nextDouble() * parameters.wouldRobRandomWeight)) / parameters.totalWouldRobWeight; return wouldRob < victim.apparentWealth && victim.getState() != AgentState.STALKING; } /** * Returns true if the conditions around the agent are conducive * to criminal activities. */ public boolean conditionsAreRight() { double lightThreshold = ((parameters.crimeLightThreshold * parameters.lightWeight) + (Model.rand.nextDouble() * parameters.lightRandomWeight)) / parameters.totalConditionsWeight; return getLight() < lightThreshold && getWitnessesInSight().size() <= parameters.maxWitnessesInSight; } }
37.887218
129
0.649236
2eb36ffce155c9e8a8ee7b4d63d20f2b7fd2d75e
9,245
rs
Rust
src/frontend/ui/conrod_ui.rs
itadinanta/rust-oids
af8151d5ff182011cfff4273500f314048741988
[ "Apache-2.0" ]
159
2016-08-22T12:13:04.000Z
2022-02-08T08:53:54.000Z
src/frontend/ui/conrod_ui.rs
itadinanta/rust-oids
af8151d5ff182011cfff4273500f314048741988
[ "Apache-2.0" ]
10
2017-06-13T21:26:34.000Z
2020-01-14T12:45:36.000Z
src/frontend/ui/conrod_ui.rs
itadinanta/rust-oids
af8151d5ff182011cfff4273500f314048741988
[ "Apache-2.0" ]
8
2017-02-26T03:41:48.000Z
2022-01-17T18:41:21.000Z
use super::conrod_gfx; use super::{theme, Error, Screen}; use app; use conrod::widget::button; use conrod::widget::text; use conrod::{self, event, widget, Colorable, Labelable, Positionable, Sizeable, Widget}; use core::resource::ResourceLoader; use frontend::render::formats; use gfx::handle::{RenderTargetView, ShaderResourceView}; use gfx::{CommandBuffer, Encoder, Factory, Resources}; use std::io; use std::vec::Drain; #[derive(Clone, Debug)] pub struct WidgetIdGroup { panel_row_id: widget::Id, panel_id: widget::Id, label_id: widget::Id, value_id: widget::Id, } #[derive(Clone, Debug)] pub struct Ids { help_canvas: widget::Id, help_text: widget::Id, hud_speed_button: widget::Id, hud_canvas: widget::Id, hud_labels: Vec<WidgetIdGroup>, } pub type ImageMap<R> = conrod::image::Map<(ShaderResourceView<R, [f32; 4]>, (u32, u32))>; #[derive(Clone, Debug)] pub struct Styles { pub label: text::Style, pub value: text::Style, pub button: button::Style, } pub struct Ui<'f, 'font, R, F> where R: Resources, F: Factory<R> + 'f, { factory: &'f mut F, renderer: conrod_gfx::Renderer<'font, R>, ui: Box<conrod::Ui>, image_map: ImageMap<R>, win_w: u16, win_h: u16, hidpi_factor: f64, styles: Styles, ids: Ids, app_events: Vec<app::Event>, events: Vec<event::Input>, } impl From<conrod::text::font::Error> for Error { fn from(_: conrod::text::font::Error) -> Error { Error::FontLoader } } impl From<io::Error> for Error { fn from(_: io::Error) -> Error { Error::ResourceLoader } } impl Screen { fn draw_widgets<'e>( &self, ui: &'e mut conrod::Ui, root_window_id: widget::Id, styles: &Styles, ids: &Ids, app_events: &mut Vec<app::Event>, ) -> conrod::UiCell<'e> { let mut widgets = ui.set_widgets(); //let mut app_events = Vec::with_capacity(1); match *self { Screen::Help => { let help_text = "Text help"; widget::Canvas::new() .pad(10.0) .color(conrod::color::CHARCOAL.alpha(0.4)) .middle_of(root_window_id) .scroll_kids_vertically() .set(ids.help_canvas, &mut widgets); widget::Text::new(&help_text) .middle_of(ids.help_canvas) .with_style(styles.label) .set(ids.help_text, &mut widgets); } Screen::Main(ref frame_update) => { let splits = ids .hud_labels .iter() .map(|&WidgetIdGroup { panel_row_id, .. }| { (panel_row_id, widget::Canvas::new().color(conrod::color::TRANSPARENT)) }) .collect::<Vec<_>>(); widget::Canvas::new() .pad(50.0) .color(conrod::color::TRANSPARENT) .kid_area_w_of(root_window_id) .mid_top() .flow_down(&splits) .set(ids.hud_canvas, &mut widgets); let mut ids_iter = ids.hud_labels.iter(); let txt_with_label = |ids_iter: &mut dyn Iterator<Item = &WidgetIdGroup>, mut widgets: &mut conrod::UiCell<'e>, label: &str, value: &str| -> widget::Id { let WidgetIdGroup { panel_id, label_id, value_id, panel_row_id } = ids_iter.next().unwrap().clone(); widget::Canvas::new() .mid_left_of(panel_row_id) .pad(10.0) .color(conrod::color::CHARCOAL.alpha(0.4)) .w(300.0) .h(60.0) .set(panel_id, &mut widgets); widget::Text::new(label).mid_left_of(panel_id).with_style(styles.label).set(label_id, &mut widgets); widget::Text::new(value) .mid_right_of(panel_id) .with_style(styles.value) .set(value_id, &mut widgets); panel_id }; let button_with_label = |ids_iter: &mut dyn Iterator<Item = &WidgetIdGroup>, mut widgets: &mut conrod::UiCell<'e>, label: &str, value: &str| -> bool { let WidgetIdGroup { panel_id, label_id, value_id, panel_row_id } = ids_iter.next().unwrap().clone(); widget::Canvas::new() .mid_left_of(panel_row_id) .pad(10.0) .color(conrod::color::CHARCOAL.alpha(0.4)) .w(300.0) .h(60.0) .set(panel_id, &mut widgets); let pressed = widget::Button::new() .label(label) .mid_left_of(panel_id) .kid_area_w_of(panel_id) .with_style(styles.button) .set(label_id, &mut widgets) .was_clicked(); widget::Text::new(value) .mid_right_of(panel_id) .with_style(styles.value) .set(value_id, &mut widgets); pressed }; txt_with_label( &mut ids_iter, &mut widgets, "Sim Frames", &format!("{}", frame_update.simulation.count), ); txt_with_label(&mut ids_iter, &mut widgets, "Vid Frames", &format!("{}", frame_update.count)); txt_with_label(&mut ids_iter, &mut widgets, "Elapsed", &format!("{:.3}", frame_update.elapsed)); txt_with_label(&mut ids_iter, &mut widgets, "Sim dt", &format!("{:.3}", frame_update.simulation.dt)); txt_with_label(&mut ids_iter, &mut widgets, "Vid dt", &format!("{:.3}", frame_update.dt)); if button_with_label(&mut ids_iter, &mut widgets, ">>", &format!("x{}", frame_update.speed_factor)) { info!("Button pressed"); app_events.push(app::Event::PrevSpeedFactor); } txt_with_label(&mut ids_iter, &mut widgets, "Avg dt", &format!("{:.3}", frame_update.duration_smooth)); txt_with_label(&mut ids_iter, &mut widgets, "FPS", &format!("{:.1}", frame_update.fps)); txt_with_label( &mut ids_iter, &mut widgets, "Population", &format!("{}", frame_update.simulation.population), ); txt_with_label( &mut ids_iter, &mut widgets, "Extinctions", &format!("{}", frame_update.simulation.extinctions), ); } }; widgets } } impl<'f, 'font, R, F> Ui<'f, 'font, R, F> where R: Resources, F: Factory<R> + 'f, { pub fn new<'e, L>( res: &L, factory: &'e mut F, frame_buffer: &RenderTargetView<R, formats::ScreenColorFormat>, hidpi_factor: f64, ) -> Result<Ui<'f, 'font, R, F>, Error> where L: ResourceLoader<u8>, 'e: 'f, { let renderer = conrod_gfx::Renderer::new(factory, frame_buffer, hidpi_factor).unwrap(); let image_map = conrod::image::Map::new(); let (w, h, _, _) = frame_buffer.get_dimensions(); let mut ui = conrod::UiBuilder::new([f64::from(w), f64::from(h)]).theme(theme::default_theme()).build(); Self::load_font(res, &mut ui.fonts, "fonts/FreeSans.ttf")?; let style_label = text::Style { color: Some(conrod::color::LIGHT_GRAY), font_size: Some(14), ..Default::default() }; let style_button = button::Style { label_color: Some(conrod::color::LIGHT_GRAY), label_font_size: Some(14), label_justify: Some(conrod::text::Justify::Left), label_x: Some(conrod::position::Relative::Align(conrod::position::Align::Start)), ..Default::default() }; let style_value = text::Style { color: Some(conrod::color::GREEN), font_size: Some(14), ..Default::default() }; const MAX_HUD_LABELS: usize = 10; let ids = Ids { help_canvas: ui.widget_id_generator().next(), help_text: ui.widget_id_generator().next(), hud_speed_button: ui.widget_id_generator().next(), hud_canvas: ui.widget_id_generator().next(), hud_labels: (0..MAX_HUD_LABELS) .map(|_| WidgetIdGroup { panel_row_id: ui.widget_id_generator().next(), panel_id: ui.widget_id_generator().next(), label_id: ui.widget_id_generator().next(), value_id: ui.widget_id_generator().next(), }) .collect(), }; Ok(Ui { factory, renderer, ui: Box::new(ui), image_map, win_w: w, win_h: h, hidpi_factor, styles: Styles { label: style_label, value: style_value, button: style_button }, ids, app_events: Vec::new(), events: Vec::new(), }) } pub fn resize_to(&mut self, frame_buffer: &RenderTargetView<R, formats::ScreenColorFormat>) -> Result<(), Error> { let (width, height, _, _) = frame_buffer.get_dimensions(); self.win_w = width; self.win_h = height; self.renderer = conrod_gfx::Renderer::new(self.factory, frame_buffer, self.hidpi_factor).unwrap(); Ok(()) } fn load_font<L>(res: &L, map: &mut conrod::text::font::Map, key: &str) -> Result<conrod::text::font::Id, Error> where L: ResourceLoader<u8> { let font_bytes = res.load(key)?; let font_collection = conrod::text::FontCollection::from_bytes(font_bytes); let default_font = font_collection.into_font().ok_or(Error::FontLoader)?; let id = map.insert(default_font); Ok(id) } pub fn update_and_draw_screen<C>(&mut self, screen: &Screen, encoder: &mut Encoder<R, C>) where C: CommandBuffer<R> { let dims = (f32::from(self.win_w), f32::from(self.win_h)); let window_id = self.ui.window; let mut app_events = Vec::with_capacity(1); let widgets = screen.draw_widgets(&mut self.ui, window_id, &self.styles, &self.ids, &mut app_events); let primitives = widgets.draw(); self.renderer.fill(encoder, dims, primitives, &self.image_map); self.renderer.draw(self.factory, encoder, &self.image_map); self.app_events.extend(app_events); } pub fn push_event(&mut self, event: event::Input) { self.events.push(event); } pub fn drain_app_events(&mut self) -> Drain<app::Event> { self.app_events.drain(..) } pub fn handle_events(&mut self) { for event in &self.events { self.ui.handle_event(event.clone()) } self.events.clear(); } }
30.511551
115
0.641644
b954ef3a2b1569c0f6d6bc278cdf819e54014ab6
5,381
php
PHP
app/views/partials/notices.php
unikent/of-course
10200d749dc6bbd315d68951555946e8b02026a3
[ "MIT" ]
null
null
null
app/views/partials/notices.php
unikent/of-course
10200d749dc6bbd315d68951555946e8b02026a3
[ "MIT" ]
160
2015-01-05T11:35:56.000Z
2020-01-06T11:28:27.000Z
app/views/partials/notices.php
unikent/of-course
10200d749dc6bbd315d68951555946e8b02026a3
[ "MIT" ]
null
null
null
<?php if(isset($preview) && $preview == true):?> <div class="alert alert-warning"> You are currently viewing a preview of revision <?php echo $course->revision_id; ?>. This is preview data ONLY and is not representative of any course offered by this institution. </div> <?php endif; ?> <?php if ( defined('CLEARING') && CLEARING && $level == 'undergraduate' ): ?> <?php if ( !isset($course) && $year == 'current' ): ?> <div class="alert alert-warning"> <strong>These pages are for undergraduate programmes starting in September <?php echo date('Y') + 1;?>.</strong> <br>If you are a <strong>Clearing</strong>, <strong>Adjustment</strong> or <strong>part-time</strong> applicant wishing to start this September, go to our <a href="/courses/undergraduate/<?php echo date('Y');?>/search/"><?php echo date('Y');?> search page</a>. </div> <?php elseif ( isset($course) && $course->current_year > $course->year ): ?> <div class="card card-backed-tertiary"> <div class="clearing-banner-container card-block"> <h2 class="col-lg-3 clearing-banner-title">CLEARING <?php echo $course->year;?></h2> <?php if (defined('CLEARING_EMBARGO') && CLEARING_EMBARGO):?> <div class="col-lg-8 clearing-banner-text">Planning to start this September? Our updated Clearing vacancy list will be available from 06.00 on Thursday 15 August, A-Level results publication day, following the end of the exam board embargo period.</div> <?php else:?> <div class="col-lg-5 clearing-banner-text">We may still have full-time vacancies available for this course.</div> <a class="col-lg-3" href="https://evision.kent.ac.uk/ipp/ClearingVacancyList.htm"><button type="button" class="btn btn-primary clearing-banner-search-button">Search Vacancies</button></a> <?php endif; ?> </div> </div> <?php elseif(isset($course) && $course->current_year == $course->year): $previous_year = $course->year-1; ?> <div class="card card-backed-tertiary"> <div class="clearing-banner-container card-block"> <h2 class="col-lg-3 clearing-banner-title">CLEARING <?php echo $previous_year;?></h2> <?php if (defined('CLEARING_EMBARGO') && CLEARING_EMBARGO):?> <div class="col-lg-8 clearing-banner-text">Planning to start this September? Our updated Clearing vacancy list will be available from 06.00 on Thursday 15 August, A-Level results publication day, following the end of the exam board embargo period.</div> <?php else:?> <div class="col-lg-8 clearing-banner-text">Planning to start this September? We may still have full-time vacancies available for this course. <a href="<?php echo "/courses/$level/$previous_year/$course->instance_id"; ?>">View 2019 course details.</a></div> <?php endif; ?> </div> </div> <?php endif; ?> <?php endif;?> <?php if(isset($course) && $course->current_year < $course->year): ?> <div class="alert alert-warning"> You are currently viewing a programme for an upcoming academic year. This data is preview ONLY and may not be representative of any course offered by this institution. </div> <?php endif;?> <?php /* * If current course year being viewed is over 2 years ago then display a message saying that it is archived. */ if (isset($course) && $course->year < $years->current -1) :?> <div class="card card-backed-tertiary"> <div class="card-block"> <h2 class=" clearing-banner-title">This is an archived page and for reference purposes only</h2> </div> </div> <?php /* * If current course year being viewed is 1 year ago and that course is not avaliable in the current academic year */ elseif (isset($course) && !in_array($course->current_year, $course->years) && ($course->year == $years->current -1)): ?> <div class="card card-backed-tertiary"> <div class="card-block"> <h2 class="clearing-banner-title"> This is a programme page for the academic year <?php echo format_academic_year($course->year)?>. </h2> <h2 class="clearing-banner-title"> We are not accepting applications for this programme for the academic year <?php echo format_academic_year($years->current) ?>. </h2> </div> </div> <?php endif;?> <?php if (defined('SHOW_UG_PREVIOUS_YEAR_BANNER') && SHOW_UG_PREVIOUS_YEAR_BANNER && $level == 'undergraduate' && isset($course) && $course->year > ($course->current_year)): ?> <div class="alert alert-warning"> <?php $previousYear = Flight::url("undergraduate/" . ($course->current_year - 1) . "/" . $course->instance_id); ?> This is a <?php echo $course->year;?> entry programme. Would you like to <a href='<?php echo $previousYear; ?>'> view <?php echo $course->programme_title;?> for <?php echo $course->current_year-1;?> entry?</a> </div> <?php endif;?> <?php if (isset($course) && ("true" == $course->globals->open_day_banner_display_banner)) : ?> <div class="card card-backed-tertiary"> <div class="card-block open-days-banner-container"> <h2 class="open-days-banner-title"><?php echo $course->globals->open_day_banner_heading?></h2> <div class="open-days-banner-text"><?php echo $course->globals->open_day_banner_text ?></div> <a href="<?php echo $course->globals->open_day_banner_target_url?>"> <button type="button" class="btn btn-primary open-days-banner-button"> <?php echo $course->globals->open_day_banner_call_to_action_button_text?> </button> </a> </div> </div> <?php endif; ?>
55.474227
264
0.687976
0306e1fbf483c740e77ce3b3c9d1113624148285
130
sh
Shell
build.sh
MakingL/rdb
7ca46642b540174dae8a92b91e967809697a13c4
[ "Apache-2.0" ]
121
2022-02-12T18:56:47.000Z
2022-03-31T16:44:42.000Z
build.sh
MakingL/rdb
7ca46642b540174dae8a92b91e967809697a13c4
[ "Apache-2.0" ]
1
2022-03-30T11:14:22.000Z
2022-03-30T11:14:22.000Z
build.sh
MakingL/rdb
7ca46642b540174dae8a92b91e967809697a13c4
[ "Apache-2.0" ]
22
2022-02-13T09:10:28.000Z
2022-03-31T16:19:48.000Z
#!/usr/bin/env bash CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o target/rdb-linux-amd64 ./ go build -o target/rdb-darwin ./
32.5
76
0.730769
695cac9e2c446d4feabddfc5e129816ecfffcfee
324
rb
Ruby
spec/shared_contexts/feature_helpers.rb
ilpoldo/user_plane
a7cb5b6cc81bf2e346ced1ea825782bb99c5922b
[ "MIT" ]
null
null
null
spec/shared_contexts/feature_helpers.rb
ilpoldo/user_plane
a7cb5b6cc81bf2e346ced1ea825782bb99c5922b
[ "MIT" ]
null
null
null
spec/shared_contexts/feature_helpers.rb
ilpoldo/user_plane
a7cb5b6cc81bf2e346ced1ea825782bb99c5922b
[ "MIT" ]
null
null
null
RSpec.shared_context 'feature_helpers' do # TODO: find a better way to mock being signed in def sign_in(account) visit polymorphic_path([User::SignIn.new], action: :new) fill_in 'Email', with: account.email.address fill_in 'Password', with: account.email.password click_button 'Sign In' end end
24.923077
60
0.712963
ce13b389ff02ef749aa54b598384476f8e384fdb
6,210
lua
Lua
gamemodes/ix_cotz/plugins/charcreation/sh_defs.lua
kristofferth/cotz
7d76c0214fbe8bbda6a8996697154d0feaf50f44
[ "MIT" ]
3
2021-12-15T12:49:33.000Z
2022-01-15T16:15:40.000Z
gamemodes/ix_cotz/plugins/charcreation/sh_defs.lua
kristofferth/cotz
7d76c0214fbe8bbda6a8996697154d0feaf50f44
[ "MIT" ]
1
2022-02-10T19:12:08.000Z
2022-02-10T19:36:02.000Z
gamemodes/ix_cotz/plugins/charcreation/sh_defs.lua
kristofferth/cotz
7d76c0214fbe8bbda6a8996697154d0feaf50f44
[ "MIT" ]
3
2021-12-07T00:34:43.000Z
2021-12-23T15:37:44.000Z
PLUGIN.stalkernames = { "Alex", "Alexander", "Alexei", "Anatoly", "Andrei", "Andryuha", "Anton", "Arkasha", "Arthur", "Artyom", "Bodya", "Bogdan", "Borka", "Borya", "Boryan", "Danila", "Danko", "Danya", "Denis", "Dima", "Dimka", "Dimon", "Dimuha", "Dmitro", "Dmitry", "Edik", "Egor", "Egorka", "Fedka", "Fedya", "Felka", "Filka", "Filya", "Fima", "Fimka", "Fyodor", "Gena", "Genka", "Georg", "German", "Gleb", "Gosha", "Grisha", "Grishka", "Grishko", "Igoryok", "Ilya", "Ilyuha", "Ivan", "Kolya", "Kolyan", "Konstantin", "Kostik", "Kostya", "Kostyan", "Lenka", "Lyoha", "Lyonya", "Lyosha", "Lyoshka", "Lyova", "Matvey", "Max", "Miha", "Mihal", "Mihas", "Misha", "Mishka", "Mitka", "Mitya", "Nik", "Nikita", "Oleg", "Oles", "Pasha", "Pashka", "Pavluha", "Petka", "Petro", "Petruha", "Petya", "Roma", "Roman", "Romka", "Rostik", "Rus", "Ruslan", "Sanya", "Sanyok", "Sasha", "Sava", "Semyon", "Senya", "Sergei", "Seryoga", "Seva", "Sevka", "Shurik", "Slava", "Slavik", "Stepa", "Stepan", "Stepuha", "Styopka", "Syoma", "Tima", "Timka", "Timoha", "Toha", "Tolay", "Tolik", "Toshka", "Tyomka", "Vadik", "Vadim", "Vadya", "Valera", "Valik", "Vanka", "Vanya", "Vasek", "Vaska", "Vasko", "Vasya", "Vasyan", "Veniamin", "Venya", "Vetal", "Vitalik", "Vitaly", "Vitka", "Vitya", "Vityuha", "Vlad", "Vladimir", "Vova", "Vovan", "Vovka", "Yara", "Yarik", "Yasha", "Yashka", "Yura", "Yuras", "Yurka", "Yurko", "Yury", "Zheka", "Zhenka", "Zhenya", "Zhora", "Zhorka", } PLUGIN.stalkersnames = { "Abdurhmanov", "Alfyorov", "Altynnik", "Andreychuk", "Andreyev", "Andruschenko", "Aniseyev", "Antipin", "Ardashev", "Babich", "Balan", "Balitsky", "Baranov", "Baranovsky", "Barsak", "Bashakov", "Bashmakov", "Baul", "Belyavin", "Beshevliy", "Binoyev", "Blinov", "Bobrov", "Bogdanov", "Bogomolov", "Boldeskul", "Boldskul", "Bondarev", "Borisov", "Boychenko", "Boyko", "Brich", "Bronshtein", "Buryak", "Buturin", "Byalo", "Chernodub", "Chirikov", "Denisenko", "Dombrik", "Dotsenko", "Dovgalyuk", "Drozdush", "Dubenchuk", "Dudorov", "Duka", "Dumko", "Dunayev", "Dyakonov", "Dyklov", "Efremov", "Erofeyev", "Erohin", "Fadeyev", "Feygelman", "Galkin", "Ganzyuk", "Garkovenko", "Garkusha", "Gatsula", "Gatsula", "Georgov", "Geshkenbein", "Glebovsky", "Gnatyuk", "Goncharenko", "Gordiyenko", "Gorlevoy", "Gorohin", "Goryunov", "Grebenyuk", "Grischuk", "Grishachev", "Gritsay", "Gritsayenko", "Gritsenko", "Gubar", "Gunko", "Gurevich", "Ignatenko", "Ischuk", "Ivanov", "Ivchenko", "Izhenko", "Kabanov", "Kandybabko", "Kapuka", "Kapustyanko", "Katz", "Kazakov", "Kazantsev", "Khaladze", "Kikabidze", "Kireyev", "Klimenko", "Kolontar", "Kolontarev", "Kondratenko", "Korkin", "Korneyev", "Kovalchuk", "Koyev", "Kozlov", "Kravchenko", "Krivda", "Krivohatsky", "Kucheruk", "Kulchitsky", "Kuntsev", "Kurvits", "Kushnaryov", "Kuzmich", "Kuznetsov", "Kuzyakin", "Larin", "Lavrik", "Lavrov", "Ledentsov", "Lisichansky", "Litvin", "Livshits", "Lymarenko", "Makarenko", "Maltsev", "Mamayev", "Manko", "Mazepa", "Merzlyayev", "Milchenko", "Mironov", "Mironyuk", "Morer", "Morozov", "Mostovoy", "Muhamedov", "Muntyan", "Myskov", "Navrotsky", "Nepritsky", "Nikanorov", "Nikeshin", "Nikulin", "Nordiyev", "Nosan", "Novikov", "Oganesyan", "Opolev", "Orlevich", "Orlov", "Petkevich", "Petrenko", "Petrov", "Plohenko", "Podyachev", "Polyanin", "Poplavsky", "Popov", "Portnyh", "Prasolov", "Prokopenko", "Proskurin", "Protsenko", "Prudov", "Puchek", "Pustovar", "Rabinovich", "Radkevich", "Rezun", "Rodnyansky", "Rogoza", "Rotan", "Rublev", "Rudik", "Rusanov", "Rychagirsky", "Sabchenko", "Sagitov", "Savchenko", "Savchuk", "Sedyh", "Sereda", "Shilov", "Sidorenko", "Sidorov", "Sinayev", "Sinitsyn", "Siniy", "Skameyka", "Slutsky", "Smelov", "Smoliy", "Sorokin", "Spirin", "Statsyura", "Steklov", "Stepanenko", "Stepchin", "Stichinsky", "Sviridov", "Sykula", "Tarnavsky", "Tatarchuk", "Timchuk", "Valentinov", "Vasilevich", "Vasiliev", "Veselov", "Vinogradov", "Volanchuk", "Volodar", "Voloshin", "Vorohayev", "Vorontsov", "Vovnenko", "Vyushinsky", "Zabiyagoda", "Zagorodnyuk", "Zaharin", "Zaharov", "Zaikin", "Zamosenchuk", "Zarubin", "Zhabenko", "Zhmiyev", "Zhurakovsky", "Zolotar", "Zonovyev", "Zozo", "Zubarev", "Zubkov", "Zvonnitsky", } PLUGIN.pdaavatars = { -- gasmaskless, balaclava loners "propic/loner/loner1", "propic/loner/loner100", "propic/loner/loner11", "propic/loner/loner12", "propic/loner/loner13", "propic/loner/loner14", "propic/loner/loner16", "propic/loner/loner17", "propic/loner/loner3", "propic/loner/loner47", "propic/loner/loner53", "propic/loner/loner62", "propic/loner/loner63", "propic/loner/loner79", "propic/loner/loner8", "propic/loner/loner80", "propic/loner/loner81", "propic/loner/loner83", "propic/loner/loner84", "propic/loner/loner85", "propic/loner/loner86", "propic/loner/loner87", "propic/loner/loner90", "propic/loner/loner96", "propic/loner/loner98", --gasmaskless, no balaclava loners, some story chars "propic/loner/loner19", "propic/loner/loner20", "propic/loner/loner21", "propic/loner/loner22", "propic/loner/loner23", "propic/loner/loner25", "propic/loner/loner26", "propic/loner/loner27", "propic/loner/loner28", "propic/loner/loner29", "propic/loner/loner30", "propic/loner/loner31", "propic/loner/loner32", "propic/loner/loner33", "propic/loner/loner34", "propic/loner/loner35", "propic/loner/loner36", "propic/loner/loner38", "propic/loner/loner39", "propic/loner/loner4", "propic/loner/loner40", "propic/loner/loner41", "propic/loner/loner5", "propic/loner/loner6", "propic/loner/loner64", "propic/loner/loner65", "propic/loner/loner66", "propic/loner/loner67", "propic/loner/loner70", "propic/loner/loner71", "propic/loner/loner72", "propic/loner/loner9", "propic/loner/loner91", "propic/loner/loner92", "propic/loner/loner93", "propic/loner/loner94", }
13.648352
53
0.615298
2c44f8c820705815b98b0cfa11873deeeb859b47
1,445
py
Python
tobiko/openstack/nova/__init__.py
4383/tobiko
f8e6916db890021fa17ddbfc5e6007a25093c8cb
[ "Apache-2.0" ]
null
null
null
tobiko/openstack/nova/__init__.py
4383/tobiko
f8e6916db890021fa17ddbfc5e6007a25093c8cb
[ "Apache-2.0" ]
null
null
null
tobiko/openstack/nova/__init__.py
4383/tobiko
f8e6916db890021fa17ddbfc5e6007a25093c8cb
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Red Hat # # 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. from __future__ import absolute_import from tobiko.openstack.nova import _client from tobiko.openstack.nova import _hypervisor from tobiko.openstack.nova import _server CLIENT_CLASSES = _client.CLIENT_CLASSES get_console_output = _client.get_console_output get_nova_client = _client.get_nova_client get_server = _client.get_server find_hypervisor = _client.find_hypervisor find_server = _client.find_server HasNovaClientMixin = _client.HasNovaClientMixin list_hypervisors = _client.list_hypervisors list_servers = _client.list_servers nova_client = _client.nova_client NovaClientFixture = _client.NovaClientFixture skip_if_missing_hypervisors = _hypervisor.skip_if_missing_hypervisors find_server_ip_address = _server.find_server_ip_address HasServerMixin = _server.HasServerMixin list_server_ip_addresses = _server.list_server_ip_addresses
38.026316
78
0.815917
57fe8ddc63a4a1730faa16e3a5be139000897c69
1,934
php
PHP
database/seeds/DatabaseSeeder.php
KheangLov/hr_project
6038f90b32b852ff6ade214421a37fc9f13a1e69
[ "MIT" ]
null
null
null
database/seeds/DatabaseSeeder.php
KheangLov/hr_project
6038f90b32b852ff6ade214421a37fc9f13a1e69
[ "MIT" ]
4
2021-02-02T19:24:16.000Z
2022-02-19T06:28:21.000Z
database/seeds/DatabaseSeeder.php
KheangLov/hr_project
6038f90b32b852ff6ade214421a37fc9f13a1e69
[ "MIT" ]
null
null
null
<?php use Illuminate\Database\Seeder; use Faker\Generator as Faker; class DatabaseSeeder extends Seeder { /** * Seed the application's database. * * @return void */ public function run(Faker $faker) { // DB::table('roles')->insert([ // ['name' => 'admin'], // ['name' => 'user'] // ]); DB::table('departments')->insert([ ['name' => 'Web'] ]); DB::table('units')->insert([ [ 'name' => 'Develop', 'department_id' => 1 ] ]); DB::table('groups')->insert([ [ 'name' => 'Sonin', 'unit_id' => 1 ] ]); DB::table('positions')->insert([ [ 'name' => 'Manager', 'role' => 1 ] ]); DB::table('users')->insert([ [ 'name' => 'admin', 'name_khmer' => 'អេតមីន', 'gender' => 'male', 'dob' => '2000-10-02', 'status' => '1', 'email' => 'admin@gmail.com', 'email_verified_at' => $faker->dateTime($max = 'now', $timezone = null), 'password' => bcrypt('not4you'), 'role_id' => 1, 'annual_leave' => 18, 'back_account' => '123213213213', 'salary' => 1000, 'address' => 'wqewqewqewqewqewqe', 'department_id' => 1, 'unit_id' => 1, 'position_id' => 1, 'group_id' => 1, 'start_date' => $faker->dateTime($max = 'now', $timezone = null), 'created_at' => $faker->dateTime($max = 'now', $timezone = null), 'updated_at' => $faker->dateTime($max = 'now', $timezone = null) ] ]); } }
27.239437
88
0.380558
e433f1300e83330e95f43a3df457f829233b7b09
4,940
swift
Swift
Tests/ConsolidateTests/ConsolidatableTests.swift
SoftwareEngineerChris/Consolidate
1e815d732e2a1f55eb5743a2f4b094f0760a4852
[ "MIT" ]
null
null
null
Tests/ConsolidateTests/ConsolidatableTests.swift
SoftwareEngineerChris/Consolidate
1e815d732e2a1f55eb5743a2f4b094f0760a4852
[ "MIT" ]
null
null
null
Tests/ConsolidateTests/ConsolidatableTests.swift
SoftwareEngineerChris/Consolidate
1e815d732e2a1f55eb5743a2f4b094f0760a4852
[ "MIT" ]
null
null
null
// // ConsolidatableTests.swift // Consolidate // // Created by Chris Hargreaves on 28/09/2019. // Copyright © 2019 Software Engineering Limited. All rights reserved. // import XCTest @testable import Consolidate final class ConsolidatableTests: XCTestCase { // MARK: Consolidatable Protocol Implementation func test_emptyArray_returnsEmptyArray() { let consolidatedTaxes: [TaxAmount] = [].consolidated() XCTAssertEqual(consolidatedTaxes, []) } func test_usingConsolidatableProtocol_noConsolidabaleValues_doesNotConsolidate() { let consolidatedTaxes = [ TaxAmount(tax: "Import Tax", amount: 3.00), TaxAmount(tax: "Sales Tax", amount: 1.75), TaxAmount(tax: "Export Tax", amount: 2.30), TaxAmount(tax: "Income Tax", amount: 2.35) ].consolidated() XCTAssertEqual(consolidatedTaxes, [ TaxAmount(tax: "Import Tax", amount: 3.00), TaxAmount(tax: "Sales Tax", amount: 1.75), TaxAmount(tax: "Export Tax", amount: 2.30), TaxAmount(tax: "Income Tax", amount: 2.35) ]) } func test_usingConsolidatableProtocol_consolidabaleValues_consolidates() { let consolidatedTaxes = [ TaxAmount(tax: "Import Tax", amount: 3.00), TaxAmount(tax: "Sales Tax", amount: 1.75), TaxAmount(tax: "Import Tax", amount: 2.30) ].consolidated() XCTAssertEqual(consolidatedTaxes, [ TaxAmount(tax: "Import Tax", amount: 5.30), TaxAmount(tax: "Sales Tax", amount: 1.75) ]) } // MARK: By KeyPath func test_byKeyPath_consolidates() { let taxes = [ TaxAmount(tax: "Import Tax", amount: 3.00), TaxAmount(tax: "Sales Tax", amount: 1.75), TaxAmount(tax: "Import Tax", amount: 2.30) ].consolidated(by: \.tax) { TaxAmount(tax: $0.tax, amount: $0.amount + $1.amount) } XCTAssertEqual(taxes, [ TaxAmount(tax: "Import Tax", amount: 5.30), TaxAmount(tax: "Sales Tax", amount: 1.75) ]) } func test_byClosure_consolidates() { let taxes = [ TaxAmount(tax: "Import Tax", amount: 3.00), TaxAmount(tax: "Sales Tax", amount: 1.75), TaxAmount(tax: "Import Tax", amount: 2.30) ].consolidated(by: { $0.tax == $1.tax }) { TaxAmount(tax: $0.tax, amount: $0.amount + $1.amount) } XCTAssertEqual(taxes, [ TaxAmount(tax: "Import Tax", amount: 5.30), TaxAmount(tax: "Sales Tax", amount: 1.75) ]) } // MARK: consolidatedIntoSingle func test_consolidatedIntoSingle_canBeConsolidatedIntoSingle_returnsConsolidation() throws { let taxes = try [ TaxAmount(tax: "Import Tax", amount: 3.00), TaxAmount(tax: "Import Tax", amount: 2.30) ].consolidatedIntoSingle(by: \.tax) { TaxAmount(tax: $0.tax, amount: $0.amount + $1.amount) } XCTAssertEqual(taxes, TaxAmount(tax: "Import Tax", amount: 5.30)) } func test_consolidatedIntoSingle_canNotBeConsolidatedIntoSingle_throws() throws { XCTAssertThrowsError(try [ TaxAmount(tax: "Import Tax", amount: 3.00), TaxAmount(tax: "Sales Tax", amount: 1.75), TaxAmount(tax: "Import Tax", amount: 2.30) ].consolidatedIntoSingle(by: \.tax) { TaxAmount(tax: $0.tax, amount: $0.amount + $1.amount) }) } static var allTests = [ ("test_emptyArray_returnsEmptyArray", test_emptyArray_returnsEmptyArray), ("test_usingConsolidatableProtocol_noConsolidabaleValues_doesNotConsolidate", test_usingConsolidatableProtocol_noConsolidabaleValues_doesNotConsolidate), ("test_usingConsolidatableProtocol_consolidabaleValues_consolidates", test_usingConsolidatableProtocol_consolidabaleValues_consolidates), ("test_byKeyPath_consolidates", test_byKeyPath_consolidates), ("test_byClosure_consolidates", test_byClosure_consolidates), ("test_consolidatedIntoSingle_canBeConsolidatedIntoSingle_returnsConsolidation", test_consolidatedIntoSingle_canBeConsolidatedIntoSingle_returnsConsolidation), ("test_consolidatedIntoSingle_canNotBeConsolidatedIntoSingle_throws", test_consolidatedIntoSingle_canNotBeConsolidatedIntoSingle_throws), ] // MARK: Test Fixtures private struct TaxAmount: Equatable, Consolidatable { let tax: String let amount: Decimal var consolidationGroup: AnyHashable { return tax } func consolidate(with other: Self) -> Self { return .init(tax: tax, amount: amount + other.amount) } } }
35.539568
167
0.615182
a9de3270798ff41076496e6aa096310f30084f8d
6,955
php
PHP
resources/views/layouts/app.blade.php
unknownrocks619/kindboxdemo
d27408231eab895e391f077b753179bb7e02ad5a
[ "MIT" ]
null
null
null
resources/views/layouts/app.blade.php
unknownrocks619/kindboxdemo
d27408231eab895e391f077b753179bb7e02ad5a
[ "MIT" ]
null
null
null
resources/views/layouts/app.blade.php
unknownrocks619/kindboxdemo
d27408231eab895e391f077b753179bb7e02ad5a
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="description" content="" /> <meta name="author" content="" /> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>Kindbox - DEMO</title> <!-- Custom fonts for this template--> <link href="{{ asset ('sbadmin/vendor/fontawesome-free/css/all.min.css') }}" rel="stylesheet" type="text/css" /> <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet" /> <!-- Custom styles for this template--> <link href="{{ asset ('sbadmin/css/sb-admin-2.min.css') }}" rel="stylesheet" /> @yield("css") </head> <body id="page-top"> <!-- Page Wrapper --> <div id="wrapper"> <!-- Sidebar --> <ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion toggled" id="accordionSidebar" > <!-- Sidebar - Brand --> <a class="sidebar-brand d-flex align-items-center justify-content-center" href="index.html" > <div class="sidebar-brand-icon rotate-n-15"> <i class="fas fa-laugh-wink"></i> </div> <div class="sidebar-brand-text mx-3">KindBox <sup>V.10</sup></div> </a> <!-- Divider --> <hr class="sidebar-divider my-0" /> <!-- Nav Item - Dashboard --> <li class="nav-item active"> <a class="nav-link" href="index.html"> <i class="fas fa-fw fa-tachometer-alt"></i> <span>Dashboard</span></a > </li> <!-- Divider --> <hr class="sidebar-divider" /> <!-- Heading --> <div class="sidebar-heading">Interface</div> <!-- Nav Item - Pages Collapse Menu --> <li class="nav-item"> <a class="nav-link collapsed" href="{{ route('organiser.organiser.index') }}" > <i class="fas fa-fw fa-users"></i> <span>Organiser</span> </a> <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar" > <div class="bg-white py-2 collapse-inner rounded"> <h6 class="collapse-header">Custom Components:</h6> <a class="collapse-item" href="buttons.html">Buttons</a> <a class="collapse-item" href="cards.html">Cards</a> </div> </div> </li> <!-- Nav Item - Utilities Collapse Menu --> <li class="nav-item"> <a class="nav-link collapsed" href="{{ route('organiser.project.index') }}" > <i class="fas fa-fw fa-file"></i> <span>Projects</span> </a> </li> <!-- Divider --> <hr class="sidebar-divider" /> <!-- Heading --> <div class="sidebar-heading">Addons</div> <!-- Nav Item - Pages Collapse Menu --> <li class="nav-item"> <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsePages" aria-expanded="true" aria-controls="collapsePages" > <i class="fas fa-fw fa-folder"></i> <span>Products</span> </a> <div id="collapsePages" class="collapse" aria-labelledby="headingPages" data-parent="#accordionSidebar" > <div class="bg-white py-2 collapse-inner rounded"> <h6 class="collapse-header">Product Management:</h6> <a class="collapse-item" href="{{ route('products.product.index') }}">Products</a> <a class="collapse-item" href="{{ route('products.product_orders') }}">Product Order</a> </div> </div> </li> <!-- Divider --> <hr class="sidebar-divider d-none d-md-block" /> <!-- Sidebar Toggler (Sidebar) --> <div class="text-center d-none d-md-inline"> <button class="rounded-circle border-0" id="sidebarToggle"></button> </div> <!-- Sidebar Message --> </ul> <!-- End of Sidebar --> <!-- Content Wrapper --> <div id="content-wrapper" class="d-flex flex-column"> @yield("content") <!-- Footer --> <footer class="sticky-footer bg-white"> <div class="container my-auto"> <div class="copyright text-center my-auto"> <span>Copyright &copy; Your Website 2021</span> </div> </div> </footer> <!-- End of Footer --> </div> <!-- End of Content Wrapper --> </div> <!-- End of Page Wrapper --> <!-- Scroll to Top Button--> <a class="scroll-to-top rounded" href="#page-top"> <i class="fas fa-angle-up"></i> </a> <!-- Logout Modal--> <div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" > <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5> <button class="close" type="button" data-dismiss="modal" aria-label="Close" > <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> Select "Logout" below if you are ready to end your current session. </div> <div class="modal-footer"> <form action="{{ route('logout') }}" method="post"> @csrf <button class="btn btn-danger" type="submit" > Logout </button> </form> <button class="btn btn-primary" type="button" data-dismiss="modal"> Cancel </button> </div> </div> </div> </div> <!-- Bootstrap core JavaScript--> <script src="{{ asset ('sbadmin/vendor/jquery/jquery.min.js') }}"></script> <script src="{{ asset ('sbadmin/vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script> <!-- Core plugin JavaScript--> <script src="{{ asset ('sbadmin/vendor/jquery-easing/jquery.easing.min.js') }}"></script> <!-- Custom scripts for all pages--> <script src="{{ asset ('sbadmin/js/sb-admin-2.min.js') }}"></script> @yield("js") </body> </html>
30.371179
122
0.501078
cdc7bc893e60480fb148c063393f27e4239f314d
10,716
cs
C#
message-builder-xml/Test/Ca/Infoway/Messagebuilder/Xml/CodedTypeEvaluatorTest.cs
freddycoder/message-builder-dotnet
3d0038560d5c02d8c6c460fa3617590ba213c275
[ "ECL-2.0", "Apache-2.0" ]
1
2021-02-22T07:03:20.000Z
2021-02-22T07:03:20.000Z
message-builder-xml/Test/Ca/Infoway/Messagebuilder/Xml/CodedTypeEvaluatorTest.cs
freddycoder/message-builder-dotnet
3d0038560d5c02d8c6c460fa3617590ba213c275
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
message-builder-xml/Test/Ca/Infoway/Messagebuilder/Xml/CodedTypeEvaluatorTest.cs
freddycoder/message-builder-dotnet
3d0038560d5c02d8c6c460fa3617590ba213c275
[ "ECL-2.0", "Apache-2.0" ]
2
2020-11-01T19:13:43.000Z
2021-05-22T02:17:38.000Z
/** * Copyright 2013 Canada Health Infoway, Inc. * * 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. * * Author: $LastChangedBy: gng $ * Last modified: $LastChangedDate: 2015-11-19 18:20:12 -0500 (Fri, 30 Jan 2015) $ * Revision: $LastChangedRevision: 9755 $ */ using Ca.Infoway.Messagebuilder.Xml; using NUnit.Framework; namespace Ca.Infoway.Messagebuilder.Xml { [TestFixture] public class CodedTypeEvaluatorTest { [Test] public virtual void TestCodedTypes() { Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ANY")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ANY.LAB")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ANY.CA.IZ")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ANY.PATH")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ANY.X1")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ANY.X2")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("AD")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("AD.BASIC")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("AD.FULL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("AD.SEARCH")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("BL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("BN")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ON")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("SC")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("EN")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TN")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("QTY")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("GTS")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("GTS.BOUNDEDPIVL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II.TOKEN")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II.BUS")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II.PUBLIC")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II.OID")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II.VER")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II.PUBLICVER")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II.BUS_AND_VER")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("II.BUSVER")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("CV")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("CO")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("CD")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("CD.LAB")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("CE")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("CS")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("PQR")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("CR")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("HXIT")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("HXIT<CE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ST")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ST.LANG")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ED")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ED.DOC")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ED.DOC_OR_REF")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ED.REF")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ED.DOC_REF")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("ED.SIGNATURE")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PN")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PN.BASIC")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PN.SIMPLE")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PN.FULL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PN.SEARCH")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<DATE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<DATETIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<FULL_DATE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<FULL_DATE_WITH_TIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<FULL_DATE_TIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<FULL_DATE_PART_TIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<TS>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<HIGH_TS_FULLDATE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<WIDTH_TS_FULLDATE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<LOW_TS_DATE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<LOW_TS_FULLDATE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<LOW_TS_FULLDATETIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<PQ>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<PQ_BASIC>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<PQ_DRUG>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<PQ_TIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<PQ_LAB>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<PQ_HEIGHTWEIGHT>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<PQ_DISTANCE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<INT>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<REAL>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL<MO>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("EIVL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("EIVL<TS>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL.WIDTH")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL.LOW")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("IVL.HIGH")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("MO")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("MO.CAD")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PIVL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PIVL<TS>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PIVL<TS.DATETIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PIVL<TS.FULLDATETIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("INT")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("INT.NONNEG")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("INT.POS")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PQ")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PQ.BASIC")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PQ.DRUG")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PQ.TIME")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PQ.LAB")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PQ.HEIGHTWEIGHT")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("PQ.DISTANCE")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("REAL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("REAL.COORD")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("REAL.CONF")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("RTO")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("RTO<PQ,PQ>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("RTO<MO,PQ>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("RTO<PQ.DRUG,PQ.TIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("RTO<PQ.DRUG,PQ.DRUG>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("RTO<MO.CAD,PQ.BASIC>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TS")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TS.DATE")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TS.DATETIME")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TS.FULLDATEWITHTIME")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TS.FULLDATE")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TS.FULLDATETIME")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TS.FULLDATEPARTTIME")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TEL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TEL.ALL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TEL.PHONEMAIL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TEL.PHONE")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TEL.EMAIL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("TEL.URI")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG<TS.DATE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG<PQ>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG<PQ.BASIC>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG<PQ.DRUG>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG<PQ.TIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG<PQ.LAB>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG<PQ.HEIGHTWEIGHT>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URG<PQ.DISTANCE>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("URL")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SXPR")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SXCM")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("SXCM<CD>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SXCM<INT>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SXCM<MO>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SXCM<PQ>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SXCM<REAL>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SXCM<TS>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("BXIT")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("BXIT<CD>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SET")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("LIST")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("COLLECTION")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("BAG")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("SET<CD>")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("LIST<CO>")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("COLLECTION<HXIT<CE>>")); Assert.IsTrue(CodedTypeEvaluator.IsCodedType("BAG<BXIT<CD>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("SET<TS.FULLDATETIME>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("LIST<URG<PQ>>>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("COLLECTION<SXCM<TS>>")); Assert.IsFalse(CodedTypeEvaluator.IsCodedType("BAG<CR>")); } } }
57.924324
83
0.757559
db7ac32b6a0141646195381ef095fc465b3e078f
3,151
php
PHP
backend/views/file/index.php
atmanegara/appperizinan
8dc6b44539038f129de4856d0ab6818f86ad94c3
[ "BSD-3-Clause" ]
null
null
null
backend/views/file/index.php
atmanegara/appperizinan
8dc6b44539038f129de4856d0ab6818f86ad94c3
[ "BSD-3-Clause" ]
null
null
null
backend/views/file/index.php
atmanegara/appperizinan
8dc6b44539038f129de4856d0ab6818f86ad94c3
[ "BSD-3-Clause" ]
null
null
null
<?php use yii\helpers\Html; use yii\grid\GridView; use backend\models\FileJenis; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'File Berita'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="ejafung-file-index"> <div class="panel"> <div class="panel-body"> <div class="pull-right"> <p> <?= Html::a('New File Berita', ['create'], ['class' => 'btn btn-success', 'disabled' => 'disable', 'onclick' => 'return false']) ?> </p> </div> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'layout' => '{items}', 'columns' => [ ['class' => 'yii\grid\SerialColumn'], [ 'attribute' => 'filename', 'label' => 'Thumbnail', 'format' => 'raw', 'value' => function ($model) { $ext = pathinfo($model->filename, PATHINFO_EXTENSION); $gambar = array('jpg', 'png', 'jpeg'); if (in_array($ext, $gambar)) { return Html::img('@web/upload/' . $model->filename , ['class' => 'pull-left img-responsive', 'height'=>'100px', 'width'=>'100px', 'alt' => $model->filename]); } else { return 'File ' . strtoupper($ext); } }, ], [ 'attribute' => 'id_file_jenis', 'label' => 'Jenis File', 'value' => function ($model) { return FileJenis::name($model->id_file_jenis); }, ], 'title', 'timestamp', [ 'header' => 'Action', 'class' => 'yii\grid\ActionColumn', 'template' => '{action} | {view}', 'buttons' => [ 'action' => function($url, $model, $key) { $idpost = Yii::$app->request->get('idpost'); return Html::a('Delete', ['upload/delete', 'id_post' => $idpost, 'id_file_jenis' => $model->id_file_jenis]); }, 'view' => function($url, $model, $key) { $ext = pathinfo($model->filename, PATHINFO_EXTENSION); $gambar = array('jpg', 'png', 'jpeg'); return Html::a(in_array($ext, $gambar) == true ? 'View' : 'Download', ['/upload/' . $model->filename], ['target' => '_blank']); } ] ] ], ]); ?> </div> </div> </div>
37.511905
190
0.357664
b0d8453ec79c4b633a4c92c62d47e7227b839085
516
py
Python
src/atcoder/abc174/d/sol_2.py
kagemeka/competitive-programming
c70fe481bcd518f507b885fc9234691d8ce63171
[ "MIT" ]
1
2021-07-11T03:20:10.000Z
2021-07-11T03:20:10.000Z
src/atcoder/abc174/d/sol_2.py
kagemeka/competitive-programming
c70fe481bcd518f507b885fc9234691d8ce63171
[ "MIT" ]
39
2021-07-10T05:21:09.000Z
2021-12-15T06:10:12.000Z
src/atcoder/abc174/d/sol_2.py
kagemeka/competitive-programming
c70fe481bcd518f507b885fc9234691d8ce63171
[ "MIT" ]
null
null
null
import typing import sys import numpy as np import numba as nb @nb.njit((nb.b1[:], ), cache=True) def solve(c: np.ndarray) -> typing.NoReturn: n = len(c) a, b = np.sum(c == 1), 0 res = max(a, b) for i in range(n): if c[i] == 1: a -= 1 else: b += 1 res = min(res, max(a, b)) print(res) def main() -> typing.NoReturn: n = int(sys.stdin.buffer.readline().rstrip()) c = np.frombuffer( sys.stdin.buffer.readline().rstrip(), dtype='S1', ) == b'R' solve(c) main()
16.645161
47
0.552326
640db9e00882d32b07f9600a43154621b8d14756
3,613
py
Python
data_processor/mit.py
thgcode/synthizer
50ff649e0651441bf67f986983e71c5ce6de239c
[ "Unlicense" ]
1
2021-02-06T07:29:35.000Z
2021-02-06T07:29:35.000Z
data_processor/mit.py
thgcode/synthizer
50ff649e0651441bf67f986983e71c5ce6de239c
[ "Unlicense" ]
null
null
null
data_processor/mit.py
thgcode/synthizer
50ff649e0651441bf67f986983e71c5ce6de239c
[ "Unlicense" ]
null
null
null
from collections import namedtuple import re import glob import os.path import numpy as np import scipy.io.wavfile as wavfile import scipy.signal as signal import math import paths from minimum_phase import minimum_phase files = glob.glob(os.path.join(paths.data_path, "elev*", "L*.wav"), recursive=True) def to_coords(f): try: bn = os.path.basename(f) x = re.match('L(.*)e(.*)a.wav', bn) az, elev = int(x[2]), int(x[1]) wav = wavfile.read(f) assert wav[0] == 44100 data = wav[1]; data = data / 32768.0 return az, elev, wav[1] except: print(f) raise d = {} for f in files: az, elev, data = to_coords(f) x = d.get(elev, {}) x[az] = data d[elev] = x assert len(d) > 2, "Must have at least 2 elevations" print(f"Have {len(d)} elevations") elev_angles = sorted(d.keys()) degs_per_elev = elev_angles[1]-elev_angles[0] print("Checking that elevations are equidistant") for i in range(len(elev_angles)-1): assert elev_angles[i+1]-elev_angles[i] == degs_per_elev, f"Elevation must be equal to {degs_per_elev}" elev_min = elev_angles[0] elev_max = elev_angles[-1] print("Unfolding azimuths") azimuths = [] for e in elev_angles: azs = sorted(d[e].keys()) azs = [d[e][i] for i in azs] azimuths.append(azs) indices = [(i, j) for i in range(len(azimuths)) for j in range(len(azimuths[i]))] print("Building magnitude responses") for i, j in indices: azimuths[i][j] = np.abs(np.fft.fft(azimuths[i][j])) print("Equalizing power response") presp = np.zeros(len(azimuths[0][0]), dtype=np.float64) c = 0 for i, j in indices: c += 1 presp += azimuths[i][j]**2 average_power = presp/c for i, j in indices: azimuths[i][j] = np.sqrt(azimuths[i][j]**2 / average_power) azimuths[i][j][0] = 1.0 print("Clamping responses to be between -60 db and 3 db") min_gain = 10**(-60/20) max_gain = 10**(3/20) print(f"Min {min_gain} max {max_gain}") for i, j in indices: azimuths[i][j] = np.maximum(np.minimum(azimuths[i][j], max_gain), min_gain) print("Converting to minimum phase") for i, j in indices: azimuths[i][j] = minimum_phase(azimuths[i][j]) hrir_length_final = 32 print(f"Windowing to {hrir_length_final} points") # We use blackman-harris because the WDL likes it for its resampler, so proceeding under the assumption that it's good enough for us too. blackman = signal.blackmanharris(hrir_length_final*2-1)[-hrir_length_final:] assert len(blackman) == hrir_length_final assert blackman[0] == 1.0 for i, j in indices: azimuths[i][j] = azimuths[i][j][:hrir_length_final]*blackman # this is the data that we need to write out. HrtfData = namedtuple("HrtfData", [ # Number of elevations in the dataset. "num_elevs", # Increment of the elevation in degrees. "elev_increment", # Min elevation angle in degrees. "elev_min", # num_elevs-length list. # Holds the azimuth count for each elevation. # For now, we assume azimuths are equally distributed. "num_azimuths", # The azimuths themselves as an array of arrays of arrays. "azimuths", # Number of data points in the set. "impulse_length", ]) num_elevs = len(azimuths) elev_min = min(d.keys()) tmp = sorted(d.keys()) elev_increment = tmp[1]-tmp[0] num_azs = [len(i) for i in azimuths] impulse_length = len(azimuths[0][0]) assert impulse_length == hrir_length_final hrtf_data = HrtfData( num_elevs = num_elevs, elev_min = elev_min, elev_increment = elev_increment, num_azimuths = num_azs, azimuths = azimuths, impulse_length = impulse_length )
28.226563
137
0.674785
c4ab508fac2216484fea97acf3e5329a52abb5f6
2,056
swift
Swift
Tests/MarkdownGeneratorTests/MarkdownResizableImageLinkTests.swift
yyokii/UIPreviewCatalog
ccf25d17d3629488d1fb6375df3fd46736fe6810
[ "MIT" ]
18
2021-09-25T05:41:28.000Z
2022-03-29T18:26:32.000Z
Tests/MarkdownGeneratorTests/MarkdownResizableImageLinkTests.swift
yyokii/UIPreviewCatalog
ccf25d17d3629488d1fb6375df3fd46736fe6810
[ "MIT" ]
1
2021-09-25T03:16:26.000Z
2021-09-26T05:11:56.000Z
Tests/MarkdownGeneratorTests/MarkdownResizableImageLinkTests.swift
yyokii/UIPreviewCatalog
ccf25d17d3629488d1fb6375df3fd46736fe6810
[ "MIT" ]
2
2021-11-10T12:31:03.000Z
2022-01-14T10:48:47.000Z
// // MarkdownResizableImageLinkTests.swift // // // Created by Higashihara Yoki on 2021/09/23. // import XCTest @testable import MarkdownGenerator class MarkdownResizableImageLinkTests: XCTestCase { func testGenerateContent_WhenInputGiven_OutputValidMarkdownString() { // Given let srcPath = "image/demo.jpg" XCTContext.runActivity(named: "GiveWidthAndHeight") { _ in let width: Float = 200 let height: Float = 200 let result = MarkdownResizableImageLink(srcPath: srcPath, width: width, height: height).content let expectation = "<img src=\"\(srcPath)\" width=\"\(width)\" height=\"\(height)\">" XCTAssertEqual(result, expectation) } XCTContext.runActivity(named: "GiveWidth") { _ in let width: Float = 200 let height: Float? = nil let result = MarkdownResizableImageLink(srcPath: srcPath, width: width, height: height).content let expectation = "<img src=\"\(srcPath)\" width=\"\(width)\" height=\"\">" XCTAssertEqual(result, expectation) } XCTContext.runActivity(named: "GiveHeight") { _ in let width: Float? = nil let height: Float = 200 let result = MarkdownResizableImageLink(srcPath: srcPath, width: width, height: height).content let expectation = "<img src=\"\(srcPath)\" width=\"\" height=\"\(height)\">" XCTAssertEqual(result, expectation) } XCTContext.runActivity(named: "GiveOnlySourcePath") { _ in let width: Float? = nil let height: Float? = nil let result = MarkdownResizableImageLink(srcPath: srcPath, width: width, height: height).content let expectation = "<img src=\"\(srcPath)\" width=\"\" height=\"\">" XCTAssertEqual(result, expectation) } } }
34.266667
107
0.565661
7595db70ac5875cb24a15be883739678a175e0b4
155
css
CSS
src/widgets/header/ui/style.module.css
yesnoruly/loripsum-generator
743601207bf26d79e4cd626d273a267f6492ea66
[ "MIT" ]
2
2021-11-17T19:16:07.000Z
2021-12-11T17:01:33.000Z
src/widgets/header/ui/style.module.css
yesnoruly/loripsum-generator
743601207bf26d79e4cd626d273a267f6492ea66
[ "MIT" ]
15
2021-10-30T18:20:59.000Z
2022-02-14T14:16:02.000Z
src/widgets/header/ui/style.module.css
yesnoruly/loripsum-generator
743601207bf26d79e4cd626d273a267f6492ea66
[ "MIT" ]
null
null
null
.header { display: flex; justify-content: flex-end; padding-bottom: 30px; } @media (max-width: 768px) { .header { padding-bottom: 15px; } }
12.916667
28
0.619355
c6816f239c0dba42a24bdbd74f14208134d77ec4
1,033
css
CSS
css/recaudio.css
jkauramaki/ratesounds
4283e8c5386010a493269c8f88e7c0b2b1e25e33
[ "MIT" ]
null
null
null
css/recaudio.css
jkauramaki/ratesounds
4283e8c5386010a493269c8f88e7c0b2b1e25e33
[ "MIT" ]
null
null
null
css/recaudio.css
jkauramaki/ratesounds
4283e8c5386010a493269c8f88e7c0b2b1e25e33
[ "MIT" ]
null
null
null
#buttons { max-width: 100%; text-align: center; padding: 20px; position: relative; } #sentencePlaceholder { max-width: 100%; text-align: center; font-size: 24px; padding: 100px; position: relative; } #start { background-color: green; border-width: medium; border-color: black; color: white; padding: 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; width: 15%; max-height: 15%; border-radius: 10%; position: relative; } #stopExperiment { background-color: red; border-width: medium; border-color: black; color: white; padding: 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; width: 10%; max-height: 15%; border-radius: 10%; position: relative; } h2 { text-align: center; position: relative; } #recordedAudio { width: 40%; left: 30%; right: 30%; position: relative; }
17.508475
28
0.642788
ff44b6002b43773ac97d34767c77c52c5b1be7da
30
py
Python
src/video2npz/visbeat3/visbeat3/ADefines.py
wzk1015/video-bgm-generation
cf46c1babbe8f127f2f7605878d9b0aa7850f16d
[ "MIT" ]
90
2021-10-21T09:52:47.000Z
2022-03-30T14:12:05.000Z
src/video2npz/visbeat3/build/lib/visbeat3/ADefines.py
wzk1015/video-bgm-generation
cf46c1babbe8f127f2f7605878d9b0aa7850f16d
[ "MIT" ]
7
2021-11-08T05:53:12.000Z
2022-02-28T12:39:02.000Z
src/video2npz/visbeat3/build/lib/visbeat3/ADefines.py
wzk1015/video-bgm-generation
cf46c1babbe8f127f2f7605878d9b0aa7850f16d
[ "MIT" ]
14
2021-11-17T05:43:28.000Z
2022-03-22T14:47:40.000Z
# AD_DEBUG = 1; AD_DEBUG = 0;
10
15
0.6
79869eade619497dd73dada82391a8fd800a5db9
6,438
php
PHP
resources/views/layouts/pdf/prueba.blade.php
txuspy/GIE
34125569bdf40875c19403309d4dcfda0c4706cc
[ "MIT" ]
null
null
null
resources/views/layouts/pdf/prueba.blade.php
txuspy/GIE
34125569bdf40875c19403309d4dcfda0c4706cc
[ "MIT" ]
null
null
null
resources/views/layouts/pdf/prueba.blade.php
txuspy/GIE
34125569bdf40875c19403309d4dcfda0c4706cc
[ "MIT" ]
null
null
null
@extends('layouts.pdf') @section('content') <div class="page"> <br/> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mi diam, scelerisque in turpis nec, commodo finibus nisi. Maecenas quam nulla, tempor eget eleifend vel, ornare a justo. Nam eget tortor sed nibh commodo semper in at tellus. Nullam dignissim mauris elit, in consectetur sapien tempus in. Integer rutrum enim massa, sit amet aliquet augue viverra vitae. Sed faucibus nisi at nisl pretium vehicula. Phasellus sagittis et tellus auctor fermentum.</p> <p>Maecenas mi neque, commodo in est ut, lacinia varius lorem. Aliquam lacinia, enim sed facilisis aliquet, ipsum quam eleifend mauris, id efficitur velit diam pellentesque lectus. Maecenas consectetur venenatis dui, pharetra facilisis quam lobortis a. Vestibulum tempus, sem vitae bibendum aliquet, dolor nibh placerat ligula, eu auctor eros tortor vel ante. Pellentesque at tempus ante, rhoncus dignissim nulla. Aenean sed nulla ut nisi elementum facilisis ut sed lacus. Morbi auctor vitae ante lobortis rhoncus.</p> <p>Vivamus arcu est, suscipit nec accumsan non, viverra et justo. Curabitur lacinia semper ante a faucibus. Etiam pharetra vehicula turpis, quis feugiat leo. Nulla posuere elit sed faucibus volutpat. Fusce a metus ipsum. Nam sit amet posuere nisi. Ut congue convallis convallis. Nam justo tortor, gravida et enim accumsan, tristique fringilla nunc. Praesent odio nibh, cursus eget accumsan quis, semper vitae metus. Nulla tempus augue quis velit malesuada, sed facilisis erat condimentum. Donec ac dolor eu orci iaculis ultrices. Suspendisse leo felis, vestibulum eu rutrum sit amet, suscipit sit amet nibh.</p> <p>Phasellus gravida risus blandit magna molestie congue. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent id placerat diam. Cras nec varius lacus, vitae varius dui. Cras ac suscipit nibh, nec tincidunt tortor. Morbi ac mauris eget sapien vehicula tincidunt vitae eget mauris. Etiam nec urna at urna mollis molestie ut non erat. Phasellus mattis fringilla urna placerat tempus. Nunc ullamcorper vehicula viverra. Vestibulum libero justo, sodales vel feugiat et, dictum sit amet urna. Pellentesque eleifend, purus id pulvinar pretium, nisi sem bibendum lacus, eu suscipit nibh orci vel ligula. Suspendisse vel quam neque. Vestibulum ex elit, finibus id nibh non, vestibulum tempus tortor. Nulla facilisi.</p> <p>Vivamus pulvinar fringilla sem, accumsan ullamcorper elit dignissim at. Quisque a massa vel sapien hendrerit cursus eu imperdiet mi. Proin vitae eleifend est, ac convallis risus. Phasellus dignissim, mi vitae egestas fringilla, mauris odio pellentesque risus, scelerisque pellentesque metus sem sit amet diam. Nullam at gravida velit, sed varius tellus. Suspendisse sed arcu non ipsum aliquam egestas. Praesent mollis pellentesque gravida. Mauris dignissim leo vitae commodo tempus. Nam pretium urna eu urna facilisis semper. Phasellus ac rutrum sapien. Etiam fermentum ut neque eget pharetra. Quisque vitae tristique ipsum, at vestibulum velit. Nunc et ipsum ante. Aenean nulla est, laoreet at purus ut, facilisis faucibus quam.</p> <span class="salto_de_pagina"/> </div> <div class="page"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mi diam, scelerisque in turpis nec, commodo finibus nisi. Maecenas quam nulla, tempor eget eleifend vel, ornare a justo. Nam eget tortor sed nibh commodo semper in at tellus. Nullam dignissim mauris elit, in consectetur sapien tempus in. Integer rutrum enim massa, sit amet aliquet augue viverra vitae. Sed faucibus nisi at nisl pretium vehicula. Phasellus sagittis et tellus auctor fermentum.</p> <p>Maecenas mi neque, commodo in est ut, lacinia varius lorem. Aliquam lacinia, enim sed facilisis aliquet, ipsum quam eleifend mauris, id efficitur velit diam pellentesque lectus. Maecenas consectetur venenatis dui, pharetra facilisis quam lobortis a. Vestibulum tempus, sem vitae bibendum aliquet, dolor nibh placerat ligula, eu auctor eros tortor vel ante. Pellentesque at tempus ante, rhoncus dignissim nulla. Aenean sed nulla ut nisi elementum facilisis ut sed lacus. Morbi auctor vitae ante lobortis rhoncus.</p> <p>Vivamus arcu est, suscipit nec accumsan non, viverra et justo. Curabitur lacinia semper ante a faucibus. Etiam pharetra vehicula turpis, quis feugiat leo. Nulla posuere elit sed faucibus volutpat. Fusce a metus ipsum. Nam sit amet posuere nisi. Ut congue convallis convallis. Nam justo tortor, gravida et enim accumsan, tristique fringilla nunc. Praesent odio nibh, cursus eget accumsan quis, semper vitae metus. Nulla tempus augue quis velit malesuada, sed facilisis erat condimentum. Donec ac dolor eu orci iaculis ultrices. Suspendisse leo felis, vestibulum eu rutrum sit amet, suscipit sit amet nibh.</p> <p>Phasellus gravida risus blandit magna molestie congue. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent id placerat diam. Cras nec varius lacus, vitae varius dui. Cras ac suscipit nibh, nec tincidunt tortor. Morbi ac mauris eget sapien vehicula tincidunt vitae eget mauris. Etiam nec urna at urna mollis molestie ut non erat. Phasellus mattis fringilla urna placerat tempus. Nunc ullamcorper vehicula viverra. Vestibulum libero justo, sodales vel feugiat et, dictum sit amet urna. Pellentesque eleifend, purus id pulvinar pretium, nisi sem bibendum lacus, eu suscipit nibh orci vel ligula. Suspendisse vel quam neque. Vestibulum ex elit, finibus id nibh non, vestibulum tempus tortor. Nulla facilisi.</p> <p>Vivamus pulvinar fringilla sem, accumsan ullamcorper elit dignissim at. Quisque a massa vel sapien hendrerit cursus eu imperdiet mi. Proin vitae eleifend est, ac convallis risus. Phasellus dignissim, mi vitae egestas fringilla, mauris odio pellentesque risus, scelerisque pellentesque metus sem sit amet diam. Nullam at gravida velit, sed varius tellus. Suspendisse sed arcu non ipsum aliquam egestas. Praesent mollis pellentesque gravida. Mauris dignissim leo vitae commodo tempus. Nam pretium urna eu urna facilisis semper. Phasellus ac rutrum sapien. Etiam fermentum ut neque eget pharetra. Quisque vitae tristique ipsum, at vestibulum velit. Nunc et ipsum ante. Aenean nulla est, laoreet at purus ut, facilisis faucibus quam.</p> </div> @endsection
321.9
767
0.795744
2d18be61a6b5744d77bb41575d23c423444cce47
842
css
CSS
lib/style.css
lacostenycoder/chrome-quick-links
2407c83d1fff3b256f927d340b2a2d63723a2bb8
[ "MIT" ]
null
null
null
lib/style.css
lacostenycoder/chrome-quick-links
2407c83d1fff3b256f927d340b2a2d63723a2bb8
[ "MIT" ]
7
2020-03-30T23:41:56.000Z
2021-03-28T23:11:27.000Z
lib/style.css
lacostenycoder/chrome-quick-links
2407c83d1fff3b256f927d340b2a2d63723a2bb8
[ "MIT" ]
2
2020-03-30T01:28:12.000Z
2020-12-30T06:13:18.000Z
body { background-color: #567; color: #fff; } a, a:hover, a:visited, u { /* color: #fff; */ text-decoration: none !important; } .url { margin-left: 10px; } .text-xs { font-size: 1em !important; padding: 1px; cursor: pointer; } label { margin: 4px; } input { margin-top: 4px; } .tb { margin-left: 2px; margin-right: 2px; padding: 4px; border-radius: 4px; } .coffee { margin-right: 100px; margin-top: 12px; color: #FFF; background-color: #47BAC1; border-radius: 10px; padding-top: 10px; padding-bottom: 10px; } .url-input { margin-left: 50px; } .search-input { margin-left: 36px; } td.table-shortcut { width: 20px !important; } #table-body { max-width: 80% !important; } #form1 { margin-top: 18px; } @media (min-width: 800px) { input.wide { width: 400px !important; max-width: 400px !important; } }
11.859155
34
0.637767
6af43e227a0c36046e41473aa10d5fe89ca1080c
123
h
C
Include/runtime/attested_config.h
andersgjerdrum/diggi
c072911c439758b6f1bb1d9972c6fc32aa49d560
[ "Intel", "CC-BY-3.0", "MIT-CMU" ]
null
null
null
Include/runtime/attested_config.h
andersgjerdrum/diggi
c072911c439758b6f1bb1d9972c6fc32aa49d560
[ "Intel", "CC-BY-3.0", "MIT-CMU" ]
null
null
null
Include/runtime/attested_config.h
andersgjerdrum/diggi
c072911c439758b6f1bb1d9972c6fc32aa49d560
[ "Intel", "CC-BY-3.0", "MIT-CMU" ]
null
null
null
#ifndef ATTESTED_CONFIG_H #define ATTESTED_CONFIG_H extern "C" const char* static_attested_diggi_configuration; #endif
15.375
59
0.829268
c3b79837b6aba2346c14d349447bea75e6c4e218
453
cs
C#
src/ZeroLog/ConfigResolvers/IConfigurationResolver.cs
y-skindersky/ZeroLog
48eab42c66bc09c224b22733ee067b4e2508be74
[ "MIT" ]
null
null
null
src/ZeroLog/ConfigResolvers/IConfigurationResolver.cs
y-skindersky/ZeroLog
48eab42c66bc09c224b22733ee067b4e2508be74
[ "MIT" ]
null
null
null
src/ZeroLog/ConfigResolvers/IConfigurationResolver.cs
y-skindersky/ZeroLog
48eab42c66bc09c224b22733ee067b4e2508be74
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Text; using ZeroLog.Appenders; namespace ZeroLog.ConfigResolvers { public interface IConfigurationResolver : IDisposable { void Initialize(Encoding encoding); Level ResolveLevel(string name); IList<IAppender> ResolveAppenders(string name); LogEventPoolExhaustionStrategy ResolveExhaustionStrategy(string name); event Action Updated; } }
25.166667
78
0.739514
14a89a45ee8fdbdb95fca9ba07a24580603f0bcf
1,158
ts
TypeScript
_angular/src/app/components/pages/product-photo/product-photo.module.ts
cheerokee/code_shopping
f204fc58b518391158fa7d5c939271e7e03a43d8
[ "MIT" ]
null
null
null
_angular/src/app/components/pages/product-photo/product-photo.module.ts
cheerokee/code_shopping
f204fc58b518391158fa7d5c939271e7e03a43d8
[ "MIT" ]
null
null
null
_angular/src/app/components/pages/product-photo/product-photo.module.ts
cheerokee/code_shopping
f204fc58b518391158fa7d5c939271e7e03a43d8
[ "MIT" ]
null
null
null
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import {ProductPhotoDeleteModalComponent} from "./product-photo-delete-modal/product-photo-delete-modal.component"; import {ProductPhotoEditModalComponent} from "./product-photo-edit-modal/product-photo-edit-modal.component"; import {ProductPhotoManagerComponent} from "./product-photo-manager/product-photo-manager.component"; import {ProductPhotoUploadComponent} from "./product-photo-upload/product-photo-upload.component"; import {RouterModule} from "@angular/router"; import {FormsModule} from "@angular/forms"; import {SharedModule} from "../../../shared.module"; import {BootstrapModule} from "../../bootstrap/bootstrap.module"; import {CommonComponentModule} from "../../common/common-component.module"; @NgModule({ declarations: [ ProductPhotoDeleteModalComponent, ProductPhotoEditModalComponent, ProductPhotoManagerComponent, ProductPhotoUploadComponent ], imports: [ CommonModule, SharedModule, BootstrapModule, CommonComponentModule ] }) export class ProductPhotoModule { }
39.931034
115
0.743523
a31a7fe0f36f6bb01d2ca2a43fc933cfddbd9365
1,425
java
Java
libraries/BaseWidget/src/main/java/com/daolion/view/dialog/DialogDescription.java
lixiaodaoaaa/ReadHeadIDCardDemo
632c3629ca048df6bdf4231895dfef41127b4cc4
[ "Apache-2.0" ]
8
2020-03-08T14:10:49.000Z
2022-03-07T07:44:26.000Z
libraries/BaseWidget/src/main/java/com/daolion/view/dialog/DialogDescription.java
lixiaodaoaaa/ReadHeadIDCardDemo
632c3629ca048df6bdf4231895dfef41127b4cc4
[ "Apache-2.0" ]
null
null
null
libraries/BaseWidget/src/main/java/com/daolion/view/dialog/DialogDescription.java
lixiaodaoaaa/ReadHeadIDCardDemo
632c3629ca048df6bdf4231895dfef41127b4cc4
[ "Apache-2.0" ]
null
null
null
package com.daolion.view.dialog; /** * Created by lixiaodaoaaa on 2016/11/2. */ /** * dialog 的描述 类 */ public class DialogDescription { private String title; private String dialogContent; private String positiveText; private String negativeText; public DialogDescription(String title, String dialogContent, String positiveText, String negativeText) { this.title = title; this.dialogContent = dialogContent; this.positiveText = positiveText; this.negativeText = negativeText; } public DialogDescription(String title, String negativeText, String positiveText) { this.title = title; this.negativeText = negativeText; this.positiveText = positiveText; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDialogContent() { return dialogContent; } public void setDialogContent(String dialogContent) { this.dialogContent = dialogContent; } public String getPositiveText() { return positiveText; } public void setPositiveText(String positiveText) { this.positiveText = positiveText; } public String getNegativeText() { return negativeText; } public void setNegativeText(String negativeText) { this.negativeText = negativeText; } }
22.619048
108
0.66386
2004de956813633a76cca63c167d99d5f5688e96
3,854
py
Python
tests/test_core.py
mohmum/s3tree
cbd1b798bcd5c203e61eed9b040c246ca5580970
[ "MIT" ]
null
null
null
tests/test_core.py
mohmum/s3tree
cbd1b798bcd5c203e61eed9b040c246ca5580970
[ "MIT" ]
null
null
null
tests/test_core.py
mohmum/s3tree
cbd1b798bcd5c203e61eed9b040c246ca5580970
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for core module.""" import json from moto import mock_s3 from pytest import raises, fail from six import string_types import s3tree from .helpers import (DUMMY_BUCKET_NAME, DUMMY_ACCESS_KEY_ID, DUMMY_SECRET_ACCESS_KEY, generate_dummy_bucket) def test_s3tree_improperly_configured(): with raises(s3tree.exceptions.ImproperlyConfiguredError): s3tree.S3Tree(bucket_name='foo') def test_s3tree_work_with_global_config(): s3tree.config.aws_access_key_id = 'foo' s3tree.config.aws_secret_access_key = 'bar' try: s3tree.S3Tree(bucket_name='foo') except s3tree.exceptions.ImproperlyConfiguredError: raise fail('Initialization failed with global config.') except Exception: pass @mock_s3 def test_s3tree_tree_sanity(): generate_dummy_bucket() tree = s3tree.S3Tree(bucket_name=DUMMY_BUCKET_NAME, aws_access_key_id=DUMMY_ACCESS_KEY_ID, aws_secret_access_key=DUMMY_SECRET_ACCESS_KEY, path='/') # we're using some magic values for asserting tests here for the tree. # refer to helpers.generate_dummy_bucket to see the origin of these values. assert len(tree) == 7 assert tree.num_directories == 3 assert len(tree.directories) == 3 assert tree.num_files == 4 assert len(tree.files) == 4 # the first object in the tree should be a directory called `css` assert isinstance(tree[0], s3tree.models.Directory) assert tree[0].name == 'cache' # the last object in the tree should be a file called `Makefile` assert isinstance(tree[-1], s3tree.models.File) assert tree[-1].name == 'index.js' @mock_s3 def test_exception_when_bucket_not_found(): with raises(s3tree.exceptions.BucketNotFound): s3tree.S3Tree(bucket_name=DUMMY_BUCKET_NAME, aws_access_key_id=DUMMY_ACCESS_KEY_ID, aws_secret_access_key=DUMMY_SECRET_ACCESS_KEY) @mock_s3 def test_exception_when_directory_not_found(): generate_dummy_bucket() with raises(s3tree.exceptions.DirectoryNotFound): s3tree.S3Tree(bucket_name=DUMMY_BUCKET_NAME, aws_access_key_id=DUMMY_ACCESS_KEY_ID, aws_secret_access_key=DUMMY_SECRET_ACCESS_KEY, path='/non-existent') @mock_s3 def test_directory_traversal(): generate_dummy_bucket() tree = s3tree.S3Tree(bucket_name=DUMMY_BUCKET_NAME, aws_access_key_id=DUMMY_ACCESS_KEY_ID, aws_secret_access_key=DUMMY_SECRET_ACCESS_KEY, path='cache') # get the first element, which is a directory directory = tree[0] child_tree = directory.get_tree() assert isinstance(child_tree, s3tree.S3Tree) assert len(child_tree) == 2 @mock_s3 def test_file_reads(): generate_dummy_bucket() tree = s3tree.S3Tree(bucket_name=DUMMY_BUCKET_NAME, aws_access_key_id=DUMMY_ACCESS_KEY_ID, aws_secret_access_key=DUMMY_SECRET_ACCESS_KEY, path='css') # the first element in this tree is a file dummy_file = tree[0] assert isinstance(dummy_file, s3tree.models.File) assert isinstance(dummy_file.read(), string_types) assert dummy_file.read().startswith('abcd') @mock_s3 def test_tree_as_json_property(): generate_dummy_bucket() tree = s3tree.S3Tree(bucket_name=DUMMY_BUCKET_NAME, aws_access_key_id=DUMMY_ACCESS_KEY_ID, aws_secret_access_key=DUMMY_SECRET_ACCESS_KEY) json_data = tree.as_json data = json.loads(json_data) assert isinstance(json_data, string_types) assert isinstance(data, list) assert len(data) == 7
34.106195
79
0.682927
6b28c0b2b0f5ae88c58053d670c280e3ef9e13aa
277
js
JavaScript
models/track.model.js
AfriDesignCommunity/AfriApi
35dd8c5610b0d28fc606bb830bd9e2c2e48ad8a5
[ "MIT" ]
null
null
null
models/track.model.js
AfriDesignCommunity/AfriApi
35dd8c5610b0d28fc606bb830bd9e2c2e48ad8a5
[ "MIT" ]
8
2020-12-30T10:12:59.000Z
2020-12-30T10:25:30.000Z
models/track.model.js
ChapAfric-Community/node-api
35dd8c5610b0d28fc606bb830bd9e2c2e48ad8a5
[ "MIT" ]
null
null
null
const mongoose = require('mongoose'); const trackSchema = mongoose.Schema({ title: {type: String, required: true}, description: {type: String, required: true}, photo: {type: String} }); const Track = mongoose.model('tracks', trackSchema); module.exports = Track;
25.181818
52
0.689531
7f8b4e6c71d9e877859aad9b78eb5bb698fd98e4
491
php
PHP
mod/thewire/views/default/resources/thewire/reply.php
iionly/Elgg
336e7c1353dc95de96f435cd968cbef9c9253ced
[ "MIT" ]
1
2016-02-09T20:45:59.000Z
2016-02-09T20:45:59.000Z
mod/thewire/views/default/resources/thewire/reply.php
iionly/Elgg
336e7c1353dc95de96f435cd968cbef9c9253ced
[ "MIT" ]
null
null
null
mod/thewire/views/default/resources/thewire/reply.php
iionly/Elgg
336e7c1353dc95de96f435cd968cbef9c9253ced
[ "MIT" ]
null
null
null
<?php /** * Reply page */ $guid = elgg_extract('guid', $vars); elgg_entity_gatekeeper($guid, 'object', 'thewire'); /* @var $post ElggWire */ $post = get_entity($guid); elgg_push_entity_breadcrumbs($post, true); $content = elgg_view('thewire/reply', ['post' => $post]); $content .= elgg_view_form('thewire/add', [ 'class' => 'thewire-form', ], [ 'post' => $post, ]); $content .= elgg_view('input/urlshortener'); echo elgg_view_page(elgg_echo('reply'), [ 'content' => $content, ]);
18.884615
57
0.639511
188acef6ac7f117fe6809337441408d25d4220c4
2,138
swift
Swift
Snoo/SnooOperation.swift
Monolith13/beam_xcuitest_demo
1d7e3c18a9ba3b05ad3dc4b9cce3f8f05f20c700
[ "Unlicense" ]
1
2018-08-28T12:51:18.000Z
2018-08-28T12:51:18.000Z
Snoo/SnooOperation.swift
Monolith13/beam_xcuitest_demo
1d7e3c18a9ba3b05ad3dc4b9cce3f8f05f20c700
[ "Unlicense" ]
1
2019-09-19T15:40:13.000Z
2020-01-14T13:26:10.000Z
Snoo/SnooOperation.swift
Monolith13/beam_xcuitest_demo
1d7e3c18a9ba3b05ad3dc4b9cce3f8f05f20c700
[ "Unlicense" ]
1
2020-08-16T10:56:51.000Z
2020-08-16T10:56:51.000Z
// // SnooOperation.swift // Snoo // // Created by Robin Speijer on 09-07-15. // Copyright © 2015 Awkward. All rights reserved. // import UIKit open class SnooOperation: Operation { open var error: Error? fileprivate var operationIsExecuting: Bool = false { willSet { self.willChangeValue(forKey: "isExecuting") } didSet { self.didChangeValue(forKey: "isExecuting") } } fileprivate var operationIsCancelled: Bool = false { willSet { self.willChangeValue(forKey: "isCancelled") } didSet { self.didChangeValue(forKey: "isCancelled") } } fileprivate var operationIsFinished: Bool = false { willSet { self.willChangeValue(forKey: "isFinished") } didSet { self.didChangeValue(forKey: "isFinished") } } /** Start the Operation. This method will notify KVO that "isExecuting" has changed. */ fileprivate func startOperation() { self.operationIsExecuting = true } /** Cancel the Operation. This method will notify KVO that "isCancelled" has changed. */ open func cancelOperation() { self.operationIsCancelled = true } /** Finish the Operation. This method will notify KVO that "isFinished" has changed. */ open func finishOperation() { self.operationIsFinished = true } override open func start() { self.startOperation() } /** If needed, subclassed of DataOperation can override this method to received the cancel operation and cancel a request. */ override open func cancel() { self.cancelOperation() } override open var isAsynchronous: Bool { return true } override open var isExecuting: Bool { return self.operationIsExecuting } override open var isFinished: Bool { return self.operationIsFinished } override open var isCancelled: Bool { return self.operationIsCancelled } }
23.494505
123
0.598223
8e8f7950f5791a214f52f305661fea8d96a94317
743
js
JavaScript
Java/FamilleModele.js
OusmanaTraore/NodeAPI
f02914ee52fdd1049d04ba21ceb82aa7612d5055
[ "MIT" ]
null
null
null
Java/FamilleModele.js
OusmanaTraore/NodeAPI
f02914ee52fdd1049d04ba21ceb82aa7612d5055
[ "MIT" ]
null
null
null
Java/FamilleModele.js
OusmanaTraore/NodeAPI
f02914ee52fdd1049d04ba21ceb82aa7612d5055
[ "MIT" ]
null
null
null
ComposantFamilles={ "Pere", "Mere", "Fis", "Fille", "Petit-Fils", "Petite-Fille", "Arriere-Petit-Fils", "Arriere-Petite-Fille", "Grand-Pere", "Grand-Mere", "Gendre", "Bru", "Beau-Pere", "Belle-Mere", "Oncle", "Tante", "Grand-Oncle", "Grand-Tante", "Grand-Cousin", "Grande-Cousine", "Beau-Fils", "Belle-Fille", "Petit-Neveu", "Petite-Niece", "Arriere-Petit-Neveu", "Arriere-Petite-Niece", "Cousin Germain", "Cousine Germaine", "Cousin", "Cousine", "Petit-Cousin", "Petit-Cousine", "Arriere-Cousin", "Arriere-Cousine", } const NbreComposantsFamilles = ComposantsFamilles.length;
19.552632
57
0.539704
e701f7cc2f1b289ab2aec4a07d2f34d965412eb1
1,584
php
PHP
app/Http/Controllers/Controller.php
lemonkazi/list-filter
a9b8af4b69a074f2ac8c09dc168eb72cd345d6c2
[ "MIT" ]
null
null
null
app/Http/Controllers/Controller.php
lemonkazi/list-filter
a9b8af4b69a074f2ac8c09dc168eb72cd345d6c2
[ "MIT" ]
null
null
null
app/Http/Controllers/Controller.php
lemonkazi/list-filter
a9b8af4b69a074f2ac8c09dc168eb72cd345d6c2
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; use View; use Route; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; public $BASE_URL = ''; public $CURRENT_URL = ''; /** @var object $AppUI Session infomation of user logged. */ public $AppUI = null; /** @var object $controller Controller name. */ public $controller = null; public $action = null; public function __construct() { $currentAction = Route::currentRouteAction(); list($controller, $method) = explode('@', $currentAction); $controller = preg_replace('/.*\\\/', '', $controller); $this->controller = strtolower($controller); $this->action = strtolower($method); $this->CURRENT_URL = url()->full(); $this->middleware(function ($request, $next) { $data = array( 'controller' => $this->controller, 'action' => $this->action, 'CURRENT_URL' => $this->CURRENT_URL, 'AppUI' => $this->AppUI ); View::share($data); return $next($request); }); } /** * Before filter event * @param Event $event */ public function beforeFilter(Event $event) { parent::beforeFilter($event); } }
25.142857
66
0.590909
2a2f9679f97bb5da05ccb4a307d617c06d336c65
8,051
rs
Rust
safe-api/src/api/quic_endpoint.rs
SAFEShane/safe-api
c44b0180e86cebe8fea1091c2ca78b0ec75caed8
[ "MIT", "BSD-3-Clause" ]
null
null
null
safe-api/src/api/quic_endpoint.rs
SAFEShane/safe-api
c44b0180e86cebe8fea1091c2ca78b0ec75caed8
[ "MIT", "BSD-3-Clause" ]
null
null
null
safe-api/src/api/quic_endpoint.rs
SAFEShane/safe-api
c44b0180e86cebe8fea1091c2ca78b0ec75caed8
[ "MIT", "BSD-3-Clause" ]
null
null
null
// Copyright 2020 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or distributed except according to those terms. Please review the Licences for the // specific language governing permissions and limitations relating to use of the SAFE Network // Software. use super::AuthReq; use failure::{Error, Fail, ResultExt}; use futures::{Future, Stream}; use jsonrpc_quic::{jsonrpc_serialised_result, parse_jsonrpc_request}; use log::debug; use serde_json::json; use slog::{Drain, Logger}; use std::{ fmt, fs, io, net::{SocketAddr, ToSocketAddrs}, path::PathBuf, str, sync::{mpsc, Arc}, }; use tokio::runtime::current_thread::Runtime; use url::Url; struct PrettyErr<'a>(&'a dyn Fail); impl<'a> fmt::Display for PrettyErr<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&self.0, f)?; let mut x: &dyn Fail = self.0; while let Some(cause) = x.cause() { f.write_str(": ")?; fmt::Display::fmt(&cause, f)?; x = cause; } Ok(()) } } trait ErrorExt { fn pretty(&self) -> PrettyErr<'_>; } impl ErrorExt for Error { fn pretty(&self) -> PrettyErr<'_> { PrettyErr(self.as_fail()) } } pub fn quic_listen( url_str: &str, notif_channel: mpsc::Sender<AuthReq>, cert_base_path: PathBuf, ) -> Result<(), String> { debug!("Launching new QUIC endpoint on '{}'", url_str); let decorator = slog_term::PlainSyncDecorator::new(std::io::stderr()); let drain = slog_term::FullFormat::new(decorator) .use_original_order() .build() .fuse(); let url = Url::parse(url_str).map_err(|err| format!("Invalid end point address: {}", err))?; let endpoint = url .to_socket_addrs() .map_err(|err| format!("Invalid end point address: {}", err))? .next() .ok_or_else(|| "The end point is an invalid address".to_string())?; if let Err(e) = start_quic_endpoint( Logger::root(drain, o!()), endpoint, notif_channel, cert_base_path, ) { Err(format!("{}", e.pretty())) } else { Ok(()) } } fn start_quic_endpoint( log: Logger, listen: SocketAddr, notif_channel: mpsc::Sender<AuthReq>, cert_base_path: PathBuf, ) -> Result<(), Error> { let server_config = quinn::ServerConfig { transport: Arc::new(quinn::TransportConfig { stream_window_uni: 0, ..Default::default() }), ..Default::default() }; let mut server_config = quinn::ServerConfigBuilder::new(server_config); server_config.protocols(&[quinn::ALPN_QUIC_HTTP]); let cert_path = cert_base_path.join("cert.der"); let key_path = cert_base_path.join("key.der"); let (cert, key) = match fs::read(&cert_path).and_then(|x| Ok((x, fs::read(&key_path)?))) { Ok(x) => x, Err(ref e) if e.kind() == io::ErrorKind::NotFound => { // info!(log, "Generating self-signed certificate..."); let cert = rcgen::generate_simple_self_signed(vec!["localhost".into()]); let key = cert.serialize_private_key_der(); let cert = cert.serialize_der(); fs::create_dir_all(&cert_base_path) .context("Failed to create certificate directory")?; fs::write(&cert_path, &cert).context("Failed to write certificate")?; fs::write(&key_path, &key).context("Failed to write private key")?; (cert, key) } Err(e) => { bail!("Failed to read certificate: {}", e); } }; let key = quinn::PrivateKey::from_der(&key)?; let cert = quinn::Certificate::from_der(&cert)?; server_config.certificate(quinn::CertificateChain::from_certs(vec![cert]), key)?; let mut endpoint = quinn::Endpoint::builder(); endpoint.logger(log.clone()); endpoint.listen(server_config.build()); let (endpoint_driver, incoming) = { let (driver, _endpoint, incoming) = endpoint.bind(listen)?; // info!(log, "Listening on {}", endpoint.local_addr()?); (driver, incoming) }; let mut runtime = Runtime::new()?; runtime.spawn(incoming.for_each(move |conn| { handle_connection(&log, conn, notif_channel.clone()); Ok(()) })); runtime.block_on(endpoint_driver)?; Ok(()) } fn handle_connection( log: &Logger, conn: ( quinn::ConnectionDriver, quinn::Connection, quinn::IncomingStreams, ), notif_channel: mpsc::Sender<AuthReq>, ) { let (conn_driver, _conn, incoming_streams) = conn; let log = log.clone(); // info!(log, "got connection"; // "remote_id" => %conn.remote_id(), // "address" => %conn.remote_address(), // "protocol" => conn.protocol().map_or_else(|| "<none>".into(), |x| String::from_utf8_lossy(&x).into_owned())); //let log2 = log.clone(); // We ignore errors from the driver because they'll be reported by the `incoming` handler anyway. tokio_current_thread::spawn(conn_driver.map_err(|_| ())); // Each stream initiated by the client constitutes a new request. tokio_current_thread::spawn( incoming_streams .map_err(move |_e| ()) // info!(log2, "Connection terminated"; "reason" => %e)) .for_each(move |stream| { handle_request(&log, stream, notif_channel.clone()); Ok(()) }), ); } fn handle_request(_log: &Logger, stream: quinn::NewStream, notif_channel: mpsc::Sender<AuthReq>) { let (send, recv) = match stream { quinn::NewStream::Bi(send, recv) => (send, recv), quinn::NewStream::Uni(_) => unreachable!("Disabled by endpoint configuration"), }; //let log = log.clone(); //let log2 = log.clone(); //let log3 = log.clone(); tokio_current_thread::spawn( recv.read_to_end(64 * 1024) // Read the request, which must be at most 64KiB .map_err(|e| format_err!("Failed reading request: {}", e)) .and_then(move |(_, req)| { // info!(log, "Got request"); // Process the request let resp = process_req(&req, notif_channel); // Write the response tokio::io::write_all(send, resp) .map_err(|e| format_err!("Failed to send response: {}", e)) }) // Gracefully terminate the stream .and_then(|(send, _)| { tokio::io::shutdown(send) .map_err(|e| format_err!("Failed to shutdown stream: {}", e)) }) .map(move |_| ()) // info!(log3, "Request complete")) .map_err(move |_e| ()), // error!(log2, "Request Failed"; "reason" => %e.pretty())), ) } fn process_req(req: &[u8], notif_channel: mpsc::Sender<AuthReq>) -> Box<[u8]> { let jsonrpc_req = match parse_jsonrpc_request(req.to_vec()) { Ok(jsonrpc) => jsonrpc, Err(err_str) => return err_str.into_bytes().into(), }; let auth_req: AuthReq = match serde_json::from_value(jsonrpc_req.params) { Ok(auth_req) => auth_req, Err(err) => return err.to_string().as_bytes().into(), }; // New notification for auth req to be sent to user let app_id = auth_req.app_id.clone(); let msg = match notif_channel.send(auth_req) { Ok(_) => format!( "Auth req from app id '{}' ready to be notified to user", app_id ), Err(err) => format!( "Auth req notification for app id '{}' couldn't be sent to user: {}", app_id, err ), }; match jsonrpc_serialised_result(json!(msg), 0) { Ok(res) => res.as_bytes().into(), Err(err) => err.as_bytes().into(), } }
34.553648
121
0.587008
9ddd2a0f6d610e94f4bda7676b5a27d7786b9e00
1,674
rs
Rust
src/api/config.rs
Squbirreland/nacos-api
fc05831a7cec2558297cd99a5bd9f76aca586e9c
[ "Apache-2.0" ]
3
2021-07-30T07:24:48.000Z
2021-10-12T11:16:15.000Z
src/api/config.rs
Squbirreland/nacos-api
fc05831a7cec2558297cd99a5bd9f76aca586e9c
[ "Apache-2.0" ]
null
null
null
src/api/config.rs
Squbirreland/nacos-api
fc05831a7cec2558297cd99a5bd9f76aca586e9c
[ "Apache-2.0" ]
2
2021-07-30T08:00:34.000Z
2021-12-05T13:00:19.000Z
use crate::{NacosConfig, util}; use crate::model::DeployConfig; use std::error::Error; const GET_CONFIGS: &str = "/v1/cs/configs"; const POST_CONFIGS: &str = "/v1/cs/configs"; const DELETE_CONFIGS: &str = "/v1/cs/configs"; #[derive(Clone)] pub struct NacosConfigApi { deploy_config: DeployConfig, } impl NacosConfigApi { pub fn new(config: DeployConfig) -> Self { Self { deploy_config: config, } } pub fn deploy_config(&self) -> &DeployConfig { &self.deploy_config } } impl NacosConfigApi { pub async fn get_configs(&self, nacos: &NacosConfig) -> Result<String, Box<dyn Error>> { let map = self.deploy_config.init_map(); let resp = util::query(&map, |c| c.get(nacos.addr(GET_CONFIGS))).await?; let result = resp.text().await?; Ok(result) } pub async fn upload_configs(nacos: &NacosConfig, config: DeployConfig, content: &str, types: Option<String>) -> Result<(), Box<dyn Error>> { let mut map = config.init_map(); map.insert("content".to_string(), content.to_string()); if let Some(t) = types { map.insert("type".to_string(), t); } let resp = util::query(&map, |c| c.post(nacos.addr(POST_CONFIGS))).await?; util::resp_assert(resp, "true").await } pub async fn delete_configs(nacos: &NacosConfig, config: DeployConfig) -> Result<(), Box<dyn Error>> { let map = config.init_map(); let resp = util::query(&map, |c| c.delete(nacos.addr(DELETE_CONFIGS))).await?; util::resp_assert(resp, "true").await } }
34.163265
112
0.592593
c4e6644b86d8ef2649eb2446f82f3ec5179b96e8
10,855
sql
SQL
sql/my.sql
gifff/wheresmycourt
dd06ea00fc8f2e1acb831072d6ffb1c2431aa769
[ "MIT" ]
1
2017-03-05T06:54:34.000Z
2017-03-05T06:54:34.000Z
sql/my.sql
gifff/wheresmycourt
dd06ea00fc8f2e1acb831072d6ffb1c2431aa769
[ "MIT" ]
null
null
null
sql/my.sql
gifff/wheresmycourt
dd06ea00fc8f2e1acb831072d6ffb1c2431aa769
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.5.4.1deb2ubuntu2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: May 22, 2017 at 11:00 PM -- Server version: 5.7.18-0ubuntu0.16.04.1 -- PHP Version: 7.0.15-0ubuntu0.16.04.4 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `wheresmycourt` -- -- -------------------------------------------------------- -- -- Table structure for table `arena` -- CREATE TABLE `arena` ( `id` int(11) NOT NULL, `lapangan_id` int(11) NOT NULL, `nama` varchar(128) NOT NULL, `harga_per_jam` int(11) NOT NULL, `link_foto` varchar(64) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `arena` -- INSERT INTO `arena` (`id`, `lapangan_id`, `nama`, `harga_per_jam`, `link_foto`) VALUES (1, 1, 'Viva Futsal 1', 150000, NULL), (2, 1, 'Viva Futsal 2', 125000, NULL), (3, 1, 'Viva Futsal 3', 100000, NULL), (4, 3, 'CT 1', 110000, NULL), (5, 3, 'CT 2', 110000, NULL), (6, 3, 'CT 3', 110000, NULL), (7, 2, 'SMF One', 80000, NULL), (8, 2, 'SMF Two', 80000, NULL), (9, 2, 'SMF Three', 80000, NULL); -- -------------------------------------------------------- -- -- Table structure for table `booking` -- CREATE TABLE `booking` ( `id` int(11) NOT NULL, `arena_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `kode_booking` varchar(8) NOT NULL, `jam_tanggal` datetime NOT NULL, `durasi` tinyint(4) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `booking` -- INSERT INTO `booking` (`id`, `arena_id`, `user_id`, `kode_booking`, `jam_tanggal`, `durasi`) VALUES (1, 8, 1, 'MBGCHHLI', '2017-03-18 11:00:00', 2), (2, 1, 1, 'MNAVQYED', '2017-03-18 12:00:00', 2), (3, 1, 1, 'UCADQEOV', '2017-03-18 07:00:00', 3); -- -------------------------------------------------------- -- -- Table structure for table `ci_sessions` -- CREATE TABLE `ci_sessions` ( `id` varchar(128) NOT NULL, `ip_address` varchar(45) NOT NULL, `timestamp` int(10) UNSIGNED NOT NULL DEFAULT '0', `data` blob NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `invoice` -- CREATE TABLE `invoice` ( `id` int(11) NOT NULL, `booking_id` int(11) NOT NULL, `payment_id` int(11) DEFAULT NULL, `created` datetime NOT NULL, `expire_time` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `lapangan` -- CREATE TABLE `lapangan` ( `id` int(11) NOT NULL, `nama` varchar(128) NOT NULL, `alamat` varchar(128) NOT NULL, `id_pemilik` int(11) NOT NULL, `type` tinyint(4) NOT NULL, `link_foto` varchar(64) DEFAULT NULL, `telp` varchar(16) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `lapangan` -- INSERT INTO `lapangan` (`id`, `nama`, `alamat`, `id_pemilik`, `type`, `link_foto`, `telp`) VALUES (1, 'Viva Futsal', 'Jl. Bunga Andong, Soekarno-Hatta, Kota Malang', 11, 1, '43236fa13186b88d486e729b002a82a661df450d.png', '0341-5445577'), (2, 'SM Futsal', 'Jl. Sudimoro Kota Malang', 9, 1, 'b2db6db4380df3d22154eec974904babd71253e9.png', '0341-5445578'), (3, 'Champion Tidar', 'Jl. Puncak Mandala 42 Kota Malang', 10, 1, 'ce39ca77252894fe2ff680206d7c08d7acc9ce03.jpg', '0341-563451'); -- -------------------------------------------------------- -- -- Table structure for table `login_attempts` -- CREATE TABLE `login_attempts` ( `id` int(11) NOT NULL, `ip_address` varchar(40) COLLATE utf8_bin NOT NULL, `login` varchar(50) COLLATE utf8_bin NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Table structure for table `payment` -- CREATE TABLE `payment` ( `id` int(11) NOT NULL, `invoice_id` int(11) NOT NULL, `paid` tinyint(1) NOT NULL DEFAULT '0', `link_bukti` varchar(32) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `username` varchar(50) COLLATE utf8_bin NOT NULL, `password` varchar(255) COLLATE utf8_bin NOT NULL, `email` varchar(100) COLLATE utf8_bin NOT NULL, `access_level` tinyint(4) NOT NULL DEFAULT '1', `activated` tinyint(1) NOT NULL DEFAULT '1', `banned` tinyint(1) NOT NULL DEFAULT '0', `ban_reason` varchar(255) COLLATE utf8_bin DEFAULT NULL, `new_password_key` varchar(50) COLLATE utf8_bin DEFAULT NULL, `new_password_requested` datetime DEFAULT NULL, `new_email` varchar(100) COLLATE utf8_bin DEFAULT NULL, `new_email_key` varchar(50) COLLATE utf8_bin DEFAULT NULL, `last_ip` varchar(40) COLLATE utf8_bin NOT NULL, `last_login` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `username`, `password`, `email`, `access_level`, `activated`, `banned`, `ban_reason`, `new_password_key`, `new_password_requested`, `new_email`, `new_email_key`, `last_ip`, `last_login`, `created`, `modified`) VALUES (1, 'gifarydhimas', '$2a$10$a2ZDBIeG3r7GbQKMHtTvjesT5XNQ/5B47L6AFyBQ2nqztqOKw6mZy', 'gifarydhimas@test.com', 10, 1, 0, NULL, NULL, NULL, NULL, '8dffa36cac0158010fee7f169009483d', '127.0.0.1', '2017-03-18 10:17:06', '2016-01-30 08:55:01', '2017-03-18 03:17:06'), (4, 'testuser', '$2a$10$1WoIqZURMbRicSW/Iu.GOOIKUq5V9M.o67wZ8lvgiYI6L/Gxx5Nsm', 'tu@test.com', 1, 1, 0, NULL, NULL, NULL, 'dhimas98@gmail.com', '7ff435eab60db83fc2264b608cb73ad1', '115.178.216.46', '2016-04-26 23:26:42', '2016-04-26 22:39:12', '2017-03-16 10:19:49'), (8, 'nyoman', '$2a$10$7w/YV1OyfI7GAj.W/Z95BuWvkibDUeZRLXg4KROykuY9wAAKv24w6', 'ny@test.com', 1, 1, 0, NULL, NULL, NULL, NULL, '8f8741e7dc9278f9b24c82492ecc0c9d', '127.0.0.1', '2017-03-15 08:05:54', '2017-03-14 22:27:25', '2017-03-16 10:19:46'), (9, 'providerOne', '$2a$10$2/jNQgSs.VYDbquUkEMJUuQlsq3oRJqhEb0cH/8olNUIs6LD5LKHe', 'providerone@mail.local', 5, 1, 0, NULL, NULL, NULL, NULL, '40868039116b3a06e52f0d359e2670b5', '127.0.0.1', '1970-01-01 00:00:00', '2017-03-16 17:17:35', '2017-03-16 10:20:46'), (10, 'providerTwo', '$2a$10$UWII2UOFlH.Ck0YRPZ4BCukvy4GREUlvVuWDn7tEQZO55x37XECS.', 'providertwo@mail.local', 5, 1, 0, NULL, NULL, NULL, NULL, 'b4708be228b873337f3a67b4432f7faa', '127.0.0.1', '1970-01-01 00:00:00', '2017-03-16 17:18:44', '2017-03-16 10:20:46'), (11, 'provider3', '$2a$10$ILTo5luuaLx28kysSiNKaOo1O5knr44sHvpxSGLppnJV8YXMx/ul6', 'provider3@mail.local', 5, 1, 0, NULL, NULL, NULL, NULL, '9805a0a35d8106669d09dd84d287ca0b', '127.0.0.1', '1970-01-01 00:00:00', '2017-03-16 17:19:30', '2017-03-16 10:20:46'); -- -------------------------------------------------------- -- -- Table structure for table `user_autologin` -- CREATE TABLE `user_autologin` ( `key_id` char(32) COLLATE utf8_bin NOT NULL, `user_id` int(11) NOT NULL DEFAULT '0', `user_agent` varchar(150) COLLATE utf8_bin NOT NULL, `last_ip` varchar(40) COLLATE utf8_bin NOT NULL, `last_login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Table structure for table `user_profiles` -- CREATE TABLE `user_profiles` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `name` varchar(64) COLLATE utf8_bin DEFAULT NULL, `phone` varchar(16) COLLATE utf8_bin DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Dumping data for table `user_profiles` -- INSERT INTO `user_profiles` (`id`, `user_id`, `name`, `phone`) VALUES (2, 4, 'test user', NULL), (6, 8, 'Nyoman Satria', '081213887771'), (7, 9, 'Ahmad', '14045'), (8, 10, 'Budi', '14046'), (9, 11, 'Cinta', '14047'); -- -- Indexes for dumped tables -- -- -- Indexes for table `arena` -- ALTER TABLE `arena` ADD PRIMARY KEY (`id`); -- -- Indexes for table `booking` -- ALTER TABLE `booking` ADD PRIMARY KEY (`id`); -- -- Indexes for table `ci_sessions` -- ALTER TABLE `ci_sessions` ADD PRIMARY KEY (`id`), ADD KEY `ci_sessions_timestamp` (`timestamp`); -- -- Indexes for table `invoice` -- ALTER TABLE `invoice` ADD PRIMARY KEY (`id`); -- -- Indexes for table `lapangan` -- ALTER TABLE `lapangan` ADD PRIMARY KEY (`id`); -- -- Indexes for table `login_attempts` -- ALTER TABLE `login_attempts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `payment` -- ALTER TABLE `payment` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user_autologin` -- ALTER TABLE `user_autologin` ADD PRIMARY KEY (`key_id`,`user_id`); -- -- Indexes for table `user_profiles` -- ALTER TABLE `user_profiles` ADD PRIMARY KEY (`id`), ADD KEY `user_id` (`user_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `arena` -- ALTER TABLE `arena` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `booking` -- ALTER TABLE `booking` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `invoice` -- ALTER TABLE `invoice` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `lapangan` -- ALTER TABLE `lapangan` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `login_attempts` -- ALTER TABLE `login_attempts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `payment` -- ALTER TABLE `payment` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `user_profiles` -- ALTER TABLE `user_profiles` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- Constraints for dumped tables -- -- -- Constraints for table `user_profiles` -- ALTER TABLE `user_profiles` ADD CONSTRAINT `referential_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
30.838068
267
0.659143
b959d7af8b574a7e4a8b2f99959c3a7514efafbe
8,541
lua
Lua
game/ex/ex.lua
BAKAOLC/LuaSTG-LuaData
6434004ea9cb6ff1105a31e93ed40c26b7665537
[ "MIT" ]
null
null
null
game/ex/ex.lua
BAKAOLC/LuaSTG-LuaData
6434004ea9cb6ff1105a31e93ed40c26b7665537
[ "MIT" ]
null
null
null
game/ex/ex.lua
BAKAOLC/LuaSTG-LuaData
6434004ea9cb6ff1105a31e93ed40c26b7665537
[ "MIT" ]
null
null
null
-- luastg ex ex = {} ex.signals = {} ex.labels = {}--由OLC添加,用于储存指向object的标签,编辑器功能 function ex.Reset() ex.coops = {} ex.boss = {} ex.signals = {} ex.stageframe = 0 ex._item1 = 0 ex.labels = {}--由OLC添加,重置ex全局变量时,顺带清除object标签 end function ex.SetLabelToObject(label,obj)--由OLC添加,用于把一个obj添加进某个表里面,编辑器功能 ex.labels[label] = obj end function ex.GetObjectFromLabel(label)--由OLC添加,从某个表取出一个object,编辑器功能 if IsValid(ex.labels[label]) then return ex.labels[label] end end function ex.SetSignal(slot,value) ex.signals[slot] = value end function ex.ResetSignals() ex.signals = {} end function ex.WaitForSignal(slot,value) while ex.signals[slot]~=value do task.Wait(1) end end function ex.GetCardObject(name) return _editor_cards[name] end ex.coops = {} function ex:coopSpellCard(coopname,mode,waittime) --init local a=ex.coops[coopname] if ex.coops[coopname] == nil then a={} ex.coops[coopname]=a a.cardcount=0 a.firstfinish=0 a.finishcount=0 a.status={} end --join local finishcount=0 a.cardcount=a.cardcount+1 local b=a.cardcount a.status[b]=self.ex.status task.Wait(1) --waitforfinish while true do finishcount=0 a.status[b]=self.ex.status if self.ex.status==0 then finishcount=finishcount+1 break end for i=1,a.cardcount do finishcount=finishcount+a.status[i] end finishcount=a.cardcount-finishcount if mode==0 then if finishcount~=0 then finishcount=finishcount+1 boss.finishSpellC(self,true) break end end if mode==1 then if finishcount==a.cardcount-1 then finishcount=finishcount+1 boss.finishSpellC(self,true) break end end task.Wait(1) end a.finishcount=a.finishcount+1 if a.firstfinish==0 then a.firstfinish=stage.current_stage.timer end waittime=waittime+a.firstfinish-stage.current_stage.timer if a.finishcount==a.cardcount then a.cardcount=0 a.firstfinish=0 a.finishcount=0 a.status={} end if waittime>0 then task.Wait(waittime) end end function ex.UnitListUpdate(lst) local r={} local n=#lst local j=0 for i=1,n do local z=lst[i] if IsValid(z) then j=j+1 lst[j]=z; if i~=j then lst[i]=nil; end else lst[i]=nil; end end return j end function ex.UnitListAppend(lst,obj) if IsValid(obj) then local n=#lst lst[n+1]=obj return n+1 elseif IsValid(obj[1]) then return ex.UnitListAppendList(lst,obj) else return #lst end end function ex.UnitListAppendList(lst,objlist) local n=#lst local n2=#objlist for i=1,n2 do lst[n+i]=objlist[i] end return n+i end function ex.UnitListFindUnit(lst,obj) local n=#lst for i=1,n do local z=lst[i] if z==obj then return i end end return 0 end function ex.UnitListInsertEx(lst,obj) local l=ex.UnitListFindUnit(lst,obj) if l==0 then return ex.UnitListInsert(lst,obj) else return l end end function ex.LaserSampleByLength(laser,l) return laser.data:SampleByLength(l) end function ex.LaserSampleByTime(laser,l) return laser.data:LaserSampleByTime(l) end function ex:LaserFormByList(list,rev) local l=#list if l<2 then Del(self) end self.data=BentLaserData() --防止因_data删除导致老mod内重写的曲光使用该函数出错 if self._data then self._data=BentLaserData() end local _l=self._l if rev==nil then for i=l,2,-1 do self.x=list[i].x self.y=list[i].y self.timer=self.timer+1 if self.timer%4==0 then self.listx[(self.timer/4)%_l]=self.x self.listy[(self.timer/4)%_l]=self.y end self.data:Update(self,self.l,self.w) if self._data then self._data:Update(self,self.l,self.w+48) end end self.x=list[1].x self.y=list[1].y self.vx=self.x-list[2].x self.vy=self.y-list[2].y self.rot=self._angle else for i=1,l-1,1 do self.x=list[i].x self.y=list[i].y self.timer=self.timer+1 if self.timer%4==0 then self.listx[(self.timer/4)%_l]=self.x self.listy[(self.timer/4)%_l]=self.y end self.data:Update(self,self.l,self.w) if self._data then self._data:Update(self,self.l,self.w+48) end end self.x=list[l].x self.y=list[l].y self.vx=self.x-list[l-1].x self.vy=self.y-list[l-1].y end end function ex:LaserUpdateByList(list,rev) local l=#list if l<2 then return end self.data:UpdatePositionByList(list,l,self._w) --兼容性接口 if self._data then self._data:UpdatePositionByList(list,l,self._w+48) end end ex.boss={} function ex.GetRandomBoss() local n=#ex.boss n=ran:Int(1,n) return ex.boss[n] end function ex.GetFirstBoss() return ex.boss[1] end function ex.AddBoss(boss) ex.UnitListAppend(ex.boss,boss) _boss=boss end function ex.RemoveBoss(boss) local i=ex.UnitListFindUnit(ex.boss,boss) if i>0 then ex.boss[i]=0 end ex.UnitListUpdate(ex.boss); end function ex.ClearBonus(spell,chip) ex.UnitListUpdate(ex.boss); for i=1,#ex.boss do local z=ex.boss[i] if z.sc_bonus then z.sc_bonus=0 end if spell then z.chip_bonus=false end if chip then z.bombchip_bonus=false end end end MODE_SET=0 MODE_ADD=1 MODE_MUL=2 function ex.SmoothSetValueTo(valname,y,t,mode,setter,starttime,vmode) local self=task.GetSelf() if starttime then task.Wait(starttime) end t=int(t) t=max(1,t) local ys=0 if setter then ys=valname() else ys=self[valname] end local dy=y-ys if vmode==nil then vmode=MODE_SET end if vmode==MODE_ADD then dy=y elseif vmode==MODE_MUL then dy=ys*y-ys end if setter then if mode==1 then for s=1/t,1+0.5/t,1/t do s=s*s setter(ys+s*dy) coroutine.yield() end elseif mode==2 then for s=1/t,1+0.5/t,1/t do s=s*2-s*s setter(ys+s*dy) coroutine.yield() end elseif mode==3 then for s=1/t,1+0.5/t,1/t do if s<0.5 then s=s*s*2 else s=-2*s*s+4*s-1 end setter(ys+s*dy) coroutine.yield() end else for s=1/t,1+0.5/t,1/t do setter(ys+s*dy) coroutine.yield() end end else if mode==1 then for s=1/t,1+0.5/t,1/t do s=s*s self[valname]=ys+s*dy coroutine.yield() end elseif mode==2 then for s=1/t,1+0.5/t,1/t do s=s*2-s*s self[valname]=ys+s*dy coroutine.yield() end elseif mode==3 then for s=1/t,1+0.5/t,1/t do if s<0.5 then s=s*s*2 else s=-2*s*s+4*s-1 end self[valname]=ys+s*dy coroutine.yield() end else for s=1/t,1+0.5/t,1/t do self[valname]=ys+s*dy coroutine.yield() end end end end function ex.SmoothSetValueToEx(valname,y,t,mode,setter,starttime,vmode) local self=task.GetSelf() if starttime then task.Wait(starttime) end t=int(t) t=max(1,t) local ys=0 if setter then ys=valname() else ys=self[valname] end local dy=y-ys if vmode==nil then vmode=MODE_SET end if vmode==MODE_ADD then dy=y elseif vmode==MODE_MUL then dy=ys*y-ys end local lasts=0 if setter then if mode==1 then for s=1/t,1+0.5/t,1/t do s=s*s setter(valname()+(s-lasts)*dy) lasts=s coroutine.yield() end elseif mode==2 then for s=1/t,1+0.5/t,1/t do s=s*2-s*s setter(valname()+(s-lasts)*dy) lasts=s coroutine.yield() end elseif mode==3 then for s=1/t,1+0.5/t,1/t do if s<0.5 then s=s*s*2 else s=-2*s*s+4*s-1 end setter(valname()+(s-lasts)*dy) lasts=s coroutine.yield() end else for s=1/t,1+0.5/t,1/t do setter(valname()+(s-lasts)*dy) lasts=s coroutine.yield() end end else if mode==1 then for s=1/t,1+0.5/t,1/t do s=s*s self[valname]=self[valname]+(s-lasts)*dy lasts=s coroutine.yield() end elseif mode==2 then for s=1/t,1+0.5/t,1/t do s=s*2-s*s self[valname]=self[valname]+(s-lasts)*dy lasts=s coroutine.yield() end elseif mode==3 then for s=1/t,1+0.5/t,1/t do if s<0.5 then s=s*s*2 else s=-2*s*s+4*s-1 end self[valname]=self[valname]+(s-lasts)*dy lasts=s coroutine.yield() end else for s=1/t,1+0.5/t,1/t do self[valname]=self[valname]+(s-lasts)*dy lasts=s coroutine.yield() end end end end ex.stageframe = 0 ex._item1=0 function ex.Frame() ex.stageframe=ex.stageframe+1 player=jstg.players[ex.stageframe%#jstg.players+1] end UNIT_SECOND = 0 UNIT_FRAME = 1 UNIT_MUSIC = 2 ex.meterstart = 0 ex.meterclock = 1 function ex.GetMusicMeter(a) return a*ex.meterclock+meterstart end function ex.GetMusicFrame(a) return int(a*ex.meterclock*60+0.5) end function ex.WaitTo(t,u,d,a) if u==UNIT_SECOND then t=t*60 end if u==UNIT_MUSIC then t=(t*ex.meterclock+ex.meterstart)*60 end if a then t=int(t+0.5) else t=int(t-ex.stageframe) end if t<0 and d then return false end task.Wait(t) return true end
18.211087
77
0.671584
9a74911074b16f4f1e628f80856a37f5781538a7
785
rb
Ruby
lib/michigan/config.rb
bvrooman/michigan
03b82461ad02bf1b628d89515bc702cf11c7cd4c
[ "MIT" ]
null
null
null
lib/michigan/config.rb
bvrooman/michigan
03b82461ad02bf1b628d89515bc702cf11c7cd4c
[ "MIT" ]
null
null
null
lib/michigan/config.rb
bvrooman/michigan
03b82461ad02bf1b628d89515bc702cf11c7cd4c
[ "MIT" ]
null
null
null
# frozen_string_literal: true require 'logger' require_relative 'adaptor' module Michigan class Config @default_config = { adaptor_config: AdaptorConfig.new, logger: Logger.new($stdout) } @allowed_config_keys = @default_config.keys class << self attr_reader :default_config, :allowed_config_keys end attr_reader :config def initialize @config = OpenStruct.new(Config.default_config) end def configure(options) options.each do |key, value| @config.send("#{key.to_sym}=", value) if Config.allowed_config_keys.include? key.to_sym end end end def self.config @config ||= Config.new.config end def self.default_configuration @default_configuration || Config.new.config end end
19.625
95
0.686624
f4b85604e011bc52dc4325b8272117492b689b1b
3,553
ts
TypeScript
src/models/Proxies.ts
JaouherK/gateway
36620da32688fa8faa3f4b741e0a05de7e8c80c6
[ "MIT" ]
6
2019-08-23T18:36:50.000Z
2021-05-30T14:01:04.000Z
src/models/Proxies.ts
JaouherK/gateway
36620da32688fa8faa3f4b741e0a05de7e8c80c6
[ "MIT" ]
1
2020-05-11T11:40:33.000Z
2020-05-11T20:44:39.000Z
src/models/Proxies.ts
JaouherK/gateway
36620da32688fa8faa3f4b741e0a05de7e8c80c6
[ "MIT" ]
null
null
null
import {Column, CreatedAt, DataType, Model, PrimaryKey, Table, UpdatedAt} from "sequelize-typescript"; /** * @swagger * components: * schemas: * Proxies: * type: object * required: * - namespacesId * - namespace * - url * - https * - method * - denyUpload * - limit * - authType * - timeout * - integrationType * - order * properties: * namespacesId: * type: string * description: ID of Base route of the whole. * namespace: * type: string * description: text of Base route of the whole. * url: * type: string * description: full route to be parsed * endpointUrl: * type: string * description: Url to forward request to * https: * type: boolean * description: enable/disable https * method: * type: string * description: any of HTTP methods * denyUpload: * type: boolean * description: accept or deny file upload * limit: * type: number * description: limit of parsed json * authType: * type: string * description: type of auth jwt/public/apiKey * timeout: * type: string * description: timout to respond to requesting call * integrationType: * type: string * description: mock response or forward http * mockResponseBody: * type: string * description: mocked body of response * mockResponseCode: * type: number * description: mocked http code of response * mockResponseContent: * type: string * description: mocked type of response * order: * type: number * description: Order to be taken in consideration in proxies parsing * hiddenFields: * type: string * description: Hidden fields while logging * example: * namespacesId: 21249527-5051-4308-a747-298ebcf3f8d5 * namespace: test * url: /test * endpointUrl: * https: true * method: GET * denyUpload: true * limit: 1mb * authType: jwt * timeout: 29000 * integrationType: MOCK * mockResponseBody: {"description": "Sample Namespace"} * mockResponseCode: 200 * mockResponseContent: application/json * order: 0 */ @Table export class Proxies extends Model<Proxies> { @PrimaryKey @Column id!: string; @Column namespacesId!: string; @Column namespace!: string; @Column url!: string; @Column endpointUrl!: string; @Column https!: boolean; @Column method!: string; @Column denyUpload!: boolean; @Column limit!: string; @Column authType!: string; @Column timeout!: number; @Column integrationType!: string; @Column(DataType.TEXT) mockResponseBody!: string; @Column mockResponseCode!: number; @Column mockResponseContent!: string; @Column(DataType.TEXT) hiddenFields!: string; @Column order!: number; @CreatedAt @Column createdAt!: Date; @UpdatedAt @Column updatedAt!: Date; }
23.529801
102
0.523783
224f3aaedee92df751298da9572fab9d5e40baf2
209
sh
Shell
buildNano.sh
eugeniomiro/arduino
02d54378f2adbd485f6e9ee40fc6f209c2b7c57a
[ "MIT" ]
null
null
null
buildNano.sh
eugeniomiro/arduino
02d54378f2adbd485f6e9ee40fc6f209c2b7c57a
[ "MIT" ]
null
null
null
buildNano.sh
eugeniomiro/arduino
02d54378f2adbd485f6e9ee40fc6f209c2b7c57a
[ "MIT" ]
null
null
null
arduino-cli compile -b arduino:avr:nano:cpu=atmega328old ../timeConsole exit_code=$? if [ $exit_code -eq 0 ]; then arduino-cli upload -b arduino:avr:nano:cpu=atmega328old ../timeConsole -p /dev/ttyUSB0 fi
34.833333
90
0.741627
8e53e75869b4440c9fd9c54b5ea8422d82e35cad
698
js
JavaScript
src/components/modules/index.js
AhmedAlihashi/Slang
73ea6581562d8c70a3d6b548b53c925398dfa8d1
[ "MIT" ]
null
null
null
src/components/modules/index.js
AhmedAlihashi/Slang
73ea6581562d8c70a3d6b548b53c925398dfa8d1
[ "MIT" ]
1
2022-02-27T19:30:09.000Z
2022-02-27T19:30:09.000Z
src/components/modules/index.js
AhmedAlihashi/Slang
73ea6581562d8c70a3d6b548b53c925398dfa8d1
[ "MIT" ]
null
null
null
export { default as SlangCard } from "./SlangCard"; export { default as Placeholder } from "./Placeholder"; export { default as VideoPlayer } from "./VideoPlayer"; export { default as ContentOptions } from "./ContentOptions"; export { default as SlangModal } from "./SlangModal"; //sections export { default as CommentSection } from "./sections/CommentSection"; export { default as InfoSection } from "./sections/InfoSection"; export { default as ShareSection } from "./sections/ShareSection"; export { default as VidReplySection } from "./sections/VidReplySection"; export { default as SaveSection } from "./sections/SaveSection"; export { default as FlagSection } from "./sections/FlagSection";
49.857143
72
0.749284
7fcd9d079a70225188b9b915ee253f5ef8aa4766
838
php
PHP
resources/views/chat.blade.php
bself/vue-chat
c4398714a0dcaf70d7c36eab4cd869853b7b0c93
[ "MIT" ]
null
null
null
resources/views/chat.blade.php
bself/vue-chat
c4398714a0dcaf70d7c36eab4cd869853b7b0c93
[ "MIT" ]
null
null
null
resources/views/chat.blade.php
bself/vue-chat
c4398714a0dcaf70d7c36eab4cd869853b7b0c93
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Chat</title> <meta name="csrf-token" content="{{ csrf_token() }}"> <link rel="stylesheet" type="text/css" href="{{ asset('css/app.css') }}"> </head> <body> <div class="container"> <div class="row" id="app"> <div class="col-md-6 offset-md-3"> <ul class="list-group"> <li class="list-group-item active">Chat Room</li> <li class="list-group-item">Dapibus ac facilisis in</li> <li class="list-group-item">Morbi leo risus</li> <li class="list-group-item">Porta ac consectetur ac</li> <li class="list-group-item">Vestibulum at eros</li> <input type="text" name="" class="form-control" placeholder="type your message"> </ul> </div> </div> </div> <script type="text/javascript" src="{{ asset('js/app.js') }}"></script> </body> </html>
32.230769
85
0.625298
b0fa5a637e0252b2259d81f1bb3d675a4c5f256b
2,655
py
Python
scripts/common.py
osddeitf/handwriting-font
b4142567e9a1b3399c1e5fb202f131f2b5d2c075
[ "DOC", "ImageMagick" ]
null
null
null
scripts/common.py
osddeitf/handwriting-font
b4142567e9a1b3399c1e5fb202f131f2b5d2c075
[ "DOC", "ImageMagick" ]
null
null
null
scripts/common.py
osddeitf/handwriting-font
b4142567e9a1b3399c1e5fb202f131f2b5d2c075
[ "DOC", "ImageMagick" ]
null
null
null
import numpy as np import aglfn import fontforge import subprocess params = {'template': 'template-256.png', 'sample_file': 'sample.png', 'name_list': 'aglfn.txt', 'new_font_file': 'sachacHand.sfd', 'new_otf': 'sachacHand.otf', 'new_font_name': 'sachacHand', 'new_family_name': 'sachacHand', 'new_full_name': 'sachacHand', 'text_color': 'lightgray', 'glyph_dir': 'glyphs/', 'letters': 'HOnodpagscebhklftijmnruwvxyzCGABRDLEFIJKMNPQSTUVWXYZ0123456789?:;-–—=!\'’"“”@/\\~_#$%&()*+,.<>[]^`{|}q', 'direction': 'vertical', 'em': 1000, 'em_width': 1000, 'x_height': 368, 'caps': 650, 'ascent': 800, 'descent': 200, 'rows': 10, 'columns': 10, 'row_padding': 0, 'width': 500, 'height': 500, 'line_width': 3, 'text': "Python+FontForge+Org: I made a font based on my handwriting!" } fontforge.loadNamelist(params['name_list']) params['font_size'] = int(params['em']) params['baseline'] = params['em'] - params['descent'] def transpose_letters(letters, width, height): return ''.join(np.reshape(list(letters.ljust(width * height)), (height, width)).transpose().reshape(-1)) # Return glyph name of s, or s if none (possibly variant) def glyph_name(s): return aglfn.name(s) or s def get_glyph(font, g): pos = font.findEncodingSlot(g) if pos == -1: return font.createChar(pos, g) else: return font[pos] def glyph_matrix(font=None, matrix=None, letters=None, rows=0, columns=0, direction='horizontal', **kwargs): if matrix: if isinstance(matrix[0], str): # Split each matrix = [x.split(',') for x in matrix] else: matrix = matrix[:] # copy the list else: matrix = np.reshape(list(letters.ljust(rows * columns)), (rows, columns)) if direction == 'vertical': matrix = matrix.transpose() matrix = [[glyph_name(x) if x != 'None' else None for x in row] for row in matrix] if font: for r, row in enumerate(matrix): for c, col in enumerate(row): if col is None: continue matrix[r][c] = get_glyph(font, col) return matrix def glyph_filename_base(glyph_name): try: return 'uni%s-%s' % (hex(ord(aglfn.to_glyph(glyph_name))).replace('0x', '').zfill(4), glyph_name) except: return glyph_name def load_font(params): if type(params) == str: return fontforge.open(params) else: return fontforge.open(params['new_font_file']) def save_font(font, font_filename=None, **kwargs): if font_filename is None: font_filename = font.fontname + '.sfd' font.save(font_filename) font.generate(font_filename.replace('.sfd', '.otf')) subprocess.call(['sfnt2woff', font_filename.replace('.sfd', '.otf')])
29.5
118
0.656497
a3945c3680ddc40600914d7d637c96adc2170b35
451
java
Java
src/simulator/factories/MoveFirstStrategyBuilder.java
marynyzcc/TrafficSimulator
409a244d953de1211b58580e260189b354f8f888
[ "MIT" ]
null
null
null
src/simulator/factories/MoveFirstStrategyBuilder.java
marynyzcc/TrafficSimulator
409a244d953de1211b58580e260189b354f8f888
[ "MIT" ]
null
null
null
src/simulator/factories/MoveFirstStrategyBuilder.java
marynyzcc/TrafficSimulator
409a244d953de1211b58580e260189b354f8f888
[ "MIT" ]
null
null
null
package simulator.factories; import org.json.JSONObject; import simulator.model.DequeuingStrategy; import simulator.model.MoveFirstStrategy; public class MoveFirstStrategyBuilder extends Builder<DequeuingStrategy>{ public MoveFirstStrategyBuilder() { super("move_first_dqs"); } @Override protected DequeuingStrategy createTheInstance(JSONObject data) { MoveFirstStrategy dq = new MoveFirstStrategy(); return dq; } }
22.55
74
0.773836
4bceb6db9c1b556dc4a5a223eb1f11812fc236b0
658
dart
Dart
lib/src/ui/views/test_notification.dart
getclosr/get_closr
dee932301b8596004adbd270057a2935dde5709f
[ "MIT" ]
null
null
null
lib/src/ui/views/test_notification.dart
getclosr/get_closr
dee932301b8596004adbd270057a2935dde5709f
[ "MIT" ]
null
null
null
lib/src/ui/views/test_notification.dart
getclosr/get_closr
dee932301b8596004adbd270057a2935dde5709f
[ "MIT" ]
null
null
null
import 'package:flutter/material.dart'; import 'package:overlay_support/overlay_support.dart'; class TestView extends StatelessWidget { const TestView({Key key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( child: RaisedButton( onPressed: () { showSimpleNotification( Text("this is a message from simple notification"), background: Colors.green); }, child: Text("Auto Dimiss Notification"), ), ), ), ); } }
26.32
73
0.547112
c4cc1dc3cdae8ced08454b7bd6976ab3a3f096e7
809
cpp
C++
Documents/RacimoAire/Libreria/Prueba3PMS/mainwindow.cpp
JoseSalamancaCoy/RACIMO_AIRE
628d6ff184a30af0efd25bff675b0006500d4ba2
[ "MIT" ]
null
null
null
Documents/RacimoAire/Libreria/Prueba3PMS/mainwindow.cpp
JoseSalamancaCoy/RACIMO_AIRE
628d6ff184a30af0efd25bff675b0006500d4ba2
[ "MIT" ]
null
null
null
Documents/RacimoAire/Libreria/Prueba3PMS/mainwindow.cpp
JoseSalamancaCoy/RACIMO_AIRE
628d6ff184a30af0efd25bff675b0006500d4ba2
[ "MIT" ]
null
null
null
#include "mainwindow.h" #include "ui_mainwindow.h" #define GPIOSet 16 #define GPIOReSet 12 #define GPIORX 26 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); GPIO = new Crpigpio; PMSSensor = new PMS(GPIO,GPIOSet, GPIOReSet, GPIORX); connect(PMSSensor, SIGNAL(newData(uint16_t,uint16_t,uint16_t)),this, SLOT(newDataPMS(uint16_t,uint16_t,uint16_t))); } MainWindow::~MainWindow() { PMSSensor->sleep(); delete PMSSensor; delete GPIO, delete ui; } void MainWindow::newDataPMS(uint16_t PM_1_0, uint16_t PM_2_5, uint16_t PM_10) { QString comando= "clear"; system(qPrintable(comando)); qDebug() << "Data PM1 ="<< PM_1_0; qDebug() << "Data PM2.5 ="<< PM_2_5; qDebug() << "Data PM10 ="<< PM_10; }
23.794118
119
0.677379
b379837c0a01e37ea15d64736e07364c22416996
888
kt
Kotlin
paris/src/main/java/com/airbnb/paris/proxies/ViewGroupProxy.kt
vinaygaba/paris
0e47deb31abc039fe7c0161e5a4a9d35a567888b
[ "Apache-2.0" ]
null
null
null
paris/src/main/java/com/airbnb/paris/proxies/ViewGroupProxy.kt
vinaygaba/paris
0e47deb31abc039fe7c0161e5a4a9d35a567888b
[ "Apache-2.0" ]
null
null
null
paris/src/main/java/com/airbnb/paris/proxies/ViewGroupProxy.kt
vinaygaba/paris
0e47deb31abc039fe7c0161e5a4a9d35a567888b
[ "Apache-2.0" ]
1
2021-04-19T17:45:09.000Z
2021-04-19T17:45:09.000Z
package com.airbnb.paris.proxies import android.animation.LayoutTransition import android.view.ViewGroup import com.airbnb.paris.R2 import com.airbnb.paris.annotations.Attr import com.airbnb.paris.annotations.Styleable @Styleable("Paris_ViewGroup") class ViewGroupProxy(view: ViewGroup) : BaseProxy<ViewGroupProxy, ViewGroup>(view) { @Attr(R2.styleable.Paris_ViewGroup_android_animateLayoutChanges) fun setAnimateLayoutChanges(animateLayoutChanges: Boolean) { view.layoutTransition = if (animateLayoutChanges) LayoutTransition() else null } @Attr(R2.styleable.Paris_ViewGroup_android_clipChildren) fun setClipChildren(clipChildren: Boolean) { view.clipChildren = clipChildren } @Attr(R2.styleable.Paris_ViewGroup_android_clipToPadding) fun setClipToPadding(clipToPadding: Boolean) { view.clipToPadding = clipToPadding } }
31.714286
86
0.783784
3f1a035f7af3d8160f0d433ce7608a899ddaa5c8
134
rb
Ruby
lib/bright/email_address.rb
Arux-Software/Bright
669478a76a5570a83daa7a6d788787c8df4975c6
[ "MIT" ]
1
2016-01-27T18:12:48.000Z
2016-01-27T18:12:48.000Z
lib/bright/email_address.rb
Arux-Software/Bright
669478a76a5570a83daa7a6d788787c8df4975c6
[ "MIT" ]
null
null
null
lib/bright/email_address.rb
Arux-Software/Bright
669478a76a5570a83daa7a6d788787c8df4975c6
[ "MIT" ]
null
null
null
module Bright class EmailAddress < Model @attribute_names = [:email_address] attr_accessor *@attribute_names end end
16.75
39
0.716418
a14178929ea7db20a6c17f4edc742e82a25251ea
1,247
ts
TypeScript
cli/build/config/webpack.devServer.config.ts
Neloreck/dreamplate
b56c225bcbc54c7adab73d872aadc4d450172fd4
[ "MIT" ]
1
2021-04-02T18:23:41.000Z
2021-04-02T18:23:41.000Z
cli/build/config/webpack.devServer.config.ts
Neloreck/dreamplate
b56c225bcbc54c7adab73d872aadc4d450172fd4
[ "MIT" ]
16
2020-03-28T01:11:56.000Z
2022-02-26T10:07:22.000Z
cli/build/config/webpack.devServer.config.ts
Neloreck/dreamplate
b56c225bcbc54c7adab73d872aadc4d450172fd4
[ "MIT" ]
null
null
null
import { BACKEND_PUBLIC_PATH, DEV_SERVER_CONTENT_BASE, DEV_SERVER_HOST, DEV_SERVER_PORT, IS_PRODUCTION, MODULES_CONFIG } from "./webpack.constants"; import { IModulesDefinition } from "./webpack.types"; /** * Generate fallback redirects/urls for dev server history usage. */ const createFallbackRewrites = (definition: IModulesDefinition) => { const rewrites: Array<{ from: RegExp; to: string }> = []; for (const module of definition.modules) { if (Array.isArray(module.path)) { for (const from of module.path) { rewrites.push({ from: new RegExp(from), to: `/html/${module.name}.html` }); } } else { rewrites.push({ from: new RegExp(module.path), to: `/html/${module.name}.html` }); } } return rewrites; }; export const DEV_SERVER_CONFIG: Record<string, any> = { clientLogLevel: "error", compress: IS_PRODUCTION, contentBase: DEV_SERVER_CONTENT_BASE, headers: { // "Cache-Control": "max-age=60" }, historyApiFallback: { rewrites: createFallbackRewrites(MODULES_CONFIG) }, host: DEV_SERVER_HOST, hot: true, // http2: true, // Unsupported for node 10+. https: false, inline: !IS_PRODUCTION, port: DEV_SERVER_PORT, publicPath: BACKEND_PUBLIC_PATH };
25.979167
88
0.681636
dc1a3466a7cfcc0449f68422e952e9a967fc251b
41
rb
Ruby
lib/mothership/version.rb
cloudfoundry-attic/mothership
8a4f951343cb21d276ae37b96760a38da63b0e1b
[ "Apache-2.0" ]
null
null
null
lib/mothership/version.rb
cloudfoundry-attic/mothership
8a4f951343cb21d276ae37b96760a38da63b0e1b
[ "Apache-2.0" ]
null
null
null
lib/mothership/version.rb
cloudfoundry-attic/mothership
8a4f951343cb21d276ae37b96760a38da63b0e1b
[ "Apache-2.0" ]
1
2021-04-07T10:37:06.000Z
2021-04-07T10:37:06.000Z
class Mothership VERSION = "0.5.0" end
10.25
19
0.682927
79cc6274d620568153969f54f2e5e61fc02a8975
238
php
PHP
resources/views/admin/estimate/timing_block_note_edit.blade.php
BabkoSergey/Reports
6e9e7bbc0d6ee6c5a5d35932eef726d0deae5f08
[ "MIT" ]
null
null
null
resources/views/admin/estimate/timing_block_note_edit.blade.php
BabkoSergey/Reports
6e9e7bbc0d6ee6c5a5d35932eef726d0deae5f08
[ "MIT" ]
4
2021-09-02T00:41:09.000Z
2022-02-26T19:03:46.000Z
resources/views/admin/estimate/timing_block_note_edit.blade.php
BabkoSergey/Reports
6e9e7bbc0d6ee6c5a5d35932eef726d0deae5f08
[ "MIT" ]
null
null
null
<div class="col-md-12 timing-block-content-text jq_timing-block-text"> {!! Form::textarea('content', null, ['class' => 'form-control jq_timing-block-text-content cke-textarea', 'id' =>'block-text-content-', 'rows' => '1']) !!} </div>
59.5
159
0.655462
b196cb0461fe43cff44a77a85f8f0caca0885e5e
9,620
py
Python
python_scripts/git_odoo.py
mao-odoo/my_odoo_aliases_and_scripts
a17f00599b34aa8ff6f860524dc7b1a465c5639f
[ "MIT" ]
1
2020-11-26T15:49:37.000Z
2020-11-26T15:49:37.000Z
python_scripts/git_odoo.py
mao-odoo/my_odoo_aliases_and_scripts
a17f00599b34aa8ff6f860524dc7b1a465c5639f
[ "MIT" ]
2
2020-03-24T12:35:18.000Z
2021-09-18T16:51:39.000Z
python_scripts/git_odoo.py
damnalex/my_odoo_aliases_and_scripts
3e7e2cf8052401118fe1551f9d17966d214eaf18
[ "MIT" ]
2
2020-08-26T09:22:23.000Z
2020-12-08T17:30:02.000Z
#!/usr/bin/env python3 """ git_odoo usage: git_odoo checkout (<version>... | --dbname <dbname>) git_odoo pull [--version <version> | --all] git_odoo fetch git_odoo list options: --dbname=<dbname> name of the database to use to select the right version to checkout --version=<version> version to pull or checkout to --all pull all relevant branches """ from docopt import docopt import psycopg2 import git from utils import env # relevant_saas_versions = ["12.3"] # RELEVANT_BRANCHES = [f"saas-{s}" for s in relevant_saas_versions] # RELEVANT_BRANCHES += ["12.0", "13.0", "14.0"] # optimize for smaller checkout between versions on git_odoo pull --all RELEVANT_BRANCHES = [ "12.0", "saas-12.3", "13.0", "14.0", ] VERSIONED_REPOS = [env.ODOO, env.ENTERPRISE, env.DESIGN_THEMES, env.USER_DOC] SINGLE_VERSION_REPOS = [env.INTERNAL, env.PAAS] SUPPORT_REPOS = [env.ST] ALL_REPOS = VERSIONED_REPOS + SINGLE_VERSION_REPOS + SUPPORT_REPOS def _repos(repos_names): """Generator of repo objects for repos_names repos.""" for rn in repos_names: # assuming repos_names is either a list of full paths # or folders in ~/src if "/" not in rn: rn = f"{env.SRC}/{rn}" yield git.Repo(rn) def _try_for_all_remotes( repo, F, *fargs, raise_on_exception=True, stop_on_success=True, verbose=False, **fkwargs, ): # execute the function :F on all remotes, until one succeeds # the remote is give to :F as a keyword argument, with the key `remote` added. # if :raise_on_exception is True and none of the remotes succeeded, # the first git error is reraised. If :raise_on_exception is False, # the git errors are simply printed. # if :stop_on_success is True, the process stops as soon as a succesful # execution of :F happens. remotes = [repo.remotes.origin] + [ rem for rem in repo.remotes if rem != repo.remotes.origin ] # storing all errors to help debugging git_errors = [] res = [] for remote in remotes: if verbose: print(f"remote: {remote}") fkwargs["remote"] = remote try: res += [F(*fargs, **fkwargs)] except git.exc.GitCommandError as ge: git_errors.append(ge) if not stop_on_success: print(f"Error : {ge}") print("------------------") else: if stop_on_success: break else: if raise_on_exception: raise git_errors[0] elif git_errors and stop_on_success: print(f"Error : {git_errors[0]}") print("------------------") return res def shorten_path(path): # return just the last bit of the path return path.split("/")[-1] class DetachedHeadError(Exception): pass class TooManyVersions(Exception): pass def _nbr_commits_ahead_and_behind(repo): try: branch_name = repo.active_branch.name except TypeError as e: if str(e).startswith("HEAD is a detached symbolic reference"): raise DetachedHeadError raise def count_commits(remote_name="origin", ahead=True): s = "{remote}/{branch}..{branch}" if ahead else "{branch}..{remote}/{branch}" s = s.format(remote=remote_name, branch=branch_name) # HACK: getting the length of a generator nbr_commit = sum(1 for _ in repo.iter_commits(s)) return nbr_commit def commits_aheads_and_behind(*args, **kwargs): nbr_commit_ahead = count_commits(remote_name=kwargs["remote"].name, ahead=True) nbr_commit_behind = count_commits( remote_name=kwargs["remote"].name, ahead=False ) return (nbr_commit_ahead, nbr_commit_behind) return _try_for_all_remotes(repo, commits_aheads_and_behind)[0] def list_all_repos_info(): """display the available information regarding the community, enterprise, design themes, internal, paas and support-tools current branch """ repos = ALL_REPOS for repo_name, repo in zip(repos, _repos(repos)): repo_name = shorten_path(repo_name) print(repo_name) try: nbr_ahead, nbr_behind = _nbr_commits_ahead_and_behind(repo) except git.exc.GitCommandError: print(f" {repo.active_branch.name}") except DetachedHeadError: print(f" HEAD --> {repo.head.commit}") else: nb_tabul = 3 if len(repo.active_branch.name) < 6 else 2 tabuls = "\t" * nb_tabul print(f" {repo.active_branch.name}{tabuls}↓ {nbr_behind} ↑ {nbr_ahead}") if repo.index.diff(None): print(" !!! With unstaged changes !!!") if repo.index.diff("HEAD"): print(" !!! With uncommited changes !!!") def fetch_all_repos_info(): """updates the available information regarding the community, enterprise, design themes, internal, paas and support-tools repos """ def fetch(*args, **kwargs): kwargs["remote"].fetch() repos = ALL_REPOS for repo_name, repo in zip(repos, _repos(repos)): repo_name = shorten_path(repo_name) print(f"fetching {repo_name}") _try_for_all_remotes( repo, fetch, raise_on_exception=False, stop_on_success=False, verbose=True ) def odoo_repos_pull(version=None, fast=False): """Updates branches of the community, enterprise and design themes repos. If no version is provided, update the current branche. If :version is not a string, itterate on it and update the given branches sequentially. """ if version and isinstance(version, list): for v in version: odoo_repos_pull(v, fast) fast = True # only pull internal and paas once return failed_checkouts = [] if version: failed_checkouts = odoo_repos_checkout([version]) repos = VERSIONED_REPOS[:] if not fast: repos += SINGLE_VERSION_REPOS if failed_checkouts: for fc in failed_checkouts: repos.remove(fc) def pull(*args, **kwargs): kwargs["remote"].pull() for repo_name, repo in zip(repos, _repos(repos)): repo_name = shorten_path(repo_name) print(f"Pulling {repo_name}") _try_for_all_remotes(repo, pull, raise_on_exception=False) def _get_version_from_db(dbname): """get the odoo version of the given DB""" with psycopg2.connect(f"dbname='{dbname}'") as conn, conn.cursor() as cr: query = "SELECT replace((regexp_matches(latest_version, '^\d+\.0|^saas~\d+\.\d+|saas~\d+'))[1], '~', '-') FROM ir_module_module WHERE name='base'" cr.execute(query) return cr.fetchone()[0] def _stash_and_checkout(repo, version): """Stash checkout and clean a given repo""" repo.git.stash() repo.git.checkout(version) repo.git.clean("-df") def odoo_repos_checkout(versions): """checkout to the :versions branche of the community, enterprise and design themes repos. If only one version is given, uses it for odoo, enterprise and design-themes If mutliple versions are given, uses them in the order odoo, enterprise, design-themes, internal If the number of versions is greater than the number of handled repos, the remaining version are ignored (but a warning is shown) returns a list of the repos for which the checkout failed """ if len(versions) > 1: odoo_repos_checkout_multi(versions) return else: version = versions[0] # 1 version given, use it for the main standard odoo repos repos = VERSIONED_REPOS[:] if version == "8.0": repos.remove(env.ENTERPRISE) failed_checkouts = [] for repo_path, repo in zip(repos, _repos(repos)): repo_name = shorten_path(repo_path) print(f"checkouting {repo_name} to {version}") try: _stash_and_checkout(repo, version) except git.exc.GitCommandError as err: print(f'Could not checkout repo "{repo_name}" to version "{version}"') print("Failed with the following error:") print(err) failed_checkouts.append(repo_path) return failed_checkouts def odoo_repos_checkout_multi(versions, raise_on_error=False): repos = [env.ODOO, env.ENTERPRISE, env.DESIGN_THEMES, env.INTERNAL] if len(versions) > len(repos): if raise_on_error: raise TooManyVersions( f"There are too many version given ({len(versions)}). Maximum is {len(repos)}." ) print(f"too many params, ignoring the following {versions[len(repos):]}") for version, repo_name, repo in zip(versions, repos, _repos(repos)): repo_name = shorten_path(repo_name) print(f"checkouting {repo_name} to {version}") _stash_and_checkout(repo, version) def App(**opt): # opt is a docopt style dict if opt.get("list"): list_all_repos_info() return if opt.get("fetch"): fetch_all_repos_info() return if opt.get("pull"): version = opt.get("--version") if opt.get("--all"): version = RELEVANT_BRANCHES odoo_repos_pull(version) return if opt.get("checkout"): version = opt.get("<version>") if not version: dbname = opt.get("--dbname") version = [_get_version_from_db(dbname)] odoo_repos_checkout(version) return if __name__ == "__main__": # args parsing opt = docopt(__doc__) App(**opt)
32.721088
154
0.634511
dc0937a7b49d8c433a1e866b1765b4e21d1f4c76
978
ts
TypeScript
test/utils.ts
kazupon/nuxt-i18n-next
ace7f7021ce6bc17d5552502aa19a029889a80bf
[ "MIT" ]
11
2021-11-13T13:28:42.000Z
2022-01-28T15:39:56.000Z
test/utils.ts
kazupon/nuxt-i18n-next
ace7f7021ce6bc17d5552502aa19a029889a80bf
[ "MIT" ]
3
2021-12-17T14:36:25.000Z
2022-03-15T01:02:57.000Z
test/utils.ts
kazupon/nuxt-i18n-next
ace7f7021ce6bc17d5552502aa19a029889a80bf
[ "MIT" ]
null
null
null
import { pathToFileURL } from 'url' import { listen } from 'listhen' import { resolve } from 'pathe' import { createCommonJS } from 'mlly' import type { NitroContext } from './types' import type { RequestListener } from 'http' import type { ListenOptions } from 'listhen' const _default = (r: any) => r.default || r // eslint-disable-line @typescript-eslint/no-explicit-any // FIXME: https://github.com/microsoft/TypeScript/issues/43329 // module: node12 will be replace it const _importDynamic = new Function('modulePath', 'return import(modulePath)') const cjs = createCommonJS(import.meta.url) export function importModule(path: string) { return _importDynamic(pathToFileURL(path).href).then(_default) } export function fixtureDir(name: string) { return resolve(cjs.__dirname, 'fixtures', name) } export async function startServer( ctx: NitroContext, handle: RequestListener, opts = {} as Partial<ListenOptions> ) { ctx.server = await listen(handle, opts) }
31.548387
101
0.740286
a1648c9cb9ec5cfa27a6c0ee555f2b5bda04a61b
211
ts
TypeScript
frontend/src/common/components/hocr/constants.ts
zachrenwick/AzureSearchSolution
1e39eea2694f07459148de16f454deef0d575fa4
[ "MIT" ]
4,537
2018-08-23T19:37:17.000Z
2019-05-06T12:48:19.000Z
frontend/src/common/components/hocr/constants.ts
zachrenwick/AzureSearchSolution
1e39eea2694f07459148de16f454deef0d575fa4
[ "MIT" ]
64
2019-05-09T12:07:02.000Z
2022-03-30T16:10:42.000Z
frontend/src/common/components/hocr/constants.ts
zachrenwick/AzureSearchSolution
1e39eea2694f07459148de16f454deef0d575fa4
[ "MIT" ]
732
2018-08-23T17:25:33.000Z
2019-05-06T13:29:40.000Z
export const hocrAttributes = { dataAnnotation: 'data-annotation', }; export const hocrClasses = { page: 'ocr_page', area: 'ocr_carea', paragraph: 'ocr_par', line: 'ocr_line', word: 'ocrx_word', };
17.583333
36
0.668246
a1579844ee93d041ba645df7ba520a3212a2b94c
548
asm
Assembly
oeis/176/A176537.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/176/A176537.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/176/A176537.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A176537: Decimal expansion of 5 + sqrt(26). ; Submitted by Jon Maiga ; 1,0,0,9,9,0,1,9,5,1,3,5,9,2,7,8,4,8,3,0,0,2,8,2,2,4,1,0,9,0,2,2,7,8,1,9,8,9,5,6,3,7,7,0,9,4,6,0,9,9,5,9,6,4,0,7,5,8,4,9,7,0,8,0,4,4,2,5,9,3,3,6,3,2,0,6,2,2,2,4,1,9,5,5,8,8,3,4,8,8,5,1,0,9,3,9,3,2,0,0 mov $1,1 mov $2,1 mov $3,$0 mul $3,4 sub $3,$0 sub $0,1 lpb $3 mul $1,$3 mul $2,$3 add $1,$2 mul $2,10 cmp $6,0 add $5,$6 div $1,$5 div $2,$5 add $2,$1 sub $3,1 lpe mov $4,10 pow $4,$0 mov $6,$4 cmp $6,0 add $4,$6 div $2,$4 div $1,$2 mod $1,10 mov $0,$1
17.125
201
0.521898
0df59325c6bd2dc432aeba1b28ff10febb6b4bec
1,161
lua
Lua
app/common/validation/autonumber_common.lua
lmnotran/gecko_sdk
2e82050dc8823c9fe0e8908c1b2666fb83056230
[ "Zlib" ]
69
2021-12-16T01:34:09.000Z
2022-03-31T08:27:39.000Z
app/common/validation/autonumber_common.lua
lmnotran/gecko_sdk
2e82050dc8823c9fe0e8908c1b2666fb83056230
[ "Zlib" ]
6
2022-01-12T18:22:08.000Z
2022-03-25T10:19:27.000Z
app/common/validation/autonumber_common.lua
lmnotran/gecko_sdk
2e82050dc8823c9fe0e8908c1b2666fb83056230
[ "Zlib" ]
21
2021-12-20T09:05:45.000Z
2022-03-28T02:52:28.000Z
-- automatic conversion of input parameters to number local autonumber_common = {} function autonumber_common.autonumber(input) logit("Autonumber function.") local base = 10 local orig_input = input if (type(input) == "string") then input = input:gsub("[\(\)\"uUlL]", "") if string.find(input,"[bxhBXH]") ~= nil then if string.find(string.lower(input), "0b") == 1 then input = input:gsub("[bB]","") base = 2 elseif string.find(string.lower(input), "0x") == 1 then input = input:gsub("[xXhH]","") base = 16 end elseif string.find(input, "0") == 1 then base = 8 end elseif (type(input) == "number") then return input else logit("autonumber() expects either a string or a number!") return nil end local result = tonumber(input, base) if result == nil then logit("Configured value is not valid: \"" .. tostring(orig_input) .. "\" - modify it to a numeric value!") end return result end return autonumber_common
34.147059
115
0.548665
fa436636d8dac56b1c2ef14b9a1b811fc6eae866
10,898
hpp
C++
include/algebra/array/multi_array.hpp
hyperpower/Nablla
5a9be9f3b064a235572a1a2c9c5c2c19118697c5
[ "MIT" ]
null
null
null
include/algebra/array/multi_array.hpp
hyperpower/Nablla
5a9be9f3b064a235572a1a2c9c5c2c19118697c5
[ "MIT" ]
null
null
null
include/algebra/array/multi_array.hpp
hyperpower/Nablla
5a9be9f3b064a235572a1a2c9c5c2c19118697c5
[ "MIT" ]
null
null
null
/************************ // \file multi_array.hpp // \brief // // \author czhou // \date 20 janv. 2018 ***********************/ #ifndef MULTI_ARRAY_HPP_ #define MULTI_ARRAY_HPP_ #include <iostream> #include <assert.h> #include "algebra/algebra_define.hpp" #include <array> #include "array_list.hpp" namespace carpio { template<typename T, St DIM> class MultiArray_ { public: static const St Dim = DIM; // type definitions=================== typedef T value_t; typedef MultiArray_<value_t, Dim> Self; typedef MultiArray_<value_t, Dim>* pSelf; typedef T* pointer; typedef const T* const_pointer; typedef T& reference; typedef const T& const_reference; typedef St size_type; typedef St difference_type; typedef typename ArrayListT_<value_t>::iterator iterator; typedef typename ArrayListT_<value_t>::const_iterator const_iterator; private: std::array<St, Dim> m_len; ArrayListT_<value_t> m_mp; public: //constructor========================== MultiArray_(){ m_len.fill(0); } MultiArray_(const Self& a){ this->m_len = a.m_len; this->m_mp = a.m_mp; } MultiArray_(St iLen, St jLen= 0, St kLen= 0){ St len = iLen; this->m_len[0] = iLen; if (Dim >= 2) { ASSERT(iLen > 0 && jLen > 0); this->m_len[1] = jLen; len *= jLen; } if (Dim == 3) { ASSERT(iLen > 0 && jLen > 0 && kLen > 0); this->m_len[2] = kLen; len *= kLen; } this->m_mp.reconstruct(len); } void reconstruct(St iLen, St jLen = 0, St kLen= 0){ St len = iLen; this->m_len[0] = iLen; if (Dim >= 2) { ASSERT(iLen > 0 && jLen > 0); this->m_len[1] = jLen; len *= jLen; } if (Dim == 3) { ASSERT(iLen > 0 && jLen > 0 && kLen > 0); this->m_len[2] = kLen; len *= kLen; } this->m_mp.reconstruct(len); } //============================================= MultiArray_<T, DIM>& operator=(const MultiArray_<T, DIM>& a){ if (this == &a) { return *this; } this->m_len = a.m_len; this->m_mp = a.m_mp; return *this; } //============================================= ~MultiArray_() { } //Capacity===================================== St size() const { return m_mp.size(); } St size_i() const { return m_len[0]; } St size_j() const { return Dim >= 2 ? m_len[1] : 0; } St size_k() const { return Dim >= 3 ? m_len[2] : 0; } bool empty() const { return m_mp.empty(); } /* * iterator */ iterator begin() { return m_mp.begin(); } const_iterator begin() const { return m_mp.begin(); } iterator end() { return m_mp.end(); } const_iterator end() const { return m_mp.end(); } //Element access=============================== St to_1d_idx(St i, St j = 0, St k = 0) const{ ASSERT(i < this->m_len[0]); if (Dim >= 2) ASSERT(j < this->m_len[1]); if (Dim >= 3) ASSERT(k < this->m_len[2]); std::array<St, Dim> inp; inp[0] = i; if (Dim >= 2) { inp[1] = j; } if (Dim >= 3) { inp[2] = k; } St idx = 0; for (St ii = 0; ii < Dim; ii++) { St b = 1; for (St jj = ii + 1; jj < Dim; jj++) { b *= m_len[jj]; } idx += b * inp[ii]; } return idx; } reference at(St i, St j= 0, St k= 0){ St idx = to_1d_idx(i, j, k); return m_mp[idx]; } const_reference at(St i, St j = 0, St k = 0) const{ St idx = to_1d_idx(i, j, k); return m_mp[idx]; } reference operator()(St i, St j = 0, St k = 0){ return at(i, j, k); } const_reference operator()(St i, St j = 0, St k = 0) const{ return at(i, j, k); } reference at_1d(St i){ return m_mp[i];} const_reference at_1d(St i) const{ return m_mp[i];} T get(St i, St j = 0, St k = 0){ return at(i, j, k); } void set(const T& value, St i, St j = 0, St k = 0){ this->at(i, j, k) = value; } void assign(const T& value){ m_mp.assign(value); } //element access=============================== // T* getpValue(St i, St = 0, St = 0); //not good inline bool check_idx(St dim, St idx) const { ASSERT(dim < Dim); if (idx >= 0 && idx < m_len[dim]) { return true; } else { return false; } } inline bool check_idx_ijk(St i, St j, St k) const { return check_idx(0, i) && ((Dim >= 2) ? check_idx(1, j) : true) && ((Dim >= 3) ? check_idx(2, k) : true); } inline St count_equal(const T& nd) const { //overload == return m_mp.count_equal(nd); } }; template<typename T, St DIM> class MultiArrayV_ { public: static const St Dim = DIM; // type definitions=================== typedef T value_t; typedef MultiArrayV_<value_t, Dim> Self; typedef MultiArrayV_<value_t, Dim>& ref_Self; typedef const MultiArrayV_<value_t, Dim>& const_ref_Self; typedef MultiArrayV_<value_t, Dim>* pSelf; typedef T* pointer; typedef const T* const_pointer; typedef T& reference; typedef const T& const_reference; typedef St size_type; typedef St difference_type; typedef typename ArrayListT_<value_t>::iterator iterator; typedef typename ArrayListT_<value_t>::const_iterator const_iterator; private: std::array<St, Dim> m_len; ArrayListV_<value_t> m_mp; public: //constructor========================== MultiArrayV_(){ m_len.fill(0); } MultiArrayV_(const Self& a): m_len(a.m_len), m_mp(a.m_mp){ } MultiArrayV_(St iLen, St jLen= 0, St kLen= 0){ St len = iLen; this->m_len[0] = iLen; if (Dim >= 2) { ASSERT(iLen > 0 && jLen > 0); this->m_len[1] = jLen; len *= jLen; } if (Dim >= 3) { ASSERT(iLen > 0 && jLen > 0 && kLen > 0); this->m_len[2] = kLen; len *= kLen; } this->m_mp.reconstruct(len); } void reconstruct(St iLen, St jLen = 0, St kLen= 0){ St Len = 0; this->m_len[0] = iLen; if (Dim == 1) { Len = iLen; } if (Dim >= 2) { ASSERT(iLen > 0 && jLen > 0); this->m_len[1] = jLen; Len = iLen * jLen; } if (Dim >= 3) { ASSERT(iLen > 0 && jLen > 0 && kLen > 0); this->m_len[2] = kLen; Len = iLen * jLen * kLen; } this->m_mp.reconstruct(Len); } //============================================= ref_Self operator=(const Self& a){ if (this == &a) { return *this; } this->m_len = a.m_len; this->m_mp = a.m_mp; return *this; } //============================================= ~MultiArrayV_() { } //Capacity===================================== St size() const { return m_mp.size(); } St size_i() const { return m_len[0]; } St size_j() const { return Dim >= 2 ? m_len[1] : 0; } St size_k() const { return Dim >= 3 ? m_len[2] : 0; } bool empty() const { return m_mp.empty(); } bool is_compatible(const Self& other) const{ for(St i = 0; i< Dim;++i){ if(m_len[i] != other.m_len[i]){ return false; } } return true; } /* * iterator */ iterator begin() { return m_mp.begin(); } const_iterator begin() const { return m_mp.begin(); } iterator end() { return m_mp.end(); } const_iterator end() const { return m_mp.end(); } //Element access=============================== St to_1d_idx(St i, St j = 0, St k = 0) const{ ASSERT(i < this->m_len[0]); if (Dim >= 2) ASSERT(j < this->m_len[1]); if (Dim >= 3) ASSERT(k < this->m_len[2]); std::array<St, Dim> inp; inp[0] = i; if (Dim >= 2) { inp[1] = j; } if (Dim >= 3) { inp[2] = k; } St idx = 0; for (St ii = 0; ii < Dim; ii++) { St b = 1; for (St jj = ii + 1; jj < Dim; jj++) { b *= m_len[jj]; } idx += b * inp[ii]; } return idx; } reference at(const St& i, const St& j= 0, const St& k= 0){ St idx = to_1d_idx(i, j, k); return m_mp[idx]; } const_reference at(const St& i, const St& j = 0, const St& k = 0) const{ St idx = to_1d_idx(i, j, k); return m_mp[idx]; } reference operator()(const St& i, const St& j = 0, const St& k = 0){ return at(i, j, k); } const_reference operator()(const St i, const St j = 0, const St k = 0) const{ return at(i, j, k); } reference at_1d(St i){ return m_mp[i];} const_reference at_1d(St i) const{ return m_mp[i];} T get(St i, St j = 0, St k = 0){ return at(i, j, k); } void set(const T& value, St i, St j = 0, St k = 0){ this->at(i, j, k) = value; } void assign(const T& value){ m_mp.assign(value); } T max() const { return this->m_mp.max(); } T min() const { return this->m_mp.min(); } void abs(){ this->m_mp.abs(); } T norm1() const{ return this->m_mp.norm1(); } T norm2() const{ return this->m_mp.norm2(); } T norminf() const{ return this->m_mp.norminf(); } //element access=============================== inline bool check_idx(St dim, St idx) const { ASSERT(dim < Dim); if (idx >= 0 && idx < m_len[dim]) { return true; } else { return false; } } inline bool check_idx_ijk(St i, St j, St k) const { return check_idx(0, i) && ((Dim >= 2) ? check_idx(1, j) : true) && ((Dim >= 3) ? check_idx(2, k) : true); } inline St count_equal(const T& nd) const { //overload == return m_mp.count_equal(nd); } // operator ==================================== Self operator-(){ Self res(*this); res.m_mp = -res.m_mp; return res; } ref_Self operator+=(const Self& a) { ASSERT(this->is_compatible(a)); m_mp += a.m_mp; return *this; } ref_Self operator-=(const Self& a) { ASSERT(this->is_compatible(a)); m_mp -= a.m_mp; return *this; } ref_Self operator*=(const Self& a) { ASSERT(this->is_compatible(a)); m_mp *= a.m_mp; return *this; } ref_Self operator/=(const Self& a) { ASSERT(this->is_compatible(a)); m_mp /= a.m_mp; return *this; } ref_Self operator+=(const Vt& a) { m_mp += a; return *this; } ref_Self operator-=(const Vt& a) { m_mp -= a; return *this; } ref_Self operator*=(const Vt& a) { m_mp *= a; return *this; } ref_Self operator/=(const Vt& a) { m_mp /= a; return *this; } }; template<typename T, St DIM> MultiArrayV_<T, DIM> Abs(const MultiArrayV_<T, DIM> a){ MultiArrayV_<T, DIM> res(a); } } #endif /* MULTI_ARRAY_HPP */
22.751566
73
0.497706
db7662eb72cf01fc0603dd7d17dbb353f4bd5e46
4,198
php
PHP
app/Http/Controllers/SubCategoryController.php
inkomomutane/salaofenn
5a02c6431ccfa0b69aff3d971f83e1220861f9c0
[ "MIT" ]
1
2022-01-29T12:48:42.000Z
2022-01-29T12:48:42.000Z
app/Http/Controllers/SubCategoryController.php
inkomomutane/salaofenn
5a02c6431ccfa0b69aff3d971f83e1220861f9c0
[ "MIT" ]
null
null
null
app/Http/Controllers/SubCategoryController.php
inkomomutane/salaofenn
5a02c6431ccfa0b69aff3d971f83e1220861f9c0
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers; use App\Http\Requests\SubCategory\CreateSubCategory; use App\Http\Requests\SubCategory\UpdateSubCategory; use App\SubCategory; //use Illuminate\Http\Request; //use Illuminate\Support\Facades\Validator; class SubCategoryController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return SubCategory::all(); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('backend.dashboard.subCategory')->with('subCategories',SubCategory::all()); } /** * Store a newly created resource in storage. * * @param \App\Http\Requests\Category\CreateCategory $createCategoryRequest * @return \Illuminate\Http\Response */ public function store(CreateSubCategory $createCategoryRequest) { try { $created = SubCategory::Create( $createCategoryRequest->all() ); session()->flash('success','Sub - category inserted successful'); return redirect()->back();//json(['Category'=>$created,'message'=>'Category inserted successful','status'=>201],201); } catch (\Throwable $th) { session()->flash('error','Error inserting sub - category'); return redirect()->back();//json(['error'=>$th],404); } } /** * Display the specified resource. * * @param \App\Category $category * @return \Illuminate\Http\Response */ public function show(SubCategory $subcategory) { return $subcategory->with('category')->where('id',$subcategory->id)->first(); } /** * Show the form for editing the specified resource. * * @param \App\Category $category * @return \Illuminate\Http\Response */ public function edit(SubCategory $subcategory) { // } /** * Update the specified resource in storage. * * @param \App\Http\Requests\Category\UpdateCategory $updateCategoryRequest * @param \App\Category $category * @return \Illuminate\Http\Response */ public function update(UpdateSubCategory $updateCategoryRequest, SubCategory $subcategory) { try { // dd($updateCategoryRequest->all()); $subcategory->update($updateCategoryRequest->all()); session()->flash('success','Sub- Category Updated successful'); return redirect()->back(); // return response()->json(['Category'=>$category,'message'=>'Category updated successful','status'=>201],201); } catch (\Throwable $th) { session()->flash('error','Error Updating sub - category'); return redirect()->back(); // return response()->json(['error'=>'Error on updating data. Please try again.'],404); //throw $th; } } /** * Remove the specified resource from storage. * * @param \App\Category $category * @return \Illuminate\Http\Response */ public function destroy(SubCategory $subcategory) { try { if($subcategory->products->count()<=0){ $subcategory->delete(); session()->flash('success','Sub - category deleted successful'); return redirect()->back(); }else{ session()->flash('error','Error cannot delete sub - category having products or services'); return redirect()->back(); } //json(['Category'=>$created,'message'=>'Category inserted successful','status'=>201],201); //return response()->json(['message'=>'Data deleted Successful', 'status'=>201],201); } catch (\Throwable $th) { // return response()->json(['message'=>'Error on deleting data. Please try again.','status'=>404],404); session()->flash('error','Error deleting sub - category'); return redirect()->back();//json(['error'=>$th],404); } } }
33.31746
127
0.582897
e243cf9a7cfffbd6d11083152c500e1135a55724
11,132
py
Python
log_parser/parser.py
mohsenasm/Python-Spark-Log-Parser
a559f0820aca09e72df44aba13a439a8bcf1b906
[ "MIT" ]
null
null
null
log_parser/parser.py
mohsenasm/Python-Spark-Log-Parser
a559f0820aca09e72df44aba13a439a8bcf1b906
[ "MIT" ]
null
null
null
log_parser/parser.py
mohsenasm/Python-Spark-Log-Parser
a559f0820aca09e72df44aba13a439a8bcf1b906
[ "MIT" ]
null
null
null
import json from datetime import datetime from numpy import array from graphviz import Digraph from log_parser.block_manager import BlockManager from log_parser.executor import Executor from log_parser.job import Job from log_parser.job import Task def get_json(line): # Need to first strip the trailing newline, and then escape newlines (which can appear # in the middle of some of the JSON) so that JSON library doesn't barf. return json.loads(line.strip("\n").replace("\n", "\\n")) class LogParser: def __init__(self, filename, is_logging_enable=False): self.filename = filename self.parsed_data = {} # empty dicts. self.block_managers = [] # empty lists. self.executors = {} self.jobs = {} self.tasks = {} self.is_logging_enable = is_logging_enable def do_SparkListenerLogStart(self, data): self.parsed_data["spark_version"] = data["Spark Version"] # parsed_data is a empty dict. def do_SparkListenerBlockManagerAdded(self, data): bm = BlockManager(data) self.block_managers.append(bm) # block_managers is a empty list def do_SparkListenerEnvironmentUpdate(self, data): self.parsed_data["java_version"] = data["JVM Information"]["Java Version"] self.parsed_data["app_name"] = data["Spark Properties"]["spark.app.name"] self.parsed_data["app_id"] = data["Spark Properties"]["spark.app.id"] # self.parsed_data["driver_memory"] = data["Spark Properties"]["spark.driver.memory"] # self.parsed_data["executor_memory"] = data["Spark Properties"]["spark.executor.memory"] self.parsed_data["commandline"] = data["System Properties"]["sun.java.command"] def do_SparkListenerApplicationStart(self, data): self.parsed_data["app_start_timestamp"] = data["Timestamp"] def do_SparkListenerApplicationEnd(self, data): self.parsed_data["app_end_timestamp"] = data["Timestamp"] def do_SparkListenerJobStart(self, data): job_id = data["Job ID"] if job_id in self.jobs: print("ERROR: Duplicate job ID!") return job = Job(data) # that class Job # job = return s self.jobs[job_id] = job # record into the `dict` def do_SparkListenerStageSubmitted(self, data): pass def do_SparkListenerExecutorAdded(self, data): exec_id = data["Executor ID"] self.executors[exec_id] = Executor(data) def do_SparkListenerTaskStart(self, data): task_id = data["Task Info"]["Task ID"] self.tasks[task_id] = Task(data) def do_SparkListenerTaskEnd(self, data): task_id = data["Task Info"]["Task ID"] self.tasks[task_id].finish(data) def do_SparkListenerExecutorRemoved(self, data): exec_id = data["Executor ID"] self.executors[exec_id].remove(data) def do_SparkListenerBlockManagerRemoved(self, data): pass def do_SparkListenerStageCompleted(self, data): stage_id = data["Stage Info"]["Stage ID"] for j in self.jobs.values(): for s in j.stages: # class Stage in job.py if s.stage_id == stage_id: s.complete(data) def do_SparkListenerJobEnd(self, data): job_id = data["Job ID"] self.jobs[job_id].complete(data) def process_name_only(self): with open(self.filename, "r") as log_file: for line in log_file: json_data = get_json(line) event_type = json_data["Event"] if event_type == "SparkListenerEnvironmentUpdate": self.do_SparkListenerEnvironmentUpdate(json_data) def process(self): with open(self.filename, "r") as log_file: unsupported_event_types = set() for line in log_file: json_data = get_json(line) event_type = json_data["Event"] # 13 event types if event_type == "SparkListenerLogStart": self.do_SparkListenerLogStart(json_data) elif event_type == "SparkListenerBlockManagerAdded": self.do_SparkListenerBlockManagerAdded(json_data) elif event_type == "SparkListenerEnvironmentUpdate": self.do_SparkListenerEnvironmentUpdate(json_data) elif event_type == "SparkListenerApplicationStart": self.do_SparkListenerApplicationStart(json_data) elif event_type == "SparkListenerApplicationEnd": self.do_SparkListenerApplicationEnd(json_data) elif event_type == "SparkListenerJobStart": self.do_SparkListenerJobStart(json_data) elif event_type == "SparkListenerStageSubmitted": self.do_SparkListenerStageSubmitted(json_data) elif event_type == "SparkListenerExecutorAdded": self.do_SparkListenerExecutorAdded(json_data) elif event_type == "SparkListenerTaskStart": self.do_SparkListenerTaskStart(json_data) elif event_type == "SparkListenerTaskEnd": self.do_SparkListenerTaskEnd(json_data) elif event_type == "SparkListenerExecutorRemoved": self.do_SparkListenerExecutorRemoved(json_data) elif event_type == "SparkListenerBlockManagerRemoved": self.do_SparkListenerBlockManagerRemoved(json_data) elif event_type == "SparkListenerStageCompleted": self.do_SparkListenerStageCompleted(json_data) elif event_type == "SparkListenerJobEnd": self.do_SparkListenerJobEnd(json_data) else: # print("WARNING: unknown event type: " + event_type) unsupported_event_types.add(event_type) if len(unsupported_event_types) > 0 and self.is_logging_enable: print("WARNING: unknown event types:\n\t{}".format("\n\t".join(unsupported_event_types))) # Link block managers and executors for bm in self.block_managers: if bm.executor_id != "driver": self.executors[bm.executor_id].block_managers.append(bm) for t in self.tasks.values(): self.executors[t.executor_id].tasks.append(t) for j in self.jobs.values(): for s in j.stages: if s.stage_id == t.stage_id: s.tasks.append(t) self.parsed_data["num_failed_tasks"] = 0 self.parsed_data["num_success_tasks"] = 0 for t in self.tasks.values(): if t.end_reason != "Success": self.parsed_data["num_failed_tasks"] += 1 else: self.parsed_data["num_success_tasks"] += 1 # Total average and stddev task run time all_runtimes = [x.finish_time - x.launch_time for x in self.tasks.values() if x.end_reason == "Success"] all_runtimes = array(all_runtimes) self.parsed_data["tot_avg_task_runtime"] = all_runtimes.mean() self.parsed_data["tot_std_task_runtime"] = all_runtimes.std() self.parsed_data["min_task_runtime"] = all_runtimes.min() self.parsed_data["max_task_runtime"] = all_runtimes.max() def get_app_name(self): return self.parsed_data["app_name"] def get_app_id(self): return self.parsed_data["app_id"] def generate_report(self): # return s s = "Report for '{}' execution {}\n".format(self.parsed_data["app_name"], self.parsed_data["app_id"]) s += "Spark version: {}\n".format(self.parsed_data["spark_version"]) s += "Java version: {}\n".format(self.parsed_data["java_version"]) s += "Application Start time: {}\n".format( datetime.fromtimestamp(self.parsed_data["app_start_timestamp"] / 1000)) s += "Application End time: {}\n".format(datetime.fromtimestamp(self.parsed_data["app_end_timestamp"] / 1000)) s += "Commandline: {}\n\n".format(self.parsed_data["commandline"]) s += "---> Jobs <---\n" s += "In total, there are {} jobs in {}\n".format(len(self.jobs), self.parsed_data["app_name"]) s += "\n" for j in self.jobs.values(): s += j.report(0) s += "\n" s += "---> Tasks <---\n" s += "Total tasks: {}\n".format(len(self.tasks)) s += "Successful tasks: {}\n".format(self.parsed_data["num_success_tasks"]) s += "Failed tasks: {}\n".format(self.parsed_data["num_failed_tasks"]) s += "Task average runtime: {} ({} stddev)\n".format(self.parsed_data["tot_avg_task_runtime"], self.parsed_data["tot_std_task_runtime"]) s += "Task min/max runtime: {} min, {} max\n".format(self.parsed_data["min_task_runtime"], self.parsed_data["max_task_runtime"]) for t in self.tasks.values(): s += t.report(0) s += "\n" s += "---> Executors <---\n" s += "In total, there are {} executors in {}\n".format(len(self.executors), self.parsed_data["app_name"]) s += "\n" for e in self.executors.values(): s += e.report(0) s += "\n" s += "---> Block managers <---\n" s += "In total, there are {} block managers in {}\n".format(len(self.block_managers), self.parsed_data["app_name"]) for bm in self.block_managers: s += bm.report(0) s += "\n" # print('generate_report is finished.') return s def save_plot_of_stages_dag(self, filename, view=False): dag = Digraph() for j in self.jobs.values(): for s in j.stages: assert type(s.stage_id) == int dag.node(str(s.stage_id), f"{s.stage_id} ({s.get_completion_time()}ms, j={j.job_id})") for j in self.jobs.values(): for s in j.stages: for parent in s.parent_ids: assert type(parent) == int assert type(s.stage_id) == int dag.edge(str(parent), str(s.stage_id)) dag.render(filename, view=view) def save_plot_of_rdds_dag(self, filename, view=False): dag = Digraph() for j in self.jobs.values(): for s in j.stages: for r in s.RDDs: assert type(r.rdd_id) == int dag.node(str(r.rdd_id), f"{r.name} {r.rdd_id} (j={j.job_id}, s={s.stage_id})") for j in self.jobs.values(): for s in j.stages: for r in s.RDDs: for parent in r.parent_ids: assert type(parent) == int assert type(r.rdd_id) == int dag.edge(str(parent), str(r.rdd_id)) dag.render(filename, view=view)
42.166667
118
0.589112
cd6eb3d5c04cf4d4fa9302a3194a1c0557a38606
154
cs
C#
Source/Minesweeper.Framework/MinePutters/MinePutterDifficulty.cs
lunacys/Minesweeper
a75ada22ec26aee35b34d585b0140d1480364fd1
[ "MIT" ]
null
null
null
Source/Minesweeper.Framework/MinePutters/MinePutterDifficulty.cs
lunacys/Minesweeper
a75ada22ec26aee35b34d585b0140d1480364fd1
[ "MIT" ]
null
null
null
Source/Minesweeper.Framework/MinePutters/MinePutterDifficulty.cs
lunacys/Minesweeper
a75ada22ec26aee35b34d585b0140d1480364fd1
[ "MIT" ]
1
2020-09-22T03:59:37.000Z
2020-09-22T03:59:37.000Z
namespace Minesweeper.Framework.MinePutters { public enum MinePutterDifficulty { Random, Hard, Easy, Cheat } }
15.4
43
0.577922
ae873ee5303cd0e3eba22d6a6ded2a889a68b24d
2,079
cs
C#
CoDN/Assets/Scripts/Game/UI/CompileButtons/PlayButton.cs
Pisc0/CoDN
d8930ba6f9f075cbea787c15fe6092d5ddf38153
[ "Apache-2.0" ]
null
null
null
CoDN/Assets/Scripts/Game/UI/CompileButtons/PlayButton.cs
Pisc0/CoDN
d8930ba6f9f075cbea787c15fe6092d5ddf38153
[ "Apache-2.0" ]
null
null
null
CoDN/Assets/Scripts/Game/UI/CompileButtons/PlayButton.cs
Pisc0/CoDN
d8930ba6f9f075cbea787c15fe6092d5ddf38153
[ "Apache-2.0" ]
null
null
null
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //Clase encargada de comenzar la simulación del código public class PlayButton : MonoBehaviour { [SerializeField] private CodeObject code; [SerializeField] private GameHandler gameHandler; private TaskSystem taskSystem; [SerializeField] private Slider slider; [SerializeField] private Image image; [SerializeField] private Sprite playSprite; [SerializeField] private Sprite stopSprite; private AudioManager audioManager; private void Start() { audioManager = GameObject.FindWithTag("AudioManager").GetComponent<AudioManager>(); } public void PlayCode() { ButtonPress(); UpdateSprite(); if (gameHandler.IsPaused) { taskSystem = TaskSystemFromCode(); gameHandler.SetTaskSystem(taskSystem); gameHandler.SetPause(false); gameHandler.SetTimeScale(slider.value); } else { gameHandler.SetPause(true); gameHandler.ResetGameState(); gameHandler.SetTimeScale(1); } } //Crea el TaskSystem de las células a partir del CodeObject referenciado public TaskSystem TaskSystemFromCode() { TaskSystem TS = new TaskSystem(); //Recorre el código genético y añade las tareas que debe realizar la célula foreach (TaskSlot t in code.Container) { string info = t.task.Info; Task task = new Task(t.task.Type, info); TS.addTask(task); } return TS; } //Actualiza el sprite del botón public void UpdateSprite() { if (gameHandler.IsPaused) { image.sprite = playSprite; } else { image.sprite = stopSprite; } } //Reproduce un sonido al presionar el botón public void ButtonPress() { if (audioManager != null) { audioManager.Play("ButtonPress"); } } }
27
91
0.613276
9c5a4844a43e444a59d36d483b079c44f3dd5bee
2,027
rb
Ruby
spec/components/cards/latest_event_component_spec.rb
GayeCord/get-into-teaching-app
75a8fd3b95e7fcf07f3b03846cdc2456071b2807
[ "MIT" ]
6
2021-03-15T15:53:02.000Z
2021-12-09T22:56:34.000Z
spec/components/cards/latest_event_component_spec.rb
GayeCord/get-into-teaching-app
75a8fd3b95e7fcf07f3b03846cdc2456071b2807
[ "MIT" ]
2,221
2020-05-06T08:16:29.000Z
2022-03-31T17:26:35.000Z
spec/components/cards/latest_event_component_spec.rb
GayeCord/get-into-teaching-app
75a8fd3b95e7fcf07f3b03846cdc2456071b2807
[ "MIT" ]
6
2020-12-21T15:44:47.000Z
2022-03-18T16:12:07.000Z
require "rails_helper" RSpec.describe Cards::LatestEventComponent, type: :component do subject { render_inline(instance) && page } let(:page_data) { Pages::Data.new } let(:url_helpers) { Rails.application.routes.url_helpers } let(:event) { build(:event_api, name: "Test event") } let(:instance) { described_class.new card: card, page_data: page_data } let(:card) { { "category" => "train to teach event" } } let(:find_events_header) { Cards::FindEventsComponent::HEADER } context "with category" do before do allow(page_data).to receive(:latest_event_for_category) .with("train to teach event") .and_return event end context "with events" do it { is_expected.to have_css ".card" } it { is_expected.to have_css ".card.card--no-border" } it { is_expected.to have_css ".card header", text: event.name } it { is_expected.to have_css "img[alt='A photograph of staff chatting in a school setting']" } it { is_expected.to have_content event.summary } it "includes the footer link" do is_expected.to have_link \ "View event", href: url_helpers.event_path(event.readable_id), class: "git-link" end end context "with no events" do let(:event) { nil } it { is_expected.to have_css ".card header", text: find_events_header } it { is_expected.to have_link "View events", href: url_helpers.events_path } end end context "with unknown category" do include_context "with stubbed types api" let(:card) { { "category" => "unknown" } } before { allow(Sentry).to receive(:capture_exception).and_call_original } it { is_expected.to have_css ".card header", text: find_events_header } end context "with no category" do include_context "with stubbed types api" let(:card) { {} } before { allow(Sentry).to receive(:capture_exception).and_call_original } it { is_expected.to have_css ".card header", text: find_events_header } end end
32.174603
100
0.670942
a334132719b07acadb01e29d9d6d45ef233a5260
3,282
h
C
src/Stream/Topic.h
geishm-ansto/kafka-to-nexus
7e968b06e72b4353b44ac2900613162d80e68df9
[ "BSD-2-Clause" ]
null
null
null
src/Stream/Topic.h
geishm-ansto/kafka-to-nexus
7e968b06e72b4353b44ac2900613162d80e68df9
[ "BSD-2-Clause" ]
null
null
null
src/Stream/Topic.h
geishm-ansto/kafka-to-nexus
7e968b06e72b4353b44ac2900613162d80e68df9
[ "BSD-2-Clause" ]
null
null
null
// SPDX-License-Identifier: BSD-2-Clause // // This code has been produced by the European Spallation Source // and its partner institutes under the BSD 2 Clause License. // // See LICENSE.md at the top level for license information. // // Screaming Udder! https://esss.se #pragma once #include "Kafka/BrokerSettings.h" #include "Kafka/ConsumerFactory.h" #include "Metrics/Registrar.h" #include "Partition.h" #include "Stream/MessageWriter.h" #include "ThreadedExecutor.h" #include "logger.h" #include <chrono> #include <vector> namespace Stream { class Topic { public: Topic(Kafka::BrokerSettings const &Settings, std::string const &Topic, SrcToDst Map, MessageWriter *Writer, Metrics::Registrar &RegisterMetric, time_point StartTime, duration StartTimeLeeway, time_point StopTime, duration StopTimeLeeway, std::unique_ptr<Kafka::ConsumerFactoryInterface> CreateConsumers = std::make_unique<Kafka::ConsumerFactory>()); /// \brief Must be called after the constructor. /// \note This function exist in order to make unit testing possible. void start(); /// \brief Stop the consumer threads. /// /// Non blocking. Will tell the consumer threads to stop as soon as possible. /// There are no guarantees for when the consumers are actually stopped. void stop(); void setStopTime(std::chrono::system_clock::time_point StopTime); bool isDone() { return IsDone.load(); }; virtual ~Topic() = default; protected: std::atomic_bool IsDone{false}; Kafka::BrokerSettings KafkaSettings; std::string TopicName; SrcToDst DataMap; MessageWriter *WriterPtr; time_point StartConsumeTime; duration StartLeeway; time_point StopConsumeTime; duration StopLeeway; duration CurrentMetadataTimeOut; Metrics::Registrar Registrar; // This intermediate function is required for unit testing. virtual void initMetadataCalls(Kafka::BrokerSettings const &Settings, std::string const &Topic); virtual void getPartitionsForTopic(Kafka::BrokerSettings const &Settings, std::string const &Topic); virtual void getOffsetsForPartitions(Kafka::BrokerSettings const &Settings, std::string const &Topic, std::vector<int> const &Partitions); virtual void createStreams(Kafka::BrokerSettings const &Settings, std::string const &Topic, std::vector<std::pair<int, int64_t>> const &PartitionOffsets); virtual std::vector<std::pair<int, int64_t>> getOffsetForTimeInternal(std::string const &Broker, std::string const &Topic, std::vector<int> const &Partitions, time_point Time, duration TimeOut) const; virtual std::vector<int> getPartitionsForTopicInternal(std::string const &Broker, std::string const &Topic, duration TimeOut) const; void checkIfDone(); virtual void checkIfDoneTask(); std::vector<std::unique_ptr<Partition>> ConsumerThreads; std::unique_ptr<Kafka::ConsumerFactoryInterface> ConsumerCreator; ThreadedExecutor Executor; // Must be last }; } // namespace Stream
34.547368
80
0.680073
0dbc975677cefbf996d968a8d78279b62969361d
81
sql
SQL
db/migrations/sqls/20200511112430-add-unique-constraint-to-call-id-up.sql
nax2uk/NHS-VV
e8023dc4b65926096dcedcb472f5defe89f137fc
[ "MIT" ]
null
null
null
db/migrations/sqls/20200511112430-add-unique-constraint-to-call-id-up.sql
nax2uk/NHS-VV
e8023dc4b65926096dcedcb472f5defe89f137fc
[ "MIT" ]
1
2020-10-28T17:04:58.000Z
2020-10-28T17:04:58.000Z
db/migrations/sqls/20200511112430-add-unique-constraint-to-call-id-up.sql
Kettering-General-Hospital/nhs-virtual-visit
dcbdaf017d8bf06f985eabd5c98b6f97fadb5921
[ "MIT" ]
null
null
null
ALTER TABLE scheduled_calls_table ADD CONSTRAINT call_id_unique UNIQUE (call_id);
81
81
0.876543
7b680e2716c6eca61c8e7e43ad576b44cc9e00d8
1,222
rb
Ruby
test/controllers/prizes_controller_test.rb
music4mic2/dashboard
96973f174f805fcd7617ddb5d6c7e7d1a0527006
[ "Apache-2.0" ]
18
2019-11-18T23:59:03.000Z
2020-12-12T17:15:03.000Z
test/controllers/prizes_controller_test.rb
music4mic2/dashboard
96973f174f805fcd7617ddb5d6c7e7d1a0527006
[ "Apache-2.0" ]
115
2019-10-24T00:03:48.000Z
2022-03-30T22:16:18.000Z
test/controllers/prizes_controller_test.rb
music4mic2/dashboard
96973f174f805fcd7617ddb5d6c7e7d1a0527006
[ "Apache-2.0" ]
21
2019-11-02T19:20:52.000Z
2022-02-09T17:30:34.000Z
require 'test_helper' class PrizesControllerTest < ActionDispatch::IntegrationTest setup do @prize = prizes(:one) end test "should get index" do get prizes_url assert_response :success end test "should get new" do get new_prize_url assert_response :success end test "should create prize" do assert_difference('Prize.count') do post prizes_url, params: { prize: { criteria: @prize.criteria, description: @prize.description, name: @prize.name, priority: @prize.priority, sponsor: @prize.sponsor } } end assert_redirected_to prize_url(Prize.last) end test "should show prize" do get prize_url(@prize) assert_response :success end test "should get edit" do get edit_prize_url(@prize) assert_response :success end test "should update prize" do patch prize_url(@prize), params: { prize: { criteria: @prize.criteria, description: @prize.description, name: @prize.name, priority: @prize.priority, sponsor: @prize.sponsor } } assert_redirected_to prize_url(@prize) end test "should destroy prize" do assert_difference('Prize.count', -1) do delete prize_url(@prize) end assert_redirected_to prizes_url end end
24.938776
181
0.710311
38614c5809f91d2d9b6a0f4f77a25e00f7e2ae3a
280
php
PHP
Modules/Subscriptions/Entities/CustomSubscription.php
balajiks/embasecloud
39c8fb63df8a05125e836fb930d17289fda55946
[ "MIT" ]
1
2020-05-13T09:50:54.000Z
2020-05-13T09:50:54.000Z
Modules/Subscriptions/Entities/CustomSubscription.php
balajiks/embasecloud
39c8fb63df8a05125e836fb930d17289fda55946
[ "MIT" ]
2
2020-07-17T10:55:34.000Z
2021-05-06T19:04:53.000Z
Modules/Subscriptions/Entities/CustomSubscription.php
balajiks/embasecloud
39c8fb63df8a05125e836fb930d17289fda55946
[ "MIT" ]
2
2020-05-13T09:51:02.000Z
2021-05-22T16:09:16.000Z
<?php namespace Modules\Subscriptions\Entities; use Laravel\Cashier\Subscription; class CustomSubscription extends Subscription { protected $dates = [ 'trial_ends_at', 'ends_at', 'created_at', 'updated_at', ]; protected $table = 'subscriptions'; }
17.5
45
0.685714
85893c036f84add91a9c27f556b9ea0303b7a412
1,003
sql
SQL
database/Database/Database/Tables/card_history.sql
thluiz/sam-apinode
adaba659adcd59e391c721bdfeafe9f6252a5188
[ "MIT" ]
null
null
null
database/Database/Database/Tables/card_history.sql
thluiz/sam-apinode
adaba659adcd59e391c721bdfeafe9f6252a5188
[ "MIT" ]
null
null
null
database/Database/Database/Tables/card_history.sql
thluiz/sam-apinode
adaba659adcd59e391c721bdfeafe9f6252a5188
[ "MIT" ]
null
null
null
CREATE TABLE [dbo].[card_history] ( [id] INT IDENTITY (1, 1) NOT NULL, [card_id] INT NOT NULL, [created_on] DATETIME DEFAULT (getUTCdate()) NOT NULL, [responsible_id] INT NOT NULL, [history_type] INT NOT NULL, [description] NVARCHAR (MAX) NULL, [created_during_card_id] INT NULL, [new_step_id] INT NULL, [new_parent_id] INT NULL, PRIMARY KEY CLUSTERED ([id] ASC), CONSTRAINT [fk_card_history_card] FOREIGN KEY ([card_id]) REFERENCES [dbo].[card] ([id]), CONSTRAINT [fk_card_history_type] FOREIGN KEY ([history_type]) REFERENCES [dbo].[enum_card_history_type] ([id]), CONSTRAINT [fk_card_history_user] FOREIGN KEY ([responsible_id]) REFERENCES [dbo].[person] ([id]) ); GO CREATE NONCLUSTERED INDEX [ix_card_history_card] ON [dbo].[card_history]([card_id] ASC);
38.576923
116
0.570289
af880f4fe1910c7508f4ea3a9481e6b468976821
1,178
py
Python
migrations/versions/5db306adc6cc_.py
di/cabotage-app
a119800ce5a83547c0abf31540bd0bc90a0e6d10
[ "MIT" ]
15
2018-04-12T20:57:25.000Z
2022-02-25T01:51:58.000Z
migrations/versions/5db306adc6cc_.py
di/cabotage-app
a119800ce5a83547c0abf31540bd0bc90a0e6d10
[ "MIT" ]
10
2018-01-30T19:55:06.000Z
2021-06-15T21:54:17.000Z
migrations/versions/5db306adc6cc_.py
di/cabotage-app
a119800ce5a83547c0abf31540bd0bc90a0e6d10
[ "MIT" ]
6
2018-01-30T10:49:17.000Z
2022-02-25T01:51:59.000Z
"""empty message Revision ID: 5db306adc6cc Revises: a645df168b55 Create Date: 2018-03-18 21:34:57.446692 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '5db306adc6cc' down_revision = 'a645df168b55' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('hooks', sa.Column('commit_sha', sa.String(length=256), nullable=True)) op.create_index(op.f('ix_hooks_commit_sha'), 'hooks', ['commit_sha'], unique=False) op.add_column('hooks_version', sa.Column('commit_sha', sa.String(length=256), autoincrement=False, nullable=True)) op.create_index(op.f('ix_hooks_version_commit_sha'), 'hooks_version', ['commit_sha'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_hooks_version_commit_sha'), table_name='hooks_version') op.drop_column('hooks_version', 'commit_sha') op.drop_index(op.f('ix_hooks_commit_sha'), table_name='hooks') op.drop_column('hooks', 'commit_sha') # ### end Alembic commands ###
33.657143
118
0.716469
e23280e1e0dca930862bb25cbb1b86ca01361894
3,036
py
Python
MindLink-Eumpy/real_time_detection/GUI/Reader/EEGReader.py
Breeze1in1drizzle/MindLink-Exploring
24e7d60112754c9fe5faf7b7f9ae255fa1bc4c59
[ "MIT" ]
7
2020-11-19T14:34:50.000Z
2022-02-26T14:16:50.000Z
MindLink-Eumpy/real_time_detection/GUI/Reader/EEGReader.py
Breeze1in1drizzle/MindLink-Exploring
24e7d60112754c9fe5faf7b7f9ae255fa1bc4c59
[ "MIT" ]
1
2021-08-20T07:30:32.000Z
2021-09-01T07:20:14.000Z
MindLink-Eumpy/real_time_detection/GUI/Reader/EEGReader.py
Breeze1in1drizzle/MindLink-Exploring
24e7d60112754c9fe5faf7b7f9ae255fa1bc4c59
[ "MIT" ]
2
2021-07-20T08:59:14.000Z
2021-08-10T08:03:56.000Z
import mne import numpy as np from real_time_detection.EEG import EEG_feature_extract from real_time_detection.GUI.EmotivDeviceReader import EmotivDeviceReader # emotiv_reader = EmotivDeviceReader() # class EEGReader class EEGReader: ''' This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features. ''' def __init__(self, input_type, file_path=None): ''' Arguments: input_type: 'file' indicates that the stream is from file. In other case, the stream will from the 'Emotiv insight' device. ''' self.emotiv_reader = EmotivDeviceReader() self.emotiv_reader.start() self.input_type = input_type if self.input_type == 'file': self.raw_EEG_obj = mne.io.read_raw_fif(file_path, preload=True) max_time = self.raw_EEG_obj.times.max() self.raw_EEG_obj.crop(28, max_time) self.raw_EEG_obj self.timestamp = 0. cal_raw = self.raw_EEG_obj.copy() cal_raw = EEG_feature_extract.add_asymmetric(cal_raw) self.features = EEG_feature_extract.extract_average_psd_from_a_trial(cal_raw, 1, 0.) else: # TODO: read EEG from devic self.timestamp = 0. pass def get_EEG_data(self): ''' Return: EEG data: the EEG data timestamp: the current timestamp ''' ''' ValueError: cannot reshape array of size 0 into shape (0,5,newaxis) ''' if self.input_type == 'file': sub_raw_obj = self.raw_EEG_obj.copy().crop(self.timestamp, self.timestamp + 1.) self.timestamp += 1. show_raw_obj = sub_raw_obj.copy().pick_channels(['AF3', 'AF4', 'T7', 'T8', 'Pz']) return show_raw_obj.get_data(), self.timestamp - 1., None else: self.timestamp += 1. data_list = self.emotiv_reader.get_data() PSD_feature = np.array(data_list) PSD_feature = PSD_feature.reshape(PSD_feature.shape[0], 5, -1) # error ''' error: line 236, in get_EEG_data PSD_feature = PSD_feature.reshape(PSD_feature.shape[0], 5, -1) ValueError: cannot reshape array of size 0 into shape (0,5,newaxis) ''' # raw_EEG = np.mean(PSD_feature, axis = 2) raw_EEG = PSD_feature[:, :, 4] raw_EEG_fill = np.zeros((257, 5)) for i in range(raw_EEG.shape[0]): start = i * (int(257 / raw_EEG.shape[0])) end = (i + 1) * (int(257 / raw_EEG.shape[0])) if i != raw_EEG.shape[0] - 1 else raw_EEG_fill.shape[0] raw_EEG_fill[start:end, :] = raw_EEG[i] return raw_EEG_fill.T, self.timestamp - 1., PSD_feature # class EEGReader
37.02439
117
0.581357
ff806612b7e43683fc0781a699632f44472acb74
370
py
Python
sample.py
leeamen/threadpool
736ab61afaabbe5ec96098c456043b03cf62bcd7
[ "MIT" ]
3
2019-01-26T08:35:46.000Z
2021-12-17T06:39:52.000Z
sample.py
leeamen/threadpool
736ab61afaabbe5ec96098c456043b03cf62bcd7
[ "MIT" ]
null
null
null
sample.py
leeamen/threadpool
736ab61afaabbe5ec96098c456043b03cf62bcd7
[ "MIT" ]
2
2017-04-22T04:11:43.000Z
2021-08-12T08:44:46.000Z
#!/usr/bin/python #coding:utf-8 import mylog import mythreadpool as tp import logging if __name__ == '__main__': logger = logging.getLogger(__name__) def process(args): logger.info('task %d is finished!', args['taskid']) threadpool = tp.MyThreadPool(2) for i in range(1,10): threadpool.DispatchTask(process, {'taskid':i}) threadpool.Destroy()
19.473684
55
0.694595
db412fe3a3c151e7eddedc3d5a19a53ca0cb3f2f
14,242
sql
SQL
mymarket.sql
alexistdev/kelompok8
5b71e41965ec84d022b0aeab91e437f82b783c42
[ "MIT" ]
null
null
null
mymarket.sql
alexistdev/kelompok8
5b71e41965ec84d022b0aeab91e437f82b783c42
[ "MIT" ]
null
null
null
mymarket.sql
alexistdev/kelompok8
5b71e41965ec84d022b0aeab91e437f82b783c42
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 5.1.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jan 10, 2022 at 01:09 AM -- Server version: 10.4.21-MariaDB -- PHP Version: 8.0.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `mymarket` -- -- -------------------------------------------------------- -- -- Table structure for table `detailtransaksis` -- CREATE TABLE `detailtransaksis` ( `id` bigint(20) UNSIGNED NOT NULL, `transaksi_id` bigint(20) UNSIGNED NOT NULL, `produk_id` bigint(20) UNSIGNED NOT NULL, `jumlah` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `detailtransaksis` -- INSERT INTO `detailtransaksis` (`id`, `transaksi_id`, `produk_id`, `jumlah`, `created_at`, `updated_at`) VALUES (3, 3, 3, 3, '2022-01-09 15:36:25', '2022-01-09 16:28:02'), (5, 4, 3, 1, '2022-01-09 16:42:32', '2022-01-09 16:42:32'); -- -------------------------------------------------------- -- -- Table structure for table `failed_jobs` -- CREATE TABLE `failed_jobs` ( `id` bigint(20) UNSIGNED NOT NULL, `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `failed_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `kategoris` -- CREATE TABLE `kategoris` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `kategoris` -- INSERT INTO `kategoris` (`id`, `name`, `created_at`, `updated_at`) VALUES (1, 'sepatu2', '2022-01-09 06:27:17', '2022-01-09 07:17:16'), (2, 'baju2', '2022-01-09 06:27:17', '2022-01-09 07:17:25'); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2019_08_19_000000_create_failed_jobs_table', 1), (4, '2019_12_14_000001_create_personal_access_tokens_table', 1), (5, '2022_01_09_123530_create_roles_table', 1), (6, '2022_01_09_125700_create_kategoris_table', 1), (7, '2022_01_09_130044_create_tokos_table', 1), (8, '2022_01_09_153521_create_produks_table', 2), (9, '2022_01_09_221522_create_transaksis_table', 3), (10, '2022_01_09_221654_create_detailtransaksis_table', 3); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `personal_access_tokens` -- CREATE TABLE `personal_access_tokens` ( `id` bigint(20) UNSIGNED NOT NULL, `tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `tokenable_id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `abilities` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `last_used_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `produks` -- CREATE TABLE `produks` ( `id` bigint(20) UNSIGNED NOT NULL, `kategori_id` bigint(20) UNSIGNED NOT NULL, `toko_id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `satuan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `gambar` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `harga` int(11) NOT NULL, `deskripsi` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `produks` -- INSERT INTO `produks` (`id`, `kategori_id`, `toko_id`, `name`, `satuan`, `gambar`, `harga`, `deskripsi`, `created_at`, `updated_at`) VALUES (3, 1, 1, 'Sepatu Cantik', 'PCS', 'g3YmUCXKG7Otq5AbDzjjoHuzPDkzLMQSF8NFeCkI.jpg', 25000, ' but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets', '2022-01-09 09:23:07', '2022-01-09 09:23:07'); -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE `roles` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `roles` -- INSERT INTO `roles` (`id`, `name`, `created_at`, `updated_at`) VALUES (1, 'admin', '2022-01-09 06:27:16', '2022-01-09 06:27:16'), (2, 'toko', '2022-01-09 06:27:16', '2022-01-09 06:27:16'), (3, 'user', '2022-01-09 06:27:16', '2022-01-09 06:27:16'); -- -------------------------------------------------------- -- -- Table structure for table `tokos` -- CREATE TABLE `tokos` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` bigint(20) UNSIGNED NOT NULL, `nohp` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `alamat` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `logo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `ktp` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `tokos` -- INSERT INTO `tokos` (`id`, `name`, `user_id`, `nohp`, `alamat`, `logo`, `ktp`, `created_at`, `updated_at`) VALUES (1, 'Toko Maju1', 2, '081234561', 'Jl.Bendungan Wayhalim Bandarlampung1', NULL, 'adada', '2022-01-09 06:27:17', '2022-01-09 08:20:39'), (3, 'adada', 4, 'adada', 'dadadad', NULL, 'adada', '2022-01-09 08:23:05', '2022-01-09 08:23:05'); -- -------------------------------------------------------- -- -- Table structure for table `transaksis` -- CREATE TABLE `transaksis` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED NOT NULL, `kode` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `total` int(11) NOT NULL DEFAULT 0, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `transaksis` -- INSERT INTO `transaksis` (`id`, `user_id`, `kode`, `total`, `created_at`, `updated_at`) VALUES (3, 3, 'eihFa9aVr6', 25000, '2022-01-09 15:36:25', '2022-01-09 16:40:31'), (4, 3, '4Ioi8ObNrQ', 25000, '2022-01-09 16:42:32', '2022-01-09 16:43:36'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `role_id` int(10) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `role_id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 1, 'admin', 'admin@gmail.com', NULL, '$2y$10$3NDOYomOiWU3tdn7PX5PKORzJAWYf79eQG9ENs9eqZSpVD6AN7uYu', NULL, '2022-01-09 06:27:16', '2022-01-09 06:27:16'), (2, 2, 'toko', 'toko@gmail.com', NULL, '$2y$10$U9yPdRjUm2RABytlK1SQuu1Uf4/huCydkFI6i3hpCg1.yN4rWCTGq', NULL, '2022-01-09 06:27:16', '2022-01-09 06:27:16'), (3, 3, 'user', 'user@gmail.com', NULL, '$2y$10$PyDAgJsJErFqMJBguaAJ9Ogj/iNR7iQh0x82fitB54BAOVMc/Pu1O', NULL, '2022-01-09 06:27:16', '2022-01-09 06:27:16'), (4, 2, 'toko2', 'toko2@gmail.com', NULL, '$2y$10$U9yPdRjUm2RABytlK1SQuu1Uf4/huCydkFI6i3hpCg1.yN4rWCTGq', NULL, '2022-01-09 06:27:16', '2022-01-09 06:27:16'); -- -- Indexes for dumped tables -- -- -- Indexes for table `detailtransaksis` -- ALTER TABLE `detailtransaksis` ADD PRIMARY KEY (`id`), ADD KEY `detailtransaksis_transaksi_id_foreign` (`transaksi_id`), ADD KEY `detailtransaksis_produk_id_foreign` (`produk_id`); -- -- Indexes for table `failed_jobs` -- ALTER TABLE `failed_jobs` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`); -- -- Indexes for table `kategoris` -- ALTER TABLE `kategoris` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `personal_access_tokens` -- ALTER TABLE `personal_access_tokens` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`), ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`); -- -- Indexes for table `produks` -- ALTER TABLE `produks` ADD PRIMARY KEY (`id`), ADD KEY `produks_kategori_id_foreign` (`kategori_id`), ADD KEY `produks_toko_id_foreign` (`toko_id`); -- -- Indexes for table `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tokos` -- ALTER TABLE `tokos` ADD PRIMARY KEY (`id`), ADD KEY `tokos_user_id_foreign` (`user_id`); -- -- Indexes for table `transaksis` -- ALTER TABLE `transaksis` ADD PRIMARY KEY (`id`), ADD KEY `transaksis_user_id_foreign` (`user_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `detailtransaksis` -- ALTER TABLE `detailtransaksis` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `failed_jobs` -- ALTER TABLE `failed_jobs` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `kategoris` -- ALTER TABLE `kategoris` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `personal_access_tokens` -- ALTER TABLE `personal_access_tokens` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `produks` -- ALTER TABLE `produks` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `roles` -- ALTER TABLE `roles` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `tokos` -- ALTER TABLE `tokos` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `transaksis` -- ALTER TABLE `transaksis` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- Constraints for dumped tables -- -- -- Constraints for table `detailtransaksis` -- ALTER TABLE `detailtransaksis` ADD CONSTRAINT `detailtransaksis_produk_id_foreign` FOREIGN KEY (`produk_id`) REFERENCES `produks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `detailtransaksis_transaksi_id_foreign` FOREIGN KEY (`transaksi_id`) REFERENCES `transaksis` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `produks` -- ALTER TABLE `produks` ADD CONSTRAINT `produks_kategori_id_foreign` FOREIGN KEY (`kategori_id`) REFERENCES `kategoris` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `produks_toko_id_foreign` FOREIGN KEY (`toko_id`) REFERENCES `tokos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `tokos` -- ALTER TABLE `tokos` ADD CONSTRAINT `tokos_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `transaksis` -- ALTER TABLE `transaksis` ADD CONSTRAINT `transaksis_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
32.004494
287
0.69618
38d679794c358c950d26e994d7f5834d716d75bf
10,256
php
PHP
resources/views/md/mAmenazas.blade.php
fparralejo/q_sgsi
5217f5dacd75f326f619f176ea38a6cebc9be0ed
[ "MIT" ]
null
null
null
resources/views/md/mAmenazas.blade.php
fparralejo/q_sgsi
5217f5dacd75f326f619f176ea38a6cebc9be0ed
[ "MIT" ]
null
null
null
resources/views/md/mAmenazas.blade.php
fparralejo/q_sgsi
5217f5dacd75f326f619f176ea38a6cebc9be0ed
[ "MIT" ]
null
null
null
@extends('md.main') @section('principal') <style> .sgsiRow:hover{ cursor: pointer; } </style> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#ejemplo1').dataTable({ "responsive": true, "bProcessing": true, "sPaginationType":"full_numbers", "oLanguage": { "sLengthMenu": "Ver _MENU_ registros por pagina", "sZeroRecords": "No se han encontrado registros", "sInfo": "Ver _START_ al _END_ de _TOTAL_ Registros", "sInfoEmpty": "Ver 0 al 0 de 0 registros", "sInfoFiltered": "(filtrados _MAX_ total registros)", "sSearch": "Busqueda:" }, "bSort":true, "aaSorting": [[ 0, "asc" ]], "aoColumns": [ { "sType": 'string' }, { "sType": 'string' }, { "sType": 'string' }, { "sType": 'string' }, { "sType": 'string' }, { "sType": 'none' } ], "bJQueryUI":true, "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "Todos"]] }); } ); function leerAmenaza(Id){ $.ajax({ data:{"Id":Id}, url: '{{ URL::asset("md/mAmenazas/show") }}', type:"get", success: function(data) { var amenaza = JSON.parse(data); $('#IdAmenaza').val(amenaza.IdAmenaza); $('#Nombre').val(amenaza.Nombre); $('#Categoria').val(amenaza.Categoria); $('#Degradacion').val(amenaza.Degradacion); $('#Frecuencia').val(amenaza.Frecuencia); $('#Descripcion').val(amenaza.Descripcion); comprobarCheck(amenaza.D,D); comprobarCheck(amenaza.S,S); comprobarCheck(amenaza.SW,SW); comprobarCheck(amenaza.HW,HW); comprobarCheck(amenaza.COM,COM); comprobarCheck(amenaza.SI,SI); comprobarCheck(amenaza.AUX,AUX); comprobarCheck(amenaza.L,L); comprobarCheck(amenaza.P,P); //cambiar nombre del titulo del formulario $("#tituloForm").html('Editar Datos'); $("#submitir").val('OK'); $("#Id").val(amenaza.Id); } }); } function comprobarCheck(amenaza,check){ if(amenaza === "1"){ $(check).prop('checked',true); }else{ $(check).prop('checked',false); } } function borrarAmenaza(Id){ if (confirm("¿Desea borrar la amenaza?")) { $.ajax({ data:{"Id":Id}, url: '{{ URL::asset("md/mAmenazas/delete") }}', type:"get", success: function(data) { $('#accionTabla').html(data); $('#accionTabla').show(); } }); setTimeout(function () { document.location.href="{{URL::to('md/mAmenazas')}}"; }, 1000); } } //hacer desaparecer en cartel $(document).ready(function() { setTimeout(function() { $("#accionTabla2").fadeOut(1500); },3000); }); </script> <h3>M. de Amenazas</h3> <!-- aviso de alguna accion --> <div class="alert alert-success" role="alert" id="accionTabla" style="display: none; "> </div> @if (Session::has('errors')) <div class="alert alert-success" id="accionTabla2" role="alert" style="display: block; "> {{ $errors }} </div> @endif <table id="ejemplo1" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%"> <thead> <tr> <th>IdAmenaza</th> <th>Nombre</th> <th>Categoria</th> <th>Degradación</th> <th>Frecuencia</th> <th></th> </tr> </thead> <tbody> @foreach ($listado as $amenaza) <?php //carga los datos en el formulario para editarlos $url="javascript:leerAmenaza('$amenaza->Id');"; ?> <tr> <td class="sgsiRow" onClick="{{ $url }}">{{ $amenaza->IdAmenaza }}</td> <td class="sgsiRow" onClick="{{ $url }}">{{ $amenaza->Nombre }}</td> <td class="sgsiRow" onClick="{{ $url }}">{{ $amenaza->Categoria }}</td> <td class="sgsiRow" onClick="{{ $url }}">{{ $amenaza->Degradacion }}</td> <td class="sgsiRow" onClick="{{ $url }}">{{ $amenaza->Frecuencia }}</td> <td> <button type="button" onclick="borrarAmenaza({{$amenaza->Id}})" class="btn btn-xs btn-danger">Borrar</button> </td> </tr> @endforeach </tbody> </table> <hr/> <h3><span id="tituloForm">Nuevos Datos</span></h3> <br/> <style type="text/css"> #productForm .inputGroupContainer .form-control-feedback, #productForm .selectContainer .form-control-feedback { top: 0; right: -15px; } </style> <form role="form" class="form-horizontal" id="productForm" name="productForm" action="{{ URL::asset('md/mAmenazas') }}" method="post"> <!-- CSRF Token --> <input type="hidden" name="_token" value="{{ csrf_token() }}"> <div class="row"> <div class="col-md-2"> <div class="form-group"> <label for="IdAmenaza">IdAmenaza:</label><input type="text" class="form-control" id="IdAmenaza" name="IdAmenaza" maxlength="3"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="Nombre">Nombre:</label><input type="text" class="form-control" id="Nombre" name="Nombre" maxlength="255"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <label for="Categoria">Categoria</label> <select class="form-control" id="Categoria" name="Categoria"> @foreach ($listCatAmenaza as $categoria) <option value="{{ $categoria->IdCatAmenaza }}">{{ $categoria->Nombre }}</option> @endforeach </select> </div> </div> <br/> <div class="row"> <div class="col-md-6"> <label for="Degradacion">Degradacion</label> <select class="form-control" id="Degradacion" name="Degradacion"> @foreach ($listDegradacion as $degradacion) <option value="{{ $degradacion->IdDegradacion }}">{{ $degradacion->ValorDegradacion }} - {{ $degradacion->Descripcion }}</option> @endforeach </select> </div> </div> <br/> <div class="row"> <div class="col-md-6"> <label for="Frecuencia">Frecuencia</label> <select class="form-control" id="Frecuencia" name="Frecuencia"> @foreach ($listFrecuencia as $frecuencia) <option value="{{ $frecuencia->IdFrecuencia }}">{{ $frecuencia->Frecuencia }} - {{ $frecuencia->DescripcionLarga }}</option> @endforeach </select> </div> </div> <br/> <br/> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="Descripcion">Descripción:</label> <textarea class="form-control" rows="2" name="Descripcion" id="Descripcion"></textarea> </div> </div> </div> <div class="row"> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="D" id="D">D</label> </div> </div> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="S" id="S">S</label> </div> </div> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="SW" id="SW">SW</label> </div> </div> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="HW" id="HW">HW</label> </div> </div> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="COM" id="COM">COM</label> </div> </div> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="SI" id="SI">SI</label> </div> </div> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="AUX" id="AUX">AUX</label> </div> </div> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="L" id="L">L</label> </div> </div> <div class="col-md-1 jumbotron"> <div class="checkbox-inline"> <label><input type="checkbox" name="P" id="P">P</label> </div> </div> </div> <input type="hidden" id="Id" name="Id" value="" /> <input type="submit" id="submitir" class="btn btn-default" value="Nuevo"/> </form> <script> $(document).ready(function() { $('#productForm').formValidation({ framework: 'bootstrap', icon: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { IdAmenaza: { validators: { notEmpty: { message: 'El IdAmenaza es requerido' }, numeric: { message: 'El IdAmenaza tiene que ser un valor numérico' } } }, Nombre: { validators: { notEmpty: { message: 'El Nombre es requerido' } } } } }); }); </script> @stop
32.15047
146
0.4883
7b39ca198de4ddfdee6f18d7961d96885a66ab59
3,541
rb
Ruby
lib/csv2avro/converter.rb
sspinc/csv2avro
33d347744d5ce974ca2bd95b7675a00ed2f80174
[ "MIT" ]
10
2015-08-07T10:41:02.000Z
2021-12-15T06:25:46.000Z
lib/csv2avro/converter.rb
sspinc/csv2avro
33d347744d5ce974ca2bd95b7675a00ed2f80174
[ "MIT" ]
13
2015-06-12T08:12:15.000Z
2016-02-16T15:45:52.000Z
lib/csv2avro/converter.rb
sspinc/csv2avro
33d347744d5ce974ca2bd95b7675a00ed2f80174
[ "MIT" ]
6
2015-06-25T17:32:21.000Z
2020-07-30T07:08:20.000Z
require 'csv2avro/schema' require 'csv2avro/avro_writer' require 'csv' require 'logr' class CSV2Avro class Converter def self.logger @logger ||= Logr::Logger.new('csv2avro.converter') end def logger self.class.logger end def initialize(reader, writer, bad_rows_writer, filename, options, schema: schema) @reader = reader @writer = writer @bad_rows_writer = bad_rows_writer @filename = filename @options = options @schema = schema # read header row explicitly @header = @reader.readline.strip.split(col_sep).map{ |col| col.gsub('"','') } end def convert while not csv.eof? do begin row = csv.shift rescue CSV::MalformedCSVError error_msg = "L#{row_number}: Unable to parse" logger.event('parse_error', filename: @filename, line: row_number) .error(error_msg) @bad_rows_writer.puts(error_msg) next end hash = row.to_hash add_defaults_to_hash!(hash) if @options[:write_defaults] convert_fields!(hash) begin @writer.write(hash) rescue CSV2Avro::SchemaValidationError => e error_msg = "L#{row_number}: #{e.errors.join(', ')}" e.errors.each do |error| logger.event('schema_violation', filename: @filename, line: row_number, cause: error) .error(error_msg) end @bad_rows_writer.puts(error_msg) end end @writer.flush row_number end private def array_delimiter @options[:array_delimiter] || ',' end def col_sep @options[:delimiter] || ',' end def row_sep @options[:line_ending] || :auto end def csv_options { col_sep: col_sep, row_sep: row_sep, headers: @header, header_converters: :aliases, skip_blanks: true, write_headers: true } end def csv # Initialize header converter CSV::HeaderConverters[:aliases] = lambda do |header| @schema.aliases[header] || header end @csv ||= CSV.new(@reader, csv_options) end def row_number @reader.lineno + 1 end def add_defaults_to_hash!(hash) # Add default values to empty/missing fields @schema.defaults.each do |key, value| hash[key] = @schema.defaults[key] if hash[key].nil? or !hash.has_key?(key) end end def convert_fields!(hash) @schema.types.each do |key, value| hash[key] = begin case value when :int Integer(hash[key]) when :float, :double Float(hash[key]) when :boolean parse_boolean(hash[key]) when :array parse_array(hash[key]) when :enum hash[key].downcase.tr(" ", "_") else hash[key] end rescue hash[key] end end end def parse_boolean(value) case when value == true || value =~ (/^(true|t|yes|y|1)$/i) then true when value == false || value =~ (/^(false|f|no|n|0)$/i) then false else nil end end def parse_array(value) value.split(array_delimiter) if value end end end
25.113475
97
0.532053
07e3720e54855e7800ef21d5e6984137d8307094
6,761
css
CSS
templates/admin.css
sudogem/brcms
6229e0659a4c2d99e41c7d53a676a628cab0fdff
[ "MIT" ]
null
null
null
templates/admin.css
sudogem/brcms
6229e0659a4c2d99e41c7d53a676a628cab0fdff
[ "MIT" ]
1
2015-12-01T09:15:03.000Z
2015-12-01T09:15:03.000Z
templates/admin.css
sudogem/brcms
6229e0659a4c2d99e41c7d53a676a628cab0fdff
[ "MIT" ]
null
null
null
body { margin:0 0 0 0; font:normal 12px Verdana, Arial, Helvetica, sans-serif; } p{ font:normal 12px Verdana, Arial, Helvetica, sans-serif; line-height:2em; } #header{ background-color: #99CC00; height:50px; } .table_header{ background-color:#2A28B2; background-color:#E66836; background-color:#96C56F; color:#FFFFFF; font:bold 12px Verdana, Arial, Helvetica, sans-serif; } .ctable{ xborder:1px solid #ccc; background-color:#fff; } .tdcaptions{ font:bold 12px Verdana, Arial, Helvetica, sans-serif; border-top: 4px solid #80B5D7; border-top: 4px solid #FBB11A; border-top: 4px solid #FFFFF0; xborder-bottom: 2px solid #2DA3C5; } .tdhover:hover{ background-color:#eee; } a{ text-decoration:none; } a:hover{ text-decoration:underline; color:#0066FF; } #topnav { background-color:#CCCCCC; float: left; width:100%; } #sidenav { float:left; width:14%; } #navlist li{ display: inline; /* for IE5 and IE6 */ } #navlist{ font-family: sans-serif; margin: 0px 0px 0px 0px; padding: 0px; } #navlist a{ display: block; xbackground-color: #E8E8E8; border-top: 2px solid #fff; text-align: left; padding-left: 10px; text-decoration: none; color: #000000; font: normal 12px Verdana, Arial, Helvetica, sans-serif; line-height: 20px; } #navlist a:hover { background-color: #3F2E2E; color:#FFFFFF; } #navlist a:visited { } #toolbar li{ display:block; } #toolbar { font-family: sans-serif; margin: 0px 0px 0px 0px; padding: 0px; } #toolbar a { display: block; xbackground-color: #E8E8E8; border-top: 2px solid #fff; text-align: left; padding-left: 10px; text-decoration: none; color: #000000; font: normal 12px Verdana, Arial, Helvetica, sans-serif; line-height: 20px; } #toolbar a:hover { background-color: #3F2E2E; color:#FFFFFF; } #content{ float:left; width: 85%; margin-left:20px; border:px solid red; margin:0; } #outerpanel{ padding:5px; border:1px solid #CCC; } #innerpanel{ border:1px solid #CCC; } #panel { padding-left:10px; margin:0 0 0 0; padding:2px; } #tablebgcolor{ background-color: #F5F5F5; } #toolbar_panel{ float:left; margin:0 0 0 0; xbackground-color: #f5f5f5; border-bottom: 1px solid #CCC; width:100%; } #toolbar_btn{ float:right; display:inline; margin-left:10px; margin-right:10px; text-decoration:none; } #toolbar_btn a{ text-decoration:none; } .clear{ clear:both; } #footer { background-color:#333333; } /*------------------------------------------------- Template sections -------------------------------------------------*/ #template{ width: 100%; float:left; margin:0px auto; padding: 0px; /*border: 2px solid black;*/ } #template h1{ font: 12px normal Verdana, Arial, Helvetica, sans-serif; /*background-image:url(admin/images/current.jpg) no-repeat;*/ } #templateSection{ margin:0px auto; zpadding: 30px 40px 30px 10px; background-color: #E6E9DC; padding-top: 20px; padding-bottom:0; text-align:left; /*border: 2px dotted red;*/ } #templateSection h1{ margin:0px auto; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:16px; } #templateSection p{ margin:0px auto; font:16px normal Verdana, Arial, Helvetica, sans-serif; } #currentTemplate{ padding-left: 35%; } #browseTemplate{ width: 100%; margin:0px auto; } .templateDetails{ width:300px; padding: 2px; margin: 5px 5px 5px 5px; background-color:#CCCCCC; } .quickJumpNav{ float: right; padding-right:50px; padding-left: 50px; } #templateThumbnail{ text-align: center; float: left; /*border: 2px dotted red;*/ padding: 10px; margin: 0 20px 30px 25px; } #templateThumbnail2{ text-align: center; float: left; /*border: 1px dotted red;*/ padding: 10px; } #thumbnailbody{ text-align: center; padding-bottom: 10px; border: px dotted white; } .center{ text-align:center; } #thumbnailbody h1{ text-align:left; } #thumbnailbody h2{ margin:0px auto; font-family:Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight:lighter; text-align:left; } .thumbnail{ text-align: center; border: 2px solid #E5E1CF; background-color: #B1BDAC; border-top: 1px solid white; border-left: 1px solid white; border-right: 2px solid gray; border-bottom: 2px solid gray; width : 200px; padding: 10px 2px 10px 2px ; } .preview{ border: 2px solid red; background:url(admin/images/preview.gif) no-repeat; z-index: 100; } .currentTemplateIcon{ float:left; background-image:url(admin/images/current.jpg); } .btnUseTemplate { width: 193px; font-size: 14px; background-color:#006699; color: #FFFFFF; border-top: 1px solid #D4D2CF; border-left: 1px solid #D4D2CF; border-bottom: 1px solid #868686; border-right : 1px solid #868686; margin: 10px 0 0 0; height: 30px; } .clear{ clear: both; } /* MY CLASSES ************************************************ */ .asterisk { color:#FF9E31; font:bold 17px Verdana, Arial, Helvetica, sans-serif; } .caption{ color:#000; font:bold 12px Arial, Helvetica, sans-serif; margin:0 0 0 0; } .msginfo { color:#FF9900; font:bold 14px Verdana, Arial, Helvetica, sans-serif; margin:0 0 0 0; text-align: center; } .data { color:#000; font:normal 12px Verdana, Arial, Helvetica, sans-serif; margin:0 0 0 0; } .smallwindow { width:100%; overflow:scroll; } /*------------------------------------------------- WYSIWYG EDITOR sections -------------------------------------------------*/ #editor { padding-left:20px; border:1px solid #D5D5D5; background-color:#F5F5F5; margin: 10px 0 0 10px; } /*------------------------------------------------- Forms Class: another ilad!!!! hehehhehe -------------------------------------------------*/ .formbutton { font-size: 20px; background: white; color: #494949; border-top: 1px solid #D4D2CF; border-left: 1px solid #D4D2CF; border-bottom: 1px solid #868686; border-right : 1px solid #868686; margin: 1px 5px 0 0; padding-left:2px; width:10%; float: right; } .formtextfield { background-color: #fff; font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #485F5F; margin: 5px 0px 0px 0px; padding: 2px; border:#E1D6c6 1px solid; max-width: 315px; } /* --- error found!! field is missing!! --- */ .missingfield{ color:#FF0000; font-size:12px; } .textboxgray { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #333333; background-color: #D5D4D4; border: 1px solid #999999; }
18.472678
70
0.626387